文件档案下载
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-button type="primary" plain icon="el-icon-upload" size="mini" @click="openUpLoadDialog">上传</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="2">
|
<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>
|
||||||
<el-col :span="2">
|
<el-col :span="2">
|
||||||
<el-button type="success" plain icon="el-icon-download" :disabled="single" size="mini" @click="handleReName">重命名</el-button>
|
<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 "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import {
|
import {
|
||||||
getArchivesTypeListApi,getAddArchivesTypeApi,updateArchivesTypeApi,delArchivesTypeApi,
|
getArchivesTypeListApi,getAddArchivesTypeApi,updateArchivesTypeApi,delArchivesTypeApi,
|
||||||
getArchivesDetailsLstApi, addArchivesDetailsApi, updateArchivesDetailsApi, delArchivesDetailsApi
|
getArchivesDetailsLstApi, addArchivesDetailsApi, updateArchivesDetailsApi, delArchivesDetailsApi,downloadFileApi
|
||||||
} from "@/api/archives/archives";
|
} from "@/api/archives/archives";
|
||||||
import { imgUpLoad, fileUpLoad } from "@/api/system/upload";
|
import { imgUpLoad, fileUpLoad } from "@/api/system/upload";
|
||||||
|
import { downloadFile } from "@/utils/download";
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
export default {
|
export default {
|
||||||
name: "ToolsType",
|
name: "ToolsType",
|
||||||
|
|
@ -692,6 +693,7 @@ export default {
|
||||||
//打开文件上传
|
//打开文件上传
|
||||||
openUpLoadDialog(){
|
openUpLoadDialog(){
|
||||||
this.uploadList=[]
|
this.uploadList=[]
|
||||||
|
this.fileList=[]
|
||||||
this.upload.open=true;
|
this.upload.open=true;
|
||||||
},
|
},
|
||||||
handleSuccess(response, file, fileList) {
|
handleSuccess(response, file, fileList) {
|
||||||
|
|
@ -727,35 +729,48 @@ export default {
|
||||||
// 提交上传文件
|
// 提交上传文件
|
||||||
async submitFileForm() {
|
async submitFileForm() {
|
||||||
console.log(this.uploadList)
|
console.log(this.uploadList)
|
||||||
|
if(this.uploadList.length==0){
|
||||||
|
this.$modal.msgError("请先选择上传文件");
|
||||||
|
}else{
|
||||||
let param = {
|
let param = {
|
||||||
archivesDetailsList:this.uploadList
|
archivesDetailsList:this.uploadList
|
||||||
}
|
}
|
||||||
const res = await addArchivesDetailsApi(param);
|
const res = await addArchivesDetailsApi(param);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$message.success("上传成功!");
|
this.$modal.msgSuccess("上传成功!");
|
||||||
this.upload.open = false
|
this.upload.open = false
|
||||||
this.getList()
|
this.getList()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// this.$refs.upload.submit()
|
// this.$refs.upload.submit()
|
||||||
},
|
},
|
||||||
cancelUpload() {
|
cancelUpload() {
|
||||||
this.getList()
|
this.getList()
|
||||||
this.upload.open=false
|
this.upload.open=false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 导出按钮作 */
|
/** 导出按钮作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
// let queryTemp = this.queryParams;
|
let arr=[]
|
||||||
// // queryTemp.level = 0;
|
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(
|
// this.download(
|
||||||
// "/material/ma_type/export",
|
// "/material/archives/download",
|
||||||
// {
|
// {'detailsIdList':arr},
|
||||||
// ...queryTemp,
|
// `文件档案下载_${new Date().getTime()}.zip`
|
||||||
// },
|
|
||||||
// `物资类型信息_${new Date().getTime()}.xlsx`
|
|
||||||
// );
|
// );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue