diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index b8fbc27..a301c10 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -81,7 +81,9 @@ v-model="inputValue" type="datetimerange" range-separator="至" + :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" :picker-options="pickerOptions" + @change="(val) => onDateChange(val, 'yyyy/MM/DD HH:mm:ss')" start-placeholder="开始日期" end-placeholder="结束日期"> @@ -300,6 +302,7 @@ export default { const defaultCheckedValue = getDefaultValueByOptions(this.item.options || []); initialValue = { checkedValues: defaultCheckedValue, otherValues: {} }; } + const {type} = this; return { inputValue: initialValue, oldValue: typeof initialValue === 'object' ? JSON.parse(JSON.stringify(initialValue)) : initialValue, // 记录上一次的值 @@ -335,7 +338,7 @@ export default { disabledDate(time) { return time.getTime() > Date.now(); }, - shortcuts: [{ + shortcuts: type === 'dateTimeRange' ? undefined:[{ text: '今天', onClick(picker) { picker.$emit('pick', new Date()); @@ -657,7 +660,11 @@ export default { this.onCommonHandleSaveRecord(this.inputValue); }, onDateChange(val, format) { - this.inputValue = moment(val).format(format); + if (this.type === 'dateTimeRange') { + this.inputValue = [moment(val[0]).format(format), moment(val[1]).format(format)]; + }else{ + this.inputValue = moment(val).format(format); + } this.onCommonHandleSaveRecord(this.inputValue); }, getUserName(record) { diff --git a/src/views/business/comps/template/comps/dj/DJ003.vue b/src/views/business/comps/template/comps/dj/DJ003.vue index 86f4a29..61ac06c 100644 --- a/src/views/business/comps/template/comps/dj/DJ003.vue +++ b/src/views/business/comps/template/comps/dj/DJ003.vue @@ -197,7 +197,8 @@ export default { { label: 'template.dj.dj003.cysj', prop: "cysj", - bodyType: 'input', + bodyType: 'dateTimeRange', + width: 450, bodyFillType: 'actFill' }, {