From 15dcf7158d4c5d66d4b196e4e0b2030e1070d448 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期一, 03 三月 2025 16:46:24 +0800
Subject: [PATCH] 5601 form

---
 pages/modal/5601.vue |  175 +++++++++++++++++++++++++---------------------------------
 1 files changed, 76 insertions(+), 99 deletions(-)

diff --git a/pages/modal/5601.vue b/pages/modal/5601.vue
index c8553f1..a6024ec 100644
--- a/pages/modal/5601.vue
+++ b/pages/modal/5601.vue
@@ -7,7 +7,7 @@
 				<uni-forms-item v-if="item.name != 'Layout'" :label="item.label ?item.label +'锛�:'' "
 					:label-width="item.labelWidth+'px'">
 					<uni-data-picker v-if="item.name=='Select'" :class="item.disabled?'input-disabled':''"
-						v-model="item.value" :localdata="item.dict" @change="onEnterChange(item)"
+						v-model="item.value" :localdata="item.useDict ? item.dict : item.selections" @change="onEnterChange(item)"
 						:readonly="item.disabled" :clear-icon="false" :popup-title="item.label"></uni-data-picker>
 					<view class="input-wrapper" v-if="item.name=='Input' || item.name=='InputNumber'">
 						<text v-if="item.setting.prefix" class="uni-icon" :class="[item.setting.prefix]"
@@ -48,9 +48,9 @@
 					<uni-col
 						:span=" item.setting.spanList && item.setting.spanList[key]? item.setting.spanList[key] : 24 / item.setting.col"
 						v-for="(col,key) in item.setting.colList">
-						<uni-forms-item :label="col.label ? col.label +'锛�:''" :label-width="col.labelWidth+'px'">
+						<uni-forms-item v-if="col!=null" :label="col.label ? col.label +'锛�:''" :label-width="col.labelWidth+'px'">
 							<uni-data-picker v-if="col.name=='Select'" :class="col.disabled?'input-disabled':''"
-								v-model="col.value" :localdata="col.dict" @change="onEnterChange(col)"
+								v-model="col.value" :localdata="col.useDict ? col.dict : col.selections" @change="onEnterChange(col)"
 								:readonly="col.disabled" :clear-icon="false" :popup-title="col.label"></uni-data-picker>
 							<view class="input-wrapper" v-if="col.name=='Input' || col.name=='InputNumber'">
 								<text v-if="col.setting.prefix" class="uni-icon" :class="[col.setting.prefix]"
@@ -536,7 +536,8 @@
 											styledefHead.form
 												.model[ele.fieldId] = itemName;
 										}
