系统动态设置.

This commit is contained in:
lijiahang
2024-10-10 18:32:40 +08:00
parent 76aa64fe75
commit c229029c1d
27 changed files with 751 additions and 44 deletions

View File

@@ -141,18 +141,18 @@
</script>
<script lang="ts" setup>
import type { VNodeRef } from 'vue';
import type { TableData } from '@arco-design/web-vue/es/table/interface';
import type { SftpFile, ISftpSession } from '../../types/define';
import type { VNodeRef } from 'vue';
import { ref, computed, watch, inject } from 'vue';
import type { SftpSetting } from '@/api/system/setting';
import { ref, computed, watch, inject, onMounted } from 'vue';
import { useRowSelection } from '@/hooks/table';
import { dateFormat } from '@/utils';
import { setAutoFocus } from '@/utils/dom';
import { copy } from '@/hooks/copy';
import columns from './types/table.columns';
import { FILE_TYPE, openSftpChmodModalKey, openSftpMoveModalKey } from '../../types/const';
const previewSize = Number.parseInt(import.meta.env.VITE_SFTP_PREVIEW_MB);
import { useCacheStore } from '@/store';
const props = defineProps<{
session?: ISftpSession;
@@ -168,6 +168,8 @@
const rowSelection = useRowSelection({ width: 40 });
const previewSize = ref(0);
// 切换页面自动清空过滤
watch(() => props.list, () => {
tableRef.value?.clearFilters();
@@ -206,7 +208,7 @@
const canEditable = (size: number, attr: string) => {
// 是普通文件 && 文件小于 配置大小(MB) 可以编辑
return FILE_TYPE.NORMAL_FILE.value == formatFileType(attr).value
&& size <= previewSize * 1024 * 1024;
&& size <= (previewSize.value || 0) * 1024 * 1024;
};
// 点击文件名称
@@ -276,6 +278,12 @@
}) || FILE_TYPE.NORMAL_FILE;
};
// 加载配置
onMounted(async () => {
const data = await useCacheStore().loadSystemSetting<SftpSetting>('SFTP');
previewSize.value = data?.previewSize;
});
</script>
<style lang="less" scoped>