gongchunyi
2026-05-15 c6c1caafba75438cc0eff215f19e9e0b900778d7
src/views/qualityManagement/processInspection/index.vue
@@ -40,7 +40,7 @@
    <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
    <FormDia ref="formDia" @close="handleQuery"></FormDia>
    <files-dia ref="filesDia" @close="handleQuery"></files-dia>
      <el-dialog v-model="dialogFormVisible" title="编辑检验员" width="70%"
      <el-dialog v-model="dialogFormVisible" title="编辑检验员" width="30%"
                      @close="closeDia">
         <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
            <el-form-item label="检验员:" prop="checkName">
@@ -62,7 +62,7 @@
<script setup>
import { Search } from "@element-plus/icons-vue";
import {onMounted, ref} from "vue";
import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
import InspectionFormDia from "@/views/qualityManagement/processInspection/components/inspectionFormDia.vue";
import FormDia from "@/views/qualityManagement/processInspection/components/formDia.vue";
import {ElMessageBox} from "element-plus";
@@ -75,17 +75,18 @@
import FilesDia from "@/views/qualityManagement/processInspection/components/filesDia.vue";
import dayjs from "dayjs";
import {userListNoPage} from "@/api/system/user.js";
import useUserStore from "@/store/modules/user";
const data = reactive({
  searchForm: {
    process: "",
    entryDate: [
      dayjs().format("YYYY-MM-DD"),
      dayjs().add(1, "day").format("YYYY-MM-DD"),
    ], // 录入日期
    entryDateStart: dayjs().format("YYYY-MM-DD"),
    entryDateEnd: dayjs().add(1, "day").format("YYYY-MM-DD"),
    entryDate: undefined, // 录入日期
    entryDateStart: undefined,
    entryDateEnd: undefined,
  },
   rules: {
      checkName: [{required: true, message: "请选择", trigger: "change"}],
   },
});
const { searchForm } = toRefs(data);
const tableColumn = ref([
@@ -94,6 +95,11 @@
    prop: "checkTime",
    width: 120
  },
  // {
  //   label: "生产工单号",
  //   prop: "workOrderNo",
  //   width: 120
  // },
  {
    label: "工序",
    prop: "process",
@@ -112,6 +118,10 @@
    prop: "model",
  },
  {
    label: "厚度(mm)",
    prop: "thickness",
  },
  {
    label: "单位",
    prop: "unit",
  },
@@ -121,34 +131,46 @@
    width: 100
  },
  {
    label: "合格数量",
    prop: "qualifiedQuantity",
    width: 100
  },
  {
    label: "不合格数量",
    prop: "unqualifiedQuantity",
    width: 100
  },
  {
    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 == null || params === '') return 'info';
      const n = Number(params);
      if (Number.isNaN(n)) return 'info';
      if (n >= 100) return 'success';
      if (n >= 90) return 'warning';
      return 'danger';
    },
  },
  {
    label: "检测单位",
    prop: "checkCompany",
    width: 120
  },
  {
    label: "检测结果",
    prop: "checkResult",
    dataType: "tag",
    formatType: (params) => {
      if (params == '不合格') {
        return "danger";
      } else if (params == '合格') {
        return "success";
      } else {
        return null;
      }
    },
  },
   {
      label: "提交状态",
      prop: "inspectState",
      formatData: (params) => {
         if (params) {
            return "已提交";
         } else {
            return "未提交";
         }
      },
    dataType: "tag",
    formatData: (params) => (params == 1 || params === true ? '已提交' : '未提交'),
    formatType: (params) => (params == 1 || params === true ? 'success' : 'info'),
   },
  {
    dataType: "action",
@@ -164,7 +186,13 @@
          openForm("edit", row);
        },
            disabled: (row) => {
               return row.inspectState == 1;
               // 已提交则禁用
               if (row.inspectState == 1) return true;
               // 如果检验员有值,只有当前登录用户能编辑
               if (row.checkName) {
                  return row.checkName !== userStore.nickName;
               }
               return false;
            }
      },
      {
@@ -178,10 +206,16 @@
            name: "提交",
            type: "text",
            clickFun: (row) => {
               submit(row.id);
               submit(row);
            },
            disabled: (row) => {
               return row.inspectState == 1;
               // 已提交则禁用
               if (row.inspectState == 1) return true;
               // 如果检验员有值,只有当前登录用户能提交
               if (row.checkName) {
                  return row.checkName !== userStore.nickName;
               }
               return false;
            }
         },
         {
@@ -195,7 +229,7 @@
               }
            },
            disabled: (row) => {
               return row.inspectState == 1 || row.checkName !== '';
               return row.inspectState == 1 || row.checkName;
            }
         },
         {
@@ -226,6 +260,7 @@
const filesDia = ref()
const inspectionFormDia = ref()
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const changeDaterange = (value) => {
  searchForm.value.entryDateStart = undefined;
  searchForm.value.entryDateEnd = undefined;
@@ -282,8 +317,12 @@
  })
};
// 提价
const submit = async (id) => {
   const res = await submitQualityInspect({id: id})
const submit = async (row) => {
   const res = await submitQualityInspect({
    id: row.id,
    qualifiedQuantity: row.qualifiedQuantity,
    unqualifiedQuantity: row.unqualifiedQuantity
  })
   if (res.code === 200) {
      proxy.$modal.msgSuccess("提交成功");
      getList();