From 7416c05b25af0dd89f84de823073113f80993796 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 01 四月 2025 17:50:12 +0800
Subject: [PATCH] 人员获取第三方人员-页面bug修改
---
src/views/system/user/index.vue | 60 +++++++++++++++++-------------
src/api/system/user.js | 2
2 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/src/api/system/user.js b/src/api/system/user.js
index 752aa45..ad8d3ce 100644
--- a/src/api/system/user.js
+++ b/src/api/system/user.js
@@ -155,7 +155,7 @@
return request({
url: "/companies/addPersonUser",
method: "post",
- params: data,
+ data: data,
});
}
// 鑾峰彇瑙掕壊
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index e5e11ee..0fb4722 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -213,7 +213,7 @@
<el-col :span="8" style="height: 70vh;overflow: hidden;" v-if="companiesList.length != 1">
<el-input v-model="search2" placeholder="杈撳叆鍏抽敭瀛楁悳绱�" clearable size="small" @clear="searchFilter2"
@keyup.enter.native="searchFilter2" prefix-icon="el-icon-search" style="margin-bottom: 20px;width: 90%" />
- <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps" @node-click="nodeClick2"
+ <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps1" @node-click="nodeClick2"
style="height: calc(100% - 42px);" @node-expand="nodeOpen0" :filter-node-method="filterNode2" ref="tree2"
highlight-current>
</el-tree>
@@ -231,7 +231,7 @@
</el-table-column>
<el-table-column prop="employeeID" label="鍛樺伐鍙�">
</el-table-column>
- <el-table-column prop="nickName" label="鍛樺伐濮撳悕">
+ <el-table-column prop="name" label="鍛樺伐濮撳悕">
</el-table-column>
<el-table-column prop="department" label="閮ㄩ棬" min-width="200">
</el-table-column>
@@ -294,6 +294,7 @@
return {
// 閬僵灞�
loading: true,
+ multipleSelection: [],
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -329,6 +330,10 @@
defaultProps: {
children: "children",
label: "label"
+ },
+ defaultProps1: {
+ children: "children",
+ label: "companyName"
},
// 鐢ㄦ埛瀵煎叆鍙傛暟
upload: {
@@ -542,6 +547,7 @@
},
// 澶氶�夋閫変腑鏁版嵁
handleSelectionChange(selection) {
+ this.multipleSelection = selection;
this.ids = selection.map(item => item.userId);
this.single = selection.length != 1;
this.multiple = !selection.length;
@@ -560,30 +566,31 @@
}
},
// 鑾峰彇涓夋柟浜哄憳
- openthirdParty() {
- this.addthirdParty = true;
- this.thirdPartyLoading = true;
- selectCompaniesList().then(res => {
- this.companiesList = this.HaveJson(res.data);
- if (this.companiesList.length == 1) {
- selectSimpleList({ companyId: this.companiesList[0].companyId }).then(res => {
- this.thirdPartyLoading = false;
- this.personListCopy = JSON.parse(JSON.stringify(res.data))
- this.personList = res.data
- this.$refs.personTable.doLayout()
- })
- } else {
- this.thirdPartyLoading = false;
+ async openthirdParty() {
+ try {
+ this.addthirdParty = true;
+ this.thirdPartyLoading = true;
+
+ const companiesResponse = await selectCompaniesList();
+ this.companiesList = this.HaveJson(companiesResponse.data);
+
+ if (this.companiesList.length === 1) {
+ const personResponse = await selectSimpleList({ companyId: this.companiesList[0].companyId });
+ this.personListCopy = JSON.parse(JSON.stringify(personResponse.data));
+ this.personList = personResponse.data;
+ this.$refs.personTable.doLayout();
}
- this.datathirdParty = this.tranListToTreeData(res.data, "ROOT");
- }).catch(() => {
+
+ this.datathirdParty = this.tranListToTreeData(this.companiesList, "ROOT");
+ console.log(' this.datathirdParty---', this.datathirdParty)
+ } catch (error) {
+ console.error("Error fetching third party data:", error);
+ } finally {
this.thirdPartyLoading = false;
- })
- if (this.componentData.entity.roleId > 10000) this.$message.warning('鐢变簬鏈�変腑鍏蜂綋瑙掕壊锛屾柊澧炵敤鎴峰皢鎴愪负榛樿瑙掕壊')
+ }
},
tranListToTreeData(list, rootValue) {
- const arr = [];
- list.forEach((item) => {
+ return list.reduce((arr, item) => {
if (item.parentCompanyId === rootValue) {
const children = this.tranListToTreeData(list, item.companyId);
if (children.length) {
@@ -591,8 +598,8 @@
}
arr.push(item);
}
- });
- return arr;
+ return arr;
+ }, []);
},
searchPerson() {
let arr = JSON.parse(JSON.stringify(this.personListCopy))
@@ -624,7 +631,7 @@
}
},
nodeOpen0(data, node, el) {
- this.currentCompaniesList[node.level - nodeOpen01] = data.id
+ // this.currentCompaniesList[node.level - nodeOpen01] = data.id
},
filterNode2(value, data) {
if (!value) return true;
@@ -652,12 +659,13 @@
addPersonUser({
company: arr,
person: this.multipleSelection,
- roleId: this.componentData.entity.roleId
+ // roleId: this.componentData.entity.roleId
}).then(res => {
this.$message.success('鎿嶄綔鎴愬姛')
this.multipleSelection = []
this.$refs.personTable.clearSelection()
this.addLoad = false
+ this.addthirdParty = false
this.userSearch2 = ''
this.getList()
}).catch(e => {
--
Gitblit v1.9.3