gaoluyang
2026-05-27 f42a646e394dbf4b68cb1beba0015ca8de03a61c
src/views/qualityManagement/nonconformingManagement/index.vue
@@ -1,38 +1,40 @@
// 不合格管理
// 不合格品处理单
<template>
  <div class="app-container">
    <div class="search_form">
      <div style="display: flex;flex-direction: row;align-items: center;">
        <div>
          <span class="search_title">类型:</span>
          <el-select v-model="searchForm.inspectType" clearable style="width: 200px" @change="handleQuery">
            <el-option label="原材料检验" :value="0" />
            <el-option label="过程检验" :value="1" />
            <el-option label="出厂检验" :value="2" />
          </el-select>
        </div>
        <div style="margin-left: 10px">
          <span class="search_title">状态:</span>
          <el-select v-model="searchForm.inspectState" clearable style="width: 200px" @change="handleQuery">
            <el-option label="待处理" :value="0" />
            <el-option label="已处理" :value="1" />
          <el-select v-model="searchForm.status" clearable style="width: 200px" @change="handleQuery">
            <el-option label="草稿" :value="0" />
            <el-option label="待审核" :value="1" />
            <el-option label="审批中" :value="2" />
            <el-option label="已完成" :value="3" />
            <el-option label="已驳回" :value="4" />
          </el-select>
        </div>
        <div style="margin-left: 10px">
          <span class="search_title">产品名称:</span>
          <span class="search_title">项目名称:</span>
          <el-input
              v-model="searchForm.productName"
              v-model="searchForm.projectName"
              style="width: 200px"
              placeholder="请输入产品名称搜索"
              placeholder="请输入项目名称搜索"
              @change="handleQuery"
              clearable
              :prefix-icon="Search"
          />
        </div>
        <span  style="margin-left: 10px" class="search_title">检测日期:</span>
        <el-date-picker  v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
                                     style="width: 300px"
                         placeholder="请选择" clearable @change="changeDaterange" />
        <div style="margin-left: 10px">
          <span class="search_title">处理单号:</span>
          <el-input
              v-model="searchForm.orderNo"
              style="width: 200px"
              placeholder="请输入处理单号搜索"
              @change="handleQuery"
              clearable
              :prefix-icon="Search"
          />
        </div>
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
@@ -55,9 +57,7 @@
      >
      </PIMTable>
    </div>
    <DetailDia ref="detailDiaRef" />
    <FormDia ref="formDia" @close="handleQuery"></FormDia>
    <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
  </div>
