From c094d4a32180130de0c26c75a5abc414128a5ec1 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期四, 20 三月 2025 18:31:33 +0800
Subject: [PATCH] test

---
 pages/modal/3037_2.vue |  391 +++++++++++++++----------------------------------------
 1 files changed, 106 insertions(+), 285 deletions(-)

diff --git a/pages/modal/3037_2.vue b/pages/modal/3037_2.vue
index 9487d2a..c7cdeae 100644
--- a/pages/modal/3037_2.vue
+++ b/pages/modal/3037_2.vue
@@ -1,81 +1,9 @@
 <template>
 	<view class="uni-page-modal-3017-2">
 		<!-- 琛ㄥご鏍峰紡 -->
-		<view class="v-headStyle" v-for="(item,index) in head_styledef.form.items">
-			<!-- 鏅�甯冨眬 -->
-			<view v-if="item.name!='Layout' && item.show==true">
-				<text class="txt_title" :style="{'width':item.labelWidth+'px'}">{{item.label}}锛�/text>
-				<!-- 涓嬫媺妗�鍗曢� item.useDict?item.dict:item.selections-->
-				<uni-data-select id="dv_select" v-if="item.name=='Select'" :class="item.disabled?'input-disabled':''"
-					v-model="item.value" :localdata="item.dict" @change="onEnterChange(item)" :disabled="item.disabled"
-					:clear="false"></uni-data-select>
-				<!-- 鏂囨湰妗�鏁板瓧妗�-->
-				<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]"
-						@click="classAttr_extButton(item)">&#xe568;</text>
-					<input class="uni-input" :class="item.disabled?'input-disabled':''"
-						:type="item.name=='Input'?'text':item.name=='InputNumber'?'number':'text'" v-model="item.value"
-						:disabled="item.disabled" :placeholder="item.placeholder"
-						:style="{'width':item.setting.prefix && item.setting.suffix?'78%':item.setting.prefix || item.setting.suffix?'87%':'96%'}"
-						:focus="focusMateria" @focus="ontap(item)" @keyup.enter="onEnterChange(item)"
-						@blur="onEnterChange(item)" :maxlength="-1" />
-					<text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]"
-						@click="classAttr_extButton(item)">&#xe568;</text>
-				</view>
-				<!-- 澶氳鏂囨湰 -->
-				<view class="input-wrapper" v-if="item.name=='Textarea'">
-					<textarea class="uni-input" :class="item.disabled?'input-disabled':''" v-model="item.value"
-						:placeholder="item.placeholder"  @blur="onEnterChange(item)"
-						:data-index="index" style="height:60px;" :style="{'width':'96%'}"
-						:disabled="item.disabled"></textarea>
-
-				</view>
-				<!-- 澶嶉�妗�-->
-				<checkbox-group class="check_rememberPwd" v-if="item.name=='Checkbox'"
-					:class="item.disabled?'input-disabled':''" :disabled="item.disabled" @change="onCheckBoxValue"
-					:data-attr="item.fieldId" :data-index="index">
-					<label v-for="(item2) in item.selections" :key="item2.value">
-						<checkbox :value="item2.value" :checked="item.value.includes(item2.value)" />
-						<text>{{item2.label}}</text>
-					</label>
-				</checkbox-group>
-				<!-- 鍗曢�妗�-->
-				<radio-group class="check_rememberPwd" v-if="item.name=='Radio'"
-					:class="item.disabled?'input-disabled':''" :disabled="item.disabled" @change="onRadioBoxValue"
-					:data-attr="item.fieldId" :data-index="index">
-					<label v-for="(item2) in item.selections" :key="item2.value">
-						<radio :value="item2.value" :checked="item2.value === item.value" />
-						<text>{{item2.label}}</text>
-					</label>
-				</radio-group>
-				<!-- Switch寮�叧 -->
-				<switch v-if="item.name=='Switch'" :class="item.disabled?'input-disabled':''" :disabled="item.disabled"
-					v-model="item.value" @change="onModelValue(item)" :style="{'margin-left':'10rpx'}" />
-				<!-- 鏃ユ湡鏃堕棿 -->
-				<!-- 	<view class="input-wrapper" v-if="item.name=='TimePicker' || item.name=='DatePicker'">
-					<picker mode="date" class="date_iput" :class="item.disabled?'input-disabled':''"
-						:disabled="item.disabled" :value="item.value" @change="onModelValue(item)">
-						<view class="picker">{{item.value}}</view>
-					</picker>
-				</view>
-			 -->
-				<view class="input-wrapper"
-					v-if="item.name=='TimePicker' || item.name=='DatePicker'|| item.name=='DatePickerRange'">
-					<OIDatePicker v-if="item.name=='DatePicker'" :class="item.disabled?'input-disabled':''"
-						:disabled="item.disabled" v-model="item.value" :placeholder="item.placeholder"
-						:defaultToday="item.setting.defaultToday" :format="item.setting.format"
-						@change="onModelValue(item)" />
-					<OIDatePickerRange v-if="item.name=='DatePickerRange'" :rangeSeparator="item.setting.separator"
-						:format="item.setting.format" :class="item.disabled?'input-disabled':''"
-						:disabled="item.disabled" v-model="item.value" :placeholder="item.placeholder"
-						@change="onModelValue(item)" />
-					<OITimePicker v-if="item.name=='TimePicker'" :class="item.disabled?'input-disabled':''"
-						:disabled="item.disabled" v-model="item.value" :placeholder="item.placeholder"
-						@change="onModelValue(item)" />
-				</view>
-			</view>
-
-		</view>
+		<OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" @on-focus="ontap"
+			@on-change="onEnterChange" @on-click-prefix="classAttr_extButton" @on-click-suffix="classAttr_extButton">
+		</OIForm>
 		<!-- 浠庢暟鎹�-->
 		<view class="v-panel">
 			<div class="panel_title">{{param.Sub_Cls.Title}}</div>
