zhangwencui
2026-05-29 befbda496fbf663c857e89f3daf3dc2dbcdcd624
src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -64,7 +64,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/rawMaterialInspection/components/inspectionFormDia.vue";
import FormDia from "@/views/qualityManagement/rawMaterialInspection/components/formDia.vue";
import {ElMessageBox} from "element-plus";
@@ -77,6 +77,7 @@
import FilesDia from "@/views/qualityManagement/rawMaterialInspection/components/filesDia.vue";
import dayjs from "dayjs";
import {userListNoPage} from "@/api/system/user.js";
import useUserStore from "@/store/modules/user";
const data = reactive({
  searchForm: {
@@ -97,6 +98,11 @@
    width: 120
  },
  {
    label: "采购订单号",
    prop: "purchaseContractNo",
    width: 120
  },
  {
    label: "供应商",
    prop: "supplier",
    width: 230
@@ -114,6 +120,10 @@
    prop: "model",
  },
  {
    label: "厚度(mm)",
    prop: "thickness",
  },
  {
    label: "单位",
    prop: "unit",
  },
@@ -123,34 +133,46 @@
    width: 120
  },
  {
    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",
@@ -166,7 +188,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;
            }
      },
      {
@@ -180,10 +208,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;
            }
      },
      {
@@ -228,6 +262,7 @@
const filesDia = ref()
const inspectionFormDia = ref()
const {proxy} = getCurrentInstance()
const userStore = useUserStore()
const changeDaterange = (value) => {
  searchForm.value.entryDateStart = undefined;
  searchForm.value.entryDateEnd = undefined;
@@ -318,8 +353,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();