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