gaoluyang
10 天以前 2c7bb17c8337f237b8e9ac02d404a6ec90123bae
src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -160,7 +160,7 @@
    label: "操作",
    align: "center",
    fixed: "right",
    width: 250,
    width: 280,
    operation: [
      {
        name: "编辑",
@@ -168,6 +168,9 @@
        clickFun: (row) => {
          openForm("edit", row);
        },
            disabled: (row) => {
               return row.inspectState == 1;
            }
      },
      {
        name: "附件",
@@ -182,6 +185,9 @@
        clickFun: (row) => {
          submit(row.id);
        },
            disabled: (row) => {
               return row.inspectState == 1;
            }
      },
      {
        name: "分配检验员",
@@ -193,6 +199,9 @@
            proxy.$modal.msgError("检验员已存在");
          }
        },
        disabled: (row) => {
          return row.inspectState;
        }
      },
      {
        name: "下载",
@@ -263,12 +272,6 @@
const openForm = (type, row) => {
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
};
// 打开新增检验弹框
const openInspectionForm = (type, row) => {
  nextTick(() => {
    inspectionFormDia.value?.openDialog(type, row)
  })
};
// 打开附件弹框
@@ -354,19 +357,18 @@
}
const downLoadFile = (row) => {
  downloadQualityInspect({id: row.id}).then(res => {
    // 创建 blob 对象
    const blob = new Blob([res.data], {type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'})
  downloadQualityInspect({ id: row.id }).then((blobData) => {
    const blob = new Blob([blobData], {
      type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    })
    const downloadUrl = window.URL.createObjectURL(blob)
    // 创建临时 <a> 标签进行下载
    const link = document.createElement('a')
    link.href = downloadUrl
    link.download = '检验报告.docx' // 这里和后端一致
    link.download = '原材料检验报告.docx'
    document.body.appendChild(link)
    link.click()
    // 清理
    document.body.removeChild(link)
    window.URL.revokeObjectURL(downloadUrl)
  })