yxh
8 天以前 fb16e99d60035949b870d0bed7f38b452458000a
src/views/project/documentfiles/index.vue
@@ -273,7 +273,7 @@
                size="small"
                style="width: 220px"
                v-model="form.uploadtime"
                type="datetime"
                type="datetime" format="yyyy-MM-dd HH:mm"
                value-format="yyyy-MM-dd HH:mm:ss"
              >
              </el-date-picker>
@@ -331,7 +331,6 @@
              <el-input v-model="form.fileurl" placeholder="请输入文件地址" />
            </el-form-item> -->
            <el-form-item label="文件上传" align="left" prop="fileurl">
              <!-- <file-upload ref="fileUpload" :fileType=fileType :limit="1" :on-success="handleUploadSuccess"></file-upload> -->
              <el-upload
                size="mini"
                class="upload-demo"
@@ -460,7 +459,6 @@
        fileurl: null,
        status: null,
      },
      fileType: ["png", "jpg", "jpeg", "doc", "xls", "ppt", "txt", "pdf"],
      // 表单参数
      form: {},
      // 表单校验
@@ -469,8 +467,9 @@
      //文件列表
      fileList: [],
       baseUrl: process.env.VUE_APP_BASE_API,
      // 上传的图片服务器地址
      uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload",
      // 政策文件上传接口(2026-10-09:改用模块专属接口,允许任意文件类型;
      // 通用 /common/upload 仍按扩展名白名单校验,不适用于本模块)
      uploadFileUrl: process.env.VUE_APP_BASE_API + "/project/documentfiles/upload",
      //上传附件请求头
      headers: {
        Authorization: "Bearer " + getToken(),
@@ -764,7 +763,8 @@
        this.$modal.msgSuccess(response.msg);
        this.fileList.push({ name: response.fileName, url: response.fileName });
      } else {
        console.log(response.msg);;
        // 2026-10-09:上传失败必须提示。原来只 console.log,用户看不到失败原因(表现为"点了没反应")
        this.$modal.msgError(response.msg || "上传失败,请重试");
      }
      //console.log("上传文件后:" + JSON.stringify(this.fileList));
    },
@@ -782,9 +782,10 @@
    handleExceed() {
      this.$message.error(`上传文件数量已超过!`);
    },
    // 上传失败
    // 上传失败(HTTP 层错误,如登录过期、网络异常)
    handleUploadError(err) {
      this.$message.error("上传失败, 请重试" + JSON.stringify(err));
      const msg = (err && (err.msg || err.message)) || "";
      this.$modal.msgError("上传失败,请重试" + (msg ? ":" + msg : ""));
    },
  },
};