From fa73abee6209cd6f7c62c61c271826f7d413035d Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期五, 01 八月 2025 11:32:17 +0800 Subject: [PATCH] event result_type --- pages/modal/3018.vue | 221 +++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 151 insertions(+), 70 deletions(-) diff --git a/pages/modal/3018.vue b/pages/modal/3018.vue index b6cb0e0..6ce37fb 100644 --- a/pages/modal/3018.vue +++ b/pages/modal/3018.vue @@ -1002,7 +1002,7 @@ //console.log(e.target) getApp().onScan((result) => { console.log(result); - this.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value =result; + this.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = result; uni.hideKeyboard(); this.onevent($ele, result); }) @@ -1680,6 +1680,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, @@ -1705,10 +1706,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; @@ -1735,6 +1747,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 } } } @@ -1826,6 +1851,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, @@ -1845,55 +1871,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 } } } @@ -1995,6 +2046,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, @@ -2020,30 +2072,42 @@ 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 => { @@ -2179,17 +2243,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; @@ -2368,14 +2443,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