</template>
@@ -67,136 +67,130 @@
import FormDia from "@/views/qualityManagement/nonconformingManagement/components/formDia.vue";
import {ElMessageBox} from "element-plus";
import {qualityUnqualifiedDel, qualityUnqualifiedListPage} from "@/api/qualityManagement/nonconformingManagement.js";
import InspectionFormDia from "@/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue";
import DetailDia from "@/views/qualityManagement/nonconformingManagement/components/detailDia.vue";
import dayjs from "dayjs";
const data = reactive({
  searchForm: {
    inspectType: "",
    inspectState: "",
    productName: "",
    entryDate: undefined, // 录入日期
    entryDateStart: undefined,
    entryDateEnd: undefined,
    status: "",
    projectName: "",
    orderNo: "",
  },
});
const { searchForm } = toRefs(data);
const tableColumn = ref([
  {
    label: "状态",
    prop: "inspectState",
    prop: "status",
    dataType: "tag",
    width: 100,
    formatData: (params) => {
      if (params == 0) {
        return "待处理";
      } else if (params == 1) {
        return "已处理";
      } else {
        return null;
      }
      const statusMap = {
        0: "草稿",
        1: "待审核",
        2: "审批中",
        3: "已完成",
        4: "已驳回"
      };
      return statusMap[params] || "-";
    },
    formatType: (params) => {
      if (params == '不合格') {
        return "danger";
      } else if (params == '合格') {
        return "success";
      } else {
        return null;
      }
      const typeMap = {
        0: "info",
        1: "warning",
        2: "primary",
        3: "success",
        4: "danger"
      };
      return typeMap[params] || "info";
    },
  },
  {
    label: "检测日期",
    prop: "checkTime",
    label: "处理单号",
    prop: "orderNo",
    width: 160
  },
  {
    label: "项目名称",
    prop: "projectName",
    width: 140
  },
  {
    label: "项目编号",
    prop: "projectNo",
    width: 140
  },
  {
    label: "设备名称",
    prop: "equipmentName",
    width: 140
  },
  {
    label: "物料/部件名称",
    prop: "materialName",
    width: 160
  },
  {
    label: "型号规格",
    prop: "specificationModel",
    width: 120
  },
  {
    label: "类别",
    prop: "inspectType",
    dataType: "tag",
    width: 120,
    formatData: (params) => {
      if (params == 0) {
        return "原材料检验";
      } else if (params == 1) {
        return "过程检验";
      } else {
        return '出厂检验';
      }
    },
    formatType: (params) => {
      if (params == '不合格') {
        return "info";
      } else if (params == '合格') {
        return "success";
      } else {
        return 'primary';
      }
    },
  },
  {
    label: "检验员",
    prop: "checkName",
  },
  {
    label: "产品名称",
    prop: "productName",
  },
  {
    label: "规格型号",
    prop: "model",
  },
  {
    label: "单位",
    prop: "unit",
  },
  {
    label: "数量",
    prop: "quantity",
    width: 80
  },
  {
    label: "不合格数",
    prop: "unqualifiedQuantity",
    width: 90
  },
  {
    label: "不合格工序",
    prop: "unqualifiedProcess",
    width: 100,
    formatData: (params) => {
      const processMap = {
        1: "来料",
        2: "制程",
        3: "成品"
      };
      return processMap[params] || "-";
    },
  },
  {
    label: "检验员",
    prop: "inspectorName",
    width: 100
  },
  {
    label: "不合格现象",
    prop: "defectivePhenomena",
    label: "检验日期",
    prop: "inspectDate",
    width: 120
  },
  {
    label: "处理结果",
    prop: "dealResult",
    label: "责任人",
    prop: "responsiblePerson",
    width: 100
  },
  {
    label: "责任部门",
    prop: "responsibleDept",
    width: 120
  },
  {
    label: "处理人",
    prop: "dealName",
    width: 120
  },
  {
    label: "处理日期",
    prop: "dealTime",
    width: 120
  },
  {
    label: "原因分析",
    prop: "reasonAnalysis",
    slot: "reasonAnalysis",
    width: 120
  },
  {
    label: "预防与纠正措施",
    prop: "preventiveCorrective",
    slot: "preventiveCorrective",
    width: 120
  },
  {
    label: "工时损失",
    prop: "lossWorking",
    width: 140
  },
  {
    label: "材料费损失",
    prop: "lossMaterial",
    width: 140
    label: "处置方式",
    prop: "disposalMethod",
    width: 100,
    formatData: (params) => {
      const disposalMap = {
        1: "让步接收",
        2: "厂内维修",
        3: "返厂维修",
        4: "换货",
        5: "退货",
        6: "报废"
      };
      return disposalMap[params] || "-";
    },
  },
  {
    dataType: "action",
@@ -206,19 +200,18 @@
    width: 140,
    operation: [
      {
        name: "详情",
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          openDetailDialog(row);
          openForm("edit", row);
        },
      },
      {
        name: "处理",
        name: "删除",
        type: "text",
        clickFun: (row) => {
          openInspectionForm("edit", row);
          handleDeleteRow(row);
        },
        disabled: (row) => row.inspectState === 1,
      },
    ],
  },
@@ -232,19 +225,8 @@
  total: 0
});
const formDia = ref()
const inspectionFormDia = ref()
const detailDiaRef = ref()
const { proxy } = getCurrentInstance()
const changeDaterange = (value) => {
  searchForm.value.entryDateStart = undefined;
  searchForm.value.entryDateEnd = undefined;
  if (value) {
    searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
    searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
  }
  getList();
};
// 查询列表
/** 搜索按钮操作 */
const handleQuery = () => {
@@ -259,7 +241,6 @@
const getList = () => {
  tableLoading.value = true;
  const params = { ...searchForm.value, ...page };
  params.entryDate = undefined
  qualityUnqualifiedListPage(params).then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
@@ -275,27 +256,27 @@
// 打开弹框
const openForm = (type, row) => {
  if (type !== 'add' && row?.inspectState === 1) {
    proxy.$modal.msgWarning("已处理的数据不能再编辑");
    return;
  }
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
};
// 打开处理弹框
const openInspectionForm = (type, row) => {
  if (row?.inspectState === 1) {
    proxy.$modal.msgWarning("已处理的数据不能再处理");
    return;
  }
  nextTick(() => {
    inspectionFormDia.value?.openDialog(type, row)
// 删除单行
const handleDeleteRow = (row) => {
  ElMessageBox.confirm("确认删除该不合格品处理单?", "提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
};
// 打开详情弹框
const openDetailDialog = (row) => {
  detailDiaRef.value?.openDialog(row);
      .then(() => {
        qualityUnqualifiedDel([row.id]).then((res) => {
          proxy.$modal.msgSuccess("删除成功");
          getList();
        });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
};
// 删除
@@ -307,7 +288,7 @@
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
@@ -330,7 +311,7 @@
    type: "warning",
  })
      .then(() => {
        proxy.download("/quality/qualityUnqualified/export", {}, "不合格管理.xlsx");
        proxy.download("/qualityUnqualifiedOrder/export", {}, "不合格品处理单.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");