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

fix(记录规则): qmsReportWorkType类型错误问题,计划规则类型选择问题

liujt 6 месяцев назад
Родитель
Сommit
31a15bf91c

+ 4 - 4
src/components/selectRecordPlan/selectRecordPlan.vue

@@ -107,7 +107,7 @@
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 0) {
-                return row.executeUser.map((i) => i.groupName).join(',');
+                return row.executeUsers.map((i) => i.groupName).join(',');
               }
               return '';
             }
@@ -120,20 +120,20 @@
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 0) {
-                return row.executeUser.map((i) => i.userName).join(',');
+                return row.executeUsers.map((i) => i.userName).join(',');
               }
               return '';
             }
           },
           {
-            prop: 'executeUser',
+            prop: 'executeUsers',
             label: '班组',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 1) {
-                return row.executeUser.map((i) => i.teamName).join(',');
+                return row.executeUsers.map((i) => i.teamName).join(',');
               }
               return '';
             }

+ 132 - 19
src/views/rulesManagement/components/programRulesDialog.vue

@@ -35,29 +35,66 @@
             </div>
           </el-form-item>
         </el-col>
-        <el-col :span="8">
+        <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
           <el-form-item label="类型" prop="autoOrder">
-            <el-select v-model="addForm.type" size="small" @change="typeChange" style="width: 100%">
+            <el-select v-model="addForm.executeUserType" :disabled="isBindPlan" size="small" @change="typeChange" style="width: 100%">
               <el-option :value="1" label="班组"></el-option>
               <el-option :value="0" label="个人"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')">
+
+        <el-col :span="8" v-if="((addForm.autoOrder && (modelType == 'add' || modelType == 'edit')) || (!addForm.autoOrder && modelType == 'dispatch')) && addForm.executeUserType == 1 && !dialogTitle.includes('量具送检')">
+          <el-form-item label="班组" prop="teamId">
+            <el-select
+              v-model="addForm.teamId"
+              :disabled="isBindPlan"
+              size="small"
+              @change="teamChange"
+              style="width: 100%"
+            >
+              <el-option
+                :value="i.id"
+                :label="i.name"
+                v-for="i in teamAllList"
+                :key="i.id"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8" v-if="((addForm.autoOrder && (modelType == 'add' || modelType == 'edit')) || (!addForm.autoOrder && modelType == 'dispatch')) && addForm.executeUserType == 0 && !dialogTitle.includes('量具送检')">
           <el-form-item label="部门" prop="groupId">
             <deptSelect v-model="addForm.groupId" @changeGroup="searchDeptNodeClick" :disabled="isBindPlan" />
           </el-form-item>
         </el-col>
         <el-col :span="8" v-if="
-          addForm.autoOrder &&
-          !dialogTitle.includes('量具送检') &&
-          addForm.type == 0
+          ((addForm.autoOrder && (modelType == 'add' || modelType == 'edit')) || (!addForm.autoOrder && modelType == 'dispatch')) && addForm.executeUserType == 0 &&
+          !dialogTitle.includes('量具送检')
         ">
-          <el-form-item label="负责人" prop="executeIdList">
+          <!-- <el-form-item label="负责人" prop="executeIdList">
             <el-select v-model="addForm.executeIdList" size="small" style="width: 100%" :disabled="isBindPlan" multiple
               filterable>
               <el-option v-for="item in executorList" :key="item.id" :value="item.id" :label="item.name"></el-option>
             </el-select>
+          </el-form-item> -->
+          <el-form-item label="负责人" prop="executeIdList">
+            <el-select
+              v-model="addForm.executeIdList"
+              :disabled="isBindPlan"
+              size="small"
+              style="width: 100%"
+              multiple
+              filterable
+              @change="executeIdListChange"
+            >
+              <el-option
+                v-for="item in executorList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
@@ -277,6 +314,7 @@ import {
   bomTaskDelete,
   getByTaskId
 } from '@/api/material/BOM';
+import { getteampage } from '@/api/workforceManagement/team';
 
 import { getFile } from '@/api/system/file';
 import { deepClone } from 'ele-admin/lib/utils/core';