@@ -105,40 +33,38 @@
 			<!-- 浠庢暟鎹樉绀鸿鎯呭尯 -->
 			<view class="v-panellist" v-for="(subpanel,iiindex) in subPanelList" @tap="onPanelClick(iiindex)"
 				:class="activelist[iiindex].active==true?'bk-active':''">
-				<view class="v-area dv-panel" v-for="(item,index) in subpanel.subClassAttr.form.items">
-					<div class="dv-panel-input">
-						<!-- 鏅�甯冨眬 -->
-						<view v-if="item.name!='Layout' && item.show==true">
-							<text class="txt_title" :style="{'width':item.labelWidth+'px'}">{{item.label}}锛�/text>
-							<span class="form-item-span" v-if="item.disabled">{{item.value}}</span>
-							<!-- 鏂囨湰妗�鏁板瓧妗�-->
-							<view v-else class="input-wrapper">
-								<input :type="item.name=='InputNumber'?'number':'text'" v-model="item.value"
-									:placeholder="item.placeholder" :maxlength="-1"
-									@on-enter="onDetail1EnterChange(item)" />
-							</view>
-						</view>
+				<uni-forms class="v-area dv-panel" label-align="right">
+					<view v-for="(item,index) in subpanel.subClassAttr.form.items" :key="index">
 						<!-- 鏍呮牸甯冨眬 -->
-						<uni-row class="demo-uni-row" v-if="item.name=='Layout' && item.show==true">
-							<uni-col v-for="(cols,key) in item.setting.colList"
-								:span="item.setting.spanList?item.setting.spanList[key]:24 / item.setting.col">
-								<view v-if="cols!=null">
-									<text class="txt_title"
-										:style="{'width':cols.labelWidth+'px'}">{{cols.label}}锛�/text>
-									<span class="form-item-span" v-if="cols.disabled">{{cols.value}}</span>
-									<!-- 鏂囨湰妗�鏁板瓧妗�-->
-									<view v-else class="input-wrapper">
-										<input :type="cols.name=='InputNumber'?'number':'text'" v-model="cols.value"
-											:placeholder="cols.placeholder" :maxlength="-1"
-											@on-enter="onDetail1EnterChange(cols)" />
-									</view>
+						<uni-row v-if="item.name == 'Layout'" :gutter="item.setting.gutter">
+							<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" :key="key">
+								<uni-forms-item v-if="col != null"
+									:label="col.labelWidth === 0 ? '' : col.label? col.label+'锛�:''"
+									:label-width="col.labelWidth || col.labelWidth === 0 ? col.labelWidth : 100+'px'">
+									<view v-if="col.disabled">{{col.value}}</view>
+									<input class="uni-input" v-else-if="col.name=='Input' || col.name=='InputNumber'"
+										:type="col.name=='InputNumber'?'number':'text'" v-model="col.value"
+										:placeholder="col.placeholder" :maxlength="-1" />
+									<view v-else>{{col.value}}</view>
 
-								</view>
+								</uni-forms-item>
+								<uni-forms-item v-else label=""></uni-forms-item>
 							</uni-col>
 						</uni-row>
