From b0041cf10ba3ddf74b9edcfd340a7d1c9179d878 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期一, 03 三月 2025 18:48:19 +0800 Subject: [PATCH] 5601 form --- pages/modal/3037.vue | 5119 ++++++++++++++++++++++++++++------------------------------ 1 files changed, 2,485 insertions(+), 2,634 deletions(-) diff --git a/pages/modal/3037.vue b/pages/modal/3037.vue index a4f59fc..0022d13 100644 --- a/pages/modal/3037.vue +++ b/pages/modal/3037.vue @@ -163,7 +163,7 @@ <a class="class_attr_add_ref"><i class="ace-icon fa fa-plus-circle"></i></a> </div> <input type="text" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" - disabled="true"> + disabled="true" :maxlength="-1"> </view> <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" @@ -172,7 +172,7 @@ </p> <input type="text" class="attr_field" :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - 9 +'%'}" - disabled="true"> + disabled="true" :maxlength="-1"> <div class="text-right2" v-if="attr.Type=='寮曠敤瀵硅薄(鍗曚釜)'|| attr.Type=='obj-ref'"> <a @tap="classAttr_AddRef" :data-classid="attr.RelCls[0].id" :data-classname="attr.RelCls[0].name"><i class="ace-icon fa fa-plus-circle"></i></a> @@ -196,7 +196,7 @@ <a class="class_attr_add_per" @tap="classAttr_AddPer(index,iindex)"><i class="ace-icon fa fa-plus-circle"></i></a> </div> - <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true"> + <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true" :maxlength="-1"> </view> <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" @@ -205,7 +205,7 @@ </p> <input type="text" class="attr_field" :value="attr.Value" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - 9 +'%'}" - disabled="true"> + disabled="true" :maxlength="-1"> <div class="text-right2"> <a class="class_attr_add_per" @tap="classAttr_AddPer(index,iindex)"><i class="ace-icon fa fa-plus-circle"></i></a> @@ -222,7 +222,7 @@ <a href="#" class="class_attr_add_prj" @tap="classAttr_AddPrj(index,iindex)"><i class="ace-icon fa fa-plus-circle"></i></a> </div> - <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true"> + <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true" :maxlength="-1"> </view> <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" @@ -231,7 +231,7 @@ </p> <input type="text" class="attr_field" :value="attr.Value" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true ?10:5) - 9 +'%'}" - disabled="true"> + disabled="true" :maxlength="-1"> <div class="text-right2"> <a class="class_attr_add_prj" @tap="classAttr_AddPrj(index,iindex)"><i class="ace-icon fa fa-plus-circle"></i></a> @@ -245,7 +245,7 @@ :style="{'font-family':classattr.Font.Name?classattr.Font.Name:'initial','font-size':classattr.Font.Size?classattr.Font.Size:'initial','font-weight':classattr.Font.Bold?'bold':'initial','font-style':classattr.Font.Tilt?'italic':'initial','text-decoration':classattr.Font.Underline?'underline':'initial','background-color':classattr.Font.Bk_Color,'color':classattr.Font.Text_Color,'width':classattr.title_p_wdith+'%'}"><i class="i_tishi" v-if="attr.notempty==true">*</i>{{attr.DispName}}:</text> <input type="text" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" - :disabled="attr.edit?false:true"> + :disabled="attr.edit?false:true" :maxlength="-1"> </view> <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" @@ -254,7 +254,7 @@ </p> <input type="text" class="attr_field" :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true ?10:5) +'%'}" - :disabled="attr.edit?false:true"> + :disabled="attr.edit?false:true" :maxlength="-1"> <i class="i_tishi" v-if="attr.notempty==true || attr.NotEmpty=='1'">*</i> </view> </view> @@ -288,12 +288,14 @@ <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> <input type="text" class="attr_field" :value="scanCodeVal" @focus="scan_ontap" @blur="scan_onevent" - :style="param.Scan_Code.Have_Select_Button==true?'width: '+(100-(param.Scan_Code.Name.length * 5)-14)+'%;':'width: '+(100-(param.Scan_Code.Name.length * 5)-5)+'%;'"> + :style="param.Scan_Code.Have_Select_Button==true?'width: '+(100-(param.Scan_Code.Name.length * 5)-14)+'%;':'width: '+(100-(param.Scan_Code.Name.length * 5)-5)+'%;'" :maxlength="-1"> <div class="text-right2" v-if="param.Scan_Code.Have_Select_Button==true"> <a @tap="scan_classAttr_extButton()"><i class="ace-icon fa" :class="param.Scan_Code.Img?param.Scan_Code.Img:'fa-plus-circle'"></i></a> @@ -474,7 +476,7 @@ <a class="class_attr_add_ref"><i class="ace-icon fa fa-plus-circle"></i></a> </div> <input type="text" :data-iiindex="iiindex" :data-index="index" :data-iindex="iindex" - :style="{'width':attr.Width}" disabled="true"> + :style="{'width':attr.Width}" disabled="true" :maxlength="-1"> </view> <view v-if="subclassattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" @@ -484,7 +486,7 @@ <input type="text" class="attr_field" :data-iiindex="iiindex" :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - subclassattr.title_p_wdith - 16 +'%'}" - disabled="true"> + disabled="true" :maxlength="-1"> <div class="text-right2" v-if="attr.Type=='寮曠敤瀵硅薄(鍗曚釜)' || attr.Type=='obj-ref'"> <a @tap="classAttr_AddRef" :data-classid="attr.RelCls[0].id" :data-classname="attr.RelCls[0].name"><i @@ -511,7 +513,7 @@ class="ace-icon fa fa-plus-circle"></i></a> </div> <input type="text" :value="attr.Value" :style="{'width':attr.Width}" - disabled="true"> + disabled="true" :maxlength="-1"> </view> <view v-if="subclassattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" @@ -520,7 +522,7 @@ </p> <input type="text" class="attr_field" :value="attr.Value" :style="{'width': attr.Width.split('%')[0] - subclassattr.title_p_wdith - 16 +'%'}" - disabled="true"> + disabled="true" :maxlength="-1"> <div class="text-right2"> <a class="class_attr_add_per" @tap="classAttr_AddPer(index,iindex)"><i class="ace-icon fa fa-plus-circle"></i></a> @@ -538,7 +540,7 @@ class="ace-icon fa fa-plus-circle"></i></a> </div> <input type="text" :value="attr.Value" :style="{'width':attr.Width}" - disabled="true"> + disabled="true" :maxlength="-1"> </view> <view v-if="subclassattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" @@ -547,7 +549,7 @@ </p> <input type="text" class="attr_field" :value="attr.Value" :style="{'width': attr.Width.split('%')[0] - subclassattr.title_p_wdith - 16 +'%'}" - disabled="true"> + disabled="true" :maxlength="-1"> <div class="text-right2"> <a class="class_attr_add_prj" @tap="classAttr_AddPrj(index,iindex)"><i class="ace-icon fa fa-plus-circle"></i></a> @@ -561,7 +563,7 @@ :style="{'font-family':subclassattr.Font.Name?subclassattr.Font.Name:'initial','font-size':subclassattr.Font.Size?subclassattr.Font.Size:'initial','font-weight':subclassattr.Font.Bold?'bold':'initial','font-style':subclassattr.Font.Tilt?'italic':'initial','text-decoration':subclassattr.Font.Underline?'underline':'initial','background-color':subclassattr.Font.Bk_Color,'color':subclassattr.Font.Text_Color,'width':subclassattr.title_p_wdith+'%'}"><i class="i_tishi" v-if="attr.notempty==true">*</i>{{attr.DispName}}:</text> <input type="text" :data-iiindex="iiindex" :data-index="index" :data-iindex="iindex" - :style="{'width':attr.Width}" :disabled="attr.edit?false:true"> + :style="{'width':attr.Width}" :disabled="attr.edit?false:true" :maxlength="-1"> </view> <view v-if="subclassattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" @@ -571,7 +573,7 @@ <input type="text" class="attr_field" :data-iiindex="iiindex" :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - subclassattr.title_p_wdith - 7 +'%'}" - :disabled="attr.edit?false:true"> + :disabled="attr.edit?false:true" :maxlength="-1"> </view> </view> <view class="form-group" v-if="attr.Type=='鐪佸競鍖� ||attr.Type=='region'" @@ -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') }); }); }, @@ -2658,7 +2574,7 @@ ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 var obj_attr = {}; info.attr.forEach(item => { - obj_attr[item.attr] = item.val; + obj_attr[item.attr] = item.value; }); if (!info.eventid.includes('{')) info .eventid = '{' + info.eventid + '}'; @@ -2683,1545 +2599,59 @@ }; 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: "鍙栨秷" - }); - - 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' - ) { - if ( - value) { - var val = - value; - if (typeof value == - 'string' - ) { - val = - JSON - .parse( - value - ); - } - console - .log( - val - ); - for ( - var i = - 0; i < - val - .length; i++ - ) { - for ( - var a = - 0; a < - this - .$data - .classAttrList - .length; a++ - ) { - for ( - var l = - 0; l < - this - .$data - .classAttrList[ - a - ] - .Attr - .length; l++ - ) { - 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 - }); - - } - ca.dictitem = - dictItemList; - // attr[j].dictitem = val[i].choice_list; - } else { - // ca.value = val[i].value; - } - } - } - } - - 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 - .length; j++ - ) { - if (this - .$data - .refdatastore[ - j - ] - .attr == - val[ - i] - .attr - ) { - this.$data - .refdatastore[ - j - ] - .value = - val[ - i] - .value; - } - } - } - } - } - } - if (action_type == - 'open_select_userdlg' - ) { - uni.showModal({ - title: "閿欒2.2", - content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - } - } - } - } - } else { - uni.showModal({ - title: "閿欒2", - content: success - .err_msg, + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + + ',鎻愮ず:' + + data + .ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); - } - }).catch(ex => { - // console.log(ex); - uni.showModal({ - title: "閿欒2.1", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - }, - DataObjRunCustomEvent(info, data_attr) { - var $this = this; - var enviroment = { - 'function': '3000', // 鍔熻兘鐐圭紪鍙�- cls_id: this.$data.param.Master_Cls - .ID, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�- 'button': 'top', // top/bottom - button_name: '鏂板', - master: { - cls_id: this.$data.param - .Master_Cls - .ID, // button=bottom鏃�master鐨刢ls_id - //obj_id: '' // button=bottom鏃�master鐨刼bj_id - } - }; - enviroment.edit_dlg = { - type: 'small', //灏忕獥鍙�- class_id: this.$data.param - .Master_Cls.ID, //褰撳墠鏁版嵁绫籭d - } - if (data_attr) { - enviroment.edit_dlg - .form_control = { //鎵�睘鐨勮〃鍗曟帶浠�- name: data_attr.Name, //瀛楁灞炴� - text: data_attr - .DispName, //鏄剧ず鏂囨湰 - group_name: data_attr - .GroupName, //灞炴�缁�- type: data_attr.Type, //瀛楁绫诲瀷 - readonly: data_attr - .ReadOnly, //鏄惁鍙 - button_img: data_attr - .button_img, //寮曠敤鎸夐挳鐨勫浘鏍�- button_tooltip: data_attr - .button_tooltip //寮曠敤鎸夐挳鐨則ooltip - } - } - // var dataInfo = { - // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid.replace('{','').replace('}',''), - // rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, - // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), inputparameter: '', global_attr: JSON.stringify(this.$data.global_attr) - // } - enviroment = Base64.encode(JSON.stringify( - enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 - var global_attr = Base64.encode(JSON - .stringify(this.$data.global_attr) - ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 - if (info.dataJson) - info.dataJson = Base64.encode(JSON - .stringify(info.dataJson) - ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 - var obj_attr = {}; - info.attr.forEach(item => { - obj_attr[item.attr] = item.val; - }); - if (!info.eventid.includes('{')) info - .eventid = '{' + info.eventid + '}'; - var dataInfo = { - ed_type: info.edtype, - start_transaction: '', - class_id: info.clsid, - class_name: '', - event_id: info.eventid, - event_name: '', - data_obj_id: info.objid, - obj_attr: obj_attr, - prj_id: info.projectid, - ref_cls_id: info.rclsid, - rel_obj_id: info.robjid, - user_login: info.userlogin, - data_json: info.dataJson, - compose_info: '', - ext_info: enviroment, - global_attr: global_attr, - input_param: '', - }; - 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: "鍙栨秷" - }); - - var actionlist = data - .action; - if (actionlist) { - console.log( - actionlist); - for (var i = 0; i < - actionlist - .length; i++) { - var action = - actionlist[ - i]; - if (action - .action_type == - 'set_dlg_attr' - ) { - var result = - action - .value; - for (var i = - 0; i < - result - .length; i++ - ) { - if (result[ - i - ] - .choice_list - ) { - for ( - var 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 < - $this - .$data - .classAttrList - .length; c++ - ) { - var attr = - $this - .$data - .classAttrList[ - 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; - } - } - } - } - } 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; - } - } - } - } - } - } + return false } else { - uni.showModal({ - title: "閿欒3", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - }).catch(ex => { - // console.log(ex); - uni.showModal({ - title: "閿欒3.1", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - }, - OKDataObjRunCustomEvent() { - var enviroment = { - 'function': '3000', // 鍔熻兘鐐圭紪鍙�- cls_id: this.$data.param.Master_Cls - .ID, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�- 'button': 'top', // top/bottom - button_name: '鏂板', - master: { - cls_id: this.$data.param - .Master_Cls - .ID, // button=bottom鏃�master鐨刢ls_id - - } - }; - var eventid = this.$data.edit_ok_event - .scrip_id; - var req = []; - var attrlist = this.$data.classAttrList; - for (var i = 0; i < attrlist.length; i++) { - var attr = attrlist[i].Attr; - for (var j = 0; j < attr.length; j++) { - var ar = attr[j]; - - - if (ar.Value == '璇烽�鎷� || ar - .Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = + var tip = data.info ? + typeof data.info == + 'string' ? data + .info : data.info + .join('<br/>') : ''; - req.push(this.formatAttr(ar)); - } - } - if (this.$data.refdatastore.length > 0) { - for (var i = 0; i < this.$data - .refdatastore.length; i++) { - if (!req.filter(function(s) { - return this.$data - .refdatastore[i] - .attr == s.name - }).length) { - length = 1; - req.push({ - 'attr': this.$data - .refdatastore[ - i].attr, - 'value': this.$data - .refdatastore[ - i].value - }); - } - } - } - var info = { - eventid: eventid, - edtype: "0", - projectid: '', - rclsid: '', - robjid: '', - userlogin: '', - clsid: this.$data.param.Master_Cls - .ID, - objid: "", - attr: req, - } - // var dataInfo = { - // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid,rclsid: info.rclsid, - // robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, - // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), global_attr: JSON.stringify(this.$data.global_attr) - // } - enviroment = Base64.encode(JSON.stringify( - enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 - var global_attr = Base64.encode(JSON - .stringify(this.$data.global_attr) - ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 - var obj_attr = {}; - info.attr.forEach(item => { - obj_attr[item.attr] = item.val; - }); - if (!eventid.includes('{')) eventid = '{' + - eventid + '}'; - var dataInfo = { - ed_type: info.edtype, - start_transaction: '', - class_id: info.clsid, - class_name: '', - event_id: eventid, - event_name: '', - data_obj_id: info.objid, - obj_attr: obj_attr, - prj_id: info.projectid, - ref_cls_id: info.rclsid, - rel_obj_id: info.robjid, - user_login: info.userlogin, - data_json: '', - compose_info: '', - ext_info: enviroment, - global_attr: global_attr, - input_param: '', - }; - 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, + if (tip) 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: "鍙栨秷" - }); - 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] - .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: "鍙栨秷" - }); - } - }).catch(ex => { - // console.log(ex); - uni.showModal({ - title: "閿欒4.1", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - }, - DataObjRunCustomEvent_Return(eventid, - data_attr, button_callback, index, iindex - ) { - var enviroment = { - 'function': '3000', // 鍔熻兘鐐圭紪鍙�- cls_id: this.$data.param.Master_Cls - .ID, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�- 'button': 'top', // top/bottom - button_name: '鏂板', - master: { - cls_id: this.$data.param - .Master_Cls - .ID, // button=bottom鏃�master鐨刢ls_id - //obj_id: '' // button=bottom鏃�master鐨刼bj_id - } - }; - var req = []; - var attrlist = this.$data.classAttrList; - for (var i = 0; i < attrlist.length; i++) { - var attr = attrlist[i].Attr; - for (var j = 0; j < attr.length; j++) { - var ar = attr[j]; - req.push(this.formatAttr(ar)); - } - } - if (this.$data.refdatastore.length > 0) { - for (var i = 0; i < this.$data - .refdatastore.length; i++) { - if (!req.filter(function(s) { - return this.$data - .refdatastore[i] - .attr == s.name - }).length) { - length = 1; - req.push({ - 'attr': this.$data - .refdatastore[ - i].attr, - 'value': this.$data - .refdatastore[ - i].value - }); - } - } - } - var extinfo = enviroment; - extinfo.edit_dlg = { - type: 'small', //灏忕獥鍙�- class_id: this.$data.param - .Master_Cls.ID, //褰撳墠鏁版嵁绫籭d - } - if (data_attr) { - extinfo.edit_dlg - .form_control = { //鎵�睘鐨勮〃鍗曟帶浠�- name: data_attr.Name, //瀛楁灞炴� - text: data_attr - .DispName, //鏄剧ず鏂囨湰 - group_name: data_attr - .GroupName, //灞炴�缁�- type: data_attr.Type, //瀛楁绫诲瀷 - readonly: data_attr - .ReadOnly, //鏄惁鍙 - button_img: data_attr - .button_img, //寮曠敤鎸夐挳鐨勫浘鏍�- button_tooltip: data_attr - .button_tooltip //寮曠敤鎸夐挳鐨則ooltip - } - } - // var dataInfo = { - // edtype: "0", eventid: eventid, projectid: '',rclsid: '', robjid: '', userlogin: '', - // clsid: this.$data.param.Master_Cls.ID, objid: '',attr: JSON.stringify(req), - // extinfo: JSON.stringify(extinfo), global_attr: JSON.stringify(this.$data.global_attr) - // } - extinfo = Base64.encode(JSON.stringify( - extinfo)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 - var global_attr = Base64.encode(JSON - .stringify(this.$data.global_attr) - ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 - var obj_attr = {}; - req.forEach(item => { - obj_attr[item.attr] = item.val; - }); - if (!eventid.includes('{')) eventid = '{' + - eventid + '}'; - var dataInfo = { - ed_type: "0", - start_transaction: '', - class_id: this.$data.param.clsid, - class_name: '', - event_id: eventid, - event_name: '', - data_obj_id: '', - obj_attr: obj_attr, - prj_id: '', - ref_cls_id: '', - rel_obj_id: '', - user_login: '', - data_json: '', - compose_info: '', - ext_info: extinfo, - global_attr: global_attr, - input_param: '', - }; - 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: "鍙栨秷" - }); - - 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 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_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 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> ' + - '鎻愮ず', - content: action - .action_type + - '姝ction灏氭湭澶勭悊锛� - }); - d - .show(); - } - } - } - } else { - uni.showModal({ - title: "鎻愮ず5.2", - content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + - eventid, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - } - } else { - uni.showModal({ - title: "閿欒5", - content: success - .err_msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - }).catch(ex => { - // console.log(ex); - uni.showModal({ - title: "鎻愮ず5.1", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - }, - scan_ini_DataObjRunCustomEvent(info) { - var obj_attr = {}; - info.attr.forEach(item => { - obj_attr[item.attr] = item - .value; - }); - var param = { - EditStyle: this.$data.param.Sub_Cls - .View_Style.Name, - ViewStyle: this.$data.param.Sub_Cls - .View_Style.Name, - NotTriggerSysEvent: 0, - enviroment: { - 'function': '3000', // 鍔熻兘鐐圭紪鍙�- cls_id: this.$data.param - .Sub_Cls.ID, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�- 'button': 'top', // top/bottom - button_name: '鏂板', - master: { - cls_id: this.$data.param - .Sub_Cls - .ID, // button=bottom鏃�master鐨刢ls_id - //obj_id: '' // button=bottom鏃�master鐨刼bj_id - obj_attrs: obj_attr, - } - } - } - var inputparameter = ''; - var global_attr = ''; - // var dataInfo = { - // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid, - // rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, - // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(param), inputparameter: inputparameter, global_attr: global_attr - // } - param = Base64.encode(JSON.stringify( - param)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 - - if (!info.eventid.includes('{')) info - .eventid = '{' + info.eventid + '}'; - var dataInfo = { - ed_type: info.edtype, - start_transaction: '', - class_id: info.clsid, - class_name: '', - event_id: info.eventid, - event_name: '', - data_obj_id: info.objid, - obj_attr: obj_attr, - prj_id: info.projectid, - ref_cls_id: info.rclsid, - rel_obj_id: info.robjid, - user_login: info.userlogin, - data_json: '', - compose_info: '', - ext_info: param, - global_attr: '', - input_param: '', - }; - 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: "鍙栨秷" - }); - - var actionlist = data - .action; + if (data.action) { + var actionlist = + data.action; if (actionlist) { - for (var j = 0; j < + for (var j = + 0; j < actionlist - .length; j++) { + .length; j++ + ) { var action = actionlist[ j] @@ -4262,7 +2692,7 @@ 0; a < this .$data - .subClassAttrList + .classAttrList .length; a++ ) { for ( @@ -4270,7 +2700,7 @@ 0; l < this .$data - .subClassAttrList[ + .classAttrList[ a ] .Attr @@ -4279,7 +2709,7 @@ var ca = this .$data - .subClassAttrList[ + .classAttrList[ a ] .Attr[ @@ -4291,7 +2721,7 @@ ca .Name ) { - if (classUtils.attrTypeIsDict(ca.Type)) { + if (utils.classUtils.attrTypeIsDict(ca.Type)) { var dictItemList = []; for ( @@ -4395,31 +2825,1465 @@ 'open_select_userdlg' ) { uni.showModal({ - title: "閿欒6.2", + title: this.translateSys('error') + " 2.2", content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, showCancel: false, - confirmText: "鍙栨秷" + 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') + " 2.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') + }); + }); + }, + DataObjRunCustomEvent(info, data_attr) { + var $this = this; + var enviroment = { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param.Master_Cls + .ID, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param + .Master_Cls + .ID, // button=bottom鏃�master鐨刢ls_id + //obj_id: '' // button=bottom鏃�master鐨刼bj_id + } + }; + enviroment.edit_dlg = { + type: 'small', //灏忕獥鍙�+ class_id: this.$data.param + .Master_Cls.ID, //褰撳墠鏁版嵁绫籭d + } + if (data_attr) { + enviroment.edit_dlg + .form_control = { //鎵�睘鐨勮〃鍗曟帶浠�+ name: data_attr.Name, //瀛楁灞炴� + text: data_attr + .DispName, //鏄剧ず鏂囨湰 + group_name: data_attr + .GroupName, //灞炴�缁�+ type: data_attr.Type, //瀛楁绫诲瀷 + readonly: data_attr + .ReadOnly, //鏄惁鍙 + button_img: data_attr + .button_img, //寮曠敤鎸夐挳鐨勫浘鏍�+ button_tooltip: data_attr + .button_tooltip //寮曠敤鎸夐挳鐨則ooltip + } + } + // var dataInfo = { + // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid.replace('{','').replace('}',''), + // rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, + // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), inputparameter: '', global_attr: JSON.stringify(this.$data.global_attr) + // } + enviroment = Base64.encode(JSON.stringify( + enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var global_attr = Base64.encode(JSON + .stringify(this.$data.global_attr) + ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + if (info.dataJson) + info.dataJson = Base64.encode(JSON + .stringify(info.dataJson) + ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var obj_attr = {}; + info.attr.forEach(item => { + obj_attr[item.attr] = item.value; + }); + if (!info.eventid.includes('{')) info + .eventid = '{' + info.eventid + '}'; + var dataInfo = { + ed_type: info.edtype, + start_transaction: '', + class_id: info.clsid, + class_name: '', + event_id: info.eventid, + event_name: '', + data_obj_id: info.objid, + obj_attr: obj_attr, + prj_id: info.projectid, + ref_cls_id: info.rclsid, + rel_obj_id: info.robjid, + user_login: info.userlogin, + data_json: info.dataJson, + compose_info: '', + ext_info: enviroment, + global_attr: global_attr, + input_param: '', + }; + console.log(dataInfo); + // return; + 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: 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 actionlist = data + .action; + if (actionlist) { + console.log( + actionlist); + for (var i = 0; i < + actionlist + .length; i++) { + var action = + actionlist[ + i]; + if (action + .action_type == + 'set_dlg_attr' + ) { + var result = + action + .value; + for (var i = + 0; i < + result + .length; i++ + ) { + if (result[ + i + ] + .choice_list + ) { + for ( + var 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 (utils.classUtils.attrTypeIsDict(attr[j].Type)) { + var + dictItemList = []; + for ( + var d in + result[ + i + ] + .choice_list + ) { + var val = + result[ + i + ] + .choice_list[ + d + ]; + dictItemList + .push({ + "CN_S_NAME": val, + "CN_S_VALUE": val, + "Name": val, + "label": val, + "value": val + }); + } + attr[ + j] + .dictitem = + dictItemList; + // attr[j].dictitem = result[i].choice_list; + } + } + } + } + } + for ( + var c = + 0; c < + $this + .$data + .classAttrList + .length; c++ + ) { + var attr = + $this + .$data + .classAttrList[ + 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; + } + } + } + } + } 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; + } + } + } + } + } + } + + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('error') + " 3.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + OKDataObjRunCustomEvent() { + var enviroment = { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param.Master_Cls + .ID, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param + .Master_Cls + .ID, // button=bottom鏃�master鐨刢ls_id + + } + }; + var eventid = this.$data.edit_ok_event + .scrip_id; + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + + + if (ar.Value == '璇烽�鎷� || ar + .Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = + ''; + req.push(this.formatAttr(ar)); + } + } + if (this.$data.refdatastore.length > 0) { + for (var i = 0; i < this.$data + .refdatastore.length; i++) { + if (!req.filter(function(s) { + return this.$data + .refdatastore[i] + .attr == s.name + }).length) { + length = 1; + req.push({ + 'attr': this.$data + .refdatastore[ + i].attr, + 'value': this.$data + .refdatastore[ + i].value + }); + } + } + } + var info = { + eventid: eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: this.$data.param.Master_Cls + .ID, + objid: "", + attr: req, + } + // var dataInfo = { + // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid,rclsid: info.rclsid, + // robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, + // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), global_attr: JSON.stringify(this.$data.global_attr) + // } + enviroment = Base64.encode(JSON.stringify( + enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var global_attr = Base64.encode(JSON + .stringify(this.$data.global_attr) + ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var obj_attr = {}; + info.attr.forEach(item => { + obj_attr[item.attr] = item.value; + }); + if (!eventid.includes('{')) eventid = '{' + + eventid + '}'; + var dataInfo = { + ed_type: info.edtype, + start_transaction: '', + class_id: info.clsid, + class_name: '', + event_id: eventid, + event_name: '', + data_obj_id: info.objid, + obj_attr: obj_attr, + prj_id: info.projectid, + ref_cls_id: info.rclsid, + rel_obj_id: info.robjid, + user_login: info.userlogin, + data_json: '', + compose_info: '', + ext_info: enviroment, + global_attr: global_attr, + input_param: '', + }; + console.log(dataInfo); + // return; + 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: 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 == + 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; + } + } + } + } + + this.add(); + } + + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('error') + " 4.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + DataObjRunCustomEvent_Return(eventid, + data_attr, button_callback, index, iindex + ) { + var enviroment = { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param.Master_Cls + .ID, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param + .Master_Cls + .ID, // button=bottom鏃�master鐨刢ls_id + //obj_id: '' // button=bottom鏃�master鐨刼bj_id + } + }; + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + req.push(this.formatAttr(ar)); + } + } + if (this.$data.refdatastore.length > 0) { + for (var i = 0; i < this.$data + .refdatastore.length; i++) { + if (!req.filter(function(s) { + return this.$data + .refdatastore[i] + .attr == s.name + }).length) { + length = 1; + req.push({ + 'attr': this.$data + .refdatastore[ + i].attr, + 'value': this.$data + .refdatastore[ + i].value + }); + } + } + } + var extinfo = enviroment; + extinfo.edit_dlg = { + type: 'small', //灏忕獥鍙�+ class_id: this.$data.param + .Master_Cls.ID, //褰撳墠鏁版嵁绫籭d + } + if (data_attr) { + extinfo.edit_dlg + .form_control = { //鎵�睘鐨勮〃鍗曟帶浠�+ name: data_attr.Name, //瀛楁灞炴� + text: data_attr + .DispName, //鏄剧ず鏂囨湰 + group_name: data_attr + .GroupName, //灞炴�缁�+ type: data_attr.Type, //瀛楁绫诲瀷 + readonly: data_attr + .ReadOnly, //鏄惁鍙 + button_img: data_attr + .button_img, //寮曠敤鎸夐挳鐨勫浘鏍�+ button_tooltip: data_attr + .button_tooltip //寮曠敤鎸夐挳鐨則ooltip + } + } + // var dataInfo = { + // edtype: "0", eventid: eventid, projectid: '',rclsid: '', robjid: '', userlogin: '', + // clsid: this.$data.param.Master_Cls.ID, objid: '',attr: JSON.stringify(req), + // extinfo: JSON.stringify(extinfo), global_attr: JSON.stringify(this.$data.global_attr) + // } + extinfo = Base64.encode(JSON.stringify( + extinfo)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var global_attr = Base64.encode(JSON + .stringify(this.$data.global_attr) + ); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var obj_attr = {}; + req.forEach(item => { + obj_attr[item.attr] = item.value; + }); + if (!eventid.includes('{')) eventid = '{' + + eventid + '}'; + var dataInfo = { + ed_type: "0", + start_transaction: '', + class_id: this.$data.param.clsid, + class_name: '', + event_id: eventid, + event_name: '', + data_obj_id: '', + obj_attr: obj_attr, + prj_id: '', + ref_cls_id: '', + rel_obj_id: '', + user_login: '', + data_json: '', + compose_info: '', + ext_info: extinfo, + global_attr: global_attr, + input_param: '', + }; + console.log(dataInfo); + // return; + 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: 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') + }); + + 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 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 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 + .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灏氭湭澶勭悊锛� + }); + d + .show(); + } + } + } + } else { + uni.showModal({ + title: this.translateSys('tip') + "5.2", + content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + + eventid, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + } + + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('tip') + "5.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + scan_ini_DataObjRunCustomEvent(info) { + var obj_attr = {}; + info.attr.forEach(item => { + obj_attr[item.attr] = item + .value; + }); + var param = { + EditStyle: this.$data.param.Sub_Cls + .View_Style.Name, + ViewStyle: this.$data.param.Sub_Cls + .View_Style.Name, + NotTriggerSysEvent: 0, + enviroment: { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param + .Sub_Cls.ID, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param + .Sub_Cls + .ID, // button=bottom鏃�master鐨刢ls_id + //obj_id: '' // button=bottom鏃�master鐨刼bj_id + obj_attrs: obj_attr, + } + } + } + var inputparameter = ''; + var global_attr = ''; + // var dataInfo = { + // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid, + // rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, + // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(param), inputparameter: inputparameter, global_attr: global_attr + // } + param = Base64.encode(JSON.stringify( + param)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + + if (!info.eventid.includes('{')) info + .eventid = '{' + info.eventid + '}'; + var dataInfo = { + ed_type: info.edtype, + start_transaction: '', + class_id: info.clsid, + class_name: '', + event_id: info.eventid, + event_name: '', + data_obj_id: info.objid, + obj_attr: obj_attr, + prj_id: info.projectid, + ref_cls_id: info.rclsid, + rel_obj_id: info.robjid, + user_login: info.userlogin, + data_json: '', + compose_info: '', + ext_info: param, + global_attr: '', + input_param: '', + }; + console.log(dataInfo); + // return; + 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: 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 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 + ); + for ( + var i = + 0; i < + val + .length; i++ + ) { + for ( + var a = + 0; a < + this + .$data + .subClassAttrList + .length; a++ + ) { + for ( + var l = + 0; l < + this + .$data + .subClassAttrList[ + a + ] + .Attr + .length; l++ + ) { + var ca = + this + .$data + .subClassAttrList[ + a + ] + .Attr[ + l + ]; + if (val[ + i] + .attr == + ca + .Name + ) { + 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; + } + } + } + } + + 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 + .length; j++ + ) { + if (this + .$data + .refdatastore[ + j + ] + .attr == + val[ + i] + .attr + ) { + this.$data + .refdatastore[ + j + ] + .value = + val[ + i] + .value; + } + } + } + } + } + } + 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') + }); + } + } + } + } + + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('error') + " 6.1", + content: ex.errMsg, + showCancel: false, + 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