Ver Fonte

质检工单新增详情页 质检工单跟质检计划可以选择工序

jingshuyong há 10 meses atrás
pai
commit
a74f4a6ef8

+ 8 - 0
src/api/inspectionPlan/index.js

@@ -204,3 +204,11 @@ export async function retractPlan(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 查询计划详情
+export async function planDetails(id) {
+  const res = await request.get(`/qms/quality_plan/getDetailByld/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 9 - 0
src/api/inspectionWork/index.js

@@ -38,6 +38,15 @@ export async function getById(id) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 查询工单详情
+export async function getDetailById(id) {
+  const res = await request.get(`/qms/quality_work_order/getDetailById/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // 新增合格证
 export async function qualificationSave(data) {
   const res = await request.post(`/qms/qualityWorkOrderCertificate/save`, data);

+ 9 - 0
src/api/main/index.js

@@ -48,4 +48,13 @@ export async function queryProportionDefectiveTypes () {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
+}
+
+//获取系统参数
+export async function parameterGetByCode(data) {
+  const res = await request.post('/sys/parameter/getByCode', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
 }

+ 35 - 4
src/views/inspectionPlan/components/baseInfo.vue

@@ -266,8 +266,25 @@
           </el-form-item>
         </el-col>
         <el-col :span="6">
-          <el-form-item label="工序:" prop="produceTaskName">
+          <!-- <el-form-item label="工序:" prop="produceTaskName">
             <el-input v-model="form.produceTaskName" disabled />
+          </el-form-item> -->
+          <el-form-item label="工序:">
+            <el-select
+              style="width: 100%"
+              v-model="form.produceTaskId"
+              placeholder="请选择"
+              clearable
+              @change="produceTaskChange"
+              :disabled="btnType == 'detail'"
+            >
+              <el-option
+                v-for="item in produceTaskList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </el-select>
           </el-form-item>
         </el-col>
       </el-row>
@@ -383,7 +400,7 @@
   import { rules } from 'eslint-config-prettier';
 
   import { getDetailInfo } from '@/api/inspectionPlan/index.js';
-
+  import { getProduceTaskList } from '@/api/aps';
   export default {
     components: {
       EquipmentDialog,
@@ -596,7 +613,8 @@
         isInfoChangeType: true,
         isInfoChangeModel: true,
         isOnce: true,
-        isListData: [{}]
+        isListData: [{}],
+        produceTaskList: []
       };
     },
     created() {
@@ -605,6 +623,19 @@
       console.log(this.form);
     },
     methods: {
+      // 获取工序数据
+      async getTaskList() {
+        if (!this.form.produceRoutingId) {
+          return;
+        }
+        const res = await getProduceTaskList({
+          isDetail: true,
+          pageNum: 1,
+          routingId: this.form.produceRoutingId,
+          size: -1
+        });
+        this.produceTaskList = res?.list;
+      },
       toggleExpand(val) {
         this.isExpanded = !this.isExpanded;
       },
@@ -841,7 +872,7 @@
         const data = await getDetailInfo(val);
         this.categoryInfo = data.category;
         const qmsData = data.categoryQms;
-        console.log(qmsData,'qmsData qmsDataqmsData 3333')
+        console.log(qmsData, 'qmsData qmsDataqmsData 3333');
         // *** 新增 批次号,来源单据 字段传递
         console.log(this.categoryInfo.measureType, 'getProductDetails');
         this.form.inspectionStandards = this.categoryInfo.measureType;

+ 78 - 26
src/views/inspectionPlan/components/new-baseInfo.vue

@@ -266,13 +266,39 @@
             </el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
-          <el-form-item label="工序:" prop="produceTaskName">
+        <el-col :span="6" v-if="parseInt(form.type) == 2">
+          <!-- <el-form-item label="工序:" prop="produceTaskName">
             <el-input v-model="form.produceTaskName" disabled />
+          </el-form-item> -->
+          <el-form-item label="工艺路线:">
+            <el-input
+              @click.native="openVersion"
+              clearable
+              v-model="form.produceRoutingName"
+              :disabled="btnType == 'detail'"
+              placeholder="请选择"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6" v-if="parseInt(form.type) == 2">
+          <el-form-item label="工序:">
+            <el-select
+              style="width: 100%"
+              v-model="form.produceTaskId"
+              placeholder="请选择"
+              clearable
+              @change="produceTaskChange"
+              :disabled="btnType == 'detail'"
+            >
+              <el-option
+                v-for="item in produceTaskList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </el-select>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row>
         <el-col :span="6">
           <el-form-item label="合格品数量:" prop="qualifiedNumber">
             <el-input type="number" v-model="form.qualifiedNumber" disabled>
@@ -304,23 +330,6 @@
             </el-input>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row>
-        <!-- <el-col :span="6" v-if="form.qualityMode == 2">
-          <el-form-item label="取样数量:" prop="sampleNumber" :rules="{
-            required: form.qualityMode == 2 ? true : false,
-            message: '请输入取样数量',
-            trigger: 'blur'
-          }">
-            <div style="display: flex;align-items: center;justify-content: space-between;">
-              <el-input type="number" v-model="form.sampleNumber" disabled style="width: calc(100% - 90px)">
-              </el-input>
-              <DictSelection dictName="计量单位" clearable v-model="form.sampleMeasureUnit" disabled size="mini"
-                style="width: 90px;margin-left: 12px;">
-              </DictSelection>
-            </div>
-          </el-form-item>
-        </el-col>-->
         <el-col :span="6">
           <el-form-item label="抽样比例:" prop="sampleProportion">
             <el-input
@@ -415,12 +424,13 @@
     />
     <!-- 成品检验 -->
     <stokledger ref="stokledgerRef" @choose="handleStokledgerChoose" />
+    <ProductionVersion ref="versionRefs" @changeProduct="changeProduct" />
   </el-form>
 </template>
 <script>
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
   import fileUpload from '@/components/addDoc/index.vue';
-
+  import ProductionVersion from '@/views/inspectionWork/components/ProductionVersion.vue';
   import warehousing from './warehousing';
   import productionPlan from './productionPlan';
   import workOrder from './workOrder';
@@ -436,7 +446,7 @@
   import { getDetailInfo } from '@/api/inspectionPlan/index.js';
 
   import { getQualityTemplateList } from '@/api/inspectionPlan/index.js';
-
+  import { getProduceTaskList } from '@/api/aps';
   export default {
     components: {
       EquipmentDialog,
@@ -446,7 +456,8 @@
       warehousing,
       deptSelect,
       fileUpload,
-      stokledger
+      stokledger,
+      ProductionVersion
     },
     props: {
       form: {
@@ -563,7 +574,8 @@
         isInfoChangeType: true,
         isInfoChangeModel: true,
         isOnce: true,
-        isListData: [{}]
+        isListData: [{}],
+        produceTaskList: []
       };
     },
     created() {
@@ -571,6 +583,40 @@
       this.getDictListIqoCode('measurement_type');
     },
     methods: {
+      // 打开工艺路线弹窗
+      openVersion() {
+        this.$refs.versionRefs.open();
+      },
+      //工艺路线回调
+      changeProduct(data) {
+        this.form.produceRoutingId = data.id;
+        this.form.produceRoutingName = data.name;
+        this.form.produceTaskId = '';
+        this.form.produceTaskName = '';
+        this.getTaskList();
+      },
+      // 获取工序数据
+      async getTaskList() {
+        if (!this.form.produceRoutingId) {
+          return;
+        }
+        const res = await getProduceTaskList({
+          isDetail: true,
+          pageNum: 1,
+          routingId: this.form.produceRoutingId,
+          size: -1
+        });
+        this.produceTaskList = res?.list;
+      },
+      // 选择工序
+      produceTaskChange(e) {
+        this.$set(this.form, 'produceTaskId', e);
+        this.form.produceTaskName = this.produceTaskList.find(
+          (item) => item.id == e
+        ).name;
+        this.$forceUpdate();
+        console.log(this.form, '000000000');
+      },
       toggleExpand(val) {
         this.isExpanded = !this.isExpanded;
       },
@@ -654,6 +700,12 @@
       },
       //根据类型获取计划来源下拉
       typeChange(val, type) {
+        if (val != 2) {
+          this.form.produceRoutingId = '';
+          this.form.produceRoutingName = '';
+          this.form.produceTaskId = '';
+          this.form.produceTaskName = '';
+        }
         if (val == 1 || val == 6) {
           this.sourceList = [{ label: '采购收货单', value: '1' }];
         } else if (val == 2) {
@@ -688,7 +740,7 @@
         this.form.isConsumable = val.isConsumable; //0 单件 1 批量
         this.form.productId = val.id;
         this.form.netWeight = val.netWeight; //净重
-        console.log(this.form,'00000000000000000')
+        console.log(this.form, '00000000000000000');
         // console.log(this.form.type)
         console.log('----------------->>>>');
         this.getProductDetails(this.form.productId);

+ 2 - 0
src/views/inspectionPlan/components/new-edit.vue

@@ -1205,6 +1205,8 @@
           //操作行点击时查询质检
           await this.getTemplateList(row.id);
         }
+
+        console.log(this.baseForm,'00000000')
       },
       reload(where) {
         this.$nextTick(() => {

+ 9 - 0
src/views/inspectionPlan/index.vue

@@ -437,6 +437,15 @@
           });
           this.qualityMode = list;
         }
+      },
+            // 打开详情
+      openDetails(row) {
+        console.log(row, 'row 000');
+        let id = row.id;
+        this.$router.push({
+          path: '/inspectionWork/details',
+          query: { id, path: '/inspectionPlan', name: '计划' }
+        });
       }
     }
   };

+ 48 - 29
src/views/inspectionWork/components/baseInfo.vue

@@ -159,32 +159,38 @@
         </el-col>
       </el-row>
       <el-row>
-        <!-- <el-col :span="6">
-          <el-form-item label="合格数:" prop="qualifiedNumber">
+        <el-col :span="6">
+          <el-form-item
+            label="合格数:"
+            prop="qualifiedNumber"
+            v-if="showArrange == '1'"
+          >
             <el-input
               type="number"
               :min="0"
-              disabled
               @input="limitation('qualifiedNumber')"
-              @blur="quantityCalculation"
+              @blur="quantityCalculation('qualifiedNumber')"
               v-model="form.qualifiedNumber"
               placeholder="请输入"
             ></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="6">
-          <el-form-item label="不合格数:" prop="noQualifiedNumber">
+          <el-form-item
+            label="不合格数:"
+            prop="noQualifiedNumber"
+            v-if="showArrange == '1'"
+          >
             <el-input
               type="number"
               :min="0"
-              disabled
               @input="limitation('noQualifiedNumber')"
-              @blur="quantityCalculation"
+              @blur="quantityCalculation('noQualifiedNumber')"
               v-model="form.noQualifiedNumber"
               placeholder="请输入"
             ></el-input>
           </el-form-item>
-        </el-col> -->
+        </el-col>
         <el-col :span="6">
           <el-form-item label="合格率:" prop="qualificationRate">
             <el-input v-model="form.qualificationRate" disabled />
@@ -224,15 +230,14 @@
               v-model="form.qualityResults"
               placeholder="请选择"
               style="width: 100%"
-              disabled
+              :disabled="showArrange == '0'"
             >
               <el-option label="合格" :value="1" />
               <el-option label="不合格" :value="2" />
             </el-select>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row>
+
         <el-col :span="6">
           <el-form-item label="总重量:" prop="totalWeight">
             <el-input
@@ -252,7 +257,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="12">
+        <el-col :span="showArrange == '1' ? 24 : 12">
           <el-form-item label="备注:" prop="remark">
             <el-input
               type="textarea"
@@ -303,8 +308,7 @@
             ></el-input>
           </el-form-item>
         </el-col> -->
-      </el-row>
-      <el-row>
+
         <el-col :span="6" v-if="parseInt(qualityType1) == 2">
           <el-form-item label="工艺路线:">
             <el-input
@@ -382,7 +386,7 @@
 
   import { getProduceTaskList } from '@/api/aps';
   import { getByCode } from '@/api/system/dictionary-data';
-
+  import { parameterGetByCode } from '@/api/main/index';
   export default {
     components: {
       EquipmentDialog,
@@ -476,33 +480,48 @@
         produceTaskList: [],
         inspectionStandardsList: [],
         qualityModeList: [],
-        isExpanded: false
+        isExpanded: false,
+        showArrange: '1'
       };
     },
     created() {
       this.getDictListIqoCode('measurement_type');
       this.getQualityModeList('quality_method_code');
+      // 是否展示合格不合格
+      this.getCode();
     },
     methods: {
+      getCode() {
+        parameterGetByCode({
+          code: 'qms_show_arrange'
+        }).then((res) => {
+          if (res) {
+            this.showArrange = res.value || '1';
+            // this.time_calc_code = res.value || '0';
+          }
+        });
+      },
       // *** 只能输入大于0的数字
       limitation(val) {
         this.form[val] =
           this.form[val].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
       },
       // *** 计算合格数 不合格数
-      quantityCalculation() {
-        // let qualifiedNumber = this.form.qualifiedNumber - 0;
-        // let noQualifiedNumber = this.form.noQualifiedNumber - 0;
-        // let total = qualifiedNumber + noQualifiedNumber;
-        // let passRate = ((qualifiedNumber / total) * 100).toFixed(2);
-        // let failureRate = ((noQualifiedNumber / total) * 100).toFixed(2);
-        // this.form.qualificationRate = passRate + '%';
-        // this.form.noQualificationRate = failureRate + '%';
-        // if (total != this.form.total) {
-        //   this.$message.warning('合格数加上不合格数需要等于总数量');
-        //   return false;
-        // }
-        // return true;
+      quantityCalculation(e) {
+        let qualifiedNumber = this.form.qualifiedNumber - 0;
+        let noQualifiedNumber = this.form.noQualifiedNumber - 0;
+        let total = qualifiedNumber + noQualifiedNumber;
+        if (total != this.form.total) {
+          let val =
+            e == 'qualifiedNumber' ? 'noQualifiedNumber' : 'qualifiedNumber';
+          this.$message.warning('合格数加上不合格数需要等于总数量');
+          this.form[e] = this.form.total - this.form[val];
+          return false;
+        }
+        let passRate = ((qualifiedNumber / total) * 100).toFixed(2);
+        let failureRate = ((noQualifiedNumber / total) * 100).toFixed(2);
+        this.form.qualificationRate = passRate + '%';
+        this.form.noQualificationRate = failureRate + '%';
         return true;
       },
 

+ 326 - 0
src/views/inspectionWork/details.vue

@@ -0,0 +1,326 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" class="tabs_box">
+      <el-tabs v-model="activeName" type="card">
+        <el-tab-pane label="基本信息" name="1">
+          <el-form ref="form1" :model="form" label-width="94px">
+            <el-row>
+              <el-col
+                :span="item.span"
+                v-for="(item, index) in infoList"
+                :key="index"
+              >
+                <el-form-item :label="`${item.label}:`">
+                  <el-input :value="form[item.prop]" disabled />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="样品数">
+                  <el-input :value="form.sampleQuantity" disabled />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="合格数">
+                  <el-input :value="form.qualifiedNumber" disabled />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="不合格数">
+                  <el-input :value="form.noQualifiedNumber" disabled />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6" v-for="el in disposeTypeList">
+                <el-form-item :label="disposalName(el.disposeType)">
+                  <el-input :value="el.measureQuantity" disabled />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="备注">
+                  <el-input :value="form.remark" disabled />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-tab-pane>
+        <el-tab-pane label="样品信息" name="2">
+          <el-form label-width="110px">
+            <el-row>
+              <el-col :span="6" v-if="showArrange == '1'">
+                <el-form-item label="样品合格数:">
+                  <el-input
+                    disabled
+                    v-model="form.sampleQualifiedNumber"
+                  ></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6" v-if="showArrange == '1'">
+                <el-form-item label="样品不合格数:">
+                  <el-input
+                    disabled
+                    v-model="form.sampleNoQualifiedNumber"
+                  ></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="样品合格率:">
+                  <el-input v-model="form.sampleQualificationRate" disabled />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="样品不合格率:">
+                  <el-input v-model="form.sampleNoQualificationRate" disabled />
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row>
+              <el-col :span="6">
+                <el-form-item label="样品类型:">
+                  <el-input
+                    disabled
+                    :value="sampletypeVal(form.conditionType)"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="样品数量:">
+                  <el-input disabled v-model="form.sampleQuantity" />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="样品重量:">
+                  <el-input disabled v-model="form.sampleWeight" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-tab-pane>
+        <el-tab-pane label="质检内容" name="3">
+          <el-tabs v-model="inspectionName">
+            <el-tab-pane label="来源清单" name="1">
+              <ele-pro-table
+                :columns="tableColumns1"
+                :datasource="sourceData1"
+                :initLoad="false"
+                :needPage="false"
+                :toolkit="[]"
+                height="calc(100vh - 330px)"
+              >
+              </ele-pro-table>
+            </el-tab-pane>
+            <el-tab-pane label="样品清单" name="2">
+              <ele-pro-table
+                :columns="tableColumns2"
+                :datasource="sourceData2"
+                :initLoad="false"
+                :needPage="false"
+                :toolkit="[]"
+                height="calc(100vh - 330px)"
+              >
+              </ele-pro-table
+            ></el-tab-pane>
+            <el-tab-pane label="质检方案" name="3">
+              <ele-pro-table
+                :columns="tableColumns3"
+                :datasource="sourceData3"
+                :initLoad="false"
+                :needPage="false"
+                :toolkit="[]"
+                height="calc(100vh - 330px)"
+              >
+              </ele-pro-table
+            ></el-tab-pane>
+          </el-tabs>
+        </el-tab-pane>
+        <el-tab-pane label="样品处置" name="4">
+          <ele-pro-table
+            :columns="tableColumns4"
+            :datasource="sourceData4"
+            :initLoad="false"
+            :needPage="false"
+            :toolkit="[]"
+            height="calc(100vh - 260px)"
+          >
+          </ele-pro-table>
+        </el-tab-pane>
+        <el-tab-pane label="不良品处置" name="5">
+          <ele-pro-table
+            :columns="tableColumns5"
+            :datasource="sourceData5"
+            :initLoad="false"
+            :needPage="false"
+            :toolkit="[]"
+            height="calc(100vh - 260px)"
+          >
+          </ele-pro-table>
+        </el-tab-pane>
+      </el-tabs>
+      <el-button class="go_back" @click="goBack">返回</el-button>
+    </el-card>
+  </div>
+</template>
+
+<script>
+  import { getDetailById } from '@/api/inspectionWork/index';
+  import { planDetails } from '@/api/inspectionPlan/index'
+  import { getByCode } from '@/api/system/dictionary-data';
+  import detailMixins from './mixins/detailMixins';
+    import { parameterGetByCode } from '@/api/main/index';
+  export default {
+    mixins: [detailMixins],
+    data() {
+      return {
+        activeName: '1',
+        inspectionName: '1',
+        sourceData1: [],
+        sourceData2: [],
+        sourceData3: [],
+        sourceData4: [],
+        sourceData5: [],
+        disposeTypeList: [],
+        form: {},
+        showArrange:'0'
+      };
+    },
+    computed: {
+      sampletypeVal() {
+        return (row) => {
+          if (row == 1) return '整样';
+          if (row == 2) return '小样';
+          return '';
+        };
+      },
+      disposalName() {
+        return (type) => {
+          return this.disposeTypeMap[type] || '';
+        };
+      }
+    },
+    created() {
+      this.getData();
+      // 是否展示合格不合格
+      this.getCode();
+    },
+    methods: {
+      getCode() {
+        parameterGetByCode({
+          code: 'qms_show_arrange'
+        }).then((res) => {
+          if (res) {
+            this.showArrange = res.value || '1';
+            // this.time_calc_code = res.value || '0';
+          }
+        });
+      },
+      async getData() {
+        let id = this.$route.query.id;
+        let name = this.$route.query.name;
+        try {
+          const api = name == '计划' ? planDetails : getDetailById;
+          const result = await api(id);
+          console.log(result,'result')
+          const res = result.data;
+          let obj = {};
+          this.infoList.map((item) => {
+            obj[item.prop] = res[item.prop];
+          });
+          this.form = obj;
+          this.fieldAssign(res, obj);
+          this.sampleInfo(res);
+        } catch (err) {
+          console.log(err,'err')
+        }
+      },
+      sampleInfo(res) {
+        this.$set(
+          this.form,
+          'sampleNoQualifiedNumber',
+          res.sampleNoQualifiedNumber
+        );
+        this.$set(
+          this.form,
+          'sampleQualificationRate',
+          res.sampleQualificationRate
+        );
+        this.$set(
+          this.form,
+          'sampleNoQualificationRate',
+          res.sampleNoQualificationRate
+        );
+        this.$set(this.form, 'conditionType', res.conditionType);
+        this.$set(this.form, 'sampleQuantity', res.sampleQuantity);
+        this.$set(this.form, 'sampleWeight', res.sampleWeight);
+        this.$set(this.form, 'qualifiedNumber', res.qualifiedNumber);
+        this.$set(this.form, 'noQualifiedNumber', res.noQualifiedNumber);
+        this.$set(this.form, 'remark', res.remark);
+        this.sourceData5 = res.unqualifiedDetail || [];
+        this.sourceData4 = res.qualitySampleList || [];
+        this.sourceData2 = res.qualitySampleList || [];
+        this.sourceData3 = res.templateList || [];
+        this.sourceData1 = res.qualityInventoryList || [];
+        this.disposeTypeList = res.disposeTypeList || [];
+      },
+      async fieldAssign(res, obj) {
+        if (res.qualityMode == 1) {
+          obj.qualityModeName = '全检';
+        } else if (res.qualityMode == 2) {
+          obj.qualityModeName = '抽检';
+        } else {
+          obj.qualityModeName = '';
+        }
+        if (res.qualityResults == 1) {
+          obj.qualityResultsName = '全检';
+        } else if (res.qualityResults == 2) {
+          obj.qualityResultsName = '抽检';
+        } else {
+          obj.qualityResultsName = '';
+        }
+        let val = res.inspectionStandards;
+        obj.inspectionStandardsName = await this.getDictListIqoCode(val);
+      },
+      async getDictListIqoCode(value) {
+        let { data: res } = await getByCode('measurement_type');
+        if (value > 0) {
+          return res[value - 1][value];
+        }
+        return '';
+      },
+      goBack() {
+        console.log(this.$route.query, '000000000000');
+        let path = this.$route.query.path || '';
+        if (path) {
+          this.$router.push({ path: '/inspectionWork' });
+        } else {
+          this.$router.go(-1);
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .ele-body {
+    width: 100%;
+    height: calc(100% - 32px);
+    box-sizing: border-box;
+
+    .el-card {
+      width: 100%;
+      height: 100%;
+    }
+  }
+
+  ::v-deep .el-tabs__content {
+    margin-top: 16px;
+  }
+
+  .tabs_box {
+    position: relative;
+
+    .go_back {
+      position: absolute;
+      right: 25px;
+      top: 19px;
+      z-index: 99;
+    }
+  }
+</style>

+ 20 - 26
src/views/inspectionWork/edit.vue

@@ -260,9 +260,8 @@
           if (!newVal || newVal.length == 0) {
             return;
           }
-          console.log('11111111111');
           // 计算重量跟数量
-          this.calculate(newVal);
+          // this.calculate(newVal);
         },
         deep: true,
         immediate: true
@@ -270,7 +269,7 @@
 
       form: {
         handler(newVal) {
-          console.log(newVal,'newVal 新的form')
+          console.log(newVal, 'newVal 新的form');
         },
         deep: true,
         immediate: true
@@ -293,6 +292,7 @@
     methods: {
       //
       calculate(list) {
+        console.log('执行了没')
         if (list.length == 0) {
           this.form.sampleQuantity = 0;
           this.form.sampleWeight = 0;
@@ -310,7 +310,6 @@
             sampleNoQualifiedNumber += el.measureQuantity - 0;
           }
         });
-        console.log(list, 'list 3333');
 
         // 计算合格率和不合格率(百分比形式)
         let sampleQualificationRate = '';
@@ -338,9 +337,9 @@
             sampleNoQualificationRate = sampleNoQualificationRate + '%';
           }
         }
-        console.log(sampleQuantity, 'sampleQuantity 1');
-        console.log(sampleQualifiedNumber, 'sampleQualifiedNumber 2');
+
         let resultsTotal = this.form.total - sampleQuantity;
+        console.log(resultsTotal, 'resultsTotal 3333');
         if (sampleQuantity == sampleQualifiedNumber) {
           this.$set(this.form, 'qualifiedNumber', resultsTotal);
           this.$set(this.form, 'noQualifiedNumber', 0);
@@ -373,8 +372,6 @@
           'sampleNoQualifiedNumber',
           sampleNoQualifiedNumber
         );
-
-        console.log(this.form, '000000000000000000');
       },
       //切换检验方式
       changeModel(val, flag) {
@@ -394,6 +391,7 @@
             this.sampleList = [];
           }
         }
+        this.calculate([]);
       },
       //根据类型判断样品清单现实列表数据
       async getProSamList(list) {
@@ -436,6 +434,7 @@
                   });
                 }
                 this.sampleList = ProductSampleList;
+                this.calculate(this.sampleList);
                 const pNum = ProductSampleList.reduce((sum, item) => {
                   return sum + Number(item.weight || 0);
                 }, 0);
@@ -453,6 +452,7 @@
                   });
                 }
                 this.sampleList = ProductSampleList;
