From 1e21bcb10afb6fee60b2ee6e3257cd4b62cb7def Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期五, 26 七月 2024 12:39:34 +0800 Subject: [PATCH] test --- pages/modal/ms_classAttr.vue | 137 +++++++++++++++++++++++++-------------------- 1 files changed, 77 insertions(+), 60 deletions(-) diff --git a/pages/modal/ms_classAttr.vue b/pages/modal/ms_classAttr.vue index add9dce..185e250 100644 --- a/pages/modal/ms_classAttr.vue +++ b/pages/modal/ms_classAttr.vue @@ -645,7 +645,7 @@ <script> import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' - import classUtils from "@/js/utils.js" + import utils from "@/js/utils.js" export default { components: { pickerAddress @@ -670,6 +670,15 @@ check_list: {}, } }, + onNavigationBarButtonTap(e) { + //鍒锋柊 + uni.redirectTo({ + url: '../modal/ms_classAttr?param=' + JSON.stringify(this.param) + + "&titlename=" + this.title + }); + + }, + onLoad(options) { // console.log(options); uni.setNavigationBarTitle({ @@ -830,7 +839,7 @@ for (var j = 0; j < attr.length; j++) { var ar = attr[j]; if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; for (var v in ar.Value) { @@ -1088,11 +1097,15 @@ //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; $this.class_attr_init(); + + } else { uni.showModal({ title: "閿欒1.2", @@ -1118,13 +1131,17 @@ $this.subClass_attr_init(); } else { //console.log(gridstyleInfo); + $this.$store.dispatch('subClassGridStyleInfo', gridstyleInfo).then(success => { // console.log(success); if (success.code == '00000') { + success.data.StyleDef = JSON.parse(success.data.StyleDef); $this.$data.subClassGridStyle = success.data; $this.subClass_attr_init(); + + } else { uni.showModal({ title: "閿欒1.2", @@ -1458,7 +1475,7 @@ var attr = attrlist[i].Attr; for (var j = 0; j < attr.length; j++) { var ar = attr[j]; - if (classUtils.attrTypeIsDict(ar.Type)) + if (utils.classUtils.attrTypeIsDict(ar.Type)) req.push({ attr: ar.Name, value: itemvalue.Name @@ -1573,7 +1590,7 @@ var attr = attrlist[i].Attr; for (var j = 0; j < attr.length; j++) { var ar = attr[j]; - if (classUtils.attrTypeIsDict(ar.Type)) + if (utils.classUtils.attrTypeIsDict(ar.Type)) req.push({ attr: ar.Name, value: itemvalue.Name @@ -1849,7 +1866,7 @@ for (var j = 0; j < attr.length; j++) { var ar = attr[j]; if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; for (var v in ar.Value) { @@ -1929,11 +1946,11 @@ // "{"ret":0, "result_type":0, "result":"鍒涘缓鎴愬姛123123123","info":""}" } //鍒锋柊 - uni.redirectTo({ - url: '../modal/ms_classAttr?param=' + JSON.stringify(this.$data.param) + - "&titlename=" + this.$data.title - }); - // this.class_attr_init(); + // uni.redirectTo({ + // url: '../modal/ms_classAttr?param=' + JSON.stringify(this.$data.param) + + // "&titlename=" + this.$data.title + // }); + // // this.class_attr_init(); } else { uni.showModal({ title: "閿欒", @@ -1954,7 +1971,7 @@ }); }, class_attr_init() { - var attrlist = this.$data.classGridStyle.StyleDef.show_style + const attrlist = this.$data.classGridStyle.StyleDef?.show_style || [] var newattrlist = []; if (this.$data.classAttrList.length > 0) { for (var i = 0; i < attrlist.length; i++) { @@ -1969,6 +1986,7 @@ for (var l = 0; l < clsattr.Attr.length; l++) { var ca = clsattr.Attr[l]; if (attrs[j].attr == ca.Name) { + ca.action = attrs[j].action; ca.edit = attrs[j].edit; ca.notempty = attrs[j].notempty; @@ -1980,6 +1998,7 @@ ca.hidden = attrs[j].hidden; ca.select = attrs[j].select == undefined ? false : attrs[j].select; ca.Value = ""; + if (ca.dictitem) { if (ca.select == true) ca.Value = []; //ca.dictitem[0].CN_S_NAME; @@ -1994,7 +2013,8 @@ ca.Value = ca.dictitem[d].CN_S_NAME; } } - if (classUtils.attrTypeIsDate(ca)) { + + if (utils.classUtils.attrTypeIsDateTime(ca.Type)) { var nowDate = new Date(); var date = { year: nowDate.getFullYear(), @@ -2004,7 +2024,7 @@ 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)) { var relClsList = []; var attr_rescls = ca.RelCls.split(','); for (var ii in attr_rescls) { @@ -2017,15 +2037,18 @@ ca.RelClsList = relClsList; ca.Value = '璇�; } - if (classUtils.attrTypeIsRegion(ca)) + + if (utils.classUtils.attrTypeIsRegion(ca.Type)) ca.Value = '璇烽�鎷�; - if (classUtils.attrTypeIsBool(ca)) + if (utils.classUtils.attrTypeIsBool(ca.Type)) ca.Value = false; attr.push(ca); + } } } + newattrlist.push({ BkColor: clsattr.BkColor, HasAce: clsattr.HasAce, @@ -2044,30 +2067,24 @@ .classGridStyle.StyleDef.Text_Color : '#000000' }) } + } } if (newattrlist.length > 0) { this.$data.classAttrList = newattrlist; } var req = []; - if (this.$data.classGridStyle.StyleDef) { - if (this.$data.classGridStyle.StyleDef.show_style.length > 0) { - var attrlist = this.$data.classGridStyle.StyleDef.show_style - // $el.find('.attr_field').prop('readonly', true); - // $el.find('.attr_field').prop('disabled', true); - for (var i = 0; i < attrlist.length; i++) { - var attr = attrlist[i].attrs - for (var j = 0; j < attr.length; j++) { - var ar = attr[j]; - req.push({ - attr: ar.attr, - value: ar.value ? ar.value : '' - }); - } - } + + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].attrs + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + req.push({ + attr: ar.attr, + value: ar.value ? ar.value : '' + }); } } - var eventlist = this.$data.classGridStyle.StyleDef.event; if (eventlist) { if (eventlist.length > 0) { @@ -2152,7 +2169,7 @@ ca.Value = ca.dictitem[d].CN_S_NAME; } } - if (classUtils.attrTypeIsDate(ca)) { + if (utils.classUtils.attrTypeIsDateTime(ca.Type)) { var nowDate = new Date(); var date = { year: nowDate.getFullYear(), @@ -2162,7 +2179,7 @@ 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)) { var relClsList = []; var attr_rescls = ca.RelCls.split(','); for (var ii in attr_rescls) { @@ -2175,9 +2192,9 @@ ca.RelClsList = relClsList; ca.Value = '璇�; } - if (classUtils.attrTypeIsRegion(ca)) + if (utils.classUtils.attrTypeIsRegion(ca.Type)) ca.Value = '璇烽�鎷�; - if (classUtils.attrTypeIsBool(ca)) + if (utils.classUtils.attrTypeIsBool(ca.Type)) ca.Value = false; attr.push(ca); @@ -2325,7 +2342,7 @@ 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)) { + if (utils.classUtils.attrTypeIsDict(ca.Type)) { var dictItemList = []; for (var d in val[i].choice_list) { var val = val[i].choice_list[d]; @@ -2452,7 +2469,7 @@ 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)) { + if (utils.classUtils.attrTypeIsDict(attr[j].Type)) { var dictItemList = []; for (var d in result[i].choice_list) { var val = result[i].choice_list[d]; @@ -2924,7 +2941,7 @@ .length; l++) { var ca = this.$data.subClassAttrList[a].Attr[l]; if (val[i].attr == ca.Name) { - if (classUtils.attrTypeIsDict(ca.Type)) { + if (utils.classUtils.attrTypeIsDict(ca.Type)) { var dictItemList = []; for (var d in val[i].choice_list) { var val = val[i].choice_list[d]; @@ -3054,7 +3071,7 @@ .Attr; for (var j = 0; j < attr.length; j++) { if (attr[j].Name == result[i].attr) { - if (classUtils.attrTypeIsDict(attr[j].Type)) { + if (utils.classUtils.attrTypeIsDict(attr[j].Type)) { var dictItemList = []; for (var d in result[i].choice_list) { var val = result[i].choice_list[d]; @@ -3249,7 +3266,7 @@ var ar = attr[j]; if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; for (var v in ar.Value) { @@ -3293,7 +3310,7 @@ var ar = attr[j]; if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; for (var v in ar.Value) { @@ -3368,13 +3385,13 @@ 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/ms_classAttr?param=' + JSON.stringify($this.$data.param) + - "&titlename=" + $this.$data.title - }); - } + // else { + // //鍒锋柊 + // uni.redirectTo({ + // url: '../modal/ms_classAttr?param=' + JSON.stringify($this.$data.param) + + // "&titlename=" + $this.$data.title + // }); + // } } else { uni.showModal({ title: "閿欒8", @@ -3407,7 +3424,7 @@ for (var j = 0; j < attr.length; j++) { var ar = attr[j]; if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; for (var v in ar.Value) { @@ -3450,7 +3467,7 @@ for (var j = 0; j < attr.length; j++) { var ar = attr[j]; if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; for (var v in ar.Value) { @@ -3526,13 +3543,13 @@ var result = data.result; if (eventID != $this.$data.param.After_Trigger_Event.ID) $this.scan_TriggerDataObjRunCustomEvent($this.$data.param.After_Trigger_Event.ID); - else { - //鍒锋柊 - uni.redirectTo({ - url: '../modal/ms_classAttr?param=' + JSON.stringify($this.$data.param) + - "&titlename=" + $this.$data.title - }); - } + // else { + // //鍒锋柊 + // uni.redirectTo({ + // url: '../modal/ms_classAttr?param=' + JSON.stringify($this.$data.param) + + // "&titlename=" + $this.$data.title + // }); + // } } else { uni.showModal({ title: "閿欒8", @@ -3553,15 +3570,15 @@ }); }, 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' -- Gitblit v1.9.1