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/3200.vue | 331 ++++++++++++++++++++++++++---------------------------- 1 files changed, 158 insertions(+), 173 deletions(-) diff --git a/pages/modal/3200.vue b/pages/modal/3200.vue index dc03306..45fb2f3 100644 --- a/pages/modal/3200.vue +++ b/pages/modal/3200.vue @@ -6,7 +6,7 @@ <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="onChange(item)" :disabled="item.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]" @@ -19,6 +19,20 @@ @blur="onEnterChange(item)" :maxlength="-1" /> <text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]" @click="onEnterChange(item)"></text> + </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> @@ -50,66 +64,12 @@ <view v-if="item.name!='Layout'"> <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 class="dv_input" v-if="(item.name=='Input' || item.name=='InputNumber')"> - <text v-if="item.setting.prefix" class="uni-icon" - :class="[item.setting.prefix]" @change="onChange(item)"></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)" @blur="onevent(item)" - :maxlength="-1" /> - <text v-if="item.setting.suffix" class="uni-icon" - :class="[item.setting.suffix]" @click="onChange(item)"></text> - </view> - <!-- 涓嬫媺妗�鍗曢� 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="onChange(item)" :disabled="item.disabled" - :clear="false"></uni-data-select> - <!-- 澶氳鏂囨湰 --> - <view class="input-wrapper" v-if="item.name=='Textarea'"> - <textarea class="uni-input" :value="item.value" - :class="item.disabled?'input-disabled':''" - :placeholder="item.placeholder" @blur="onModelValue(item)" - 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"> - <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" - :style="{'margin-left':'10rpx'}" @change="onModelValue(item)" - :data-attr="item.fieldId"> - <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') && !item.disabled"> - <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 v-else class="form-item-input"> + <input :type="item.name=='InputNumber'?'number':'text'" v-model="item.value" + :placeholder="item.placeholder" :maxlength="-1" + @on-enter="onDetail1EnterChange(item)" /> </view> </view> <!-- 鏍呮牸甯冨眬 --> @@ -119,71 +79,13 @@ <view v-if="cols!=null"> <text class="txt_title" :style="{'width':cols.labelWidth+'px'}">{{cols.label}}锛�/text> - <view class="dv_input" - v-if="(cols.name=='Input' || cols.name=='InputNumber') && !cols.disabled"> - <text v-if="cols.setting.prefix" class="uni-icon" - :class="[cols.setting.prefix]" - @change="onChange(cols)"></text> - <input class="uni-input" :class="cols.disabled?'input-disabled':''" - :type="cols.name=='Input'?'text':cols.name=='InputNumber'?'number':'text'" - v-model="cols.value" :disabled="cols.disabled" - :placeholder="cols.placeholder" - :style="{'width':cols.setting.prefix && cols.setting.suffix?'78%':cols.setting.prefix || cols.setting.suffix?'87%':'96%'}" - :focus="focusMateria" @focus="ontap(cols)" @blur="onevent(cols)" - :maxlength="-1" /> - <text v-if="cols.setting.suffix" class="uni-icon" - :class="[cols.setting.suffix]" - @click="onChange(cols)"></text> + <span class="form-item-span" v-if="cols.disabled">{{cols.value}}</span> + <!-- 鏂囨湰妗�鏁板瓧妗�--> + <view v-else class="form-item-input"> + <input :type="cols.name=='InputNumber'?'number':'text'" + v-model="cols.value" :placeholder="cols.placeholder" + :maxlength="-1" @on-enter="onDetail1EnterChange(cols)" /> </view> - <!-- 涓嬫媺妗�鍗曢� cols.useDict?cols.dict:cols.selections--> - <uni-data-select id="dv_select" v-if="cols.name=='Select'" - :class="cols.disabled?'input-disabled':''" v-model="cols.value" - :localdata="cols.dict" @change="onChange(cols)" - :disabled="cols.disabled" :clear="false"></uni-data-select> - <!-- 澶氳鏂囨湰 --> - <view class="input-wrapper" v-if="cols.name=='Textarea'"> - <textarea class="uni-input" :value="cols.value" - :class="cols.disabled?'input-disabled':''" - :placeholder="cols.placeholder" @blur="onModelValue(cols)" - style="height:60px;" :style="{'width':'96%'}" - :disabled="cols.disabled"></textarea> - </view> - <!-- 澶嶉�妗�--> - <checkbox-group class="check_rememberPwd" v-if="cols.name=='Checkbox'" - :class="cols.disabled?'input-disabled':''" :disabled="cols.disabled" - @change="onCheckBoxValue" :data-attr="cols.fieldId"> - <label v-for="(cols2) in cols.selections" :key="cols2.value"> - <checkbox :value="cols2.value" - :checked="cols.value.includes(cols2.value)" /> - <text>{{cols2.label}}</text> - </label> - </checkbox-group> - <!-- 鍗曢�妗�--> - <radio-group class="check_rememberPwd" v-if="cols.name=='Radio'" - :class="cols.disabled?'input-disabled':''" :disabled="cols.disabled" - :style="{'margin-left':'10rpx'}" @change="onModelValue(cols)"> - <label v-for="(cols2) in cols.selections" :key="cols2.value"> - <radio :value="cols2.value" - :checked="cols2.value === cols.value" /> - <text>{{cols2.label}}</text> - </label> - </radio-group> - <!-- Switch寮�叧 --> - <switch v-if="cols.name=='Switch'" - :class="cols.disabled?'input-disabled':''" :disabled="item.disabled" - v-model="cols.value" @change="onModelValue(cols)" - :style="{'margin-left':'10rpx'}" /> - <!-- 鏃ユ湡鏃堕棿 --> - <view class="input-wrapper" - v-if="(cols.name=='TimePicker' || cols.name=='DatePicker') && !cols.disabled"> - <picker mode="date" class="date_iput" - :class="cols.disabled?'input-disabled':''" - :disabled="item.disabled" :value="cols.value" - @change="onModelValue(cols)"> - <view class="picker">{{cols.value}}</view> - </picker> - </view> - </view> </uni-col> </uni-row> @@ -237,10 +139,18 @@ dataObjQuery, 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' export default { modules: { Base64, + }, + components: { + OIDatePicker, + OIDatePickerRange, + OITimePicker }, onNavigationBarButtonTap(e) { // console.log(e); @@ -516,7 +426,7 @@ title: this.translateSys("error") + "1.1", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } @@ -547,7 +457,7 @@ title: this.translateSys("error") + "1.1", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } @@ -582,7 +492,7 @@ title: this.translateSys("error") + "1.1", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, @@ -623,7 +533,7 @@ title: this.translateSys("error") + "3", content: ex.errMsg, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, @@ -654,14 +564,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') + ':' + result .ret, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false; } else { @@ -671,7 +581,7 @@ title: this.translateSys("tip"), content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); if (result.result_type == 0 && result.action) { @@ -694,7 +604,7 @@ title: this.translateSys("tip"), content: result.info, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } } @@ -708,7 +618,7 @@ "comma") + tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } @@ -872,7 +782,7 @@ title: this.translateSys("error") + "5.1", content: ex.errMsg, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); }); } catch (ex) { @@ -881,7 +791,7 @@ title: this.translateSys("error") + "5.2", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, @@ -937,7 +847,7 @@ content: tip, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); } } @@ -954,8 +864,10 @@ uni.showModal({ title: this.translateSys("tip"), content: btn.PromptContent || this.translate("are_you_sure"), + cancelText: this.translateSys('ok'), + confirmText: this.translateSys('cancel'), success: function(res) { - if (res.confirm) { + if (res.cancel) { that.onButtonClicked(btn, style); // } else if (res.cancel) { // console.log('鐢ㄦ埛鐐瑰嚮鍙栨秷'); @@ -980,10 +892,11 @@ if (btn.Prompt) { uni.showModal({ title: this.translateSys("tip"), - content: btn.PromptContent || this.translate( - "are_you_sure"), + content: btn.PromptContent || this.translate("are_you_sure"), + cancelText: this.translateSys('ok'), + confirmText: this.translateSys('cancel'), success: function(res) { - if (res.confirm) { + if (res.cancel) { that.onButtonClicked(btn); // } else if (res.cancel) { // console.log('鐢ㄦ埛鐐瑰嚮鍙栨秷'); @@ -1013,7 +926,7 @@ title: this.translateSys("tip"), content: this.translateSys("unrealized"), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } } else if (btn.FunCode == "Delete") { @@ -1033,7 +946,7 @@ title: this.translateSys("tip"), content: this.translateSys("unrealized"), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } } catch (ex) { @@ -1042,7 +955,7 @@ title: this.translateSys("error"), content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, @@ -1076,8 +989,10 @@ uni.showModal({ title: this.translateSys("tip"), content: this.translate("confirm_delete_data"), + cancelText: this.translateSys('ok'), + confirmText: this.translateSys('cancel'), success: function(res) { - if (res.confirm) { + if (res.cancel) { var objID = style.form.objId; if (!style.form.objId.includes('{')) objID = '{' + style.form .objId + '}'; @@ -1108,7 +1023,7 @@ "delete_success"), showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); }).catch(ex => { // console.log(ex); @@ -1118,7 +1033,7 @@ content: ex.errMsg, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); }); } else if (res.cancel) { @@ -1181,7 +1096,7 @@ title: this.translateSys("tip"), content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } else uni.showModal({ title: this.translateSys("tip"), @@ -1190,7 +1105,7 @@ result .ret, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return false; } else { @@ -1202,7 +1117,7 @@ title: this.translateSys("tip"), content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } @@ -1212,7 +1127,7 @@ title: this.translateSys("error"), content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); this.showError(ex); } @@ -1261,7 +1176,7 @@ 'tip_no_app_param'), showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); return; } @@ -1286,7 +1201,7 @@ content: this.translate( "function_not_exist"), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } @@ -1295,7 +1210,7 @@ title: this.translateSys("error"), content: this.translate("cannot_related_function"), showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } @@ -1309,7 +1224,7 @@ title: this.translateSys("error"), content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); return undefined } @@ -1332,7 +1247,7 @@ title: this.translateSys("error") + "7", content: tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, @@ -1388,6 +1303,7 @@ } }) }, + onEnterChange(item) { //鍥炶溅锛岀偣鍑绘寜閽紝鍙栨秷鑺傜偣浜嬩欢 // console.log(item); if (item.oldvalue != item.value) { @@ -1474,7 +1390,7 @@ content: tip, showCancel: false, confirmText: this - .translateSys("cancel") + .translateSys('close') }); } else uni.showModal({ title: this.translateSys( @@ -1486,7 +1402,7 @@ .ret, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); return false; } else { @@ -1500,7 +1416,7 @@ content: tip, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); if (result.result_type == 0 && result @@ -1545,7 +1461,7 @@ showCancel: false, confirmText: this .translateSys( - "cancel") + 'close') }); } } @@ -1560,7 +1476,7 @@ content: ex.errMsg, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); }); } @@ -1575,11 +1491,74 @@ this.translate('reason') + this.translateSys( "colon") + tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } }, + 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) { + var attr = item.fieldId; + this.head_styledef.form.model[attr] = item.value; + }, + onDetail1EnterChange() {}, //鐐逛腑琛ㄥ崟 onPanelClick(value) { //鐐瑰嚮闈㈡澘楂樹寒鏄剧ず // console.log(value); @@ -1618,7 +1597,7 @@ content: tip, showCancel: false, confirmText: this - .translateSys("cancel") + .translateSys('close') }); } else uni.showModal({ title: this.translateSys( @@ -1629,7 +1608,7 @@ result.ret, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); return false; } else { @@ -1643,7 +1622,7 @@ content: tip, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); if (result.result_type == 0 && result @@ -1719,7 +1698,7 @@ showCancel: false, confirmText: this .translateSys( - "cancel" + 'close' ) }); } @@ -1734,7 +1713,7 @@ showCancel: false, confirmText: this .translateSys( - "cancel") + 'close') }); } } @@ -1749,7 +1728,7 @@ content: ex.errMsg, showCancel: false, confirmText: this.translateSys( - "cancel") + 'close') }); }); } catch (ex) { @@ -1762,7 +1741,7 @@ this.translate('reason') + this.translateSys( "colon") + tip, showCancel: false, - confirmText: this.translateSys("cancel") + confirmText: this.translateSys('close') }); } @@ -2029,7 +2008,7 @@ }, }; </script> -<style lang="less"> +<style lang="scss"> .uni-page-modal-3200 { display: flex; flex-direction: column; @@ -2088,7 +2067,8 @@ .uni-icon { /* border: 1px solid red; */ - width: 8%; + width: 30rpx; + padding: 10rpx 5rpx; font-family: uniicons; font-size: 40rpx; font-weight: 400; @@ -2207,6 +2187,11 @@ width: calc(100% - 100px); } + .dv-panel .form-item-input { + + width: calc(100% - 100px); + } + .dv-panel-button { display: inline-block; } @@ -2241,7 +2226,7 @@ margin-top: 25rpx; padding: 20rpx; line-height: 1.5; - background: #4D6AF4; + background: #27A6E1; border: none; color: #fff; font-size: 38rpx; @@ -2256,7 +2241,7 @@ padding: 20rpx; line-height: 1.5; background: #fff; - border: none; + // border: none; color: #000; font-size: 38rpx; font-weight: bold; -- Gitblit v1.9.1