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/5601.vue | 467 ++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 256 insertions(+), 211 deletions(-) diff --git a/pages/modal/5601.vue b/pages/modal/5601.vue index eaa6aa5..934899f 100644 --- a/pages/modal/5601.vue +++ b/pages/modal/5601.vue @@ -1,7 +1,8 @@ <template> <view class="uni-page-modal-5601" :class="largeMode?'large-mode':''"> <!-- 琛ㄥご鏍峰紡 --> - <OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" :hiddenIds="head_styledef.hiddenIds ?head_styledef.hiddenIds :[] " :focusId="focusFieldId" + <OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" + :hiddenIds="head_styledef.hiddenIds ?head_styledef.hiddenIds :[] " :focusId="focusFieldId" @on-click="onClick" @on-focus="ontap" @on-change="onEnterChange" @on-click-prefix="classAttr_extButton" @on-click-suffix="classAttr_extButton"></OIForm> @@ -886,15 +887,28 @@ 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_dlg_attr") { // value = {"attr":"xxx", "value":"xxx"} var data = item.value; @@ -904,19 +918,20 @@ this.setDetailFormItemVisible(data, style, pageIndex) } }); - } else { - - if (result.info) { - uni.showModal({ - title: this.translateSys( - "error") + "6.3", - 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 } + } @@ -1093,6 +1108,7 @@ 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, @@ -1100,9 +1116,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 { + let actionList = result.action || [] + actionList.forEach(item => { if (item.action_type == "insert_subtable_page_row") { //鐮佺洏涓� $this.param.Show_Welcom_Page = false; var value = item.value; @@ -1209,25 +1237,26 @@ // value = {"attr":"xxx", "value":"xxx"} var data = item.value; $this.setFormValues(data) - } - else if (item.action_type == 'set_dlg_attr_show') { + } else if (item.action_type == 'set_dlg_attr_show') { var data = item.value; $this.setFormItemVisible(data) } }); - } else { - if (result.info) { - uni.showModal({ - title: this.translateSys( - "error") + "4.3", - 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 } + } @@ -1606,7 +1635,7 @@ data.content.forEach(cont => { var detailStyle = JSON.parse(styleStr); if (detailStyle.form) { - // detailStyle.SelBut_Checked = data.checkbox ?? true; + // detailStyle.SelBut_Checked = data.checkbox ?? true; detailStyle.form.objId = cont.id; detailStyle.form.htmlobjId = cont.id ? cont.id.replace(/-/g, @@ -1685,7 +1714,7 @@ if (index == -1) head_styledef.hiddenIds.push(attr.attr); } }); - + this.setData({ head_styledef: head_styledef }) @@ -2741,12 +2770,14 @@ this.After_OK_Event = pageData.After_ok; // console.log(this.Before_OK_Event); // console.log(this.After_OK_Event); + console.log("ok"); if (this.Before_OK_Event.ID) //鏄惁鏈夌‘瀹氬墠浜嬩欢 this.sava(pageData, this.Before_OK_Event); else if (this.After_OK_Event.ID) //鏄惁鏈夌‘瀹氬悗浜嬩欢 this.sava(pageData, this.After_OK_Event); }, sava(pageData, event) { + var $this = this; // if (pageData.DefList.length == 0) { // uni.showModal({ @@ -2858,7 +2889,7 @@ item_list: jsonlist, ext_data: pageData.ExtData }) - // console.log(jsonlist); + $this.runCustomEvent(pageData, event, input_param, list); // jsonlist.forEach(async (json,key)=>{ // await $this.runCustomEvent(event,input_param,json,'1'); @@ -2889,6 +2920,7 @@ global_attr: '', input_param: input_param, }; + console.log(dataInfo); runCustomEvent(dataInfo).then(result => { console.log(result); if (result.ret != 0) { @@ -2923,6 +2955,7 @@ 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, @@ -2930,191 +2963,203 @@ confirmText: this.translateSys( 'close') }); - if (result.result_type == 0) { - if (result.action) { - // uni.showModal({title:this.translateSys("tip"),content:JSON.stringify(result.action),showCancel:false,confirmText:this.translateSys("cancel")}); + if (result.result_type == 2) { - result.action.forEach(item => { - if (item.action_type == - "insert_subtable_page_row") { //鐮佺洏涓�- var value = item.value; - //鍔犺浇宸茬粡鐮佺洏鏁版嵁 - $this.viewAceionRow(value); - //娓呯┖鏉$爜鍐呭 - $this.head_styledef.form.items.forEach((item, - index) => { - if (item.fieldId != - "S_CNTR_CODE") { - item.value = ''; - item.oldvalue = ''; - $this.head_styledef.form.model[ - item - .fieldId] = ''; - } - }); - - uni.showModal({ - title: $this.translateSys("tip"), - content: $this.translate( - 'execute_event_success'), - showCancel: false, - confirmText: $this.translateSys( - 'close') - }); - } else if (item.action_type == - "set_subtable_page_content" - ) { //宸茬爜鐩�- $this.param.Show_Welcom_Page = false; - var value = item.value; - const pageData = $this.pageDetail.find(( - page) => { - return value.page_name == page - .Name; - }); - if (value.clear_confirm != false && value - .clear == true && - pageData && pageData.DefList.length > 0 - ) { //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鐮佺洏鏄惁鏈夋暟鎹�- uni.showModal({ - title: $this.translateSys( - 'tip'), - content: $this.translate( - "are_you_sure_clear_first" - ) + - $this.translateSys( - "quotation_mark_left" - ) + - value.page_name + - $this.translateSys( - "quotation_mark_right" - ) + - $this.translate( - "are_you_sure_clear_last" - ), - cancelText: $this.translateSys( - 'ok'), - confirmText: $this - .translateSys('cancel'), - success: function(res) { - if (res.cancel) { - if (pageData) - pageData - .DefList = []; - $this - .viewAceionContent( - value); - } else if (res - .confirm) { - if (pageData) - pageData - .DefList = []; - $this - .viewAceionContent( - value); - } - } - }); - } else { - if (pageData) - pageData.DefList = []; - $this.viewAceionContent(value); - } - } else if (item.action_type == - "select_subtable_page") { - var value = item.value; - const pageIndex = $this.pageDetail.findIndex(( - page) => { - return value.page_name == page - .Name; - }); - if (pageIndex > -1) { - $this.setData({ - current: pageIndex - }) - } - } else if (item.action_type == - "remove_subtable_page_row") { //娓呴櫎闈㈡澘涓寚瀹歩d鐨勬暟鎹�- let value = item.value; - $this.viewActionRemoveRow(value) - } else if (item.action_type == - "set_subtable_page_row") { - $this.viewActionSetRow(item.value) - } else if (item.action_type == - "set_subtable_page_ext_data") { - let value = item.value; - const pageData = $this.pageDetail.find(( - page) => { - return value.page_name == page - .Name; - }); - if (pageData) { - pageData.ExtData = value.ext_data - } - - } else if (item.action_type == - "clear_subpage_rows") { - var value = item.value; - const pageIndex = $this.pageDetail.findIndex(( - page) => { - return value.page_name == page - .Name; - }); - if (pageIndex > -1) { - const pageData = $this.pageDetail[ - pageIndex] - pageData.DefList = [] - pageData.ExtData = {} - - $this.$set(this.pageDetail, pageIndex, - pageData) - } - } else if (item.action_type == - "set_dlg_current_edit_attr") { - if ($this.focusOldFieldId == item.value) - $this.setData({ - focusFieldId: "" - }) - else { - $this.setData({ - focusFieldId: $this - .focusOldFieldId - }) - } - $this.$nextTick(() => { - $this.setData({ - focusFieldId: item - .value - }) - }); - } else if (item.action_type == - "set_dlg_attr") { - // value = {"attr":"xxx", "value":"xxx"} - var data = item.value; - $this.setFormValues(data) - } - else if (item.action_type == 'set_dlg_attr_show') { - var data = item.value; - $this.setFormItemVisible(data) - } - - }); - } else { - if ($this.After_OK_Event.ID != event.ID) { //鍒ゆ柇褰撳墠浜嬩欢鏄惁鏄‘瀹氬悗浜嬩欢 - $this.sava(pageParam, $this.After_OK_Event); //鎵ц纭畾鍚庝簨浠�- - } - } - } else { - - if (result.info) { + } else if (typeof result.result == 'string') { + if (result.result) { uni.showModal({ - title: this.translateSys("tip"), - content: result.info, + title: this.translateSys('tip'), + content: result.result, showCancel: false, confirmText: this.translateSys('close') }); } } + try { + let actionList = result.action || [] + actionList.forEach(item => { + if (item.action_type == + "insert_subtable_page_row") { //鐮佺洏涓�+ var value = item.value; + //鍔犺浇宸茬粡鐮佺洏鏁版嵁 + $this.viewAceionRow(value); + //娓呯┖鏉$爜鍐呭 + $this.head_styledef.form.items.forEach((item, + index) => { + if (item.fieldId != + "S_CNTR_CODE") { + item.value = ''; + item.oldvalue = ''; + $this.head_styledef.form.model[ + item + .fieldId] = ''; + } + }); + + uni.showModal({ + title: $this.translateSys("tip"), + content: $this.translate( + 'execute_event_success'), + showCancel: false, + confirmText: $this.translateSys( + 'close') + }); + } else if (item.action_type == + "set_subtable_page_content" + ) { //宸茬爜鐩�+ $this.param.Show_Welcom_Page = false; + var value = item.value; + const pageData = $this.pageDetail.find(( + page) => { + return value.page_name == page + .Name; + }); + if (value.clear_confirm != false && value + .clear == true && + pageData && pageData.DefList.length > 0 + ) { //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鐮佺洏鏄惁鏈夋暟鎹�+ uni.showModal({ + title: $this.translateSys( + 'tip'), + content: $this.translate( + "are_you_sure_clear_first" + ) + + $this.translateSys( + "quotation_mark_left" + ) + + value.page_name + + $this.translateSys( + "quotation_mark_right" + ) + + $this.translate( + "are_you_sure_clear_last" + ), + cancelText: $this.translateSys( + 'ok'), + confirmText: $this + .translateSys('cancel'), + success: function(res) { + if (res.cancel) { + if (pageData) + pageData + .DefList = []; + $this + .viewAceionContent( + value); + } else if (res + .confirm) { + if (pageData) + pageData + .DefList = []; + $this + .viewAceionContent( + value); + } + } + }); + } else { + if (pageData) + pageData.DefList = []; + $this.viewAceionContent(value); + } + } else if (item.action_type == + "select_subtable_page") { + var value = item.value; + const pageIndex = $this.pageDetail.findIndex(( + page) => { + return value.page_name == page + .Name; + }); + if (pageIndex > -1) { + $this.setData({ + current: pageIndex + }) + } + } else if (item.action_type == + "remove_subtable_page_row") { //娓呴櫎闈㈡澘涓寚瀹歩d鐨勬暟鎹�+ let value = item.value; + $this.viewActionRemoveRow(value) + } else if (item.action_type == + "set_subtable_page_row") { + $this.viewActionSetRow(item.value) + } else if (item.action_type == + "set_subtable_page_ext_data") { + let value = item.value; + const pageData = $this.pageDetail.find(( + page) => { + return value.page_name == page + .Name; + }); + if (pageData) { + pageData.ExtData = value.ext_data + } + + } else if (item.action_type == + "clear_subpage_rows") { + var value = item.value; + const pageIndex = $this.pageDetail.findIndex(( + page) => { + return value.page_name == page + .Name; + }); + if (pageIndex > -1) { + const pageData = $this.pageDetail[ + pageIndex] + pageData.DefList = [] + pageData.ExtData = {} + + $this.$set(this.pageDetail, pageIndex, + pageData) + } + } else if (item.action_type == + "set_dlg_current_edit_attr") { + if ($this.focusOldFieldId == item.value) + $this.setData({ + focusFieldId: "" + }) + else { + $this.setData({ + focusFieldId: $this + .focusOldFieldId + }) + } + $this.$nextTick(() => { + $this.setData({ + focusFieldId: item + .value + }) + }); + } else if (item.action_type == + "set_dlg_attr") { + // value = {"attr":"xxx", "value":"xxx"} + var data = item.value; + $this.setFormValues(data) + } else if (item.action_type == 'set_dlg_attr_show') { + var data = item.value; + $this.setFormItemVisible(data) + } + + }); + + if ($this.After_OK_Event?.ID && $this.After_OK_Event.ID != event + .ID) { //鍒ゆ柇褰撳墠浜嬩欢鏄惁鏄‘瀹氬悗浜嬩欢 + $this.sava(pageParam, $this.After_OK_Event); //鎵ц纭畾鍚庝簨浠�+ + } + } 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 => { -- Gitblit v1.9.1