From ab9d6c46fe78f005ff1efb5cbef1be763a69e4a2 Mon Sep 17 00:00:00 2001
From: jt <jt@activesoft.com.cn>
Date: 星期六, 20 七月 2024 16:36:57 +0800
Subject: [PATCH] test

---
 pages/modal/classAttr.vue |  148 +++++++++++++++++++++++++-----------------------
 1 files changed, 77 insertions(+), 71 deletions(-)

diff --git a/pages/modal/classAttr.vue b/pages/modal/classAttr.vue
index 0f90b83..20f42dc 100644
--- a/pages/modal/classAttr.vue
+++ b/pages/modal/classAttr.vue
@@ -289,7 +289,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
@@ -326,6 +326,14 @@
 				popupParam: {},
 			}
 		},
+		onNavigationBarButtonTap(e) {
+			//鍒锋柊
+			uni.redirectTo({
+				url: '../modal/classAttr?param=' + JSON.stringify(this.param) +
+					"&titlename=" + this.title
+			});
+		
+		},
 		onLoad(options) {
 			// console.log(options);
 			uni.setNavigationBarTitle({
@@ -353,47 +361,51 @@
 				return;
 			}
 			this.$data.param = param;
-			var edit_dlg = {
-				Model: param.EditDlgMode,
-				Name: param.Edit_dlg.Name
-			}
-			var dataInfo = {
-				class_id: param.clsid
-			};
-			var $this = this;
-			$this.$store.state.thisareaFuncID = 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;
 
-						$this.classGridStyleInfo();
-					} else {
+			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;
+
+							$this.classGridStyleInfo();
+						} else {
+							uni.showModal({
+								title: "閿欒1",
+								content: success.msg,
+								showCancel: false,
+								confirmText: "鍙栨秷"
+							});
+						}
+					}).catch(ex => {
+						// console.log(ex);
 						uni.showModal({
-							title: "閿欒1",
-							content: success.msg,
+							title: "閿欒1.1",
+							content: ex.errMsg,
 							showCancel: false,
 							confirmText: "鍙栨秷"
 						});
-					}
-				}).catch(ex => {
-					// console.log(ex);
-					uni.showModal({
-						title: "閿欒1.1",
-						content: ex.errMsg,
-						showCancel: false,
-						confirmText: "鍙栨秷"
 					});
-				});
-
-		},
-		methods: {
+				}
+			},
 			classAttr_extButton(index, iindex) { //寮规灞傛樉绀�type:top bottom center left right
 				var $this = this;
 				$this.$data.popupType = 'right'
@@ -525,12 +537,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;
 							// console.log($this.$data.classGridStyle);
 
 							$this.class_attr_init();
+
 						} else {
 							uni.showModal({
 								title: "閿欒1.2",
@@ -652,7 +667,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
@@ -877,7 +892,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) {
@@ -894,8 +909,7 @@
 									name: ar.Name,
 									value: ar.Value
 								});
-						} else
-						{
+						} else {
 							const node = this.formatAttr(ar)
 							req.push({
 								name: node.attr,
@@ -984,11 +998,7 @@
 								icon: "success",
 								duration: 3000
 							});
-						//鍒锋柊
-						uni.redirectTo({
-							url: '../modal/classAttr?param=' + JSON.stringify(this.$data.param) +
-								"&titlename=" + this.$data.title
-						});
+
 						// this.class_attr_init();
 					} else {
 						uni.showModal({
@@ -1010,7 +1020,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++) {
@@ -1050,7 +1060,7 @@
 														ca.Value = ca.dictitem[d].CN_S_NAME;
 												}
 											}
-											if(classUtils.attrTypeIsDate(ca.Type)) {
+											if (utils.classUtils.attrTypeIsDateTime(ca.Type)) {
 												var nowDate = new Date();
 												var date = {
 													year: nowDate.getFullYear(),
@@ -1060,7 +1070,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.Type))  {
+											if (utils.classUtils.attrTypeIsObjRefMulti(ca.Type)) {
 												var relClsList = [];
 												var attr_rescls = ca.RelCls.split(',');
 												for (var ii in attr_rescls) {
@@ -1073,9 +1083,9 @@
 												ca.RelClsList = relClsList;
 												ca.Value = '璇�;
 											}
-											if(classUtils.attrTypeIsRegion(ca.Type)) 
+											if (utils.classUtils.attrTypeIsRegion(ca.Type))
 												ca.Value = '璇烽�鎷�;
-											if(classUtils.attrTypeIsBool(ca.Type)) 
+											if (utils.classUtils.attrTypeIsBool(ca.Type))
 												ca.Value = false;
 
 											attr.push(ca);
@@ -1100,25 +1110,20 @@
 						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,
-										val: 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,
+								val: ar.value ? ar.value : ''
+							});
 						}
 					}
-
 					var eventlist = this.$data.classGridStyle.StyleDef.event;
+
 					if (eventlist) {
 						if (eventlist.length > 0) {
 							for (var i = 0; i < eventlist.length; i++) {
@@ -1149,6 +1154,7 @@
 						}
 						this.ini_DataObjRunCustomEvent(info);
 					}
+
 					console.log(this.$data.classGridStyle);
 					console.log(this.$data.classAttrList);
 
@@ -1213,7 +1219,7 @@
 												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 (classUtils.attrTypeIsDict(ca.Type)) {
+														if (utils.classUtils.attrTypeIsDict(ca.Type)) {
 															var dictItemList = [];
 															for (var d in value[i].choice_list) {
 																var list_val = value[i].choice_list[d];
@@ -1346,7 +1352,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];
@@ -1777,15 +1783,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