🔨 优化批量执行日志跳转逻辑.
This commit is contained in:
@@ -4,6 +4,8 @@ export const MessageStatus = {
|
|||||||
READ: 1,
|
READ: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MESSAGE_CONFIG_KEY = 'messageConfig';
|
||||||
|
|
||||||
// 查询数量
|
// 查询数量
|
||||||
export const messageLimit = 15;
|
export const messageLimit = 15;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
type="round"
|
type="round"
|
||||||
checked-text="未读"
|
checked-text="未读"
|
||||||
unchecked-text="全部"
|
unchecked-text="全部"
|
||||||
@change="changeMessageStatus" />
|
@change="reloadAllMessage" />
|
||||||
<!-- 全部已读 -->
|
<!-- 全部已读 -->
|
||||||
<a-button class="header-button"
|
<a-button class="header-button"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { MessageRecordResponse } from '@/api/system/message';
|
import type { MessageRecordResponse } from '@/api/system/message';
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted, onUnmounted } from 'vue';
|
||||||
import {
|
import {
|
||||||
clearSystemMessage,
|
clearSystemMessage,
|
||||||
deleteSystemMessage,
|
deleteSystemMessage,
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useDictStore } from '@/store';
|
import { useDictStore } from '@/store';
|
||||||
import { dictKeys, messageClassifyKey, messageTypeKey, defaultClassify, messageLimit, MessageStatus } from './const';
|
import { dictKeys, messageClassifyKey, messageTypeKey, defaultClassify, MESSAGE_CONFIG_KEY, messageLimit, MessageStatus } from './const';
|
||||||
import List from './list.vue';
|
import List from './list.vue';
|
||||||
import Modal from './modal.vue';
|
import Modal from './modal.vue';
|
||||||
import { clearHtmlTag, replaceHtmlTag } from '@/utils';
|
import { clearHtmlTag, replaceHtmlTag } from '@/utils';
|
||||||
@@ -96,8 +96,8 @@
|
|||||||
const hasMore = ref(true);
|
const hasMore = ref(true);
|
||||||
const modalRef = ref();
|
const modalRef = ref();
|
||||||
|
|
||||||
// 修改消息状态
|
// 重新加载消息
|
||||||
const changeMessageStatus = async () => {
|
const reloadAllMessage = async () => {
|
||||||
hasMore.value = true;
|
hasMore.value = true;
|
||||||
messageList.value = [];
|
messageList.value = [];
|
||||||
// 查询数量
|
// 查询数量
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
setMessageLoading(false);
|
setMessageLoading(false);
|
||||||
}
|
}
|
||||||
// 查询消息
|
// 查询消息
|
||||||
await changeMessageStatus();
|
await reloadAllMessage();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 点击消息
|
// 点击消息
|
||||||
@@ -239,7 +239,29 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 获取消息
|
// 获取消息
|
||||||
onMounted(changeMessageStatus);
|
onMounted(() => {
|
||||||
|
// 获取配置缓存
|
||||||
|
const item = localStorage.getItem(MESSAGE_CONFIG_KEY);
|
||||||
|
if (item) {
|
||||||
|
const config = JSON.parse(item) as Record<string, any>;
|
||||||
|
if (config?.currentClassify) {
|
||||||
|
currentClassify.value = config.currentClassify;
|
||||||
|
}
|
||||||
|
if (config?.queryUnread) {
|
||||||
|
queryUnread.value = config.queryUnread;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 查询数据
|
||||||
|
reloadAllMessage();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置缓存配置
|
||||||
|
onUnmounted(() => {
|
||||||
|
localStorage.setItem(MESSAGE_CONFIG_KEY, JSON.stringify({
|
||||||
|
currentClassify: currentClassify.value,
|
||||||
|
queryUnread: queryUnread.value,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -139,18 +139,19 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
color: var(--color-text-1);
|
color: var(--color-text-1);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&-title {
|
&-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
|
|
||||||
&-text {
|
&-text {
|
||||||
width: calc(100% - @actions-width - @gap);
|
width: calc(100% - @actions-width - @gap);
|
||||||
display: block;
|
display: block;
|
||||||
|
font-size: 15px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-overflow: clip;
|
text-overflow: clip;
|
||||||
}
|
}
|
||||||
@@ -179,6 +180,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-content {
|
&-content {
|
||||||
|
display: block;
|
||||||
|
padding-bottom: 2px;
|
||||||
color: var(--color-text-1);
|
color: var(--color-text-1);
|
||||||
text-overflow: clip;
|
text-overflow: clip;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,51 +1,37 @@
|
|||||||
import type { AppRouteRecordRaw } from '../types';
|
import type { AppRouteRecordRaw } from '../types';
|
||||||
import { DEFAULT_LAYOUT, FULL_LAYOUT } from '../base';
|
import { DEFAULT_LAYOUT } from '../base';
|
||||||
|
|
||||||
const EXEC: AppRouteRecordRaw[] = [
|
const EXEC: AppRouteRecordRaw = {
|
||||||
{
|
name: 'execModule',
|
||||||
name: 'execModule',
|
path: '/exec-module',
|
||||||
path: '/exec-module',
|
component: DEFAULT_LAYOUT,
|
||||||
component: DEFAULT_LAYOUT,
|
children: [
|
||||||
children: [
|
{
|
||||||
{
|
name: 'execCommand',
|
||||||
name: 'execCommand',
|
path: '/exec-command',
|
||||||
path: '/exec-command',
|
component: () => import('@/views/exec/exec-command/index.vue'),
|
||||||
component: () => import('@/views/exec/exec-command/index.vue'),
|
},
|
||||||
},
|
{
|
||||||
{
|
name: 'execCommandLog',
|
||||||
name: 'execCommandLog',
|
path: '/exec-log',
|
||||||
path: '/exec-log',
|
component: () => import('@/views/exec/exec-command-log/index.vue'),
|
||||||
component: () => import('@/views/exec/exec-command-log/index.vue'),
|
},
|
||||||
},
|
{
|
||||||
{
|
name: 'batchUpload',
|
||||||
name: 'batchUpload',
|
path: '/batch-upload',
|
||||||
path: '/batch-upload',
|
component: () => import('@/views/exec/batch-upload/index.vue'),
|
||||||
component: () => import('@/views/exec/batch-upload/index.vue'),
|
},
|
||||||
},
|
{
|
||||||
{
|
name: 'uploadTask',
|
||||||
name: 'uploadTask',
|
path: '/upload-task',
|
||||||
path: '/upload-task',
|
component: () => import('@/views/exec/upload-task/index.vue'),
|
||||||
component: () => import('@/views/exec/upload-task/index.vue'),
|
},
|
||||||
},
|
{
|
||||||
{
|
name: 'execTemplate',
|
||||||
name: 'execTemplate',
|
path: '/exec-template',
|
||||||
path: '/exec-template',
|
component: () => import('@/views/exec/exec-template/index.vue'),
|
||||||
component: () => import('@/views/exec/exec-template/index.vue'),
|
},
|
||||||
},
|
],
|
||||||
],
|
};
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'execFullModule',
|
|
||||||
path: '/exec-full-module',
|
|
||||||
component: FULL_LAYOUT,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: 'execCommandLogView',
|
|
||||||
path: '/exec-log-view',
|
|
||||||
component: () => import('@/views/exec/exec-command-log-view/index.vue'),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
export default EXEC;
|
export default EXEC;
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="container">
|
|
||||||
<div class="wrapper">
|
|
||||||
<exec-log-panel ref="log"
|
|
||||||
type="BATCH"
|
|
||||||
:visible-back="false" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
name: 'execCommandLogView'
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { onMounted, ref, nextTick } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { getExecCommandLog } from '@/api/exec/exec-command-log';
|
|
||||||
import ExecLogPanel from '@/components/exec/log/panel/index.vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const log = ref();
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
const init = async (id: number) => {
|
|
||||||
// 获取执行日志
|
|
||||||
const { data } = await getExecCommandLog(id);
|
|
||||||
// 打开日志
|
|
||||||
await nextTick(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
log.value.open(data);
|
|
||||||
}, 50);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const idParam = route.query.id;
|
|
||||||
if (idParam) {
|
|
||||||
init(Number.parseInt(idParam as string));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.container {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
position: relative;
|
|
||||||
padding: 16px;
|
|
||||||
background: var(--color-fill-2);
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
if (newWindow) {
|
if (newWindow) {
|
||||||
// 跳转新页面
|
// 跳转新页面
|
||||||
openNewRoute({
|
openNewRoute({
|
||||||
name: 'execCommandLogView',
|
name: 'execCommand',
|
||||||
query: {
|
query: {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user