From f8439bb40ab44d3a4c5afe12e9a9544cff4e092e Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 20 Sep 2024 12:05:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20HLR=E8=B7=9F=E8=B8=AA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=85=8D=E7=99=BB=E5=BD=95/trace-task-hlr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/{traceManage => trace}/taskHLR.ts | 18 +++++ src/router/index.ts | 7 ++ src/views/traceManage/task-hlr/index.vue | 85 +++++++++++------------ 3 files changed, 67 insertions(+), 43 deletions(-) rename src/api/{traceManage => trace}/taskHLR.ts (76%) diff --git a/src/api/traceManage/taskHLR.ts b/src/api/trace/taskHLR.ts similarity index 76% rename from src/api/traceManage/taskHLR.ts rename to src/api/trace/taskHLR.ts index d65a737f..6d6adf34 100644 --- a/src/api/traceManage/taskHLR.ts +++ b/src/api/trace/taskHLR.ts @@ -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) { url: '/trace/task/hlr/start', method: 'post', data: data, + timeout: 60_000, }); } @@ -48,6 +50,7 @@ export function stopTaskHLR(data: Record) { url: '/trace/task/hlr/stop', method: 'post', data: data, + timeout: 60_000, }); } @@ -63,3 +66,18 @@ export function fileTaskHLR(data: Record) { data: data, }); } + +/** + * 跟踪任务文件从网元到本地 + * @param query 对象 + * @returns object + */ +export function filePullTaskHLR(query: Record) { + return request({ + url: '/trace/task/hlr/filePull', + method: 'get', + params: query, + responseType: 'blob', + timeout: 60_000, + }); +} diff --git a/src/router/index.ts b/src/router/index.ts index e01ce1e9..4ac48d3f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -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', ]; /**全局路由-前置守卫 */ diff --git a/src/views/traceManage/task-hlr/index.vue b/src/views/traceManage/task-hlr/index.vue index 591a0a5b..ce773353 100644 --- a/src/views/traceManage/task-hlr/index.vue +++ b/src/views/traceManage/task-hlr/index.vue @@ -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) { 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) { 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) { 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,