🔨 添加执行超时.
This commit is contained in:
@@ -38,6 +38,11 @@ public enum ExecHostStatusEnum {
|
|||||||
*/
|
*/
|
||||||
FAILED(false),
|
FAILED(false),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行超时
|
||||||
|
*/
|
||||||
|
TIMEOUT(false),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 中断执行
|
* 中断执行
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 命令执行器
|
* 命令执行器
|
||||||
@@ -93,7 +92,7 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
|||||||
this.updateStatus(ExecHostStatusEnum.FAILED, ex);
|
this.updateStatus(ExecHostStatusEnum.FAILED, ex);
|
||||||
} else if (executor.isTimeout()) {
|
} else if (executor.isTimeout()) {
|
||||||
// 更新执行超时
|
// 更新执行超时
|
||||||
this.updateStatus(ExecHostStatusEnum.FAILED, new TimeoutException());
|
this.updateStatus(ExecHostStatusEnum.TIMEOUT, null);
|
||||||
} else {
|
} else {
|
||||||
// 更新执行完成
|
// 更新执行完成
|
||||||
this.updateStatus(ExecHostStatusEnum.COMPLETED, null);
|
this.updateStatus(ExecHostStatusEnum.COMPLETED, null);
|
||||||
@@ -144,6 +143,9 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
|||||||
// 失败
|
// 失败
|
||||||
update.setFinishTime(new Date());
|
update.setFinishTime(new Date());
|
||||||
update.setErrorMessage(this.getErrorMessage(ex));
|
update.setErrorMessage(this.getErrorMessage(ex));
|
||||||
|
} else if (ExecHostStatusEnum.TIMEOUT.equals(status)) {
|
||||||
|
// 超时
|
||||||
|
update.setFinishTime(new Date());
|
||||||
} else if (ExecHostStatusEnum.INTERRUPTED.equals(status)) {
|
} else if (ExecHostStatusEnum.INTERRUPTED.equals(status)) {
|
||||||
// 中断
|
// 中断
|
||||||
update.setFinishTime(new Date());
|
update.setFinishTime(new Date());
|
||||||
@@ -152,8 +154,6 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
|||||||
log.info("ExecCommandHandler.updateStatus finish id: {}, effect: {}", id, effect);
|
log.info("ExecCommandHandler.updateStatus finish id: {}, effect: {}", id, effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO timeout
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(String msg) {
|
public void write(String msg) {
|
||||||
this.executor.write(msg);
|
this.executor.write(msg);
|
||||||
@@ -182,9 +182,7 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
|||||||
Streams.close(executor);
|
Streams.close(executor);
|
||||||
Streams.close(sessionStore);
|
Streams.close(sessionStore);
|
||||||
Streams.close(logOutputStream);
|
Streams.close(logOutputStream);
|
||||||
// TODO TEST 异步关闭日志
|
|
||||||
execLogManager.asyncCloseTailFile(execHostCommand.getLogPath());
|
execLogManager.asyncCloseTailFile(execHostCommand.getLogPath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -195,9 +193,7 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
|||||||
*/
|
*/
|
||||||
private String getErrorMessage(Exception ex) {
|
private String getErrorMessage(Exception ex) {
|
||||||
String message;
|
String message;
|
||||||
if (ex instanceof TimeoutException) {
|
if (ex instanceof InvalidArgumentException) {
|
||||||
message = "执行超时";
|
|
||||||
} else if (ex instanceof InvalidArgumentException) {
|
|
||||||
message = ex.getMessage();
|
message = ex.getMessage();
|
||||||
} else if (ex instanceof ConnectionRuntimeException) {
|
} else if (ex instanceof ConnectionRuntimeException) {
|
||||||
message = "连接失败";
|
message = "连接失败";
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.orion.ops.framework.websocket.core.utils.WebSockets;
|
|||||||
import com.orion.ops.module.asset.define.AssetThreadPools;
|
import com.orion.ops.module.asset.define.AssetThreadPools;
|
||||||
import com.orion.ops.module.asset.entity.dto.ExecHostLogTailDTO;
|
import com.orion.ops.module.asset.entity.dto.ExecHostLogTailDTO;
|
||||||
import com.orion.ops.module.asset.entity.dto.ExecLogTailDTO;
|
import com.orion.ops.module.asset.entity.dto.ExecLogTailDTO;
|
||||||
|
import com.orion.ops.module.asset.handler.host.exec.log.constant.LogConst;
|
||||||
import com.orion.ops.module.asset.handler.host.exec.log.manager.ExecLogManager;
|
import com.orion.ops.module.asset.handler.host.exec.log.manager.ExecLogManager;
|
||||||
import com.orion.ops.module.asset.handler.host.exec.log.tracker.ExecLogTracker;
|
import com.orion.ops.module.asset.handler.host.exec.log.tracker.ExecLogTracker;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -55,6 +56,11 @@ public class ExecLogTailHandler extends AbstractWebSocketHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
|
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
|
||||||
|
String payload = message.getPayload();
|
||||||
|
// ping
|
||||||
|
if (LogConst.PING_PAYLOAD.equals(payload)) {
|
||||||
|
WebSockets.sendText(session, LogConst.PONG_PAYLOAD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -68,16 +74,12 @@ public class ExecLogTailHandler extends AbstractWebSocketHandler {
|
|||||||
log.info("ExecLogTailHandler-afterConnectionClosed id: {}, code: {}, reason: {}", id, status.getCode(), status.getReason());
|
log.info("ExecLogTailHandler-afterConnectionClosed id: {}, code: {}, reason: {}", id, status.getCode(), status.getReason());
|
||||||
// 关闭会话
|
// 关闭会话
|
||||||
ExecLogTailDTO info = WebSockets.getAttr(session, ExtraFieldConst.INFO);
|
ExecLogTailDTO info = WebSockets.getAttr(session, ExtraFieldConst.INFO);
|
||||||
// 移除追踪器 TODO TEST
|
// 移除追踪器
|
||||||
for (ExecHostLogTailDTO host : info.getHosts()) {
|
for (ExecHostLogTailDTO host : info.getHosts()) {
|
||||||
execLogManager.removeTracker(this.getTrackerId(id, info, host));
|
execLogManager.removeTracker(this.getTrackerId(id, info, host));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO ws://127.0.0.1:9200/orion/keep-alive/exec/log/ive0btemHxmEY0HyTm5
|
|
||||||
// todo 首页元数据加载
|
|
||||||
// todo 批量执行的 warn
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取追踪器 id
|
* 获取追踪器 id
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ package com.orion.ops.module.asset.handler.host.exec.log.constant;
|
|||||||
*/
|
*/
|
||||||
public interface LogConst {
|
public interface LogConst {
|
||||||
|
|
||||||
|
String PING_PAYLOAD = "p";
|
||||||
|
|
||||||
|
String PONG_PAYLOAD = "p";
|
||||||
|
|
||||||
String SEPARATOR = "|";
|
String SEPARATOR = "|";
|
||||||
|
|
||||||
int TRACKER_OFFSET_LINE = 200;
|
int TRACKER_OFFSET_LINE = 200;
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public class ExecLogTracker implements IExecLogTracker {
|
|||||||
// 开始监听文件
|
// 开始监听文件
|
||||||
tracker.run();
|
tracker.run();
|
||||||
// 监听完成回调
|
// 监听完成回调
|
||||||
// TODO test
|
|
||||||
this.close = true;
|
this.close = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("exec log tracker error path: {}", absolutePath, e);
|
log.error("exec log tracker error path: {}", absolutePath, e);
|
||||||
@@ -80,7 +79,6 @@ public class ExecLogTracker implements IExecLogTracker {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
// TODO test
|
|
||||||
log.info("ExecLogTracker.close path: {}", absolutePath);
|
log.info("ExecLogTracker.close path: {}", absolutePath);
|
||||||
if (close) {
|
if (close) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { CanvasAddon } from 'xterm-addon-canvas';
|
|||||||
export const AppenderOption: ITerminalOptions = {
|
export const AppenderOption: ITerminalOptions = {
|
||||||
theme: {
|
theme: {
|
||||||
foreground: '#FFFFFF',
|
foreground: '#FFFFFF',
|
||||||
background: '#212529',
|
background: '#202020',
|
||||||
selectionBackground: '#B5D5FF',
|
selectionBackground: '#B5D5FF',
|
||||||
},
|
},
|
||||||
rightClickSelectsWord: true,
|
rightClickSelectsWord: true,
|
||||||
@@ -47,9 +47,6 @@ export interface ILogAppender {
|
|||||||
// 初始化
|
// 初始化
|
||||||
init(refs: Array<LogDomRef>): Promise<void>;
|
init(refs: Array<LogDomRef>): Promise<void>;
|
||||||
|
|
||||||
// 自适应
|
|
||||||
fit(): void;
|
|
||||||
|
|
||||||
// 关闭 client
|
// 关闭 client
|
||||||
closeClient(): void;
|
closeClient(): void;
|
||||||
|
|
||||||
@@ -2,17 +2,19 @@ import type { ExecTailRequest } from '@/api/exec/exec';
|
|||||||
import { getExecLogTailToken } from '@/api/exec/exec';
|
import { getExecLogTailToken } from '@/api/exec/exec';
|
||||||
import type { ILogAppender, LogAddons, LogAppenderConf, LogDomRef } from './appender.const';
|
import type { ILogAppender, LogAddons, LogAppenderConf, LogDomRef } from './appender.const';
|
||||||
import { AppenderOption } from './appender.const';
|
import { AppenderOption } from './appender.const';
|
||||||
import { Terminal } from 'xterm';
|
|
||||||
import { webSocketBaseUrl } from '@/utils/env';
|
import { webSocketBaseUrl } from '@/utils/env';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import { createWebSocket } from '@/utils';
|
import { createWebSocket } from '@/utils';
|
||||||
|
import { Terminal } from 'xterm';
|
||||||
import { FitAddon } from 'xterm-addon-fit';
|
import { FitAddon } from 'xterm-addon-fit';
|
||||||
import { SearchAddon } from 'xterm-addon-search';
|
import { SearchAddon } from 'xterm-addon-search';
|
||||||
import { CanvasAddon } from 'xterm-addon-canvas';
|
import { CanvasAddon } from 'xterm-addon-canvas';
|
||||||
|
import { useDebounceFn } from '@vueuse/core';
|
||||||
|
import { addEventListen, removeEventListen } from '@/utils/event';
|
||||||
|
|
||||||
// todo ping
|
// todo SEARCH addon setfixed
|
||||||
// todo SEARCH addon
|
|
||||||
// todo font-size totop copy tobottom selectall clear
|
// todo font-size totop copy tobottom selectall clear
|
||||||
|
// todo 批量执行的 warn
|
||||||
|
|
||||||
// 执行日志 appender 实现
|
// 执行日志 appender 实现
|
||||||
export default class LogAppender implements ILogAppender {
|
export default class LogAppender implements ILogAppender {
|
||||||
@@ -21,13 +23,16 @@ export default class LogAppender implements ILogAppender {
|
|||||||
|
|
||||||
private client?: WebSocket;
|
private client?: WebSocket;
|
||||||
|
|
||||||
private appenderRel: Record<string, LogAppenderConf>;
|
private readonly appenderRel: Record<string, LogAppenderConf>;
|
||||||
|
|
||||||
private keepAliveTask?: number;
|
private keepAliveTask?: number;
|
||||||
|
|
||||||
|
private readonly fitFn: () => {};
|
||||||
|
|
||||||
constructor(config: ExecTailRequest) {
|
constructor(config: ExecTailRequest) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.appenderRel = {};
|
this.appenderRel = {};
|
||||||
|
this.fitFn = useDebounceFn(this.fit).bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
@@ -56,6 +61,8 @@ export default class LogAppender implements ILogAppender {
|
|||||||
addons
|
addons
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// 注册自适应事件
|
||||||
|
addEventListen(window, 'resize', this.fitFn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化插件
|
// 初始化插件
|
||||||
@@ -114,12 +121,15 @@ export default class LogAppender implements ILogAppender {
|
|||||||
|
|
||||||
// 关闭 view
|
// 关闭 view
|
||||||
closeView(): void {
|
closeView(): void {
|
||||||
|
// 关闭 terminal
|
||||||
Object.values(this.appenderRel).forEach(s => {
|
Object.values(this.appenderRel).forEach(s => {
|
||||||
s.terminal?.dispose();
|
s.terminal?.dispose();
|
||||||
if (s.addons) {
|
if (s.addons) {
|
||||||
Object.values(s.addons).forEach(s => s.dispose());
|
Object.values(s.addons).forEach(s => s.dispose());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// 移除自适应事件
|
||||||
|
removeEventListen(window, 'resize', this.fitFn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭
|
// 关闭
|
||||||
@@ -6,7 +6,35 @@
|
|||||||
class="log-view">
|
class="log-view">
|
||||||
<!-- 面板头部 -->
|
<!-- 面板头部 -->
|
||||||
<div class="log-header">
|
<div class="log-header">
|
||||||
header
|
<!-- 左侧信息 -->
|
||||||
|
<div class="log-header-left">
|
||||||
|
<a-space :size="12">
|
||||||
|
<!-- 状态 -->
|
||||||
|
<a-tag :color="getDictValue(execHostStatusKey, host.status, 'color')">
|
||||||
|
{{ getDictValue(execHostStatusKey, host.status) }}
|
||||||
|
</a-tag>
|
||||||
|
<!-- exitStatus -->
|
||||||
|
<a-tag v-if="host.exitStatus || host.exitStatus === 0"
|
||||||
|
:color="host.exitStatus === 0 ? 'arcoblue' : 'orangered'"
|
||||||
|
title="exit status">
|
||||||
|
<template #icon>
|
||||||
|
<icon-check v-if="host.exitStatus === 0" />
|
||||||
|
<icon-exclamation v-else />
|
||||||
|
</template>
|
||||||
|
<span class="tag-value">{{ host.exitStatus }}</span>
|
||||||
|
</a-tag>
|
||||||
|
<!-- 持续时间 -->
|
||||||
|
<a-tag color="arcoblue" title="持续时间">
|
||||||
|
<template #icon>
|
||||||
|
<icon-loading v-if="host.status === execHostStatus.WAITING || host.status === execHostStatus.RUNNING" />
|
||||||
|
<icon-clock-circle v-else />
|
||||||
|
</template>
|
||||||
|
<span class="tag-value">{{ formatDuration(host.startTime, host.finishTime) || '0s' }}</span>
|
||||||
|
</a-tag>
|
||||||
|
</a-space>
|
||||||
|
</div>
|
||||||
|
<!-- 右侧操作 -->
|
||||||
|
<div class="log-header-right">TODO</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 日志面板 -->
|
<!-- 日志面板 -->
|
||||||
<div class="log-wrapper">
|
<div class="log-wrapper">
|
||||||
@@ -25,10 +53,13 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VNodeRef } from 'vue';
|
import type { VNodeRef } from 'vue';
|
||||||
import type { ExecCommandResponse, ExecCommandHostResponse } from '@/api/exec/exec';
|
import type { ExecCommandResponse } from '@/api/exec/exec';
|
||||||
import type { LogDomRef, ILogAppender } from '@/components/view/log-appender/appender.const';
|
import type { LogDomRef, ILogAppender } from '@/components/xtrem/log-appender/appender.const';
|
||||||
import { nextTick, ref } from 'vue';
|
import { nextTick, ref } from 'vue';
|
||||||
import LogAppender from '@/components/view/log-appender/log-appender';
|
import { formatDuration } from '@/utils';
|
||||||
|
import { execHostStatus, execHostStatusKey } from '@/views/exec/exec-log/types/const';
|
||||||
|
import { useDictStore } from '@/store';
|
||||||
|
import LogAppender from '@/components/xtrem/log-appender/log-appender';
|
||||||
import 'xterm/css/xterm.css';
|
import 'xterm/css/xterm.css';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -36,6 +67,8 @@
|
|||||||
command: ExecCommandResponse;
|
command: ExecCommandResponse;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const { getDictValue } = useDictStore();
|
||||||
|
|
||||||
const logRefs = ref<Array<LogDomRef>>([]);
|
const logRefs = ref<Array<LogDomRef>>([]);
|
||||||
const appender = ref<ILogAppender>();
|
const appender = ref<ILogAppender>();
|
||||||
|
|
||||||
@@ -80,7 +113,25 @@
|
|||||||
.log-header {
|
.log-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: @header-height;
|
height: @header-height;
|
||||||
background: green;
|
padding: 8px;
|
||||||
|
border-radius: 4px 4px 0 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
background: var(--color-bg-1);
|
||||||
|
color: var(--color-text-1);
|
||||||
|
|
||||||
|
:deep(.arco-tag-icon) {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-value {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-right {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-wrapper {
|
.log-wrapper {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
import { execStatus } from '@/views/exec/exec-log/types/const';
|
import { execStatus } from '@/views/exec/exec-log/types/const';
|
||||||
import LogPanelHost from './log-panel-host.vue';
|
import LogPanelHost from './log-panel-host.vue';
|
||||||
import LogPanelView from './log-panel-view.vue';
|
import LogPanelView from './log-panel-view.vue';
|
||||||
|
import { useDictStore } from '@/store';
|
||||||
|
|
||||||
const emits = defineEmits(['back']);
|
const emits = defineEmits(['back']);
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@
|
|||||||
if (hostStatus) {
|
if (hostStatus) {
|
||||||
host.status = hostStatus.status;
|
host.status = hostStatus.status;
|
||||||
host.startTime = hostStatus.startTime;
|
host.startTime = hostStatus.startTime;
|
||||||
host.finishTime = hostStatus.finishTime;
|
host.finishTime = hostStatus.finishTime || Date.now();
|
||||||
host.exitStatus = hostStatus.exitStatus;
|
host.exitStatus = hostStatus.exitStatus;
|
||||||
host.errorMessage = hostStatus.errorMessage;
|
host.errorMessage = hostStatus.errorMessage;
|
||||||
}
|
}
|
||||||
@@ -116,7 +117,6 @@
|
|||||||
|
|
||||||
.host-container, .log-container {
|
.host-container, .log-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 16px;
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--color-bg-2);
|
background: var(--color-bg-2);
|
||||||
@@ -124,6 +124,7 @@
|
|||||||
|
|
||||||
.host-container {
|
.host-container {
|
||||||
width: @host-width;
|
width: @host-width;
|
||||||
|
padding: 16px;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
hostId: 4,
|
hostId: 4,
|
||||||
hostName: 'main-44',
|
hostName: 'main-44',
|
||||||
hostAddress: '192.412.53.2',
|
hostAddress: '192.412.53.2',
|
||||||
status: 'FAILED'
|
status: 'TIMEOUT'
|
||||||
},]
|
},]
|
||||||
} as ExecCommandResponse);
|
} as ExecCommandResponse);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -221,7 +221,7 @@
|
|||||||
|
|
||||||
const emits = defineEmits(['viewCommand', 'viewParams', 'viewLog', 'openClear']);
|
const emits = defineEmits(['viewCommand', 'viewParams', 'viewLog', 'openClear']);
|
||||||
|
|
||||||
// TODO 日志 清理 ctrl日志 ctrl重新执行
|
// TODO 日志 ctrl日志 ctrl重新执行
|
||||||
|
|
||||||
const pagination = usePagination();
|
const pagination = usePagination();
|
||||||
const rowSelection = useRowSelection();
|
const rowSelection = useRowSelection();
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ export const execHostStatus = {
|
|||||||
COMPLETED: 'COMPLETED',
|
COMPLETED: 'COMPLETED',
|
||||||
// 执行失败
|
// 执行失败
|
||||||
FAILED: 'FAILED',
|
FAILED: 'FAILED',
|
||||||
|
// 执行超时
|
||||||
|
TIMEOUT: 'TIMEOUT',
|
||||||
// 已中断
|
// 已中断
|
||||||
INTERRUPTED: 'INTERRUPTED',
|
INTERRUPTED: 'INTERRUPTED',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { OperatorLogQueryRequest, OperatorLogQueryResponse } from '@/api/user/operator-log';
|
import type { OperatorLogQueryRequest, OperatorLogQueryResponse } from '@/api/user/operator-log';
|
||||||
import { ref, onMounted, onBeforeMount } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { operatorLogModuleKey, operatorLogTypeKey, operatorRiskLevelKey, operatorLogResultKey, dictKeys } from '../types/const';
|
import { operatorLogModuleKey, operatorLogTypeKey, operatorRiskLevelKey, operatorLogResultKey, dictKeys } from '../types/const';
|
||||||
import columns from '../types/table.columns';
|
import columns from '../types/table.columns';
|
||||||
import { getLogDetail } from '../types/const';
|
import { getLogDetail } from '../types/const';
|
||||||
@@ -146,14 +146,12 @@
|
|||||||
fetchTableData
|
fetchTableData
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
onMounted(async () => {
|
||||||
// 加载字典值
|
// 加载字典值
|
||||||
onBeforeMount(async () => {
|
|
||||||
const dictStore = useDictStore();
|
const dictStore = useDictStore();
|
||||||
await dictStore.loadKeys(dictKeys);
|
await dictStore.loadKeys(dictKeys);
|
||||||
});
|
// 设置表格列
|
||||||
|
|
||||||
// 初始化
|
|
||||||
onMounted(() => {
|
|
||||||
let cols = columns.map(s => {
|
let cols = columns.map(s => {
|
||||||
return { ...s };
|
return { ...s };
|
||||||
}).filter(s => s.dataIndex !== 'username');
|
}).filter(s => s.dataIndex !== 'username');
|
||||||
@@ -168,6 +166,7 @@
|
|||||||
cols = cols.filter(s => s.dataIndex !== 'handle');
|
cols = cols.filter(s => s.dataIndex !== 'handle');
|
||||||
}
|
}
|
||||||
tableColumns.value = cols;
|
tableColumns.value = cols;
|
||||||
|
// 加载数据
|
||||||
fetchTableData();
|
fetchTableData();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user