From caa1edffd99cdbb9d6e5b24bc214d406e181f551 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Wed, 9 Feb 2022 15:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=9C=A8=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E5=88=86=E5=90=8E=E9=9D=A2=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E5=B7=B2=E5=AF=BC=E5=85=A5=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Transaction.vue | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) 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)