feat: HLR跟踪任务页面免登录/trace-task-hlr

This commit is contained in:
TsMask
2024-09-20 12:05:16 +08:00
parent d268d920e7
commit f8439bb40a
3 changed files with 67 additions and 43 deletions

View File

@@ -22,6 +22,7 @@ export function delTaskHLR(ids: string | number) {
return request({
url: `/trace/task/hlr/${ids}`,
method: 'delete',
timeout: 60_000,
});
}
@@ -35,6 +36,7 @@ export function startTaskHLR(data: Record<string, any>) {
url: '/trace/task/hlr/start',
method: 'post',
data: data,
timeout: 60_000,
});
}
@@ -48,6 +50,7 @@ export function stopTaskHLR(data: Record<string, any>) {
url: '/trace/task/hlr/stop',
method: 'post',
data: data,
timeout: 60_000,
});
}
@@ -63,3 +66,18 @@ export function fileTaskHLR(data: Record<string, any>) {
data: data,
});
}
/**
*
* @param query
* @returns object
*/
export function filePullTaskHLR(query: Record<string, any>) {
return request({
url: '/trace/task/hlr/filePull',
method: 'get',
params: query,
responseType: 'blob',
timeout: 60_000,
});
}

View File

@@ -87,6 +87,12 @@ const constantRoutes: RouteRecordRaw[] = [
meta: { title: 'router.helpDoc' },
component: () => import('@/views/tool/help/index.vue'),
},
{
path: '/trace-task-hlr',
name: 'TraceTaskHLR',
meta: { title: 'router.traceTaskHLR' },
component: () => import('@/views/traceManage/task-hlr/index.vue'),
},
{
path: '/quick-start',
name: 'QuickStart',
@@ -154,6 +160,7 @@ const WHITE_LIST: string[] = [
'/help',
'/register',
'/quick-start',
'/trace-task-hlr',
];
/**全局路由-前置守卫 */

View File

@@ -13,7 +13,8 @@ import {
startTaskHLR,
stopTaskHLR,
fileTaskHLR,
} from '@/api/traceManage/taskHLR';
filePullTaskHLR,
} from '@/api/trace/taskHLR';
import { getNeFile } from '@/api/tool/neFile';
import saveAs from 'file-saver';
const { t } = useI18n();
@@ -174,28 +175,25 @@ function fnRecordDelete(row: Record<string, any>) {
title: t('common.tipTitle'),
content: t('views.traceManage.task.delTaskTip', { id: row.id }),
onOk() {
const key = 'delTraceTask';
message.loading({ content: t('common.loading'), key });
// 进行中的先停止任务后删除记录
if (row.status === '1') {
stopTaskHLR({ id: row.id });
}
delTaskHLR(row.id).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('views.traceManage.task.delTask', { id: row.id }),
key,
duration: 2,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key: key,
duration: 2,
});
}
});
const hide = message.loading(t('common.loading'), 0);
delTaskHLR(row.id)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('views.traceManage.task.delTask', { id: row.id }),
duration: 3,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
duration: 2,
});
}
})
.finally(() => {
hide();
});
},
});
}
@@ -247,24 +245,25 @@ function fnRecordStop(id: string) {
title: t('common.tipTitle'),
content: t('views.traceManage.task.stopTaskTip', { id }),
onOk() {
const key = 'delTraceTask';
message.loading({ content: t('common.loading'), key });
stopTaskHLR({ id }).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('views.traceManage.task.stopTask', { id }),
key,
duration: 2,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key: key,
duration: 2,
});
}
});
const hide = message.loading(t('common.loading'), 0);
stopTaskHLR({ id })
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('views.traceManage.task.stopTask', { id }),
duration: 3,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
})
.finally(() => {
hide();
});
},
});
}
@@ -356,7 +355,7 @@ function fnModalVisibleByVive(id: Record<string, any>) {
if (res.code === RESULT_CODE_SUCCESS) {
for (const item of res.data) {
if (item.err != '') {
modalState.fileErrMsg += `${item.neId}: ${item.err} \n`;
modalState.fileErrMsg += `${item.neName}: ${item.err} \n`;
continue;
}
modalState.fileList.push(item);
@@ -455,7 +454,7 @@ function fnDownloadFile(row: Record<string, any>) {
downLoading.value = true;
const hide = message.loading(t('common.loading'), 0);
const path = row.filePath.substring(0, row.filePath.lastIndexOf('/'));
getNeFile({
filePullTaskHLR({
neType: row.neType,
neId: row.neId,
path: path,