forked from github/dataease
fix: 过滤组件选择字段显示不准确
This commit is contained in:
parent
0b1066b7eb
commit
d2564a8c43
@ -90,7 +90,7 @@ export default {
|
|||||||
this.changeValue(value)
|
this.changeValue(value)
|
||||||
},
|
},
|
||||||
'element.options.attrs.fieldId': function(value, old) {
|
'element.options.attrs.fieldId': function(value, old) {
|
||||||
if (typeof value === 'undefined' || value === old) return
|
if (value === null || typeof value === 'undefined' || value === old) return
|
||||||
this.datas = []
|
this.datas = []
|
||||||
|
|
||||||
let method = multFieldValues
|
let method = multFieldValues
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
>
|
>
|
||||||
<transition-group>
|
<transition-group>
|
||||||
<div
|
<div
|
||||||
v-for="item in fieldDatas.filter(item => !keyWord || (item.name && item.name.toLocaleLowerCase().includes(keyWord)))"
|
v-for="item in fieldDatas"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:class="myAttrs && myAttrs.fieldId && myAttrs.fieldId.includes(item.id) ? 'filter-db-row-checked' : 'filter-db-row'"
|
:class="myAttrs && myAttrs.fieldId && myAttrs.fieldId.includes(item.id) ? 'filter-db-row-checked' : 'filter-db-row'"
|
||||||
class="filter-db-row"
|
class="filter-db-row"
|
||||||
@ -140,7 +140,7 @@
|
|||||||
>
|
>
|
||||||
<transition-group>
|
<transition-group>
|
||||||
<div
|
<div
|
||||||
v-for="item in comFieldDatas.filter(item => !viewKeyWord || item.name.toLocaleLowerCase().includes(viewKeyWord))"
|
v-for="item in comFieldDatas"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:class="myAttrs && myAttrs.fieldId && myAttrs.fieldId.includes(item.id) ? 'filter-db-row-checked' : 'filter-db-row'"
|
:class="myAttrs && myAttrs.fieldId && myAttrs.fieldId.includes(item.id) ? 'filter-db-row-checked' : 'filter-db-row'"
|
||||||
class="filter-db-row"
|
class="filter-db-row"
|
||||||
@ -237,7 +237,9 @@ export default {
|
|||||||
sceneDatas: [],
|
sceneDatas: [],
|
||||||
// viewDatas: [],
|
// viewDatas: [],
|
||||||
fieldDatas: [],
|
fieldDatas: [],
|
||||||
|
originFieldDatas: [],
|
||||||
comFieldDatas: [],
|
comFieldDatas: [],
|
||||||
|
originComFieldDatas: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
label: 'name',
|
label: 'name',
|
||||||
children: 'children',
|
children: 'children',
|
||||||
@ -298,6 +300,11 @@ export default {
|
|||||||
keyWord(val) {
|
keyWord(val) {
|
||||||
this.expandedArray = []
|
this.expandedArray = []
|
||||||
if (this.showDomType === 'field') {
|
if (this.showDomType === 'field') {
|
||||||
|
let results = this.originFieldDatas
|
||||||
|
if (val) {
|
||||||
|
results = this.originFieldDatas.filter(item => item.name.toLocaleLowerCase().includes(val))
|
||||||
|
}
|
||||||
|
this.fieldDatas = JSON.parse(JSON.stringify(results))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
@ -306,6 +313,16 @@ export default {
|
|||||||
this.timer = setTimeout(() => {
|
this.timer = setTimeout(() => {
|
||||||
this.getTreeData(val)
|
this.getTreeData(val)
|
||||||
}, (val && val !== '') ? 1000 : 0)
|
}, (val && val !== '') ? 1000 : 0)
|
||||||
|
},
|
||||||
|
|
||||||
|
viewKeyWord(val) {
|
||||||
|
if (this.comShowDomType === 'field') {
|
||||||
|
let results = this.originComFieldDatas
|
||||||
|
if (val) {
|
||||||
|
results = this.originComFieldDatas.filter(item => item.name.toLocaleLowerCase().includes(val))
|
||||||
|
}
|
||||||
|
this.comFieldDatas = JSON.parse(JSON.stringify(results))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -512,7 +529,8 @@ export default {
|
|||||||
if (this.widget && this.widget.filterFieldMethod) {
|
if (this.widget && this.widget.filterFieldMethod) {
|
||||||
datas = this.widget.filterFieldMethod(datas)
|
datas = this.widget.filterFieldMethod(datas)
|
||||||
}
|
}
|
||||||
this.fieldDatas = datas
|
this.originFieldDatas = datas
|
||||||
|
this.fieldDatas = JSON.parse(JSON.stringify(datas))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
comLoadField(tableId) {
|
comLoadField(tableId) {
|
||||||
@ -521,7 +539,8 @@ export default {
|
|||||||
if (this.widget && this.widget.filterFieldMethod) {
|
if (this.widget && this.widget.filterFieldMethod) {
|
||||||
datas = this.widget.filterFieldMethod(datas)
|
datas = this.widget.filterFieldMethod(datas)
|
||||||
}
|
}
|
||||||
this.comFieldDatas = datas
|
this.originComFieldDatas = datas
|
||||||
|
this.comFieldDatas = JSON.parse(JSON.stringify(datas))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
showFieldDatas(row) {
|
showFieldDatas(row) {
|
||||||
|
Loading…
Reference in New Issue
Block a user