فهرست منبع

fix: 统一执行人字段名从executeUser改为executeUsers并修复相关逻辑

liujt 6 ماه پیش
والد
کامیت
d674bfb0ec

+ 4 - 4
src/views/batchRecord/components/plan.vue

@@ -147,7 +147,7 @@
               if (row.type == 0) {
                 return [
                   ...new Set(
-                    (row.executeUser || [])
+                    (row.executeUsers || [])
                       .map((i) => i.groupName)
                       .filter((i) => i)
                   )
@@ -164,20 +164,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 '';
             }

+ 15 - 10
src/views/batchRecord/components/programRulesDialog.vue

@@ -84,7 +84,8 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="((addForm.autoOrder && addForm.status == 4) || (!addForm.autoOrder && addForm.status == 0)) && addForm.type == 1">
+        
+        <el-col :span="8" v-if="((addForm.autoOrder && (type == 'add' || type == 'edit' || type == 'detail')) || (!addForm.autoOrder && type == 'dispatch')) && addForm.type == 1">
           <el-form-item label="班组" prop="teamId">
             <el-select
               v-model="addForm.teamId"
@@ -101,7 +102,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="((addForm.autoOrder && addForm.status == 4) || (!addForm.autoOrder && addForm.status == 0)) && addForm.type == 0">
+        <el-col :span="8" v-if="((addForm.autoOrder && (type == 'add' || type == 'edit' || type == 'detail')) || (!addForm.autoOrder && type == 'dispatch')) && addForm.type == 0">
           <el-form-item label="部门" prop="groupId">
             <deptSelect
               v-model="addForm.groupId"
@@ -109,7 +110,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="((addForm.autoOrder && addForm.status == 4) || (!addForm.autoOrder && addForm.status == 0)) && addForm.type == 0">
+        <el-col :span="8" v-if="((addForm.autoOrder && (type == 'add' || type == 'edit' || type == 'detail')) || (!addForm.autoOrder && type == 'dispatch')) && addForm.type == 0">
           <el-form-item label="负责人" prop="executeIdList">
             <el-select
               v-model="addForm.executeIdList"
@@ -581,7 +582,7 @@
         createUserName: '',
         details: [],
         duration: null,
-        executeUser: [],
+        executeUsers: [],
         factoryId: null,
         factoryName: '',
         id: null,
@@ -872,14 +873,14 @@
         // 处理回显数据
         if (this.addForm.type === 0) {
           // 个人
-          this.addForm.executeIdList = this.addForm.executeUser.map(
+          this.addForm.executeIdList = this.addForm.executeUsers.map(
             (item) => item.userId
           );
-          this.addForm.groupId = this.addForm.executeUser[0]?.groupId || '';
+          this.addForm.groupId = this.addForm.executeUsers[0]?.groupId || '';
           this.searchDeptNodeClick(this.addForm.groupId);
         } else {
           // 班组
-          this.addForm.teamId = this.addForm.executeUser[0]?.teamId || '';
+          this.addForm.teamId = this.addForm.executeUsers[0]?.teamId || '';
         }
 
         // if (this.type === 'dispatch') {
@@ -1212,7 +1213,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,
@@ -1221,7 +1222,11 @@
             groupName: user.groupName
           };
         });
