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/3200.vue | 143 ++++++++++++++++++++++++++++++----------------- 1 files changed, 92 insertions(+), 51 deletions(-) diff --git a/pages/modal/3200.vue b/pages/modal/3200.vue index f5ffc6b..dd162d9 100644 --- a/pages/modal/3200.vue +++ b/pages/modal/3200.vue @@ -533,15 +533,28 @@ } else { var tip = result.info ? typeof result.info == 'string' ? result.info : result.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 (result.result_type == 2) { - if (result.result_type == 0 && result.action) { - result.action.forEach(item => { + } else if (typeof result.result == 'string') { + if (result.result) { + uni.showModal({ + title: this.translateSys('tip'), + content: result.result, + showCancel: false, + confirmText: this.translateSys('close') + }); + } + } + try { + var actionList = result.action || [] + actionList.forEach(item => { if (item.action_type == "set_query_condition") { var value = item.value; $this.wheres = value.condition; @@ -554,16 +567,20 @@ } }); - } else { - if (result.info) { - uni.showModal({ - title: this.translateSys("tip"), - content: result.info, - showCancel: false, - confirmText: this.translateSys('close') - }); - } + } catch (ex) { + let actionList = (result.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) { @@ -1219,8 +1236,8 @@ // var $ele = e; //console.log(e.target) getApp().onScan((result) => { - console.log(result.decodedata); - item.value = result.decodedata; + console.log(result); + item.value = result; uni.hideKeyboard(); var $this = this; console.log(item); @@ -1373,6 +1390,7 @@ .info == 'string' ? result .info : result.info.join('<br/>') : ''; + tip = tip || result.err_info if (tip) uni.showModal({ title: this.translateSys( "tip"), @@ -1381,9 +1399,20 @@ confirmText: this.translateSys( 'close') }); + if (result.result_type == 2) { - if (result.result_type == 0 && result.action) { - var actionlist = result.action; + } else if (typeof result.result == 'string') { + if (result.result) { + uni.showModal({ + title: this.translateSys('tip'), + content: result.result, + showCancel: false, + confirmText: this.translateSys('close') + }); + } + } + try { + var actionlist = result.action || [] for (var j = 0; j < actionlist.length; j++) { var action = actionlist[j]; var action_type = action.action_type; @@ -1418,20 +1447,18 @@ } } - // value = {"attr":"xxx", "value":"xxx"} - } else { - if (result.info) { - uni.showModal({ - title: this - .translateSys( - "tip"), - content: result.info, - showCancel: false, - confirmText: this - .translateSys( - 'close') - }); - } + } catch (ex) { + let actionList = (result.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 } } @@ -1551,10 +1578,11 @@ return; } var styleStr = JSON.stringify($this.detail1_styledef); - var detailStyle = JSON.parse(styleStr); - if (detailStyle.form) { - data.content.forEach(cont => { - detailStyle = JSON.parse(styleStr); + data.content.forEach(cont => { + let detailStyle = JSON.parse(styleStr); + if (detailStyle.form) { + + detailStyle.SelBut_Checked = data.checkbox ?? true; detailStyle.form.objId = cont.id; @@ -1611,8 +1639,8 @@ } else { $this.detail1StyleDefList.push(detailStyle); //寰呭垎鎷� } - }); - } + } + }); }, @@ -1674,6 +1702,7 @@ .info == 'string' ? result .info : result .info.join('<br/>') : ''; + tip = tip || result.err_info if (tip) uni.showModal({ title: this.translateSys( "tip"), @@ -1682,10 +1711,21 @@ confirmText: this.translateSys( 'close') }); + if (result.result_type == 2) { - if (result.result_type == 0 && result - .action) { - result.action.forEach(item => { + } else if (typeof result.result == 'string') { + if (result.result) { + uni.showModal({ + title: this.translateSys('tip'), + content: result.result, + showCancel: false, + confirmText: this.translateSys('close') + }); + } + } + try { + var actionList = result.action || [] + actionList.forEach(item => { if (item.action_type == "goback_to_pre_page" ) { //杩斿洖涓婁竴椤�@@ -1761,20 +1801,21 @@ }); } }); - } else { - if (result.info) { - uni.showModal({ - title: this - .translateSys( - "tip"), - content: result.info, - showCancel: false, - confirmText: this - .translateSys( - 'close') - }); - } + + } catch (ex) { + let actionList = (result.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 } + } -- Gitblit v1.9.1