From e792217d89c64aeacf543c91313cb05841e64e6a Mon Sep 17 00:00:00 2001 From: jt <jt@activesoft.com.cn> Date: 星期三, 06 九月 2023 15:07:05 +0800 Subject: [PATCH] MoboxPDA--调用API的RunCustomEvent接口后处理返回的info信息提示改进 --- pages/modal/5600.vue | 148 ++++++++++++++++++++++++++++--------------------- 1 files changed, 84 insertions(+), 64 deletions(-) diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue index 5fbcbd8..e619e88 100644 --- a/pages/modal/5600.vue +++ b/pages/modal/5600.vue @@ -555,40 +555,50 @@ // console.log(ret); if (ret.err_code == 0) { var result = ret.result; - if(result.result_type == 0 && result.action){ - result.action.forEach(item=>{ - if(item.action_type == "insert_subtable_page_row"){ //鐮佺洏涓�- var value = item.value; - $this.viewAceionRow(value); - } else if(item.action_type == "set_subtable_page_content"){ //宸茬爜鐩�- var value = item.value; - if(value.clear == true && $this.$data.detail1StyleDefList.length>0){ //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鐮佺洏鏄惁鏈夋暟鎹�- uni.showModal({ - title: '鎻愮ず', - content: '绯荤粺妫�祴鍒版湁姝e湪鐮佺洏涓殑璐у搧锛岀户缁搷浣滀細娓呯┖锛屾槸鍚︾户缁紵', - success: function (res) { - if (res.confirm) { - $this.$data.detail1StyleDefList=[]; - $this.$data.detail2StyleDefList=[]; - $this.viewAceionContent(value); - } else if (res.cancel) { - $this.$data.detail2StyleDefList=[]; - $this.viewAceionContent(value); + if (result.ret != 0) { + var tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info : result.err_info.join('<br/>') : ''; + if (result.ret == 801) uni.showModal({title:'鎻愮ず',content:tip,showCancel:false,confirmText:"鍙栨秷"}); + else uni.showModal({title:'鎻愮ず',content:tip+',鎻愮ず:'+result.ret,showCancel:false,confirmText:"鍙栨秷"}); + return false + }else{ + let tip = result.info ? typeof result.info == 'string' ? result.info : result.info.join('<br/>') : ''; + if (tip) uni.showModal({title:'鎻愮ず',content:tip,showCancel:false,confirmText:"鍙栨秷"}); + + if(result.result_type == 0 && result.action){ + result.action.forEach(item=>{ + if(item.action_type == "insert_subtable_page_row"){ //鐮佺洏涓�+ var value = item.value; + $this.viewAceionRow(value); + } else if(item.action_type == "set_subtable_page_content"){ //宸茬爜鐩�+ var value = item.value; + if(value.clear == true && $this.$data.detail1StyleDefList.length>0){ //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鐮佺洏鏄惁鏈夋暟鎹�+ uni.showModal({ + title: '鎻愮ず', + content: '绯荤粺妫�祴鍒版湁姝e湪鐮佺洏涓殑璐у搧锛岀户缁搷浣滀細娓呯┖锛屾槸鍚︾户缁紵', + success: function (res) { + if (res.confirm) { + $this.$data.detail1StyleDefList=[]; + $this.$data.detail2StyleDefList=[]; + $this.viewAceionContent(value); + } else if (res.cancel) { + $this.$data.detail2StyleDefList=[]; + $this.viewAceionContent(value); + } } - } - }); - } else { - $this.$data.detail2StyleDefList=[]; - $this.viewAceionContent(value); - } - } - }); - }else{ - // this.detail2StyleDefList=[]; - if(result.info){ - uni.showModal({title:"閿欒4.3",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); + }); + } else { + $this.$data.detail2StyleDefList=[]; + $this.viewAceionContent(value); + } + } + }); + }else{ + // this.detail2StyleDefList=[]; + if(result.info){ + uni.showModal({title:"閿欒4.3",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); + } } - } + } }else{ uni.showModal({title:"閿欒4",content:ret.err_msg,showCancel:false,confirmText:"鍙栨秷"}); @@ -795,41 +805,51 @@ console.log(res); if (res.err_code == 0) { var result = res.result; - if(result.result_type == 0){ - if(result.action){ - result.action.forEach(item=>{ - if(item.action_type == "insert_subtable_page_row"){ //鐮佺洏涓�- var value = item.value; - //鍔犺浇宸茬粡鐮佺洏鏁版嵁 - $this.viewAceionRow(value,'add'); - //娓呯┖鏉$爜鍐呭 - $this.$data.head_styledef.form.items.forEach((item,index) => { - if(item.fieldId != "S_CNTR_CODE"){ - item.value = ''; - item.oldvalue = ''; - $this.$data.head_styledef.form.model[item.fieldId] = ''; - } - }); - //娓呴櫎姝e湪鐮佺洏涓垚鍔熺殑鏁版嵁 - $this.$data.detail1StyleDefList.forEach((style,index)=>{ - if(style.form.items[0].fieldId == json.attrs[0].attr && style.form.items[0].value == json.attrs[0].value){ - $this.$data.detail1StyleDefList.splice(index,1); - return; + if (result.ret != 0) { + var tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info : result.err_info.join('<br/>') : ''; + if (result.ret == 801) uni.showModal({title:'鎻愮ず',content:tip,showCancel:false,confirmText:"鍙栨秷"}); + else uni.showModal({title:'鎻愮ず',content:tip+',鎻愮ず:'+result.ret,showCancel:false,confirmText:"鍙栨秷"}); + return false + }else{ + let tip = result.info ? typeof result.info == 'string' ? result.info : result.info.join('<br/>') : ''; + if (tip) uni.showModal({title:'鎻愮ず',content:tip,showCancel:false,confirmText:"鍙栨秷"}); + + if(result.result_type == 0){ + if(result.action){ + result.action.forEach(item=>{ + if(item.action_type == "insert_subtable_page_row"){ //鐮佺洏涓�+ var value = item.value; + //鍔犺浇宸茬粡鐮佺洏鏁版嵁 + $this.viewAceionRow(value,'add'); + //娓呯┖鏉$爜鍐呭 + $this.$data.head_styledef.form.items.forEach((item,index) => { + if(item.fieldId != "S_CNTR_CODE"){ + item.value = ''; + item.oldvalue = ''; + $this.$data.head_styledef.form.model[item.fieldId] = ''; + } + }); + //娓呴櫎姝e湪鐮佺洏涓垚鍔熺殑鏁版嵁 + $this.$data.detail1StyleDefList.forEach((style,index)=>{ + if(style.form.items[0].fieldId == json.attrs[0].attr && style.form.items[0].value == json.attrs[0].value){ + $this.$data.detail1StyleDefList.splice(index,1); + return; + } + }); + // this.detail2StyleDefList=[]; + uni.showModal({title:"鎻愮ず",content:"鐮佺洏鎴愬姛",showCancel:false,confirmText:"鍙栨秷"}); } }); - // this.detail2StyleDefList=[]; - uni.showModal({title:"鎻愮ず",content:"鐮佺洏鎴愬姛",showCancel:false,confirmText:"鍙栨秷"}); + }else{ + if($this.$data.param.After_OK_Event.ID != event.ID){ //鍒ゆ柇褰撳墠浜嬩欢鏄惁鏄‘瀹氬悗浜嬩欢 + $this.sava($this.$data.param.After_OK_Event); //鎵ц纭畾鍚庝簨浠�+ } } - }); - }else{ - if($this.$data.param.After_OK_Event.ID != event.ID){ //鍒ゆ柇褰撳墠浜嬩欢鏄惁鏄‘瀹氬悗浜嬩欢 - $this.sava($this.$data.param.After_OK_Event); //鎵ц纭畾鍚庝簨浠�- } - } - }else{ - // $this.$data.detail2StyleDefList=[]; - if(result.info){ - uni.showModal({title:"鎻愮ず",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); + }else{ + // $this.$data.detail2StyleDefList=[]; + if(result.info){ + uni.showModal({title:"鎻愮ず",content:result.info,showCancel:false,confirmText:"鍙栨秷"}); + } } } }else{ -- Gitblit v1.9.1