🐛 修复文件上传列表显示错误.

This commit is contained in:
lijiahang
2024-07-25 13:46:48 +08:00
parent 87b8e405f5
commit 305312cc26
3 changed files with 42 additions and 13 deletions

View File

@@ -10,13 +10,15 @@
:unmount-on-close="true"
:on-before-ok="handlerOk"
@cancel="handleClose">
<!-- 上传目录 -->
<div class="item-wrapper">
<div class="form-item">
<span class="item-label">上传至文件夹</span>
<a-input class="item-input"
v-model="parentPath"
placeholder="上传目录" />
<div class="upload-container">
<!-- 上传目录 -->
<div class="item-wrapper">
<div class="form-item">
<span class="item-label">上传至文件夹</span>
<a-input class="item-input"
v-model="parentPath"
placeholder="上传目录" />
</div>
</div>
<a-space>
<!-- 选择文件 -->
@@ -112,7 +114,7 @@
}
// 获取上传的文件
const files = fileList.value.map(s => s.file as File);
// 上传
// 普通上传
transferManager.addUpload(hostId.value, parentPath.value, files);
Message.success('已开始上传, 点击右侧传输列表查看进度');
// 清空
@@ -136,6 +138,11 @@
@file-size-width: 82px;
@item-label: 104px;
.upload-container {
width: 100%;
padding: 20px;
}
.item-wrapper {
margin-bottom: 24px;
display: flex;
@@ -163,6 +170,11 @@
width: 376px;
}
.form-help {
margin: 4px 0 0 @item-label;
font-size: 12px;
color: var(--color-text-2);
}
}
.file-list-uploader {

View File

@@ -1,4 +1,5 @@
import type { ISftpSession, ISftpSessionResolver, ITerminalChannel, TerminalPanelTabItem } from '../types/define';
import { h } from 'vue';
import { InputProtocol } from '@/types/protocol/terminal.protocol';
import { PanelSessionType } from '../types/const';
import { Modal } from '@arco-design/web-vue';
@@ -77,15 +78,32 @@ export default class SftpSession extends BaseSession implements ISftpSession {
};
// 删除文件
remove(path: string[]) {
remove(paths: string[]) {
// 内容
const contentNode = h('div', {
style: {
display: 'flex',
flexDirection: 'column',
maxHeight: '40vh',
overflowY: 'auto'
}
},
paths.map(s => {
return h('span', { style: { marginTop: '4px' } }, s);
}));
// 提示
Modal.confirm({
title: '删除确认',
content: `确定要删除 ${path.join(',')} 吗? 确定后将立即删除且无法恢复!`,
title: '确定后将立即删除这些文件且无法恢复!',
modalStyle: { padding: '24px 32px' },
bodyStyle: { marginTop: '-14px' },
okButtonProps: { status: 'danger' },
okText: '删除',
content: () => contentNode,
onOk: () => {
this.resolver.setLoading(true);
this.channel.send(InputProtocol.SFTP_REMOVE, {
sessionId: this.sessionId,
path: path.join('|')
path: paths.join('|')
});
}
});

View File

@@ -43,7 +43,6 @@ export default class SftpTransferManager implements ISftpTransferManager {
file: s
};
});
this.transferList.push(...items);
// 开始传输
this.startTransfer(items);
}