fix: 修复高级搜索时间控件不能正确重置的bug

This commit is contained in:
q4speed 2020-07-15 13:40:36 +08:00
parent dfde0171dd
commit 323b341113
2 changed files with 18 additions and 14 deletions

View File

@ -22,23 +22,25 @@
name: "MsTableSearchDatePicker",
components: {MsTableSearchComponent},
props: ['component'],
data() {
return {
type: "daterange"
}
},
methods: {
change(value) {
if (value === OPERATORS.BETWEEN.value) {
if (!Array.isArray(this.component.value)) {
this.component.value = [];
}
this.type = "daterange";
} else {
if (Array.isArray(this.component.value)) {
this.component.value = "";
}
this.type = "date";
}
}
},
computed: {
type() {
if (this.component.operator.value === OPERATORS.BETWEEN.value) {
return "daterange";
} else {
return "date";
}
}
}

View File

@ -21,23 +21,25 @@
name: "MsTableSearchDateTimePicker",
components: {MsTableSearchComponent},
props: ['component'],
data() {
return {
type: "datetimerange"
}
},
methods: {
change(value) {
if (value === OPERATORS.BETWEEN.value) {
if (!Array.isArray(this.component.value)) {
this.component.value = [];
}
this.type = "datetimerange";
} else {
if (Array.isArray(this.component.value)) {
this.component.value = "";
}
this.type = "datetime";
}
}
},
computed: {
type() {
if (this.component.operator.value === OPERATORS.BETWEEN.value) {
return "datetimerange";
} else {
return "datetime";
}
}
}