From c8eb1d74a09537143e697c849ca6e8986344212e Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期四, 12 九月 2024 17:28:19 +0800 Subject: [PATCH] 3018 disabled也要显示具体控件 --- pages/modal/3037.vue | 4315 ++++++++++++++++++++++++++++------------------------------- 1 files changed, 2,083 insertions(+), 2,232 deletions(-) diff --git a/pages/modal/3037.vue b/pages/modal/3037.vue index a4f59fc..ca9cb91 100644 --- a/pages/modal/3037.vue +++ b/pages/modal/3037.vue @@ -288,7 +288,9 @@ <div class="panel_title">{{param.Sub_Cls.Title}}</div> <!-- 浠庢暟鎹壂鐮佸尯 --> <view class="v-area class_attr_body" v-if="param.Sub_Cls.Can_Add_Delete == true"> - <h4 style="margin: 15rpx 0 0 30rpx;font-weight: bold;">鏂板{{param.Sub_Cls.Name }}</h4> + <h4 style="margin: 15rpx 0 0 30rpx;font-weight: bold;"> + {{`${translateSys('add2')}'${param.Sub_Cls.Name}'` }} + </h4> <view class="form-group"> <!-- 宸﹀彸甯冨眬 --> <p class="tx_title2">{{param.Scan_Code.Name}}:</p> @@ -608,7 +610,8 @@ </view> </view> - <button type="default" @tap="cancel" class="btn_cancel" v-if="param.Sub_Cls.Can_Add_Delete == true">鍙栨秷</button> + <button type="default" @tap="cancel" class="btn_cancel" + v-if="param.Sub_Cls.Can_Add_Delete == true">{{translateSys('cancel')}}</button> <button type="default" @tap="sava" class="btn_add" v-if="param.Sub_Cls.Can_Add_Delete == true">{{title}}</button> <button type="default" @tap="sava" class="btn_sava" @@ -632,8 +635,9 @@ </view> </view> <view class="popup-footer"> - <button type="default" @tap="popup_sava" class="btn_popup_add">纭畾</button> - <button type="default" @tap="popup_cancel" class="btn_popup_cancel">鍙栨秷</button> + <button type="default" @tap="popup_sava" class="btn_popup_add">{{translateSys('ok')}}</button> + <button type="default" @tap="popup_cancel" + class="btn_popup_cancel">{{translateSys('cancel')}}</button> </view> </view> </uni-popup> @@ -644,7 +648,23 @@ <script> import Base64 from '../../components/js-base64/base64.js' import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' - import classUtils from "@/js/utils.js" + import utils from "@/js/utils.js" + import { + appGetInfo, + dictGetInfo, + dictItemGetInfo + } from "@/api/mobox.js" + import { + getUIStyleInfo, + runCustomEvent, + dataObjCreate, + dataObjDel + } from "@/api/data.js" + import { + classAttrList, + } from "@/api/index.js" + + export default { modules: { Base64, @@ -682,19 +702,19 @@ console.log(param); if (!param.Master_Cls.View_Style) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "璇ュ姛鑳界偣鏈厤缃晫闈㈢獥鍙o紝璇烽噸鏂伴厤缃紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } if (!param.Master_Cls.View_Style.Name) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "璇ュ姛鑳界偣鏈厤缃獥鍙f牱寮忥紝璇烽噸鏂伴厤缃紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -703,215 +723,128 @@ // Model: param.EditDlgMode, // Name: param.Master_Cls.View_Style.Name // } - //涓绘暟鎹被鑾峰彇 - var dataInfo = { - class_id: param.Master_Cls.ID - }; - var $this = this; - $this.$store.state.thisareaFuncID = param.Master_Cls.ID; - // console.log($this.$store.getters.getclassAttrList); - if ($this.$store.getters.getclassAttrList) { - $this.$data.classAttrList = $this.$store.getters.getclassAttrList; - $this.classGridStyleInfo(param.Master_Cls.ID, $this.$data.param.Master_Cls.View_Style.Name, 'Mast'); - } else { - $this.$store.dispatch('classAttrGetList', dataInfo).then(success => { - // console.log(success); - if (success.err_code == 0) { - $this.$data.classAttrList = success.result; - success.result.forEach(async (group, index) => { - group.attr_list.forEach(async (attr, key) => { - if (classUtils.attrTypeIsDict(attr.type)) - // if (attr.type == "瀛楀吀-瀛楃涓� || attr.type == "瀛楀吀-鏁存暟" ||attr.type == "dict-char" || attr.type == "dict-int") - { - await $this.DictItemGetList(attr, key, index, 'mast'); - } - }); - }); - setTimeout(function() { - $this.classGridStyleInfo(param.Master_Cls.ID, $this.$data.param.Master_Cls - .View_Style.Name, 'Mast'); - }, 500); - } else { - uni.showModal({ - title: "閿欒1", - content: success.err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - }).catch(ex => { - // console.log(ex); - uni.showModal({ - title: "閿欒1.1", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - } + this.loadData() - //浠庢暟鎹被鑾峰彇 - var subdataInfo = { - class_id: param.Sub_Cls.ID - }; - $this.$store.state.thisareaFuncSubID = param.Sub_Cls.ID; - if ($this.$store.getters.getSubClassAttrList) { - $this.$data.subClassAttrList = $this.$store.getters.getSubClassAttrList; - $this.classGridStyleInfo(param.Sub_Cls.ID, $this.$data.param.Sub_Cls.View_Style.Name, 'Sub'); - } else { - $this.$store.dispatch('subClassAttrGetList', subdataInfo).then(success => { - // console.log(success); - if (success.err_code == 0) { - $this.$data.subClassAttrList = success.result; - success.result.forEach(async (group, index) => { - group.attr_list.forEach(async (attr, key) => { - if (classUtils.attrTypeIsDict(attr.type)) { - //if (attr.type == "瀛楀吀-瀛楃涓� || attr.type == "瀛楀吀-鏁存暟" ||attr.type == "dict-char" || attr.type == "dict-int"){ - await $this.DictItemGetList(attr, key, index, 'sub'); - } - }); - }); - setTimeout(function() { - $this.classGridStyleInfo(param.Sub_Cls.ID, $this.$data.param.Sub_Cls.View_Style - .Name, 'Sub'); - }, 500); - } else { - uni.showModal({ - title: "閿欒1_1", - content: success.err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - }).catch(ex => { - // console.log(ex); - uni.showModal({ - title: "閿欒1_1.1", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - } }, methods: { - async DictItemGetList(attr, key, index, type) { //Mobox3寰楀埌瀛楀吀椤瑰垪琛�- this.data = []; - var $this = this; - var dataInfo = { - dict_id: attr.dict_id, - dict_name: attr.dict_name - }; - // console.log(dataInfo); - this.$store.dispatch('DictItemGetList', dataInfo).then(async (success) => { - // console.log(success); - if (success.err_code == 0) { - if (type == 'mast') { - $this.$data.classAttrList[index].attr_list[key].dictitem = success.result; - this.$store.commit("classAttrList", $this.$data.classAttrList); + setData(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 { - $this.$data.subClassAttrList[index].attr_list[key].dictitem = success.result; - this.$store.commit("subClassAttrList", $this.$data.subClassAttrList); + if (!data[key2]) { + that.$set(data, key2, {}); + } } - - } else { - uni.showModal({ - title: "閿欒1.2", - content: success.err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - }).catch(ex => { - // console.log(ex); - uni.showModal({ - title: "閿欒1.3", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" + data = data[key2]; }); }); }, - async classGridStyleInfo(clsid, styleName, clsType) { - var $this = this; - var gridstyleInfo = { - class_id: clsid, - ui_style_type: 2, - ui_style_name: styleName - }; - // console.log($this.$store.getters.getclassGridStyleInfo); - //鑾峰彇涓绘暟鎹被鐣岄潰鏍峰紡 - if (clsType == 'Mast') { - $this.$store.state.thisEditName = styleName; - if ($this.$store.getters.getclassGridStyleInfo) { - $this.$data.classGridStyle = $this.$store.getters.getclassGridStyleInfo; - $this.viewParam('Mast'); - } else { - //console.log(gridstyleInfo); - $this.$store.dispatch('UIStyleGetInfo', gridstyleInfo).then(success => { - // console.log(success); - if (success.err_code == 0) { - var styledef = Base64.decode(success.result.style_def); - success.result.style_def = JSON.parse(styledef); - $this.$data.classGridStyle = success.result; - // console.log($this.$data.classGridStyle); + + async loadData() { + //涓绘暟鎹被鑾峰彇 + const param = this.param + this.$data.classAttrList = await this.classAttrGetList(param.Master_Cls?.ID) + this.$data.classGridStyle = await this.classGridStyleInfo(param.Master_Cls.ID, param.Master_Cls + ?.View_Style?.Name) + this.viewParam('Mast'); + this.$data.classAttrList = await this.classAttrGetList(param.Sub_Cls?.ID) + this.$data.classGridStyle = await this.classGridStyleInfo(param.Sub_Cls?.ID, param.Sub_Cls?.View_Style + ?.Name) + this.viewParam('Sub'); + }, + async DictItemGetList(attr) { //Mobox3寰楀埌瀛楀吀椤瑰垪琛�+ try { + this.data = []; + var $this = this; + var dataInfo = { + dict_id: attr.dict_id, + dict_name: attr.dict_name + }; + const result = await dictItemGetInfo(dataInfo) + return result?.dict_item_list || [] - $this.viewParam('Mast'); - } else { - uni.showModal({ - title: "閿欒1.2", - content: success.err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - }).catch(ex => { - console.log(ex); - uni.showModal({ - title: "閿欒1.3", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - } - } else if (clsType == 'Sub') { //鑾峰彇浠庢暟鎹被鐣岄潰鏍峰紡 - $this.$store.state.thisEditSubName = styleName; - if ($this.$store.getters.getSubClassGridStyleInfo) { - $this.$data.subClassGridStyle = $this.$store.getters.getSubClassGridStyleInfo; - $this.viewParam('Sub'); - } else { - //console.log(gridstyleInfo); - $this.$store.dispatch('UIStyleGetInfo', gridstyleInfo).then(success => { - // console.log(success); - if (success.err_code == 0) { - var styledef = Base64.decode(success.result.style_def); - success.result.style_def = JSON.parse(styledef); - $this.$data.subClassGridStyle = success.result; - // console.log($this.$data.subClassGridStyle); - - $this.viewParam('Sub'); - - // $this.subClass_attr_init(); - } else { - uni.showModal({ - title: "閿欒1.2", - content: success.err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - }).catch(ex => { - console.log(ex); - uni.showModal({ - title: "閿欒1.3", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - } + } catch (ex) { + uni.showModal({ + title: this.translateSys('error') + " 1.2", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return [] } + + }, + async classAttrGetList(clsid) { + try { + + var $this = this; + var dataInfo = { + class_id: clsid, + }; + const result = await classAttrList(dataInfo) || [] + for (let index in result) { + const group = result[index] + for (let key in group.attr_list) { + const attr = group.attr_list[key] + if (utils.classUtils.attrTypeIsDict(attr.type)) { + attr.dictitem = await $this.DictItemGetList(attr); + } + } + } + return result + } catch (ex) { + // console.log(ex); + let exStr = JSON.stringify(ex) + if (exStr == "{}") + exStr = ex + let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr + uni.showModal({ + title: this.translateSys("error") + " 1.1", + content: tip, + showCancel: false, + confirmText: this.translateSys("cancel") + }); + return [] + }; + }, + + async classGridStyleInfo(clsid, styleName) { + try { + + var $this = this; + var gridstyleInfo = { + class_id: clsid, + ui_style_type: 2, + ui_style_name: styleName + }; + const result = await getUIStyleInfo(gridstyleInfo) + var styledef = Base64.decode(result.style_def || ""); + result.style_def = JSON.parse(styledef); + return result + + } catch (ex) { + // console.log(ex); + let exStr = JSON.stringify(ex) + if (exStr == "{}") + exStr = ex + let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr + uni.showModal({ + title: this.translateSys("error") + " 1.2", + content: tip, + showCancel: false, + confirmText: this.translateSys("cancel") + }); + return {} + }; }, viewParam(type) { //灏唌obox3灏忓啓鍙傛暟杞崲涓簃obox2澶у啓鍙傛暟 var classGridStyle = ''; @@ -1072,7 +1005,7 @@ } // console.log(ca.dictitem); } - if (classUtils.attrTypeIsDate(ca + if (utils.classUtils.attrTypeIsDateTime(ca .Type )) // if(ca.Type=='鏃ユ湡' || ca.Type=='鏃堕棿' ||ca.Type=='date' || ca.Type=='datetime') { @@ -1085,15 +1018,17 @@ ca.Value = date.year + '-' + (date.month >= 10 ? date.month : '0' + date .month) + '-' + (date.day >= 10 ? date.day : '0' + date.day); } - if (classUtils.attrTypeIsObjRefMulti(ca + if (utils.classUtils.attrTypeIsObjRefMulti(ca .Type)) // if(ca.Type=='寮曠敤瀵硅薄(澶氫釜)' || ca.Type=='obj-ref-multi'){ { ca.RelClsList = ca.RelCls; ca.Value = '璇烽�鎷�; } - if (classUtils.attrTypeIsRegion(ca.Type)) //if(ca.Type=='鐪佸競鍖�|| ca.Type=='region') + if (utils.classUtils.attrTypeIsRegion(ca + .Type)) //if(ca.Type=='鐪佸競鍖�|| ca.Type=='region') ca.Value = '璇烽�鎷�; - if (classUtils.attrTypeIsBool(ca.Type)) //if(ca.Type=='甯冨皵鍊�|| ca.Type=='bool') + if (utils.classUtils.attrTypeIsBool(ca + .Type)) //if(ca.Type=='甯冨皵鍊�|| ca.Type=='bool') ca.Value = false; attr.push(ca); @@ -1178,10 +1113,10 @@ } else { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "鏈壘鍒板彲鏄剧ず鐨勭殑灞炴�", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }, @@ -1228,7 +1163,8 @@ } } } - if (classUtils.attrTypeIsDate(ca.Type)) //if(ca.Type=='鏃ユ湡' || ca.Type=='鏃堕棿') + if (utils.classUtils.attrTypeIsDateTime(ca + .Type)) //if(ca.Type=='鏃ユ湡' || ca.Type=='鏃堕棿') { var nowDate = new Date(); var date = { @@ -1239,14 +1175,15 @@ ca.Value = date.year + '-' + (date.month >= 10 ? date.month : '0' + date .month) + '-' + (date.day >= 10 ? date.day : '0' + date.day); } - if (classUtils.attrTypeIsObjRefMulti(ca.Type)) //if(ca.Type=='寮曠敤瀵硅薄(澶氫釜)') + if (utils.classUtils.attrTypeIsObjRefMulti(ca.Type)) //if(ca.Type=='寮曠敤瀵硅薄(澶氫釜)') { ca.RelClsList = ca.RelCls; ca.Value = '璇�; } - if (classUtils.attrTypeIsRegion(ca.Type)) //if(ca.Type=='鐪佸競鍖�||ca.Type=='region') + if (utils.classUtils.attrTypeIsRegion(ca + .Type)) //if(ca.Type=='鐪佸競鍖�||ca.Type=='region') ca.Value = '璇烽�鎷�; - if (classUtils.attrTypeIsBool(ca.Type)) //if(ca.Type=='甯冨皵鍊�||ca.Type=='bool') + if (utils.classUtils.attrTypeIsBool(ca.Type)) //if(ca.Type=='甯冨皵鍊�||ca.Type=='bool') ca.Value = false; attr.push(ca); @@ -1331,10 +1268,10 @@ } else { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "鏈壘鍒板彲鏄剧ず鐨勭殑灞炴�", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }, @@ -1343,10 +1280,10 @@ var Before_Select_Event = $this.$data.param.Scan_Code.Before_Select_Event; if (!Before_Select_Event) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "閫夋嫨鍓嶄簨浠朵负绌猴紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1358,10 +1295,10 @@ var ar = attr[j]; if (ar.Value == '璇烽�鎷�) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar.DispName + "鏈�鎷╂暟鎹紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1378,7 +1315,7 @@ for (var j = 0; j < attr.length; j++) { var ar = attr[j]; if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar + if (utils.classUtils.attrTypeIsDict(ar .Type)) //if (ar.Type == '瀛楀吀' || ar.Type == '瀛楀吀-瀛楃涓� || ar.Type == '瀛楀吀-鏁存暟' ) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; @@ -1410,10 +1347,10 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar.DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1488,10 +1425,10 @@ var After_Select_Event = $this.$data.param.Scan_Code.After_Select_Event; if (!After_Select_Event) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "閫夋嫨鍚庝簨浠朵负绌猴紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1511,10 +1448,10 @@ } if (data.length == 0) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "鏈�鎷╂暟鎹紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1526,10 +1463,10 @@ var ar = attr[j]; if (ar.Value == '璇烽�鎷�) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar.DispName + "鏈�鎷╂暟鎹紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1583,33 +1520,25 @@ uni.showLoading({ title: "鍔犺浇涓�.." }); - this.$store.dispatch('dataObjDel', dataInfo).then(success => { + dataObjDel(dataInfo).then(success => { // console.log(success); uni.hideLoading(); - if (ret.err_code == 0) { - $this.$data.subPanelList.splice(index, 1); - uni.showModal({ - title: "鎻愮ず", - content: "鍒犻櫎鎴愬姛锛�, - showCancel: false, - confirmText: "鍙栨秷" - }); - } else { - uni.showModal({ - title: "閿欒9", - content: success.msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } + $this.$data.subPanelList.splice(index, 1); + uni.showModal({ + title: this.translateSys('tip') + "", + content: "鍒犻櫎鎴愬姛锛�, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }).catch(ex => { console.log(ex); uni.hideLoading(); uni.showModal({ - title: "鎻愮ず9.1", + title: this.translateSys('tip') + "9.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); } @@ -1950,7 +1879,7 @@ for (var j = 0; j < attr .length; j++) { var ar = attr[j]; - if (classUtils.attrTypeIsDict( + if (utils.classUtils.attrTypeIsDict( ar.Type )) //if(ar.Type=='瀛楀吀' || ar.Type=='瀛楀吀-瀛楃涓� || ar.Type=='瀛楀吀-鏁存暟') req.push({ @@ -2277,19 +2206,19 @@ .button_callback; if (!before_click_button) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "before_click_button-event_id涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } if (!button_callback) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "button_callback-event_id涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -2368,10 +2297,10 @@ classAttr_AddRef(e) { console.log(e.target); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "姝ゅ姛鑳借繕鏈疄鐜帮紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); // var value=this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].RelCls[e.target.value]; // this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value=value; @@ -2470,7 +2399,7 @@ if (ar.Value == '璇烽�鎷� || ar .Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; @@ -2488,15 +2417,14 @@ name: ar.Name, value: ar.Value }); - } else - { - const node = this.formatAttr(ar) - req.push({ - name: node.attr, - value: node.value - }); - } - + } else { + const node = this.formatAttr(ar) + req.push({ + name: node.attr, + value: node.value + }); + } + if (ar.notempty == true && !ar .Value) { @@ -2504,12 +2432,12 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar .DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -2556,70 +2484,58 @@ }; console.log(dataInfo); // return - this.$store.dispatch('createDataObj', - dataInfo).then(success => { - console.log(success); + dataObjCreate(dataInfo).then(result => { + console.log(result); uni.hideLoading(); - if (success.err_code == 0) { - var result = success - .result; - if (success.result - .action) { - var action = JSON - .parse(success - .result.Action - ); - if (action.ret == + if (success.result + .action) { + var action = JSON + .parse(success + .result.Action + ); + if (action.ret == + '0') { + if (action + .result_type == '0') { - if (action - .result_type == - '0') { - uni.showToast({ - title: action - .result, - icon: "success", - duration: 3000 - }); - } - // "{"ret":0, "result_type":0, "result":"鍒涘缓鎴愬姛123123123","info":""}" + uni.showToast({ + title: action + .result, + icon: "success", + duration: 3000 + }); } - } else - uni.showToast({ - title: "鍒涘缓鎴愬姛锛�, - icon: "success", - duration: 3000 - }); - //鍒锋柊 - uni.redirectTo({ - url: '../modal/3037?param=' + - JSON - .stringify( - this - .$data - .param - ) + - "&titlename=" + - this.$data - .title + // "{"ret":0, "result_type":0, "result":"鍒涘缓鎴愬姛123123123","info":""}" + } + } else + uni.showToast({ + title: "鍒涘缓鎴愬姛锛�, + icon: "success", + duration: 3000 }); - // this.class_attr_init(); - } else { - uni.showModal({ - title: "閿欒", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } + //鍒锋柊 + uni.redirectTo({ + url: '../modal/3037?param=' + + JSON + .stringify( + this + .$data + .param + ) + + "&titlename=" + + this.$data + .title + }); + // this.class_attr_init(); + }).catch(ex => { console.log(ex); uni.hideLoading(); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -2683,260 +2599,250 @@ }; console.log(dataInfo); // return; - this.$store.dispatch('runCustomEvent', - dataInfo).then(success => { - console.log(success); - if (success.err_code == 0) { - var data = success.result; - if (data.ret != 0) { - var tip = data - .err_info ? - typeof data - .err_info == - 'string' ? data - .err_info : data - .err_info.join( - '<br/>') : ''; - if (data.ret == 801) - uni.showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); - else uni.showModal({ - title: '鎻愮ず', - content: tip + - ',鎻愮ず:' + - data - .ret, + runCustomEvent( + dataInfo).then(data => { + console.log(data); + if (data.ret != 0) { + var tip = data + .err_info ? + typeof data + .err_info == + 'string' ? data + .err_info : data + .err_info.join( + '<br/>') : ''; + if (data.ret == 801) + uni.showModal({ + title: this.translateSys('tip'), + content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); - return false - } else { - var tip = data.info ? - typeof data.info == - 'string' ? data - .info : data.info - .join('<br/>') : - ''; - if (tip) uni - .showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + + ',鎻愮ず:' + + data + .ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? + typeof data.info == + 'string' ? data + .info : data.info + .join('<br/>') : + ''; + if (tip) uni + .showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); - if (data.action) { - var actionlist = - data.action; - if (actionlist) { - for (var j = - 0; j < - actionlist - .length; j++ + if (data.action) { + var actionlist = + data.action; + if (actionlist) { + for (var j = + 0; j < + actionlist + .length; j++ + ) { + var action = + actionlist[ + j] + var action_type = + action + .action_type; + var value = + action + .value; + if (action_type == + 'set_dlg_attr' ) { - var action = - actionlist[ - j] - var action_type = - action - .action_type; - var value = - action - .value; - if (action_type == - 'set_dlg_attr' - ) { - if ( - value) { - var val = - value; - if (typeof value == - 'string' - ) { - val = - JSON - .parse( - value - ); - } - console - .log( - val + if ( + value) { + var val = + value; + if (typeof value == + 'string' + ) { + val = + JSON + .parse( + value ); - for ( - var i = - 0; i < + } + console + .log( val - .length; i++ + ); + for ( + var i = + 0; i < + val + .length; i++ + ) { + for ( + var a = + 0; a < + this + .$data + .classAttrList + .length; a++ ) { for ( - var a = - 0; a < + var l = + 0; l < this .$data - .classAttrList - .length; a++ + .classAttrList[ + a + ] + .Attr + .length; l++ ) { - for ( - var l = - 0; l < + var ca = this .$data .classAttrList[ a ] - .Attr - .length; l++ + .Attr[ + l + ]; + if (val[ + i] + .attr == + ca + .Name ) { - var ca = - this - .$data - .classAttrList[ - a - ] - .Attr[ - l - ]; - if (val[ - i] - .attr == - ca - .Name - ) { - if (classUtils.attrTypeIsDict(ca.Type)) { - var - dictItemList = []; - for ( - var d in - val[ - i] - .choice_list - ) { - var val = - val[ - i] - .choice_list[ - d - ]; - dictItemList - .push({ - "CN_S_NAME": val, - "CN_S_VALUE": val, - "Name": val, - "label": val, - "value": val - }); + if (utils.classUtils.attrTypeIsDict(ca.Type)) { + var + dictItemList = []; + for ( + var d in + val[ + i] + .choice_list + ) { + var val = + val[ + i] + .choice_list[ + d + ]; + dictItemList + .push({ + "CN_S_NAME": val, + "CN_S_VALUE": val, + "Name": val, + "label": val, + "value": val + }); - } - ca.dictitem = - dictItemList; - // attr[j].dictitem = val[i].choice_list; - } else { - // ca.value = val[i].value; } + ca.dictitem = + dictItemList; + // attr[j].dictitem = val[i].choice_list; + } else { + // ca.value = val[i].value; } } } + } - var length = - 0; - if (! + var length = + 0; + if (! + this + .$data + .refdatastore + .filter( + function( + s + ) { + return val[ + i + ] + .attr == + s + .attr + } + ) + .length + ) { + length + = + 1; + this.$data + .refdatastore + .push( + val[ + i] + ); + } + if (length == + 0 + ) { + for ( + var j = + 0; j < this .$data .refdatastore - .filter( - function( - s - ) { - return val[ - i - ] - .attr == - s - .attr - } - ) - .length + .length; j++ ) { - length - = - 1; - this.$data - .refdatastore - .push( - val[ - i] - ); - } - if (length == - 0 - ) { - for ( - var j = - 0; j < - this + if (this .$data - .refdatastore - .length; j++ + .refdatastore[ + j + ] + .attr == + val[ + i] + .attr ) { - if (this - .$data + this.$data .refdatastore[ j ] - .attr == + .value = val[ i] - .attr - ) { - this.$data - .refdatastore[ - j - ] - .value = - val[ - i] - .value; - } + .value; } } } } } - if (action_type == - 'open_select_userdlg' - ) { - uni.showModal({ - title: "閿欒2.2", - content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, - showCancel: false, - confirmText: "鍙栨秷" - }); - } + } + if (action_type == + 'open_select_userdlg' + ) { + uni.showModal({ + title: this.translateSys('error') + " 2.2", + content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, + showCancel: false, + confirmText: this.translateSys('cancel') + }); } } } } - } else { - uni.showModal({ - title: "閿欒2", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); } + }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒2.1", + title: this.translateSys('error') + " 2.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -3018,146 +2924,78 @@ }; console.log(dataInfo); // return; - this.$store.dispatch('runCustomEvent', - dataInfo).then(success => { - console.log(success); - if (success.err_code == 0) { - var data = success.result; - if (data.ret != 0) { - var tip = data - .err_info ? - typeof data - .err_info == - 'string' ? data - .err_info : data - .err_info.join( - '<br/>') : ''; - if (data.ret == 801) - uni.showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); - else uni.showModal({ - title: '鎻愮ず', - content: tip + - ',鎻愮ず:' + - data - .ret, + runCustomEvent( + dataInfo).then(data => { + console.log(data); + if (data.ret != 0) { + var tip = data + .err_info ? + typeof data + .err_info == + 'string' ? data + .err_info : data + .err_info.join( + '<br/>') : ''; + if (data.ret == 801) + uni.showModal({ + title: this.translateSys('tip'), + content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); - return false - } else { - var tip = data.info ? - typeof data.info == - 'string' ? data - .info : data.info - .join('<br/>') : - ''; - if (tip) uni - .showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + + ',鎻愮ず:' + + data + .ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? + typeof data.info == + 'string' ? data + .info : data.info + .join('<br/>') : + ''; + if (tip) uni + .showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); - 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 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++ ) { - var result = - action - .value; - for (var i = - 0; i < - result - .length; i++ + if (result[ + i + ] + .choice_list ) { - if (result[ - i - ] - .choice_list - ) { - for ( - var c = - 0; c < - $this - .$data - .classAttrList - .length; c++ - ) { - var attr = - $this - .$data - .classAttrList[ - c - ] - .Attr; - for ( - var j = - 0; j < - attr - .length; j++ - ) { - if (attr[ - j - ] - .Name == - result[ - i - ] - .attr - ) { - if (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 c = 0; c < @@ -3179,18 +3017,6 @@ attr .length; j++ ) { - console - .log( - attr[ - j - ] - .Name + - '==' + - result[ - i - ] - .attr - ); if (attr[ j ] @@ -3200,219 +3026,289 @@ ] .attr ) { - attr[ - j] - .Value = - result[ - i - ] - .value; + 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; + } } } } - var length = - 0; - if (! + } + for ( + var c = + 0; c < + $this + .$data + .classAttrList + .length; c++ + ) { + var attr = $this .$data - .refdatastore - .filter( - function( - s - ) { - return result[ - i - ] - .attr == - s - .attr - } - ) - .length + .classAttrList[ + c + ] + .Attr; + for ( + var j = + 0; j < + attr + .length; j++ ) { - length - = - 1; - $this - .$data - .refdatastore - .push( - result[ - i - ] - ); - } - if (length == - 0 - ) { - for ( - var j = - 0; j < - $this - .$data - .refdatastore - .length; j++ - ) { - if ($this - .$data - .refdatastore[ + console + .log( + attr[ j ] - .attr == + .Name + + '==' + result[ i ] .attr - ) { - $this - .$data - .refdatastore[ - j - ] - .value = - result[ - i - ] - .value; - } - } - } - } - } else if (data - .action[i] - .action_type == - 'set_global_attr' - ) { - $this.$data - .global_attr = - data - .action[ - i] - .value || []; - } - } - } - - if (data.result) { - var result = data - .result; - for (var i = 0; i < - result - .length; i++) { - for (var c = - 0; c < - $this.$data - .classAttrList - .length; c++ - ) { - var attr = - $this - .$data - .classAttrList[ - c] - .Attr; - for (var j = - 0; j < - attr - .length; j++ - ) { - if (attr[ - j - ] - .Name == - result[ - i - ] - .attr - ) { - attr[ - j] - .Value = + ); + if (attr[ + j + ] + .Name == result[ i ] - .value; + .attr + ) { + attr[ + j] + .Value = + result[ + i + ] + .value; + } } } - } - - var length = 0; - if (!$this - .$data - .refdatastore - .filter( - function( - s - ) { - return result[ - i - ] - .attr == - s - .attr - }) - .length) { - length = 1; - $this.$data - .refdatastore - .push( - result[ - i - ] - ); - } - if (length == - 0) { - for (var j = - 0; j < + var length = + 0; + if (! $this .$data .refdatastore - .length; j++ + .filter( + function( + s + ) { + return result[ + i + ] + .attr == + s + .attr + } + ) + .length ) { - if ($this + length + = + 1; + $this .$data - .refdatastore[ - j - ] - .attr == - result[ - i - ] - .attr - ) { + .refdatastore + .push( + result[ + i + ] + ); + } + if (length == + 0 + ) { + for ( + var j = + 0; j < $this + .$data + .refdatastore + .length; j++ + ) { + if ($this .$data .refdatastore[ j ] - .value = + .attr == result[ i ] - .value; + .attr + ) { + $this + .$data + .refdatastore[ + j + ] + .value = + result[ + i + ] + .value; + } } + } + } + } else if (data + .action[i] + .action_type == + 'set_global_attr' + ) { + $this.$data + .global_attr = + data + .action[ + i] + .value || []; + } + } + } + + if (data.result) { + var result = data + .result; + for (var i = 0; i < + result + .length; i++) { + for (var c = + 0; c < + $this.$data + .classAttrList + .length; c++ + ) { + var attr = + $this + .$data + .classAttrList[ + c] + .Attr; + for (var j = + 0; j < + attr + .length; j++ + ) { + if (attr[ + j + ] + .Name == + result[ + i + ] + .attr + ) { + attr[ + j] + .Value = + result[ + i + ] + .value; + } + } + } + + var length = 0; + if (!$this + .$data + .refdatastore + .filter( + function( + s + ) { + return result[ + i + ] + .attr == + s + .attr + }) + .length) { + length = 1; + $this.$data + .refdatastore + .push( + result[ + i + ] + ); + } + if (length == + 0) { + for (var j = + 0; j < + $this + .$data + .refdatastore + .length; j++ + ) { + if ($this + .$data + .refdatastore[ + j + ] + .attr == + result[ + i + ] + .attr + ) { + $this + .$data + .refdatastore[ + j + ] + .value = + result[ + i + ] + .value; } } } } } - } else { - uni.showModal({ - title: "閿欒3", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); } + }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒3.1", + title: this.translateSys('error') + " 3.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -3515,128 +3411,118 @@ }; console.log(dataInfo); // return; - this.$store.dispatch('runCustomEvent', - dataInfo).then(success => { - console.log(success); - if (success.err_code == 0) { - var data = success.result; - if (data.ret != 0) { - var tip = data - .err_info ? - typeof data - .err_info == - 'string' ? data - .err_info : data - .err_info.join( - '<br/>') : ''; - if (data.ret == 801) - uni.showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); - else uni.showModal({ - title: '鎻愮ず', - content: tip + - ',鎻愮ず:' + - data - .ret, - showCancel: false, - confirmText: "鍙栨秷" - }); - return false - } else { - var tip = data.info ? - typeof data.info == - 'string' ? data - .info : data.info - .join('<br/>') : - ''; - if (tip) uni - .showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); + runCustomEvent(dataInfo).then(data => { + console.log(data); - var result = data - .result; - for (var i = 0; i < - result.length; i++ - ) { - // self.class_attr_ele.find('.attr_field[data-field="' + result[i].attr + '"]').val(result[i].value).data('val', result[i].value); - var length = 0; - if (!this.$data - .refdatastore - .filter( - function( - s) { - return result[ - i - ] - .attr == - s - .attr - }).length - ) { - length = 1; - this.$data - .refdatastore - .push( - result[ - i] - ); - } - if (length == 0) { - for (var j = - 0; j < this - .$data - .refdatastore - .length; j++ - ) { - if (this - .$data - .refdatastore[ - j] + if (data.ret != 0) { + var tip = data + .err_info ? + typeof data + .err_info == + 'string' ? data + .err_info : data + .err_info.join( + '<br/>') : ''; + if (data.ret == 801) + uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + + ',鎻愮ず:' + + data + .ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? + typeof data.info == + 'string' ? data + .info : data.info + .join('<br/>') : + ''; + if (tip) uni + .showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + + var result = data + .result; + for (var i = 0; i < + result.length; i++ + ) { + // self.class_attr_ele.find('.attr_field[data-field="' + result[i].attr + '"]').val(result[i].value).data('val', result[i].value); + var length = 0; + if (!this.$data + .refdatastore + .filter( + function( + s) { + return result[ + i + ] .attr == - result[ - i] + s .attr - ) { - this.$data - .refdatastore[ - j - ] - .value = - result[ - i - ] - .value; - } + }).length + ) { + length = 1; + this.$data + .refdatastore + .push( + result[ + i] + ); + } + if (length == 0) { + for (var j = + 0; j < this + .$data + .refdatastore + .length; j++ + ) { + if (this + .$data + .refdatastore[ + j] + .attr == + result[ + i] + .attr + ) { + this.$data + .refdatastore[ + j + ] + .value = + result[ + i + ] + .value; } } } - - this.add(); } - } else { - uni.showModal({ - title: "閿欒4", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); + + this.add(); } + }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒4.1", + title: this.translateSys('error') + " 4.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -3745,134 +3631,307 @@ }; console.log(dataInfo); // return; - this.$store.dispatch('runCustomEvent', - dataInfo).then(success => { - console.log(success); - if (success.err_code == 0) { - var data = success.result; - if (data.ret != 0) { - var tip = data - .err_info ? - typeof data - .err_info == - 'string' ? data - .err_info : data - .err_info.join( - '<br/>') : ''; - if (data.ret == 801) - uni.showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); - else uni.showModal({ - title: '鎻愮ず', - content: tip + - ',鎻愮ず:' + - data - .ret, + runCustomEvent(dataInfo).then(data => { + console.log(data); + if (data.ret != 0) { + var tip = data + .err_info ? + typeof data + .err_info == + 'string' ? data + .err_info : data + .err_info.join( + '<br/>') : ''; + if (data.ret == 801) + uni.showModal({ + title: this.translateSys('tip'), + content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); - return false - } else { - var tip = data.info ? - typeof data.info == - 'string' ? data - .info : data.info - .join('<br/>') : - ''; - if (tip) uni - .showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + + ',鎻愮ず:' + + data + .ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? + typeof data.info == + 'string' ? data + .info : data.info + .join('<br/>') : + ''; + if (tip) uni + .showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); - if (data != "") { - var actions = data - .action; - console.log( - actions); - if (actions) { - for (var i = - 0; i < - actions - .length; i++ + if (data != "") { + var actions = data + .action; + console.log( + actions); + if (actions) { + for (var i = + 0; i < + actions + .length; i++ + ) { + var action = + actions[ + i]; + var val = + action + .value; + var enviroment = + JSON + .stringify( + enviroment + ); + + if (action + .action_type == + 'open_panel' ) { - var action = - actions[ - i]; - var val = + var d = + dialog({ + title: '<i class="ace-icon fa fa-info-circle"></i> ' + + this.translateSys('tip'), + content: action + .action_type + + '姝ction灏氭湭澶勭悊锛� + }); + d + .show(); + } else if ( + action + .action_type == + 'open_select_userdlg' + ) { + var style = + val + .style; + // style == 'user' ? '閫夋嫨浜哄憳' : style == 'department' ? '閫夋嫨閮ㄩ棬' : style == 'role' ? '閫夋嫨瑙掕壊' : '' + var $this = + this; + var param = { + index: index, + iindex: iindex, + button_callback: button_callback, + req: req, + data_attr: data_attr + } + uni.navigateTo({ + url: '../selpsn/index?mulit=false¶m=' + + JSON + .stringify( + param + ), + events: { + AddPer( + data, + param + ) { + // console.log(param); + console + .log( + data + ); + var callback_eventid = + param + .button_callback + .trim(); + var info = { + eventid: callback_eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: $this + .$data + .param + .Master_Cls + .ID, + objid: "", + attr: param + .req, + inputparameter: data + } + $this + .DataObjRunCustomEvent( + info, + param + .data_attr + ); + } + } + }); + } else if ( + action + .action_type == + 'open_data_query_dlg' + ) { + + } else if ( + action + .action_type == + 'open_common_dlg' + ) { + var value = action .value; - var enviroment = - JSON - .stringify( - enviroment - ); - + var d = + dialog({ + title: '<i class="ace-icon fa fa-info-circle"></i> ' + + this.translateSys('tip'), + content: action + .action_type + + '姝ction灏氭湭澶勭悊锛� + }); + d + .show(); + } else if ( + action + .action_type == + 'open_project_query_dlg' + ) { + //console.log(action.value.select_range); + //console.log(action.value.mulit_select); + var priRel = + '-1'; if (action - .action_type == - 'open_panel' - ) { - var d = - dialog({ - title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', - content: action - .action_type + - '姝ction灏氭湭澶勭悊锛� - }); - d - .show(); - } else if ( + .value + .select_range == + '鍏ㄩ儴鐩稿叧' + ) + priRel = + '0'; + else if ( action - .action_type == - 'open_select_userdlg' - ) { - var style = - val - .style; - // style == 'user' ? '閫夋嫨浜哄憳' : style == 'department' ? '閫夋嫨閮ㄩ棬' : style == 'role' ? '閫夋嫨瑙掕壊' : '' - var $this = - this; - var param = { - index: index, - iindex: iindex, - button_callback: button_callback, - req: req, - data_attr: data_attr - } - uni.navigateTo({ - url: '../selpsn/index?mulit=false¶m=' + - JSON - .stringify( - param - ), - events: { - AddPer( - data, - param - ) { - // console.log(param); - console - .log( - data - ); - var callback_eventid = + .value + .select_range == + '鎴戣礋璐g殑椤圭洰' + ) + priRel = + '1'; + else if ( + action + .value + .select_range == + '鎴戝垱寤虹殑' + ) + priRel = + '2'; + else if ( + action + .value + .select_range == + '鎴戝弬涓庣殑' || + action + .value + .select_range == + '鎴戝弬鍔犵殑' + ) + priRel = + '3'; + else if ( + action + .value + .select_range == + '鎴戝叧娉ㄧ殑' + ) + priRel = + '4'; + else if ( + action + .value + .select_range == + '鎴戜笅灞炵殑椤圭洰' + ) + priRel = + '5'; + + var $this = + this; + var param_ = { + index: index, + iindex: iindex, + button_callback: button_callback, + req: req + } + uni.navigateTo({ + url: '../selPrj/index?relation=' + + priRel + + '¶m=' + + JSON + .stringify( + param_ + ), + events: { + AddPer( + data, + param + ) { + $this + .$data + .classAttrList[ param - .button_callback - .trim(); + .index + ] + .Attr[ + param + .iindex + ] + .Value = + data[ + 0 + ] + .Name; + $this + .$data + .classAttrList[ + param + .index + ] + .Attr[ + param + .iindex + ] + .ValID = + data[ + 0 + ] + .ID + + ';' + + data[ + 0 + ] + .Name; + var callback_eventid = + param + .button_callback + .trim(); + if ( + callback_eventid) { var info = { eventid: callback_eventid, - edtype: "0", - projectid: '', - rclsid: '', - robjid: '', - userlogin: '', + edtype: "2", + projectid: data[ + 0 + ] + .ID, + rclsid: "", + robjid: "", + userlogin: "", clsid: $this .$data .param @@ -3881,232 +3940,48 @@ objid: "", attr: param .req, - inputparameter: data } + $this .DataObjRunCustomEvent( - info, - param - .data_attr + info ); } } - }); - } else if ( - action - .action_type == - 'open_data_query_dlg' - ) { - - } else if ( - action - .action_type == - 'open_common_dlg' - ) { - var value = - action - .value; - var d = - dialog({ - title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', - content: action - .action_type + - '姝ction灏氭湭澶勭悊锛� - }); - d - .show(); - } else if ( - action - .action_type == - 'open_project_query_dlg' - ) { - //console.log(action.value.select_range); - //console.log(action.value.mulit_select); - var priRel = - '-1'; - if (action - .value - .select_range == - '鍏ㄩ儴鐩稿叧' - ) - priRel = - '0'; - else if ( - action - .value - .select_range == - '鎴戣礋璐g殑椤圭洰' - ) - priRel = - '1'; - else if ( - action - .value - .select_range == - '鎴戝垱寤虹殑' - ) - priRel = - '2'; - else if ( - action - .value - .select_range == - '鎴戝弬涓庣殑' || - action - .value - .select_range == - '鎴戝弬鍔犵殑' - ) - priRel = - '3'; - else if ( - action - .value - .select_range == - '鎴戝叧娉ㄧ殑' - ) - priRel = - '4'; - else if ( - action - .value - .select_range == - '鎴戜笅灞炵殑椤圭洰' - ) - priRel = - '5'; - - var $this = - this; - var param_ = { - index: index, - iindex: iindex, - button_callback: button_callback, - req: req } - uni.navigateTo({ - url: '../selPrj/index?relation=' + - priRel + - '¶m=' + - JSON - .stringify( - param_ - ), - events: { - AddPer( - data, - param - ) { - $this - .$data - .classAttrList[ - param - .index - ] - .Attr[ - param - .iindex - ] - .Value = - data[ - 0 - ] - .Name; - $this - .$data - .classAttrList[ - param - .index - ] - .Attr[ - param - .iindex - ] - .ValID = - data[ - 0 - ] - .ID + - ';' + - data[ - 0 - ] - .Name; - var callback_eventid = - param - .button_callback - .trim(); - if ( - callback_eventid) { - var info = { - eventid: callback_eventid, - edtype: "2", - projectid: data[ - 0 - ] - .ID, - rclsid: "", - robjid: "", - userlogin: "", - clsid: $this - .$data - .param - .Master_Cls - .ID, - objid: "", - attr: param - .req, - } - - $this - .DataObjRunCustomEvent( - info - ); - } - } - } + }); + } else { + var d = + dialog({ + title: '<i class="ace-icon fa fa-info-circle"></i> ' + + this.translateSys('tip'), + content: action + .action_type + + '姝ction灏氭湭澶勭悊锛� }); - } else { - var d = - dialog({ - title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', - content: action - .action_type + - '姝ction灏氭湭澶勭悊锛� - }); - d - .show(); - } + d + .show(); } } - } else { - uni.showModal({ - title: "鎻愮ず5.2", - content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + - eventid, - showCancel: false, - confirmText: "鍙栨秷" - }); } + } else { + uni.showModal({ + title: this.translateSys('tip') + "5.2", + content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + + eventid, + showCancel: false, + confirmText: this.translateSys('cancel') + }); } - } else { - uni.showModal({ - title: "閿欒5", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); } + }).catch(ex => { // console.log(ex); uni.showModal({ - title: "鎻愮ず5.1", + title: this.translateSys('tip') + "5.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -4170,256 +4045,245 @@ }; console.log(dataInfo); // return; - this.$store.dispatch('runCustomEvent', - dataInfo).then(success => { - console.log(success); - if (success.err_code == 0) { - var data = success.result; - if (data.ret != 0) { - var tip = data - .err_info ? - typeof data - .err_info == - 'string' ? data - .err_info : data - .err_info.join( - '<br/>') : ''; - if (data.ret == 801) - uni.showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); - else uni.showModal({ - title: '鎻愮ず', - content: tip + - ',鎻愮ず:' + - data - .ret, + runCustomEvent(dataInfo).then(data => { + console.log(data); + if (data.ret != 0) { + var tip = data + .err_info ? + typeof data + .err_info == + 'string' ? data + .err_info : data + .err_info.join( + '<br/>') : ''; + if (data.ret == 801) + uni.showModal({ + title: this.translateSys('tip'), + content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); - return false - } else { - var tip = data.info ? - typeof data.info == - 'string' ? data - .info : data.info - .join('<br/>') : - ''; - if (tip) uni - .showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + + ',鎻愮ず:' + + data + .ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? + typeof data.info == + 'string' ? data + .info : data.info + .join('<br/>') : + ''; + if (tip) uni + .showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); - var actionlist = data - .action; - if (actionlist) { - for (var j = 0; j < - actionlist - .length; j++) { - var action = - actionlist[ - j] - var action_type = - action - .action_type; - var value = - action - .value; - if (action_type == - 'set_dlg_attr' - ) { - if ( - value) { - var val = - value; - if (typeof value == - 'string' - ) { - val = - JSON - .parse( - value - ); - } - console - .log( - val + var actionlist = data + .action; + if (actionlist) { + for (var j = 0; j < + actionlist + .length; j++) { + var action = + actionlist[ + j] + var action_type = + action + .action_type; + var value = + action + .value; + if (action_type == + 'set_dlg_attr' + ) { + if ( + value) { + var val = + value; + if (typeof value == + 'string' + ) { + val = + JSON + .parse( + value ); - for ( - var i = - 0; i < + } + console + .log( val - .length; i++ + ); + for ( + var i = + 0; i < + val + .length; i++ + ) { + for ( + var a = + 0; a < + this + .$data + .subClassAttrList + .length; a++ ) { for ( - var a = - 0; a < + var l = + 0; l < this .$data - .subClassAttrList - .length; a++ + .subClassAttrList[ + a + ] + .Attr + .length; l++ ) { - for ( - var l = - 0; l < + var ca = this .$data .subClassAttrList[ a ] - .Attr - .length; l++ + .Attr[ + l + ]; + if (val[ + i] + .attr == + ca + .Name ) { - var ca = - this - .$data - .subClassAttrList[ - a - ] - .Attr[ - l - ]; - if (val[ - i] - .attr == - ca - .Name - ) { - if (classUtils.attrTypeIsDict(ca.Type)) { - var - dictItemList = []; - for ( - var d in - val[ - i] - .choice_list - ) { - var val = - val[ - i] - .choice_list[ - d - ]; - dictItemList - .push({ - "CN_S_NAME": val, - "CN_S_VALUE": val, - "Name": val, - "label": val, - "value": val - }); + if (utils.classUtils.attrTypeIsDict(ca.Type)) { + var + dictItemList = []; + for ( + var d in + val[ + i] + .choice_list + ) { + var val = + val[ + i] + .choice_list[ + d + ]; + dictItemList + .push({ + "CN_S_NAME": val, + "CN_S_VALUE": val, + "Name": val, + "label": val, + "value": val + }); - } - ca.dictitem = - dictItemList; - // attr[j].dictitem = val[i].choice_list; - } else { - // ca.value = val[i].value; } + ca.dictitem = + dictItemList; + // attr[j].dictitem = val[i].choice_list; + } else { + // ca.value = val[i].value; } } } + } - var length = - 0; - if (! + var length = + 0; + if (! + this + .$data + .refdatastore + .filter( + function( + s + ) { + return val[ + i + ] + .attr == + s + .attr + } + ) + .length + ) { + length + = + 1; + this.$data + .refdatastore + .push( + val[ + i] + ); + } + if (length == + 0 + ) { + for ( + var j = + 0; j < this .$data .refdatastore - .filter( - function( - s - ) { - return val[ - i - ] - .attr == - s - .attr - } - ) - .length + .length; j++ ) { - length - = - 1; - this.$data - .refdatastore - .push( - val[ - i] - ); - } - if (length == - 0 - ) { - for ( - var j = - 0; j < - this + if (this .$data - .refdatastore - .length; j++ + .refdatastore[ + j + ] + .attr == + val[ + i] + .attr ) { - if (this - .$data + this.$data .refdatastore[ j ] - .attr == + .value = val[ i] - .attr - ) { - this.$data - .refdatastore[ - j - ] - .value = - val[ - i] - .value; - } + .value; } } } } } - if (action_type == - 'open_select_userdlg' - ) { - uni.showModal({ - title: "閿欒6.2", - content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, - showCancel: false, - confirmText: "鍙栨秷" - }); - } + } + if (action_type == + 'open_select_userdlg' + ) { + uni.showModal({ + title: this.translateSys('error') + " 6.2", + content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, + showCancel: false, + confirmText: this.translateSys('cancel') + }); } } } - } else { - uni.showModal({ - title: "閿欒6", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); } + }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒6.1", + title: this.translateSys('error') + " 6.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -4493,163 +4357,79 @@ }; console.log(dataInfo); // return; - this.$store.dispatch('runCustomEvent', - dataInfo).then(success => { - console.log(success); - if (success.err_code == 0) { - var data = success.result; - if (data.ret != 0) { - var tip = data - .err_info ? - typeof data - .err_info == - 'string' ? data - .err_info : data - .err_info.join( - '<br/>') : ''; - if (data.ret == 801) - uni.showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); - else uni.showModal({ - title: '鎻愮ず', - content: tip + - ',鎻愮ず:' + - data - .ret, + runCustomEvent(dataInfo).then(data => { + console.log(data); + if (data.ret != 0) { + var tip = data + .err_info ? + typeof data + .err_info == + 'string' ? data + .err_info : data + .err_info.join( + '<br/>') : ''; + if (data.ret == 801) + uni.showModal({ + title: this.translateSys('tip'), + content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); - return false - } else { - var tip = data.info ? - typeof data.info == - 'string' ? data - .info : data.info - .join('<br/>') : - ''; - if (tip) uni - .showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + + ',鎻愮ず:' + + data + .ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? + typeof data.info == + 'string' ? data + .info : data.info + .join('<br/>') : + ''; + if (tip) uni + .showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); - var actionlist = data - .action; - if (actionlist) { - console.log( - actionlist); - for (var ii = - 0; ii < - actionlist - .length; ii++ + 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 action = - actionlist[ - ii]; - if (action - .action_type == - 'set_dlg_attr' + var result = + action + .value; + for (var i = + 0; i < + result + .length; i++ ) { - var result = - action - .value; - for (var i = - 0; i < - result - .length; i++ + if (result[ + i + ] + .choice_list ) { - if (result[ - i - ] - .choice_list - ) { - for ( - var s = - 0; s < - $this - .$data - .subPanelList - .length; s++ - ) { - for ( - var c = - 0; c < - $this - .$data - .subPanelList[ - s - ] - .subClassAttrList - .length; c++ - ) { - var attr = - $this - .$data - .subPanelList[ - s - ] - .subClassAttrList[ - c - ] - .Attr; - for ( - var j = - 0; j < - attr - .length; j++ - ) { - if (attr[ - j - ] - .Name == - result[ - i - ] - .attr - ) { - if (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 < @@ -4685,18 +4465,6 @@ attr .length; j++ ) { - console - .log( - attr[ - j - ] - .Name + - '==' + - result[ - i - ] - .attr - ); if (attr[ j ] @@ -4706,466 +4474,70 @@ ] .attr ) { - attr[ - j] - .Value = - result[ - i - ] - .value; + 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; + } } } } } - var length = - 0; - if (! - $this - .$data - .refdatastore - .filter( - function( - s - ) { - return result[ - i - ] - .attr == - s - .attr - } - ) - .length - ) { - length - = - 1; - $this - .$data - .refdatastore - .push( - result[ - i - ] - ); - } - if (length == - 0 - ) { - for ( - var j = - 0; j < - $this - .$data - .refdatastore - .length; j++ - ) { - if ($this - .$data - .refdatastore[ - j - ] - .attr == - result[ - i - ] - .attr - ) { - $this - .$data - .refdatastore[ - j - ] - .value = - result[ - i - ] - .value; - } - } - } } - } 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 - .$data - .check_list = - action - .value - .config; - if (action - .value - .config - .appear_style == - 'sideslip' - ) //鍒ゆ柇鏄惁鏄晶婊�- $this - .$data - .popupType = - 'right'; - else - $this - .$data - .popupType = - 'center' - // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� - $this - .$refs - .popup - .open( - $this - .$data - .popupType - ); - } - } else if ( - action - .action_type == - 'add_subcls_panel' - ) { //涓讳粠鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�- var result = - action - .value; - var $this = - this; - var list_1 = - JSON - .parse( - JSON - .stringify( - this - .$data - .subClassAttrList - ) - ); - var scanCodeVal = + for ( + var s = + 0; s < $this .$data - .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.$data .subPanelList - .push({ - scanCodeVal: scanCodeVal, - subClassAttr: list_1 - }); - for (var i = - 0; i < - result - .length; i++ + .length; s++ ) { for ( - var s = - 0; s < + var c = + 0; c < $this .$data - .subPanelList - .length; s++ + .subPanelList[ + s + ] + .subClassAttrList + .length; c++ ) { - if ($this + var attr = + $this .$data .subPanelList[ s ] - .scanCodeVal == - scanCodeVal - ) { - if (result[ - i - ] - .attr == - "S_ID" - ) - $this - .$data - .subPanelList[ - s - ] - .ObjID = - result[ - i - ] - .value; - var _subClassAttr = - $this - .$data - .subPanelList[ - s - ] - .subClassAttr; - for ( - var c = - 0; c < - _subClassAttr - .length; c++ - ) { - var attr = - _subClassAttr[ - 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; - } - } - } - - // $this.$data.subPanelList[s].subClassAttr=list_1; - } - } - - var length = - 0; - if (! - $this - .$data - .refdatastore - .filter( - function( - s - ) { - return result[ - i - ] - .attr == - s - .attr - } - ) - .length - ) { - length - = - 1; - $this - .$data - .refdatastore - .push( - result[ - i - ] - ); - } - if (length == - 0 - ) { - for ( - var j = - 0; j < - $this - .$data - .refdatastore - .length; j++ - ) { - if ($this - .$data - .refdatastore[ - j - ] - .attr == - result[ - i - ] - .attr - ) { - $this - .$data - .refdatastore[ - j - ] - .value = - result[ - i - ] - .value; - } - } - } - } - } - } - } - - if (data.result) { - var list_1 = JSON - .parse(JSON - .stringify( - this - .$data - .subClassAttrList - )); - var scanCodeVal = - $this.$data - .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.$data - .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.$data - .subPanelList - .length; s++ - ) { - if ($this - .$data - .subPanelList[ - s] - .scanCodeVal == - scanCodeVal - ) { - if (result[ - i - ] - .attr == - "S_ID" - ) - $this - .$data - .subPanelList[ - s - ] - .ObjID = - result[ - i - ] - .value; - var _subClassAttr = - $this - .$data - .subPanelList[ - s - ] - .subClassAttr; - for ( - var c = - 0; c < - _subClassAttr - .length; c++ - ) { - var attr = - _subClassAttr[ + .subClassAttrList[ c ] .Attr; @@ -5175,7 +4547,18 @@ attr .length; j++ ) { - // console.log(attr[j].Name+'=='+result[i].attr); + console + .log( + attr[ + j + ] + .Name + + '==' + + result[ + i + ] + .attr + ); if (attr[ j ] @@ -5196,85 +4579,556 @@ } } } - } - - var length = 0; - if (!$this - .$data - .refdatastore - .filter( - function( - s - ) { - return result[ - i - ] - .attr == - s - .attr - }) - .length) { - length = 1; - $this.$data - .refdatastore - .push( - result[ - i - ] - ); - } - if (length == - 0) { - for (var j = - 0; j < + var length = + 0; + if (! $this .$data .refdatastore - .length; j++ + .filter( + function( + s + ) { + return result[ + i + ] + .attr == + s + .attr + } + ) + .length ) { - if ($this + length + = + 1; + $this .$data - .refdatastore[ - j - ] - .attr == - result[ - i - ] - .attr - ) { + .refdatastore + .push( + result[ + i + ] + ); + } + if (length == + 0 + ) { + for ( + var j = + 0; j < $this + .$data + .refdatastore + .length; j++ + ) { + if ($this .$data .refdatastore[ j ] - .value = + .attr == + result[ + i + ] + .attr + ) { + $this + .$data + .refdatastore[ + j + ] + .value = + result[ + i + ] + .value; + } + } + } + } + } 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 + .$data + .check_list = + action + .value + .config; + if (action + .value + .config + .appear_style == + 'sideslip' + ) //鍒ゆ柇鏄惁鏄晶婊�+ $this + .$data + .popupType = + 'right'; + else + $this + .$data + .popupType = + 'center' + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� + $this + .$refs + .popup + .open( + $this + .$data + .popupType + ); + } + } else if ( + action + .action_type == + 'add_subcls_panel' + ) { //涓讳粠鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+ var result = + action + .value; + var $this = + this; + var list_1 = + JSON + .parse( + JSON + .stringify( + this + .$data + .subClassAttrList + ) + ); + var scanCodeVal = + $this + .$data + .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.$data + .subPanelList + .push({ + scanCodeVal: scanCodeVal, + subClassAttr: list_1 + }); + for (var i = + 0; i < + result + .length; i++ + ) { + for ( + var s = + 0; s < + $this + .$data + .subPanelList + .length; s++ + ) { + if ($this + .$data + .subPanelList[ + s + ] + .scanCodeVal == + scanCodeVal + ) { + if (result[ + i + ] + .attr == + "S_ID" + ) + $this + .$data + .subPanelList[ + s + ] + .ObjID = result[ i ] .value; + var _subClassAttr = + $this + .$data + .subPanelList[ + s + ] + .subClassAttr; + for ( + var c = + 0; c < + _subClassAttr + .length; c++ + ) { + var attr = + _subClassAttr[ + 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; + } + } + } + + // $this.$data.subPanelList[s].subClassAttr=list_1; + } + } + + var length = + 0; + if (! + $this + .$data + .refdatastore + .filter( + function( + s + ) { + return result[ + i + ] + .attr == + s + .attr + } + ) + .length + ) { + length + = + 1; + $this + .$data + .refdatastore + .push( + result[ + i + ] + ); + } + if (length == + 0 + ) { + for ( + var j = + 0; j < + $this + .$data + .refdatastore + .length; j++ + ) { + if ($this + .$data + .refdatastore[ + j + ] + .attr == + result[ + i + ] + .attr + ) { + $this + .$data + .refdatastore[ + j + ] + .value = + result[ + i + ] + .value; + } } } } } } } - } else { - uni.showModal({ - title: "閿欒7", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); + + if (data.result) { + var list_1 = JSON + .parse(JSON + .stringify( + this + .$data + .subClassAttrList + )); + var scanCodeVal = + $this.$data + .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.$data + .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.$data + .subPanelList + .length; s++ + ) { + if ($this + .$data + .subPanelList[ + s] + .scanCodeVal == + scanCodeVal + ) { + if (result[ + i + ] + .attr == + "S_ID" + ) + $this + .$data + .subPanelList[ + s + ] + .ObjID = + result[ + i + ] + .value; + var _subClassAttr = + $this + .$data + .subPanelList[ + s + ] + .subClassAttr; + for ( + var c = + 0; c < + _subClassAttr + .length; c++ + ) { + var attr = + _subClassAttr[ + 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; + } + } + } + } + } + + var length = 0; + if (!$this + .$data + .refdatastore + .filter( + function( + s + ) { + return result[ + i + ] + .attr == + s + .attr + }) + .length) { + length = 1; + $this.$data + .refdatastore + .push( + result[ + i + ] + ); + } + if (length == + 0) { + for (var j = + 0; j < + $this + .$data + .refdatastore + .length; j++ + ) { + if ($this + .$data + .refdatastore[ + j + ] + .attr == + result[ + i + ] + .attr + ) { + $this + .$data + .refdatastore[ + j + ] + .value = + result[ + i + ] + .value; + } + } + } + } + } } + }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒7.1", + title: this.translateSys('error') + " 7.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -5293,7 +5147,7 @@ if (ar.Value == '璇烽�鎷� || ar .Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; @@ -5320,12 +5174,12 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar .DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -5347,7 +5201,7 @@ if (ar.Value == '璇烽�鎷� || ar .Value == '鈥斺�璇烽�鎷┾�鈥�) ar .Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; @@ -5377,12 +5231,12 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar .DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -5444,112 +5298,101 @@ }; console.log(dataInfo); // return; - this.$store.dispatch('runCustomEvent', - dataInfo).then(success => { - console.log(success); + runCustomEvent(dataInfo).then(data => { + console.log(data); uni.hideLoading(); - if (success.err_code == 0) { - var data = success.result; - if (data.ret != 0) { - var tip = data - .err_info ? - typeof data - .err_info == - 'string' ? data - .err_info : data - .err_info.join( - '<br/>') : ''; - if (data.ret == 801) - uni.showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); - else uni.showModal({ - title: '鎻愮ず', - content: tip + - ',鎻愮ず:' + - data - .ret, + if (data.ret != 0) { + var tip = data + .err_info ? + typeof data + .err_info == + 'string' ? data + .err_info : data + .err_info.join( + '<br/>') : ''; + if (data.ret == 801) + uni.showModal({ + title: this.translateSys('tip'), + content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); - return false - } else { - var tip = data.info ? - typeof data.info == - 'string' ? data - .info : data.info - .join('<br/>') : - ''; - if (tip) uni - .showModal({ - title: '鎻愮ず', - content: tip, - showCancel: false, - confirmText: "鍙栨秷" - }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + + ',鎻愮ず:' + + data + .ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? + typeof data.info == + 'string' ? data + .info : data.info + .join('<br/>') : + ''; + if (tip) uni + .showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); - var result = data - .result; - if (eventID != $this - .$data.param - .After_OK_Event.ID) - $this - .scan_OKDataObjRunCustomEvent( - $this.$data - .param - .After_OK_Event - .ID); - else { - //鍒锋柊 - uni.redirectTo({ - url: '../modal/3037?param=' + - JSON - .stringify( - $this - .$data - .param - ) + - "&titlename=" + + var result = data + .result; + if (eventID != $this + .$data.param + .After_OK_Event.ID) + $this + .scan_OKDataObjRunCustomEvent( + $this.$data + .param + .After_OK_Event + .ID); + else { + //鍒锋柊 + uni.redirectTo({ + url: '../modal/3037?param=' + + JSON + .stringify( $this .$data - .title - }); - } + .param + ) + + "&titlename=" + + $this + .$data + .title + }); } - } else { - uni.showModal({ - title: "閿欒8", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); } + }).catch(ex => { // console.log(ex); uni.hideLoading(); uni.showModal({ - title: "閿欒8.1", + title: this.translateSys('error') + " 8.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, formatAttr(attr) { - if (classUtils.attrTypeIsObjRefMulti(attr.Type)) //if(ar.Type=='寮曠敤瀵硅薄(澶氫釜)') + if (utils.classUtils.attrTypeIsObjRefMulti(attr.Type)) //if(ar.Type=='寮曠敤瀵硅薄(澶氫釜)') if (attr.Value == '璇�) ar.Value = ''; - if (classUtils.attrTypeIsUser(attr.Type) || classUtils.attrTypeIsProject(attr + if (utils.classUtils.attrTypeIsUser(attr.Type) || utils.classUtils.attrTypeIsProject(attr .Type)) //if(ar.Type=='寮曠敤浜哄憳' || ar.Type=='寮曠敤椤圭洰') return { attr: attr.Name, value: attr.ValID ? attr.ValID : '' }; - else if (classUtils.attrTypeIsBool(attr.Type)) //if(ar.Type=='甯冨皵鍊�) + else if (utils.classUtils.attrTypeIsBool(attr.Type)) //if(ar.Type=='甯冨皵鍊�) return { attr: attr.Name, value: attr.Value ? '1' : '0' @@ -5560,6 +5403,14 @@ value: attr.Value ? attr.Value : '' }; }, + translate(t) { + if (typeof this.$t == "function") return this.$t(`page.${t}`) + else return t; + }, + translateSys(t) { + if (typeof this.$t == "function") return this.$t(`sys.${t}`) + else return t; + }, } } </script> -- Gitblit v1.9.1