From e540e5b44f56ce8e8edc377dfa4c5b343b1a9eef Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期四, 14 八月 2025 16:12:15 +0800
Subject: [PATCH] paramvalue

---
 pages/modal/3037_2.vue |  284 ++++++++++++++++++++++----------------------------------
 1 files changed, 112 insertions(+), 172 deletions(-)

diff --git a/pages/modal/3037_2.vue b/pages/modal/3037_2.vue
index 8b4cd76..1d4d857 100644
--- a/pages/modal/3037_2.vue
+++ b/pages/modal/3037_2.vue
@@ -173,7 +173,7 @@
 			}); //璁剧疆椤堕儴鏍囬 
 			this.title = options.titlename;
 			this.param = JSON.parse(options.param);
-			const  paramValue = options.paramValue ?JSON.parse(options.paramValue) :undefined
+			const paramValue = options.paramValue ? JSON.parse(options.paramValue) : undefined
 			this.loadData(paramValue)
 
 			//椤甸潰鍒濆鍖栬幏鍙栫劍鐐�@@ -207,28 +207,29 @@
 				await this.Head_UIStyleGetInfo(this.param.Master_Cls?.ID, this.param.Master_Cls?.UI_Style?.ID);
 				//浼犲叆鍙傛暟鍊� 				if (paramValue) {
-					const attrs = paramValue.attrs || [];
+					this.setFormItemVisible(this.head_styledef,paramValue)
+					// 	const attrs = paramValue.attrs || [];
+					// 	(this.head_styledef?.form?.items || []).forEach(async (ele, index) => {
+					// 		if (ele.name != "Layout") {
+					// 			attrs.forEach(async (ele2, index2) => {
+					// 				if (ele.fieldId == ele2.name) {
+					// 					ele.value = ele2.value;
+					// 				}
+					// 			});
+					// 		} else {
+					// 			ele.setting.colList.forEach(async (col) => {
+					// 				if (col) {
+					// 					attrs.forEach(async (ele2,
+					// 						index2) => {
+					// 						if (col.fieldId == ele2.name) {
+					// 							col.value = ele2.value;
+					// 						}
+					// 					});
+					// 				}
+					// 			});
+					// 		}
+					// 	})
 
-					(this.head_styledef?.form?.items || []).forEach(async (ele, index) => {
-						if (ele.name != "Layout") {
-							attrs.forEach(async (ele2, index2) => {
-								if (ele.fieldId == ele2.name) {
-									ele.value = ele2.value;
-								}
-							});
-						} else {
-							ele.setting.colList.forEach(async (col) => {
-								if (col) {
-									attrs.forEach(async (ele2,
-										index2) => {
-										if (col.fieldId == ele2.name) {
-											col.value = ele2.value;
-										}
-									});
-								}
-							});
-						}
-					})
 				}
 
 				await this.Detail1_UIstyleGetInfo(this.param.Sub_Cls?.ID, this.param.Sub_Cls?.UI_Style?.ID);
@@ -441,7 +442,7 @@
 				runCustomEvent(dataInfo).then(data => {
 					console.log(data);
 
-					if (data.ret != 0&& data.ret != 1) {
+					if (data.ret != 0 && data.ret != 1) {
 						var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
 							.err_info.join('<br/>') : '';
 						if (data.ret == 801) {
@@ -491,84 +492,8 @@
 									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 < styledef.form.items.length; c++) {
-													var attr = styledef.form.items[c];
-													if (attr.name != 'Layout') {
-														if (attr.fieldId == result[i].attr) {
-															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,
-																	"text": val,
-																	"value": val
-																});
-															}
-															attr.dict = dictItemList;
-														}
-													} else if (attr.name == 'Layout') {
-														attr.setting.colList.forEach(col => {
-															if (col) {
-																if (col.fieldId == result[i].attr) {
-																	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,
-																			"text": val,
-																			"value": val
-																		});
-																	}
-																	col.dict = dictItemList;
-																}
-															}
-														});
-													}
+										$this.setFormValues(styledef, result)
 
