🎉 重构页面代码.
This commit is contained in:
@@ -76,12 +76,12 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TerminalConnectLogQueryRequest } from '@/api/asset/terminal-connect-log';
|
||||
import type { TerminalConnectLogQueryRequest } from '@/api/terminal/terminal-connect-log';
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { connectStatusKey, connectTypeKey, maxClearLimit } from '../types/const';
|
||||
import { getTerminalConnectLogCount, clearTerminalConnectLog } from '@/api/asset/terminal-connect-log';
|
||||
import { getTerminalConnectLogCount, clearTerminalConnectLog } from '@/api/terminal/terminal-connect-log';
|
||||
import { Message, Modal } from '@arco-design/web-vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
|
||||
@@ -75,12 +75,6 @@
|
||||
{{ record.extra?.traceId }}
|
||||
</span>
|
||||
</a-descriptions-item>
|
||||
<!-- channelId -->
|
||||
<a-descriptions-item label="channelId">
|
||||
<span class="text-copy" @click="copy(record.extra?.channelId)">
|
||||
{{ record.extra?.channelId }}
|
||||
</span>
|
||||
</a-descriptions-item>
|
||||
<!-- sessionId -->
|
||||
<a-descriptions-item label="sessionId">
|
||||
<span class="text-copy" @click="copy(record.sessionId)">
|
||||
@@ -98,7 +92,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TerminalConnectLogQueryResponse } from '@/api/asset/terminal-connect-log';
|
||||
import type { TerminalConnectLogQueryResponse } from '@/api/terminal/terminal-connect-log';
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
@@ -148,7 +142,6 @@
|
||||
color: rgb(var(--arcoblue-6));
|
||||
}
|
||||
|
||||
|
||||
:deep(.arco-collapse-item-content) {
|
||||
background: unset;
|
||||
padding: 0;
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<div class="table-right-bar-handle">
|
||||
<a-space>
|
||||
<!-- 清空 -->
|
||||
<a-button v-permission="['asset:terminal-connect-log:management:clear']"
|
||||
<a-button v-permission="['terminal:terminal-connect-log:management:clear']"
|
||||
status="danger"
|
||||
@click="openClear">
|
||||
清空
|
||||
@@ -77,7 +77,7 @@
|
||||
position="br"
|
||||
type="warning"
|
||||
@ok="deleteSelectedRows">
|
||||
<a-button v-permission="['asset:terminal-connect-log:management:delete']"
|
||||
<a-button v-permission="['terminal:terminal-connect-log:management:delete']"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
@@ -88,7 +88,7 @@
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
<!-- 调整 -->
|
||||
<table-adjust :columns="columns"
|
||||
<table-adjust :columns="logColumns"
|
||||
:columns-hook="columnsHook"
|
||||
:query-order="queryOrder"
|
||||
@query="fetchTableData" />
|
||||
@@ -161,19 +161,19 @@
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 连接 -->
|
||||
<a-button v-permission="['asset:terminal:access']"
|
||||
<a-button v-permission="['terminal:terminal:access']"
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.hostId, type: record.type } })">
|
||||
连接
|
||||
</a-button>
|
||||
<!-- 下线 -->
|
||||
<a-popconfirm v-if="record.status === TerminalConnectStatus.CONNECTING"
|
||||
<a-popconfirm v-if="record.status === HostConnectStatus.CONNECTING"
|
||||
content="确认要强制下线吗?"
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="forceOffline(record)">
|
||||
<a-button v-permission="['asset:terminal-connect-log:management:force-offline', 'asset:terminal-connect-session:management:force-offline']"
|
||||
<a-button v-permission="['terminal:terminal-connect-log:management:force-offline', 'terminal:terminal-connect-session:management:force-offline']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
@@ -191,7 +191,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:terminal-connect-log:management:delete']"
|
||||
<a-button v-permission="['terminal:terminal-connect-log:management:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
@@ -211,20 +211,20 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TerminalConnectLogQueryRequest, TerminalConnectLogQueryResponse } from '@/api/asset/terminal-connect-log';
|
||||
import type { TerminalConnectLogQueryRequest, TerminalConnectLogQueryResponse } from '@/api/terminal/terminal-connect-log';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { deleteTerminalConnectLog, getTerminalConnectLogPage, hostForceOffline } from '@/api/asset/terminal-connect-log';
|
||||
import { TableName, connectStatusKey, connectTypeKey, TerminalConnectStatus } from '../types/const';
|
||||
import { deleteTerminalConnectLog, getTerminalConnectLogPage, hostForceOffline } from '@/api/terminal/terminal-connect-log';
|
||||
import { TableName, connectStatusKey, connectTypeKey, HostConnectStatus } from '../types/const';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { useDictStore, useUserStore } from '@/store';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import columns from '../types/table.columns';
|
||||
import { logColumns } from '../types/table.columns';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { dateFormat } from '@/utils';
|
||||
import { openNewRoute } from '@/router';
|
||||
import { DESC, useQueryOrder } from '@/hooks/query-order';
|
||||
import { useQueryOrder, DESC } from '@/hooks/query-order';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
import HostSelector from '@/components/asset/host/selector/index.vue';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
@@ -235,7 +235,7 @@
|
||||
const rowSelection = useRowSelection();
|
||||
const pagination = useTablePagination();
|
||||
const queryOrder = useQueryOrder(TableName, DESC);
|
||||
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||
const { tableColumns, columnsHook } = useTableColumns(TableName, logColumns);
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
|
||||
@@ -252,46 +252,6 @@
|
||||
startTimeRange: undefined,
|
||||
});
|
||||
|
||||
// 加载数据
|
||||
const doFetchTableData = async (request: TerminalConnectLogQueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await getTerminalConnectLogPage(queryOrder.markOrderly(request));
|
||||
tableRenderData.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
selectedKeys.value = [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 切换页码
|
||||
const fetchTableData = (page = 1, limit = pagination.pageSize, form = formModel) => {
|
||||
doFetchTableData({ page, limit, ...form });
|
||||
};
|
||||
|
||||
// 打开清空
|
||||
const openClear = () => {
|
||||
emits('openClear', { ...formModel, id: undefined });
|
||||
};
|
||||
|
||||
// 强制下线
|
||||
const forceOffline = async (record: TerminalConnectLogQueryResponse) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
await hostForceOffline({ id: record.id });
|
||||
record.status = TerminalConnectStatus.FORCE_OFFLINE;
|
||||
record.endTime = Date.now();
|
||||
Message.success('已下线');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 删除选中行
|
||||
const deleteSelectedRows = async () => {
|
||||
try {
|
||||
@@ -332,6 +292,46 @@
|
||||
|
||||
defineExpose({ reload });
|
||||
|
||||
// 加载数据
|
||||
const doFetchTableData = async (request: TerminalConnectLogQueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await getTerminalConnectLogPage(queryOrder.markOrderly(request));
|
||||
tableRenderData.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
selectedKeys.value = [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 切换页码
|
||||
const fetchTableData = (page = 1, limit = pagination.pageSize, form = formModel) => {
|
||||
doFetchTableData({ page, limit, ...form });
|
||||
};
|
||||
|
||||
// 打开清空
|
||||
const openClear = () => {
|
||||
emits('openClear', { ...formModel, id: undefined });
|
||||
};
|
||||
|
||||
// 强制下线
|
||||
const forceOffline = async (record: TerminalConnectLogQueryResponse) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
await hostForceOffline({ id: record.id });
|
||||
record.status = HostConnectStatus.FORCE_OFFLINE;
|
||||
record.endTime = Date.now();
|
||||
Message.success('已下线');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 当前用户
|
||||
const action = route.query.action as string;
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
export const TableName = 'conn-log';
|
||||
|
||||
// 终端连接类型
|
||||
export const TerminalConnectType = {
|
||||
export const HostConnectType = {
|
||||
SSH: 'SSH',
|
||||
SFTP: 'SFTP',
|
||||
RDP: 'RDP',
|
||||
VNC: 'VNC',
|
||||
};
|
||||
|
||||
// 终端连接状态
|
||||
export const TerminalConnectStatus = {
|
||||
export const HostConnectStatus = {
|
||||
CONNECTING: 'CONNECTING',
|
||||
COMPLETE: 'COMPLETE',
|
||||
FAILED: 'FAILED',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { TableColumnData } from '@arco-design/web-vue';
|
||||
|
||||
const columns = [
|
||||
export const logColumns = [
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
@@ -62,5 +62,3 @@ const columns = [
|
||||
default: true,
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
export default columns;
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
</template>
|
||||
<!-- 类型 -->
|
||||
<template #type="{ record }">
|
||||
<!-- 类型 -->
|
||||
<a-tag :color="getDictValue(connectTypeKey, record.type, 'color')">
|
||||
{{ getDictValue(connectTypeKey, record.type) }}
|
||||
</a-tag>
|
||||
@@ -96,7 +97,7 @@
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 连接 -->
|
||||
<a-button v-permission="['asset:terminal:access']"
|
||||
<a-button v-permission="['terminal:terminal:access']"
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.hostId, type: record.type } })">
|
||||
@@ -107,7 +108,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="forceOffline(record)">
|
||||
<a-button v-permission="['asset:terminal-connect-log:management:force-offline', 'asset:terminal-connect-session:management:force-offline']"
|
||||
<a-button v-permission="['terminal:terminal-connect-log:management:force-offline', 'terminal:terminal-connect-session:management:force-offline']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
@@ -127,9 +128,9 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TerminalConnectLogQueryRequest, TerminalConnectLogQueryResponse } from '@/api/asset/terminal-connect-log';
|
||||
import type { TerminalConnectLogQueryRequest, TerminalConnectLogQueryResponse } from '@/api/terminal/terminal-connect-log';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { getTerminalConnectSessions, hostForceOffline } from '@/api/asset/terminal-connect-log';
|
||||
import { getTerminalConnectSessions, hostForceOffline } from '@/api/terminal/terminal-connect-log';
|
||||
import { connectTypeKey } from '../types/const';
|
||||
import { useDictStore } from '@/store';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<div class="layout-container" v-if="render">
|
||||
<!-- 列表-表格 -->
|
||||
<connect-session-table />
|
||||
<connect-session-table @open-watcher="openWatcher"
|
||||
@open-event="(s) => eventDrawer.open(s)" />
|
||||
<!-- 监视模态框 -->
|
||||
<xterm-watcher-modal ref="watcherModal" />
|
||||
<!-- 事件抽屉 -->
|
||||
<connect-event-drawer ref="eventDrawer" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -15,9 +20,27 @@
|
||||
import { ref, onBeforeMount } from 'vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import { dictKeys } from './types/const';
|
||||
import { openNewRoute } from '@/router';
|
||||
import ConnectSessionTable from './components/connect-session-table.vue';
|
||||
import ConnectEventDrawer from '../connect-log/components/connect-event-drawer.vue';
|
||||
import XtermWatcherModal from '@/components/xterm/watcher/modal/index.vue';
|
||||
|
||||
const render = ref(false);
|
||||
const watcherModal = ref();
|
||||
const eventDrawer = ref();
|
||||
|
||||
// 打开监视
|
||||
const openWatcher = (sessionId: string, newWindow: boolean) => {
|
||||
if (newWindow) {
|
||||
// 跳转新页面
|
||||
openNewRoute({
|
||||
name: 'terminalWatcher',
|
||||
query: { sessionId }
|
||||
});
|
||||
} else {
|
||||
watcherModal.value.open(sessionId);
|
||||
}
|
||||
};
|
||||
|
||||
// 加载字典配置
|
||||
onBeforeMount(async () => {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// 终端连接类型 字典项
|
||||
export const connectTypeKey = 'terminalConnectType';
|
||||
|
||||
// 终端连接事件状态 字典项
|
||||
export const hostConnectEventStatusKey = 'hostConnectEventStatus';
|
||||
|
||||
// 加载的字典值
|
||||
export const dictKeys = [connectTypeKey];
|
||||
export const dictKeys = [connectTypeKey, hostConnectEventStatusKey];
|
||||
|
||||
@@ -26,7 +26,7 @@ const columns = [
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
slotName: 'type',
|
||||
width: 98,
|
||||
width: 116,
|
||||
align: 'left',
|
||||
}, {
|
||||
title: '留痕地址',
|
||||
@@ -47,8 +47,8 @@ const columns = [
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 154,
|
||||
align: 'center',
|
||||
width: 208,
|
||||
align: 'left',
|
||||
fixed: 'right',
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
position="br"
|
||||
type="warning"
|
||||
@ok="deleteSelectedRows">
|
||||
<a-button v-permission="['infra:operator-log:delete', 'asset:terminal-sftp-log:management:delete']"
|
||||
<a-button v-permission="['infra:operator-log:delete', 'terminal:terminal-sftp-log:management:delete']"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
@@ -169,7 +169,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['infra:operator-log:delete', 'asset:terminal-sftp-log:management:delete']"
|
||||
<a-button v-permission="['infra:operator-log:delete', 'terminal:terminal-sftp-log:management:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
@@ -189,10 +189,10 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TerminalSftpLogQueryRequest, TerminalSftpLogQueryResponse } from '@/api/asset/terminal-sftp';
|
||||
import type { TerminalSftpLogQueryRequest, TerminalSftpLogQueryResponse } from '@/api/terminal/terminal-sftp';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { getTerminalSftpLogPage, deleteTerminalSftpLog } from '@/api/asset/terminal-sftp';
|
||||
import { sftpOperatorTypeKey, sftpOperatorResultKey, SftpOperatorType, showPathMaxCount, TableName } from '../types/const';
|
||||
import { getTerminalSftpLogPage, deleteTerminalSftpLog } from '@/api/terminal/terminal-sftp';
|
||||
import { TableName, sftpOperatorTypeKey, sftpOperatorResultKey, SftpOperatorType, showPathMaxCount } from '../types/const';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { useDictStore } from '@/store';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
@@ -200,7 +200,7 @@
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { permission10toString } from '@/utils/file';
|
||||
import { DESC, useQueryOrder } from '@/hooks/query-order';
|
||||
import { useQueryOrder, DESC } from '@/hooks/query-order';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
import HostSelector from '@/components/asset/host/selector/index.vue';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化选项
|
||||
onMounted(loadHosts);
|
||||
onActivated(loadHosts);
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
privateKey: undefined,
|
||||
password: undefined,
|
||||
description: undefined,
|
||||
useNewPassword: false,
|
||||
useNewPassword: false
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -238,13 +238,13 @@
|
||||
</a-doption>
|
||||
<!-- SSH -->
|
||||
<a-doption v-if="record.types.includes(HostType.SSH.value)"
|
||||
v-permission="['asset:terminal:access']"
|
||||
v-permission="['terminal:terminal:access']"
|
||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SSH' } })">
|
||||
<span class="more-doption normal">SSH</span>
|
||||
</a-doption>
|
||||
<!-- RDP -->
|
||||
<a-doption v-if="record.types.includes(HostType.RDP.value)"
|
||||
v-permission="['asset:terminal:access']"
|
||||
v-permission="['terminal:terminal:access']"
|
||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'RDP' } })">
|
||||
<span class="more-doption normal">RDP</span>
|
||||
</a-doption>
|
||||
|
||||
@@ -42,6 +42,15 @@
|
||||
class="form-panel"
|
||||
:hostId="hostId" />
|
||||
</a-tab-pane>
|
||||
<!-- RDP 配置 -->
|
||||
<a-tab-pane v-permission="['asset:host:update-config']"
|
||||
key="rdp"
|
||||
title="RDP"
|
||||
:disabled="!hostId || !types.includes(HostType.RDP.value)">
|
||||
<host-form-rdp v-if="hostId"
|
||||
class="form-panel"
|
||||
:hostId="hostId" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
</a-drawer>
|
||||
@@ -62,6 +71,7 @@
|
||||
import HostFormInfo from './host-form-info.vue';
|
||||
import HostFormSpec from './host-form-spec.vue';
|
||||
import HostFormSsh from './host-form-ssh.vue';
|
||||
import HostFormRdp from './host-form-rdp.vue';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
|
||||
|
||||
@@ -0,0 +1,342 @@
|
||||
<template>
|
||||
<a-spin :loading="loading">
|
||||
<!-- 表单 -->
|
||||
<a-form :model="formModel"
|
||||
ref="formRef"
|
||||
label-align="right"
|
||||
:label-col-props="{ span: 6 }"
|
||||
:wrapper-col-props="{ span: 18 }"
|
||||
:rules="rdpFormRules">
|
||||
<!-- 端口 -->
|
||||
<a-form-item field="port"
|
||||
label="端口"
|
||||
hide-asterisk>
|
||||
<a-input-number v-model="formModel.port"
|
||||
placeholder="请输入 RDP 端口"
|
||||
hide-button />
|
||||
</a-form-item>
|
||||
<!-- 用户名 -->
|
||||
<a-form-item field="username"
|
||||
label="用户名"
|
||||
:rules="usernameRules"
|
||||
:help="HostAuthType.IDENTITY === formModel.authType ? '将使用主机身份的用户名' : undefined"
|
||||
hide-asterisk>
|
||||
<a-input v-model="formModel.username"
|
||||
:disabled="HostAuthType.IDENTITY === formModel.authType"
|
||||
placeholder="请输入用户名" />
|
||||
</a-form-item>
|
||||
<!-- 认证方式 -->
|
||||
<a-form-item field="authType"
|
||||
label="认证方式"
|
||||
hide-asterisk>
|
||||
<a-radio-group type="button"
|
||||
class="auth-type-group usn"
|
||||
v-model="formModel.authType"
|
||||
:options="toRadioOptions(passwordAuthTypeKey)" />
|
||||
</a-form-item>
|
||||
<!-- 主机密码 -->
|
||||
<a-form-item v-if="HostAuthType.PASSWORD === formModel.authType"
|
||||
field="password"
|
||||
label="主机密码"
|
||||
:rules="passwordRules"
|
||||
hide-asterisk>
|
||||
<a-input-password v-model="formModel.password"
|
||||
:disabled="!formModel.useNewPassword && formModel.hasPassword"
|
||||
placeholder="主机密码" />
|
||||
<a-switch v-if="formModel.hasPassword"
|
||||
v-model="formModel.useNewPassword"
|
||||
class="password-switch"
|
||||
type="round"
|
||||
checked-text="使用新密码"
|
||||
unchecked-text="使用原密码" />
|
||||
</a-form-item>
|
||||
<!-- 主机身份 -->
|
||||
<a-form-item v-if="HostAuthType.IDENTITY === formModel.authType"
|
||||
field="identityId"
|
||||
label="主机身份"
|
||||
hide-asterisk>
|
||||
<host-identity-selector v-model="formModel.identityId"
|
||||
:type="IdentityType.PASSWORD" />
|
||||
</a-form-item>
|
||||
<!-- RDP版本 -->
|
||||
<a-form-item field="versionGt81"
|
||||
label="RDP版本"
|
||||
hide-asterisk>
|
||||
<a-switch v-model="formModel.versionGt81"
|
||||
type="round"
|
||||
checked-text=">= 8.1"
|
||||
unchecked-text="< 8.1" />
|
||||
</a-form-item>
|
||||
<a-collapse class="advanced-settings" :bordered="false">
|
||||
<a-collapse-item header="高级设置" key="1">
|
||||
<!-- 域 -->
|
||||
<a-form-item field="domain"
|
||||
label="域"
|
||||
hide-asterisk>
|
||||
<a-input v-model="formModel.domain"
|
||||
placeholder="身份验证时使用的域"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 系统时区 -->
|
||||
<a-form-item field="timezone"
|
||||
label="系统时区"
|
||||
hide-asterisk>
|
||||
<a-select v-model="formModel.timezone"
|
||||
placeholder="请选择系统时区"
|
||||
:options="toOptions(timezoneKey)" />
|
||||
</a-form-item>
|
||||
<!-- 键盘布局 -->
|
||||
<a-form-item field="keyboardLayout"
|
||||
label="键盘布局"
|
||||
hide-asterisk>
|
||||
<a-select v-model="formModel.keyboardLayout"
|
||||
placeholder="请选择系统键盘布局"
|
||||
:options="toOptions(keyboardLayoutKey)" />
|
||||
</a-form-item>
|
||||
<!-- 剪切板规范 -->
|
||||
<a-form-item field="clipboardNormalize"
|
||||
label="剪切板规范"
|
||||
hide-asterisk>
|
||||
<a-select v-model="formModel.clipboardNormalize"
|
||||
placeholder="请选择剪切板规范"
|
||||
:options="toOptions(clipboardNormalizeKey)" />
|
||||
</a-form-item>
|
||||
<!-- 预连接id -->
|
||||
<a-form-item field="preConnectionId"
|
||||
label="预连接id"
|
||||
hide-asterisk>
|
||||
<a-input v-model="formModel.preConnectionId"
|
||||
placeholder="请输入预连接id"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 预连接数据 -->
|
||||
<a-form-item field="preConnectionBlob"
|
||||
label="预连接数据"
|
||||
hide-asterisk>
|
||||
<a-input v-model="formModel.preConnectionBlob"
|
||||
placeholder="请输入预连接数据"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 远程应用 -->
|
||||
<a-form-item field="remoteApp"
|
||||
label="远程应用"
|
||||
tooltip="RemoteApp 一般使用双竖线开头, 如 ||notepad, RemoteApp 一般在 Windows Server 系统下可用"
|
||||
hide-asterisk>
|
||||
<a-input v-model="formModel.remoteApp"
|
||||
placeholder="请输入 RemoteApp"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 远程应用路径 -->
|
||||
<a-form-item field="remoteAppDir"
|
||||
label="远程应用路径"
|
||||
hide-asterisk>
|
||||
<a-input v-model="formModel.remoteAppDir"
|
||||
placeholder="请输入 RemoteApp 路径"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 远程应用参数 -->
|
||||
<a-form-item field="remoteAppArgs"
|
||||
label="远程应用参数"
|
||||
style="margin-bottom: 0;"
|
||||
hide-asterisk>
|
||||
<a-input v-model="formModel.remoteAppArgs"
|
||||
placeholder="请输入 RemoteApp 参数"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
</a-collapse-item>
|
||||
</a-collapse>
|
||||
<!-- 操作 -->
|
||||
<a-form-item style="margin-bottom: 0;">
|
||||
<!-- 保存 -->
|
||||
<a-button type="primary"
|
||||
long
|
||||
@click="saveConfig">
|
||||
保存
|
||||
</a-button>
|
||||
<!-- 测试连接 -->
|
||||
<a-tooltip position="tr"
|
||||
content="请先保存后测试连接"
|
||||
mini>
|
||||
<a-button class="extra-button"
|
||||
type="primary"
|
||||
:loading="connectLoading"
|
||||
long
|
||||
@click="testConnect">
|
||||
测试连接
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'hostFormRdp'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { FieldRule } from '@arco-design/web-vue';
|
||||
import type { HostRdpConfig } from '@/api/asset/host-config';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { useDictStore } from '@/store';
|
||||
import { passwordAuthTypeKey, HostAuthType, HostType, timezoneKey, keyboardLayoutKey, clipboardNormalizeKey } from '../types/const';
|
||||
import { IdentityType } from '@/views/asset/host-identity/types/const';
|
||||
import { rdpFormRules } from '../types/form.rules';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { encrypt } from '@/utils/rsa';
|
||||
import { testHostConnect } from '@/api/asset/host';
|
||||
import { getHostConfig, updateHostConfig } from '@/api/asset/host-config';
|
||||
import HostIdentitySelector from '@/components/asset/host-identity/selector/index.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
hostId: number;
|
||||
}>();
|
||||
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { loading: connectLoading, setLoading: setConnectLoading } = useLoading();
|
||||
const { toOptions, toRadioOptions } = useDictStore();
|
||||
|
||||
const formRef = ref();
|
||||
const formModel = ref<HostRdpConfig>({} as HostRdpConfig);
|
||||
|
||||
// 用户名验证
|
||||
const usernameRules = [{
|
||||
validator: (value, cb) => {
|
||||
if (value && value.length > 128) {
|
||||
cb('用户名长度不能大于128位');
|
||||
return;
|
||||
}
|
||||
if (formModel.value.authType !== HostAuthType.IDENTITY && !value) {
|
||||
cb('请输入用户名');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}] as FieldRule[];
|
||||
|
||||
// 密码验证
|
||||
const passwordRules = [{
|
||||
validator: (value, cb) => {
|
||||
if (value && value.length > 256) {
|
||||
cb('密码长度不能大于256位');
|
||||
return;
|
||||
}
|
||||
if (formModel.value.useNewPassword && !value) {
|
||||
cb('请输入密码');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}] as FieldRule[];
|
||||
|
||||
// 加载配置
|
||||
const fetchHostConfig = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
// 加载配置
|
||||
const { data } = await getHostConfig<HostRdpConfig>({
|
||||
hostId: props.hostId,
|
||||
type: HostType.RDP.value,
|
||||
});
|
||||
formModel.value = data;
|
||||
// 使用新密码默认为不包含密码
|
||||
formModel.value.useNewPassword = !formModel.value.hasPassword;
|
||||
} catch ({ message }) {
|
||||
Message.error(`配置加载失败 ${message}`);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 测试连接
|
||||
const testConnect = async () => {
|
||||
// 验证参数
|
||||
const error = await formRef.value.validate();
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
setConnectLoading(true);
|
||||
// 测试连接
|
||||
await testHostConnect({
|
||||
id: props.hostId,
|
||||
type: HostType.RDP.value,
|
||||
});
|
||||
Message.success('连接成功');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setConnectLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 保存配置
|
||||
const saveConfig = async () => {
|
||||
// 验证参数
|
||||
const error = await formRef.value.validate();
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
// 加密参数
|
||||
const requestData = { ...formModel.value };
|
||||
try {
|
||||
requestData.password = await encrypt(formModel.value.password);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
setLoading(true);
|
||||
// 更新
|
||||
await updateHostConfig({
|
||||
hostId: props.hostId,
|
||||
type: HostType.RDP.value,
|
||||
config: JSON.stringify(requestData),
|
||||
});
|
||||
Message.success('修改成功');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(fetchHostConfig);
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.auth-type-group {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
:deep(.arco-radio-button) {
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.password-switch {
|
||||
width: 148px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.advanced-settings {
|
||||
margin-bottom: 16px;
|
||||
|
||||
:deep(.arco-collapse-item-header) {
|
||||
border: none;
|
||||
user-select: none;
|
||||
background: var(--color-fill-1);
|
||||
}
|
||||
|
||||
:deep(.arco-collapse-item-content) {
|
||||
padding: 0;
|
||||
background: unset;
|
||||
|
||||
&-box {
|
||||
padding: 12px 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -18,8 +18,7 @@
|
||||
<a-form-item field="username"
|
||||
label="用户名"
|
||||
:rules="usernameRules"
|
||||
:help="HostAuthType.IDENTITY === formModel.authType ? '将使用主机身份的用户名' : undefined"
|
||||
hide-asterisk>
|
||||
:help="HostAuthType.IDENTITY === formModel.authType ? '将使用主机身份的用户名' : undefined">
|
||||
<a-input v-model="formModel.username"
|
||||
:disabled="HostAuthType.IDENTITY === formModel.authType"
|
||||
placeholder="请输入用户名" />
|
||||
@@ -37,8 +36,7 @@
|
||||
<a-form-item v-if="HostAuthType.PASSWORD === formModel.authType"
|
||||
field="password"
|
||||
label="主机密码"
|
||||
:rules="passwordRules"
|
||||
hide-asterisk>
|
||||
:rules="passwordRules">
|
||||
<a-input-password v-model="formModel.password"
|
||||
:disabled="!formModel.useNewPassword && formModel.hasPassword"
|
||||
placeholder="主机密码" />
|
||||
@@ -256,6 +254,11 @@
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
:deep(.arco-radio-button) {
|
||||
width: 33%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.password-switch {
|
||||
|
||||
@@ -257,13 +257,13 @@
|
||||
<a-button v-if="record.types?.length === 1"
|
||||
type="text"
|
||||
size="mini"
|
||||
v-permission="['asset:terminal:access']"
|
||||
v-permission="['terminal:terminal:access']"
|
||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: record.types[0] } })">
|
||||
连接
|
||||
</a-button>
|
||||
<!-- 多协议连接 -->
|
||||
<a-popover v-else-if="(record.types?.length || 0) > 1"
|
||||
v-permission="['asset:terminal:access']"
|
||||
v-permission="['terminal:terminal:access']"
|
||||
:title="undefined"
|
||||
:content-style="{ padding: '8px' }">
|
||||
<a-button type="text" size="mini">
|
||||
|
||||
@@ -72,5 +72,25 @@ export const hostStatusKey = 'hostStatus';
|
||||
// 主机 SSH 认证方式 字典项
|
||||
export const sshAuthTypeKey = 'hostSshAuthType';
|
||||
|
||||
// 主机密码认证方式 字典项
|
||||
export const passwordAuthTypeKey = 'hostPasswordAuthType';
|
||||
|
||||
// 时区
|
||||
export const timezoneKey = 'timezone';
|
||||
|
||||
// 键盘布局
|
||||
export const keyboardLayoutKey = 'keyboardLayout';
|
||||
|
||||
// 剪切板标准
|
||||
export const clipboardNormalizeKey = 'clipboardNormalize';
|
||||
|
||||
// 剪切板编码
|
||||
export const clipboardEncodingKey = 'clipboardEncoding';
|
||||
|
||||
// 加载的字典值
|
||||
export const dictKeys = [hostTypeKey, hostOsTypeKey, hostArchTypeKey, hostStatusKey, sshAuthTypeKey];
|
||||
export const dictKeys = [
|
||||
hostTypeKey, hostOsTypeKey, hostArchTypeKey, hostStatusKey,
|
||||
sshAuthTypeKey, passwordAuthTypeKey,
|
||||
keyboardLayoutKey, timezoneKey, clipboardNormalizeKey,
|
||||
clipboardEncodingKey,
|
||||
];
|
||||
|
||||
@@ -112,4 +112,24 @@ export const sshFormRules = {
|
||||
}],
|
||||
} as Record<string, FieldRule | FieldRule[]>;
|
||||
|
||||
// rdp 表单规则
|
||||
export const rdpFormRules = {
|
||||
port: [{
|
||||
required: true,
|
||||
message: '请输入 RDP 端口'
|
||||
}, {
|
||||
min: 1,
|
||||
max: 65535,
|
||||
message: 'RDP 端口不合法'
|
||||
}],
|
||||
authType: [{
|
||||
required: true,
|
||||
message: '请选择认证方式'
|
||||
}],
|
||||
identityId: [{
|
||||
required: true,
|
||||
message: '请选择主机身份'
|
||||
}],
|
||||
} as Record<string, FieldRule | FieldRule[]>;
|
||||
|
||||
export default null;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<template>
|
||||
<div class="login-form-wrapper">
|
||||
<!-- 标题 -->
|
||||
<div class="login-form-title usn">{{ t('login.form.title') }}</div>
|
||||
<div class="login-form-title usn">
|
||||
{{ t('login.form.title') }}
|
||||
</div>
|
||||
<!-- 子标题 -->
|
||||
<div class="login-form-sub-title">{{ t('login.form.sub.title') }}</div>
|
||||
<!-- 错误信息 -->
|
||||
@@ -103,6 +105,9 @@
|
||||
}
|
||||
|
||||
&-title {
|
||||
margin-bottom: 2px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
color: var(--color-text-1);
|
||||
font-weight: 500;
|
||||
font-size: 24px;
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
}
|
||||
|
||||
&-text {
|
||||
display: flex;
|
||||
margin-right: 4px;
|
||||
margin-left: 4px;
|
||||
color: var(--color-fill-1);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<a-table row-key="id"
|
||||
:loading="loading"
|
||||
:columns="batchExecColumns"
|
||||
:data="data.asset?.execLogList || []"
|
||||
:data="data.exec?.execLogList || []"
|
||||
:pagination="false"
|
||||
:bordered="false"
|
||||
:scroll="{ y: 258 }">
|
||||
@@ -33,7 +33,7 @@
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 日志 -->
|
||||
<a-button v-permission="['asset:exec-command:exec']"
|
||||
<a-button v-permission="['exec:exec-command:exec']"
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="router.push({ name: 'execCommand', query: { id: record.id } })">
|
||||
@@ -54,7 +54,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { WorkplaceStatisticsData } from '@/views/dashboard/workplace/types/const';
|
||||
import type { WorkplaceStatisticsData } from '../types/const';
|
||||
import { batchExecColumns } from '../types/table.columns';
|
||||
import { useDictStore } from '@/store';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { WorkplaceStatisticsData } from '@/views/dashboard/workplace/types/const';
|
||||
import type { WorkplaceStatisticsData } from '../types/const';
|
||||
import { createLineSeries, LineSeriesColors } from '@/types/chart';
|
||||
import { useRouter } from 'vue-router';
|
||||
import useChartOption from '@/hooks/chart-option';
|
||||
@@ -95,7 +95,6 @@
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<a-table row-key="id"
|
||||
:loading="loading"
|
||||
:columns="terminalLogColumns"
|
||||
:data="data.asset?.terminalConnectList || []"
|
||||
:data="data.terminal?.terminalConnectList || []"
|
||||
:pagination="false"
|
||||
:bordered="false"
|
||||
:scroll="{ y: 258 }">
|
||||
@@ -44,8 +44,8 @@
|
||||
<!-- 操作 -->
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 连接 SSH -->
|
||||
<a-button v-permission="['asset:terminal:access']"
|
||||
<!-- 连接 -->
|
||||
<a-button v-permission="['terminal:terminal:access']"
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="openNewRoute({ name: 'terminal', query: { connect: record.hostId, type: record.type } })">
|
||||
@@ -68,9 +68,9 @@
|
||||
<script lang="ts" setup>
|
||||
import type { WorkplaceStatisticsData } from '../types/const';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { terminalLogColumns } from '../types/table.columns';
|
||||
import { terminalConnectTypeKey } from '../types/const';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useDictStore } from '@/store';
|
||||
import { openNewRoute } from '@/router';
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="chart-container">
|
||||
<div class="statistics-wrapper">
|
||||
<a-statistic title="连接终端次数 (7日)"
|
||||
:value="data.asset?.weekTerminalConnectCount || 0"
|
||||
:value="data.terminal?.weekTerminalConnectCount || 0"
|
||||
:value-from="0"
|
||||
:animation-duration="1000"
|
||||
animation
|
||||
@@ -55,7 +55,7 @@
|
||||
<div class="chart-container">
|
||||
<div class="statistics-wrapper">
|
||||
<a-statistic title="批量执行次数 (7日)"
|
||||
:value="data.asset?.weekExecCommandCount || 0"
|
||||
:value="data.exec?.weekExecCommandCount || 0"
|
||||
:value-from="0"
|
||||
:animation-duration="1000"
|
||||
animation
|
||||
@@ -93,7 +93,7 @@
|
||||
const summaryItems = computed(() => [
|
||||
{
|
||||
title: '今日连接终端次数',
|
||||
value: props.data.asset?.todayTerminalConnectCount || 0,
|
||||
value: props.data.terminal?.todayTerminalConnectCount || 0,
|
||||
prefix: {
|
||||
icon: 'icon-history',
|
||||
background: isDark.value ? '#354276' : '#E8F3FF',
|
||||
@@ -102,7 +102,7 @@
|
||||
go: () => router.push({ name: 'connectLog', query: { action: 'self' } })
|
||||
}, {
|
||||
title: '今日批量执行次数',
|
||||
value: props.data.asset?.todayExecCommandCount || 0,
|
||||
value: props.data.exec?.todayExecCommandCount || 0,
|
||||
prefix: {
|
||||
icon: 'icon-code-block',
|
||||
background: isDark.value ? '#3F385E' : '#F5E8FF',
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
}, {
|
||||
title: '管理的任务数量',
|
||||
value: props.data.asset?.execJobCount || 0,
|
||||
value: props.data.exec?.execJobCount || 0,
|
||||
prefix: {
|
||||
icon: 'icon-calendar-clock',
|
||||
background: isDark.value ? '#3F385E' : '#F5E8FF',
|
||||
@@ -142,7 +142,7 @@
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: props.data.asset?.terminalConnectChart?.x || [],
|
||||
data: props.data.terminal?.terminalConnectChart?.x || [],
|
||||
show: false,
|
||||
},
|
||||
yAxis: {
|
||||
@@ -154,9 +154,9 @@
|
||||
},
|
||||
series: {
|
||||
name: '连接次数',
|
||||
data: !props.data.asset?.terminalConnectChart
|
||||
data: !props.data.terminal?.terminalConnectChart
|
||||
? []
|
||||
: props.data.asset?.terminalConnectChart.data.map(s => {
|
||||
: props.data.terminal?.terminalConnectChart.data.map(s => {
|
||||
return {
|
||||
value: s,
|
||||
};
|
||||
@@ -183,8 +183,8 @@
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: props.data.asset?.execCommandChart?.x || [],
|
||||
show: false,
|
||||
data: props.data.exec?.execCommandChart?.x || [],
|
||||
},
|
||||
yAxis: {
|
||||
show: false,
|
||||
@@ -195,10 +195,10 @@
|
||||
},
|
||||
series: {
|
||||
name: '执行次数',
|
||||
data: !props.data.asset?.execCommandChart
|
||||
data: !props.data.exec?.execCommandChart
|
||||
? []
|
||||
: props.data.asset?.execCommandChart.data.map((s, index) => {
|
||||
const x = props.data.asset?.execCommandChart.x;
|
||||
: props.data.exec?.execCommandChart.data.map((s, index) => {
|
||||
const x = props.data.exec?.execCommandChart.x;
|
||||
return {
|
||||
x: x[index],
|
||||
value: s,
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
:data="statisticsData" />
|
||||
<a-row :gutter="16" class="mb16" align="stretch">
|
||||
<!-- 最近终端连接表格 -->
|
||||
<terminal-connect-table :loading="assetLoading"
|
||||
<terminal-connect-table :loading="terminalLoading"
|
||||
:data="statisticsData" />
|
||||
<!-- 最近批量执行表格 -->
|
||||
<batch-exec-table :loading="assetLoading"
|
||||
<batch-exec-table :loading="execLoading"
|
||||
:data="statisticsData" />
|
||||
<!-- 快捷操作 -->
|
||||
<quick-operation />
|
||||
@@ -38,8 +38,9 @@
|
||||
import { useDictStore } from '@/store';
|
||||
import { dictKeys } from './types/const';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { getExecWorkplaceStatisticsData } from '@/api/statistics/exec-statistics';
|
||||
import { getTerminalWorkplaceStatisticsData } from '@/api/statistics/terminal-statistics';
|
||||
import { getInfraWorkplaceStatisticsData } from '@/api/statistics/infra-statistics';
|
||||
import { getAssetWorkplaceStatisticsData } from '@/api/statistics/asset-statistics';
|
||||
import WorkplaceHeader from './components/workplace-header.vue';
|
||||
import WorkplaceStatistics from './components/workplace-statistics.vue';
|
||||
import TerminalConnectTable from './components/terminal-connect-table.vue';
|
||||
@@ -49,7 +50,8 @@
|
||||
import OperatorLogChart from './components/operator-log-chart.vue';
|
||||
|
||||
const { loading: infraLoading, setLoading: setInfraLoading } = useLoading();
|
||||
const { loading: assetLoading, setLoading: setAssetLoading } = useLoading();
|
||||
const { loading: execLoading, setLoading: setExecLoading } = useLoading();
|
||||
const { loading: terminalLoading, setLoading: setTerminalLoading } = useLoading();
|
||||
|
||||
const render = ref(false);
|
||||
const statisticsData = ref({} as WorkplaceStatisticsData);
|
||||
@@ -63,13 +65,21 @@
|
||||
}).catch(() => {
|
||||
setInfraLoading(false);
|
||||
});
|
||||
// 资产模块
|
||||
setAssetLoading(true);
|
||||
getAssetWorkplaceStatisticsData().then(({ data }) => {
|
||||
setAssetLoading(false);
|
||||
statisticsData.value.asset = data;
|
||||
// 执行模块
|
||||
setExecLoading(true);
|
||||
getExecWorkplaceStatisticsData().then(({ data }) => {
|
||||
setExecLoading(false);
|
||||
statisticsData.value.exec = data;
|
||||
}).catch(() => {
|
||||
setAssetLoading(false);
|
||||
setExecLoading(false);
|
||||
});
|
||||
// 终端模块
|
||||
setTerminalLoading(true);
|
||||
getTerminalWorkplaceStatisticsData().then(({ data }) => {
|
||||
setTerminalLoading(false);
|
||||
statisticsData.value.terminal = data;
|
||||
}).catch(() => {
|
||||
setTerminalLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import type { InfraWorkplaceStatisticsResponse } from '@/api/statistics/infra-statistics';
|
||||
import type { AssetWorkplaceStatisticsResponse } from '@/api/statistics/asset-statistics';
|
||||
import type { ExecWorkplaceStatisticsResponse } from '@/api/statistics/exec-statistics';
|
||||
import type { TerminalWorkplaceStatisticsResponse } from '@/api/statistics/terminal-statistics';
|
||||
import { execHostStatusKey } from '@/components/exec/log/const';
|
||||
|
||||
// 工作台统计数据
|
||||
export interface WorkplaceStatisticsData {
|
||||
infra: InfraWorkplaceStatisticsResponse;
|
||||
asset: AssetWorkplaceStatisticsResponse;
|
||||
exec: ExecWorkplaceStatisticsResponse;
|
||||
terminal: TerminalWorkplaceStatisticsResponse;
|
||||
}
|
||||
|
||||
// 终端连接类型 字典项
|
||||
|
||||
@@ -87,7 +87,11 @@
|
||||
return props.fileList;
|
||||
},
|
||||
set(e) {
|
||||
emits('update:fileList', e);
|
||||
if (e) {
|
||||
emits('update:fileList', e);
|
||||
} else {
|
||||
emits('update:fileList', []);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 命令 -->
|
||||
<a-button v-permission="['asset:exec-command-log:query']"
|
||||
<a-button v-permission="['exec:exec-command-log:query']"
|
||||
type="text"
|
||||
size="mini"
|
||||
:disabled="record.status === ExecHostStatus.WAITING"
|
||||
@@ -56,7 +56,7 @@
|
||||
命令
|
||||
</a-button>
|
||||
<!-- 参数 -->
|
||||
<a-button v-permission="['asset:exec-command-log:query']"
|
||||
<a-button v-permission="['exec:exec-command-log:query']"
|
||||
type="text"
|
||||
size="mini"
|
||||
:disabled="record.status === ExecHostStatus.WAITING"
|
||||
@@ -75,7 +75,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="interruptedHost(record)">
|
||||
<a-button v-permission="['asset:exec-command-log:interrupt']"
|
||||
<a-button v-permission="['exec:exec-command-log:interrupt']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger"
|
||||
@@ -88,7 +88,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:exec-command-log:delete']"
|
||||
<a-button v-permission="['exec:exec-command-log:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="table-right-bar-handle">
|
||||
<a-space>
|
||||
<!-- 执行命令 -->
|
||||
<a-button v-permission="['asset:exec-command:exec']"
|
||||
<a-button v-permission="['exec:exec-command:exec']"
|
||||
type="primary"
|
||||
@click="router.push({ name: 'execCommand' })">
|
||||
执行命令
|
||||
@@ -71,7 +71,7 @@
|
||||
</template>
|
||||
</a-button>
|
||||
<!-- 清空 -->
|
||||
<a-button v-permission="['asset:exec-command-log:management:clear']"
|
||||
<a-button v-permission="['exec:exec-command-log:management:clear']"
|
||||
status="danger"
|
||||
@click="openClear">
|
||||
清空
|
||||
@@ -84,7 +84,7 @@
|
||||
position="br"
|
||||
type="warning"
|
||||
@ok="deleteSelectedRows">
|
||||
<a-button v-permission="['asset:exec-command-log:delete']"
|
||||
<a-button v-permission="['exec:exec-command-log:delete']"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
@@ -153,7 +153,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="doReExecCommand(record)">
|
||||
<a-button v-permission="['asset:exec-command:exec']"
|
||||
<a-button v-permission="['exec:exec-command:exec']"
|
||||
type="text"
|
||||
size="mini">
|
||||
重新执行
|
||||
@@ -166,7 +166,7 @@
|
||||
命令
|
||||
</a-button>
|
||||
<!-- 日志 -->
|
||||
<a-button v-permission="['asset:exec-command-log:query', 'asset:exec-command:exec']"
|
||||
<a-button v-permission="['exec:exec-command-log:query', 'exec:exec-command:exec']"
|
||||
type="text"
|
||||
size="mini"
|
||||
title="ctrl + 左键新页面打开"
|
||||
@@ -178,7 +178,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="doInterruptExecCommand(record)">
|
||||
<a-button v-permission="['asset:exec-command-log:interrupt']"
|
||||
<a-button v-permission="['exec:exec-command-log:interrupt']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger"
|
||||
@@ -191,7 +191,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:exec-command-log:delete']"
|
||||
<a-button v-permission="['exec:exec-command-log:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- 表头 -->
|
||||
<div class="panel-header">
|
||||
<h3>执行命令</h3>
|
||||
<span v-permission="['asset:exec-template:query']"
|
||||
<span v-permission="['exec:exec-template:query']"
|
||||
class="span-blue usn pointer"
|
||||
@click="emits('openTemplate')">
|
||||
从模板中选择
|
||||
|
||||
@@ -172,11 +172,11 @@
|
||||
};
|
||||
|
||||
// 从执行模板设置
|
||||
const setWithTemplate = async ({ id }: ExecTemplateQueryResponse) => {
|
||||
const setWithTemplate = async (record: ExecTemplateQueryResponse) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
// 查询模板信息
|
||||
const { data } = await getExecTemplateWithAuthorized(id);
|
||||
const { data } = await getExecTemplateWithAuthorized(record.id);
|
||||
formModel.value = {
|
||||
...formModel.value,
|
||||
description: data.name,
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 命令 -->
|
||||
<a-button v-permission="['asset:exec-job-log:query']"
|
||||
<a-button v-permission="['exec:exec-job-log:query']"
|
||||
type="text"
|
||||
size="mini"
|
||||
:disabled="record.status === ExecHostStatus.WAITING"
|
||||
@@ -56,7 +56,7 @@
|
||||
命令
|
||||
</a-button>
|
||||
<!-- 参数 -->
|
||||
<a-button v-permission="['asset:exec-job-log:query']"
|
||||
<a-button v-permission="['exec:exec-job-log:query']"
|
||||
type="text"
|
||||
size="mini"
|
||||
:disabled="record.status === ExecHostStatus.WAITING"
|
||||
@@ -75,7 +75,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="interruptedHost(record)">
|
||||
<a-button v-permission="['asset:exec-job-log:interrupt']"
|
||||
<a-button v-permission="['exec:exec-job-log:interrupt']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger"
|
||||
@@ -88,7 +88,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:exec-job-log:delete']"
|
||||
<a-button v-permission="['exec:exec-job-log:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="table-right-bar-handle">
|
||||
<a-space>
|
||||
<!-- 清空 -->
|
||||
<a-button v-permission="['asset:exec-job-log:management:clear']"
|
||||
<a-button v-permission="['exec:exec-job-log:management:clear']"
|
||||
status="danger"
|
||||
@click="openClear">
|
||||
清空
|
||||
@@ -75,7 +75,7 @@
|
||||
position="br"
|
||||
type="warning"
|
||||
@ok="deleteSelectedRows">
|
||||
<a-button v-permission="['asset:exec-job-log:delete']"
|
||||
<a-button v-permission="['exec:exec-job-log:delete']"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
@@ -116,14 +116,14 @@
|
||||
</template>
|
||||
<!-- 任务名称 -->
|
||||
<template #description="{ record }">
|
||||
<span>
|
||||
<div>
|
||||
<span class="span-blue mr4 usn">
|
||||
#{{ record.execSeq }}
|
||||
</span>
|
||||
<span :title="record.description">
|
||||
{{ record.description }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 执行命令 -->
|
||||
<template #command="{ record }">
|
||||
@@ -179,7 +179,7 @@
|
||||
命令
|
||||
</a-button>
|
||||
<!-- 日志 -->
|
||||
<a-button v-permission="['asset:exec-job-log:query']"
|
||||
<a-button v-permission="['exec:exec-job-log:query']"
|
||||
type="text"
|
||||
size="mini"
|
||||
title="ctrl + 左键新页面打开"
|
||||
@@ -191,7 +191,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="doInterruptExecJob(record)">
|
||||
<a-button v-permission="['asset:exec-job-log:interrupt']"
|
||||
<a-button v-permission="['exec:exec-job-log:interrupt']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger"
|
||||
@@ -204,7 +204,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:exec-job-log:delete']"
|
||||
<a-button v-permission="['exec:exec-job-log:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
@@ -238,20 +238,20 @@
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
import { DESC, useQueryOrder } from '@/hooks/query-order';
|
||||
import { ExecStatus, execStatusKey, ExecMode } from '@/components/exec/log/const';
|
||||
import { useExpandable, useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { TableName } from '../types/const';
|
||||
import { useExpandable, useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { useDictStore } from '@/store';
|
||||
import { dateFormat, formatDuration } from '@/utils';
|
||||
import { useQueryOrder, DESC } from '@/hooks/query-order';
|
||||
import ExecJobHostLogTable from './exec-job-host-log-table.vue';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
const emits = defineEmits(['viewCommand', 'viewParams', 'viewLog', 'openClear']);
|
||||
|
||||
const rowSelection = useRowSelection();
|
||||
const expandable = useExpandable();
|
||||
const rowSelection = useRowSelection();
|
||||
const pagination = useTablePagination();
|
||||
const queryOrder = useQueryOrder(TableName, DESC);
|
||||
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||
@@ -276,45 +276,6 @@
|
||||
emits('openClear', { ...formModel, id: undefined, description: undefined });
|
||||
};
|
||||
|
||||
// 删除当前行
|
||||
const deleteRow = async (record: ExecLogQueryResponse) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
// 调用删除接口
|
||||
await deleteExecJobLog(record.id);
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 删除选中行
|
||||
const deleteSelectedRows = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
// 调用删除接口
|
||||
await batchDeleteExecJobLog(selectedKeys.value);
|
||||
Message.success(`成功删除 ${selectedKeys.value.length} 条数据`);
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 重新加载
|
||||
const reload = () => {
|
||||
// 重新加载数据
|
||||
fetchTableData();
|
||||
};
|
||||
|
||||
defineExpose({ reload });
|
||||
|
||||
// 中断执行
|
||||
const doInterruptExecJob = async (record: ExecLogQueryResponse) => {
|
||||
try {
|
||||
@@ -391,6 +352,45 @@
|
||||
});
|
||||
};
|
||||
|
||||
// 删除当前行
|
||||
const deleteRow = async (record: ExecLogQueryResponse) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
// 调用删除接口
|
||||
await deleteExecJobLog(record.id);
|
||||
Message.success('删除成功');
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 删除选中行
|
||||
const deleteSelectedRows = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
// 调用删除接口
|
||||
await batchDeleteExecJobLog(selectedKeys.value);
|
||||
Message.success(`成功删除 ${selectedKeys.value.length} 条数据`);
|
||||
selectedKeys.value = [];
|
||||
// 重新加载
|
||||
reload();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 重新加载
|
||||
const reload = () => {
|
||||
// 重新加载数据
|
||||
fetchTableData();
|
||||
};
|
||||
|
||||
defineExpose({ reload });
|
||||
|
||||
// 加载数据
|
||||
const doFetchTableData = async (request: ExecLogQueryRequest) => {
|
||||
try {
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
:hide-label="true"
|
||||
:help="'使用 @{{ xxx }} 来替换参数, 输入_可以获取全部变量'">
|
||||
<template #extra>
|
||||
<span v-permission="['asset:exec-template:query']"
|
||||
<span v-permission="['exec:exec-template:query']"
|
||||
class="span-blue usn pointer"
|
||||
@click="emits('openTemplate')">
|
||||
从模板中选择
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<div class="table-right-bar-handle">
|
||||
<a-space>
|
||||
<!-- 新增 -->
|
||||
<a-button v-permission="['asset:exec-job:create']"
|
||||
<a-button v-permission="['exec:exec-job:create']"
|
||||
type="primary"
|
||||
@click="emits('openAdd')">
|
||||
新增
|
||||
@@ -67,7 +67,7 @@
|
||||
position="br"
|
||||
type="warning"
|
||||
@ok="deleteSelectedRows">
|
||||
<a-button v-permission="['asset:exec-job:delete']"
|
||||
<a-button v-permission="['exec:exec-job:delete']"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
@@ -122,7 +122,7 @@
|
||||
<!-- 任务状态 -->
|
||||
<template #status="{ record }">
|
||||
<!-- 状态开关 可编辑 -->
|
||||
<a-switch v-if="hasPermission('asset:exec-job:update-status')"
|
||||
<a-switch v-if="hasPermission('exec:exec-job:update-status')"
|
||||
type="round"
|
||||
:default-checked="record.status === ExecJobStatus.ENABLED"
|
||||
:checked-text="getDictValue(execJobStatusKey, ExecJobStatus.ENABLED)"
|
||||
@@ -164,7 +164,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="triggerJob(record.id)">
|
||||
<a-button v-permission="['asset:exec-job:trigger']"
|
||||
<a-button v-permission="['exec:exec-job:trigger']"
|
||||
type="text"
|
||||
size="mini">
|
||||
手动触发
|
||||
@@ -175,7 +175,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:exec-job:delete']"
|
||||
<a-button v-permission="['exec:exec-job:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
@@ -189,12 +189,12 @@
|
||||
</a-button>
|
||||
<template #content>
|
||||
<!-- 修改任务 -->
|
||||
<a-doption v-permission="['asset:exec-job:update']"
|
||||
<a-doption v-permission="['exec:exec-job:update']"
|
||||
@click="emits('openUpdate', record.id)">
|
||||
<span class="more-doption normal">修改任务</span>
|
||||
</a-doption>
|
||||
<!-- 修改执行用户 -->
|
||||
<a-doption v-permission="['asset:exec-job:update-exec-user']"
|
||||
<a-doption v-permission="['exec:exec-job:update-exec-user']"
|
||||
@click="emits('updateExecUser', record)">
|
||||
<span class="more-doption normal">修改执行用户</span>
|
||||
</a-doption>
|
||||
@@ -223,10 +223,10 @@
|
||||
import { TableName, ExecJobStatus, execJobStatusKey, execStatusKey } from '../types/const';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { useCacheStore, useDictStore, useUserStore } from '@/store';
|
||||
import { useQueryOrder, DESC } from '@/hooks/query-order';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { dateFormat } from '@/utils';
|
||||
import { DESC, useQueryOrder } from '@/hooks/query-order';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
import { CronNextTimes, dictKeys } from './types/const';
|
||||
import ExecJobTable from './components/exec-job-table.vue';
|
||||
import ExecJobFormDrawer from './components/exec-job-form-drawer.vue';
|
||||
import ExecUserUpdateModal from './components/exec-user-update-modal.vue';
|
||||
import ExecJobDetailDrawer from './components/exec-job-detail-drawer.vue';
|
||||
import ExecUserUpdateModal from './components/exec-user-update-modal.vue';
|
||||
import AuthorizedHostModal from '@/components/asset/host/authorized-host-modal/index.vue';
|
||||
import ExecTemplateModal from '@/components/exec/template/modal/index.vue';
|
||||
import CronNextModal from '@/components/meta/cron/next-modal/index.vue';
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<div class="table-right-bar-handle">
|
||||
<a-space>
|
||||
<!-- 新增 -->
|
||||
<a-button v-permission="['asset:exec-template:create']"
|
||||
<a-button v-permission="['exec:exec-template:create']"
|
||||
type="primary"
|
||||
@click="emits('openAdd')">
|
||||
新增
|
||||
@@ -54,7 +54,7 @@
|
||||
position="br"
|
||||
type="warning"
|
||||
@ok="deleteSelectedRows">
|
||||
<a-button v-permission="['asset:exec-template:delete']"
|
||||
<a-button v-permission="['exec:exec-template:delete']"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
@@ -96,14 +96,14 @@
|
||||
<!-- 操作 -->
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<a-button v-permission="['asset:exec-command:exec']"
|
||||
<a-button v-permission="['exec:exec-command:exec']"
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="emits('openExec', record.id)">
|
||||
执行
|
||||
</a-button>
|
||||
<!-- 修改 -->
|
||||
<a-button v-permission="['asset:exec-template:update']"
|
||||
<a-button v-permission="['exec:exec-template:update']"
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="emits('openUpdate', record.id)">
|
||||
@@ -114,7 +114,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:exec-template:delete']"
|
||||
<a-button v-permission="['exec:exec-template:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
@@ -140,10 +140,10 @@
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
import { TableName } from '../types/const';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { TableName } from '../types/const';
|
||||
import { useQueryOrder, DESC } from '@/hooks/query-order';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { DESC, useQueryOrder } from '@/hooks/query-order';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openExec']);
|
||||
@@ -154,8 +154,8 @@
|
||||
const { tableColumns, columnsHook } = useTableColumns(TableName, columns);
|
||||
const { loading, setLoading } = useLoading();
|
||||
|
||||
const selectedKeys = ref<number[]>([]);
|
||||
const tableRenderData = ref<ExecTemplateQueryResponse[]>([]);
|
||||
const selectedKeys = ref<Array<number>>([]);
|
||||
const tableRenderData = ref<Array<ExecTemplateQueryResponse>>([]);
|
||||
const formModel = reactive<ExecTemplateQueryRequest>({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="table-right-bar-handle">
|
||||
<a-space>
|
||||
<!-- 上传 -->
|
||||
<a-button v-permission="['asset:upload-task:upload']"
|
||||
<a-button v-permission="['exec:upload-task:upload']"
|
||||
type="primary"
|
||||
@click="router.push({ name: 'batchUpload' })">
|
||||
上传
|
||||
@@ -71,7 +71,7 @@
|
||||
</template>
|
||||
</a-button>
|
||||
<!-- 清空 -->
|
||||
<a-button v-permission="['asset:upload-task:management:clear']"
|
||||
<a-button v-permission="['exec:upload-task:management:clear']"
|
||||
status="danger"
|
||||
@click="openClear">
|
||||
清空
|
||||
@@ -84,7 +84,7 @@
|
||||
position="br"
|
||||
type="warning"
|
||||
@ok="deleteSelectedRows">
|
||||
<a-button v-permission="['asset:upload-task:delete']"
|
||||
<a-button v-permission="['exec:upload-task:delete']"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
@@ -142,7 +142,7 @@
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 详情 -->
|
||||
<a-button v-permission="['asset:upload-task:query']"
|
||||
<a-button v-permission="['exec:upload-task:query']"
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="router.push({ name: 'batchUpload', query: { id: record.id } })">
|
||||
@@ -154,7 +154,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="doCancel(record)">
|
||||
<a-button v-permission="['asset:upload-task:upload']"
|
||||
<a-button v-permission="['exec:upload-task:upload']"
|
||||
type="text"
|
||||
size="mini">
|
||||
取消
|
||||
@@ -165,7 +165,7 @@
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:upload-task:delete']"
|
||||
<a-button v-permission="['exec:upload-task:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
@@ -193,10 +193,10 @@
|
||||
import columns from '../types/table.columns';
|
||||
import { TableName, UploadTaskStatus, uploadTaskStatusKey } from '../types/const';
|
||||
import { useTablePagination, useRowSelection, useTableColumns } from '@/hooks/table';
|
||||
import { useQueryOrder, DESC } from '@/hooks/query-order';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useDictStore } from '@/store';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { DESC, useQueryOrder } from '@/hooks/query-order';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
@@ -211,8 +211,8 @@
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
|
||||
const pullIntervalId = ref();
|
||||
const selectedKeys = ref<number[]>([]);
|
||||
const tableRenderData = ref<UploadTaskQueryResponse[]>([]);
|
||||
const selectedKeys = ref<Array<number>>([]);
|
||||
const tableRenderData = ref<Array<UploadTaskQueryResponse>>([]);
|
||||
const formModel = reactive<UploadTaskQueryRequest>({
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
@@ -278,6 +278,8 @@
|
||||
fetchTableData();
|
||||
};
|
||||
|
||||
defineExpose({ reload });
|
||||
|
||||
// 加载状态
|
||||
const pullTaskStatus = async () => {
|
||||
const unCompleteIdList = tableRenderData.value
|
||||
|
||||
@@ -33,7 +33,6 @@ export const cache = [{
|
||||
message: '请选择是否缓存'
|
||||
}] as FieldRule[];
|
||||
|
||||
|
||||
export default {
|
||||
parentId,
|
||||
name,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<!-- 查询头组件 -->
|
||||
<operator-log-query-header :model="formModel"
|
||||
:visible-user="false"
|
||||
@submit="() => table.fetchTableData()" />
|
||||
@submit="() => table.reload()" />
|
||||
</a-card>
|
||||
<!-- 表格 -->
|
||||
<a-card class="general-card table-card">
|
||||
@@ -22,7 +22,7 @@
|
||||
<operator-log-simple-table ref="table"
|
||||
:current="!user"
|
||||
:base-params="{ userId: user?.id }"
|
||||
:model="formModel"/>
|
||||
:model="formModel" />
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -47,5 +47,3 @@ export const operatorLogResultKey = 'operatorLogResult';
|
||||
|
||||
// 加载的字典值
|
||||
export const dictKeys = [operatorLogModuleKey, operatorLogTypeKey, operatorRiskLevelKey, operatorLogResultKey];
|
||||
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
import { useQueryOrder, ASC } from '@/hooks/query-order';
|
||||
import TableAdjust from '@/components/app/table-adjust/index.vue';
|
||||
|
||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openImport', 'openExport', 'openResetPassword', 'openGrantRole']);
|
||||
const emits = defineEmits(['openAdd', 'openUpdate', 'openResetPassword', 'openGrantRole']);
|
||||
|
||||
const cacheStore = useCacheStore();
|
||||
const rowSelection = useRowSelection();
|
||||
|
||||
Reference in New Issue
Block a user