Merge pull request #6094 from dataease/pr@dev@fix_dynamic_time

fix(过滤器): 时间范围组件自定义动态时间异常#5780
This commit is contained in:
fit2cloud-chenyw 2023-09-08 18:43:19 +08:00 committed by GitHub
commit bbc1139b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,7 +155,7 @@
:format="element.options.attrs.accuracy"
style="width: auto; min-width: 110px;"
placeholder=""
@change="eDynamicSuffixTimeChange"
@change="sDynamicSuffixTimeChange"
/>
</el-form-item>
@ -384,10 +384,22 @@ export default {
}
},
eDynamicSuffixTimeChange(val) {
const time = this.convertTime(val)
this.$set(this.element.options.attrs.default, 'eDynamicSuffixTime', time)
this.setDval()
},
sDynamicSuffixTimeChange(val) {
const time = this.convertTime(val)
this.$set(this.element.options.attrs.default, 'sDynamicSuffixTime', time)
this.setDval()
},
convertTime(val) {
const date = new Date(val)
const baseDate = new Date(this.baseTime)
date.setFullYear(baseDate.getFullYear())
date.setMonth(baseDate.getMonth())
date.setDate(baseDate.getDate())
return date.getTime()
}
}
}