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({ return request({
url: `/trace/task/hlr/${ids}`, url: `/trace/task/hlr/${ids}`,
method: 'delete', method: 'delete',
timeout: 60_000,
}); });
} }
@@ -35,6 +36,7 @@ export function startTaskHLR(data: Record<string, any>) {
url: '/trace/task/hlr/start', url: '/trace/task/hlr/start',
method: 'post', method: 'post',
data: data, data: data,
timeout: 60_000,
}); });
} }
@@ -48,6 +50,7 @@ export function stopTaskHLR(data: Record<string, any>) {
url: '/trace/task/hlr/stop', url: '/trace/task/hlr/stop',
method: 'post', method: 'post',
data: data, data: data,
timeout: 60_000,
}); });
} }
@@ -63,3 +66,18 @@ export function fileTaskHLR(data: Record<string, any>) {
data: data, 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' }, meta: { title: 'router.helpDoc' },
component: () => import('@/views/tool/help/index.vue'), 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', path: '/quick-start',
name: 'QuickStart', name: 'QuickStart',
@@ -154,6 +160,7 @@ const WHITE_LIST: string[] = [
'/help', '/help',
'/register', '/register',
'/quick-start', '/quick-start',
'/trace-task-hlr',
]; ];
/**全局路由-前置守卫 */ /**全局路由-前置守卫 */

View File

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