From 090819b136cc0903bf2ac25845c9b275ddbcba89 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期五, 01 八月 2025 17:32:29 +0800 Subject: [PATCH] dataobjcreat而返回处理 --- pages/modal/3037_2.vue | 919 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 509 insertions(+), 410 deletions(-) diff --git a/pages/modal/3037_2.vue b/pages/modal/3037_2.vue index 4ed0626..3f49521 100644 --- a/pages/modal/3037_2.vue +++ b/pages/modal/3037_2.vue @@ -1,7 +1,8 @@ <template> - <view class="uni-page-modal-3017-2"> + <view class="uni-page-modal-3017-2" :class="largeMode?'large-mode':''"> <!-- 琛ㄥご鏍峰紡 --> - <OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" @on-focus="ontap" + <OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" + :hiddenIds="head_styledef.hiddenIds ?head_styledef.hiddenIds :[] " @on-focus="ontap" @on-change="onEnterChange" @on-click-prefix="classAttr_extButton" @on-click-suffix="classAttr_extButton"> </OIForm> <!-- 浠庢暟鎹�--> @@ -123,7 +124,7 @@ import { getUIStyleInfo, runCustomEvent, - dataObjCreate, + dataObjDel } from "@/api/data.js" import dayjs from "dayjs"; @@ -137,6 +138,7 @@ }, data() { return { + largeMode: getApp().globalData.largeMode || false, title: this.translateSys('add2'), param: {}, edit_inital_event: "", //寮圭獥鍒濆鍖栦簨浠禝D @@ -265,11 +267,11 @@ } $this.head_styledef.form.items[index].selections = selections.map(( a) => { - return { - value: a.value, - text: a.label - } - }) + return { + value: a.value, + text: a.label + } + }) } } @@ -462,145 +464,175 @@ } else { var tip = data.info ? typeof data.info == 'string' ? data.info : data.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) { - 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; - for (var i = 0; i < result.length; i++) { - if (result[i].choice_list) { + } 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 i = 0; i < actionlist.length; i++) { + var action = actionlist[i]; + if (action.action_type == 'set_dlg_attr') { + var result = action.value; + for (var i = 0; i < result.length; i++) { + if (result[i].choice_list) { + for (var c = 0; c < styledef.form.items.length; c++) { + var attr = styledef.form.items[c]; + if (attr.name != 'Layout') { + if (attr.fieldId == result[i].attr) { + var dictItemList = []; + for (var d in result[i].choice_list) { + var val = result[i].choice_list[d]; + dictItemList.push({ + "CN_S_NAME": val, + "CN_S_VALUE": val, + "text": val, + "value": val + }); + } + attr.dict = dictItemList; + } + } else if (attr.name == 'Layout') { + attr.setting.colList.forEach(col => { + if (col) { + if (col.fieldId == result[i].attr) { + var dictItemList = []; + for (var d in result[i] + .choice_list) { + var val = result[i] + .choice_list[d]; + dictItemList.push({ + "CN_S_NAME": val, + "CN_S_VALUE": val, + "text": val, + "value": val + }); + } + col.dict = dictItemList; + } + } + }); + } + + } + } for (var c = 0; c < styledef.form.items.length; c++) { var attr = styledef.form.items[c]; + // console.log(attr[j].Name+'=='+result[i].attr); + //鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�+ if ($this.head_styledef.form.model[result[i].attr] == + undefined) { + $this.head_styledef.form.model[result[i].attr] = result[i] + .value; + } + //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗� if (attr.name != 'Layout') { if (attr.fieldId == result[i].attr) { - var dictItemList = []; - for (var d in result[i].choice_list) { - var val = result[i].choice_list[d]; - dictItemList.push({ - "CN_S_NAME": val, - "CN_S_VALUE": val, - "text": val, - "value": val - }); - } - attr.dict = dictItemList; + attr.value = ''; + attr.oldvalue = ''; + attr.value = result[i].value; + attr.oldvalue = result[i].value; + $this.head_styledef.form.model[attr.fieldId] = result[ + i].value; } } else if (attr.name == 'Layout') { attr.setting.colList.forEach(col => { if (col) { if (col.fieldId == result[i].attr) { - var dictItemList = []; - for (var d in result[i] - .choice_list) { - var val = result[i] - .choice_list[d]; - dictItemList.push({ - "CN_S_NAME": val, - "CN_S_VALUE": val, - "text": val, - "value": val - }); - } - col.dict = dictItemList; + col.value = ''; + col.oldvalue = ''; + col.value = result[i].value; + col.oldvalue = result[i].value; + $this.head_styledef.form.model[col + .fieldId] = result[i].value; } } }); } + } - } } - for (var c = 0; c < styledef.form.items.length; c++) { - var attr = styledef.form.items[c]; - // console.log(attr[j].Name+'=='+result[i].attr); - //鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�- if ($this.head_styledef.form.model[result[i].attr] == - undefined) { - $this.head_styledef.form.model[result[i].attr] = result[i] - .value; - } - //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (attr.name != 'Layout') { - if (attr.fieldId == result[i].attr) { - attr.value = ''; - attr.oldvalue = ''; - attr.value = result[i].value; - attr.oldvalue = result[i].value; - $this.head_styledef.form.model[attr.fieldId] = result[ - i].value; - } - } else if (attr.name == 'Layout') { - attr.setting.colList.forEach(col => { - if (col) { - if (col.fieldId == result[i].attr) { - col.value = ''; - col.oldvalue = ''; - col.value = result[i].value; - col.oldvalue = result[i].value; - $this.head_styledef.form.model[col - .fieldId] = result[i].value; + } else if (data.action[i].action_type == 'set_dlg_attr_show') { + var result = action.value; + if (type == 'head') { + $this.setFormItemVisible(result) + // console.log($this.head_styledef); + } else { + result.forEach(async (attr, key) => { + styledef.form.items.forEach(async (ele, index) => { + //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�+ if (ele.name != 'Layout') { + if (ele.fieldId == attr.attr) { + ele.show = attr.show; } + } else if (ele.name == 'Layout') { + ele.setting.colList.forEach( + col => { + if (col) { + if (col + .fieldId == + attr.attr + ) { + col.show = + attr + .show; + } + } + }); } }); - } - } + }); + var style_def = JSON.parse(JSON.stringify(styledef)); - } - } else if (data.action[i].action_type == 'set_dlg_attr_show') { - var result = action.value; - result.forEach(async (attr, key) => { - styledef.form.items.forEach(async (ele, index) => { - //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (ele.name != 'Layout') { - if (ele.fieldId == attr.attr) { - ele.show = attr.show; - } - } else if (ele.name == 'Layout') { - ele.setting.colList.forEach( - col => { - if (col) { - if (col.fieldId == - attr.attr) { - col.show = attr - .show; - } - } - }); - } - }); - }); - var style_def = JSON.parse(JSON.stringify(styledef)); - if (type == 'head') { - $this.head_styledef = []; - $this.head_styledef = style_def; - // console.log($this.head_styledef); + + $this.detail1_styledef = []; + $this.detail1_styledef = style_def; + // console.log($this.detail1_styledef); + } } else { - $this.detail1_styledef = []; - $this.detail1_styledef = style_def; - // console.log($this.detail1_styledef); + uni.showModal({ + title: this.translateSys("tip"), + content: this.translate('execute_init_event_failed') + + this.translateSys("full_stop") + + this.translate('reason') + this.translateSys("colon") + + this.translateSys("quotation_mark_left") + action + .action_type + this.translateSys( + "quotation_mark_right") + this + .translate('tip_action_unprocessed'), + showCancel: false, + confirmText: this.translateSys('close') + }); } - } else { - uni.showModal({ - title: this.translateSys("tip"), - content: this.translate('execute_init_event_failed') + - this.translateSys("full_stop") + - this.translate('reason') + this.translateSys("colon") + - this.translateSys("quotation_mark_left") + action - .action_type + this.translateSys( - "quotation_mark_right") + this - .translate('tip_action_unprocessed'), - showCancel: false, - confirmText: this.translateSys('close') - }); } + + } 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 } } } @@ -621,11 +653,11 @@ ontap(item) { //鎵爜鍔熻兘 //console.log(e.target) getApp().onScan((result) => { - //console.log(result.decodedata); + //console.log(result); uni.hideKeyboard(); var $this = this; console.log(item); - item.value = result.decodedata + item.value = result let newVal = item.value.trim() if (newVal) { item.oldvalue = newVal; @@ -851,16 +883,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; - 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]; console.log(action) @@ -1034,18 +1078,22 @@ }); } } + + } 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.translateSys("quotation_mark_left") + - "before_click_button" + $this.translateSys( - "quotation_mark_right") + $this.translateSys( - "comma") + 'event_id' + eventid, - showCancel: false, - confirmText: $this.translateSys('close') - }); } + } }).catch(ex => { @@ -1116,8 +1164,8 @@ scan_ontap(e) { //鎵爜鍖烘壂鐮佸姛鑳� //console.log(e.target) getApp().onScan((result) => { - console.log(result.decodedata); - item.value = result.decodedata + console.log(result); + item.value = result let newVal = item.value if (typeof item.value == "string") { newVal = item.value.trim() @@ -1527,167 +1575,169 @@ } else { var tip = data.info ? typeof data.info == 'string' ? data.info : data.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) { + var result = data.result || [] - 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; - for (var i = 0; i < result.length; i++) { - if (result[i].choice_list) { + for (var i = 0; i < result.length; i++) { + for (var c = 0; c < $this.head_styledef.form.items.length; c++) { + var attr = $this.head_styledef.form.items[c]; + if (attr.name != 'Layout') { + if (attr.fieldId == result[i].attr) { + attr.value = ''; + attr.oldvalue = ''; + attr.value = result[i].value; + attr.oldvalue = result[i].value; + $this.head_styledef.form.model[attr.fieldId] = result[i].value; + } + } else if (attr.name == 'Layout') { + attr.setting.colList.forEach(col => { + if (col) { + if (col.fieldId == result[i].attr) { + col.value = ''; + col.oldvalue = ''; + col.value = result[i].value; + col.oldvalue = result[i].value; + $this.head_styledef.form.model[col.fieldId] = + 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') + }); + } + } + try { + var actionlist = data.action || [] + for (var i = 0; i < actionlist.length; i++) { + var action = actionlist[i]; + if (action.action_type == 'set_dlg_attr') { + var result = action.value; + for (var i = 0; i < result.length; i++) { + if (result[i].choice_list) { + for (var c = 0; c < $this.head_styledef.form.items.length; c++) { + var attr = $this.head_styledef.form.items[c]; + if (attr.name != 'Layout') { + if (attr.fieldId == result[i].attr) { + var dictItemList = []; + for (var d in result[i].choice_list) { + var val = result[i].choice_list[d]; + dictItemList.push({ + "CN_S_NAME": val, + "CN_S_VALUE": val, + "text": val, + "value": val + }); + } + attr.dict = dictItemList; + } + } else if (attr.name == 'Layout') { + attr.setting.colList.forEach(col => { + if (col) { + if (col.fieldId == result[i].attr) { + var dictItemList = []; + for (var d in result[i].choice_list) { + var val = result[i].choice_list[d]; + dictItemList.push({ + "CN_S_NAME": val, + "CN_S_VALUE": val, + "text": val, + "value": val + }); + } + col.dict = dictItemList; + } + } + }); + } + } + } for (var c = 0; c < $this.head_styledef.form.items.length; c++) { var attr = $this.head_styledef.form.items[c]; + // console.log(attr[j].Name+'=='+result[i].attr); if (attr.name != 'Layout') { if (attr.fieldId == result[i].attr) { - var dictItemList = []; - for (var d in result[i].choice_list) { - var val = result[i].choice_list[d]; - dictItemList.push({ - "CN_S_NAME": val, - "CN_S_VALUE": val, - "text": val, - "value": val - }); - } - attr.dict = dictItemList; + attr.value = ''; + attr.oldvalue = ''; + attr.value = result[i].value; + attr.oldvalue = result[i].value; + $this.head_styledef.form.model[attr.fieldId] = result[i] + .value; } } else if (attr.name == 'Layout') { attr.setting.colList.forEach(col => { if (col) { if (col.fieldId == result[i].attr) { - var dictItemList = []; - for (var d in result[i].choice_list) { - var val = result[i].choice_list[d]; - dictItemList.push({ - "CN_S_NAME": val, - "CN_S_VALUE": val, - "text": val, - "value": val - }); - } - col.dict = dictItemList; + col.value = ''; + col.oldvalue = ''; + col.value = result[i].value; + col.oldvalue = result[i].value; + $this.head_styledef.form.model[col + .fieldId] = result[i].value; } } }); } - } - } - for (var c = 0; c < $this.head_styledef.form.items.length; c++) { - var attr = $this.head_styledef.form.items[c]; - // console.log(attr[j].Name+'=='+result[i].attr); - if (attr.name != 'Layout') { - if (attr.fieldId == result[i].attr) { - attr.value = ''; - attr.oldvalue = ''; - attr.value = result[i].value; - attr.oldvalue = result[i].value; - $this.head_styledef.form.model[attr.fieldId] = result[i] - .value; - } - } else if (attr.name == 'Layout') { - attr.setting.colList.forEach(col => { - if (col) { - if (col.fieldId == result[i].attr) { - col.value = ''; - col.oldvalue = ''; - col.value = result[i].value; - col.oldvalue = result[i].value; - $this.head_styledef.form.model[col - .fieldId] = result[i].value; - } - } - }); + } } - - } - } else if (action.action_type == 'set_dlg_attr_show') { - var result = action.value; - result.forEach(async (attr, key) => { - $this.head_styledef.form.items.forEach(async (ele, - index) => { - //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (ele.name != 'Layout') { - if (ele.fieldId == attr.attr) { - ele.show = attr.show; - } - } else if (ele.name == 'Layout') { - ele.setting.colList.forEach(col => { - if (col) { - if (col.fieldId == attr - .attr) { - col.show = attr - .show; - } - } - }); - } - }); - }); - var head_styledef = JSON.parse(JSON.stringify($this.head_styledef)); - $this.head_styledef = []; - $this.head_styledef = head_styledef; - // console.log($this.head_styledef); - } else if (action.action_type == 'set_global_attr') { - $this.global_attr = action.value || []; - } - - } - } - - if (data.result) { - var result = data.result; - for (var i = 0; i < result.length; i++) { - for (var c = 0; c < $this.head_styledef.form.items.length; c++) { - var attr = $this.head_styledef.form.items[c]; - if (attr.name != 'Layout') { - if (attr.fieldId == result[i].attr) { - attr.value = ''; - attr.oldvalue = ''; - attr.value = result[i].value; - attr.oldvalue = result[i].value; - $this.head_styledef.form.model[attr.fieldId] = result[i].value; - } - } else if (attr.name == 'Layout') { - attr.setting.colList.forEach(col => { - if (col) { - if (col.fieldId == result[i].attr) { - col.value = ''; - col.oldvalue = ''; - col.value = result[i].value; - col.oldvalue = result[i].value; - $this.head_styledef.form.model[col.fieldId] = - result[i].value; - } - } - }); + } else if (action.action_type == 'set_dlg_attr_show') { + var data = action.value; + $this.setFormItemVisible(data) + // console.log($this.head_styledef); + } else if (action.action_type == 'set_global_attr') { + $this.global_attr = action.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; - } - } - } + } 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 } } } @@ -1701,6 +1751,27 @@ confirmText: this.translateSys('close') }); }); + }, + setFormItemVisible(attrs) { + if (!Array.isArray(attrs)) { + return + } + const head_styledef = this.head_styledef + if (!head_styledef.hiddenIds) { + head_styledef.hiddenIds = [] + } + attrs.forEach((attr) => { + let index = head_styledef.hiddenIds.findIndex((id) => id == attr.attr); + if (attr.show) { + if (index > -1) head_styledef.hiddenIds.splice(index, 1); + } else { + if (index == -1) head_styledef.hiddenIds.push(attr.attr); + } + }); + + this.setData({ + head_styledef: head_styledef + }) }, scan_DataObjRunCustomEvent(info, data_attr) { var $this = this; @@ -1791,86 +1862,17 @@ } else { var tip = data.info ? typeof data.info == 'string' ? data.info : data.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.result) { - var actionlist = data.action; - if (actionlist) { - console.log(actionlist); - for (var ii = 0; ii < actionlist.length; ii++) { - var action = actionlist[ii]; - if (action.action_type == 'set_dlg_attr') { - var result = action.value; - for (var i = 0; i < result.length; i++) { - if (result[i].choice_list) { - for (var s = 0; s < $this.subPanelList.length; s++) { - for (var c = 0; c < $this.subPanelList[s] - .subClassAttrList.length; c++) { - var attr = $this.subPanelList[s].subClassAttrList[c] - .Attr; - for (var j = 0; j < attr.length; j++) { - if (attr[j].Name == result[i].attr) { - if (utils.classUtils.attrTypeIsDict(attr[j] - .Type)) { - var dictItemList = []; - for (var d in result[i].choice_list) { - var val = result[i].choice_list[d]; - dictItemList.push({ - "CN_S_NAME": val, - "CN_S_VALUE": val, - "Name": val, - "label": val, - "value": val - }); - } - attr[j].dictitem = dictItemList; - // attr[j].dictitem = result[i].choice_list; - } - } - } - } - } - } - for (var s = 0; s < $this.subPanelList.length; s++) { - for (var c = 0; c < $this.subPanelList[s].subClassAttrList - .length; c++) { - var attr = $this.subPanelList[s].subClassAttrList[c] - .Attr; - for (var j = 0; j < attr.length; j++) { - console.log(attr[j].Name + '==' + result[i].attr); - if (attr[j].Name == result[i].attr) { - attr[j].Value = result[i].value; - // attr.value = ''; - // attr.oldvalue = ''; - // attr.value = result[i].value; - // attr.oldvalue = result[i].value; - } - } - } - } - var length = 0; - - } - } else if (action.action_type == 'set_global_attr') { - $this.$actiontr = action.value || []; - } else if (action.action_type == 'open_common_dlg') { //鎵撳紑渚ф粦寮规 - var $this = this; - if (action.value.common_dlg_id == 'check_list') { - $this.check_list = action.value.config; - if (action.value.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�- $this.popupType = 'right'; - else - $this.popupType = 'center' - // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� - $this.$refs.popup.open($this.popupType); - } - } else if (action.action_type == 'add_subcls_panel') { //涓讳粠鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�- var result = action.value; - var $this = this; var list_1 = JSON.parse(JSON.stringify(this.detail1_styledef)); var scanCodeVal = $this.scanCodeVal; var rand = ''; @@ -1889,16 +1891,14 @@ scanCodeVal: scanCodeVal, subClassAttr: list_1 }); - $this.activelist.push({ - active: false - }); + var result = data.result || [] for (var i = 0; i < result.length; i++) { for (var s = 0; s < $this.subPanelList.length; s++) { if ($this.subPanelList[s].scanCodeVal == scanCodeVal) { if (result[i].attr == "S_ID") $this.subPanelList[s].ObjID = result[i].value; - var _subClassAttr = $this.subPanelList[s].subClassAttr - .form.items; + var _subClassAttr = $this.subPanelList[s].subClassAttr.form + .items; for (var c = 0; c < _subClassAttr.length; c++) { if (_subClassAttr[c].name != 'Layout') { if (_subClassAttr[c].fieldId == result[i].attr) @@ -1912,11 +1912,9 @@ }); } } - - // $this.subPanelList[s].subClassAttr=list_1; } } - // console.log($this.subPanelList); + var length = 0; if (!$this.refdatastore.filter(function(s) { return result[i].attr == s.attr @@ -1932,77 +1930,177 @@ } } } - } else { + } + + } else if (typeof data.result == 'string') { + if (data.result) { uni.showModal({ - title: this.translateSys("tip"), - content: this.translateSys("quotation_mark_left") + action - .action_type + this.translateSys( - "quotation_mark_right") + this.translate( - "tip_action_unprocessed"), + title: this.translateSys('tip'), + content: data.result, showCancel: false, confirmText: this.translateSys('close') }); } } - } - - if (data.result) { - var list_1 = JSON.parse(JSON.stringify(this.detail1_styledef)); - var scanCodeVal = $this.scanCodeVal; - var rand = ''; - for (var i = 0; i < 5; i++) { //鐢熸垚5浣嶉殢鏈烘暟 - rand += Math.floor(Math.random() * 10); - } - if (inputParamter[0].attr) { - if (inputParamter[0].attr == "mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�- scanCodeVal = "mast_input_3037-" + rand; - } - if (info.attr[0].attr) { - if (info.attr[0].attr == "mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�- scanCodeVal = "mast_input_3037-" + rand; - } - $this.subPanelList.push({ - scanCodeVal: scanCodeVal, - subClassAttr: list_1 - }); - var result = data.result; - for (var i = 0; i < result.length; i++) { - for (var s = 0; s < $this.subPanelList.length; s++) { - if ($this.subPanelList[s].scanCodeVal == scanCodeVal) { - if (result[i].attr == "S_ID") - $this.subPanelList[s].ObjID = result[i].value; - var _subClassAttr = $this.subPanelList[s].subClassAttr.form - .items; - for (var c = 0; c < _subClassAttr.length; c++) { - if (_subClassAttr[c].name != 'Layout') { - if (_subClassAttr[c].fieldId == result[i].attr) - _subClassAttr[c].value = result[i].value; - } else if (_subClassAttr[c].name == 'Layout') { - _subClassAttr[c].setting.colList.forEach(col => { - if (col) { - if (col.fieldId == result[i].attr) - col.value = result[i].value; + try { + var actionlist = data.action || [] + for (var ii = 0; ii < actionlist.length; ii++) { + var action = actionlist[ii]; + if (action.action_type == 'set_dlg_attr') { + var result = action.value; + for (var i = 0; i < result.length; i++) { + if (result[i].choice_list) { + for (var s = 0; s < $this.subPanelList.length; s++) { + for (var c = 0; c < $this.subPanelList[s] + .subClassAttrList.length; c++) { + var attr = $this.subPanelList[s].subClassAttrList[c] + .Attr; + for (var j = 0; j < attr.length; j++) { + if (attr[j].Name == result[i].attr) { + if (utils.classUtils.attrTypeIsDict(attr[j] + .Type)) { + var dictItemList = []; + for (var d in result[i].choice_list) { + var val = result[i].choice_list[d]; + dictItemList.push({ + "CN_S_NAME": val, + "CN_S_VALUE": val, + "Name": val, + "label": val, + "value": val + }); + } + attr[j].dictitem = dictItemList; + // attr[j].dictitem = result[i].choice_list; + } + } + } } - }); + } + } + for (var s = 0; s < $this.subPanelList.length; s++) { + for (var c = 0; c < $this.subPanelList[s].subClassAttrList + .length; c++) { + var attr = $this.subPanelList[s].subClassAttrList[c] + .Attr; + for (var j = 0; j < attr.length; j++) { + console.log(attr[j].Name + '==' + result[i].attr); + if (attr[j].Name == result[i].attr) { + attr[j].Value = result[i].value; + // attr.value = ''; + // attr.oldvalue = ''; + // attr.value = result[i].value; + // attr.oldvalue = result[i].value; + } + } + } + } + var length = 0; + + } + } else if (action.action_type == 'set_global_attr') { + $this.$actiontr = action.value || []; + } else if (action.action_type == 'open_common_dlg') { //鎵撳紑渚ф粦寮规 + var $this = this; + if (action.value.common_dlg_id == 'check_list') { + $this.check_list = action.value.config; + if (action.value.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�+ $this.popupType = 'right'; + else + $this.popupType = 'center' + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� + $this.$refs.popup.open($this.popupType); + } + } else if (action.action_type == 'add_subcls_panel') { //涓讳粠鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+ var result = action.value; + var $this = this; + var list_1 = JSON.parse(JSON.stringify(this.detail1_styledef)); + var scanCodeVal = $this.scanCodeVal; + var rand = ''; + for (var i = 0; i < 5; i++) { //鐢熸垚5浣嶉殢鏈烘暟 + rand += Math.floor(Math.random() * 10); + } + if (inputParamter[0].attr) { + if (inputParamter[0].attr == "mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+ scanCodeVal = "mast_input_3037-" + rand; + } + if (info.attr[0].attr) { + if (info.attr[0].attr == "mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+ scanCodeVal = "mast_input_3037-" + rand; + } + $this.subPanelList.push({ + scanCodeVal: scanCodeVal, + subClassAttr: list_1 + }); + $this.activelist.push({ + active: false + }); + for (var i = 0; i < result.length; i++) { + for (var s = 0; s < $this.subPanelList.length; s++) { + if ($this.subPanelList[s].scanCodeVal == scanCodeVal) { + if (result[i].attr == "S_ID") + $this.subPanelList[s].ObjID = result[i].value; + var _subClassAttr = $this.subPanelList[s].subClassAttr + .form.items; + for (var c = 0; c < _subClassAttr.length; c++) { + if (_subClassAttr[c].name != 'Layout') { + if (_subClassAttr[c].fieldId == result[i].attr) + _subClassAttr[c].value = result[i].value; + } else if (_subClassAttr[c].name == 'Layout') { + _subClassAttr[c].setting.colList.forEach(col => { + if (col) { + if (col.fieldId == result[i].attr) + col.value = result[i].value; + } + }); + } + } + + // $this.subPanelList[s].subClassAttr=list_1; + } + } + // console.log($this.subPanelList); + 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 { + uni.showModal({ + title: this.translateSys("tip"), + content: this.translateSys("quotation_mark_left") + action + .action_type + this.translateSys( + "quotation_mark_right") + this.translate( + "tip_action_unprocessed"), + showCancel: false, + confirmText: this.translateSys('close') + }); } } - 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 } } } @@ -2139,6 +2237,7 @@ } else { var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( '<br/>') : ''; + tip = tip || data.err_info if (tip) uni.showModal({ title: this.translateSys("tip"), content: tip, @@ -2146,7 +2245,7 @@ confirmText: this.translateSys('close') }); - var result = data.result; + // var result = data.result; if (eventID != $this.param.After_OK_Event.ID) $this.scan_OKDataObjRunCustomEvent($this.param.After_OK_Event.ID); else { -- Gitblit v1.9.1