-										ele.dict = selections.map((a) => {
+										
+										ele.selections = selections.map((a) => {
 											return {
 												value: a.value,
 												text: a.label
@@ -573,7 +574,7 @@
 												styledefHead.form
 													.model[col.fieldId] = itemName;
 											}
-											col.dict = selections.map((a) => {
+											col.selections = selections.map((a) => {
 												return {
 													value: a.value,
 													text: a.label
@@ -645,6 +646,13 @@
 										detailstyledef.form
 										.model, ele);
 								}
+								else
+								{
+									if (ele?.name === "Select") {
+										ele.selections =[]
+									}
+								}
+									
 							} else {
 								for (let j in ele.setting.colList) {
 									const col = ele.setting.colList[j]
@@ -653,6 +661,12 @@
 											.bind.dict,
 											detailstyledef.form
 											.model, col);
+									}
+									else
+									{
+										if (col?.name === "Select") {
+											col.selections =[]
+										}
 									}
 								}
 							}
@@ -905,7 +919,7 @@
 				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
 				this.$refs.popup.open(this.popupType);
 
-				this.dataObjRunCustomEvent_Return(onSuffixClickCallbackEvent.id, '', onSuffixClickEvent.id,
+				this.dataObjRunCustomEvent_Return(onSuffixClickEvent.id, '', onSuffixClickCallbackEvent.id,
 					item);
 			},
 
@@ -1029,7 +1043,6 @@
 						};
 						runCustomEvent(dataInfo).then(result => {
 							console.log(result);
-
 							if (result.ret != 0) {
 								var tip = result.err_info ? typeof result
 									.err_info == 'string' ? result
@@ -1718,109 +1731,74 @@
 				}
 
 			},
-			setFormValues(data) {
+			setFormValues(attrs) {
 				const head_styledef = this.head_styledef
-				if (JSON.stringify(data) == '{}') {
+				if (JSON.stringify(attrs) == '{}') {
 					return;
 				}
-				head_styledef.form.items.forEach(async (ele, index) => {
-					if (ele.name != "Layout") {
-						let curIndex = data.findIndex((attr, index2, arr) => {
-							return attr.attr == ele.fieldId;
-						})
-						if (curIndex > -1) {
-							const attr = data[curIndex]
-							if (ele.name ==
-								'Select' &&
-								attr
-								.choice_list
-							) {
-								const
-									dictItemList = [];
-								const
-									choiceList =
-									attr
-									.choice_list || [];
-								for (let d in
-										choiceList) {
-									const
-										val =
-										choiceList[
-											d
-										];
-									dictItemList
-										.push({
-											text: val,
-											value: val
-										});
+				console.log(attrs)
+				attrs.forEach(async (attr, key) => {
+					if (attr.choice_list) {
+						var dictItemList = [];
+						attr.choice_list.forEach(async (val, index) => {
+							dictItemList.push({
+								text: val,
+								value: val
+							});
+						});
+						
+						head_styledef.form.items.forEach(async (attr_item, index) => {
+							if (attr_item.name != "Layout") {
+								if (attr_item.fieldId == attr.attr) {
+									if (attr_item.useDict) {
+										attr_item.dict = dictItemList;
+									} else {
+										attr_item.selections = dictItemList;
+									}
 								}
-								ele.dict =
-									dictItemList;
-							}
-
-							ele.value =
-								attr
-								.value;
-						}
-					} else {
-						ele.setting
-							.colList
-							.forEach(
-								async (
-									col
-								) => {
-									if (
-										col) {
-										let curIndex = data.findIndex((
-											attr, index2, arr) => {
-											return attr.attr == col.fieldId;
-										})
-										if (curIndex > -1) {
-											const attr = data[curIndex]
-											if (col.name ==
-												'Select' &&
-												attr
-												.choice_list
-											) {
-												const
-													dictItemList = [];
-												const
-													choiceList =
-													attr
-													.choice_list || [];
-												for (let d in
-														choiceList) {
-													const
-														val =
-														choiceList[
-															d
-														];
-													dictItemList
-														.push({
-															text: val,
-															value: val
-														});
-												}
-												col.dict =
-													dictItemList;
+							} else if (attr_item.name == "Layout") {
+								attr_item.setting.colList.forEach((col) => {
+									if (col) {
+										if (col.fieldId == attr.attr) {
+											if (col.useDict) {
+												col.dict = dictItemList;
+											} else {
+												col.selections = dictItemList;
 											}
-
-											col.value =
-												attr
-												.value;
 										}
 									}
-
-								})
-
+								});
+							}
+						});
 					}
-				})
+					if (!head_styledef.form.model[attr.attr]) {
+						head_styledef.form.model[attr.attr] = attr.value;
+					}
+					head_styledef.form.items.forEach(async (ele) => {
+						if (ele.name != "Layout") {
+							if (ele.fieldId == attr.attr) {
+								ele.value = attr.value;
+								ele.oldvalue = attr.value;
+							}
+						} else if (ele.name == "Layout") {
+							ele.setting.colList.forEach((col) => {
+								if (col) {
+									if (col.fieldId == attr.attr) {
+										col.value = attr.value;
+										col.oldvalue = attr.value;
+									}
+								}
+							});
+						}
 
+					})
+					//鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�+				})
+				console.log(head_styledef)
 				this.setData({
 					head_styledef: head_styledef
 				})
 			},
-
 			onClickItem(e) { //閫夋嫨椤电
 				// console.log(e);
 				this.current = e.currentIndex
@@ -2728,8 +2706,7 @@
 						objAttr[item.fieldId] = item.value;
 				});
 
-				const url = `../modal/form/index?param=${JSON.stringify(btn)}&titlename=${btn.Edit_dlg
-					.Name}&editMode=1&objAttr=${JSON.stringify(objAttr)}&type=updateDataObj`
+				const url = `../modal/form/index?param=${JSON.stringify(btn)}&titlename=${btn.ShowName}&editMode=1&objAttr=${JSON.stringify(objAttr)}&type=updateDataObj`
 				var $this = this;
 				uni.navigateTo({
 					url: url,

--
Gitblit v1.9.1