🔨 文件上传 💩

This commit is contained in:
lijiahang
2024-02-20 19:18:44 +08:00
parent 9912130da1
commit 082d2745b4
3 changed files with 99 additions and 1 deletions

View File

@@ -140,7 +140,6 @@ public enum InputTypeEnum {
SftpSetContentRequest.class),
// TODO
// COPY
// UPLOAD
// DOWNLOAD

View File

@@ -0,0 +1,96 @@
<template>
<a-modal :visible="true"
top="80px"
title-align="start"
title="文件上传"
ok-text="上传"
:align-center="false"
:mask-closable="false"
:unmount-on-close="true"
:on-before-ok="handlerOk">
<div class="upload-container">
<a-space>
<!-- 选择文件 -->
<a-upload v-model:file-list="fileList"
:auto-upload="false"
:show-file-list="false"
:multiple="true">
<template #upload-button>
<a-button type="primary">选择文件</a-button>
</template>
</a-upload>
<!-- 选择文件夹 -->
<a-upload v-model:file-list="fileList"
:auto-upload="false"
:show-file-list="false"
:directory="true">
<template #upload-button>
<a-button type="primary">选择文件夹</a-button>
</template>
</a-upload>
</a-space>
<!-- 文件列表 -->
<a-upload class="file-list-uploader"
v-model:file-list="fileList"
:auto-upload="false"
:show-file-list="true">
<template #upload-button>
</template>
</a-upload>
</div>
</a-modal>
</template>
<script lang="ts">
export default {
name: 'sftpUploadModal'
};
</script>
<script lang="ts" setup>
import useVisible from '@/hooks/visible';
import { nextTick, ref } from 'vue';
import { useTerminalStore } from '@/store';
import { permission10toString } from '@/utils/file';
import SftpSession from '../../handler/sftp-session';
const { visible, setVisible } = useVisible(true);
const { sessionManager } = useTerminalStore();
const fileList = ref([]);
const handlerOk = () => {
console.log(fileList.value);
return false;
};
</script>
<style lang="less" scoped>
.upload-container {
width: 100%;
}
.file-list-uploader {
margin-top: 24px;
:deep(.arco-upload) {
display: none;
}
:deep(.arco-upload-list) {
max-height: calc(100vh - 328px);
overflow-y: auto;
padding: 0 12px 0 0;
}
:deep(.arco-upload-list-item:first-of-type) {
margin-top: 0 !important;
}
:deep(.arco-upload-list-item .arco-upload-progress) {
display: none;
}
}
</style>

View File

@@ -47,6 +47,8 @@
<sftp-move-modal ref="moveModal" />
<!-- 文件提权模态框 -->
<sftp-chmod-modal ref="chmodModal" />
<!-- 文件上传模态框 -->
<sftp-upload-modal ref="uploadModal" />
</div>
</template>
@@ -70,6 +72,7 @@
import SftpCreateModal from './sftp-create-modal.vue';
import SftpMoveModal from './sftp-move-modal.vue';
import SftpChmodModal from './sftp-chmod-modal.vue';
import SftpUploadModal from './sftp-upload-modal.vue';
const props = defineProps<{
tab: TerminalTabItem