文件档案下载
This commit is contained in:
		
							parent
							
								
									82bdb7becd
								
							
						
					
					
						commit
						1ac9bd125f
					
				| 
						 | 
				
			
			@ -68,3 +68,12 @@ export function delArchivesDetailsApi(data) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//右侧表格-下载
 | 
			
		||||
export function downloadFileApi(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
      url: '/material/archives/download',
 | 
			
		||||
      method: 'post',
 | 
			
		||||
      data: data,
 | 
			
		||||
      // responseType: 'blob'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -92,7 +92,7 @@
 | 
			
		|||
            <el-button type="primary" plain icon="el-icon-upload" size="mini" @click="openUpLoadDialog">上传</el-button>
 | 
			
		||||
          </el-col> 
 | 
			
		||||
          <el-col :span="2">
 | 
			
		||||
            <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">下载</el-button>
 | 
			
		||||
            <el-button type="warning" plain icon="el-icon-download" :disabled="multiple" size="mini" @click="handleExport">下载</el-button>
 | 
			
		||||
          </el-col>
 | 
			
		||||
          <el-col :span="2">
 | 
			
		||||
            <el-button type="success" plain icon="el-icon-download" :disabled="single" size="mini" @click="handleReName">重命名</el-button>
 | 
			
		||||
| 
						 | 
				
			
			@ -240,9 +240,10 @@ import Treeselect from "@riophae/vue-treeselect";
 | 
			
		|||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 | 
			
		||||
import {
 | 
			
		||||
  getArchivesTypeListApi,getAddArchivesTypeApi,updateArchivesTypeApi,delArchivesTypeApi,
 | 
			
		||||
  getArchivesDetailsLstApi, addArchivesDetailsApi, updateArchivesDetailsApi, delArchivesDetailsApi
 | 
			
		||||
  getArchivesDetailsLstApi, addArchivesDetailsApi, updateArchivesDetailsApi, delArchivesDetailsApi,downloadFileApi
 | 
			
		||||
} from "@/api/archives/archives"; 
 | 
			
		||||
import { imgUpLoad, fileUpLoad } from "@/api/system/upload"; 
 | 
			
		||||
import { downloadFile } from "@/utils/download";
 | 
			
		||||
import { getToken } from '@/utils/auth'
 | 
			
		||||
export default {
 | 
			
		||||
  name: "ToolsType",
 | 
			
		||||
| 
						 | 
				
			
			@ -692,6 +693,7 @@ export default {
 | 
			
		|||
    //打开文件上传
 | 
			
		||||
    openUpLoadDialog(){
 | 
			
		||||
      this.uploadList=[]
 | 
			
		||||
      this.fileList=[]
 | 
			
		||||
      this.upload.open=true; 
 | 
			
		||||
    },
 | 
			
		||||
    handleSuccess(response, file, fileList) {
 | 
			
		||||
| 
						 | 
				
			
			@ -727,35 +729,48 @@ export default {
 | 
			
		|||
    // 提交上传文件
 | 
			
		||||
    async submitFileForm() { 
 | 
			
		||||
      console.log(this.uploadList)
 | 
			
		||||
      let param = {
 | 
			
		||||
        archivesDetailsList:this.uploadList
 | 
			
		||||
      }
 | 
			
		||||
      const res = await addArchivesDetailsApi(param);
 | 
			
		||||
      if (res.code === 200) {
 | 
			
		||||
        this.$message.success("上传成功!");
 | 
			
		||||
        this.upload.open = false 
 | 
			
		||||
        this.getList()
 | 
			
		||||
      if(this.uploadList.length==0){ 
 | 
			
		||||
        this.$modal.msgError("请先选择上传文件");
 | 
			
		||||
      }else{
 | 
			
		||||
        let param = {
 | 
			
		||||
          archivesDetailsList:this.uploadList
 | 
			
		||||
        }
 | 
			
		||||
        const res = await addArchivesDetailsApi(param);
 | 
			
		||||
        if (res.code === 200) { 
 | 
			
		||||
          this.$modal.msgSuccess("上传成功!");
 | 
			
		||||
          this.upload.open = false 
 | 
			
		||||
          this.getList()
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      
 | 
			
		||||
      // this.$refs.upload.submit() 
 | 
			
		||||
    },
 | 
			
		||||
    cancelUpload() {
 | 
			
		||||
      this.getList()
 | 
			
		||||
      this.upload.open=false
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }, 
 | 
			
		||||
    /** 导出按钮作 */
 | 
			
		||||
    handleExport() {
 | 
			
		||||
      // let queryTemp = this.queryParams;
 | 
			
		||||
      // // queryTemp.level = 0;
 | 
			
		||||
      let arr=[]
 | 
			
		||||
      this.ids.forEach(item=>{
 | 
			
		||||
        arr.push(item.detailsId)
 | 
			
		||||
      })
 | 
			
		||||
      downloadFileApi({'detailsIdList':arr}).then((res) => {
 | 
			
		||||
        downloadFile({
 | 
			
		||||
          fileName: "文件档案下载.zip",
 | 
			
		||||
          fileData: res,
 | 
			
		||||
          fileType: "text/html;charset=UTF-8",
 | 
			
		||||
        });
 | 
			
		||||
      });  
 | 
			
		||||
      // this.download(
 | 
			
		||||
      //   "/material/ma_type/export",
 | 
			
		||||
      //   {
 | 
			
		||||
      //     ...queryTemp,
 | 
			
		||||
      //   },
 | 
			
		||||
      //   `物资类型信息_${new Date().getTime()}.xlsx`
 | 
			
		||||
      //   "/material/archives/download",
 | 
			
		||||
      //   {'detailsIdList':arr},
 | 
			
		||||
      //   `文件档案下载_${new Date().getTime()}.zip`
 | 
			
		||||
      // );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue