From effc285be3229af6b77edafcb5ec71b96a35f53a Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期五, 12 七月 2024 17:41:57 +0800 Subject: [PATCH] test --- pages/modal/3200.vue | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 160 insertions(+), 5 deletions(-) diff --git a/pages/modal/3200.vue b/pages/modal/3200.vue index a8f7bac..2a21fda 100644 --- a/pages/modal/3200.vue +++ b/pages/modal/3200.vue @@ -273,7 +273,7 @@ }); //璁剧疆椤堕儴鏍囬 this.$data.title = options.titlename; this.$data.param = JSON.parse(options.param); - this.initial(); + this.initial( options.paramValue); // this.isFilter=true; // if(this.param.ShowFilter) // this.isFilter=false; @@ -303,8 +303,31 @@ // this.focusMateria=true; }, methods: { + // + setData: function(obj) { + let that = this; + let keys = []; + let val, data; + + Object.keys(obj).forEach(function(key) { + keys = key.split("."); + val = obj[key]; + data = that.$data; + keys.forEach(function(key2, index) { + if (index + 1 == keys.length) { + that.$set(data, key2, val); + } else { + if (!data[key2]) { + that.$set(data, key2, {}); + } + } + data = data[key2]; + }); + }); + }, + //鍒濆鍖�- async initial() { + async initial(paramValue) { this.styledef = {}; this.head_styledef = { form: { @@ -332,7 +355,31 @@ this.isFilter = false; //鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁� if (this.param.Query_Panel) { - this.Head_UIStyleGetInfo(this.param.DataCls.id, this.param.Query_Panel.id); + await this.Head_UIStyleGetInfo(this.param.DataCls.id, this.param.Query_Panel.id); + //浼犲叆鍙傛暟鍊�+ if (paramValue) { + const attrs = paramValue.attrs || []; + (this.$data.head_styledef?.form?.items || []).forEach(async (ele, index) => { + if (ele.name != "Layout") { + attrs.forEach(async (ele2, index2) => { + if (ele.fieldId == ele2.name) { + ele.value = ele2.value; + } + }); + } else { + ele.setting.colList.forEach(async (col) => { + if (col) { + attrs.forEach(async (ele2, + index2) => { + if (col.fieldId == ele2.name) { + col.value = ele2.value; + } + }); + } + }); + } + }) + } } if (this.param.ListPage.ListItem_UIDef?.ui_type == "HTML椤甸潰") { // HTML椤甸潰 @@ -351,6 +398,7 @@ this.query_id = ""; await this.loadDataGetList(); } + }, //婊氬姩鍒板簳閮ㄥ悗鎳掑姞杞芥暟鎹� async scrolltolower(e) { @@ -1053,7 +1101,114 @@ }, //鎵ц浜嬩欢 - TriggerEvent(btn, style, enviroment) {}, + async TriggerEvent(btn, style, enviroment) { //鎵ц瑙﹀彂浜嬩欢 + try { + let obj_attr = { + S_ID: this.styledef.form.objId + }; + style.form.attrs.forEach((attr) => { + obj_attr[attr.name] = attr.value; + }); + + if (!this.ListPageHtml_Show.event.id) { + //鍒ゆ柇娌℃湁HTML椤甸潰浜嬩欢 + // console.log(this.detail2_styledef); + this.detail2_styledef.form.items.forEach(async (ele, index) => { + if (ele.name != "Layout") { + if (!obj_attr[ele.fieldId]) { + obj_attr[ele.fieldId] = ele.value; + } + } else if (ele.name == "Layout") { + ele.setting.colList.forEach(async (col, key) => { + if (col) { + if (!obj_attr[col.fieldId]) { + obj_attr[col.fieldId] = col.value; + } + } + }); + } + }); + } + + const dataInfo = { + ed_type: 0, + start_transaction: true, + class_id: btn.clsId, + event_id: btn.event.id, + data_obj_id: this.styledef.form.objId, + obj_attr: obj_attr, + } + this.$store.dispatch('runCustomEvent', dataInfo).then(ret => { + // console.log(ret); + if (ret.err_code == 0) { + var result = ret.result; + 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) { + if (this.param.Only_Script_Error) { + let pos = tip.indexOf("锛�); + if (pos > -1) tip = tip.substring(pos + 1); + } + uni.showModal({ + title: this.translateSys("tip"), + content: tip, + showCancel: false, + confirmText: this.translateSys("cancel") + }); + } else uni.showModal({ + title: this.translateSys("tip"), + content: tip + ',' + this.translateSys('tip') + + ':' + + result + .ret, + showCancel: false, + confirmText: this.translateSys("cancel") + }); + return false; + } else { + var tip = result.info ? typeof result.info == 'string' ? result + .info : + result.info.join('<br/>') : ''; + if (tip) uni.showModal({ + title: this.translateSys("tip"), + content: tip, + showCancel: false, + confirmText: this.translateSys("cancel") + }); + + } + } else { + uni.showModal({ + title: this.translateSys("error") + "8", + content: ret.err_msg, + showCancel: false, + confirmText: this.translateSys("cancel") + }); + } + + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys("error") + "8.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys("cancel") + }); + }); + } catch (ex) { + var tip = typeof ex == "string" ? ex : ex.message; + uni.showModal({ + title: this.translateSys("error"), + content: tip, + showCancel: false, + confirmText: this.translateSys("cancel") + }); + this.showError(ex); + } + }, //璺宠浆 async RelatedFunction(btn, style, enviroment) { @@ -1102,7 +1257,7 @@ uni.navigateTo({ url: '../modal/' + name + '?param=' + param + "&titlename=" + appName + - "&type=relatedFunction&attrValue=" + JSON.stringify(style + "&type=relatedFunction¶mValue=" + JSON.stringify(style .form), events: { relatedFunction: function(data) { -- Gitblit v1.9.1