From 90e4076a8adf5dac4384f10d9ce22398580eaf34 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期三, 09 七月 2025 17:27:06 +0800
Subject: [PATCH] 5601列表页面中的内容变化处理,自定义表单的set_dlg_attr_show

---
 pages/modal/form/index.vue |  103 +++++++++++++++++++++++++++++----------------------
 1 files changed, 59 insertions(+), 44 deletions(-)

diff --git a/pages/modal/form/index.vue b/pages/modal/form/index.vue
index bc51570..876b3b5 100644
--- a/pages/modal/form/index.vue
+++ b/pages/modal/form/index.vue
@@ -1,8 +1,8 @@
 <template>
-	<view class="uni-page-modal-form">
+	<view class="uni-page-modal-form" :class="largeMode?'large-mode':''">
 		<view class="view-content">
 			<!-- 琛ㄥご鏍峰紡 -->
-			<OIForm ref="refBaseForm" class="v-head-style" :form="head_styledef.form" :focusId="focusFieldId"
+			<OIForm ref="refBaseForm" class="v-head-style" :form="head_styledef.form" :hiddenIds="head_styledef.hiddenIds ?head_styledef.hiddenIds :[] " :focusId="focusFieldId"
 				@on-click="onClick" @on-focus="ontap" @on-change="onEnterChange" @on-click-prefix="classAttr_extButton"
 				@on-click-suffix="classAttr_extButton"></OIForm>
 		</view>
@@ -43,7 +43,7 @@
 <script>
 	import {
 		Base64
-	} from  '@/js/Base64.js';
+	} from '@/js/Base64.js';
 	import {
 		dictGetInfo
 	} from "@/api/mobox.js"
@@ -64,6 +64,7 @@
 		},
 		data() {
 			return {
+				largeMode: getApp().globalData.largeMode || false,
 				okLoading: false,
 				title: this.translateSys('add2'),
 				type: '',
@@ -293,6 +294,25 @@
 								}
 							}
 						}
+						const app = getApp()
+						if (app.globalData.bindClasses) {
+							styledefHead.form.items.push({
+								name: "Input",
+								label: this.translate("classes"),
+								labelWidth: 100,
+								disabled: true,
+								value: app.globalData.classes,
+								setting: {
+									width: 100,
+									height: 50,
+								},
+								bind: {
+									attr: "",
+								},
+								fieldId: "S_CLASSES",
+							})
+							styledefHead.form.model["S_CLASSES"] = app.globalData.classes
+						}
 
 					}
 					this.setData({
@@ -489,6 +509,10 @@
 										// value = {"attr":"xxx", "value":"xxx"}
 										var data = item.value;
 										$this.setFormValues(data)
+									} else if (action.action_type == 'set_dlg_attr_show') {
+										var data = action.value;
+
+										$this.setFormItemVisible(data)
 									}
 								});
 							} else {
@@ -529,8 +553,8 @@
 				//console.log(e.target)
 				this.focusOldFieldId = item.fieldId
 				getApp().onScan((result) => {
-					console.log(result.decodedata);
-					item.value = result.decodedata;
+					console.log(result);
+					item.value = result;
 					var $this = this;
 					let newVal = item.value.trim()
 					if (newVal) {
@@ -795,6 +819,11 @@
 											var data = item.value;
 											$this.setFormValues(data)
 										}
+										else if (action.action_type == 'set_dlg_attr_show') {
+											var data = action.value;
+										
+											$this.setFormItemVisible(data)
+										}
 									});
 								} else {
 
@@ -900,11 +929,32 @@
 
 					//鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹� 				})
-				console.log(head_styledef)
 				this.setData({
 					head_styledef: head_styledef
 				})
 			},
+			setFormItemVisible(attrs) {
+				if (!Array.isArray(attrs)) {
+					return
+				}
+				const head_styledef = this.head_styledef
+				if (!head_styledef.hiddenIds) {
+					head_styledef.hiddenIds = []
+				}
+				attrs.forEach((attr) => {
+					let index = head_styledef.hiddenIds.findIndex((id) => id == attr.attr);
+					if (attr.show) {
+						if (index > -1) head_styledef.hiddenIds.splice(index, 1);
+					} else {
+						if (index == -1) head_styledef.hiddenIds.push(attr.attr);
+					}
+				});
+				this.setData({
+					head_styledef: head_styledef
+				})
+
+			},
+
 			popupChange(e) {
 				console.log('褰撳墠妯″紡锛� + e.type + ',鐘舵�锛� + e.show);
 			},
@@ -1087,43 +1137,8 @@
 									$this.setFormValues(result)
 								} else if (action.action_type == 'set_dlg_attr_show') {
 									var result = action.value;
-									result.forEach(async (attr, key) => {
-										$this.head_styledef.form.items
-											.forEach(
-												async (ele,
-													index) => {
-													//鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�-													if (ele.name != 'Layout') {
-														if (ele.fieldId == attr
-															.attr) {
-															ele.show = attr
-																.show;
-														}
-													} else if (ele.name ==
-														'Layout') {
-														ele.setting.colList
-															.forEach(
-																col => {
-																	if (col) {
-																		if (col
-																			.fieldId ==
-																			attr
-																			.attr
-																		) {
-																			col.show =
-																				attr
-																				.show;
-																		}
-																	}
-																});
-													}
-												});
-									});
-									var head_styledef = JSON.parse(JSON.stringify($this.$data
-										.head_styledef));
-									$this.head_styledef = [];
-									$this.head_styledef = head_styledef;
-									// console.log($this.head_styledef);
+
+									$this.setFormItemVisible(result)
 								} else if (action.action_type == 'set_global_attr') {
 									$this.global_attr = action.value || [];
 								} else {
@@ -1838,7 +1853,7 @@
 			flex-direction: column;
 		}
 
-	
+
 		.view-content {
 			display: flex;
 			flex: 1;

--
Gitblit v1.9.1