diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue index 2dfaa80..2da5360 100644 --- a/src/views/Transaction.vue +++ b/src/views/Transaction.vue @@ -360,7 +360,7 @@ export default { treeData: [], // 树结构数据 defaultProps: { children: "children", - label: "name" + label: "label" }, // 树结构配置项 defaultProp: { children: "children", @@ -685,6 +685,7 @@ export default { toTreeId(data, parentId) { // id重新串连成(父+子+孙),已便达到树节点需要的key唯一性,且后面提交数据,需要传这个id串到后台 let result = []; data.forEach(item => { + item.label = item.name if (item.isNode === 0) { item.showCheckbox = false; } else { @@ -812,13 +813,30 @@ export default { }); } }, + // 新增判分点 addRules(){ - this.configVisible = true; - let operationIds = [] - this.tableData.map((e, i) => { - e.operationIds && operationIds.push(e.operationIds) + this.configVisible = TextTrackCue + const ids = [] + const treeData = this.treeData + const list = this.tableData + list.map(e => { + e.operationIds && ids.push(e.operationIds) // 获取列表中已有的判分id }) - this.$refs.tree.setCheckedKeys([]); + // 列表中已有的判分,在新增判分树形里判分名后面加上已导入三个字 + const addSuffix = data => { + data.map(e => { + // 如果已存在,并且名称后面没加上标识 + if (ids.includes(e.operationIds) && !e.label.endsWith('(已导入)')) { + e.label += '(已导入)' + } else if (!ids.includes(e.operationIds) && e.label.endsWith('(已导入)')) { // 删除了的,要把标识去掉 + e.label = e.label.replace('(已导入)', '') + } else if (e.children && e.children.length) { // 未找到,并且有子级,则递归 + addSuffix(e.children) + } + }) + } + addSuffix(treeData) + this.$refs.tree.setCheckedKeys([]) }, addRule() { // 新增规则 this.changeArr.splice(0, this.changeArr.length)