@@ -326,7 +364,7 @@ export default {
       addForm: {
         code: '', // 计划配置单号
         name: '', // 计划配置名称
-        type: 0, // 默认个人
+        executeUserType: 0, // 默认个人
         autoOrder: 1, // 自动派单
         ruleId: '', // 规则id
         ruleName: '', // 规则名称
@@ -377,9 +415,15 @@ export default {
         executeIdList: [
           { required: true, message: '请选择人员', trigger: 'change' }
         ],
+        teamId: [
+          { required: true, message: '请选择班组', trigger: 'change' }
+        ],
         urgent: [
           { required: true, message: '请选择紧急程度', trigger: 'change' }
-        ]
+        ],
+        executeUserType: [
+          { required: true, message: '请选择', trigger: 'change' }
+        ],
       },
 
       columns: [
@@ -470,7 +514,9 @@ export default {
       tabsValue: null,
 
       hasCategoryId:false,
-      getByIdData:{}
+      getByIdData:{},
+      modelType: '',
+      teamAllList: [],
     };
   },
   computed: {
@@ -498,13 +544,15 @@ export default {
     }
   },
   mounted() {
+    this.getAllTeamList();
     this.getUserList({groupId: "1"});
   },
   methods: {
     // 初始化
-    async init(row, tips) {
+    async init(type, row, tips) {
       console.log(row);
       console.log(tips);
+      this.modelType = type;
       if (row) {
         this.getInfo(row.id);
       } else {
@@ -514,7 +562,7 @@ export default {
           code: '', // 计划配置单号
           name: '', // 计划配置名称
           autoOrder: 1, // 自动派单
-          type: 0, // 默认个人
+          executeUserType: 0, // 默认个人
           ruleId: '', // 规则id
           ruleName: '', // 规则名称
           duration: null, // 计划完成时长
@@ -533,6 +581,30 @@ export default {
         //   this.matterRulesList = [];
       }
     },
+    async getAllTeamList() {
+      const { list } = await getteampage({
+        pageNum: 1,
+        size: -1
+      });
+      console.log('teamAllList 班组', list);
+      this.teamAllList = list;
+    },
+    teamChange() {
+      console.log('this.addForm.teamId', this.addForm.teamId);
+      // 当前班组
+      const currentTeam = this.teamAllList.find(
+        (item) => item.id === this.addForm.teamId
+      );
+      if (currentTeam) {
+        // 同步执行人
+        this.addForm.executeUsers = [
+          {
+            teamId: currentTeam.id,
+            teamName: currentTeam.name
+          }
+        ];
+      }
+    },
     typeChange() {
       this.addForm.groupId = '';
       this.addForm.executeIdList = [];
@@ -700,6 +772,33 @@ export default {
             ruleItems: item.ruleMatters
           };
         });
+
+        // 处理回显数据
+        if (this.addForm.executeUserType === 0) {
+          // 个人
+          this.addForm.executeIdList = this.addForm.executeUsers.map(
+            (item) => item.userId
+          );
+
+          let groupIds = this.addForm.executeUsers
+            .map((i) => i.groupId)
+            .filter((i) => i);
+          groupIds = Array.from(new Set(groupIds));
+
+          if (groupIds.includes('1')) {
+            // 包含全部部门,置空
+            this.addForm.groupId = '1';
+          } else {
+            this.addForm.groupId = this.addForm.executeUsers[0]?.groupId || '1';
+          }
+
+          groupIds.map((item) => {
+            this.searchDeptNodeClick(item);
+          });
+        } else {
+          // 班组
+          this.addForm.teamId = this.addForm.executeUsers[0]?.teamId || '';
+        }
         this.tabsValue = this.ruleIdList[0].ruleId;
         if (res.groupId) {
           const params = { groupId: res.groupId };
@@ -707,8 +806,8 @@ export default {
         }
         // this._getMatterRulesDetails(res.ruleId);
         this.$set(this.addForm, 'code', res.code);
-        this.$set(this.addForm, 'urgent', JSON.stringify(res.urgent));
-        this.$set(this.addForm, 'executeIdList', res.executeId.split(','));
+        this.$set(this.addForm, 'urgent', res.urgent+'');
+        // this.$set(this.addForm, 'executeIdList', res.executeId.split(','));
         this.$set(this.addForm, 'imageUrl', {});
         console.log(this.rootData);
         const rep = await getTreeByType(0);
@@ -777,15 +876,29 @@ export default {
         this.addForm.groupName = data.name;
         const params = { groupId: info };
         await this.getUserList(params);
-        if (this.addForm.type == 1) {
-          this.addForm.executeIdList = this.executorList.map(
-            (item) => item.id
-          );
-        }
+        // if (this.addForm.executeUserType == 1) {
+        //   this.addForm.executeIdList = this.executorList.map(
+        //     (item) => item.id
+        //   );
+        // }
       } else {
         this.addForm.groupId = null;
       }
     },
+    // 负责人变更 同步执行人列表
+      executeIdListChange() {
+        this.addForm.executeUsers = this.addForm.executeIdList.map((userId) => {
+          const user = this.executorList.find((u) => u.id === userId);
+          return {
+            userId: user.id,
+            userName: user.name,
+
+            groupId: user.groupId,
+            groupName: user.groupName
+          };
+        });
+        console.log('this.addForm.executeUsers', this.addForm.executeUsers);
+      },
     // 过滤计划完成时长
     formDataDurationTime(value) {
       if (value > 0) {

+ 4 - 4
src/views/rulesManagement/inspectionPoint/index.vue

@@ -19,7 +19,7 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="openEdit()"
+            @click="openEdit('add')"
             v-if="$hasPermission('eam:planconfig:save')"
           >
             新建
@@ -42,7 +42,7 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openEdit('edit', row)"
             v-if="$hasPermission('eam:planconfig:update')"
           >
             修改
@@ -272,7 +272,7 @@
         });
       },
 
-      openEdit(row) {
+      openEdit(type, row) {
         this.isBindPlan = false;
         this.addProgramRulesDialog = true;
         if (row) {
@@ -291,7 +291,7 @@
               : '新增检修配置';
         }
         this.$nextTick(() => {
-          this.$refs.programRulesDialog.init(
+          this.$refs.programRulesDialog.init(type, 
             row,
             this.ruleType == 1
               ? '巡点检'

+ 4 - 4
src/views/rulesManagement/maintenance/index.vue

@@ -19,7 +19,7 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="openEdit()"
+            @click="openEdit('add')"
             v-if="$hasPermission('eam:planconfig:save')"
           >
             新建
@@ -36,7 +36,7 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openEdit('edit', row)"
             v-if="$hasPermission('eam:planconfig:update')"
 
           >
@@ -236,7 +236,7 @@ export default {
       this.$refs.table.reload({ page: 1, where, ruleType: 2 });
     },
 
-    openEdit(row) {
+    openEdit(type,row) {
       this.isBindPlan = false;
       this.addProgramRulesDialog = true;
       if (row) {
@@ -245,7 +245,7 @@ export default {
         this.dialogTitle = '新增保养计划配置';
       }
       this.$nextTick(() => {
-        this.$refs.programRulesDialog.init(row, '保养');
+        this.$refs.programRulesDialog.init(type, row, '保养');
       });
     },
 

+ 4 - 4
src/views/rulesManagement/measuringSubmit/index.vue

@@ -19,7 +19,7 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="openEdit()"
+            @click="openEdit('add')"
             v-if="$hasPermission('eam:planconfig:save')"
           >
             新建
@@ -36,7 +36,7 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openEdit('edit', row)"
             v-if="$hasPermission('eam:planconfig:update')"
           >
             修改
@@ -236,7 +236,7 @@ export default {
       this.$refs.table.reload({ page: 1, where, ruleType: 1 });
     },
 
-    openEdit(row) {
+    openEdit(type, row) {
       this.isBindPlan = false;
       this.addProgramRulesDialog = true;
       if (row) {
@@ -245,7 +245,7 @@ export default {
         this.dialogTitle = '新增量具送检计划配置';
       }
       this.$nextTick(() => {
-        this.$refs.programRulesDialog.init(row, '量具送检');
+        this.$refs.programRulesDialog.init(type, row, '量具送检');
       });
     },
 

+ 9 - 9
src/views/rulesManagement/recordPlan/components/programRulesDialog.vue

@@ -603,7 +603,7 @@
         configType: 1,
         createUserName: '',
         duration: null,
-        executeUser: [
+        executeUsers: [
           // {
           //   groupId: 0,
           //   groupName: '',
@@ -881,11 +881,11 @@
         // 处理回显数据
         if (this.addForm.type === 0) {
           // 个人
-          this.addForm.executeIdList = this.addForm.executeUser.map(
+          this.addForm.executeIdList = this.addForm.executeUsers.map(
             (item) => item.userId
           );
 
-          let groupIds = this.addForm.executeUser
+          let groupIds = this.addForm.executeUsers
             .map((i) => i.groupId)
             .filter((i) => i);
           groupIds = Array.from(new Set(groupIds));
@@ -894,7 +894,7 @@
             // 包含全部部门,置空
             this.addForm.groupId = '1';
           } else {
-            this.addForm.groupId = this.addForm.executeUser[0]?.groupId || '1';
+            this.addForm.groupId = this.addForm.executeUsers[0]?.groupId || '1';
           }
 
           groupIds.map((item) => {
@@ -902,7 +902,7 @@
           });
         } else {
           // 班组
-          this.addForm.teamId = this.addForm.executeUser[0]?.teamId || '';
+          this.addForm.teamId = this.addForm.executeUsers[0]?.teamId || '';
         }
         this.tabsValue = this.addForm.children[0]?.ruleId || '';
 
@@ -933,7 +933,7 @@
           rule.configType = body.configType;
           rule.createUserName = body.createUserName;
           rule.duration = body.duration;
-          rule.executeUser = body.executeUser;
+          rule.executeUsers = body.executeUsers;
           rule.name = body.name;
           rule.nextExecuteTime = body.nextExecuteTime;
           rule.remark = body.remark;
@@ -1316,7 +1316,7 @@
       },
       // 负责人变更 同步执行人列表
       executeIdListChange() {
-        this.addForm.executeUser = this.addForm.executeIdList.map((userId) => {
+        this.addForm.executeUsers = this.addForm.executeIdList.map((userId) => {
           const user = this.executorList.find((u) => u.id === userId);
           return {
             userId: user.id,
@@ -1326,7 +1326,7 @@
             groupName: user.groupName
           };
         });
-        console.log('this.addForm.executeUser', this.addForm.executeUser);
+        console.log('this.addForm.executeUsers', this.addForm.executeUsers);
       },
       async getAllTeamList() {
         const { list } = await getteampage({
@@ -1344,7 +1344,7 @@
         );
         if (currentTeam) {
           // 同步执行人
-          this.addForm.executeUser = [
+          this.addForm.executeUsers = [
             {
               teamId: currentTeam.id,
               teamName: currentTeam.name

+ 4 - 4
src/views/rulesManagement/recordPlan/index.vue

@@ -118,7 +118,7 @@
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 0) {
-                return row.executeUser.map((i) => i.groupName).join(',');
+                return row.executeUsers.map((i) => i.groupName).join(',');
               }
               return '';
             }
@@ -131,20 +131,20 @@
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 0) {
-                return row.executeUser.map((i) => i.userName).join(',');
+                return row.executeUsers.map((i) => i.userName).join(',');
               }
               return '';
             }
           },
           {
-            prop: 'executeUser',
+            prop: 'executeUsers',
             label: '班组',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
             formatter: (row) => {
               if (row.type == 1) {
-                return row.executeUser.map((i) => i.teamName).join(',');
+                return row.executeUsers.map((i) => i.teamName).join(',');
               }
               return '';
             }

+ 1 - 1
src/views/rulesManagement/releaseRules/index.vue

@@ -415,7 +415,7 @@
         cacheKeyUrl: 'maindata-25922-recordrules-index',
         typeTree: [],
         treeNode: null,
-        qmsReportWorkType: ['5', '6', '7'],
+        qmsReportWorkType: [5, 6, 7],
       };
     },
     created() {