🚧 修改 exitCode.

This commit is contained in:
lijiahangmax
2024-05-15 00:20:38 +08:00
parent 4fe6208d0e
commit a6209751de
16 changed files with 76 additions and 116 deletions

View File

@@ -54,7 +54,7 @@ export interface ExecHostLogQueryResponse extends TableData {
status: string;
command: string;
parameter: string;
exitStatus: number;
exitCode: number;
errorMessage: string;
startTime: number;
finishTime: number;

View File

@@ -95,7 +95,7 @@
host.startTime = hostStatus.startTime;
// 结束时间绑定了使用时间 如果未完成则使用当前时间
host.finishTime = hostStatus.finishTime || Date.now();
host.exitStatus = hostStatus.exitStatus;
host.exitCode = hostStatus.exitCode;
host.errorMessage = hostStatus.errorMessage;
}
}

View File

@@ -12,15 +12,15 @@
<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">
<!-- exitCode -->
<a-tag v-if="host.exitCode || host.exitCode === 0"
:color="host.exitCode === 0 ? 'arcoblue' : 'orangered'"
title="exit code">
<template #icon>
<icon-check v-if="host.exitStatus === 0" />
<icon-check v-if="host.exitCode === 0" />
<icon-exclamation v-else />
</template>
<span class="tag-value">{{ host.exitStatus }}</span>
<span class="tag-value">{{ host.exitCode }}</span>
</a-tag>
<!-- 持续时间 -->
<a-tag v-if="host.startTime"

View File

@@ -10,10 +10,10 @@
@change="loadClassifyMessage">
<!-- 消息列表 -->
<a-tab-pane v-for="item in toOptions(messageClassifyKey)"
:key="item.value">
:key="item.value as string">
<!-- 标题 -->
<template #title>
<span class="usn">{{ item.label }} ({{ classifyCount[item.value] || 0 }})</span>
<span class="usn">{{ item.label }} ({{ classifyCount[item.value as any] || 0 }})</span>
</template>
<!-- 消息列表 -->
</a-tab-pane>
@@ -51,11 +51,7 @@
:message-list="messageList"
@load="loadMessage"
@click="clickMessage"
@view="viewMessage"
@delete="deleteMessage" />
<!-- 模态框 -->
<modal ref="modalRef"
@delete="deleteMessage" />
</div>
</template>
@@ -78,11 +74,10 @@
} from '@/api/system/message';
import useLoading from '@/hooks/loading';
import { useRouter } from 'vue-router';
import { clearHtmlTag, replaceHtmlTag } from '@/utils';
import { useDictStore } from '@/store';
import { dictKeys, messageClassifyKey, messageTypeKey, defaultClassify, MESSAGE_CONFIG_KEY, messageLimit, MessageStatus } from './const';
import List from './list.vue';
import Modal from './modal.vue';
import { clearHtmlTag, replaceHtmlTag } from '@/utils';
const { loading: fetchLoading, setLoading: setFetchLoading } = useLoading();
const { loading: messageLoading, setLoading: setMessageLoading } = useLoading();
@@ -94,7 +89,6 @@
const classifyCount = ref<Record<string, number>>({});
const messageList = ref<Array<MessageRecordResponse>>([]);
const hasMore = ref(true);
const modalRef = ref();
// 重新加载消息
const reloadAllMessage = async () => {
@@ -193,26 +187,6 @@
if (redirectComponent && redirectComponent !== '0') {
// 跳转组件
router.push({ name: redirectComponent, query: { key: message.relKey } });
} else {
// 打开消息模态框
modalRef.value.open(message);
}
};
// 查看消息
const viewMessage = async (message: MessageRecordResponse) => {
setMessageLoading(true);
try {
// 设置为已读
if (message.status === MessageStatus.UNREAD) {
await updateSystemMessageRead(message.id);
message.status = MessageStatus.READ;
}
// 打开消息模态框
modalRef.value.open(message);
} catch (ex) {
} finally {
setMessageLoading(false);
}
};

View File

@@ -33,20 +33,13 @@
<!-- tag -->
<div class="message-item-title-status">
<template v-if="getDictValue(messageTypeKey, message.type, 'tagVisible', false)">
<a-tag size="mini" :color="getDictValue(messageTypeKey, message.type, 'tagColor')">
<a-tag size="small" :color="getDictValue(messageTypeKey, message.type, 'tagColor')">
{{ getDictValue(messageTypeKey, message.type, 'tagLabel') }}
</a-tag>
</template>
</div>
<!-- 操作 -->
<div class="message-item-title-actions">
<!-- 查看 -->
<a-button class="mr4"
size="mini"
type="text"
@click.stop="emits('view', message)">
查看
</a-button>
<!-- 删除 -->
<a-button size="mini"
type="text"
@@ -57,12 +50,10 @@
</div>
</div>
<!-- 内容 -->
<div v-html="message.contentHtml"
class="message-item-content"
:title="message.content" />
<div v-html="message.contentHtml" class="message-item-content" />
<!-- 时间 -->
<div class="message-item-time">
{{ dateFormat(new Date(message.createTime))}}
{{ dateFormat(new Date(message.createTime)) }}
</div>
</div>
<!-- 加载中 -->
@@ -98,7 +89,7 @@
import { useDictStore } from '@/store';
import { dateFormat } from '@/utils';
const emits = defineEmits(['load', 'click', 'view', 'delete']);
const emits = defineEmits(['load', 'click', 'delete']);
const props = defineProps<{
fetchLoading: boolean;
messageLoading: boolean;

View File

@@ -1,49 +0,0 @@
<template>
<a-modal v-model:visible="visible"
title-align="start"
:title="record.title"
:top="80"
:align-center="false"
:unmount-on-close="true"
ok-text="删除"
:hide-cancel="true"
:ok-button-props="{ status: 'danger', size: 'small' }"
:body-style="{ padding: '20px' }"
@ok="emits('delete', record)">
<div class="content" v-html="record.contentHtml" />
</a-modal>
</template>
<script lang="ts">
export default {
name: 'messageBoxModal'
};
</script>
<script lang="ts" setup>
import type { MessageRecordResponse } from '@/api/system/message';
import useVisible from '@/hooks/visible';
import { ref } from 'vue';
const emits = defineEmits(['delete']);
const { visible, setVisible } = useVisible();
const record = ref<MessageRecordResponse>({} as MessageRecordResponse);
// 打开
const open = (message: MessageRecordResponse) => {
record.value = message;
setVisible(true);
};
defineExpose({ open });
</script>
<style lang="less" scoped>
.content {
font-size: 16px;
color: var(--color-text-2);
}
</style>

View File

@@ -374,7 +374,7 @@
host.status = s.status;
host.startTime = s.startTime;
host.finishTime = s.finishTime;
host.exitStatus = s.exitStatus;
host.exitCode = s.exitCode;
host.errorMessage = s.errorMessage;
});
};

View File

@@ -18,12 +18,12 @@ const columns = [
tooltip: true,
}, {
title: '退出码',
dataIndex: 'exitStatus',
slotName: 'exitStatus',
dataIndex: 'exitCode',
slotName: 'exitCode',
align: 'left',
width: 118,
render: ({ record }) => {
return isNumber(record.exitStatus) ? record.exitStatus : '-';
return isNumber(record.exitCode) ? record.exitCode : '-';
},
}, {
title: '执行状态',

View File

@@ -339,7 +339,7 @@
host.status = s.status;
host.startTime = s.startTime;
host.finishTime = s.finishTime;
host.exitStatus = s.exitStatus;
host.exitCode = s.exitCode;
host.errorMessage = s.errorMessage;
});
};