yuan
5 天以前 7726b6cdab80596d2e2f7dd3fe1ec3dfbdeee155
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
@@ -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,6 +75,7 @@
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: {
@@ -92,6 +93,11 @@
  {
    label: "检测日期",
    prop: "checkTime",
    width: 120
  },
  {
    label: "生产工单号",
    prop: "workOrderNo",
    width: 120
  },
  {
@@ -116,8 +122,18 @@
    prop: "unit",
  },
  {
    label: "数量",
    label: "总数量",
    prop: "quantity",
    width: 100
  },
  {
    label: "合格数量",
    prop: "qualifiedQuantity",
    width: 100
  },
  {
    label: "不合格数量",
    prop: "unqualifiedQuantity",
    width: 100
  },
  {
@@ -126,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";
         }
      },
   },
@@ -164,8 +196,21 @@
          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;
            }
      },
      {
        name: "查看",
        type: "text",
        clickFun: (row) => {
          openForm("view", row);
        },
      },
      {
        name: "附件",
@@ -181,7 +226,13 @@
               submit(row.id);
            },
            disabled: (row) => {
               return row.inspectState == 1;
               // 已提交则禁用
               if (row.inspectState == 1) return true;
               // 如果检验员有值,只有当前登录用户能提交
               if (row.checkName) {
                  return row.checkName !== userStore.nickName;
               }
               return false;
            }
         },
         {
@@ -226,6 +277,7 @@
const filesDia = ref()
const inspectionFormDia = ref()
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const changeDaterange = (value) => {
  searchForm.value.entryDateStart = undefined;
  searchForm.value.entryDateEnd = undefined;
@@ -344,13 +396,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)
   })