-					</div>
-				</view>
+						<uni-forms-item v-else :label="item.labelWidth === 0 ? '' : item.label? item.label+'锛�:''"
+							:label-width="item.labelWidth || item.labelWidth === 0 ? item.labelWidth : 100+'px'"
+							:style="{ textAlign: item.setting.align }">
+							<view v-if="item.disabled">{{item.value}}</view>
+							<input v-else-if="item.name=='Input' || item.name=='InputNumber' " class="uni-input"
+								:type="item.name=='InputNumber'?'number':'text'" v-model="item.value"
+								:disabled="item.disabled" :placeholder="item.placeholder" :maxlength="-1" />
+							<view v-else>{{item.value}}</view>
 
+						</uni-forms-item>
+					</view>
+				</uni-forms>
 				<view class="v-paneldel" v-if="param.Sub_Cls.Can_Add_Delete == true">
 					<a href="javascript:;" class="panel_del" @tap="panel_del(iiindex)"><i
 							class="ace-icon fu-delete"></i></a>
@@ -199,18 +125,14 @@
 		dataObjDel
 	} from "@/api/data.js"
 	import dayjs from "dayjs";
-	import OIDatePicker from '@/components/oi-date-time-picker/oi-date-picker.vue'
-	import OIDatePickerRange from '@/components/oi-date-time-picker/oi-date-picker-range.vue'
-	import OITimePicker from '@/components/oi-date-time-picker/oi-time-picker.vue'
+	import OIForm from '@/components/oi-form/index.vue'
 
 	export default {
 		modules: {
 			Base64,
 		},
 		components: {
-			OIDatePicker,
-			OIDatePickerRange,
-			OITimePicker
+			OIForm
 		},
 		data() {
 			return {
@@ -608,20 +530,6 @@
 												});
 											}
 										}
