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 | 150 ++++++++++++++++++++++++++++++++----------------- 1 files changed, 97 insertions(+), 53 deletions(-) diff --git a/pages/modal/form/index.vue b/pages/modal/form/index.vue index d2c24d3..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)"></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,8 +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':'200px','height':check_list.height?check_list.height+'px':'88%'}"> - <view class="popup-cont" :style="{'height':check_list.height?check_list.height-45+'px':'415px'}"> + :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'}"> @@ -117,7 +143,7 @@ </view> </view> <view class="popup-footer"> - <button type="default" @tap="popup_sava" class="btn_popup_add">{{translateSys('ok')}}</button> + <button type="primary" @tap="popup_sava" class="btn_popup_add">{{translateSys('ok')}}</button> <button type="default" @tap="popup_cancel" class="btn_popup_cancel">{{translateSys('cancel')}}</button> </view> @@ -139,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 { @@ -231,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 @@ -244,7 +278,7 @@ title: this.translateSys("error"), content: this.translate("tip_no_master_class"), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, @@ -394,7 +428,7 @@ title: $this.translateSys('tip') + "1", content: exStr, showCancel: false, - confirmText: $this.translateSys("cancel") + confirmText: $this.translateSys('close') }); } @@ -432,14 +466,14 @@ title: this.translateSys("error") + "3", content: ex.errMsg, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, async loadFormData(objAttr) { let attrs = [] - + if (this.objId) { let info = await dataObjInfo({ class_id: this.clsId, @@ -518,7 +552,7 @@ content: tip, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); } else uni.showModal({ title: this.translateSys('tip'), @@ -528,7 +562,7 @@ .ret, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); return false; } else { @@ -540,7 +574,7 @@ content: tip, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); if (result.result_type == 0 && result.action) { @@ -584,7 +618,7 @@ content: result.info, showCancel: false, confirmText: this - .translateSys("cancel") + .translateSys('close') }); } } @@ -601,7 +635,7 @@ title: $this.translateSys('tip') + "2", content: exStr, showCancel: false, - confirmText: $this.translateSys("cancel") + confirmText: $this.translateSys('close') }); } }, @@ -773,6 +807,11 @@ } }, + onDatetimePickerChange(e) { + var attr = item.fieldId; + this.head_styledef.form.model[attr] = item.value; + + }, classAttr_extButton(item) { var onSuffixClickCallbackEvent = item.bind.onSuffixClickCallbackEvent; //鍚庡浘鏍囩偣鍑讳簨浠� var onSuffixClickEvent = item.bind.onSuffixClickEvent; //鍚庡浘鏍囩偣鍑诲洖璋�@@ -782,7 +821,7 @@ title: this.translateSys("tip"), content: this.translate('icon_click_callback_empty'), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return; } @@ -791,7 +830,7 @@ title: this.translateSys("tip"), content: this.translate('icon_click_event_empty'), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return; } @@ -872,7 +911,7 @@ content: tip, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); } else uni.showModal({ title: this.translateSys('tip'), @@ -882,7 +921,7 @@ .ret, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); return false; } else { @@ -894,7 +933,7 @@ content: tip, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); if (result.result_type == 0 && result.action) { @@ -938,7 +977,7 @@ content: result.info, showCancel: false, confirmText: this - .translateSys("cancel") + .translateSys('close') }); } } @@ -952,7 +991,7 @@ title: this.translateSys("error") + "4.1", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); }); } @@ -967,7 +1006,7 @@ this.translate('reason') + this.translateSys("colon") + tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, @@ -1080,7 +1119,7 @@ title: this.translateSys("tip"), content: "popupParam涓虹┖锛�, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return; } @@ -1089,7 +1128,7 @@ title: this.translateSys("tip"), content: this.translate("tip_no_select_data"), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return; } @@ -1188,14 +1227,14 @@ title: this.translateSys("tip"), content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } else uni.showModal({ title: this.translateSys("tip"), content: tip + ',' + this.translateSys('tip') + ':' + data .ret, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false } else { @@ -1207,7 +1246,7 @@ title: this.translateSys("tip"), content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); var actionlist = data.action; @@ -1270,7 +1309,7 @@ .translate( "tip_action_unprocessed"), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } } @@ -1347,7 +1386,7 @@ title: this.translateSys("error") + "3.1", content: exStr, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); }); }, @@ -1435,14 +1474,14 @@ title: $this.translateSys("tip"), content: tip, showCancel: false, - confirmText: $this.translateSys("cancel") + confirmText: $this.translateSys('close') }); } else uni.showModal({ title: $this.translateSys("tip"), content: tip + ',' + $this.translateSys('tip') + ':' + data .ret, showCancel: false, - confirmText: $this.translateSys("cancel") + confirmText: $this.translateSys('close') }); return false } else { @@ -1454,7 +1493,7 @@ title: $this.translateSys("tip"), content: tip, showCancel: false, - confirmText: $this.translateSys("cancel") + confirmText: $this.translateSys('close') }); if (data != "") { @@ -1628,7 +1667,7 @@ .translate( "tip_action_unprocessed"), showCancel: false, - confirmText: $this.translateSys("cancel") + confirmText: $this.translateSys('close') }); } } @@ -1641,7 +1680,7 @@ "quotation_mark_right") + $this.translateSys( "comma") + 'event_id' + eventid, showCancel: false, - confirmText: $this.translateSys("cancel") + confirmText: $this.translateSys('close') }); } } @@ -1656,7 +1695,7 @@ title: $this.translateSys('tip') + "5.1", content: exStr, showCancel: false, - confirmText: $this.translateSys("cancel") + confirmText: $this.translateSys('close') }); }); }, @@ -1769,7 +1808,7 @@ title: this.translateSys('tip') + "7.1", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false } @@ -1796,7 +1835,7 @@ title: this.translateSys("tip") + "6.1", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false } @@ -1823,7 +1862,7 @@ title: this.translateSys("tip") + "6.2", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false } @@ -1874,7 +1913,7 @@ title: this.translateSys('tip') + "7.2", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false } @@ -1943,7 +1982,7 @@ title: this.translateSys("tip") + "8.1", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false } @@ -1991,7 +2030,7 @@ title: this.translateSys("tip") + "8.2", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false } @@ -2047,7 +2086,8 @@ } .uni-icon { - padding: 8rpx; + + padding: 10rpx 5rpx; font-size: 32rpx; color: rgb(192, 196, 204); } @@ -2095,8 +2135,10 @@ .btn_cancel { width: 45%; margin: 0 10rpx; + // background: #fff; + // border: none; + // color: #000; background: #fff; - border: none; color: #000; font-size: 38rpx; float: right; @@ -2116,7 +2158,7 @@ .uni-icon { /* border: 1px solid red; */ - width: 8%; + width: 30rpx; font-family: uniicons; font-size: 40rpx; font-weight: 400; @@ -2154,7 +2196,7 @@ .popup-footer { float: right; position: absolute; - bottom: 0; + bottom: 10rpx; right: 20rpx; } @@ -2178,9 +2220,11 @@ margin-top: 50rpx; padding: 15rpx; line-height: 1.5; - background: #27A6E1; - border: none; - color: #fff; + // background: #27A6E1; + // border: none; + // color: #fff; + background: #fff; + color: #000; font-size: 38rpx; font-weight: bold; /* float: right; */ -- Gitblit v1.9.1