From 090819b136cc0903bf2ac25845c9b275ddbcba89 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 01 八月 2025 17:32:29 +0800
Subject: [PATCH] dataobjcreat而返回处理

---
 pages/modal/3018.vue |  313 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 197 insertions(+), 116 deletions(-)

diff --git a/pages/modal/3018.vue b/pages/modal/3018.vue
index 005fed8..c4285b8 100644
--- a/pages/modal/3018.vue
+++ b/pages/modal/3018.vue
@@ -1002,12 +1002,9 @@
 				//console.log(e.target)
 				getApp().onScan((result) => {
 					console.log(result);
-					this.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[
-							'iindex']]
-						.Value =
-						result.decodedata;
+					this.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = result;
 					uni.hideKeyboard();
-					this.onevent($ele, result.decodedata);
+					this.onevent($ele, result);
 				})
 			},
 			onarrow(index, open) {
@@ -1137,14 +1134,14 @@
 
 
 			},
-			onevent(e, decodedata) {
+			onevent(e, value) {
 				// console.log(e.target);
 				var data_attr = this.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[
 					'iindex']];
-				// console.log(decodedata);
+				// console.log(value);
 				if (e.detail.value != data_attr.Value) {
 					this.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value =
-						decodedata ? decodedata : e.detail.value;
+						value ? value : e.detail.value;
 					var eventid = this.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].action;
 					if (eventid) {
 						// self.event_no_sub = 1;
@@ -1550,46 +1547,48 @@
 						console.log(res);
 						uni.hideLoading();
 						let data = res.lua_result
-						if (data.ret != 0) {
-							var tip = data.err_info ? typeof data.err_info == 'string' ? data
-								.err_info :
-								data
-								.err_info.join('<br/>') : '';
-							if (data.ret == 801) uni.showModal({
-								title: this.translateSys('tip'),
-								content: tip,
-								showCancel: false,
-								confirmText: this.translateSys('close')
-							});
-							else uni.showModal({
-								title: this.translateSys('tip'),
-								content: tip + ',' + this.translateSys('tip') + ':' + data
-									.ret,
-								showCancel: false,
-								confirmText: this.translateSys('close')
-							});
-							return false
-						} else {
-							var tip = data.info ? typeof data.info == 'string' ? data.info : data
-								.info
-								.join(
-									'<br/>') : '';
-							if (tip) uni.showModal({
-								title: this.translateSys('tip'),
-								content: tip,
-								showCancel: false,
-								confirmText: this.translateSys('close')
-							});
-							uni.showToast({
-								title: this.translate('create_success'),
-								icon: "success",
-								duration: 3000
-							});
+						if (data) {
+							if (data.ret != 0) {
+								var tip = data.err_info ? typeof data.err_info == 'string' ? data
+									.err_info :
+									data
+									.err_info.join('<br/>') : '';
+								if (data.ret == 801) uni.showModal({
+									title: this.translateSys('tip'),
+									content: tip,
+									showCancel: false,
+									confirmText: this.translateSys('close')
+								});
+								else uni.showModal({
+									title: this.translateSys('tip'),
+									content: tip + ',' + this.translateSys('tip') + ':' + data
+										.ret,
+									showCancel: false,
+									confirmText: this.translateSys('close')
+								});
+								return false
+							} else {
+								var tip = data.info ? typeof data.info == 'string' ? data.info : data
+									.info
+									.join(
+										'<br/>') : '';
+								tip = tip || data.err_info
+								if (tip) uni.showModal({
+									title: this.translateSys('tip'),
+									content: tip,
+									showCancel: false,
+									confirmText: this.translateSys('close')
+								});
+								uni.showToast({
+									title: this.translate('create_success'),
+									icon: "success",
+									duration: 3000
+								});
+							}
+
+
+
 						}
-
-
-
-
 						//鍒锋柊
 						uni.redirectTo({
 							url: '../modal/3018?param=' + JSON.stringify(this.$data
@@ -1683,6 +1682,7 @@
 							.err_info :
 							data
 							.err_info.join('<br/>') : '';
+						tip = tip || data.err_info
 						if (data.ret == 801) uni.showModal({
 							title: this.translateSys('tip'),
 							content: tip,
@@ -1708,10 +1708,21 @@
 							showCancel: false,
 							confirmText: this.translateSys('close')
 						});
+						if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+							if (data.result_type == 2) {
 
-						if (data.action) {
-							var actionlist = data.action;
-							if (actionlist) {
+							} else if (typeof data.result == 'string') {
+								if (data.result) {
+									uni.showModal({
+										title: this.translateSys('tip'),
+										content: data.result,
+										showCancel: false,
+										confirmText: this.translateSys('close')
+									});
+								}
+							}
+							try {
+								var actionlist = data.action || []
 								for (var j = 0; j < actionlist.length; j++) {
 									var action = actionlist[j];
 									var action_type = action.action_type;
@@ -1738,6 +1749,19 @@
 
 									// }
 								}
+
+							} catch (ex) {
+								let actionList = (data.action || []).map(a => a.action_type).join(';')
+								let tip = typeof ex == 'string' ? ex : ex.message
+								tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+								uni.showModal({
+									title: this.translateSys('tip'),
+									content: tip,
+									showCancel: false,
+									confirmText: this.translateSys('close')
+								});
+								console.log(ex)
+								return
 							}
 						}
 					}
@@ -1829,6 +1853,7 @@
 							.err_info :
 							data
 							.err_info.join('<br/>') : '';
+						tip = tip || data.err_info
 						if (data.ret == 801) uni.showModal({
 							title: this.translateSys('tip'),
 							content: tip,
@@ -1848,55 +1873,80 @@
 							.info
 							.join(
 								'<br/>') : '';
+						tip = tip || result.err_info
 						if (tip) uni.showModal({
 							title: this.translateSys('tip'),
 							content: tip,
 							showCancel: false,
 							confirmText: this.translateSys('close')
 						});
+						if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+							if (data.result_type == 2) {
+								var result = data.result || []
+								for (var i = 0; i < result.length; i++) {
+									for (var c = 0; c < $this.classAttrList.length; c++) {
+										var attr = $this.classAttrList[c].Attr;
+										for (var j = 0; j < attr.length; j++) {
+											if (attr[j].Name == result[i].attr) {
+												attr[j].Value = result[i].value;
+											}
+										}
+									}
+									console.log($this.refdatastore)
+									var length = 0;
+									if (!$this.refdatastore.filter(function(s) {
+											return result[i].attr == s.attr
+										}).length) {
+										length = 1;
+										$this.refdatastore.push(result[i]);
+									}
+									if (length == 0) {
+										for (var j = 0; j < $this.refdatastore.length; j++) {
+											if ($this.refdatastore[j].attr == result[i]
+												.attr) {
+												$this.refdatastore[j].value = result[i]
+													.value;
+											}
+										}
+									}
+								}
 
-						var actionlist = data.action;
-						if (actionlist) {
-							console.log(actionlist);
-							for (var i = 0; i < actionlist.length; i++) {
-								var action = actionlist[i];
-								if (action.action_type == 'set_dlg_attr') {
-									var result = action.value;
-									this.setFormValues(action.value)
-								} else if (data.action[i].action_type == 'set_global_attr') {
-									$this.global_attr = data.action[i].value || [];
+							} else if (typeof data.result == 'string') {
+								if (data.result) {
+									uni.showModal({
+										title: this.translateSys('tip'),
+										content: data.result,
+										showCancel: false,
+										confirmText: this.translateSys('close')
+									});
 								}
 							}
-						}
-
-						if (data.result_type == 2 && data.result) {
-							var result = data.result;
-							for (var i = 0; i < result.length; i++) {
-								for (var c = 0; c < $this.classAttrList.length; c++) {
-									var attr = $this.classAttrList[c].Attr;
-									for (var j = 0; j < attr.length; j++) {
-										if (attr[j].Name == result[i].attr) {
-											attr[j].Value = result[i].value;
+							try {
+								var actionlist = data.action || [];
+								if (actionlist) {
+									console.log(actionlist);
+									for (var i = 0; i < actionlist.length; i++) {
+										var action = actionlist[i];
+										if (action.action_type == 'set_dlg_attr') {
+											var result = action.value;
+											this.setFormValues(action.value)
+										} else if (data.action[i].action_type == 'set_global_attr') {
+											$this.global_attr = data.action[i].value || [];
 										}
 									}
 								}
-								console.log($this.refdatastore)
-								var length = 0;
-								if (!$this.refdatastore.filter(function(s) {
-										return result[i].attr == s.attr
-									}).length) {
-									length = 1;
-									$this.refdatastore.push(result[i]);
-								}
-								if (length == 0) {
-									for (var j = 0; j < $this.refdatastore.length; j++) {
-										if ($this.refdatastore[j].attr == result[i]
-											.attr) {
-											$this.refdatastore[j].value = result[i]
-												.value;
-										}
-									}
-								}
+							} catch (ex) {
+								let actionList = (data.action || []).map(a => a.action_type).join(';')
+								let tip = typeof ex == 'string' ? ex : ex.message
+								tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+								uni.showModal({
+									title: this.translateSys('tip'),
+									content: tip,
+									showCancel: false,
+									confirmText: this.translateSys('close')
+								});
+								console.log(ex)
+								return
 							}
 						}
 					}
@@ -1998,6 +2048,7 @@
 								.err_info :
 								data
 								.err_info.join('<br/>') : '';
+							tip = tip || data.err_info
 							if (data.ret == 801) uni.showModal({
 								title: this.translateSys('tip'),
 								content: tip,
@@ -2017,36 +2068,49 @@
 								.info
 								.join(
 									'<br/>') : '';
+							tip = tip || data.err_info
 							if (tip) uni.showModal({
 								title: this.translateSys('tip'),
 								content: tip,
 								showCancel: false,
 								confirmText: this.translateSys('close')
 							});
-							if (data.result) {
-								var result = data.result;
-								console.log(this.refdatastore)
-								for (var i = 0; i < result.length; i++) {
-									// self.class_attr_ele.find('.attr_field[data-field="' + result[i].attr + '"]').val(result[i].value).data('val', result[i].value);
-									var length = 0;
-									if (!this.refdatastore.filter(function(s) {
-											return result[i].attr == s.attr
-										}).length) {
-										length = 1;
-										this.refdatastore.push(result[i]);
-									}
-									if (length == 0) {
-										for (var j = 0; j < this.refdatastore.length; j++) {
-											if (this.refdatastore[j].attr == result[i].attr) {
-												this.refdatastore[j].value = result[i].value;
+							if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+								if (data.result_type == 2) {
+									var result = data.result || [];
+									console.log(this.refdatastore)
+									for (var i = 0; i < result.length; i++) {
+										// self.class_attr_ele.find('.attr_field[data-field="' + result[i].attr + '"]').val(result[i].value).data('val', result[i].value);
+										var length = 0;
+										if (!this.refdatastore.filter(function(s) {
+												return result[i].attr == s.attr
+											}).length) {
+											length = 1;
+											this.refdatastore.push(result[i]);
+										}
+										if (length == 0) {
+											for (var j = 0; j < this.refdatastore.length; j++) {
+												if (this.refdatastore[j].attr == result[i].attr) {
+													this.refdatastore[j].value = result[i].value;
+												}
 											}
 										}
 									}
+
+								} else if (typeof data.result == 'string') {
+									if (data.result) {
+										uni.showModal({
+											title: this.translateSys('tip'),
+											content: data.result,
+											showCancel: false,
+											confirmText: this.translateSys('close')
+										});
+									}
 								}
 
-							}
 
-							this.add();
+								this.add();
+							}
 						}
 
 					}).catch(ex => {
@@ -2182,17 +2246,28 @@
 							.info
 							.join(
 								'<br/>') : '';
+						tip = tip || data.err_info
 						if (tip) uni.showModal({
 							title: this.translateSys('tip'),
 							content: tip,
 							showCancel: false,
 							confirmText: this.translateSys('close')
 						});
+						if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+							if (data.result_type == 2) {
 
-						if (data != "") {
-							var actions = data.action;
-							console.log(actions);
-							if (actions) {
+							} else if (typeof data.result == 'string') {
+								if (data.result) {
+									uni.showModal({
+										title: this.translateSys('tip'),
+										content: data.result,
+										showCancel: false,
+										confirmText: this.translateSys('close')
+									});
+								}
+							}
+							try {
+								var actions = data.action || []
 								for (var i = 0; i < actions.length; i++) {
 									var action = actions[i];
 									var val = action.value;
@@ -2371,14 +2446,20 @@
 										d.show();
 									}
 								}
+
+							} catch (ex) {
+								let actionList = (data.action || []).map(a => a.action_type).join(';')
+								let tip = typeof ex == 'string' ? ex : ex.message
+								tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+								uni.showModal({
+									title: this.translateSys('tip'),
+									content: tip,
+									showCancel: false,
+									confirmText: this.translateSys('close')
+								});
+								console.log(ex)
+								return
 							}
-						} else {
-							uni.showModal({
-								title: this.translateSys('tip') + "5.2",
-								content: this.translate("execute_script_return_empty"),
-								showCancel: false,
-								confirmText: this.translateSys('close')
-							});
 						}
 					}
 

--
Gitblit v1.9.1