+                this.calculate(this.sampleList);
                 const pNum = ProductSampleList.reduce((sum, item) => {
                   return sum + Number(item.weight || 0);
                 }, 0);
@@ -473,7 +473,6 @@
           const ProductSampleList = [];
 
           for (const oldItem of list) {
-            console.log(oldItem, 'oldItem 0000 进入循环');
             const count = oldItem.measureQuantity ? oldItem.measureQuantity : 1;
             const newMeasureQuantity = oldItem.measureQuantity / count;
             const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
@@ -486,13 +485,11 @@
               delete item.id;
             });
             delete oldItem.id;
-            console.log('----------------------------------', oldItem);
             if (
               oldItem.qualitySampleTemplateList == undefined ||
               oldItem.qualitySampleTemplateList == null ||
               oldItem.qualitySampleTemplateList.length == 0
             ) {
-              console.log('+++++++++++++++++++++++++');
               oldItem.qualitySampleTemplateList = JSON.parse(
                 JSON.stringify(this.schemeList)
               );
@@ -507,14 +504,13 @@
                   )
                 });
               }
-              console.log(ProductSampleList, 'ProductSampleList 123');
               this.sampleList = ProductSampleList;
+              this.calculate(this.sampleList);
               const pNum = ProductSampleList.reduce((sum, item) => {
                 return sum + Number(item.weight || 0);
               }, 0);
               this.form.totalWeight = parseFloat(pNum.toFixed(2));
             } else {
-              console.log('没有质检方法');
               for (let i = 0; i < count; i++) {
                 ProductSampleList.push({
                   ...oldItem,
@@ -526,8 +522,8 @@
                   )
                 });
               }
