spring
2026-03-19 3318ca34258aea096611f79744d98d0ca78c5020
src/views/qualityManagement/nonconformingManagement/index.vue
@@ -4,24 +4,24 @@
      <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: 240px" @change="handleQuery">
            <el-option label="原材料检验" :value="0" />
            <el-option label="过程检验" :value="1" />
            <el-option label="出厂检验" :value="2" />
          <el-select v-model="searchForm.checkType" 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">
        <!-- <div style="margin-left: 10px">
          <span class="search_title">状态:</span>
          <el-select v-model="searchForm.inspectState" clearable style="width: 240px" @change="handleQuery">
          <el-select v-model="searchForm.inspectState" clearable style="width: 200px" @change="handleQuery">
            <el-option label="待处理" :value="0" />
            <el-option label="已处理" :value="1" />
          </el-select>
        </div>
        </div> -->
        <div style="margin-left: 10px">
          <span class="search_title">产品名称:</span>
          <el-input
              v-model="searchForm.productName"
              style="width: 240px"
              style="width: 200px"
              placeholder="请输入产品名称搜索"
              @change="handleQuery"
              clearable
@@ -30,6 +30,7 @@
        </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" />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
      </div>
@@ -68,59 +69,38 @@
const data = reactive({
  searchForm: {
    inspectType: "",
    checkType: "",
    inspectState: "",
    productName: "",
    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,
  },
});
const { searchForm } = toRefs(data);
const tableColumn = ref([
  {
    label: "状态",
    prop: "inspectState",
    dataType: "tag",
    formatData: (params) => {
      if (params == 0) {
        return "待处理";
      } else if (params == 1) {
        return "已处理";
      } else {
        return null;
      }
    },
    formatType: (params) => {
      if (params == '不合格') {
        return "danger";
      } else if (params == '合格') {
        return "success";
      } else {
        return null;
      }
    },
  },
  {
    label: "检测日期",
    prop: "checkTime",
    width: 120
  },
  {
    label: "批号",
    prop: "batchNo",
    width: 120
  },
  {
    label: "类别",
    prop: "inspectType",
    prop: "checkType",
    dataType: "tag",
    width: 120,
    formatData: (params) => {
      if (params == 0) {
        return "原材料检验";
        return "入厂检";
      } else if (params == 1) {
        return "过程检验";
        return "车间检";
      } else {
        return '出厂检验';
        return '出厂检';
      }
    },
    formatType: (params) => {
@@ -149,11 +129,11 @@
    label: "单位",
    prop: "unit",
  },
  {
    label: "数量",
    prop: "quantity",
    width: 100
  },
  // {
  //   label: "数量",
  //   prop: "quantity",
  //   width: 100
  // },
  {
    label: "不合格现象",
    prop: "defectivePhenomena",
@@ -173,29 +153,6 @@
    label: "处理日期",
    prop: "dealTime",
    width: 120
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: "right",
    width: 120,
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          openForm("edit", row);
        },
      },
      {
        name: "处理",
        type: "text",
        clickFun: (row) => {
          openInspectionForm("edit", row);
        },
      },
    ],
  },
]);
const tableData = ref([]);
@@ -249,12 +206,20 @@
// 打开弹框
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)
  })