-												}
-											}
-											for (var c = 0; c < styledef.form.items.length; c++) {
-												var attr = styledef.form.items[c];
-												// console.log(attr[j].Name+'=='+result[i].attr);
-												//鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�-												if ($this.head_styledef.form.model[result[i].attr] ==
-													undefined) {
-													$this.head_styledef.form.model[result[i].attr] = result[i]
-														.value;
-												}
-												//鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�-												if (attr.name != 'Layout') {
-													if (attr.fieldId == result[i].attr) {
-														attr.value = '';
-														attr.oldvalue = '';
-														attr.value = result[i].value;
-														attr.oldvalue = result[i].value;
-														$this.head_styledef.form.model[attr.fieldId] = result[
-															i].value;
-													}
-												} else if (attr.name == 'Layout') {
-													attr.setting.colList.forEach(col => {
-														if (col) {
-															if (col.fieldId == result[i].attr) {
-																col.value = '';
-																col.oldvalue = '';
-																col.value = result[i].value;
-																col.oldvalue = result[i].value;
-																$this.head_styledef.form.model[col
-																	.fieldId] = result[i].value;
-															}
-														}
-													});
-												}
-											}
-
-										}
 									} else if (data.action[i].action_type == 'set_dlg_attr_show') {
 										var result = action.value;
 										if (type == 'head') {
@@ -855,7 +780,7 @@
 				console.log(dataInfo);
 				// return;
 				runCustomEvent(dataInfo).then(data => {
-					if (data.ret != 0&& data.ret != 1) {
+					if (data.ret != 0 && data.ret != 1) {
 						var tip = data.err_info ? typeof data.err_info == 'string' ? data
 							.err_info :
 							data
@@ -1552,7 +1477,7 @@
 				// return;
 				runCustomEvent(dataInfo).then(data => {
 					console.log(data);
-					if (data.ret != 0&& data.ret != 1) {
+					if (data.ret != 0 && data.ret != 1) {
 						var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
 							.err_info.join('<br/>') : '';
 						if (data.ret == 801) {
@@ -1648,75 +1573,7 @@
 									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.head_styledef.form.items.length; c++) {
-													var attr = $this.head_styledef.form.items[c];
-													if (attr.name != 'Layout') {
-														if (attr.fieldId == result[i].attr) {
-															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,
-																	"text": val,
-																	"value": val
-																});
-															}
-															attr.dict = dictItemList;
-														}
-													} else if (attr.name == 'Layout') {
-														attr.setting.colList.forEach(col => {
-															if (col) {
-																if (col.fieldId == result[i].attr) {
-																	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,
-																			"text": val,
-																			"value": val
-																		});
-																	}
-																	col.dict = dictItemList;
-																}
-															}
-														});
-													}
-												}
-											}
-											for (var c = 0; c < $this.head_styledef.form.items.length; c++) {
-												var attr = $this.head_styledef.form.items[c];
-												// console.log(attr[j].Name+'=='+result[i].attr);
-												if (attr.name != 'Layout') {
-													if (attr.fieldId == result[i].attr) {
-														attr.value = '';
-														attr.oldvalue = '';
-														attr.value = result[i].value;
-														attr.oldvalue = result[i].value;
-														$this.head_styledef.form.model[attr.fieldId] = result[i]
-															.value;
-													}
-												} else if (attr.name == 'Layout') {
-													attr.setting.colList.forEach(col => {
-														if (col) {
-															if (col.fieldId == result[i].attr) {
-																col.value = '';
-																col.oldvalue = '';
-																col.value = result[i].value;
-																col.oldvalue = result[i].value;
-																$this.head_styledef.form.model[col
-																	.fieldId] = result[i].value;
-															}
-														}
-													});
-												}
-
-											}
-
-										}
+										$this.setFormValues($this.head_styledef, result)
 									} else if (action.action_type == 'set_dlg_attr_show') {
 										var data = action.value;
 										$this.setFormItemVisible(data)
@@ -1752,6 +1609,89 @@
 						confirmText: this.translateSys('close')
 					});
 				});
+			},
+			setFormValues(styledef, attrs) {
+				if (!Array.isArray(attrs)) {
+					return
+				}
+				for (var i = 0; i < attrs.length; i++) {
+					if (attrs[i].choice_list) {
+						for (var c = 0; c < styledef.form.items.length; c++) {
+							var attr = styledef.form.items[c];
+							if (attr.name != 'Layout') {
+								if (attr.fieldId == attrs[i].attr) {
+									var dictItemList = [];
+									for (var d in attrs[i].choice_list) {
+										var val = attrs[i].choice_list[d];
+										dictItemList.push({
+											"CN_S_NAME": val,
+											"CN_S_VALUE": val,
+											"text": val,
+											"value": val
+										});
+									}
+									attr.dict = dictItemList;
+								}
+							} else if (attr.name == 'Layout') {
+								attr.setting.colList.forEach(col => {
+									if (col) {
+										if (col.fieldId == attrs[i].attr) {
+											var dictItemList = [];
+											for (var d in attrs[i]
+													.choice_list) {
+												var val = attrs[i]
+													.choice_list[d];
+												dictItemList.push({
+													"CN_S_NAME": val,
+													"CN_S_VALUE": val,
+													"text": val,
+													"value": val
+												});
+											}
+											col.dict = dictItemList;
+										}
+									}
+								});
+							}
+
+						}
+					}
+					for (var c = 0; c < styledef.form.items.length; c++) {
+						var attr = styledef.form.items[c];
+						// console.log(attr[j].Name+'=='+attrs[i].attr);
+						//鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�+						if (styledef.form.model[attrs[i].attr] ==
+							undefined) {
+							styledef.form.model[attrs[i].attr] = attrs[i]
+								.value;
+						}
+						//鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�+						if (attr.name != 'Layout') {
+							if (attr.fieldId == attrs[i].attr) {
+								attr.value = '';
+								attr.oldvalue = '';
+								attr.value = attrs[i].value;
+								attr.oldvalue = attrs[i].value;
+								styledef.form.model[attr.fieldId] = attrs[
+									i].value;
+							}
+						} else if (attr.name == 'Layout') {
+							attr.setting.colList.forEach(col => {
+								if (col) {
+									if (col.fieldId == attrs[i].attr) {
+										col.value = '';
+										col.oldvalue = '';
+										col.value = attrs[i].value;
+										col.oldvalue = attrs[i].value;
+										styledef.form.model[col
+											.fieldId] = attrs[i].value;
+									}
+								}
+							});
+						}
+					}
+
+				}
 			},
 			setFormItemVisible(attrs) {
 				if (!Array.isArray(attrs)) {
@@ -1838,7 +1778,7 @@
 				runCustomEvent(dataInfo).then(data => {
 					console.log(data);
 
-					if (data.ret != 0&& data.ret != 1) {
+					if (data.ret != 0 && data.ret != 1) {
 						var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
 							.err_info.join('<br/>') : '';
 						if (data.ret == 801) {

--
Gitblit v1.9.1