Explorar el Código

批记录新增首件两检,修复首件两检报工质检项选择不合格不能重新提交的问题

695593266@qq.com hace 6 meses
padre
commit
fc1da4d6eb

+ 12 - 0
src/api/produce/qualityInspection.js

@@ -58,3 +58,15 @@ export async function specialInspectionReport(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//批记录列表
+export async function getBatchRecordList(params) {
+  const res = await request.post(
+    `/mes/firstarticledualinspectionrecord/batchRecordPage`,
+    params
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 229 - 0
src/views/batchRecord/components/tables/qualityInspection.vue

@@ -0,0 +1,229 @@
+<template>
+  <div>
+    <seek-page :seekList="seekList" @search="search"></seek-page>
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :datasource="datasource"
+      :cache-key="cacheKeyUrl"
+      :needPage="false"
+      height="calc(86vh - 230px)"
+    >
+      <template v-slot:selfCheck="{ row }">
+        <el-button
+          type="primary"
+          v-if="row.status == 2 || row.status == 3"
+          @click="reportClick(row, 1, 'detail')"
+          >详情</el-button
+        >
+      </template>
+
+      <template v-slot:specialInspection="{ row }">
+        <el-button
+          type="primary"
+          v-if="row.status == 3"
+          @click="reportClick(row, 2, 'detail')"
+          >详情</el-button
+        >
+      </template>
+
+      <template v-slot:status="{ row }">
+        <el-tag v-if="row.status == 0">待自检</el-tag>
+        <el-tag v-if="row.status == 2">待专检</el-tag>
+        <el-tag v-if="row.status == 3">已完成</el-tag>
+      </template>
+    </ele-pro-table>
+
+    <self-inspection-reporting
+      ref="selfReportingRef"
+      @refreshData="reload"
+    ></self-inspection-reporting>
+  </div>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+  import selfInspectionReporting from '@/views/produce/components/qualityInspection/components/selfInspectionReporting.vue';
+  import { getBatchRecordList } from '@/api/produce/qualityInspection';
+  import { produceTask } from '@/api/InTheSystem/index';
+  export default {
+    mixins: [dictMixins, tableColumnsMixin],
+
+    components: {
+      selfInspectionReporting
+    },
+
+    props: {
+      tableQuery: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      }
+    },
+    data() {
+      return {
+        columns: [
+          {
+            width: 50,
+            type: 'index',
+            columnKey: 'index',
+            label: '序号',
+            align: 'center'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'workstationName',
+            label: '工位名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+
+          {
+            prop: 'deviceName',
+            label: '设备名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+
+          {
+            prop: 'produceTaskName',
+            label: '工序名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+
+          {
+            prop: 'selfCheckUserName',
+            label: '自检报工人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'selfCheckTime',
+            label: '自检时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+
+          {
+            prop: 'specialCheckUserName',
+            label: '专检报工人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+
+          {
+            prop: 'specialCheckTime',
+            label: '专检时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+
+          {
+            prop: 'status',
+            slot: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            label: '自检报工',
+            align: 'center',
+            width: 150,
+            fixed: 'right',
+            slot: 'selfCheck'
+          },
+          {
+            label: '专检报工',
+            align: 'center',
+            width: 150,
+            fixed: 'right',
+            slot: 'specialInspection'
+          }
+        ],
+        cacheKeyUrl: 'batchRecord-qualityInspection-2025-12-17',
+        routList: []
+      };
+    },
+
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '工序:',
+            value: 'produceTaskId',
+            type: 'select',
+            placeholder: '请选择',
+            planList: this.routList
+          }
+        ];
+      }
+    },
+
+    created() {
+      this.getTaskList();
+    },
+
+    methods: {
+      reload(where = {}) {
+        this.$refs.table.reload({
+          where,
+          ...this.tableQuery
+        });
+      },
+
+      async getTaskList() {
+        let params = {
+          pageNum: 1,
+          size: -1
+        };
+        await produceTask(params).then((res) => {
+          this.routList = res.list.map((item) => {
+            return {
+              label: item.name,
+              value: item.id
+            };
+          });
+        });
+      },
+
+      search(where) {
+        this.reload(where);
+      },
+
+      datasource({ page, limit, where, order }) {
+        // 参数
+        const body = {
+          ...where,
+          ...order,
+          pageNum: page,
+          size: limit,
+          ...this.tableQuery
+        };
+        return getBatchRecordList(body);
+      },
+
+      reportClick(row, type, mode) {
+        this.$refs.selfReportingRef.open(row, type, mode);
+      }
+    }
+  };
+</script>
+
+<style></style>

+ 7 - 1
src/views/batchRecord/index.vue

@@ -203,6 +203,7 @@
   import batchRecordTable from './components/tables/batchRecordTable.vue';
   import deviceBatchRecordTable from './components/tables/deviceBatchRecordTable.vue';
   import craftFilesTable from './components/tables/craftFilesTable.vue';
+  import qualityInspection from './components/tables/qualityInspection.vue';
 
   export default {
     components: {
@@ -215,7 +216,8 @@
       wmsOutInt,
       batchRecordTable,
       deviceBatchRecordTable,
-      craftFilesTable
+      craftFilesTable,
+      qualityInspection
     },
     name: 'batchRecord',
     mixins: [dictMixins, tableColumnsMixin],
@@ -257,6 +259,10 @@
           {
             name: '工艺文件',
             componentName: 'craftFilesTable'
+          },
+          {
+            name: '首件两检',
+            componentName: 'qualityInspection'
           }
         ],
         activeType: '生产工单',

+ 92 - 11
src/views/produce/components/qualityInspection/components/selfInspectionReporting.vue

@@ -530,37 +530,118 @@
         });
       },
 
+      // applyStatus(actionType) {
+      //   if (actionType !== 1) return;
+
+      //   const statusMap = {
+      //     1: { form: 2, item: 2 },
+      //     2: { form: 3, item: 3 }
+      //   };
+
+      //   const config = statusMap[this.type];
+      //   if (!config) return;
+
+      //   this.form.status = config.form;
+      //   this.form.items.forEach((item) => {
+      //     item.status = config.item;
+      //   });
+      // },
+
       applyStatus(actionType) {
         if (actionType !== 1) return;
 
-        const statusMap = {
-          1: { form: 2, item: 2 },
-          2: { form: 3, item: 3 }
+        const map = {
+          1: {
+            resultField: 'selfCheckResult',
+            itemStatus: 2,
+            formStatus: 2
+          },
+          2: {
+            resultField: 'specialCheckResult',
+            itemStatus: 3,
+            formStatus: 3
+          }
         };
 
-        const config = statusMap[this.type];
+        const config = map[this.type];
         if (!config) return;
 
-        this.form.status = config.form;
+        const { resultField, itemStatus, formStatus } = config;
+
         this.form.items.forEach((item) => {
-          item.status = config.item;
+          if (item[resultField] === 1) {
+            item.status = itemStatus;
+          }
         });
+
+        const allPass = this.form.items.every(
+          (item) => item[resultField] === 1
+        );
+
+        if (allPass) {
+          this.form.status = formStatus;
+        }
       },
 
+      // validateCheckResult() {
+      //   const map = {
+      //     1: ['selfCheckResult', '请填写完整自检结果后再提交'],
+      //     2: ['specialCheckResult', '请填写完整专检结果后再提交']
+      //   };
+
+      //   const config = map[this.type];
+      //   if (!config) return true;
+
+      //   const [field, msg] = config;
+      //   if (this.form.items.some((item) => !item[field])) {
+      //     this.$message.warning(msg);
+      //     return false;
+      //   }
+      //   return true;
+      // },
+
       validateCheckResult() {
         const map = {
-          1: ['selfCheckResult', '请填写完整自检结果后再提交'],
-          2: ['specialCheckResult', '请填写完整专检结果后再提交']
+          1: {
+            field: 'selfCheckResult',
+            checkStatus: 0,
+            entrustStatus: 1
+          },
+          2: {
+            field: 'specialCheckResult',
+            checkStatus: 2,
+            entrustStatus: 1
+          }
         };
 
         const config = map[this.type];
         if (!config) return true;
 
-        const [field, msg] = config;
-        if (this.form.items.some((item) => !item[field])) {
-          this.$message.warning(msg);
+        const { field, checkStatus, entrustStatus } = config;
+        const hasEntrustPending = this.form.items.some(
+          (item) =>
+            item.status === entrustStatus &&
+            (item[field] === null || item[field] === undefined)
+        );
+
+        if (hasEntrustPending) {
+          this.$message.warning('请托结果还没有返回');
+          return false;
+        }
+
+        const checkItems = this.form.items.filter(
+          (item) => item.status === checkStatus
+        );
+
+        if (checkItems.some((item) => item[field] == null)) {
+          this.$message.warning(
+            this.type === 1
+              ? '请填写完整自检结果后再提交'
+              : '请填写完整专检结果后再提交'
+          );
           return false;
         }
+
         return true;
       },
 

+ 6 - 17
src/views/produce/index.vue

@@ -921,28 +921,17 @@
           };
 
           // const result = await this.checkQualityResult();
+          // if (!result) return;
 
-          // this.isFinalCheckProduction =
-          //   typeof result.firstArticleDualInspectionResult === 'boolean'
-          //     ? result.firstArticleDualInspectionResult
-          //     : true;
+          // const firstArticleResult =
+          //   result.firstArticleDualInspectionResult ?? true;
 
-          // if (!result.firstArticleDualInspectionResult) {
+          // this.isFinalCheckProduction = firstArticleResult;
+
+          // if (!firstArticleResult) {
           //   return this.$message.warning('请完成首件两检再报工!');
           // }
 
-          const result = await this.checkQualityResult();
-          if (!result) return;
-
-          const firstArticleResult =
-            result.firstArticleDualInspectionResult ?? true;
-
-          this.isFinalCheckProduction = firstArticleResult;
-
-          if (!firstArticleResult) {
-            return this.$message.warning('请完成首件两检再报工!');
-          }
-
           if (
             this.taskObj.type == 2 ||
             this.taskObj.type == 3 ||

+ 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',