-        console.log('this.addForm.executeUser', this.addForm.executeUser);
+        console.log('this.addForm.executeUsers', this.addForm.executeUsers);
+      },
+      typeChange() {
+        this.addForm.groupId = '';
+        this.addForm.executeIdList = [];
       },
       async getAllTeamList() {
         const { list } = await getteampage({
@@ -1239,7 +1244,7 @@
         );
         if (currentTeam) {
           // 同步执行人
-          this.addForm.executeUser = [
+          this.addForm.executeUsers = [
             {
               teamId: currentTeam.id,
               teamName: currentTeam.name

+ 7 - 7
src/views/batchRecord/components/redeployOther.vue

@@ -188,7 +188,7 @@
         selection: [],
         teamAllList: [],
         teamId: '',
-        executeUser: []
+        executeUsers: []
       };
     },
     created() {
@@ -282,10 +282,10 @@
           return this.$message.warning('请选择班组');
         }
 
-        let executeUser = null;
+        let executeUsers = null;
 
         if (this.tabValue == '0') {
-          executeUser = this.selection.map((i) => {
+          executeUsers = this.selection.map((i) => {
             return {
               groupId: i.groupId,
               groupName: i.groupName,
@@ -294,13 +294,13 @@
             };
           });
         } else {
-          executeUser = this.executeUser;
+          executeUsers = this.executeUsers;
         }
 
         this.btnLoading = true;
 
         let params = {
-          executeUser,
+          executeUsers,
           id: this.row.planId,
           // 0个人 1班组
           type: this.tabValue
@@ -325,7 +325,7 @@
         this.selectedRow = {};
         this.selectedRowData = [];
         this.selection = [];
-        this.executeUser = [];
+        this.executeUsers = [];
         this.visible = false;
       },
       async getAllTeamList() {
@@ -344,7 +344,7 @@
         );
         if (currentTeam) {
           // 同步执行人
-          this.executeUser = [
+          this.executeUsers = [
             {
               teamId: currentTeam.id,
               teamName: currentTeam.name

+ 1 - 1
src/views/batchRecord/components/workOrder.vue

@@ -134,7 +134,7 @@
             }
           },
           {
-            prop: 'executeUser',
+            prop: 'executeUsers',
             label: '班组',
             align: 'center',
             showOverflowTooltip: true,

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

@@ -173,6 +173,18 @@
             </el-input>
           </el-form-item>
         </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="车间" prop="workshopAreaName">
+            <el-input
+              placeholder=""
+              v-model="addForm.workshopAreaName"
+              disabled
+            >
+            </el-input>
+          </el-form-item>
+        </el-col>
+
         <el-col :span="8">
           <el-form-item label="结论" required prop="conclusion">
             <el-radio-group v-model="addForm.conclusion">
@@ -640,7 +652,8 @@
             }
             return i;
           });
-          this.$util.assignObject(this.addForm, data);
+          // this.$util.assignObject(this.addForm, data);
+          Object.assign(this.addForm, data);
           console.log('this.addForm', this.addForm);
 
           // 处理数据
@@ -996,7 +1009,7 @@
         );
         if (currentTeam) {
           // 同步执行人
-          this.addForm.executeUser = [
+          this.addForm.executeUsers = [
             {
               teamId: currentTeam.id,
               teamName: currentTeam.name

+ 144 - 8
src/views/produce/components/prenatalExamination/components/workOrder/programRulesDialog.vue

@@ -64,9 +64,36 @@
           </el-form-item>
         </el-col>
 
+        <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
+          <el-form-item label="类型" prop="type">
+            <el-select v-model="addForm.type" 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 && addForm.type == 1 && !dialogTitle.includes('量具送检')">
+          <el-form-item label="班组" prop="teamId">
+            <el-select
+              v-model="addForm.teamId"
+              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 && !dialogTitle.includes('量具送检')"
+          v-if="!addForm.autoOrder && addForm.type == 0 && !dialogTitle.includes('量具送检')"
         >
           <el-form-item label="部门" prop="groupId">
             <deptSelect
@@ -78,9 +105,9 @@
         </el-col>
         <el-col
           :span="8"
-          v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')"
+          v-if="!addForm.autoOrder && addForm.type == 0 && !dialogTitle.includes('量具送检')"
         >
-          <el-form-item label="负责人" prop="executorId">
+          <!-- <el-form-item label="负责人" prop="executorId">
             <el-select
               v-model="addForm.executorId"
               size="small"
@@ -96,6 +123,24 @@
                 :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('量具送检')">
@@ -423,6 +468,7 @@
   import { getById } from '@/api/maintenance/patrol_maintenance';
   import { getFile } from '@/api/system/file';
   import { deepClone } from 'ele-admin/lib/utils/core';
+  import { getteampage } from '@/api/workforceManagement/team';
 
   export default {
     components: {
@@ -486,7 +532,10 @@
           executorPhone: '',
           status: 1, // 状态
           remark: '', // 备注
-          urgent: '1'
+          urgent: '1',
+          executeIdList: [], // 负责人id
+          teamId: '', // 班组id
+          type: 0,
         },
         ruleNameList: [], // 规则列表
         uerList: [], // 审核人列表
@@ -527,6 +576,15 @@
           ],
           urgent: [
             { required: true, message: '请选择紧急程度', trigger: 'change' }
+          ],
+          executeIdList: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          teamId: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          type: [
+            { required: true, message: '请选择', trigger: 'change' }
           ]
         },
 
@@ -618,7 +676,8 @@
         tabsValue: null,
 
         hasCategoryId: false,
-        getByIdData: {}
+        getByIdData: {},
+        teamAllList: [],
       };
     },
     computed: {
@@ -635,10 +694,19 @@
           // 获取规则名称
           this._getRuleNameList();
         }
+      },
+      info: {
+        handler(newVal) {
+          if (newVal) {
+            this.init({ id: this.planId });
+          }
+        },
+        deep: true
       }
     },
     created() {
       console.log('触发');
+      this.getAllTeamList();
       this.init({ id: this.planId });
     },
     methods: {
@@ -700,6 +768,47 @@
         // };
         // this.addForm.planType = planRuleTypeObj[this.formLabel];
       },
+      // 负责人变更 同步执行人列表
+      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);
+      },
+      typeChange() {
+        this.addForm.groupId = '';
+        this.addForm.executeIdList = [];
+      },
+      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
+            }
+          ];
+        }
+      },
       autoOrderChange(val) {
         if (val == 0) {
           this.addForm.executorId = [];
@@ -831,9 +940,9 @@
           this.addForm = res.data;
 
           this.addForm.id = res.data.planId;
-          if (this.dialogTitle === '派单') {
-            this.addForm.autoOrder = 1;
-          }
+          // if (this.dialogTitle === '派单') {
+          //   this.addForm.autoOrder = 1;
+          // }
           this.isBindPlan = res.isBindPlan;
           // this.categoryEquipment(res.categoryLevelId);
           this.ruleIdList = [
@@ -860,6 +969,33 @@
             }
           ];
           console.log(this.ruleIdList);
+
+          // 处理回显数据
+          if (this.addForm.type === 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;
 
           // this._getMatterRulesDetails(res.ruleId);

+ 10 - 10
src/views/produce/components/prenatalExamination/components/workOrder/programRulesEventDialog.vue

@@ -75,7 +75,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="addForm.autoOrder && addForm.type == 1">
+        <el-col :span="8" v-if="!addForm.autoOrder && addForm.type == 1">
           <el-form-item label="班组" prop="teamId">
             <el-select
               v-model="addForm.teamId"
@@ -92,7 +92,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="addForm.autoOrder && addForm.type == 0">
+        <el-col :span="8" v-if="!addForm.autoOrder && addForm.type == 0">
           <el-form-item label="部门" prop="groupId">
             <deptSelect
               v-model="addForm.groupId"
@@ -100,7 +100,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="addForm.autoOrder && addForm.type == 0">
+        <el-col :span="8" v-if="!addForm.autoOrder && addForm.type == 0">
           <el-form-item label="负责人" prop="executeIdList">
             <el-select
               v-model="addForm.executeIdList"
@@ -597,7 +597,7 @@
         createUserName: '',
         details: [],
         duration: null,
-        executeUser: [],
+        executeUsers: [],
         factoryId: null,
         factoryName: '',
         id: null,
@@ -903,14 +903,14 @@
         // 处理回显数据
         if (this.addForm.type === 0) {
           // 个人
-          this.addForm.executeIdList = this.addForm.executeUser.map(
+          this.addForm.executeIdList = this.addForm.executeUsers.map(
             (item) => item.userId
           );
-          this.addForm.groupId = this.addForm.executeUser[0]?.groupId || '';
+          this.addForm.groupId = this.addForm.executeUsers?.[0]?.groupId || '';
           this.searchDeptNodeClick(this.addForm.groupId);
         } else {
           // 班组
-          this.addForm.teamId = this.addForm.executeUser[0]?.teamId || '';
+          this.addForm.teamId = this.addForm.executeUsers?.[0]?.teamId || '';
         }
 
         // if (this.type === 'dispatch') {
@@ -1245,7 +1245,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,
@@ -1254,7 +1254,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({
@@ -1272,7 +1272,7 @@
         );
         if (currentTeam) {
           // 同步执行人
-          this.addForm.executeUser = [
+          this.addForm.executeUsers = [
             {
               teamId: currentTeam.id,
               teamName: currentTeam.name

+ 40 - 27
src/views/produce/components/prenatalExamination/components/workOrder/workOrderEvent.vue

@@ -164,6 +164,16 @@
             </el-input>
           </el-form-item>
         </el-col>
+        <el-col :span="8">
+          <el-form-item label="车间" prop="workshopAreaName">
+            <el-input
+              placeholder=""
+              v-model="addForm.workshopAreaName"
+              disabled
+            >
+            </el-input>
+          </el-form-item>
+        </el-col>
         <el-col :span="8">
           <el-form-item label="结论" required prop="conclusion">
             <el-radio-group v-model="addForm.conclusion">
@@ -355,6 +365,12 @@
           if (newVal) {
             console.log('workOrderId~~~~~~~~~~~', newVal);
             // this.getOrderDetials();
+            if (localStorage.getItem('singleUserInfo') == '1') {
+              const data = JSON.parse(localStorage.getItem('chooseUserInfo'));
+              this.getTeamList(data.teamId);
+            } else {
+              this.getTeamList(this.$store.state.user.info.teamId);
+            }
           }
         },
         deep: true,
@@ -382,7 +398,7 @@
     data() {
       const formBaseData = {
         id: null,
-        workshopArea: '',
+        workshopArea: null,
         workshopAreaId: null,
         checkFinishTime: '',
         checkStartTime: '',
@@ -610,12 +626,7 @@
       }
     },
     created() {
-      if (localStorage.getItem('singleUserInfo') == '1') {
-        const data = JSON.parse(localStorage.getItem('chooseUserInfo'));
-        this.getTeamList(data.teamId);
-      } else {
-        this.getTeamList(this.$store.state.user.info.teamId);
-      }
+      
       // 获取审核人列表、巡点检人员
       this.getUserList();
       this.getAllTeamList();
@@ -666,7 +677,9 @@
             }
             return i;
           });
-          this.$util.assignObject(this.addForm, data);
+          console.log('data', data);
+          // this.$util.assignObject(this.addForm, data);
+          Object.assign(this.addForm, data);
           console.log('this.addForm', this.addForm);
 
           // 处理数据
@@ -947,24 +960,24 @@
 
         console.log('row', row);
       },
-      // 查询车间区域
-      async getWorkshopArea() {
-        const data = await getFactoryarea({
-          pageNum: 1,
-          size: 999,
-          type: 3
-        });
-        console.log('list', data.list);
-        this.workshopAreaList = data.list;
-      },
-      workshopAreaIdChange(e) {
-        const area = this.workshopAreaList.find((i) => i.id === e);
-        if (area) {
-          this.addForm.workshopArea = area.name;
-        } else {
-          this.addForm.workshopArea = '';
-        }
-      },
+      // // 查询车间区域
+      // async getWorkshopArea() {
+      //   const data = await getFactoryarea({
+      //     pageNum: 1,
+      //     size: 999,
+      //     type: 3
+      //   });
+      //   console.log('list', data.list);
+      //   this.workshopAreaList = data.list;
+      // },
+      // workshopAreaIdChange(e) {
+      //   const area = this.workshopAreaList.find((i) => i.id === e);
+      //   if (area) {
+      //     this.addForm.workshopArea = area.name;
+      //   } else {
+      //     this.addForm.workshopArea = '';
+      //   }
+      // },
       // 批量检查
       batchCheck() {
         this.addForm.details = this.addForm.details.map((i) => {
@@ -1042,7 +1055,7 @@
         );
         if (currentTeam) {
           // 同步执行人
-          this.addForm.executeUser = [
+          this.addForm.executeUsers = [
             {
               teamId: currentTeam.id,
               teamName: currentTeam.name