sftp 操作日志.

This commit is contained in:
lijiahang
2024-02-23 18:20:48 +08:00
parent 471f149a04
commit f8e96a6b54
45 changed files with 442 additions and 151 deletions

View File

@@ -1,26 +1,29 @@
import { useClipboard } from '@vueuse/core';
import { Message } from '@arco-design/web-vue';
export default function useCopy() {
const { copy: c } = useClipboard();
// 复制
const copy = async (value: string | undefined, tips: string | boolean = `${value} 已复制`) => {
try {
if (!value) {
return;
}
await c(value);
if (tips) {
Message.success(tips as string);
}
} catch (e) {
Message.error('复制失败');
const { copy: c } = useClipboard();
// 复制
export const copy = async (value: string | undefined, tips: string | boolean = `${value} 已复制`) => {
try {
if (!value) {
return;
}
};
// 获取剪切板内容
const readText = () => {
return navigator.clipboard.readText();
};
await c(value);
if (tips) {
Message.success(tips as string);
}
} catch (e) {
Message.error('复制失败');
}
};
// 获取剪切板内容
export const readText = () => {
return navigator.clipboard.readText();
};
export default function useCopy() {
return {
copy,
readText,

View File

@@ -5,7 +5,7 @@
label-align="left"
:itemOptions="{ 6: { span: 2 } }"
@submit="fetchTableData"
@reset="fetchTableData"
@reset="resetTableData"
@keyup.enter="() => fetchTableData()">
<!-- 连接用户 -->
<a-form-item field="userId" label="连接用户" label-col-flex="50px">
@@ -114,7 +114,7 @@
import { getHostConnectLogPage } from '@/api/asset/host-connect-log';
import useLoading from '@/hooks/loading';
import columns from '../types/table.columns';
import { connectStatusKey, connectTypeKey } from '../types/const';
import { connectStatusKey, connectTypeKey, HostConnectType } from '../types/const';
import { usePagination } from '@/types/table';
import { useDictStore } from '@/store';
import useCopy from '@/hooks/copy';
@@ -134,7 +134,7 @@
userId: undefined,
hostId: undefined,
hostAddress: undefined,
type: undefined,
type: HostConnectType.SSH,
token: undefined,
status: undefined,
startTimeRange: undefined,
@@ -155,6 +155,12 @@
}
};
// 重置
const resetTableData = (page = 1, limit = pagination.pageSize, form = formModel) => {
formModel.type = HostConnectType.SSH;
doFetchTableData({ page, limit, ...form });
};
// 切换页码
const fetchTableData = (page = 1, limit = pagination.pageSize, form = formModel) => {
doFetchTableData({ page, limit, ...form });

View File

@@ -1,3 +1,9 @@
// 主机连接类型
export const HostConnectType = {
SSH: 'SSH',
SFTP: 'SFTP'
};
// 主机连接状态 字典项
export const connectStatusKey = 'hostConnectStatus';

View File

@@ -86,7 +86,7 @@ export default class SftpSession implements ISftpSession {
remove(path: string[]) {
Modal.confirm({
title: '删除确认',
content: `确定要删除 ${path} 吗? 确定后将立即删除且无法恢复!`,
content: `确定要删除 ${path.join(',')} 吗? 确定后将立即删除且无法恢复!`,
onOk: () => {
this.resolver.setLoading(true);
this.channel.send(InputProtocol.SFTP_REMOVE, {

View File

@@ -439,7 +439,6 @@ export interface SftpTransferItem {
// 传输操作响应
export interface TransferOperatorResponse {
type: string;
fileId?: string;
hostId?: number;
success: boolean;
msg?: string;

View File

@@ -103,7 +103,7 @@
<style lang="less" scoped>
.tabs-container {
background: var(--color-bg-2);
margin: 16px 16px 0 16px;
margin: 16px;
padding: 16px;
display: flex;
flex-direction: column;

View File

@@ -32,6 +32,7 @@
</template>
<!-- 操作日志 -->
<template #originLogInfo="{ record }">
<icon-copy class="copy-left" @click="copy(record.originLogInfo, '已复制')" />
<span v-html="replaceHtmlTag(record.logInfo)" />
</template>
<!-- 操作 -->
@@ -64,6 +65,7 @@
import { replaceHtmlTag, clearHtmlTag, dateFormat } from '@/utils';
import { pick } from 'lodash';
import { getCurrentUserOperatorLog } from '@/api/user/mine';
import useCopy from '@/hooks/copy';
const emits = defineEmits(['viewDetail']);
const props = defineProps({
@@ -83,12 +85,13 @@
}
});
const tableColumns = ref();
const tableRenderData = ref<OperatorLogQueryResponse[]>([]);
const pagination = usePagination();
const { loading, setLoading } = useLoading();
const { getDictValue } = useDictStore();
const { copy } = useCopy();
const tableColumns = ref();
const tableRenderData = ref<OperatorLogQueryResponse[]>([]);
// 查看详情
const viewDetail = (record: OperatorLogQueryResponse) => {

View File

@@ -49,7 +49,7 @@ const columns = [
ellipsis: true,
tooltip: true,
}, {
title: '创建时间',
title: '操作时间',
dataIndex: 'createTime',
slotName: 'createTime',
align: 'center',