From 00814401bba75825126baa6675e542ea3c82a5bb Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 14 三月 2025 12:19:39 +0800
Subject: [PATCH] 日期

---
 pages/modal/form/index.vue |   67 ++++++++++++++++++++++++++-------
 1 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/pages/modal/form/index.vue b/pages/modal/form/index.vue
index 72ffda4..a1acb6d 100644
--- a/pages/modal/form/index.vue
+++ b/pages/modal/form/index.vue
@@ -8,8 +8,9 @@
 					<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.useDict ? item.dict : item.selections" @change="onEnterChange(item)"
-							:readonly="item.disabled" :clear-icon="false" :popup-title="item.label"></uni-data-picker>
+							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]"
 								@click="classAttr_extButton(item)">&#xe568;</text>
@@ -44,16 +45,28 @@
 						<switch class="input-switch" v-if="item.name=='Switch'"
 							:class="item.disabled?'input-disabled':''" :disabled="item.disabled" v-model="item.value"
 							@change="onEnterChange(item)" />
+						<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="onDatetimePickerChange(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="onDatetimePickerChange(item)" />
+						<OITimePicker v-if="item.name=='TimePicker'" :class="item.disabled?'input-disabled':''"
+							:disabled="item.disabled" v-model="item.value" :placeholder="item.placeholder"
+							@change="onDatetimePickerChange(item)" />
 					</uni-forms-item>
 					<!-- 鏍呮牸甯冨眬 -->
 					<uni-row v-else :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">
-							<uni-forms-item v-if="col!=null" :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.useDict ? col.dict : col.selections" @change="onEnterChange(col)"
-									:readonly="col.disabled" :clear-icon="false"
+									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]"
@@ -88,6 +101,18 @@
 								<!-- Switch寮�叧 -->
 								<switch v-if="col.name=='Switch'" :class="col.disabled?'input-disabled':''"
 									:disabled="col.disabled" v-model="col.value" @change="onEnterChange(col)" />
+								<OIDatePicker v-if="col.name=='DatePicker'" :class="col.disabled?'input-disabled':''"
+									:disabled="col.disabled" v-model="col.value" :placeholder="col.placeholder"
+									:defaultToday="col.setting.defaultToday" :format="col.setting.format"
+									@change="onDatetimePickerChange(col)" />
+								<OIDatePickerRange v-if="col.name=='DatePickerRange'"
+									:rangeSeparator="col.setting.separator" :format="col.setting.format"
+									:class="col.disabled?'input-disabled':''" :disabled="col.disabled"
+									v-model="col.value" :placeholder="col.placeholder"
+									@change="onDatetimePickerChange(col)" />
+								<OITimePicker v-if="col.name=='TimePicker'" :class="col.disabled?'input-disabled':''"
+									:disabled="col.disabled" v-model="col.value" :placeholder="col.placeholder"
+									@change="onDatetimePickerChange(col)" />
 							</uni-forms-item>
 						</uni-col>
 					</uni-row>
@@ -104,9 +129,9 @@
 			<uni-popup class="view-popup" ref="popup" background-color="#fff" @change="popupChange">
 				<view class="popup-header">{{check_list.title}}</view>
 				<view class="popup-content" :class="{ 'popup-height': popupType === 'left' || popupType === 'right' }"
-				:style="{'width':check_list.width?check_list.width+'px':'375rpx','height':check_list.height?check_list.height+'px':popupType =='center'?'60vh':'88vh'}">
-				<view class="popup-cont"
-					:style="{'height':check_list.height?check_list.height-45+'px':popupType =='center'?'50vh':'80vh'}">
+					:style="{'width':check_list.width?check_list.width+'px':'375rpx','height':check_list.height?check_list.height+'px':popupType =='center'?'60vh':'88vh'}">
+					<view class="popup-cont"
+						:style="{'height':check_list.height?check_list.height-45+'px':popupType =='center'?'50vh':'80vh'}">
 						<view class="view_popup_CheckList" v-for="(item,index) in check_list.items">
 							<checkbox-group class="check_list" @change="checkChange" :data-ischeck="item.check"
 								:data-index="index" :style="{'margin-left': '10rpx'}">
@@ -140,11 +165,19 @@
 		updateDataObj,
 		dataObjInfo
 	} 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'
 	export default {
 		name: "PageModalForm",
 		modules: {
 			Base64,
+		},
+		components: {
+			OIDatePicker,
+			OIDatePickerRange,
+			OITimePicker
 		},
 		data() {
 			return {
@@ -232,7 +265,7 @@
 				this.ext_info = JSON.parse(options.extInfo);
 			if (options.dataJson)
 				this.data_json = JSON.parse(options.dataJson);
-			this.title =  options.titlename ?  options.titlename : this.param.ShowName; //璁剧疆鎸夐挳鏂囧瓧
+			this.title = options.titlename ? options.titlename : this.param.ShowName; //璁剧疆鎸夐挳鏂囧瓧
 			// console.log(options)
 			uni.setNavigationBarTitle({
 				title: this.title
@@ -440,7 +473,7 @@
 			},
 			async loadFormData(objAttr) {
 				let attrs = []
-				
+
 				if (this.objId) {
 					let info = await dataObjInfo({
 						class_id: this.clsId,
@@ -772,6 +805,11 @@
 					}
 
 				}
+
+			},
+			onDatetimePickerChange(e) {
+				var attr = item.fieldId;
+				this.head_styledef.form.model[attr] = item.value;
 
 			},
 			classAttr_extButton(item) {
@@ -2048,7 +2086,8 @@
 				}
 
 				.uni-icon {
-					padding: 8rpx;
+
+					padding: 10rpx 5rpx;
 					font-size: 32rpx;
 					color: rgb(192, 196, 204);
 				}
@@ -2119,7 +2158,7 @@
 
 		.uni-icon {
 			/* border: 1px solid red; */
-			width: 8%;
+			width: 30rpx;
 			font-family: uniicons;
 			font-size: 40rpx;
 			font-weight: 400;
@@ -2157,7 +2196,7 @@
 		.popup-footer {
 			float: right;
 			position: absolute;
-			bottom:10rpx;
+			bottom: 10rpx;
 			right: 20rpx;
 		}
 

--
Gitblit v1.9.1