gongchunyi
2 天以前 0a251e40e30e7c8a96d71b3b9b6c459d4dfa4b22
src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -40,7 +40,7 @@
    </div>
    <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
    <FormDia ref="formDia" @close="handleQuery"></FormDia>
    <files-dia ref="filesDia" @close="handleQuery"></files-dia>
    <files-dia ref="filesDia"></files-dia>
    <el-dialog v-model="dialogFormVisible" title="编辑检验员" width="30%"
               @close="closeDia">
      <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
@@ -144,32 +144,43 @@
    width: 120
  },
  {
    label: "检测单位",
    prop: "checkCompany",
    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 'danger';
      }
      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";
      }
    },
  },
@@ -197,6 +208,13 @@
            }
      },
      {
        name: "查看",
        type: "text",
        clickFun: (row) => {
          openForm("view", row);
        },
      },
      {
        name: "附件",
        type: "text",
        clickFun: (row) => {
@@ -209,6 +227,7 @@
        clickFun: (row) => {
          submit(row.id);
        },
        loading: (row) => submitLoadingId.value === row.id,
            disabled: (row) => {
               // 已提交则禁用
               if (row.inspectState == 1) return true;
@@ -239,6 +258,7 @@
        clickFun: (row) => {
          downLoadFile(row);
        },
        loading: (row) => downloadLoadingId.value === row.id,
      },
    ],
  },
@@ -246,6 +266,8 @@
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
const submitLoadingId = ref(null);
const downloadLoadingId = ref(null);
const userList = ref([]);
const dialogFormVisible = ref(false);
const form = ref({
@@ -351,12 +373,20 @@
      });
};
// 提价
// 提交
const submit = async (id) => {
  const res = await submitQualityInspect({id: id})
  if (res.code === 200) {
    proxy.$modal.msgSuccess("提交成功");
    getList();
  submitLoadingId.value = id;
  try {
    const res = await submitQualityInspect({ id });
    if (res.code === 200) {
      proxy.$modal.msgSuccess("提交成功");
      const row = tableData.value.find(item => item.id === id);
      if (row) {
        row.inspectState = 1;
      }
    }
  } finally {
    submitLoadingId.value = null;
  }
}
@@ -387,8 +417,10 @@
  dialogFormVisible.value = true
}
const downLoadFile = (row) => {
  downloadQualityInspect({ id: row.id }).then((blobData) => {
const downLoadFile = async (row) => {
  downloadLoadingId.value = row.id;
  try {
    const blobData = await downloadQualityInspect({ id: row.id });
    const blob = new Blob([blobData], {
      type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    })
@@ -402,7 +434,9 @@
    document.body.removeChild(link)
    window.URL.revokeObjectURL(downloadUrl)
  })
  } finally {
    downloadLoadingId.value = null;
  }
};
onMounted(() => {