forked from github/dataease
fix:条件组件值回显错误
This commit is contained in:
parent
d303ae90fe
commit
740922f982
@ -2,7 +2,7 @@
|
||||
|
||||
<el-input
|
||||
v-if="options!== null && options.attrs!==null"
|
||||
v-model="values"
|
||||
v-model="value"
|
||||
resize="vertical"
|
||||
:placeholder="$t(options.attrs.placeholder)"
|
||||
@keypress.enter.native="search"
|
||||
@ -31,22 +31,30 @@ export default {
|
||||
return {
|
||||
options: null,
|
||||
operator: 'like',
|
||||
values: null,
|
||||
value: null,
|
||||
canEdit: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.options = this.element.options
|
||||
if (this.inDraw && this.options.value && this.options.value.length > 0) {
|
||||
this.value = this.options.value[0]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
// this.options.value && this.setCondition()
|
||||
this.options.value = []
|
||||
if (this.inDraw && this.value) {
|
||||
this.options.value = [this.value]
|
||||
}
|
||||
|
||||
this.setCondition()
|
||||
},
|
||||
setCondition() {
|
||||
const param = {
|
||||
component: this.element,
|
||||
value: !this.values ? [] : Array.isArray(this.values) ? this.values : [this.values],
|
||||
value: !this.options.value ? [] : Array.isArray(this.options.value) ? this.options.value : [this.options.value],
|
||||
operator: this.operator
|
||||
}
|
||||
this.inDraw && this.$store.commit('addViewFilter', param)
|
||||
|
@ -66,6 +66,12 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.options = this.element.options
|
||||
if (this.inDraw && this.options.value && this.options.value.length > 0) {
|
||||
this.form.min = this.options.value[0]
|
||||
if (this.options.value.length > 1) {
|
||||
this.form.max = this.options.value[1]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
searchWithKey(index) {
|
||||
@ -134,6 +140,7 @@ export default {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.setCondition()
|
||||
this.styleChange()
|
||||
})
|
||||
@ -145,6 +152,8 @@ export default {
|
||||
value: [this.form.min, this.form.max],
|
||||
operator: this.operator
|
||||
}
|
||||
|
||||
this.inDraw && (this.options.value = param.value)
|
||||
if (this.form.min && this.form.max) {
|
||||
this.inDraw && this.$store.commit('addViewFilter', param)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user