From fe10cf437b17a2ea0ef63373cae2e5790ebc3930 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期四, 31 七月 2025 18:22:52 +0800 Subject: [PATCH] action 处理 --- pages/modal/3018.vue | 60 ++++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 42 insertions(+), 18 deletions(-) diff --git a/pages/modal/3018.vue b/pages/modal/3018.vue index b6cb0e0..b365f5b 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); }) @@ -1845,29 +1845,15 @@ .info .join( '<br/>') : ''; + tip = tip || result.err_info if (tip) uni.showModal({ title: this.translateSys('tip'), content: tip, showCancel: false, confirmText: this.translateSys('close') }); - - 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 || []; - } - } - } - - if (data.result_type == 2 && data.result) { - var result = data.result; + 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; @@ -1895,7 +1881,45 @@ } } } + + } 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 || []; + 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 || []; + } + } + } + } 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 + } + } }).catch(ex => { -- Gitblit v1.9.1