Przeglądaj źródła

feat(workPlan): 新增执行班组和执行人字段并完善相关逻辑

yusheng 6 miesięcy temu
rodzic
commit
ce1e758a2d

+ 72 - 3
src/views/produce/components/workPlan/components/baseInfo.vue

@@ -112,7 +112,7 @@
         <el-col :span="6">
           <el-form-item label="质检部门" prop="groupId">
             <deptSelect
-              :disabled="btnType == 'detail'"
+              :disabled="btnType == 'detail' || form.qualityType == 2"
               v-model="form.groupId"
               @changeGroup="searchDeptNodeClick"
             />
@@ -121,7 +121,7 @@
         <el-col :span="6">
           <el-form-item label="质检人" prop="qualityIdList">
             <el-select
-              :disabled="btnType == 'detail'"
+              :disabled="btnType == 'detail' || form.qualityType == 2"
               v-model="form.qualityIdList"
               @change="changeExecutor"
               size="small"
@@ -160,6 +160,48 @@
           </el-form-item>
         </el-col>
       </el-row>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="执行班组" prop="executeJobId">
+            <el-select
+              :disabled="btnType == 'detail'"
+              v-model="form.executeJobId"
+              size="small"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in form.jobList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+                @click.native="changeExecuteJob(item)"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="执行人" prop="executeUserId">
+            <el-select
+              :disabled="btnType == 'detail'"
+              v-model="form.executeUserIdList"
+              size="small"
+              style="width: 100%"
+              filterable
+              multiple
+              @change="executeUserIdChange"
+            >
+              <el-option
+                v-for="item in form.jobList.find(
+                  (job) => job.id == form.executeJobId
+                )?.userVOList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
       <el-row>
         <el-col :span="6">
           <el-form-item
@@ -387,7 +429,6 @@
 
   import { getProduceTaskList } from '@/api/aps';
   import { getByCode, parameterGetByCode } from '@/api/system/dictionary-data';
-
   export default {
     components: {
       EquipmentDialog,
@@ -470,6 +511,10 @@
           groupId: [
             { required: true, message: '请选择质检部门', trigger: 'change' }
           ],
+          executeJobId: [
+            { required: true, message: '请选择执行班组', trigger: 'change' }
+          ],
+
           // qualityId: [
           //   { required: true, message: '请选择质检人', trigger: 'change' }
           // ],
@@ -486,6 +531,7 @@
         produceTaskList: [],
         inspectionStandardsList: [],
         qualityModeList: [],
+        executeUserList: [],
         isExpanded: false,
         showArrange: '1'
       };
@@ -498,6 +544,10 @@
       this.getCode();
     },
     methods: {
+      changeExecuteJob(item) {
+        this.$set(this.form, 'executeJobName', item.name);
+        this.$set(this.form, 'executeUserId', '');
+      },
       getCode() {
         parameterGetByCode({
           code: 'qms_show_arrange'
@@ -665,6 +715,8 @@
 
       //选择部门(搜索)
       searchDeptNodeClick(info, row) {
+        this.form.executeUserId = '';
+
         if (info) {
           const params = { groupId: info };
           this.getUserList(params);
@@ -702,6 +754,23 @@
 
         this.$forceUpdate();
       },
+      // 人员选择
+      executeUserIdChange(val) {
+        if (val.length) {
+          let arr = this.form.jobList.find(
+            (job) => job.id == this.form.executeJobId
+          )?.userVOList;
+
+          this.form.executeUserName = val
+            .map((item) => arr.find((item2) => item2.id == item)?.name)
+            .join(',');
+        } else {
+          this.form.executeUserName = '';
+        }
+
+        this.$forceUpdate();
+      },
+
       inputTotal(val) {
         if (val) {
           this.form.total = val;

+ 25 - 3
src/views/produce/components/workPlan/edit.vue

@@ -857,8 +857,14 @@
       },
       async getDetail(id) {
         getById(id).then((res) => {
+          if (res.data.jobList?.length == 1) {
+            res.data.executeJobId = res.data.jobList[0].id;
+            res.data.executeJobName = res.data.jobList[0].name;
+          }
           this.form = res.data;
-
+          this.form.executeUserIdList = this.form.executeUserId
+            ? this.form.executeUserId.split(',')
+            : [];
           console.log(this.form, 'this.form');
 
           this.form.qualityIdList = this.form.qualityId
@@ -1252,7 +1258,8 @@
           this.form.qualityId = this.form.qualityIdList.join(',');
 
           delete this.form['qualityTimeEnd'];
-
+          this.form.executeUserId = '';
+          this.form.executeUserName = '';
           let params = {
             ...this.form,
             sampleList: this.sampleList,
@@ -1404,7 +1411,22 @@
           this.form.qualityTimeEnd = this.getNowTime();
           this.form.qualityTimeStart = this.qualityTimeStart;
           this.form.qualityId = this.form.qualityIdList.join(',');
-
+          if (
+            !this.form.executeUserIdList.find(
+              (item) => item == this.$store.state.user.info.userId
+            )
+          ) {
+            this.form.executeUserIdList.push(
+              this.$store.state.user.info.userId
+            );
+            this.form.executeUserName =
+              this.form.executeUserIdList.length > 1
+                ? this.form.executeUserName +
+                  ',' +
+                  this.$store.state.user.info.userName
+                : this.$store.state.user.info.userName;
+          }
+          this.form.executeUserId = this.form.executeUserIdList.join(',');
           // if (this.form.qualityMode == 1) {
           //   this.form.qualityResults = '';
           // }

+ 11 - 1
src/views/produce/components/workPlan/mixins/detailMixins.js

@@ -60,6 +60,16 @@ export default {
           prop: 'qualityTime',
           span: 6
         },
+        {
+          prop: 'executeJobName',
+          span: 6,
+          label: '执行班组',
+        },
+        {
+          prop: 'executeUserName',
+          span: 6,
+          label: '执行人'
+        },
         {
           label: '工时(h)',
           prop: 'hours',
@@ -95,7 +105,7 @@ export default {
           label: '总数量',
           prop: 'total',
           span: 6
-        },
+        }
       ],
       disposeTypeMap: {
         1: '返工',