zhangwencui
2026-06-16 19f0e68b3fe3cf5244a2b936bfef4e0712bdf025
src/views/qualityManagement/processInspection/index.vue
@@ -1,6 +1,6 @@
<template>
  <div class="app-container">
    <div class="search_form">
    <div class="search_form mb20">
      <div>
        <span class="search_title">工序:</span>
        <el-input
@@ -39,7 +39,7 @@
    </div>
    <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
    <FormDia ref="formDia" @close="handleQuery"></FormDia>
    <files-dia ref="filesDia" @close="handleQuery"></files-dia>
    <files-dia ref="filesDia"></files-dia>
      <el-dialog v-model="dialogFormVisible" title="编辑检验员" width="30%"
                      @close="closeDia">
         <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
@@ -96,6 +96,11 @@
    width: 120
  },
  {
    label: "生产工单号",
    prop: "workOrderNo",
    width: 120
  },
  {
    label: "工序",
    prop: "process",
    width: 230
@@ -117,8 +122,18 @@
    prop: "unit",
  },
  {
    label: "数量",
    label: "总数量",
    prop: "quantity",
    width: 100
  },
  {
    label: "合格数量",
    prop: "qualifiedQuantity",
    width: 100
  },
  {
    label: "不合格数量",
    prop: "unqualifiedQuantity",
    width: 100
  },
  {
@@ -127,27 +142,43 @@
    width: 120
  },
  {
    label: "检测结果",
    prop: "checkResult",
    label: "合格率",
    prop: "passRate",
    width: 100,
    dataType: "tag",
    formatData: (params) => {
      if (params == null || params === '') return '—';
      const n = Number(params);
      if (Number.isNaN(n)) return '—';
      return `${n.toFixed(2)}%`;
    },
    formatType: (params) => {
      if (params == '不合格') {
        return "danger";
      } else if (params == '合格') {
        return "success";
      } else {
        return null;
      }
      if (params == null || params === '') return 'info';
      const n = Number(params);
      if (Number.isNaN(n)) return 'info';
      if (n === 100) return 'success';
      if (n >= 75) return 'primary';
      if (n >= 50) return 'warning';
      if (n >= 25) return 'danger';
      return 'danger';
    },
  },
   {
      label: "提交状态",
      prop: "inspectState",
      dataType: "tag",
      formatData: (params) => {
         if (params) {
            return "已提交";
         } else {
            return "未提交";
         }
      },
      formatType: (params) => {
         if (params) {
            return "success";
         } else {
            return "info";
         }
      },
   },
@@ -175,6 +206,13 @@
            }
      },
      {
        name: "查看",
        type: "text",
        clickFun: (row) => {
          openForm("view", row);
        },
      },
      {
        name: "附件",
        type: "text",
        clickFun: (row) => {
@@ -187,6 +225,7 @@
            clickFun: (row) => {
               submit(row.id);
            },
            loading: (row) => submitLoadingId.value === row.id,
            disabled: (row) => {
               // 已提交则禁用
               if (row.inspectState == 1) return true;
@@ -226,6 +265,7 @@
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
const submitLoadingId = ref(null);
const dialogFormVisible = ref(false);
const form = ref({
   checkName: ""
@@ -295,12 +335,20 @@
    filesDia.value?.openDialog(type, row)
  })
};
// 提价
// 提交
const submit = async (id) => {
   const res = await submitQualityInspect({id: id})
   if (res.code === 200) {
      proxy.$modal.msgSuccess("提交成功");
      getList();
   submitLoadingId.value = id;
   try {
      const res = await submitQualityInspect({ id });
      if (res.code === 200) {
         proxy.$modal.msgSuccess("提交成功");
         const row = tableData.value.find(item => item.id === id);
         if (row) {
            row.inspectState = 1;
         }
      }
   } finally {
      submitLoadingId.value = null;
   }
}
const open = async (row) => {
@@ -358,13 +406,13 @@
         type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
      })
      const downloadUrl = window.URL.createObjectURL(blob)
      const link = document.createElement('a')
      link.href = downloadUrl
      link.download = '过程检验报告.docx'
      document.body.appendChild(link)
      link.click()
      document.body.removeChild(link)
      window.URL.revokeObjectURL(downloadUrl)
   })