Skip to content

Commit

Permalink
fix(过滤组件): 全屏导致选择的过滤器值消失 close #8076
Browse files Browse the repository at this point in the history
  • Loading branch information
fit2cloud-chenyw committed Mar 1, 2024
1 parent d3f30ed commit 371cc8c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion core/frontend/src/components/widget/deWidget/DeDate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ export default {
if (this.refreshHandler()) {
return
}
if (this.element.options.value) {
const existLastValidFilters = this.$store.state.lastValidFilters && this.$store.state.lastValidFilters[this.element.id]?.length
if (this.element.options.value || existLastValidFilters) {
this.values = this.fillValueDerfault()
this.dateChange(this.values)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export default {
}
},
created() {
if (this.element.options.value) {
const existLastValidFilters = this.$store.state.lastValidFilters && this.$store.state.lastValidFilters[this.element.id]?.length
if (this.element.options.value || existLastValidFilters) {
this.value = this.fillValueDerfault()
this.search()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ export default {
}
},
created() {
if (this.element.options.value && this.element.options.value.length > 0) {
const existLastValidFilters = this.$store.state.lastValidFilters && this.$store.state.lastValidFilters[this.element.id]?.length
if ((this.element.options.value && this.element.options.value.length > 0) || existLastValidFilters) {
const values = this.fillValueDerfault()
this.form.min = values[0]
if (values.length > 1) {
Expand Down
5 changes: 3 additions & 2 deletions core/frontend/src/components/widget/deWidget/DeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export default {
this.firstChange(this.value)
return
}
if (this.value.toString() !== eleVal && this.defaultValueStr === eleVal) {
if (this.value?.toString() !== eleVal && this.defaultValueStr === eleVal) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
Expand All @@ -387,7 +387,8 @@ export default {
},
initLoad() {
this.initOptions(this.fillFirstSelected)
if (this.element.options.value && !this.selectFirst) {
const existLastValidFilters = this.$store.state.lastValidFilters && this.$store.state.lastValidFilters[this.element.id]?.length
if ((this.element.options.value || existLastValidFilters) && !this.selectFirst) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ export default {
initLoad() {
this.value = this.element.options.attrs.multiple ? [] : null
this.initOptions()
if (this.element.options.value) {
const existLastValidFilters = this.$store.state.lastValidFilters && this.$store.state.lastValidFilters[this.element.id]?.length
if (this.element.options.value || existLastValidFilters) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ export default {
this.value = this.fillValueDerfault()
this.data = []
this.initOptions()
if (this.element.options.value) {
const existLastValidFilters = this.$store.state.lastValidFilters && this.$store.state.lastValidFilters[this.element.id]?.length
if (this.element.options.value || existLastValidFilters) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
Expand Down

0 comments on commit 371cc8c

Please sign in to comment.