-										var length = 0;
-										if (!$this.$data.refdatastore.filter(function(s) {
-												return result[i].attr == s.attr
-											}).length) {
-											length = 1;
-											$this.$data.refdatastore.push(result[i]);
-										}
-										if (length == 0) {
-											for (var j = 0; j < $this.$data.refdatastore.length; j++) {
-												if ($this.$data.refdatastore[j].attr == result[i].attr) {
-													$this.$data.refdatastore[j].value = result[i].value;
-												}
-											}
-										}
 									}
 								} else if (data.action[i].action_type == 'set_dlg_attr_show') {
 									var result = action.value;
@@ -694,20 +602,19 @@
 					uni.hideKeyboard();
 					var $this = this;
 					console.log(item);
-					if (item.oldvalue != result.decodedata) {
-						item.oldvalue = result.decodedata;
-						item.value = result.decodedata;
+					item.value = result.decodedata
+					let newVal = item.value.trim()
+					if (item.oldvalue != newVal) {
+						item.oldvalue = newVal;
 						var attr = item.fieldId;
-						$this.head_styledef.form.model[attr] = result.decodedata;
-						if (result.decodedata) { //绗竴涓緭鍏ユ涓嶄负绌�-							$this.focusMateria = true; //鍒濆鍖栵紝绗簩涓緭鍏ユfocus灞炴�
-							// setTimeout(function(){
-							// 	$this.focusMateria=true; //绗簩涓緭鍏ユ鑾峰彇鐒︾偣
-							setTimeout(function() {
-								uni.hideKeyboard();
-							}, 1000);
-							// },500);
-						}
+						$this.head_styledef.form.model[attr] = newVal;
+						$this.focusMateria = true; //鍒濆鍖栵紝绗簩涓緭鍏ユfocus灞炴�
+						// setTimeout(function(){
+						// 	$this.focusMateria=true; //绗簩涓緭鍏ユ鑾峰彇鐒︾偣
+						setTimeout(function() {
+							uni.hideKeyboard();
+						}, 1000);
+						// },500);
 						//瀛愭暟鎹被鎵爜鍖轰簨浠惰剼鏈� 						var eventid = this.$data.param.Scan_Code.Input_Change_Event.ID;
 						if (eventid) {
@@ -730,7 +637,7 @@
 								mast_attr: [],
 								inputParamter: [{
 									attr: 'mast_input_3037',
-									value: result.decodedata
+									value: newVal
 								}]
 							}
 
@@ -743,10 +650,16 @@
 				// console.log(e.target);
 				var $this = this;
 				console.log(item);
-				if (item.oldvalue != item.value && item.value.trim() != "") {
-					item.oldvalue = item.value;
+				let newVal = item.value
+				if (typeof item.value == "string") {
+					newVal = item.value.trim()
+					if (!newVal)
+						return
+				}
+				if (item.oldvalue != newVal) {
+					item.oldvalue = newVal;
 					var attr = item.fieldId;
-					$this.head_styledef.form.model[attr] = item.value;
+					$this.head_styledef.form.model[attr] = newVal;
 					//瀛愭暟鎹被鎵爜鍖轰簨浠惰剼鏈� 					var eventid = this.$data.param.Scan_Code.Input_Change_Event.ID;
 					if (eventid) {
@@ -769,7 +682,7 @@
 							mast_attr: [],
 							inputParamter: [{
 								attr: 'mast_input_3037',
-								value: item.value
+								value: newVal
 							}]
 						}
 
@@ -1125,10 +1038,16 @@
 
 			onEnterChange(item) {
 				console.log("onEnterChange", item);
-				if (item.oldvalue != item.value && item.value.trim() != "") {
-					item.oldvalue = item.value;
+				let newVal = item.value
+				if (typeof item.value == "string") {
+					newVal = item.value.trim()
+					if (!newVal)
+						return
+				}
+				if (item.oldvalue != newVal) {
+					item.oldvalue = newVal;
 					var attr = item.fieldId;
-					this.head_styledef.form.model[attr] = item.value;
+					this.head_styledef.form.model[attr] = newVal;
 					var onChangeEvent = item.bind.onChangeEvent; //鍐呭鍙樺寲鍚庝簨浠� 					if (onChangeEvent?.id) { //鍐呭鍙樺寲鍚庝簨浠� 						this.onChange(onChangeEvent);
@@ -1171,15 +1090,20 @@
 				//console.log(e.target)
 				getApp().onScan((result) => {
 					console.log(result.decodedata);
+					item.value = result.decodedata
+					let newVal = item.value
+					if (typeof item.value == "string") {
+						newVal = item.value.trim()
+					}
 					var isflag = true;
 					for (var i in this.$data.subPanelList) {
-						if (this.$data.subPanelList[i].scanCodeVal == result.decodedata)
+						if (this.$data.subPanelList[i].scanCodeVal == newVal)
 							isflag = false;
 					}
 					//瀛愭暟鎹被鎵爜鏌ヨ鏁版嵁
 					if (isflag) {
 						uni.hideKeyboard();
-						this.$data.scanCodeVal = result.decodedata;
+						this.$data.scanCodeVal = newVal;
 						var eventid = this.$data.param.Scan_Code.Input_Change_Event.ID;
 						if (eventid) {
 							//涓绘暟鎹被灞炴�
@@ -1272,68 +1196,6 @@
 						}
 					}
 				}
-			},
-			onCheckBoxValue(e) { //缁戝畾Model鍊�-				let values = e.detail.value || []
-				const item = this.head_styledef.form.items[e.currentTarget?.dataset?.index || 0]
-				if (item?.setting?.colList) {
-					const col = item.setting.colList[e.currentTarget?.dataset?.iindex || 0]
-					if (col) {
-						col.value = values
-						let attr = col.fieldId;
-						this.head_styledef.form.model[attr] = col.value;
-						var onChangeEvent = col.bind.onChangeEvent; //鍐呭鍙樺寲鍚庝簨浠�-						if (onChangeEvent?.id) { //鍐呭鍙樺寲鍚庝簨浠�-							this.onChange(onChangeEvent);
-						}
-						return
-					}
-				} else {
-					if (item) {
-						item.value = values
-						let attr = item.fieldId;
-						this.head_styledef.form.model[attr] = item.value;
-						var onChangeEvent = item.bind.onChangeEvent; //鍐呭鍙樺寲鍚庝簨浠�-						if (onChangeEvent?.id) { //鍐呭鍙樺寲鍚庝簨浠�-							this.onChange(onChangeEvent);
-						}
-					}
-				}
-
-			},
-			onRadioBoxValue(e) { //缁戝畾Model鍊�-				let values = e.detail.value || ""
-				const item = this.head_styledef.form.items[e.currentTarget?.dataset?.index || 0]
-				if (item?.setting?.colList) {
-					const col = item.setting.colList[e.currentTarget?.dataset?.iindex || 0]
-					if (col) {
-						col.value = values
-						let attr = col.fieldId;
-						this.head_styledef.form.model[attr] = col.value;
-						var onChangeEvent = col.bind.onChangeEvent; //鍐呭鍙樺寲鍚庝簨浠�-						if (onChangeEvent?.id) { //鍐呭鍙樺寲鍚庝簨浠�-							this.onChange(onChangeEvent);
-						}
-						return
-					}
-				} else {
-					if (item) {
-						item.value = values
-						let attr = item.fieldId;
-						this.head_styledef.form.model[attr] = item.value;
-						var onChangeEvent = item.bind.onChangeEvent; //鍐呭鍙樺寲鍚庝簨浠�-						if (onChangeEvent?.id) { //鍐呭鍙樺寲鍚庝簨浠�-							this.onChange(onChangeEvent);
-						}
-					}
-
-				}
-
-			},
-			onModelValue(item) { //缁戝畾Model鍊�-				//console.log(e.target)
-				var attr = item.fieldId;
-				this.head_styledef.form.model[attr] = item.value;
 			},
 
 			panel_del(index) { //闈㈡澘鍒犻櫎
@@ -1719,20 +1581,7 @@
 											}
 
 										}
-										var length = 0;
-										if (!$this.$data.refdatastore.filter(function(s) {
-												return result[i].attr == s.attr
-											}).length) {
-											length = 1;
-											$this.$data.refdatastore.push(result[i]);
-										}
-										if (length == 0) {
-											for (var j = 0; j < $this.$data.refdatastore.length; j++) {
-												if ($this.$data.refdatastore[j].attr == result[i].attr) {
-													$this.$data.refdatastore[j].value = result[i].value;
-												}
-											}
-										}
+									
 									}
 								} else if (action.action_type == 'set_dlg_attr_show') {
 									var result = action.value;
@@ -1976,20 +1825,7 @@
 												}
 											}
 										}