-              console.log(ProductSampleList, 'ProductSampleList 456');
               this.sampleList = ProductSampleList;
+              this.calculate(this.sampleList);
               const pNum = ProductSampleList.reduce((sum, item) => {
                 return sum + Number(item.weight || 0);
               }, 0);
@@ -549,8 +545,6 @@
         let count = list ? list.length : 0;
         const codeList = await this.batchCodes(count);
         for (const [index, item] of list.entries()) {
-          console.log(index, 'index');
-          console.log(item, 'item');
           const qualitySampleTemplateList = item.qualitySampleTemplateList
             ?.length
             ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
@@ -575,6 +569,7 @@
         }
 
         this.sampleList = dataList;
+        this.calculate(this.sampleList);
         this.sampleNumber = this.sampleList.length;
       },
       // 切换检验方式为全检后生成样品
@@ -636,6 +631,7 @@
             }
           });
           this.sampleList = ProductSampleList;
+          this.calculate(this.sampleList);
           const pNum = ProductSampleList.reduce((sum, item) => {
             return sum + Number(item.weight || 0);
           }, 0);
@@ -876,6 +872,7 @@
         } else if (val == 2) {
           console.log(data, 'datadatadatadataxiaoyang');
         }
+        this.calculate(this.sampleList);
       },
       async handleSampleSubmit(data, specifications) {
         this.sampleList = [];
@@ -923,6 +920,7 @@
           console.error('取样处理失败:', error);
           this.$message.error('取样处理失败');
         }
