From 1ac9bd125f4e0377b386edace8828ab845eaa971 Mon Sep 17 00:00:00 2001
From: zzyuan <781948537@qq.com>
Date: Wed, 8 Jan 2025 18:13:09 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=A1=A3=E6=A1=88=E4=B8=8B?=
=?UTF-8?q?=E8=BD=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/archives/archives.js | 9 +++++
src/views/material/archives/index.vue | 57 +++++++++++++++++----------
2 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/src/api/archives/archives.js b/src/api/archives/archives.js
index 5b0b7a18..b17eba22 100644
--- a/src/api/archives/archives.js
+++ b/src/api/archives/archives.js
@@ -68,3 +68,12 @@ export function delArchivesDetailsApi(data) {
}
+//右侧表格-下载
+export function downloadFileApi(data) {
+ return request({
+ url: '/material/archives/download',
+ method: 'post',
+ data: data,
+ // responseType: 'blob'
+ })
+}
\ No newline at end of file
diff --git a/src/views/material/archives/index.vue b/src/views/material/archives/index.vue
index 56401a27..f4d8de6b 100644
--- a/src/views/material/archives/index.vue
+++ b/src/views/material/archives/index.vue
@@ -92,7 +92,7 @@
上传
- 下载
+ 下载
重命名
@@ -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`
// );
+
+
+
+
},