From 016fe8296e58f28f30bf66fa71bdcd420e9e9d84 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期二, 20 八月 2024 15:55:16 +0800 Subject: [PATCH] test --- pages/modal/5600.vue | 144 ++++++++++++++++++++++++++++++++--------------- 1 files changed, 97 insertions(+), 47 deletions(-) diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue index 042ff3e..34a9ef2 100644 --- a/pages/modal/5600.vue +++ b/pages/modal/5600.vue @@ -459,54 +459,47 @@ dict_id: dict.id, dict_name: dict.name }; - // console.log(dataInfo); - this.$store.dispatch('DictGetInfo', dataInfo).then(async (success) => { - console.log(success); - if (success.err_code == 0) { - var list = []; - var itemName = ''; - success.result.dict_item_list.forEach((item) => { - if (item.is_default == '1') - itemName = item.name; - list.push({ - text: item.value, - value: item.name, - }); + try { + const res = await this.getDictInfo(dataInfo) + var list = []; + var itemName = ''; + res.result.dict_item_list.forEach((item) => { + if (item.is_default == '1') + itemName = item.name; + list.push({ + text: item.value, + value: item.name, }); - - if (type == 'mast') { //鏈夐粯璁ゅ�锛屾樉绀洪粯璁ゅ� - if (itemName) { - $this.head_styledef.form.items[index].value = itemName; - var attr = $this.head_styledef.form.items[index].fieldId; - $this.head_styledef.form.model[attr] = itemName; - } - $this.head_styledef.form.items[index].dict = list; - 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 (itemName) { - $this.detail1_styledef.form.items[index].value = itemName; - var attr = $this.detail1_styledef.form.items[index].fieldId; - $this.detail1_styledef.form.model[attr] = itemName; - } - $this.detail1_styledef.form.items[index].dict = list; - var detail1_styledef = JSON.parse(JSON.stringify($this.detail1_styledef)); - $this.detail1_styledef = []; - $this.detail1_styledef = detail1_styledef; - // console.log($this.$data.detail1_styledef); + }); + //鏈夐粯璁ゅ�锛屾樉绀洪粯璁ゅ� + if (type == 'mast') { //鏈夐粯璁ゅ�锛屾樉绀洪粯璁ゅ� + if (itemName) { + $this.head_styledef.form.items[index].value = itemName; + var attr = $this.head_styledef.form.items[index].fieldId; + $this.head_styledef.form.model[attr] = itemName; } - + $this.head_styledef.form.items[index].dict = list; + var head_styledef = JSON.parse(JSON.stringify($this.head_styledef)); + $this.head_styledef = []; + $this.head_styledef = head_styledef; + // console.log($this.head_styledef); } else { - uni.showModal({ - title: this.translateSys("error") + "3.1", - content: success.err_msg, - showCancel: false, - confirmText: this.translateSys("cancel") - }); + if (itemName) { + $this.detail1_styledef.form.items[index].value = itemName; + var attr = $this.detail1_styledef.form.items[index].fieldId; + $this.detail1_styledef.form.model[attr] = itemName; + } + $this.detail1_styledef.form.items[index].dict = list; + var detail1_styledef = JSON.parse(JSON.stringify($this.detail1_styledef)); + $this.detail1_styledef = []; + $this.detail1_styledef = detail1_styledef; + // console.log($this.$data.detail1_styledef); } - }).catch(ex => { + + + // $this.head_styledef.form.items[index].dictitem=success.result; + // this.$store.commit("classAttrList", $this.$data.classAttrList); + } catch (ex) { // console.log(ex); uni.showModal({ title: this.translateSys("error") + "3", @@ -514,8 +507,39 @@ showCancel: false, confirmText: this.translateSys("cancel") }); - }); + } + // console.log(dataInfo); }, + getDictInfo(info) { //Mobox3寰楀埌寰楀埌瀛楀吀淇℃伅瀛楀吀椤瑰垪琛�+ const loginInfo = this.$store.getters.loginid + const mobxoSApi = this.$store.getters.getMobxoSApi + return new Promise((resolve, reject) => { + uni.request({ + url: mobxoSApi + 'api/dict/GetInfo2?sessionid=' + loginInfo.result.session_id, + data: info, + method: 'POST', + dataType: "json", + success: (_res) => { + // console.log(_res); + const ret = _res.data + if (ret.err_code == 0) { + resolve(ret); + } else { + reject({ + "errMsg": ret.err_msg + }); + } + }, + fail: (err) => { + // console.log(err); + reject(err); + } + }) + + }) + + }, + onClick(item) { this.focusFieldId = item.fieldId }, @@ -547,7 +571,7 @@ // .exec(); // } //console.log(item); - if (item.oldvalue != item.value) { + if (item.oldvalue != item.value&& item.value.trim() != "") { item.oldvalue = item.value; var attr = item.fieldId; this.head_styledef.form.model[attr] = item.value; @@ -629,7 +653,7 @@ }, onEnterChange(item) { //鍥炶溅锛岀偣鍑绘寜閽紝鍙栨秷鑺傜偣浜嬩欢 // console.log(item); - if (item.oldvalue != item.value) { + if (item.oldvalue != item.value&& item.value.trim() != "") { item.oldvalue = item.value; var attr = item.fieldId; this.head_styledef.form.model[attr] = item.value; @@ -951,6 +975,32 @@ data.forEach(async (ele2, index) => { if (ele.fieldId == ele2 .attr) { + if (ele.name == + 'Select' && + ele2 + .choice_list) { + const + dictItemList = []; + const + choiceList = + ele2 + .choice_list || + []; + for (let d in + choiceList) { + const val = + choiceList[ + d]; + dictItemList + .push({ + text: val, + value: val + }); + } + ele.dict = + dictItemList; + } + ele.value = ele2 .value; } -- Gitblit v1.9.1