From f7e6a0554bcb58ca5792ffd344f0387f337a7803 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 01 三月 2024 09:08:47 +0800
Subject: [PATCH] 整理
---
admin/src/components/common/Tree.vue | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/admin/src/components/common/Tree.vue b/admin/src/components/common/Tree.vue
index 47b7e6a..6a6275a 100644
--- a/admin/src/components/common/Tree.vue
+++ b/admin/src/components/common/Tree.vue
@@ -18,13 +18,14 @@
<div class="tree">
<div v-for="(item, index) in list" :key="index" @click.stop="clickIten(item)">
<div class="tree_item">
- <i class="el-icon-caret-bottom" :class="{ 'activeColor': item.status }" v-show="item.status === 1 && item.companyDTOList.length > 0"></i>
- <i class="el-icon-caret-right color" v-show="item.companyDTOList.length > 0 && item.status === 0"></i>
- <div class="tree_item_label long-title-style" :title="item.name" :class="{ 'activeColor': item.status === 1 && item.companyDTOList.length === 0 }">{{ item.name }}</div>
+ <i class="el-icon-caret-bottom" :class="{ 'activeColor': item.fsStatus === 1 }" v-show="item.fsStatus === 1 && item.childList.length > 0"></i>
+ <i class="el-icon-caret-right color" v-show="item.childList.length > 0 && (item.fsStatus === 0 || !item.fsStatus)"></i>
+ <div class="tree_item_label long-title-style" :title="item.name" :class="{ 'activeColor': item.fsDate === 1 && item.childList.length === 0 }">{{ item.name }}</div>
</div>
- <div class="tree_childern" v-show="item.status === 1">
+<!-- v-show="item.status === 1"-->
+ <div class="tree_childern" v-show="item.fsStatus === 1">
<tree
- :list="item.companyDTOList"
+ :list="item.childList"
:defaultProps="defaultProps"
@callback="callback"
/>
@@ -51,7 +52,7 @@
name: 'name',
status: 'status',
children: 'children',
- id: 'id'
+ id: 'erpId'
}
}
}
@@ -68,7 +69,10 @@
// 鐐瑰嚮褰撳墠椤�
clickIten (item) {
this.recursion(this.list)
- item.status === 0 ? item.status = 1 : item.status = 0
+ item.fsDate === 0 || !item.fsDate ? item.fsDate = 1 : item.fsDate = 0
+ if (item.childList.length > 0) {
+ item.fsStatus === 0 || !item.fsStatus ? item.fsStatus = 1 : item.fsStatus = 0
+ }
// item[this.defaultProps.status] = !item[this.defaultProps.status]
// this.list.forEach(subItem => {
// if ((subItem[this.defaultProps.id] !== item[this.defaultProps.id] && subItem[this.defaultProps.status]) || (this.list.length === 1 && subItem[this.defaultProps.status] === false)) {
@@ -87,7 +91,6 @@
// this.tempItem.id = item[this.defaultProps.id]
// this.tempItem.name = item[this.defaultProps.name]
// }
-
this.$emit('callback', item)
},
// 閫掑綊鏂规硶
@@ -99,20 +102,22 @@
// }
// })
children.forEach(item => {
- item.status = 0
- if (item.companyDTOList.length > 0) {
- this.recursion(item.companyDTOList)
+ item.fsDate = 0
+ if (item.childList.length > 0) {
+ this.recursion(item.childList)
}
})
},
callback (data, item) {
+ console.log('data', data)
+ console.log('item', item)
if (this.tempItem.id === data.id) {
this.tempItem = {}
} else {
- this.tempItem.id = data.id
+ this.tempItem.id = data.erpId
this.tempItem.name = data.name
}
- this.$emit('callback', this.tempItem, item)
+ this.$emit('callback', data, item)
}
}
}
--
Gitblit v1.9.3