-										var length = 0;
-										if (!$this.$data.refdatastore.filter(function(s) {
-												return result[i].attr == s.attr
-											}).length) {
-											length = 1;
-											$this.$data.refdatastore.push(result[i]);
-										}
-										if (length == 0) {
-											for (var j = 0; j < $this.$data.refdatastore.length; j++) {
-												if ($this.$data.refdatastore[j].attr == result[i].attr) {
-													$this.$data.refdatastore[j].value = result[i].value;
-												}
-											}
-										}
+									
 									}
 								} else if (action.action_type == 'set_global_attr') {
 									$this.$actiontr = action.value || [];
@@ -2413,61 +2249,46 @@
 			/* padding: 10rpx 20rpx 4rpx 0px; */
 			border-radius: 12rpx;
 			/* margin-bottom: 20rpx; */
-			text-align: right;
+
+			.uni-forms-item {
+				padding-bottom: 5rpx;
+				margin-bottom: 0;
+
+				.uni-forms-item__label {
+					height: 20px !important;
+					padding: 0 10rpx 0 0 !important;
+				}
+
+				.uni-input {
+					width: calc(100% - 12rpx);
+					padding: 5rpx;
+					border: 1px solid #d5d5d5;
+					color: #2d8cf0;
+					height: 20px;
+					background: #FFF;
+					line-height: 20px;
+					border-radius: 6px !important;
+					font-size: 14px;
+					font-family: inherit;
+					box-shadow: none !important;
+					transition-duration: 0.1s;
+					vertical-align: middle;
+				}
+
+				.uni-input:hover {
+					border: 1px solid rgb(41, 121, 255);
+				}
+			}
+
+
+
 		}
 
 		.dv-panel:first-child {
 			padding-top: 10rpx;
 		}
 
-		.dv-panel-input {
-			width: 100%;
-			display: inline-block;
-			text-align: left;
-		}
 
-		.dv-panel .txt_title {
-			font-size: 34rpx;
-			text-align: right;
-			display: inline-block;
-			vertical-align: 12px;
-		}
-
-		.dv-panel input {
-			/* vertical-align: middle; */
-			display: inline-block;
-			border: 1px solid #d5d5d5;
-			width: 68%;
-			height: 52rpx;
-			line-height: 34rpx;
-			background: #FFF;
-			border-radius: 7px !important;
-			color: #2d8cf0;
-			padding: 6rpx 8rpx 8rpx;
-			font-size: 32rpx;
-			font-family: inherit;
-			box-shadow: none !important;
-			transition-duration: 0.1s;
-			margin-top: 0rpx;
-		}
-
-		.dv-panel input::-webkit-input-placeholder {
-			font-size: 10rpx;
-		}
-
-		.input-disabled {
-			background-color: #f3f3f3 !important;
-		}
-
-		.dv-panel .form-item-span {
-			vertical-align: top;
-			color: #2d8cf0;
-			white-space: normal;
-			word-break: break-all;
-			display: inline-block;
-			width: calc(100% - 100px);
-			/* border: 1rpx solid red; */
-		}
 
 		#dv_select {
 			display: inline-block;

--
Gitblit v1.9.1