【update】多选时间组件 增加全部删除的方法-测试1
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
:ref="fieldName"
|
:ref="fieldName"
|
||||||
:dropdownClassName="'j-multiple-date-picker ' + fieldName + '-drop'"
|
:dropdownClassName="'j-multiple-date-picker ' + fieldName + '-drop'"
|
||||||
@openChange="handleOpenChange"
|
@openChange="handleOpenChange"
|
||||||
|
@change="handleChange"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
>
|
>
|
||||||
@@ -35,6 +36,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value (val) {
|
value (val) {
|
||||||
|
console.log(val, '----watch--value-------')
|
||||||
if (!val) {
|
if (!val) {
|
||||||
this.checkedValue = []
|
this.checkedValue = []
|
||||||
document.getElementById(this.fieldName).children[0].children[0].value = ''
|
document.getElementById(this.fieldName).children[0].children[0].value = ''
|
||||||
@@ -79,12 +81,32 @@ export default {
|
|||||||
}, 100)
|
}, 100)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
const newVal = document.getElementsByClassName(this.fieldName + '-drop')[0].children[0].children[0].children[0].children[0].children[0].value
|
||||||
|
const oldVal = this.checkedValue.join(',')
|
||||||
|
if (newVal !== oldVal) {
|
||||||
|
if (newVal) {
|
||||||
|
this.checkedValue = newVal.split(',')
|
||||||
|
} else {
|
||||||
|
this.checkedValue = []
|
||||||
|
}
|
||||||
|
this.$emit('change', this.checkedValue.join(','))
|
||||||
|
}
|
||||||
|
this.$refs[this.fieldName].blur()
|
||||||
this.open = open
|
this.open = open
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
// console.log('------this.checkedValue.join(\',\')----------', this.checkedValue.join(','))
|
||||||
|
// this.$emit('change', lastCheckedValue.join(','))
|
||||||
document.getElementById(this.fieldName).children[0].children[0].value = this.checkedValue.join(',')
|
document.getElementById(this.fieldName).children[0].children[0].value = this.checkedValue.join(',')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleChange (val) {
|
||||||
|
console.log('-handleChange-----', val)
|
||||||
|
if (!val) {
|
||||||
|
this.checkedValue = []
|
||||||
|
this.$emit('change', this.checkedValue.join(','))
|
||||||
|
}
|
||||||
|
},
|
||||||
getCurrentStyle (current) {
|
getCurrentStyle (current) {
|
||||||
const currentStr = current.format('YYYY-MM-DD')
|
const currentStr = current.format('YYYY-MM-DD')
|
||||||
if (this.checkedValue.includes(currentStr)) {
|
if (this.checkedValue.includes(currentStr)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user