From 303d480e7569a0c0a476b462e843ea76658faac5 Mon Sep 17 00:00:00 2001 From: cyy <cuiqian2004@163.com> Date: 星期六, 01 三月 2025 17:55:53 +0800 Subject: [PATCH] 5601 modify form smallwmd --- pages/modal/classAttr.vue | 952 ++++++++++++++++++++++++++++++---------------------------- 1 files changed, 492 insertions(+), 460 deletions(-) diff --git a/pages/modal/classAttr.vue b/pages/modal/classAttr.vue index 20f42dc..c61f7b0 100644 --- a/pages/modal/classAttr.vue +++ b/pages/modal/classAttr.vue @@ -24,14 +24,17 @@ </div> <input :type="attr.Type=='鏁存暟' || attr.Type=='娴偣鏁� || attr.Type=='int' || attr.Type=='float'?'number':'text'" - :value="attr.Value" @focus="ontap" @blur="onevent" v-if="attr.Height=='1'" + :value="attr.Value" :focus="focusField == `${index}-${iindex}`" @focus="ontap" + @click="onClick(index,iindex)" @blur="onevent" v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"> <!-- =='flase'?true:false --> - <textarea :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='2'" + <textarea :value="attr.Value" :focus="focusField == `${index}-${iindex}`" @focus="ontap" + @click="onClick(index,iindex)" @blur="onevent" v-else-if="attr.Height=='2'" :data-index="index" :data-iindex="iindex" style="height:60px;" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"></textarea> - <textarea :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='3'" + <textarea :value="attr.Value" :focus="focusField == `${index}-${iindex}`" @focus="ontap" + @click="onClick(index,iindex)" @blur="onevent" v-else-if="attr.Height=='3'" :data-index="index" :data-iindex="iindex" style="height:90px;" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"></textarea> <!-- 鎵爜鍚庝簨浠惰繑鍥�--> @@ -47,16 +50,19 @@ <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> <input :type="attr.Type=='鏁存暟' || attr.Type=='娴偣鏁� || attr.Type=='int' || attr.Type=='float' ?'number':'text'" - class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" - v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" + class="attr_field" :value="attr.Value" :focus="focusField == `${index}-${iindex}`" + @focus="ontap" @blur="onevent" @click="onClick(index,iindex)" v-if="attr.Height=='1'" + :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" :disabled="attr.edit?false:true"> - <textarea class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" + <textarea class="attr_field" :value="attr.Value" :focus="focusField == `${index}-${iindex}`" + @focus="ontap" @blur="onevent" @click="onClick(index,iindex)" v-else-if="attr.Height=='2'" :data-index="index" :data-iindex="iindex" style="height:60px;" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" :disabled="attr.edit?false:true"></textarea> - <textarea class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" + <textarea class="attr_field" :value="attr.Value" :focus="focusField ==`${index}-${iindex}`" + @focus="ontap" @blur="onevent" @click="onClick(index,iindex)" v-else-if="attr.Height=='3'" :data-index="index" :data-iindex="iindex" style="height:90px;" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" @@ -150,13 +156,13 @@ <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" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</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.split('|')[0]" :data-classname="attr.RelCls.split('|')[1]"><i @@ -181,13 +187,14 @@ <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" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</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> @@ -204,13 +211,14 @@ <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" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</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> @@ -224,13 +232,13 @@ <text class="tx_title">{{attr.DispName}}:<i class="i_tishi" v-if="attr.notempty==true">*</i></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" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</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">*</i> </view> </view> @@ -290,6 +298,13 @@ <script> import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' import utils from "@/js/utils.js" + import { + classAttrList, + classGridStyleInfo, + dataObjAdd, + dataObjRunCustomEvent + } from "@/api/index.js" + export default { components: { pickerAddress @@ -298,6 +313,8 @@ return { title: '鏂板', param: {}, + focusField: "", + focusOldField: "", classAttrList: [], classGridStyle: [], edit_inital_event: "", //寮圭獥鍒濆鍖栦簨浠禝D @@ -332,7 +349,7 @@ url: '../modal/classAttr?param=' + JSON.stringify(this.param) + "&titlename=" + this.title }); - + }, onLoad(options) { // console.log(options); @@ -365,44 +382,57 @@ this.loadData() }, methods: { - loadData() { - var $this = this; - var edit_dlg = { - Model: $this.param.EditDlgMode, - Name: $this.param.Edit_dlg.Name - } - var dataInfo = { - class_id: $this.param.clsid - }; - $this.$store.state.thisareaFuncID = $this.param.clsid; - // console.log($this.$store.getters.getclassAttrList); - //鑾峰彇 - if ($this.$store.getters.getclassAttrList) { - $this.$data.classAttrList = $this.$store.getters.getclassAttrList.data; - $this.classGridStyleInfo(); - } else { - $this.$store.dispatch('classAttrList', dataInfo).then(success => { - // console.log(success); - if (success.code == '00000') { - $this.$data.classAttrList = success.data; + setData(obj) { + let that = this; + let keys = []; + let val, data; - $this.classGridStyleInfo(); + 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 { - uni.showModal({ - title: "閿欒1", - content: success.msg, - showCancel: false, - confirmText: "鍙栨秷" - }); + if (!data[key2]) { + that.$set(data, key2, {}); + } } - }).catch(ex => { - // console.log(ex); - uni.showModal({ - title: "閿欒1.1", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); + data = data[key2]; + }); + }); + }, + + async loadData() { + try { + var edit_dlg = { + Model: this.param.EditDlgMode, + Name: this.param.Edit_dlg.Name + } + var dataInfo = { + class_id: this.param.clsid + }; + this.$data.classAttrList = await classAttrList(dataInfo) || [] + + var gridstyleInfo = { + class_id: this.param.clsid, + name: this.param.Edit_dlg.Name, + type: '2' + }; + + const res = await classGridStyleInfo(gridstyleInfo) + res.StyleDef = JSON.parse(res.StyleDef); + this.$data.classGridStyle = res; + // console.log($this.$data.classGridStyle); + this.class_attr_init(); + + } catch (ex) { + uni.showModal({ + title: "閿欒1", + content: ex.errMsg, + showCancel: false, + confirmText: "鍙栨秷" }); } }, @@ -520,60 +550,94 @@ delta: 1 //杩斿洖灞傛暟锛�鍒欎笂涓婇〉 }); }, - async classGridStyleInfo() { - var $this = this; - var gridstyleInfo = { - class_id: $this.$data.param.clsid, - name: $this.$data.param.Edit_dlg.Name, - type: '2' - }; - $this.$store.state.thisEditName = $this.$data.param.Edit_dlg.Name - // console.log($this.$store.getters.getclassGridStyleInfo); - //鑾峰彇 - if ($this.$store.getters.getclassGridStyleInfo) { - $this.$data.classGridStyle = $this.$store.getters.getclassGridStyleInfo.data; - $this.class_attr_init(); - } else { - //console.log(gridstyleInfo); - $this.$store.dispatch('classGridStyleInfo', gridstyleInfo).then(success => { - // console.log(success); - - if (success.code == '00000') { - - success.data.StyleDef = JSON.parse(success.data.StyleDef); - $this.$data.classGridStyle = success.data; - // console.log($this.$data.classGridStyle); - - $this.class_attr_init(); - - } else { - uni.showModal({ - title: "閿欒1.2", - content: success.msg, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - }).catch(ex => { - console.log(ex); - uni.showModal({ - title: "閿欒1.3", - content: ex.errMsg, - showCancel: false, - confirmText: "鍙栨秷" - }); - }); - } + onClick(index, iindex) { + this.focusField = `${index}-${iindex}` }, + ontap(e) { //鎵爜鍔熻兘 var $ele = e; //console.log(e.target) + this.focusOldField = `${e.target.dataset['index']}-${e.target.dataset['iindex']}` getApp().onScan((result) => { //console.log(result.decodedata); this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = result.decodedata; uni.hideKeyboard(); this.onevent($ele, result.decodedata); + if (result.decodedata) { //绗竴涓緭鍏ユ涓嶄负绌�+ //鍒濆鍖栵紝涓嬩釜杈撳叆妗唂ocus灞炴� + const attrs = this.$data.classAttrList[e.target.dataset['index']].Attr || [] + var findd = false + for (let i = e.target.dataset['iindex'] + 1; i < attrs.length; i++) { + const ele = attrs[i] + + if (ele.hidden != true) { + if (utils.classUtils.attrTypeIsString(ele.Type) || utils.classUtils + .attrTypeIsInt(ele.Type)) { + const field = `${e.target.dataset['index']}-${i}` + if (this + .focusOldField == + field) { + this.setData({ + focusField: "" + }) + } else { + this.setData({ + focusField: this + .focusOldField + }) + } + this.$nextTick(() => { + this.setData({ + focusField: field + }) + }); + findd = true + break + } + } + + + } + if (findd) { + return + } + for (let i = e.target.dataset['index'] + 1; i < this.classAttrList.length; i++) { + const attrs2 = this.classAttrList[i].Attr || [] + for (let ii in attrs2) { + const ele = attrs2[ii] + if (ele.hidden != true) { + if (utils.classUtils.attrTypeIsString(ele.Type) || utils.classUtils + .attrTypeIsInt(ele.Type)) { + const field = `${i}-${ii}` + if (this + .focusOldField == + field) { + this.setData({ + focusField: "" + }) + } else { + this.setData({ + focusField: this + .focusOldField + }) + } + this.$nextTick(() => { + this.setData({ + focusField: field + }) + }); + break + } + } + } + if (findd) { + break + } + } + + } + }) }, onarrow(index, open) { @@ -590,7 +654,6 @@ var value = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].dictitem[e .target.value]; var data_attr = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']]; - console.log(data_attr); if (value.Name != data_attr.Value) { this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = value .Name; @@ -715,6 +778,7 @@ req.push(this.formatAttr(ar)) } } + var info = { eventid: eventid, edtype: "0", @@ -956,58 +1020,54 @@ console.log(dataInfo); // return - this.$store.dispatch('addclassattr', dataInfo).then(success => { - console.log(success); + dataObjAdd(dataInfo).then(data => { + console.log(data); uni.hideLoading(); - if (success.code == '00000') { - if (success.data.Action) { - var action = JSON.parse(success.data.Action); - console.log(action); - if (action.ret == '0') { - if (action.ret != 0) { - uni.showModal({ - title: "鎻愮ず", - content: '鎵ц鑴氭湰澶辫触锛� + action.result, - showCancel: false, - confirmText: "鍙栨秷" - }); - return; - } - if (action.info) { - uni.showModal({ - title: "鎻愮ず", - content: '鎵ц鑴氭湰澶辫触锛� + action.info, - showCancel: false, - confirmText: "鍙栨秷" - }); - return; - } - if (action.result_type == '0') { - uni.showToast({ - title: action.result, - icon: "success", - duration: 3000 - }); - } - - // "{"ret":0, "result_type":0, "result":"鍒涘缓鎴愬姛123123123","info":""}" + if (data.Action) { + var action = JSON.parse(data.Action); + console.log(action); + if (action.ret == '0') { + if (action.ret != 0) { + uni.showModal({ + title: "鎻愮ず", + content: '鎵ц鑴氭湰澶辫触锛� + action.result, + showCancel: false, + confirmText: "鍙栨秷" + }); + return; } - } else - uni.showToast({ - title: "鍒涘缓鎴愬姛锛�, - icon: "success", - duration: 3000 - }); + if (action.info) { + uni.showModal({ + title: "鎻愮ず", + content: '鎵ц鑴氭湰澶辫触锛� + action.info, + showCancel: false, + confirmText: "鍙栨秷" + }); + return; + } + if (action.result_type == '0') { + uni.showToast({ + title: action.result, + icon: "success", + duration: 3000 + }); + } - // this.class_attr_init(); - } else { - uni.showModal({ - title: "閿欒", - content: success.msg, - showCancel: false, - confirmText: "鍙栨秷" + // "{"ret":0, "result_type":0, "result":"鍒涘缓鎴愬姛123123123","info":""}" + } + } else + uni.showToast({ + title: "鍒涘缓鎴愬姛锛�, + icon: "success", + duration: 3000 }); - } + //鍒锋柊 + uni.redirectTo({ + url: '../modal/classAttr?param=' + JSON.stringify(this.$data.param) + + "&titlename=" + this.$data.title + }); + //this.class_attr_init(); + }).catch(ex => { console.log(ex); uni.hideLoading(); @@ -1087,6 +1147,16 @@ ca.Value = '璇烽�鎷�; if (utils.classUtils.attrTypeIsBool(ca.Type)) ca.Value = false; + if (ca.hidden != true) { + if (utils.classUtils.attrTypeIsString(ca.Type) || utils.classUtils + .attrTypeIsInt(ca.Type) || utils.classUtils.attrTypeIsFloat(ca.Type)) { + if (this.focusField == "") { + this.setData({ + focusField: `${newattrlist.length}-${attr.length}` + }) + } + } + } attr.push(ca); } @@ -1118,7 +1188,7 @@ var ar = attr[j]; req.push({ attr: ar.attr, - val: ar.value ? ar.value : '' + value: ar.value ? ar.value : '' }); } } @@ -1201,84 +1271,73 @@ global_attr: global_attr } console.log(dataInfo); - this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { - console.log(success); - if (success.code == '00000') { - var data = JSON.parse(success.data); - 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) { - console.log(value); - for (var i = 0; i < value.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 (value[i].attr == ca.Name) { - if (utils.classUtils.attrTypeIsDict(ca.Type)) { - var dictItemList = []; - for (var d in value[i].choice_list) { - var list_val = value[i].choice_list[d]; - dictItemList.push({ - "CN_S_NAME": list_val, - "Name": list_val, - "label": list_val, - "value": list_val - }); + dataObjRunCustomEvent(dataInfo).then(data => { + data = JSON.parse(data); + 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) { + console.log(value); + for (var i = 0; i < value.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 (value[i].attr == ca.Name) { + if (utils.classUtils.attrTypeIsDict(ca.Type)) { + var dictItemList = []; + for (var d in value[i].choice_list) { + var list_val = value[i].choice_list[d]; + dictItemList.push({ + "CN_S_NAME": list_val, + "Name": list_val, + "label": list_val, + "value": list_val + }); - } - ca.dictitem = dictItemList; - // attr[j].dictitem = val[i].choice_list; - } else { - ca.Value = value[i].value; } + ca.dictitem = dictItemList; + // attr[j].dictitem = val[i].choice_list; + } else { + ca.Value = value[i].value; } } } + } - var length = 0; - if (!this.$data.refdatastore.filter(function(s) { - return value[i].attr == s.attr - }).length) { - length = 1; - this.$data.refdatastore.push(value[i]); - } - if (length == 0) { - for (var j = 0; j < this.$data.refdatastore.length; j++) { - if (this.$data.refdatastore[j].attr == value[i].attr) { - this.$data.refdatastore[j].value = value[i].value; - } + var length = 0; + if (!this.$data.refdatastore.filter(function(s) { + return value[i].attr == s.attr + }).length) { + length = 1; + this.$data.refdatastore.push(value[i]); + } + if (length == 0) { + for (var j = 0; j < this.$data.refdatastore.length; j++) { + if (this.$data.refdatastore[j].attr == value[i].attr) { + this.$data.refdatastore[j].value = value[i].value; } } } } } - if (action_type == 'open_select_userdlg') { - uni.showModal({ - title: "閿欒2.2", - content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, - showCancel: false, - confirmText: "鍙栨秷" - }); - } - // else if (action_type == 'tip_dlg') { - - // } + } else if (action_type == 'open_select_userdlg') { + uni.showModal({ + title: "閿欒2.2", + content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, + showCancel: false, + confirmText: "鍙栨秷" + }); } - } + // else if (action_type == 'tip_dlg') { - } else { - uni.showModal({ - title: "閿欒2", - content: success.msg, - showCancel: false, - confirmText: "鍙栨秷" - }); + // } + } } + }).catch(ex => { // console.log(ex); uni.showModal({ @@ -1334,108 +1393,100 @@ dataJson: JSON.stringify(info.dataJson) } console.log(dataInfo); - this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { - console.log(success); - if (success.code == '00000') { - var data = JSON.parse(success.data); - 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, - "Name": val, - "label": val, - "value": val - }); - } - attr[j].dictitem = dictItemList; - // attr[j].dictitem = result[i].choice_list; + dataObjRunCustomEvent(dataInfo).then(data => { + data = JSON.parse(data); + 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, + "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; - } + } + 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; } } } - } 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; + } } } } - - 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 || []; } } - } else { - uni.showModal({ - title: "閿欒3", - content: success.msg, - showCancel: false, - confirmText: "鍙栨秷" - }); } + + 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({ @@ -1478,7 +1529,7 @@ length = 1; req.push({ 'attr': this.$data.refdatastore[i].attr, - 'val': this.$data.refdatastore[i].value + 'value': this.$data.refdatastore[i].value }); } } @@ -1508,38 +1559,28 @@ global_attr: JSON.stringify(this.$data.global_attr) } console.log(dataInfo); - this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { - console.log(success); - if (success.code == '00000') { - var data = JSON.parse(success.data); - var result = data.result; - for (var i = 0; i < result.length; i++) { - // self.class_attr_ele.find('.attr_field[data-field="' + result[i].attr + '"]').val(result[i].value).data('val', result[i].value); - var length = 0; - if (!this.$data.refdatastore.filter(function(s) { - return result[i].attr == s.attr - }).length) { - length = 1; - this.$data.refdatastore.push(result[i]); - } - if (length == 0) { - for (var j = 0; j < this.$data.refdatastore.length; j++) { - if (this.$data.refdatastore[j].attr == result[i].attr) { - this.$data.refdatastore[j].value = result[i].value; - } + dataObjRunCustomEvent(dataInfo).then(data => { + data = JSON.parse(data); + var result = data.result; + for (var i = 0; i < result.length; i++) { + // self.class_attr_ele.find('.attr_field[data-field="' + result[i].attr + '"]').val(result[i].value).data('val', result[i].value); + var length = 0; + if (!this.$data.refdatastore.filter(function(s) { + return result[i].attr == s.attr + }).length) { + length = 1; + this.$data.refdatastore.push(result[i]); + } + if (length == 0) { + for (var j = 0; j < this.$data.refdatastore.length; j++) { + if (this.$data.refdatastore[j].attr == result[i].attr) { + this.$data.refdatastore[j].value = result[i].value; } } } - - this.add(); - } else { - uni.showModal({ - title: "閿欒4", - content: success.msg, - showCancel: false, - confirmText: "鍙栨秷" - }); } + + this.add(); }).catch(ex => { // console.log(ex); uni.showModal({ @@ -1611,167 +1652,158 @@ global_attr: JSON.stringify(this.$data.global_attr) } console.log(dataInfo); - this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { - console.log(success); - if (success.code == '00000') { - var data = JSON.parse(success.data); - if (data != "") { + dataObjRunCustomEvent(dataInfo).then(data => { + data = JSON.parse(data) + console.log(data); + 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); - 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 = { + 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.clsid, + objid: "", + attr: param.req, + inputparameter: data, + dataJson: [], + } + $this.DataObjRunCustomEvent(info, param.data_attr); + } + } + }); + } else if (action.action_type == 'open_data_query_dlg') { + 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_common_dlg') { + var $this = this; + if (val.common_dlg_id == 'check_list') { + $this.$data.check_list = val.config; + if (val.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�+ $this.$data.popupType = 'right'; + else + $this.$data.popupType = 'center' + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� + $this.$refs.popup.open($this.$data.popupType); + var popupParam = { 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(); + $this.$data.popupParam = popupParam; + } + } 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: "0", - projectid: '', - rclsid: '', - robjid: '', - userlogin: '', + edtype: "2", + projectid: data[0].ID, + rclsid: "", + robjid: "", + userlogin: "", clsid: $this.$data.param.clsid, objid: "", attr: param.req, - inputparameter: data, dataJson: [], } - $this.DataObjRunCustomEvent(info, param.data_attr); + + $this.DataObjRunCustomEvent(info); } } - }); - } else if (action.action_type == 'open_data_query_dlg') { - 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_common_dlg') { - var $this = this; - if (val.common_dlg_id == 'check_list') { - $this.$data.check_list = val.config; - if (val.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�- $this.$data.popupType = 'right'; - else - $this.$data.popupType = 'center' - // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� - $this.$refs.popup.open($this.$data.popupType); - var popupParam = { - index: index, - iindex: iindex, - button_callback: button_callback, - req: req, - data_attr: data_attr - } - $this.$data.popupParam = popupParam; } - } 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.clsid, - objid: "", - attr: param.req, - dataJson: [], - } - - $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 { + 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.msg, + title: "鎻愮ず5.2", + content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + eventid, showCancel: false, confirmText: "鍙栨秷" }); } + }).catch(ex => { // console.log(ex); uni.showModal({ -- Gitblit v1.9.1