Просмотр исходного кода

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dev

yusheng 3 месяцев назад
Родитель
Сommit
df328587ca

+ 12 - 0
src/api/system/organization/index.js

@@ -25,6 +25,18 @@ export async function getUserPage (params) {
   return Promise.reject(new Error(res.data.message));
 }
 
+/**
+ * 查询多个部门下的员工
+ * @param data 机构信息
+ */
+export async function getUserByGroupIds (data) {
+  const res = await request.post('/main/user/getUserByGroupIds', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 /**
  * 添加机构
  * @param data 机构信息

+ 6 - 5
src/views/batchRecord/components/programRulesDialog.vue

@@ -548,7 +548,7 @@
 <script>
   import dictMixins from '@/mixins/dictMixins';
   import tableColumnsMixin from '@/mixins/tableColumnsMixin';
-  import { getUserPage } from '@/api/system/organization';
+  import { getUserPage, getUserByGroupIds } from '@/api/system/organization';
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
   import { getCode } from '@/api/ruleManagement/matter';
   import selectReleaseRules from '@/components/selectReleaseRules/select-release-rules.vue';
@@ -882,7 +882,8 @@
             (item) => item.userId
           );
           this.addForm.groupId = this.addForm.executeUsers[0]?.groupId || '';
-          this.searchDeptNodeClick(this.addForm.groupId);
+          const groupIds = this.addForm.executeUsers?.map((i) => i.groupId).join(',');
+          this.searchDeptNodeClick(groupIds);
         } else {
           // 班组
           this.addForm.teamId = this.addForm.executeUsers[0]?.teamId || '';
@@ -985,11 +986,11 @@
           if (params) {
             data = Object.assign(data, params);
           }
-          const res = await getUserPage(data);
+          const res = await getUserByGroupIds(params.groupId.split(','));
           if (params) {
-            this.executorList = res.list;
+            this.executorList = res;
           } else {
-            this.uerList = res.list;
+            this.uerList = res;
           }
         } catch (error) {}
       },

+ 15 - 7
src/views/batchRecord/components/workOrderReport.vue

@@ -3,6 +3,7 @@
     :title="title"
     :visible.sync="visible"
     :close-on-click-modal="false"
+    destroy-on-close
     @close="handleClose"
     resizable
     maxable
@@ -343,7 +344,7 @@
   import toolModal from '@/views/batchRecord/components/toolModal.vue';
   import { producetaskrulerecordSaveOrUpdateAndSubmit } from '@/api/recordRules/index.js';
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
-  import { getUserPage } from '@/api/system/organization';
+  import { getUserPage, getUserByGroupIds } from '@/api/system/organization';
   import { getteampage } from '@/api/workforceManagement/team';
 
   export default {
@@ -432,6 +433,7 @@
         type: 'add',
         title: '报工',
         formBaseData,
+        defaultExecuteUsers: [],
         addForm: JSON.parse(JSON.stringify(formBaseData)),
         rules: {
           checkStartTime: [
@@ -613,6 +615,12 @@
       this.getAllTeamList();
     },
     methods: {
+      getDefaultExecuteUsers() {
+        let data = { pageNum: 1, size: -1 };
+        getUserPage(data).then(res => {
+          this.defaultExecuteUsers = res.list;
+        });
+      },
       // 外部调用,打开弹窗
       open(type = 'add', data) {
         this.type = type;
@@ -680,11 +688,11 @@
               this.addForm.groupId = '1';
             } else {
               this.addForm.groupId =
-                this.addForm.executeUsers[0]?.groupId + '' || '1';
+                this.addForm.executeUsers[0].groupId || '1';
             }
 
             if (this.addForm.groupId) {
-              this.searchDeptNodeClick(this.addForm.groupId);
+              this.searchDeptNodeClick(groupIds.join(','));
             }
           }
 
@@ -954,11 +962,11 @@
           if (params) {
             data = Object.assign(data, params);
           }
-          const res = await getUserPage(data);
+          const res = await getUserByGroupIds(params.groupId.split(','));
           if (params) {
-            this.executorList = res.list;
+            this.executorList = res;
           } else {
-            this.uerList = res.list;
+            this.uerList = res;
           }
         } catch (error) {}
       },
@@ -976,7 +984,7 @@
       executeIdListChange() {
         this.addForm.executeUsers = this.addForm.executeUsersIds
           .map((userId) => {
-            const user = this.executorList.find((u) => u.id === userId);
+            const user = this.defaultExecuteUsers.find((u) => u.id === userId);
             if (!user) return null;
             return {
               userId: user.id,