+        this.calculate(this.sampleList);
       },
       // 当计量类型 是数量的时候 取整样 校验
       validateSampleQuantity(sampleCount, specifications) {
@@ -1047,12 +1045,11 @@
         //   newItem.measureUnit = unit;
         //   return newItem;
         // });
-
+        this.calculate(this.sampleList);
         this.$refs.tabsRef.tabsChange('2');
       },
 
       async getQueryQualityInventory() {
-        console.log(']]]]]]]]]]');
         const res = await queryQualityInventory({
           qualityWorkerId: this.$route.query.id,
           size: -1
@@ -1082,6 +1079,7 @@
         });
         if (addStatus.length > 0) {
           this.sampleList = addStatus;
+          // this.calculate(this.sampleList);
           this.addStatus = addStatus;
         } else {
           this.getProSamList(this.packingList);
@@ -1173,8 +1171,6 @@
         const selectedData = [];
         selectedData.push(this.sampleList[index]);
 
-        console.log(selectedData, 'selectedData');
-
         if (this.schemeList.length != 0) {
           this.sampleList.forEach((item) => {
             if (item.qualitySampleTemplateList.length == 0) {
@@ -1352,6 +1348,7 @@
         } else {
           // this.$set(this.sampleList, null, list);
           this.sampleList = list;
+          this.calculate(this.sampleList);
         }
         this.activeName = '2';
         // *** 选完批量质检调用
@@ -1447,6 +1444,7 @@
         ) {
           this.getProSamList(sData);
         }
+        this.calculate(this.sampleList);
       },
 
       //从来源数组取样到目标数组
@@ -1472,7 +1470,6 @@
 
         const result = [];
         let remainingCount = sampleCount;
-        console.log(remainingCount, 'remainingCount ========');
         let count = Math.ceil(remainingCount);
         const codeList = await this.batchCodes(count);
         let codeIdx = 0;
@@ -1512,7 +1509,6 @@
                 this.form.conditionType == 1 &&
                 this.form.inspectionStandards == 1
               ) {
-                // console.log('进来1', values);
                 result.push({
                   ...item,
                   // measureQuantity: values,
@@ -1525,7 +1521,6 @@
                 (this.form.inspectionStandards == 1 ||
                   this.form.inspectionStandards == 2)
               ) {
-                console.log('进来2');
                 let weight = (item.weight / item.maxPossible).toFixed(2);
                 result.push({
                   ...item,
@@ -1572,6 +1567,7 @@
           this.sampleList = this.sampleList.splice(0, sampleCount);
         }
         this.form.sampleNumber = this.sampleList.length;
+        this.calculate(this.sampleList);
       },
       // 小数点数据判断
       formatNumber(a, b, maxDecimals = 4) {
@@ -1696,7 +1692,6 @@
       },
 
       async handleWeightFullSample(sampleCount, specifications) {
-        console.log('执行没有');
         const dataList = [];
         let currentNum = sampleCount - this.selectedList.length;
         let currentNum1 = sampleCount;
@@ -1747,8 +1742,6 @@
         // 更改 从新计算 样品清单 取整样 数据
         if (specifications && specifications.id) {
           // let proportion = (obj.weight / obj.measureQuantity).toFixed(2);
-          console.log(dataList, 'dataList 这里是重量');
-          console.log(specifications, 'specifications ===');
           dataList.map((el) => {
             el.measureQuantity =
               el.measureQuantity * specifications.packageCellTotal;
@@ -1760,6 +1753,7 @@
         }
         // 更改
         this.sampleList = dataList;
+        this.calculate(this.sampleList);
         this.sampleNumber = this.sampleList.length;
       },
       // 批量生成编码 4444444 getCodeList

+ 10 - 1
src/views/inspectionWork/index.vue

@@ -22,7 +22,7 @@
           <el-link
             type="primary"
             :underline="false"
-            @click="openEdit('detail', row)"
+            @click="openDetails(row)"
             >{{ row.code }}</el-link
           >
         </template>
@@ -507,6 +507,15 @@
           this.$message.error('请到角色管理配置菜单权限!');
         }
       },
+      // 打开详情
+      openDetails(row) {
+        console.log(row, 'row 000');
+        let id = row.id;
+        this.$router.push({
+          path: '/inspectionWork/details',
+          query: { id, path: '/inspectionWork', name: '工单' }
+        });
+      },
       downloadFile(file) {
         getFile({ objectName: file.storePath }, file.name);
       },

+ 669 - 0
src/views/inspectionWork/mixins/detailMixins.js

@@ -0,0 +1,669 @@
+const qualityResultList = { 1: '合格', 2: '不合格' };
+const disposalStatustList = { 0: '待处置', 1: '处置中', 2: '处置完成' };
+export default {
+  data() {
+    return {
+      infoList: [
+        {
+          label: '编码',
+          prop: 'code',
+          span: 6
+        },
+        {
+          label: '产品名称',
+          prop: 'productName',
+          span: 6
+        },
+        {
+          label: '产品编码',
+          prop: 'productCode',
+          span: 6
+        },
+        {
+          label: '批次号',
+          prop: 'batchNo',
+          span: 6
+        },
+        {
+          label: '规格',
+          prop: 'specification',
+          span: 6
+        },
+        {
+          label: '型号',
+          prop: 'modelType',
+          span: 6
+        },
+        {
+          label: '牌号',
+          prop: 'brandNo',
+          span: 6
+        },
+        {
+          label: '计量类型',
+          prop: 'inspectionStandardsName',
+          span: 6
+        },
+        {
+          label: '质检部门',
+          prop: 'groupName',
+          span: 6
+        },
+        {
+          label: '质检人',
+          prop: 'qualityName',
+          span: 6
+        },
+
+        {
+          label: '质检时间',
+          prop: 'qualityTime',
+          span: 6
+        },
+        {
+          label: '工时(h)',
+          prop: 'hours',
+          span: 6
+        },
+        {
+          label: '合格率',
+          prop: 'qualificationRate',
+          span: 6
+        },
+        {
+          label: '不合格率',
+          prop: 'noQualificationRate',
+          span: 6
+        },
+        {
+          label: '检验方式',
+          prop: 'qualityModeName',
+          span: 6
+        },
+
+        {
+          label: '质检结果',
+          prop: 'qualityResultsName',
+          span: 6
+        },
+        {
+          label: '总重量',
+          prop: 'totalWeight',
+          span: 6
+        },
+        {
+          label: '总数量',
+          prop: 'total',
+          span: 6
+        },
+      ],
+      disposeTypeMap: {
+        1: '返工',
+        2: '返修',
+        3: '报废',
+        4: '降级使用',
+        5: '让步接收',
+        6: '留样',
+        7: '消耗',
+        8: '回用/归批',
+        9: '转试销',
+        10: '退货'
+      },
+      tableColumns1: [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          fixed: 'left'
+        },
+        {
+          label: '编码',
+          prop: 'categoryCode',
+          width: 150,
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '名称',
+          prop: 'categoryName',
+          width: '150',
+          align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        {
+          label: '批次号',
+          prop: 'batchNo',
+          align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        {
+          label: '发货条码',
+          prop: 'barcodes',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '包装编码',
+          prop: 'packageNo',
+          align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        { label: '包装数量', prop: 'packingQuantity', align: 'center' },
+        { label: '包装单位', prop: 'packingUnit', align: 'center' },
+        { label: '计量数量', prop: 'measureQuantity', align: 'center' },
+        { label: '计量单位', prop: 'measureUnit', align: 'center' },
+        {
+          label: '物料代号',
+          prop: 'materielDesignation',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '客户代号',
+          prop: 'clientCode',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '供应商名称',
+          prop: 'supplierName',
+          align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        {
+          label: '供应商代号',
+          prop: 'supplierCode',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        { label: '刻码', prop: 'engrave', align: 'center' },
+        { label: '重量', prop: 'weight', align: 'center' },
+        { label: '重量单位', prop: 'weightUnit', align: 'center' },
+        {
+          label: '仓库',
+          prop: 'warehouseName',
+          align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        { label: '货区', prop: 'areaName', align: 'center' },
+        { label: '货架', prop: 'goodsShelfName', align: 'center' },
+        { label: '货位', prop: 'goodsAllocationName', align: 'center' },
+        {
+          label: '生产日期',
+          prop: 'productionDate',
+          align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        },
+        {
+          label: '采购日期',
+          prop: 'purchaseDate',
+          align: 'center',
+          width: 120,
+          showOverflowTooltip: true
+        }
+      ],
+      tableColumns2: [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          fixed: 'left'
+        },
+        {
+          label: '样品编码',
+          prop: 'sampleCode',
+          width: '200',
+          align: 'center',
+          fixed: 'left',
+          showOverflowTooltip: true
+        },
+        {
+          label: '编码',
+          prop: 'categoryCode',
+          align: 'center',
+          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
+        },
+        {
+          label: '供应商代号',
+          prop: 'supplierCode',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          label: '物料代号',
+          prop: 'materielDesignation',
+          align: 'center',
+          slot: 'materielDesignation',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          label: '客户代号',
+          prop: 'clientCode',
+          align: 'center',
+          slot: 'clientCode',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          label: '刻码',
+          prop: 'engrave',
+          align: 'center',
+          slot: 'engrave',
+          width: '120',
+          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',
+          align: 'center',
+          formatter: (_row) => {
+            return this.disposeTypeMap[_row.disposeType] || '';
+          }
+        },
+        {
+          label: '处置时间',
+          prop: 'disposeTime',
+          align: 'center',
+          showOverflowTooltip: true,
+          width: 150
+        },
+        {
+          label: '质检状态',
+          prop: 'qualityStatus',
+          align: 'center',
+          formatter: (row) => {
+            if (row.qualityStatus == 0) {
+              return '未检';
+            }
+            if (row.qualityStatus == 1) {
+              return '已检';
+            }
+            if (row.qualityStatus == 2) {
+              return '待检';
+            }
+          }
+        }
+      ],
+      tableColumns3: [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          fixed: 'left'
+        },
+        {
+          label: '质检方案编码',
+          prop: 'qualitySchemeTemplateCode',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '质检方案名称',
+          prop: 'qualitySchemeTemplateName',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '质检类型',
+          prop: 'categoryLevelClassName',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '质检项编码',
+          prop: 'inspectionCode',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '质检项名称',
+          prop: 'inspectionName',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '工艺参数',
+          prop: 'defaultValue',
+          align: 'center',
+          showOverflowTooltip: true,
+          slot: 'defaultValue'
+        }
+      ],
+      tableColumns4: [
+        {
+          type: 'index',
+          columnKey: 'index',
+          align: 'center',
+          label: '序号',
+          width: 55,
+          showOverflowTooltip: true
+        },
+        {
+          label: '样品编码',
+          prop: 'sampleCode',
+          minWidth: '150',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '物品编码',
+          prop: 'categoryCode',
+          minWidth: '150',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '物品名称',
+          prop: 'categoryName',
+          minWidth: '180',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'batchNo',
+          label: '批次号',
+          align: 'center',
+          minWidth: '120',
+          showOverflowTooltip: true
+        },
+        {
+          label: '规格',
+          prop: 'specification',
+          width: '120',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '牌号',
+          prop: 'brandNum',
+          width: '120',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'modelType',
+          label: '型号',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'measureQuantity',
+          label: '计量数量',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'measureUnit',
+          label: '计量单位',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+
+        {
+          prop: 'weight',
+          label: '重量',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'weightUnit',
+          label: '重量单位',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          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, column, cellValue) => {
+            return this.disposeTypeMap[cellValue];
+          }
+        },
+        {
+          prop: 'qualityResults',
+          label: '质检结果',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true,
+          formatter: (row, column, cellValue) => {
+            return qualityResultList[cellValue];
+          }
+        }
+      ],
+      tableColumns5: [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          label: '样品编码',
+          prop: 'sampleCode',
+          width: '150',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'categoryCode',
+          label: '物品编码',
+          width: '150',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'categoryName',
+          label: '物品名称',
+          width: '150',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          label: '规格',
+          prop: 'specification',
+          width: '120',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'brandNum',
+          label: '牌号',
+          align: 'center'
+        },
+        {
+          prop: 'modelType',
+          label: '型号',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'batchNo',
+          label: '批次号',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'weight',
+          label: '重量',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'weightUnit',
+          label: '重量单位',
+          align: 'center',
+          width: '120',
+          showOverflowTooltip: true
+        },
+        {
+          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: '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];
+          }
+        }
+      ]
+    };
+  }
+};

+ 46 - 3
src/views/unqualifiedProduct/unqualifiedList/index.vue

@@ -21,6 +21,9 @@
         <template v-slot:qualityType="{ row }">
           {{ getDictValue('质检计划类型', row.qualityType) }}
         </template>
+        <template v-slot:createTime="{ row }">
+          <span :class="isRed(row.createTime)">{{ row.createTime }}</span>
+        </template>
         <template v-slot:action="{ row }">
           <el-link
             v-if="row.status == 0"
@@ -196,14 +199,20 @@
             width: 120,
             showOverflowTooltip: true
           },
+          {
+            prop: 'createTime',
+            slot: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
           {
             prop: 'status',
             label: '状态',
             align: 'center',
             width: 80,
             formatter: (row, column, cellValue) => {
-              console.log(this.getDictName('处置状态', cellValue));
-
               return this.getDictName('处置状态', cellValue);
             }
           },
@@ -218,6 +227,36 @@
             slot: 'action'
           }
         ];
+      },
+
+      isRed() {
+        return (givenTimeStr) => {
+          // 解析给定的时间字符串
+          const givenTime = new Date(givenTimeStr);
+
+          // 检查时间是否有效
+          if (isNaN(givenTime.getTime())) {
+            throw new Error(
+              '无效的时间格式,请使用类似 "2025-08-12 17:03:27" 的格式'
+            );
+          }
+          // 获取当前时间
+          const now = new Date();
+
+          // 检查给定时间是否超过当前时间(超过当前时间的不算)
+          if (givenTime > now) {
+            return '';
+          }
+
+          // 计算时间差(毫秒)
+          const timeDiff = now - givenTime;
+
+          // 转换为天数(1天 = 24小时 * 60分钟 * 60秒 * 1000毫秒)
+          const daysDiff = timeDiff / (1000 * 60 * 60 * 24);
+
+          // 判断是否大于5天
+          return daysDiff > 5 ? 'is_red' : '';
+        };
       }
     },
     created() {
@@ -286,4 +325,8 @@
   };
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+  .is_red {
+    color: red;
+  }
+</style>