gaoluyang
2025-03-07 573265f7d79341298ba4287be38f00ddbc66e7ec
src/views/CNAS/systemManagement/documentControl/components/FileList.vue
@@ -21,8 +21,9 @@
        <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
      </div>
      <div class="btns" style="padding-left: 30px;">
        <el-upload :action="action" :multiple="false" accept='.xls,.xlsx' :headers="headers" :on-change="beforeUpload"
          :on-error="onError" ref='upload' :on-success="handleSuccessUp" :show-file-list="false">
        <el-upload :action="action" :multiple="false" accept='.xls,.xlsx' :headers="uploadHeader"
          :on-change="beforeUpload" :on-error="onError" ref='upload' :on-success="handleSuccessUp"
          :show-file-list="false">
          <el-button size="small" type="primary" :loading="upLoading">导入</el-button></el-upload>
      </div>
    </div>
@@ -96,7 +97,6 @@
  delManageDocumentList,
  doManageDocumentList,
} from '@/api/cnas/systemManagement/documentControl.js'
import { getToken } from "@/utils/auth";
export default {
  components: {
    UpPdfStamp,
@@ -201,11 +201,6 @@
  },
  // 用于上传文件的信息
  computed: {
    headers() {
      return {
        'Authorization': "Bearer " + getToken()
      }
    },
    action() {
      return this.javaApi + '/manageDocumentList/exportManageDocumentList'
    }
@@ -257,8 +252,7 @@
    // 下载文件
    handleDown(row) {
      if (!row.url) return this.$message.warning('文件未上传')
      let url = this.javaApi + '/word/' + row.url
      this.$download.saveAs(url, row.url);
      this.$download.downloadFileFromUrl(row.url, row.url);
    },
    // 查看文件
    handleLook(row) {
@@ -322,6 +316,8 @@
      if (response.code == 200) {
        this.$message.success('上传成功');
        this.refreshTable()
      }else {
        this.$message.error(response.msg);
      }
    },
    selectEnumByCategory() {
@@ -339,17 +335,22 @@
      formData.append('file', pdfBlob, fileName); // 文件字段
      formData.append('id', this.currentInfo.id); // 文件名字段
      let res = await uploadFileManageDocumentList(formData)
      this.addLoading = false
      if (res.code == 200) {
        this.$message({ message: '上传成功', type: 'success' });
        this.addDialogVisible = false;
        this.refreshTable()
        return true
      } else {
        this.$message({ message: '上传失败', type: 'error' });
        return false
      try {
        let res = await uploadFileManageDocumentList(formData)
        this.addLoading = false
        if (res.code == 200) {
          this.$message({ message: '上传成功', type: 'success' });
          this.addDialogVisible = false;
          this.refreshTable()
          return true
        } else {
          this.$message({ message: '上传失败', type: 'error' });
          return false
        }
      } catch (e) {
        this.addLoading = false
      }
    },
    handleDelete(row) {
      this.$confirm("是否删除该条数据?", "提示", {
@@ -359,7 +360,6 @@
      })
        .then(() => {
          delManageDocumentList({ id: row.id }).then((res) => {
            if (res.code == 201) return;
            this.$message.success("删除成功");
            this.refresh();
          });