update 属性类型新增年份选择

This commit is contained in:
赵霄
2023-09-14 14:33:04 +08:00
parent bdb9e0d18c
commit a1e4a12ff6
7 changed files with 78 additions and 6 deletions
+23 -1
View File
@@ -222,6 +222,22 @@
</a-form-model-item>
</div>
</a-col>
<!--14 年份选择-->
<a-col :span="12" v-else-if="item.fieldShowType === FieldType.YEAR_PICKER.value">
<div class="box-title-text" :title="item.dbFieldTxt">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<j-date show-type="year"
v-model="formInline[item.dbFieldName]"
:default-value="defaultValue[item.dbFieldName]"
date-format="YYYY"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"/>
</a-form-model-item>
</div>
</a-col>
</div>
</a-row>
@@ -326,7 +342,8 @@ export default {
},
methods: {
add () {
this.formInline = Object.assign({}, this.defaultValue)
this.$set(this.formInline, 'year_number', '2023')
this.$forceUpdate()
this.type = 'add'
this.getForm()
},
@@ -483,4 +500,9 @@ export default {
<style scoped lang="less">
@import '~@assets/less/common.less';
/deep/ .ant-form-item-children {
width: 100%;
display: inline-block;
}
</style>
+10 -1
View File
@@ -10,6 +10,7 @@
:value="momVal"
:showTime="true"
:format="dateFormat"
style="width: 100%"
v-bind="$attrs"
v-on="childListeners"
:getCalendarContainer="getCalendarContainer">
@@ -24,6 +25,7 @@
:value="momVal"
:showTime="false"
:format="dateFormat"
style="width: 100%"
v-bind="$attrs"
v-on="childListeners"
:getCalendarContainer="getCalendarContainer">
@@ -35,6 +37,7 @@
:value="momVal"
:disabled="disabled || readOnly"
:format="dateFormat"
style="width: 100%"
v-bind="$attrs"
v-on="childListeners"
@change="handleMonthChange">
@@ -51,6 +54,7 @@
v-bind="$attrs"
v-on="childListeners"
:getCalendarContainer="getCalendarContainer"
style="width: 100%"
@openChange="openChangeOne"
@panelChange="panelChangeOne">
</a-date-picker>
@@ -116,6 +120,7 @@ export default {
},
watch: {
value (val) {
console.log(val)
const fm = this.dateFormat
moment.prototype.toJSON = function () {
return moment(this).format(fm)
@@ -123,7 +128,11 @@ export default {
if (!val) {
this.momVal = null
} else {
this.momVal = moment(val, this.dateFormat)
if (this.showType === 'year') {
this.year = val
} else {
this.momVal = moment(val, this.dateFormat)
}
}
}
},