Merge pull request #7486 from dataease/pr@dev@fix_date_filter_reset

fix: 日期过滤器设置必填编辑页面置空后重新设置无效
This commit is contained in:
fit2cloud-chenyw 2024-01-02 12:21:55 +08:00 committed by GitHub
commit a6ab03428d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -422,10 +422,19 @@ export default {
this.$refs.dateRef.hidePicker() this.$refs.dateRef.hidePicker()
} }
}, },
textSame(str1, str2) {
if (str1 === null && str2 === null) {
return true
}
if (str1 !== null && str2 !== null && typeof str1 !== 'undefined' && typeof str2 !== 'undefined') {
return str1.toString() === str2.toString()
}
return false
},
resetDefaultValue(ele) { resetDefaultValue(ele) {
const id = ele.id const id = ele.id
const eleVal = ele.options.value.toString() const eleVal = ele.options.value.toString()
if (this.inDraw && this.manualModify && this.element.id === id && this.values.toString() !== eleVal && this.defaultValueStr === eleVal) { if (this.inDraw && this.manualModify && this.element.id === id && !this.textSame(this.values, eleVal) && this.textSame(this.defaultValueStr, eleVal)) {
if (!this.element.options.attrs.default.isDynamic) { if (!this.element.options.attrs.default.isDynamic) {
this.values = this.fillValueDerfault() this.values = this.fillValueDerfault()
this.dateChange(this.values) this.dateChange(this.values)