From 41e6159cfa12416155adcd6747e48fab28ffc534 Mon Sep 17 00:00:00 2001 From: cyy <cuiqian2004@163.com> Date: 星期一, 26 八月 2024 22:45:17 +0800 Subject: [PATCH] test --- pages/modal/5602.vue | 231 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 168 insertions(+), 63 deletions(-) diff --git a/pages/modal/5602.vue b/pages/modal/5602.vue index b1c4342..622cfaa 100644 --- a/pages/modal/5602.vue +++ b/pages/modal/5602.vue @@ -98,7 +98,8 @@ <view v-if="param.Sub_Page[0].OK_Button==true"> <button type="default" @tap="cancel" class="btn_cancel">{{translateSys('cancel')}}</button> - <button type="primary" @tap="ok" class="btn_add">{{translateSys('ok')}}</button> + <button type="primary" @tap="ok" class="btn_add" :class="okLoading?'btn_disabled':''" + :disabled="okLoading">{{translateSys('ok')}}</button> </view> </view> </swiper-item> @@ -147,7 +148,8 @@ <view v-if=" param.Sub_Page[1].OK_Button==true"> <button type="default" @tap="cancel" class="btn_cancel">{{translateSys('cancel')}}</button> - <button type="primary" @tap="ok2" class="btn_add">{{translateSys('ok')}}</button> + <button type="primary" @tap="ok2" class="btn_add" :class="ok2Loading?'btn_disabled':''" + :disabled="ok2Loading">{{translateSys('ok')}}</button> </view> </view> </swiper-item> @@ -185,8 +187,8 @@ data() { return { title: this.translateSys("sorting"), - ClsID: "Sorting_Detail", - ClsID2: "Sorting_Result", + ClsID: "Distribution_CNTR_Detail", + ClsID2: "Picking_Result", param: {}, focusFieldId: "", focusOldFieldId: "", @@ -210,6 +212,8 @@ items: [], active_id: '', activelist: [], + okLoading: false, + ok2Loading: false, }; }, onLoad(options) { @@ -227,7 +231,7 @@ let that = this; let keys = []; let val, data; - + Object.keys(obj).forEach(function(key) { keys = key.split("."); val = obj[key]; @@ -244,7 +248,7 @@ }); }); }, - + async loadData(paramValue) { //鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁� await this.Head_UIStyleGetInfo(this.$data.ClsID, this.$data.param.Input_UI_Style.ID); @@ -272,7 +276,7 @@ } }) } - + //鍔犺浇鍒濆鐣岄潰 if (this.$data.param.Show_Welcom_Page) { this.$data.param.Welcome_Page.Img = this.$data.param.Welcome_Page.Img.replace(/ /g, '+'); @@ -285,8 +289,8 @@ await this.Detail1_UIstyleGetInfo(this.ClsID, this.$data.param.Sub_Page[0].UI_Style.ID); await this.Detail2_UIstyleGetInfo(this.ClsID2, this.$data.param.Sub_Page[1].UI_Style.ID); - - console.log(this.$data.param); + + console.log(this.$data.param); }, changeSwiper(evt) { let index = evt.target.current || evt.detail.current; @@ -466,53 +470,47 @@ 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.$data.detail1StyleDefList); - } 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") + "9.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") + "9", @@ -520,8 +518,68 @@ showCancel: false, confirmText: this.translateSys("cancel") }); - }); + } }, + 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); + } + }) + + }) + + }, +getUIStyleInfo(info) { //Mobox3鏁版嵁绫荤晫闈㈡牱寮�+ const loginInfo = this.$store.getters.loginid + const dataSApi = this.$store.getters.getDataSApi + return new Promise((resolve, reject) => { + uni.request({ + url: dataSApi + 'api/class/uistyle/GetInfo?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 }, @@ -535,7 +593,7 @@ var $this = this; 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; @@ -618,7 +676,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; @@ -808,7 +866,7 @@ this.translateSys( "quotation_mark_left") + value .page_name + this.translateSys( - "sys.quotation_mark_right") + + "quotation_mark_right") + this.translate( "are_you_sure_clear_last"), @@ -942,8 +1000,34 @@ 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; + } }); }); @@ -1485,21 +1569,23 @@ }, sava(event) { var $this = this; + if (this.$data.detail1StyleDefList.length == 0) { uni.showModal({ title: this.translateSys("tip"), content: this.translate( - "page.tip_no_data_first") + + "tip_no_data_first") + this.translateSys( "quotation_mark_left") + this.param.Sub_Page[0].Name + this.translateSys( - "sys.quotation_mark_right") + + "quotation_mark_right") + this.translate( - "page.tip_no_data_last"), + "tip_no_data_last"), showCancel: false, confirmText: this.translateSys("cancel") }); return false; } + this.okLoading = true //鑾峰彇琛ㄥご灞炴� var head_attr = {}; this.$data.head_styledef.form.items.forEach(item => { @@ -1567,6 +1653,7 @@ }); }); if (jsonlist.length == 0) { + this.okLoading = false uni.showModal({ title: this.translateSys("tip"), content: this.translate("tip_no_select_data"), @@ -1600,21 +1687,23 @@ }, sava2(event) { var $this = this; + if (this.$data.detail1StyleDefList.length == 0) { uni.showModal({ title: this.translateSys("tip"), content: this.translate( - "page.tip_no_data_first") + + "tip_no_data_first") + this.translateSys( "quotation_mark_left") + this.param.Sub_Page[1].Name + this.translateSys( - "sys.quotation_mark_right") + + "quotation_mark_right") + this.translate( - "page.tip_no_data_last"), + "tip_no_data_last"), showCancel: false, confirmText: this.translateSys("cancel") }); return false; } + this.ok2Loading = true //鑾峰彇琛ㄥご灞炴� var head_attr = {}; this.$data.head_styledef.form.items.forEach(item => { @@ -1682,12 +1771,14 @@ }); }); if (jsonlist.length == 0) { + this.ok2Loading = false uni.showModal({ title: this.translateSys("tip"), content: this.translate("tip_no_select_data"), showCancel: false, confirmText: this.translateSys("cancel") }); + return; } const list = [] @@ -1811,7 +1902,7 @@ this.translateSys( "quotation_mark_left") + value .page_name + this.translateSys( - "sys.quotation_mark_right") + + "quotation_mark_right") + this.translate( "are_you_sure_clear_last"), success: function(res) { @@ -1952,7 +2043,15 @@ confirmText: this.translateSys("cancel") }); } + if (type == "1") + this.okLoading = false + else if (type == "2") + this.ok2Loading = false }).catch(ex => { + if (type == "1") + this.okLoading = false + else if (type == "2") + this.ok2Loading = false var tip = typeof ex == "string" ? ex : ex.errMsg; uni.showModal({ title: this.translateSys("error") + "8.1", @@ -2223,9 +2322,15 @@ font-size: 38rpx; font-weight: bold; float: right; + color: #fff; display: inline-block; } + button.btn_disabled { + background-color: #ddd; + color: #888; + } + .logo { height: 100rpx; width: 460rpx; -- Gitblit v1.9.1