提交 a0fb3a62 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

perf: 树形过滤器基本逻辑

上级 f5241528
......@@ -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
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论