Forráskód Böngészése

4.0.69 修改部门管理编辑时选择管理员bug

liuyanpeng 1 éve
szülő
commit
3caeeba2ca
2 módosított fájl, 45 hozzáadás és 16 törlés
  1. 1 1
      package.json
  2. 44 15
      src/client/OrganizationEditPanel.vue

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-base-v4",
   "description": "Leanwo Prodog Client",
-  "version": "4.0.67",
+  "version": "4.0.69",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",

+ 44 - 15
src/client/OrganizationEditPanel.vue

@@ -118,6 +118,7 @@
           show-search
           @search="fetchUser"
           @change="getOrgUsers"
+          @focus="focusUser('')"
         >
           <template v-if="fetching" #notFoundContent>
             <a-spin size="small" />
@@ -182,6 +183,7 @@
           show-search
           @search="fetchUser"
           @change="getClientUsers"
+          @focus="focusUser('')"
         >
           <template v-if="fetching" #notFoundContent>
             <a-spin size="small" />
@@ -195,6 +197,7 @@
       </a-button>
     </template>
   </a-drawer>
+  <Loading v-if="loading" />
 </template>
 
 <script setup>
@@ -238,10 +241,17 @@ const organizations = ref([]);
 const oldParentId = ref('');
 const oldParentName = ref('');
 const fetching = ref(false);
+const loading = ref(false);
 onMounted(() => {
   getComponyInfo();
 });
 
+const focusUser = value => {
+  userList.value = [];
+  fetching.value = true;
+  fetchUserList(value);
+};
+
 const fetchUser = Common.debounce(value => {
   userList.value = [];
   fetching.value = true;
@@ -285,21 +295,30 @@ const getALLClient = datas => {
 // 编辑公司(获取公司信息)
 const editClient = () => {
   if (clientNameStr.value) {
+    loading.value = true;
     isEditClient.value = true;
     getClientInfo(clientId.value).then(
       success => {
         if (success.errorCode == 0) {
-          fetchUserList();
           client.value = success.data;
           client.value.userIds = [];
-          success.data.managerUsers.forEach(user => {
-            client.value.userIds.push(user.id);
-          });
+          if (
+            success.data.managerUsers &&
+            success.data.managerUsers.length > 0
+          ) {
+            userList.value = [];
+            success.data.managerUsers.forEach(item =>{
+              userList.value.push({text:`${item.name}(${item.no})`,id:item.id});
+              client.value.userIds.push(item.id);
+            });
+          }
         } else {
           message.error(success.errorMessage);
         }
+        loading.value = false;
       },
       error => {
+        loading.value = false;
         Common.processException(error);
       },
     );
@@ -348,6 +367,7 @@ const createOrganization = () => {
 
 // 隐藏部门
 const hiddenDepartment = info => {
+  loading.value = true;
   $.ajax({
     url: Common.getApiURL('organizationResource/concealOrganization'),
     type: 'post',
@@ -359,10 +379,12 @@ const hiddenDepartment = info => {
     processData: false,
     success: function (data) {
       editVisible.value = false;
+      loading.value = false;
       message.success(`${info.name}隐藏成功。`);
       refreshData();
     },
     error: function (XMLHttpRequest, textStatus, errorThrown) {
+      loading.value = false;
       Common.processException(XMLHttpRequest, textStatus, errorThrown);
     },
   });
@@ -393,6 +415,7 @@ const refreshData = () => {
 };
 // 获取所有部门
 const getOrganization = () => {
+  loading.value = true;
   dataSource.value = [];
   const datas = [];
   const id = clientId.value;
@@ -405,9 +428,11 @@ const getOrganization = () => {
         traversalTree(datas.flat(1), dataSource.value);
         clientOrganizations(dataSource.value);
       }
+      loading.value = false;
       // loadAllSubClients();
     },
     err => {
+      loading.value = false;
       Common.processException(err);
     },
   );
@@ -437,24 +462,33 @@ const editOrganization = (flag, id) => {
       message.warning('请选择公司');
     }
   } else {
+    loading.value = true;
     editVisible.value = true;
     drawerTitle.value = '编辑部门';
     loadOrganization(id).then(
       success => {
-        organization.value = success.data;
-        organization.value.userIds = [];
         if (success.errorCode == 0) {
-          success.data.managerUsers.forEach(user => {
-            organization.value.userIds.push(user.id);
-          });
+          organization.value = success.data;
+          organization.value.userIds = [];
+          if (
+            success.data.managerUsers &&
+            success.data.managerUsers.length > 0
+          ) {
+            userList.value = [];
+            success.data.managerUsers.forEach(item =>{
+              userList.value.push({text:`${item.name}(${item.no})`,id:item.id});
+              organization.value.userIds.push(item.id);
+            });
+          }
           oldParentName.value = success.data.parentName;
           oldParentId.value = success.data.parentId;
-          fetchUserList();
         } else {
           message.error(success.errorMessage);
         }
+        loading.value = false;
       },
       err => {
+        loading.value = false;
         Common.processException(err);
       },
       (isCreate.value = false),
@@ -547,11 +581,6 @@ const fetchUserList = value => {
         successData.resultList.forEach(function (user) {
           if (user.no) {
             user.text = user.name + '(' + user.no + ')';
-            if (user.organizations && user.organizations.length > 0) {
-              user.organizations.forEach(item => {
-                user.text = user.text + '(' + item.organizationName + ')';
-              });
-            }
           } else {
             user.text = user.name;
           }