|
|
@@ -26,9 +26,8 @@
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<!-- 表格渲染 -->
|
|
|
- <el-table permsEdit="sys:dept:edit" height="720" permsDelete="sys:dept:delete" row-key="id"
|
|
|
- v-loading="loading" border :data="ztreeNodes" default-expand-all
|
|
|
- :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" :header-cell-style="{
|
|
|
+ <el-table permsEdit="sys:dept:edit" height="720" permsDelete="sys:dept:delete" row-key="id" v-loading="loading"
|
|
|
+ border :data="ztreeNodes" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" :header-cell-style="{
|
|
|
background: '#F2F7FC',
|
|
|
fontWeight: '900',
|
|
|
color: '#606266',
|
|
|
@@ -377,6 +376,7 @@ export default {
|
|
|
// }
|
|
|
|
|
|
this.findTreeData(); // 获取左边机构树数据
|
|
|
+ // this.generateUniqueKeys(this.ztreeNodes)
|
|
|
//获取所有下拉框数据
|
|
|
this.getDictItems("comlevel");
|
|
|
this.getDictItems("comattribute");
|
|
|
@@ -613,6 +613,15 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ generateUniqueKeys(nodes, parentKey = '') {
|
|
|
+ return nodes.map((node, index) => {
|
|
|
+ const key = `${parentKey}${node.id}-${index}`; // 结合父节点和当前索引生成一个唯一键
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
+ node.children = generateUniqueKeys(node.children, `${key}-`);
|
|
|
+ }
|
|
|
+ return { ...node, uniqueKey: key };
|
|
|
+ });
|
|
|
+ },
|
|
|
//关闭部门弹框
|
|
|
closeLeadDialog() {
|
|
|
this.leadDataForm = {
|
|
|
@@ -651,8 +660,8 @@ export default {
|
|
|
//点击每一行的事件
|
|
|
rowClick(row, treeNode) {
|
|
|
//点每行展开折叠
|
|
|
- if(row.expanded===undefined){
|
|
|
- row.expanded=false;
|
|
|
+ if (row.expanded === undefined) {
|
|
|
+ row.expanded = false;
|
|
|
}
|
|
|
row.expanded = !row.expanded;
|
|
|
this.$refs.expandTable.toggleRowExpansion(row, row.expanded);
|
|
|
@@ -855,6 +864,8 @@ export default {
|
|
|
this.ztreeRightWidth = 100 - (this.ztreeLeftWidth - 0);
|
|
|
},
|
|
|
findTreeData() {
|
|
|
+ this.ztreeNodes=[];
|
|
|
+
|
|
|
// 获取机构树的数据
|
|
|
this.loading = true;
|
|
|
this.$api.dept.findDeptTree(this.peopledeptid, "").then((res) => {
|
|
|
@@ -863,10 +874,15 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
managementSourceQuery() {
|
|
|
+ this.ztreeNodes=[];
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
this.$api.dept
|
|
|
.findDeptTree(this.peopledeptid, this.managementSource)
|
|
|
.then((res) => {
|
|
|
this.ztreeNodes = res.data;
|
|
|
+ this.loading = false;
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
// 右边表格Start
|