🐛 修复文件上传列表显示错误.
This commit is contained in:
@@ -10,13 +10,15 @@
|
|||||||
:unmount-on-close="true"
|
:unmount-on-close="true"
|
||||||
:on-before-ok="handlerOk"
|
:on-before-ok="handlerOk"
|
||||||
@cancel="handleClose">
|
@cancel="handleClose">
|
||||||
<!-- 上传目录 -->
|
<div class="upload-container">
|
||||||
<div class="item-wrapper">
|
<!-- 上传目录 -->
|
||||||
<div class="form-item">
|
<div class="item-wrapper">
|
||||||
<span class="item-label">上传至文件夹</span>
|
<div class="form-item">
|
||||||
<a-input class="item-input"
|
<span class="item-label">上传至文件夹</span>
|
||||||
v-model="parentPath"
|
<a-input class="item-input"
|
||||||
placeholder="上传目录" />
|
v-model="parentPath"
|
||||||
|
placeholder="上传目录" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a-space>
|
<a-space>
|
||||||
<!-- 选择文件 -->
|
<!-- 选择文件 -->
|
||||||
@@ -112,7 +114,7 @@
|
|||||||
}
|
}
|
||||||
// 获取上传的文件
|
// 获取上传的文件
|
||||||
const files = fileList.value.map(s => s.file as File);
|
const files = fileList.value.map(s => s.file as File);
|
||||||
// 上传
|
// 普通上传
|
||||||
transferManager.addUpload(hostId.value, parentPath.value, files);
|
transferManager.addUpload(hostId.value, parentPath.value, files);
|
||||||
Message.success('已开始上传, 点击右侧传输列表查看进度');
|
Message.success('已开始上传, 点击右侧传输列表查看进度');
|
||||||
// 清空
|
// 清空
|
||||||
@@ -136,6 +138,11 @@
|
|||||||
@file-size-width: 82px;
|
@file-size-width: 82px;
|
||||||
@item-label: 104px;
|
@item-label: 104px;
|
||||||
|
|
||||||
|
.upload-container {
|
||||||
|
width: 100%;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.item-wrapper {
|
.item-wrapper {
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -163,6 +170,11 @@
|
|||||||
width: 376px;
|
width: 376px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-help {
|
||||||
|
margin: 4px 0 0 @item-label;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--color-text-2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-list-uploader {
|
.file-list-uploader {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { ISftpSession, ISftpSessionResolver, ITerminalChannel, TerminalPanelTabItem } from '../types/define';
|
import type { ISftpSession, ISftpSessionResolver, ITerminalChannel, TerminalPanelTabItem } from '../types/define';
|
||||||
|
import { h } from 'vue';
|
||||||
import { InputProtocol } from '@/types/protocol/terminal.protocol';
|
import { InputProtocol } from '@/types/protocol/terminal.protocol';
|
||||||
import { PanelSessionType } from '../types/const';
|
import { PanelSessionType } from '../types/const';
|
||||||
import { Modal } from '@arco-design/web-vue';
|
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({
|
Modal.confirm({
|
||||||
title: '删除确认',
|
title: '确定后将立即删除这些文件且无法恢复!',
|
||||||
content: `确定要删除 ${path.join(',')} 吗? 确定后将立即删除且无法恢复!`,
|
modalStyle: { padding: '24px 32px' },
|
||||||
|
bodyStyle: { marginTop: '-14px' },
|
||||||
|
okButtonProps: { status: 'danger' },
|
||||||
|
okText: '删除',
|
||||||
|
content: () => contentNode,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
this.resolver.setLoading(true);
|
this.resolver.setLoading(true);
|
||||||
this.channel.send(InputProtocol.SFTP_REMOVE, {
|
this.channel.send(InputProtocol.SFTP_REMOVE, {
|
||||||
sessionId: this.sessionId,
|
sessionId: this.sessionId,
|
||||||
path: path.join('|')
|
path: paths.join('|')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ export default class SftpTransferManager implements ISftpTransferManager {
|
|||||||
file: s
|
file: s
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.transferList.push(...items);
|
|
||||||
// 开始传输
|
// 开始传输
|
||||||
this.startTransfer(items);
|
this.startTransfer(items);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user