ludc
2023-07-27 9a6757109b406fa0c7c1c548d9977702e6df76b6
Source/UBCS-WEB/src/components/file/main.vue
@@ -7,7 +7,6 @@
               :before-open="beforeOpen"
               :permission="permissionList"
               v-model="form"
               :height="options.height || 200"
               ref="crud"
               @row-del="rowDel"
               @search-change="searchChange"
@@ -66,6 +65,7 @@
import {mapGetters} from "vuex";
import {dateFormat} from "@/util/date";
import {validatenull} from "@/util/validate";
import func from "@/util/func";
export default {
  props: ["options","visible","ownbizOid"],
@@ -88,10 +88,10 @@
      hasDel:validatenull(this.options.hasDel) ? true :this.options.hasDel,
      hasDownload:validatenull(this.options.hasDownload) ? true :this.options.hasDownload,
      option: {
        height:(this.options.tableHeight?this.options.tableHeight:'auto'),
        height:(this.options.tableHeight?this.options.tableHeight:'200'),
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchShow: false,
        searchMenuSpan: 6,
        border: true,
        index: true,
@@ -381,16 +381,31 @@
      let data=new FormData();
      if(row && row.oid){
        data.append('fileOids',row.oid)
        download(data)
        this.downloadFile(data);
      }else{
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");x
          this.$message.warning("请选择至少一条数据");
          return;
        }
        data.append('fileOids',this.oids)
        download(data);
        this.downloadFile(data);
      }
    },
    downloadFile(data){
      download(data).then(res=>{
        // console.log(res);
        if(res){
          const fileNames = res.headers['content-disposition'].split(";");
          let characterSet = fileNames[2].split("filename*=")[1];
          let fileName = decodeURI(fileNames[1].split("filename=")[1],characterSet);  // 下载的文件名
          let blob = new Blob([res.data], {
            type: res.data.type + ";charset=utf-8",
          });
          func.downloadFileByBlob(blob,fileName);
          window.URL.revokeObjectURL(src); //释放掉blob对象
        }
      });
    },
    rowDel(row) {
      this.$confirm("确定将选择文件删除?", {
        confirmButtonText: "确定",