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

@@ -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,