🎨 修改代码规范.
This commit is contained in:
@@ -30,12 +30,12 @@
|
||||
|
||||
// 跳转日志
|
||||
onMounted(async () => {
|
||||
const idParam = route.query.id;
|
||||
const keyParam = route.query.key;
|
||||
const idParam = route.query.id as string;
|
||||
const keyParam = route.query.key as string;
|
||||
if (idParam) {
|
||||
await panel.value?.openLog(Number.parseInt(idParam as string));
|
||||
await panel.value?.openLog(Number.parseInt(idParam));
|
||||
} else if (keyParam) {
|
||||
await panel.value?.openLog(Number.parseInt(keyParam as string));
|
||||
await panel.value?.openLog(Number.parseInt(keyParam));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<a-table row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:columns="hostColumns"
|
||||
:data="row.hosts"
|
||||
:expandable="expandable"
|
||||
:scroll="{ y: '100%' }"
|
||||
@@ -105,7 +105,7 @@
|
||||
import { deleteExecCommandHostLog } from '@/api/exec/exec-command-log';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/host-table.columns';
|
||||
import { hostColumns } from '../types/table.columns';
|
||||
import { execHostStatusKey, ExecHostStatus } from '@/components/exec/log/const';
|
||||
import { useDictStore } from '@/store';
|
||||
import { useExpandable } from '@/hooks/table';
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:columns="tableColumns"
|
||||
:row-selection="rowSelection"
|
||||
:expandable="expandable"
|
||||
:data="tableRenderData"
|
||||
@@ -218,7 +218,7 @@
|
||||
} from '@/api/exec/exec-command-log';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
import { tableColumns } from '../types/table.columns';
|
||||
import { ExecStatus, execStatusKey } from '@/components/exec/log/const';
|
||||
import { useExpandable, useTablePagination, useRowSelection } from '@/hooks/table';
|
||||
import { useDictStore } from '@/store';
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
import { isNumber } from '@/utils/is';
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, {
|
||||
title: '执行主机',
|
||||
dataIndex: 'hostName',
|
||||
slotName: 'hostName',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '退出码',
|
||||
dataIndex: 'exitCode',
|
||||
slotName: 'exitCode',
|
||||
align: 'left',
|
||||
width: 118,
|
||||
render: ({ record }) => {
|
||||
return isNumber(record.exitCode) ? record.exitCode : '-';
|
||||
},
|
||||
}, {
|
||||
title: '执行状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'left',
|
||||
width: 118,
|
||||
}, {
|
||||
title: '错误信息',
|
||||
dataIndex: 'errorMessage',
|
||||
slotName: 'errorMessage',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
width: 168,
|
||||
}, {
|
||||
title: '执行时间',
|
||||
dataIndex: 'startTime',
|
||||
slotName: 'startTime',
|
||||
align: 'left',
|
||||
width: 190,
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 258,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
export default columns;
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
import { isNumber } from '@/utils/is';
|
||||
|
||||
const columns = [
|
||||
// 表格列
|
||||
export const tableColumns = [
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
@@ -51,4 +53,56 @@ const columns = [
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
export default columns;
|
||||
// 主机列
|
||||
export const hostColumns = [
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, {
|
||||
title: '执行主机',
|
||||
dataIndex: 'hostName',
|
||||
slotName: 'hostName',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '退出码',
|
||||
dataIndex: 'exitCode',
|
||||
slotName: 'exitCode',
|
||||
align: 'left',
|
||||
width: 118,
|
||||
render: ({ record }) => {
|
||||
return isNumber(record.exitCode) ? record.exitCode : '-';
|
||||
},
|
||||
}, {
|
||||
title: '执行状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'left',
|
||||
width: 118,
|
||||
}, {
|
||||
title: '错误信息',
|
||||
dataIndex: 'errorMessage',
|
||||
slotName: 'errorMessage',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
width: 168,
|
||||
}, {
|
||||
title: '执行时间',
|
||||
dataIndex: 'startTime',
|
||||
slotName: 'startTime',
|
||||
align: 'left',
|
||||
width: 190,
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 258,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
@@ -60,12 +60,12 @@
|
||||
|
||||
// 跳转日志
|
||||
onMounted(async () => {
|
||||
const idParam = route.query.id;
|
||||
const keyParam = route.query.key;
|
||||
const idParam = route.query.id as string;
|
||||
const keyParam = route.query.key as string;
|
||||
if (idParam) {
|
||||
await openLogWithId(Number.parseInt(idParam as string));
|
||||
await openLogWithId(Number.parseInt(idParam));
|
||||
} else if (keyParam) {
|
||||
await openLogWithId(Number.parseInt(keyParam as string));
|
||||
await openLogWithId(Number.parseInt(keyParam));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
const idParam = route.query.id;
|
||||
const idParam = route.query.id as string;
|
||||
if (idParam) {
|
||||
init(Number.parseInt(idParam as string));
|
||||
init(Number.parseInt(idParam));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<a-table row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:columns="hostColumns"
|
||||
:data="row.hosts"
|
||||
:expandable="expandable"
|
||||
:scroll="{ y: '100%' }"
|
||||
@@ -106,7 +106,7 @@
|
||||
import { execHostStatusKey, ExecHostStatus } from '@/components/exec/log/const';
|
||||
import { useDictStore } from '@/store';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '@/views/exec/exec-command-log/types/host-table.columns';
|
||||
import { hostColumns } from '@/views/exec/exec-command-log/types/table.columns';
|
||||
import { useExpandable } from '@/hooks/table';
|
||||
import { dateFormat, formatDuration } from '@/utils';
|
||||
import { downloadExecJobLogFile } from '@/api/exec/exec-job-log';
|
||||
|
||||
Reference in New Issue
Block a user