From e5454b769d44a34af423bf87ac8a740bf8c20341 Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期二, 29 四月 2025 13:25:29 +0800
Subject: [PATCH] Merge branch 'dev' into dev_tides

---
 src/views/system/user/index.vue |   66 ++++++++++++++++++--------------
 1 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 90909b3..0fb4722 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -28,14 +28,14 @@
                     @keyup.enter.native="handleQuery" />
                 </el-form-item>
                 <el-form-item label="鐘舵��" prop="status">
-                  <el-select v-model="queryParams.status" placeholder="鐢ㄦ埛鐘舵��" clearable>
+                  <el-select v-model="queryParams.status" placeholder="鐢ㄦ埛鐘舵��" clearable @change="handleQuery">
                     <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
                       :value="dict.value" />
                   </el-select>
                 </el-form-item>
                 <el-form-item>
-                  <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鏌� 璇�</el-button>
-                  <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲� 缃�</el-button>
+                  <el-button type="primary" size="mini" @click="handleQuery">鏌ヨ</el-button>
+                  <el-button size="mini" @click="resetQuery">閲嶇疆</el-button>
                 </el-form-item>
               </el-form>
             </div>
@@ -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