forked from github/dataease
perf: 树形过滤器基本逻辑
This commit is contained in:
parent
f5241528ff
commit
a0fb3a62ad
@ -129,7 +129,7 @@ export default {
|
||||
method(param).then(res => {
|
||||
this.datas = this.optionDatas(res.data)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.deSelectTree.treeDataUpdateFun(this.datas)
|
||||
this.$refs.deSelectTree && this.$refs.deSelectTree.treeDataUpdateFun(this.datas)
|
||||
})
|
||||
}) || (this.element.options.value = '')
|
||||
},
|
||||
@ -191,7 +191,7 @@ export default {
|
||||
method({ fieldIds: this.element.options.attrs.fieldId.split(',') }).then(res => {
|
||||
this.datas = this.optionDatas(res.data)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.deSelectTree.treeDataUpdateFun(this.datas)
|
||||
this.$refs.deSelectTree && this.$refs.deSelectTree.treeDataUpdateFun(this.datas)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -231,7 +231,8 @@ export default {
|
||||
const param = {
|
||||
component: this.element,
|
||||
value: this.formatFilterValue(),
|
||||
operator: this.operator
|
||||
operator: this.operator,
|
||||
isTree: true
|
||||
}
|
||||
this.inDraw && this.$store.commit('addViewFilter', param)
|
||||
},
|
||||
|
@ -5,11 +5,12 @@
|
||||
* viewIds 过滤视图范围
|
||||
*/
|
||||
export class Condition {
|
||||
constructor(componentId, fieldId, operator, value, viewIds) {
|
||||
constructor(componentId, fieldId, operator, value, viewIds, isTree) {
|
||||
this.componentId = componentId
|
||||
this.fieldId = fieldId
|
||||
this.operator = operator || 'eq'
|
||||
this.value = value
|
||||
this.viewIds = viewIds
|
||||
this.isTree = isTree || false
|
||||
}
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ export const valueValid = condition => {
|
||||
}
|
||||
|
||||
export const formatCondition = obj => {
|
||||
const { component, value, operator } = obj
|
||||
const { component, value, operator, isTree } = obj
|
||||
const fieldId = component.options.attrs.fieldId
|
||||
const viewIds = component.options.attrs.viewIds
|
||||
const condition = new Condition(component.id, fieldId, operator, value, viewIds)
|
||||
const condition = new Condition(component.id, fieldId, operator, value, viewIds, isTree)
|
||||
return condition
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user