From c0056a276412154ae839b0af45756aef46722825 Mon Sep 17 00:00:00 2001 From: Yuanjianghong Date: Sat, 28 Aug 2021 17:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/project/ProjectUnitSelect.vue | 80 ++++++++++++++----------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/src/views/project/ProjectUnitSelect.vue b/src/views/project/ProjectUnitSelect.vue index 494a96f..795abd8 100644 --- a/src/views/project/ProjectUnitSelect.vue +++ b/src/views/project/ProjectUnitSelect.vue @@ -1,40 +1,46 @@ @@ -76,6 +82,7 @@ const treeData = [ const transferDataSource = [] function flatten(list = []) { + console.log('执行了flatten函数:list', list) list.forEach((item) => { transferDataSource.push(item) flatten(item.children) @@ -84,11 +91,12 @@ function flatten(list = []) { flatten(JSON.parse(JSON.stringify(treeData))) function isChecked(selectedKeys, eventKey) { + console.log('执行了isChecked函数:', eventKey, selectedKeys) return selectedKeys.indexOf(eventKey) !== -1 } function handleTreeData(data, targetKeys = []) { - console.log("执行了handleTreeData函数:",data,targetKeys) + console.log('执行了handleTreeData函数:', data, targetKeys) data.forEach((item) => { item['disabled'] = targetKeys.includes(item.key) if (item.children) { @@ -101,6 +109,7 @@ function handleTreeData(data, targetKeys = []) { export default { data() { return { + form: {}, targetKeys: [], dataSource: transferDataSource, @@ -123,6 +132,7 @@ export default { onChange(targetKeys) { console.log('Target Keys:', targetKeys) this.targetKeys = targetKeys + // this.form = targetKeys }, onChecked(_, e, checkedKeys, itemSelect) { const { eventKey } = e.node