|
|
@@ -1,9 +1,16 @@
|
|
|
<template>
|
|
|
<a-row style="margin-bottom: 20px;" justify="space-between">
|
|
|
<a-col>
|
|
|
- <a-button type="primary" :disabled="!selectedRowKeys.length" @click="onClickDownload" v-if="mode === 'table'">
|
|
|
+ <a-button style="margin-right: 10px;" type="primary" :disabled="!selectedRowKeys.length" @click="onClickDownload"
|
|
|
+ v-if="mode === 'table'">
|
|
|
压缩下载
|
|
|
</a-button>
|
|
|
+ <a-upload :action="uploadUrl" method="POST" :headers="getHeaders()" accept=".rar,.zip" :multiple="false"
|
|
|
+ :showUploadList="false" @change="handleChangeUploadFile" v-if="true">
|
|
|
+ <a-button type="primary">
|
|
|
+ 上传
|
|
|
+ </a-button>
|
|
|
+ </a-upload>
|
|
|
</a-col>
|
|
|
<a-col>
|
|
|
<a-form ref="formRef" layout="inline" :model="formModel" :colon="false">
|
|
|
@@ -55,11 +62,15 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
|
+import { message } from 'ant-design-vue'
|
|
|
import { SearchOutlined, ReloadOutlined } from '@ant-design/icons-vue';
|
|
|
import { apis } from '/@/api/custom';
|
|
|
+import { getWorkspaceId } from '/@/utils';
|
|
|
import moment from 'moment';
|
|
|
+import { ELocalStorageKey } from '/@/types'
|
|
|
|
|
|
interface Props {
|
|
|
+ fetchList: () => Promise<any>,
|
|
|
mode: 'table' | 'list',
|
|
|
selectedRowKeys: string[],
|
|
|
onClickDownload: () => Promise<any>,
|
|
|
@@ -91,6 +102,15 @@ const state: State = reactive({
|
|
|
payloadList: [],
|
|
|
})
|
|
|
|
|
|
+const uploadUrl = `/api/media/api/v1/files/${getWorkspaceId()}/file/zip/upload`;
|
|
|
+
|
|
|
+const getHeaders = () => {
|
|
|
+ const token = localStorage.getItem(ELocalStorageKey.Token);
|
|
|
+ return {
|
|
|
+ [ELocalStorageKey.Token]: token,
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
try {
|
|
|
const res = await apis.fetchPayloadList();
|
|
|
@@ -106,6 +126,16 @@ onMounted(async () => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+// 上传合成文件
|
|
|
+const handleChangeUploadFile = async (info: any) => {
|
|
|
+ if (info.file.status === 'done') {// 上传成功
|
|
|
+ await props.fetchList()
|
|
|
+ message.success('上传成功');
|
|
|
+ } else if (info.file.status === 'error') {// 上传失败
|
|
|
+ message.error('上传失败');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 点击查询
|
|
|
const handleClickSearch = async () => {
|
|
|
const values = formRef.value?.getFieldsValue();
|