695593266@qq.com 8 месяцев назад
Родитель
Сommit
048398df14

+ 28 - 1
src/api/inspectionProjectTask/index.js

@@ -74,4 +74,31 @@ export async function verificationQualityInspector(id) {
     `/qms/taskmonad/verificationQualityInspector/${id}`
   );
   return res.data.code;
-}
+}
+
+// 工艺文件
+export async function craftFiles(qualityWorkOrderId) {
+  const res = await request.get(
+    `/qms/quality_work_order/craftFiles/${qualityWorkOrderId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function newFilePageAPI(data) {
+  const res = await request.post('/fm/file/queryIds', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function fileReleaseAPI(data) {
+  const res = await request.post('/fm/file/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 57 - 0
src/components/workList/wokePopup.vue

@@ -0,0 +1,57 @@
+<template>
+  <ele-modal
+    title="工艺文件"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    :maxable="true"
+    width="80%"
+  >
+    <wokePopupList ref="wokePopupListRef"></wokePopupList>
+    <template slot="footer">
+      <el-button size="mini" @click="handleClose">取 消</el-button>
+      <el-button size="mini" type="primary" @click="handleClose"
+        >确 定</el-button
+      >
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import wokePopupList from './wokePopupList.vue';
+
+  export default {
+    components: { wokePopupList },
+    props: {},
+    data() {
+      return {
+        visible: false
+      };
+    },
+
+    watch: {},
+    methods: {
+      open(ids) {
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.wokePopupListRef.open(ids);
+        });
+      },
+
+      openTwo(req) {
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.wokePopupListRef.openTwo(req);
+        });
+      },
+
+      handleClose() {
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 117 - 0
src/components/workList/wokePopupList.vue

@@ -0,0 +1,117 @@
+<template>
+  <ele-pro-table ref="fileTable" :columns="jobColumns1" :datasource="workList">
+    <!-- 表头工具栏 -->
+
+    <template v-slot:action="{ row, $index }">
+      <el-link type="primary" @click="browseOpen(row)">详情</el-link>
+    </template>
+  </ele-pro-table>
+</template>
+
+<script>
+  import { newFilePageAPI, fileReleaseAPI } from '@/api/inspectionProjectTask';
+  import { setFileUrl } from '@/components/addDoc/util.js';
+  export default {
+    components: {},
+    props: {},
+    data() {
+      return {
+        workList: [],
+
+        jobColumns1: [
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'name',
+            label: '文档名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+
+          {
+            prop: 'storagePath',
+            label: '文件名称',
+            align: 'center',
+
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue[0]?.name;
+            }
+          },
+
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 260,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ]
+      };
+    },
+
+    watch: {},
+    methods: {
+      open(ids) {
+        this.getFilepProcess(ids);
+      },
+
+      openTwo(req) {
+        fileReleaseAPI({
+          fileType: 0,
+          isQueryAll: 1,
+          jobNumber: '',
+          lcyStatus: '3',
+          loginName: '',
+          name: req.productCode,
+          pageNum: 1,
+          size: 10
+        }).then((res) => {
+          console.log(res, '13123131');
+          this.workList = res.list;
+        });
+      },
+      browseOpen(row) {
+        window.open(setFileUrl(row));
+      },
+      async getFilepProcess(ids) {
+        if (!ids.length) {
+          return;
+        }
+        await newFilePageAPI({
+          ids: "'" + ids + "'"
+        }).then((res) => {
+          this.workList = res;
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 3 - 3
src/views/produce/components/workPlan/components/experimentReport.vue

@@ -20,17 +20,17 @@
       <el-row>
         <el-col :span="8">
           <el-form-item label="质检项:" prop="inspectionName">
-            {{ tableData[0].inspectionName }}</el-form-item
+            {{ tableData[0]?.inspectionName }}</el-form-item
           >
         </el-col>
         <el-col :span="8">
           <el-form-item label="编码:" prop="inspectionCode">
-            {{ tableData[0].inspectionCode }}
+            {{ tableData[0]?.inspectionCode }}
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="批次号:" prop="batchNo">
-            {{ tableData[0].batchNo }}
+            {{ tableData[0]?.batchNo }}
           </el-form-item>
         </el-col></el-row
       >

+ 115 - 25
src/views/produce/components/workPlan/components/inspectionProjectReport.vue

@@ -16,7 +16,12 @@
       :datasource="[form]"
     >
       <template v-slot:toolbar>
-        剩余样品总数:{{ form.remainingSampleCount }}
+        剩余样品总数:{{ form.remainingSampleCount }}{{ form.measureUnit }}
+      </template>
+      <template v-slot:craftFiles="{ row }">
+        <el-link type="primary" :underline="false" @click="craftFiles(row)"
+          >工艺文件</el-link
+        >
       </template>
 
       <template v-slot:isRequired="{ column }">
@@ -48,6 +53,7 @@
           @input="formSampleQuantityChange"
           :disabled="type == 'detail'"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
       <template v-slot:sampleNoQualifiedNumber="{ row }">
@@ -58,6 +64,7 @@
           type="number"
           :disabled="type == 'detail'"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
     </ele-pro-table>
@@ -67,7 +74,7 @@
       :datasource="tableData"
     >
       <template v-slot:toolbar>
-        当前质检剩余样品数:{{ getSampleQuantityCount }}
+        当前质检剩余样品数:{{ getSampleQuantityCount }}{{ form.measureUnit }}
       </template>
       <template v-slot:qualityStandardType="{ row }">
         {{ getDictValue('质检标准类型', row.qualityStandardType) }}
@@ -83,11 +90,7 @@
         </el-select>
       </template>
       <template v-slot:useTools="{ row }">
-        <toolButtom
-          v-model="row.useTools"
-          :type="type"
-          :sList="row.toolList"
-        />
+        <toolButtom v-model="row.useTools" :type="type" :sList="row.toolList" />
       </template>
       <template v-slot:qualityResultContent="{ row }">
         <el-input
@@ -109,6 +112,7 @@
           type="number"
           @input="inputValue('sampleQuantity', row, $index)"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
 
@@ -120,6 +124,7 @@
           type="number"
           @input="inputValue('qualifiedQuantity', row, $index)"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
       <template v-slot:noQualifiedQuantity="{ row, $index }">
@@ -130,6 +135,7 @@
           type="number"
           @input="inputValue('noQualifiedQuantity', row, $index)"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
       <template v-slot:lossNumber="{ row, $index }">
@@ -141,6 +147,7 @@
           @input="inputValue('lossNumber', row, $index)"
           @click.native="curretNum = row.lossNumber"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
       <template v-slot:lossNumberUnqualified="{ row, $index }">
@@ -152,6 +159,7 @@
           @input="inputValue('lossNumberUnqualified', row, $index)"
           @click.native="curretNum = row.lossNumberUnqualified"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
       <template v-slot:retainedSampleQuantity="{ row, $index }">
@@ -163,6 +171,7 @@
           @input="inputValue('retainedSampleQuantity', row, $index)"
           @click.native="curretNum = row.retainedSampleQuantity"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
       <template v-slot:retainedSampleUnqualified="{ row, $index }">
@@ -174,6 +183,7 @@
           @input="inputValue('retainedSampleUnqualified', row, $index)"
           @click.native="curretNum = row.retainedSampleUnqualified"
         >
+          <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
       </template>
       <template v-slot:qualityResults="{ row, $index }">
@@ -226,6 +236,7 @@
       ref="experimentReport"
       @done="experimentReportDone"
     ></experimentReport>
+    <wokePopup ref="wokePopupRef"></wokePopup>
   </ele-modal>
 </template>
 
@@ -237,12 +248,16 @@
   import { handleInput } from './unit.js';
   import {
     exeTaskReportWork,
-    exeEntrustReportWork
+    exeEntrustReportWork,
+    craftFiles
   } from '@/api/inspectionProjectTask';
+  import wokePopup from '@/components/workList/wokePopup.vue';
+  import { parameterGetByCode } from '@/api/system/dictionary-data';
+
   export default {
     mixins: [dictMixins, detailMixins],
 
-    components: { toolButtom, experimentReport },
+    components: { toolButtom, experimentReport, wokePopup },
 
     data() {
       return {
@@ -347,10 +362,15 @@
             prop: 'total',
             align: 'center',
             label: '总数量',
+            formatter: (row) => {
+              if (row.total) {
+                return row.total + this.form.measureUnit || '';
+              }
+            },
             showOverflowTooltip: true
           },
           {
-            minWidth: 140,
+            minWidth: 180,
             prop: 'sampleQuantity',
             headerSlot: 'isRequired',
             slot: 'sampleQuantity',
@@ -359,7 +379,7 @@
             showOverflowTooltip: true
           },
           {
-            minWidth: 140,
+            minWidth: 180,
             prop: 'sampleNoQualifiedNumber',
             slot: 'sampleNoQualifiedNumber',
             align: 'center',
@@ -372,6 +392,13 @@
             headerSlot: 'isRequired',
             slot: 'sampleQualifiedNumber',
             align: 'center',
+            formatter: (row) => {
+              if (row.sampleQualifiedNumber) {
+                return (
+                  row.sampleQualifiedNumber + (this.form.measureUnit || '')
+                );
+              }
+            },
             label: '样品合格数',
             showOverflowTooltip: true
           },
@@ -380,6 +407,11 @@
             prop: 'lossNumber',
             slot: 'lossNumber',
             align: 'center',
+            formatter: (row) => {
+              if (row.lossNumber) {
+                return row.lossNumber + (this.form.measureUnit || '');
+              }
+            },
             label: '损耗数(合格品)',
             showOverflowTooltip: true
           },
@@ -388,6 +420,13 @@
             prop: 'lossNumberUnqualified',
             slot: 'lossNumberUnqualified',
             align: 'center',
+            formatter: (row) => {
+              if (row.lossNumberUnqualified) {
+                return (
+                  row.lossNumberUnqualified + (this.form.measureUnit || '')
+                );
+              }
+            },
             label: '损耗数(不合格品)',
             showOverflowTooltip: true
           },
@@ -396,6 +435,13 @@
             prop: 'retainedSampleQuantity',
             slot: 'retainedSampleQuantity',
             align: 'center',
+            formatter: (row) => {
+              if (row.retainedSampleQuantity) {
+                return (
+                  row.retainedSampleQuantity + (this.form.measureUnit || '')
+                );
+              }
+            },
             label: '留样数(合格品)',
             showOverflowTooltip: true
           },
@@ -404,6 +450,13 @@
             prop: 'retainedSampleUnqualified',
             slot: 'retainedSampleUnqualified',
             align: 'center',
+            formatter: (row) => {
+              if (row.retainedSampleUnqualified) {
+                return (
+                  row.retainedSampleUnqualified + (this.form.measureUnit || '')
+                );
+              }
+            },
             label: '留样数(不合格品)',
             showOverflowTooltip: true
           },
@@ -438,6 +491,15 @@
             align: 'center',
             label: '质检时间',
             showOverflowTooltip: true
+          },
+          {
+            minWidth: 120,
+            prop: 'craftFiles',
+            slot: 'craftFiles',
+            align: 'center',
+            label: '工艺文件',
+            fixed: 'right',
+            showOverflowTooltip: true
           }
         ],
 
@@ -525,7 +587,7 @@
             showOverflowTooltip: true
           },
           {
-            minWidth: 120,
+            minWidth: 180,
             prop: 'sampleQuantity',
             slot: 'sampleQuantity',
             align: 'center',
@@ -533,7 +595,7 @@
             showOverflowTooltip: true
           },
           {
-            minWidth: 120,
+            minWidth: 180,
             prop: 'qualifiedQuantity',
             align: 'center',
             slot: 'qualifiedQuantity',
@@ -541,7 +603,7 @@
             showOverflowTooltip: true
           },
           {
-            minWidth: 130,
+            minWidth: 180,
             prop: 'noQualifiedQuantity',
             slot: 'noQualifiedQuantity',
             align: 'center',
@@ -549,7 +611,7 @@
             showOverflowTooltip: true
           },
           {
-            minWidth: 140,
+            minWidth: 180,
             prop: 'lossNumber',
             slot: 'lossNumber',
             align: 'center',
@@ -557,7 +619,7 @@
             showOverflowTooltip: true
           },
           {
-            minWidth: 150,
+            minWidth: 180,
             prop: 'lossNumberUnqualified',
             slot: 'lossNumberUnqualified',
             align: 'center',
@@ -565,7 +627,7 @@
             showOverflowTooltip: true
           },
           {
-            minWidth: 140,
+            minWidth: 180,
             prop: 'retainedSampleQuantity',
             slot: 'retainedSampleQuantity',
             align: 'center',
@@ -573,7 +635,7 @@
             showOverflowTooltip: true
           },
           {
-            minWidth: 150,
+            minWidth: 180,
             prop: 'retainedSampleUnqualified',
             slot: 'retainedSampleUnqualified',
             align: 'center',
@@ -644,11 +706,12 @@
     computed: {
       getSampleQuantityCount() {
         return (
-          this.form.sampleQuantity -
-          (this.form.lossNumber || 0) -
-          (this.form.lossNumberUnqualified || 0) -
-          (this.form.retainedSampleQuantity || 0) -
-          (this.form.retainedSampleUnqualified || 0)
+          (this.form.sampleQuantity * 100 -
+            (this.form.lossNumber * 100 || 0) -
+            (this.form.lossNumberUnqualified * 100 || 0) -
+            (this.form.retainedSampleQuantity * 100 || 0) -
+            (this.form.retainedSampleUnqualified * 100 || 0)) /
+          100
         );
       }
     },
@@ -659,6 +722,21 @@
       this.requestDict('质检标准类型');
     },
     methods: {
+      async craftFiles(row) {
+        const res = await parameterGetByCode({
+          code: 'mes_craft_file_by_category_code'
+        });
+        const byCategory = res?.value === '1';
+
+        if (byCategory) {
+          this.$refs.wokePopupRef.openTwo(row);
+        } else {
+          const data = row.qualityWorkOrderId
+            ? await craftFiles(row.qualityWorkOrderId)
+            : [];
+          this.$refs.wokePopupRef.open(data.map((item) => item.id));
+        }
+      },
       experimentReport(row, type) {
         console.log(this.getSampleQuantityCount, 'this.form');
         this.$refs.experimentReport.open(
@@ -684,6 +762,7 @@
 
       async open({ workData, row, list }, type, pageName) {
         this.tableData = [];
+        console.log(workData, row, list, 'workDataworkData');
         this.pageName = pageName;
         this.type = type;
         if (pageName == 'inspectionProjectTask') {
@@ -701,6 +780,7 @@
             data.sampleQuantity - data.sampleNoQualifiedNumber ||
             0;
           this.$set(this, 'form', JSON.parse(JSON.stringify(data)));
+          console.log(this.form, 'this.form');
           this.tableData = JSON.parse(JSON.stringify(list));
           this.tableData.forEach((item, index) => {
             if (item.experimentCode) {
@@ -714,7 +794,8 @@
           });
           if (row.sampleQuantity) {
             this.form.remainingSampleCount =
-              row.sampleQuantity + this.form.remainingSampleCount;
+              Number(row.sampleQuantity) +
+              Number(this.form.remainingSampleCount);
           }
         } else {
           this.$set(this, 'form', JSON.parse(JSON.stringify(workData)));
@@ -741,6 +822,9 @@
         this.visible = true;
       },
       formSampleQuantityChange() {
+        if (this.form.sampleQuantity < 0) {
+          this.form.sampleQuantity = 0;
+        }
         if (this.form.sampleQuantity > this.form.remainingSampleCount) {
           this.form.sampleQuantity = this.form.remainingSampleCount;
         }
@@ -760,7 +844,10 @@
         this.form.sampleNoQualifiedNumber = 0;
       },
       formSampleNoQualifiedNumberChange() {
-        if (this.form.sampleNoQualifiedNumber > this.form.sampleQuantity) {
+        if (+this.form.sampleNoQualifiedNumber < 0) {
+          this.form.sampleNoQualifiedNumber = 0;
+        }
+        if (+this.form.sampleNoQualifiedNumber > this.form.sampleQuantity) {
           this.form.sampleNoQualifiedNumber = this.form.sampleQuantity;
         }
         this.form.sampleQualifiedNumber =
@@ -804,6 +891,9 @@
         }
       },
       inputValue(type, item, index) {
+        if (item[type] < 0) {
+          item[type] = 0;
+        }
         //样品数
         if (type == 'sampleQuantity') {
           this.isSampleQuantity(item, index);

+ 2 - 1
src/views/produce/components/workPlan/edit.vue

@@ -863,7 +863,8 @@
                 accessory: this.form.accessory,
                 qualityNames: this.form.qualityNames,
                 qualityTimeEnd: this.form.qualityTimeEnd,
-                remainingSampleCount: this.form.remainingSampleCount
+                remainingSampleCount: this.form.remainingSampleCount,
+                measureUnit: this.sampleList[0]?.measureUnit
               },
               row: this.form.taskMonadInfo || {},
               list

+ 602 - 234
src/views/produce/components/workPlan/mixins/detailMixins.js

@@ -1,8 +1,16 @@
-const qualityResultList = { 1: '合格', 2: '不合格' };
+const qualityResultList = { 1: '合格', 2: '不合格', 3: '让步接收' };
 const disposalStatustList = { 0: '待处置', 1: '处置中', 2: '处置完成' };
+import { inspectionProjectStatus } from '@/enum/dict.js';
+
 export default {
   data() {
     return {
+      keyArr: [
+        'lossNumber',
+        'lossNumberUnqualified',
+        'retainedSampleQuantity',
+        'retainedSampleUnqualified'
+      ],
       infoList: [
         {
           label: '编码',
@@ -44,13 +52,9 @@ export default {
           prop: 'inspectionStandardsName',
           span: 6
         },
+
         {
-          label: '质检部门',
-          prop: 'groupName',
-          span: 6
-        },
-        {
-          label: '质检人',
+          label: '接收人',
           prop: 'qualityName',
           span: 6
         },
@@ -60,16 +64,6 @@ export default {
           prop: 'qualityTime',
           span: 6
         },
-        {
-          prop: 'executeJobName',
-          span: 6,
-          label: '执行班组',
-        },
-        {
-          prop: 'executeUserName',
-          span: 6,
-          label: '执行人'
-        },
         {
           label: '工时(h)',
           prop: 'hours',
@@ -105,6 +99,60 @@ export default {
           label: '总数量',
           prop: 'total',
           span: 6
+        },
+        {
+          label: '记录方法',
+          prop: 'recordingMethod',
+          span: 6
+        },
+        {
+          minWidth: 140,
+          prop: 'lossNumber',
+          slot: 'lossNumber',
+          align: 'center',
+          label: '损耗数(合格品)',
+          showOverflowTooltip: true
+        },
+        {
+          minWidth: 150,
+          prop: 'lossNumberUnqualified',
+          slot: 'lossNumberUnqualified',
+          align: 'center',
+          label: '损耗数(不合格品)',
+          showOverflowTooltip: true
+        },
+        {
+          minWidth: 140,
+          prop: 'retainedSampleQuantity',
+          slot: 'retainedSampleQuantity',
+          align: 'center',
+          label: '留样数(合格品)',
+          showOverflowTooltip: true
+        },
+        {
+          minWidth: 150,
+          prop: 'retainedSampleUnqualified',
+          slot: 'retainedSampleUnqualified',
+          align: 'center',
+          label: '留样数(不合格品)',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'executeJobName',
+          label: '执行班组'
+        },
+        {
+          prop: 'executeUserName',
+          label: '执行人'
+        },
+        {
+          prop: 'executeDeptName',
+          label: '执行部门'
+        },
+
+        {
+          prop: 'groupName',
+          label: '接收人部门'
         }
       ],
       disposeTypeMap: {
@@ -194,6 +242,18 @@ export default {
           showOverflowTooltip: true
         },
         { label: '刻码', prop: 'engrave', align: 'center' },
+        {
+          label: '机型',
+          prop: 'modelKey',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '颜色',
+          prop: 'colorKey',
+          align: 'center',
+          showOverflowTooltip: true
+        },
         { label: '重量', prop: 'weight', align: 'center' },
         { label: '重量单位', prop: 'weightUnit', align: 'center' },
         {
@@ -221,459 +281,767 @@ export default {
           showOverflowTooltip: true
         }
       ],
-      tableColumns2: [
+
+      tableColumns4: [
         {
+          type: 'index',
           columnKey: 'index',
+          align: 'center',
           label: '序号',
-          type: 'index',
           width: 55,
-          align: 'center',
-          fixed: 'left'
+          showOverflowTooltip: true
         },
         {
           label: '样品编码',
           prop: 'sampleCode',
-          width: '200',
+          minWidth: '150',
           align: 'center',
-          fixed: 'left',
           showOverflowTooltip: true
         },
         {
-          label: '编码',
+          label: '物品编码',
           prop: 'categoryCode',
+          minWidth: '150',
           align: 'center',
-          fixed: 'left',
-          width: '150',
           showOverflowTooltip: true
         },
         {
-          label: '名称',
+          label: '物品名称',
           prop: 'categoryName',
+          minWidth: '180',
           align: 'center',
-          width: '150',
           showOverflowTooltip: true
         },
         {
-          label: '批次号',
           prop: 'batchNo',
+          label: '批次号',
           align: 'center',
+          minWidth: '120',
           showOverflowTooltip: true
         },
         {
-          label: '发货条码',
-          prop: 'barcodes',
+          label: '规格',
+          prop: 'specification',
+          width: '120',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          label: '包装编码',
-          prop: 'packageNo',
+          label: '牌号',
+          prop: 'brandNum',
+          width: '120',
           align: 'center',
-          width: '170',
           showOverflowTooltip: true
         },
-        { label: '包装数量', prop: 'packingQuantity', align: 'center' },
-        { label: '包装单位', prop: 'packingUnit', align: 'center' },
-        { label: '计量数量', prop: 'measureQuantity', align: 'center' },
-        { label: '计量单位', prop: 'measureUnit', align: 'center' },
         {
-          label: '供应商名称',
-          prop: 'supplierName',
+          prop: 'modelType',
+          label: '型号',
           align: 'center',
           width: '120',
           showOverflowTooltip: true
         },
         {
-          label: '供应商代号',
-          prop: 'supplierCode',
+          label: '机型',
+          prop: 'modelKey',
           align: 'center',
-          width: '120',
           showOverflowTooltip: true
         },
         {
-          label: '物料代号',
-          prop: 'materielDesignation',
+          label: '颜色',
+          prop: 'colorKey',
           align: 'center',
-          slot: 'materielDesignation',
-          width: '120',
           showOverflowTooltip: true
         },
         {
-          label: '客户代号',
-          prop: 'clientCode',
+          prop: 'measureQuantity',
+          label: '计量数量',
           align: 'center',
-          slot: 'clientCode',
           width: '120',
           showOverflowTooltip: true
         },
         {
-          label: '刻码',
-          prop: 'engrave',
+          prop: 'measureUnit',
+          label: '计量单位',
           align: 'center',
-          slot: 'engrave',
           width: '120',
           showOverflowTooltip: true
         },
+
         {
-          label: '重量',
           prop: 'weight',
+          label: '重量',
           align: 'center',
-          slot: 'weight',
-          width: '120'
-        },
-        {
-          label: '重量单位',
-          prop: 'weightUnit',
-          align: 'center',
-          width: 100
-        },
-        {
-          label: '仓库',
-          prop: 'warehouseName',
-          align: 'center',
-          width: 150,
-          showOverflowTooltip: true
-        },
-        {
-          label: '货区',
-          prop: 'areaName',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        { label: '货架', prop: 'goodsShelfName', align: 'center' },
-        { label: '货位', prop: 'goodsAllocationName', align: 'center' },
-        {
-          label: '生产日期',
-          prop: 'productionDate',
-          align: 'center',
-          width: 150,
+          width: '120',
           showOverflowTooltip: true
         },
         {
-          label: '采购日期',
-          prop: 'purchaseDate',
+          prop: 'weightUnit',
+          label: '重量单位',
           align: 'center',
-          width: 150,
+          width: '120',
           showOverflowTooltip: true
         },
         {
+          prop: 'disposalStatus',
           label: '处置状态',
-          prop: 'disposeType',
           align: 'center',
-          formatter: (_row) => {
-            return this.disposeTypeMap[_row.disposeType] || '';
+          width: '120',
+          showOverflowTooltip: true,
+          formatter: (row, column, cellValue) => {
+            return disposalStatustList[cellValue ? cellValue : 0];
           }
         },
         {
-          label: '处置时间',
-          prop: 'disposeTime',
+          prop: 'disposeType',
+          label: '处置类型',
           align: 'center',
+          width: '120',
           showOverflowTooltip: true,
-          width: 150
+          formatter: (row, column, cellValue) => {
+            return this.disposeTypeMap[cellValue];
+          }
         },
         {
-          label: '质检状态',
-          prop: 'qualityStatus',
+          prop: 'qualityResults',
+          label: '质检结果',
           align: 'center',
-          formatter: (row) => {
-            if (row.qualityStatus == 0) {
-              return '未检';
-            }
-            if (row.qualityStatus == 1) {
-              return '已检';
-            }
-            if (row.qualityStatus == 2) {
-              return '待检';
-            }
+          width: '120',
+          showOverflowTooltip: true,
+          formatter: (row, column, cellValue) => {
+            return qualityResultList[cellValue];
           }
         }
       ],
-      tableColumns3: [
+      tableColumns5: [
         {
           columnKey: 'index',
           label: '序号',
           type: 'index',
           width: 55,
           align: 'center',
+          showOverflowTooltip: true,
           fixed: 'left'
         },
         {
-          label: '质检方案编码',
-          prop: 'qualitySchemeTemplateCode',
+          label: '样品编码',
+          prop: 'sampleCode',
+          width: '150',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          label: '质检方案名称',
-          prop: 'qualitySchemeTemplateName',
+          prop: 'categoryCode',
+          label: '物品编码',
+          width: '150',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          label: '质检类型',
-          prop: 'categoryLevelClassName',
+          prop: 'categoryName',
+          label: '物品名称',
+          width: '150',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          label: '质检项编码',
-          prop: 'inspectionCode',
+          label: '规格',
+          prop: 'specification',
+          width: '120',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          label: '质检项名称',
-          prop: 'inspectionName',
-          align: 'center',
-          showOverflowTooltip: true
+          prop: 'brandNum',
+          label: '牌号',
+          align: 'center'
         },
         {
-          label: '工艺参数',
-          prop: 'defaultValue',
-          align: 'center',
-          showOverflowTooltip: true,
-          slot: 'defaultValue'
-        }
-      ],
-      tableColumns4: [
-        {
-          type: 'index',
-          columnKey: 'index',
+          prop: 'modelType',
+          label: '型号',
           align: 'center',
-          label: '序号',
-          width: 55,
+          width: '120',
           showOverflowTooltip: true
         },
         {
-          label: '样品编码',
-          prop: 'sampleCode',
-          minWidth: '150',
+          label: '机型',
+          prop: 'modelKey',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          label: '物品编码',
-          prop: 'categoryCode',
-          minWidth: '150',
+          label: '颜色',
+          prop: 'colorKey',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          label: '物品名称',
-          prop: 'categoryName',
-          minWidth: '180',
+          prop: 'batchNo',
+          label: '批次号',
           align: 'center',
+          width: '120',
           showOverflowTooltip: true
         },
         {
-          prop: 'batchNo',
-          label: '批次号',
+          prop: 'weight',
+          label: '重量',
           align: 'center',
-          minWidth: '120',
+          width: '120',
           showOverflowTooltip: true
         },
         {
-          label: '规格',
-          prop: 'specification',
-          width: '120',
+          prop: 'weightUnit',
+          label: '重量单位',
           align: 'center',
+          width: '120',
           showOverflowTooltip: true
         },
         {
-          label: '牌号',
-          prop: 'brandNum',
-          width: '120',
+          prop: 'engrave',
+          label: '刻码',
+          align: 'center'
+        },
+        { label: '计量数量', prop: 'measureQuantity', align: 'center' },
+        { label: '计量单位', prop: 'measureUnit', align: 'center' },
+        {
+          prop: 'produceRoutingName',
+          label: '工艺路线',
+          align: 'center'
+        },
+        {
+          prop: 'produceTaskName',
+          label: '工序',
+          align: 'center'
+        },
+        {
+          prop: 'unqualifiedReason',
+          label: '原因',
+          align: 'center'
+        },
+        {
+          prop: 'disposeTime',
+          label: '处置时间',
           align: 'center',
+          width: '180',
           showOverflowTooltip: true
         },
         {
-          prop: 'modelType',
-          label: '型号',
+          prop: 'disposalStatus',
+          label: '处置状态',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true,
+          formatter: (row, column, cellValue) => {
+            return disposalStatustList[cellValue ? cellValue : 0];
+          }
+        },
+        {
+          prop: 'disposeType',
+          label: '处置类型',
           align: 'center',
           width: '120',
+          showOverflowTooltip: true,
+          formatter: (_row) => {
+            return this.disposeTypeMap[_row.disposeType];
+          }
+        }
+      ]
+    };
+  },
+  computed: {
+    tableColumns2() {
+      return [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          fixed: 'left'
+        },
+        {
+          label: '样品编码',
+          prop: 'sampleCode',
+          width: '200',
+          align: 'center',
+          fixed: 'left',
           showOverflowTooltip: true
         },
         {
-          prop: 'measureQuantity',
-          label: '计量数量',
+          label: '编码',
+          prop: 'categoryCode',
+          align: 'center',
+          slot: 'categoryCode',
+          fixed: 'left',
+          width: '150',
+          showOverflowTooltip: true
+        },
+        {
+          label: '名称',
+          prop: 'categoryName',
+          align: 'center',
+          width: '150',
+          showOverflowTooltip: true
+        },
+        {
+          label: '批次号',
+          prop: 'batchNo',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '发货条码',
+          prop: 'barcodes',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '包装编码',
+          prop: 'packageNo',
+          align: 'center',
+          width: '170',
+          showOverflowTooltip: true
+        },
+        { label: '包装数量', prop: 'packingQuantity', align: 'center' },
+        { label: '包装单位', prop: 'packingUnit', align: 'center' },
+        { label: '计量数量', prop: 'measureQuantity', align: 'center' },
+        { label: '计量单位', prop: 'measureUnit', align: 'center' },
+        {
+          label: '供应商名称',
+          prop: 'supplierName',
           align: 'center',
           width: '120',
           showOverflowTooltip: true
         },
         {
-          prop: 'measureUnit',
-          label: '计量单位',
+          label: '供应商代号',
+          prop: 'supplierCode',
           align: 'center',
           width: '120',
           showOverflowTooltip: true
         },
-
         {
-          prop: 'weight',
-          label: '重量',
+          label: '物料代号',
+          prop: 'materielDesignation',
           align: 'center',
+          slot: 'materielDesignation',
           width: '120',
           showOverflowTooltip: true
         },
         {
-          prop: 'weightUnit',
-          label: '重量单位',
+          label: '客户代号',
+          prop: 'clientCode',
           align: 'center',
+          slot: 'clientCode',
           width: '120',
           showOverflowTooltip: true
         },
         {
-          prop: 'disposalStatus',
-          label: '处置状态',
+          label: '刻码',
+          prop: 'engrave',
           align: 'center',
+          slot: 'engrave',
           width: '120',
-          showOverflowTooltip: true,
-          formatter: (row, column, cellValue) => {
-            return disposalStatustList[cellValue ? cellValue : 0];
-          }
+          showOverflowTooltip: true
+        },
+        {
+          label: '机型',
+          prop: 'modelKey',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '颜色',
+          prop: 'colorKey',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '重量',
+          prop: 'weight',
+          align: 'center',
+          slot: 'weight',
+          width: '120'
+        },
+        {
+          label: '重量单位',
+          prop: 'weightUnit',
+          align: 'center',
+          width: 100
+        },
+        {
+          label: '仓库',
+          prop: 'warehouseName',
+          align: 'center',
+          width: 150,
+          showOverflowTooltip: true
+        },
+        {
+          label: '货区',
+          prop: 'areaName',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        { label: '货架', prop: 'goodsShelfName', align: 'center' },
+        { label: '货位', prop: 'goodsAllocationName', align: 'center' },
+        {
+          label: '生产日期',
+          prop: 'productionDate',
+          align: 'center',
+          width: 150,
+          showOverflowTooltip: true
         },
         {
+          label: '采购日期',
+          prop: 'purchaseDate',
+          align: 'center',
+          width: 150,
+          showOverflowTooltip: true
+        },
+        {
+          label: '处置状态',
           prop: 'disposeType',
-          label: '处置类型',
           align: 'center',
-          width: '120',
-          showOverflowTooltip: true,
-          formatter: (row, column, cellValue) => {
-            return this.disposeTypeMap[cellValue];
+          formatter: (_row) => {
+            return this.disposeTypeMap[_row.disposeType] || '';
           }
         },
         {
-          prop: 'qualityResults',
-          label: '质检结果',
+          label: '处置时间',
+          prop: 'disposeTime',
           align: 'center',
-          width: '120',
           showOverflowTooltip: true,
-          formatter: (row, column, cellValue) => {
-            return qualityResultList[cellValue];
+          width: 150
+        },
+        {
+          prop: 'badTypeName',
+          label: '不良类型',
+          width: '180',
+          align: 'center',
+          show: this.form.recordingMethod != 1
+        },
+        {
+          prop: 'badNameName',
+          label: '不良名称',
+          width: '180',
+          align: 'center',
+          show: this.form.recordingMethod != 1
+        },
+        {
+          label: '质检状态',
+          prop: 'qualityStatus',
+          align: 'center',
+          show: this.form.recordingMethod != 1,
+          formatter: (row) => {
+            if (row.qualityStatus == 0) {
+              return '未检';
+            }
+            if (row.qualityStatus == 1) {
+              return '已检';
+            }
+            if (row.qualityStatus == 2) {
+              return '待检';
+            }
           }
         }
-      ],
-      tableColumns5: [
+      ];
+    },
+    tableColumns3() {
+      return [
         {
           columnKey: 'index',
           label: '序号',
           type: 'index',
           width: 55,
           align: 'center',
-          showOverflowTooltip: true,
           fixed: 'left'
         },
         {
-          label: '样品编码',
-          prop: 'sampleCode',
-          width: '150',
+          label: '质检方案编码',
+          prop: 'qualitySchemeTemplateCode',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          prop: 'categoryCode',
-          label: '物品编码',
-          width: '150',
+          label: '质检方案名称',
+          prop: 'qualitySchemeTemplateName',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          prop: 'categoryName',
-          label: '物品名称',
-          width: '150',
+          label: '质检类型',
+          prop: 'categoryLevelClassName',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          label: '规格',
-          prop: 'specification',
-          width: '120',
+          label: '质检项编码',
+          prop: 'inspectionCode',
           align: 'center',
           showOverflowTooltip: true
         },
         {
-          prop: 'brandNum',
-          label: '牌号',
-          align: 'center'
+          label: '质检项名称',
+          prop: 'inspectionName',
+          align: 'center',
+          showOverflowTooltip: true
         },
         {
-          prop: 'modelType',
-          label: '型号',
+          label: '工艺参数',
+          prop: 'defaultValue',
           align: 'center',
-          width: '120',
+          showOverflowTooltip: true,
+          slot: 'defaultValue'
+        },
+
+        {
+          label: '执行方法',
+          prop: 'executionMethod',
+          align: 'center',
+          showOverflowTooltip: true,
+          show: this.form.recordingMethod == 1,
+          formatter: (row) => {
+            return row.executionMethod == 1 ? '常规检验' : '实验';
+          }
+        },
+        {
+          minWidth: 200,
+          prop: 'qualityResultContent',
+          align: 'center',
+          headerSlot: 'isRequired',
+          label: '质检内容',
           showOverflowTooltip: true
         },
         {
-          prop: 'batchNo',
-          label: '批次号',
+          minWidth: 120,
+          prop: 'sampleQuantity',
           align: 'center',
-          width: '120',
+          label: '样品数',
+          formatter: (row) => {
+            if (row.sampleQuantity) {
+              return (
+                row.sampleQuantity + this.sourceData2[0]?.measureUnit || ''
+              );
+            }
+          },
           showOverflowTooltip: true
         },
         {
-          prop: 'weight',
-          label: '重量',
+          minWidth: 120,
+          prop: 'qualifiedQuantity',
           align: 'center',
-          width: '120',
+          label: '合格数',
+          formatter: (row) => {
+            if (row.qualifiedQuantity) {
+              return (
+                row.qualifiedQuantity + this.sourceData2[0]?.measureUnit || ''
+              );
+            }
+          },
           showOverflowTooltip: true
         },
         {
-          prop: 'weightUnit',
-          label: '重量单位',
+          minWidth: 130,
+          prop: 'noQualifiedQuantity',
           align: 'center',
-          width: '120',
+          label: '不合格数',
+          formatter: (row) => {
+            if (row.noQualifiedQuantity) {
+              return (
+                row.noQualifiedQuantity + this.sourceData2[0]?.measureUnit || ''
+              );
+            }
+          },
           showOverflowTooltip: true
         },
         {
-          prop: 'engrave',
-          label: '刻码',
-          align: 'center'
+          minWidth: 140,
+          prop: 'lossNumber',
+          align: 'center',
+          label: '损耗数(合格品)',
+          formatter: (row) => {
+            if (row.lossNumber) {
+              return row.lossNumber + this.sourceData2[0]?.measureUnit || '';
+            }
+          },
+          showOverflowTooltip: true
         },
-        { label: '计量数量', prop: 'measureQuantity', align: 'center' },
-        { label: '计量单位', prop: 'measureUnit', align: 'center' },
         {
-          prop: 'produceRoutingName',
-          label: '工艺路线',
-          align: 'center'
+          minWidth: 150,
+          prop: 'lossNumberUnqualified',
+          align: 'center',
+          label: '损耗数(不合格品)',
+          formatter: (row) => {
+            if (row.lossNumberUnqualified) {
+              return (
+                row.lossNumberUnqualified + this.sourceData2[0]?.measureUnit ||
+                ''
+              );
+            }
+          },
+          showOverflowTooltip: true
         },
         {
-          prop: 'produceTaskName',
-          label: '工序',
-          align: 'center'
+          minWidth: 140,
+          prop: 'retainedSampleQuantity',
+          align: 'center',
+          label: '留样数(合格品)',
+          formatter: (row) => {
+            if (row.retainedSampleQuantity) {
+              return (
+                row.retainedSampleQuantity + this.sourceData2[0]?.measureUnit ||
+                ''
+              );
+            }
+          },
+          showOverflowTooltip: true
         },
         {
-          prop: 'unqualifiedReason',
-          label: '原因',
-          align: 'center'
+          minWidth: 150,
+          prop: 'retainedSampleUnqualified',
+          align: 'center',
+          label: '留样数(不合格品)',
+          formatter: (row) => {
+            if (row.retainedSampleUnqualified) {
+              return (
+                row.retainedSampleUnqualified +
+                  this.sourceData2[0]?.measureUnit || ''
+              );
+            }
+          },
+          showOverflowTooltip: true
         },
         {
-          prop: 'disposeTime',
-          label: '处置时间',
+          minWidth: 150,
+          prop: 'experimentCode',
+          slot: 'experimentCode',
           align: 'center',
-          width: '180',
+          label: '实验编号',
           showOverflowTooltip: true
         },
         {
-          prop: 'disposalStatus',
-          label: '处置状态',
+          label: '质检状态',
+          prop: 'status',
           align: 'center',
-          width: '120',
           showOverflowTooltip: true,
-          formatter: (row, column, cellValue) => {
-            return disposalStatustList[cellValue ? cellValue : 0];
+          show: this.form.recordingMethod == 1,
+          formatter: (row) => {
+            return inspectionProjectStatus.find(
+              (item) => item.value == row.status
+            )?.label;
           }
         },
         {
-          prop: 'disposeType',
-          label: '处置类型',
+          label: '质检结果',
+          prop: 'qualityResults',
           align: 'center',
-          width: '120',
+          show: this.form.recordingMethod == 1,
           showOverflowTooltip: true,
-          formatter: (_row) => {
-            return this.disposeTypeMap[_row.disposeType];
+          formatter: (row, column, cellValue) => {
+            return qualityResultList[cellValue];
           }
         }
-      ]
-    };
+      ];
+    }
+  },
+  methods: {
+    //样品数操作
+    isSampleQuantity(item, index) {
+      // this.resetData(item, index, ['qualifiedQuantity', 'noQualifiedQuantity']);
+      if (Number(item.sampleQuantity) > this.getSampleQuantityCount) {
+        this.$message.error('样品数量不能大于当前质检剩余样品数');
+        this.$set(
+          this.tableData[index],
+          'sampleQuantity',
+          this.getSampleQuantityCount
+        );
+      }
+      this.$set(
+        this.tableData[index],
+        'qualifiedQuantity',
+        item.sampleQuantity
+      );
+      this.isQualifiedQuantity(item, index, 'qualifiedQuantity');
+    },
+    //合格/不合格数操作
+    isQualifiedQuantity(item, index, key) {
+      if (Number(item[key]) > Number(item.sampleQuantity)) {
+        this.$message.error(
+          (key == 'qualifiedQuantity' ? '合格' : '不合格') +
+            '数量不能大于样品数'
+        );
+        this.$set(this.tableData[index], key, item.sampleQuantity);
+      }
+      this.$set(
+        this.tableData[index],
+        key == 'qualifiedQuantity'
+          ? 'noQualifiedQuantity'
+          : 'qualifiedQuantity',
+        item.sampleQuantity - item[key]
+      );
+
+      this.resetData(item, index);
+    },
+
+    //留样、损耗逻辑
+    setNumber(item, index, key, title, keyName) {
+      let keyObj = {
+        key: key == keyName ? 'qualifiedQuantity' : 'noQualifiedQuantity',
+        title: key == keyName ? '合格数' : '不合格数',
+        title1: title == '留样' ? '损耗' : '留样',
+        numTotal:
+          key == keyName
+            ? Number(item.lossNumber) + Number(item.retainedSampleQuantity)
+            : Number(item.lossNumberUnqualified) +
+              Number(item.retainedSampleUnqualified)
+      };
+
+      if (Number(item[key]) > Number(item[keyObj.key])) {
+        this.$message.error(
+          title + keyObj.title + '不能大于样品' + keyObj.title
+        );
+        this.$set(this.tableData[index], key, 0);
+      }
+      if (keyObj.numTotal > item[keyObj.key]) {
+        this.$message.error(
+          title +
+            keyObj.title +
+            '与' +
+            keyObj.title1 +
+            keyObj.title +
+            '之和' +
+            '不能大于样品' +
+            keyObj.title
+        );
+        this.$set(this.tableData[index], key, 0);
+      }
+      if (item[key] - (this.curretNum || 0) > this.getSampleQuantityCount) {
+        this.$message.error(
+          title + keyObj.title + '不能大于当前质检剩余样品数'
+        );
+        this.$set(this.tableData[index], key, 0);
+      }
+      this.curretNum = this.tableData[index][key];
+      this.initData();
+    },
+
+    //重置数据
+    resetData(item, index, addResetData = []) {
+      [...this.keyArr, ...addResetData].forEach((key) => {
+        this.$set(this.tableData[index], key, 0);
+      });
+      this.initData();
+    },
+    initData() {
+      this.keyArr.forEach((key) => {
+        this.$set(this.form, key, 0);
+      });
+      this.tableData.forEach((item, index) => {
+        this.keyArr.forEach((key) => {
+          this.form[key] = this.form[key] * 100;
+          this.form[key] += Number(item[key] * 100) || 0;
+          this.form[key] = this.form[key] / 100;
+        });
+      });
+    }
   }
 };

+ 2 - 2
vue.config.js

@@ -32,9 +32,9 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://124.71.68.31:50001',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18086',
-        // target: 'http://192.168.1.251:18186',
+        target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.251:18086', // 开发环境
         // target: 'http://192.168.1.103:18086',192.168.1.116
         // target: 'http://192.168.1.144:18086',