优化文件下载.

This commit is contained in:
lijiahangmax
2024-02-25 19:29:39 +08:00
parent c3f33e7494
commit b30a48f174
10 changed files with 38 additions and 14 deletions

View File

@@ -260,7 +260,7 @@
setLoading(false);
Message.success('修改成功');
// 回调 props
emits('submitted', { ...formModel.value });
emits('submitted', { ...props.content, config: { ...formModel.value } });
} catch (e) {
} finally {
setLoading(false);

View File

@@ -30,8 +30,8 @@ const columns = [
}, {
title: '操作',
slotName: 'handle',
width: 180,
align: 'right',
width: 162,
align: 'center',
fixed: 'right',
},
] as TableColumnData[];

View File

@@ -186,8 +186,8 @@
:deep(.arco-tabs-tab) {
height: 100%;
margin: 0;
padding: 0;
margin: 0 !important;
padding: 0 !important;
color: var(--color-panel-text-1);
background: var(--color-bg-panel-tabs);
position: relative;

View File

@@ -68,7 +68,7 @@
</span>
</a-tooltip>
<!-- 编辑内容 -->
<a-tooltip v-if="canEditable(record.size, record.isDir)"
<a-tooltip v-if="canEditable(record.size, record.attr)"
position="top"
:mini="true"
:overlay-inverse="true"
@@ -204,14 +204,15 @@
};
// 是否可编辑
const canEditable = (size: number, isDir: boolean) => {
// 非文件夹并且文件小于 配置大小(MB) 可以编辑
return !isDir && size <= previewSize * 1024 * 1024;
const canEditable = (size: number, attr: string) => {
// 是普通文件 && 文件小于 配置大小(MB) 可以编辑
return FILE_TYPE.NORMAL_FILE.value == formatFileType(attr).value
&& size <= previewSize * 1024 * 1024;
};
// 点击文件名称
const clickFilename = (record: TableData) => {
if (FILE_TYPE.DIRECTORY.value === formatFileType(record.attr).value) {
if (record.isDir) {
// 进入文件夹
emits('loadFile', record.path);
} else {

View File

@@ -121,6 +121,7 @@
// 编辑文件
const editFile = (name: string, path: string) => {
setEditorLoading(true);
setTableLoading(true);
splitSize.value = 0.6;
editorView.value = true;
editorFileName.value = name;
@@ -208,6 +209,7 @@
// 接收获取文件内容响应
const resolveSftpGetContent = (path: string, result: string, content: string) => {
setTableLoading(false);
setEditorLoading(false);
// 检查结果
if (!checkResult(result, '加载失败')) {