diff --git a/orion-ops-ui/src/types/table.ts b/orion-ops-ui/src/types/table.ts
index f7c006fb..a4c4f277 100644
--- a/orion-ops-ui/src/types/table.ts
+++ b/orion-ops-ui/src/types/table.ts
@@ -7,7 +7,7 @@ import { TablePageSizeOptions } from '@/types/const';
/**
* 创建列表分页
*/
-export const usePagination = (): PaginationProps => {
+export const usePagination = (ext?: PaginationProps): PaginationProps => {
const appStore = useAppStore();
return reactive({
total: 0,
@@ -15,17 +15,19 @@ export const usePagination = (): PaginationProps => {
pageSize: isNumber(appStore.defaultTablePageSize) ? appStore.defaultTablePageSize : TablePageSizeOptions[0],
showTotal: true,
showPageSize: true,
- pageSizeOptions: TablePageSizeOptions
+ pageSizeOptions: TablePageSizeOptions,
+ ...ext
});
};
/**
* 创建行选择器
*/
-export const useRowSelection = (type = 'checkbox'): TableRowSelection => {
+export const useRowSelection = (ext?: TableRowSelection): TableRowSelection => {
return reactive({
- type: type as any,
+ type: 'checkbox',
showCheckedAll: true,
onlyCurrent: true,
+ ...ext
});
};
diff --git a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue
new file mode 100644
index 00000000..01c1b92c
--- /dev/null
+++ b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table.vue b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table.vue
index 8a59f778..7a16010c 100644
--- a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table.vue
+++ b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-table.vue
@@ -27,10 +27,88 @@
+
+
+
+
+
+
+
+ {{ record.name }}
+
+
- 操作
- {{ record.size }}
+ {{ record.size }}
+
+
+
+
+ {{ dateFormat(new Date(record.modifyTime)) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -46,33 +124,62 @@
import type { SftpFile } from '../../types/terminal.type';
import { ref } from 'vue';
import { useRowSelection } from '@/types/table';
+ import { dateFormat } from '@/utils';
import columns from './types/table.columns';
+ import useCopy from '@/hooks/copy';
+ import { FILE_TYPE } from '../../types/terminal.const';
const props = defineProps<{
list: Array;
loading: boolean;
}>();
- const rowSelection = useRowSelection();
+ const rowSelection = useRowSelection({ width: 40 });
+ const { copy } = useCopy();
+
const selectedKeys = ref>([]);
- const editRecord = ref({});
+ const editName = ref('');
// 设置选中状态
const setEditable = (record: TableData) => {
- editRecord.value = record;
+ editName.value = record.name;
record.hover = true;
};
// 设置未选中状态
const unsetEditable = (record: TableData) => {
setTimeout(() => {
- if (record.name === editRecord.value.name && !record.hover) {
- editRecord.value = {};
+ // 等待后如果还是当前行 但是未被选中则代表已经被失焦
+ if (record.name === editName.value && !record.hover) {
+ editName.value = '';
}
}, 20);
record.hover = false;
};
+ // 删除文件
+ const deleteFile = (path: string) => {
+ };
+
+ // 下载文件
+ const downloadFile = (path: string) => {
+ };
+
+ // 移动文件
+ const moveFile = (path: string) => {
+ };
+
+ // 文件提权
+ const chmodFile = (path: string) => {
+ };
+
+ // 格式化文件类型
+ const formatFileType = (attr: string) => {
+ return Object.values(FILE_TYPE).find(s => {
+ return s.value === attr.charAt(0);
+ }) || FILE_TYPE.NORMAL_FILE;
+ };
+
diff --git a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-view.vue b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-view.vue
index 26892565..15a4fe00 100644
--- a/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-view.vue
+++ b/orion-ops-ui/src/views/host/terminal/components/sftp/sftp-view.vue
@@ -1,24 +1,19 @@
-
-
-
+
-
+
+
+
+
+
+
editor
@@ -39,7 +34,8 @@
import { useTerminalStore } from '@/store';
import useLoading from '@/hooks/loading';
import data from './data';
- import SftpTable from '@/views/host/terminal/components/sftp/sftp-table.vue';
+ import SftpTable from './sftp-table.vue';
+ import SftpTableHeader from './sftp-table-header.vue';
const props = defineProps<{
tab: TerminalTabItem
@@ -72,36 +68,31 @@