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