fetch(add): 新增
Some checks failed
构建并部署前端到测试环境 / build-and-deploy (push) Failing after 6s

This commit is contained in:
sexygoat
2026-01-27 09:18:45 +08:00
parent 0eed8244e5
commit 5c6312c407
33 changed files with 4897 additions and 374 deletions

View File

@@ -10,8 +10,15 @@
<!-- 任务基本信息 -->
<ElDescriptions title="任务基本信息" :column="3" border class="task-info">
<ElDescriptionsItem label="任务编号">{{ taskDetail?.task_no || '-' }}</ElDescriptionsItem>
<ElDescriptionsItem label="任务类型">
<ElTag :type="taskType === 'device' ? 'warning' : 'primary'" size="small">
{{ taskType === 'device' ? '设备导入' : 'ICCID导入' }}
</ElTag>
</ElDescriptionsItem>
<ElDescriptionsItem label="批次号">{{ taskDetail?.batch_no || '-' }}</ElDescriptionsItem>
<ElDescriptionsItem label="运营商">{{ taskDetail?.carrier_name || '-' }}</ElDescriptionsItem>
<ElDescriptionsItem label="运营商" v-if="taskType === 'card'">
{{ (taskDetail as IotCardImportTaskDetail)?.carrier_name || '-' }}
</ElDescriptionsItem>
<ElDescriptionsItem label="文件名">{{ taskDetail?.file_name || '-' }}</ElDescriptionsItem>
<ElDescriptionsItem label="任务状态">
<ElTag :type="getStatusType(taskDetail?.status)" v-if="taskDetail">
@@ -55,7 +62,18 @@
</ElDivider>
<ElTable :data="taskDetail.failed_items" border style="width: 100%">
<ElTableColumn prop="line" label="行号" width="100" />
<ElTableColumn prop="iccid" label="ICCID" min-width="180" />
<ElTableColumn
v-if="taskType === 'card'"
prop="iccid"
label="ICCID"
min-width="180"
/>
<ElTableColumn
v-else
prop="device_no"
label="设备号"
min-width="180"
/>
<ElTableColumn prop="reason" label="失败原因" min-width="300" />
</ElTable>
</div>
@@ -67,7 +85,18 @@
</ElDivider>
<ElTable :data="taskDetail.skipped_items" border style="width: 100%">
<ElTableColumn prop="line" label="行号" width="100" />
<ElTableColumn prop="iccid" label="ICCID" min-width="180" />
<ElTableColumn
v-if="taskType === 'card'"
prop="iccid"
label="ICCID"
min-width="180"
/>
<ElTableColumn
v-else
prop="device_no"
label="设备号"
min-width="180"
/>
<ElTableColumn prop="reason" label="跳过原因" min-width="300" />
</ElTable>
</div>
@@ -78,18 +107,23 @@
<script setup lang="ts">
import { useRouter, useRoute } from 'vue-router'
import { CardService } from '@/api/modules'
import { CardService, DeviceService } from '@/api/modules'
import { ElMessage, ElTag, ElDescriptions, ElDescriptionsItem, ElDivider, ElTable, ElTableColumn } from 'element-plus'
import { formatDateTime } from '@/utils/business/format'
import type { IotCardImportTaskDetail, IotCardImportTaskStatus } from '@/types/api/card'
import type { DeviceImportTaskDetail } from '@/types/api/device'
defineOptions({ name: 'TaskDetail' })
const router = useRouter()
const route = useRoute()
const taskDetail = ref<IotCardImportTaskDetail | null>(null)
type TaskType = 'card' | 'device'
type TaskDetail = IotCardImportTaskDetail | DeviceImportTaskDetail
const taskDetail = ref<TaskDetail | null>(null)
const loading = ref(false)
const taskType = ref<TaskType>('card')
// 获取状态标签类型
const getStatusType = (status?: IotCardImportTaskStatus) => {
@@ -116,17 +150,33 @@
// 获取任务详情
const getTaskDetail = async () => {
const taskId = route.query.id
const queryTaskType = route.query.task_type as TaskType | undefined
if (!taskId) {
ElMessage.error('缺少任务ID参数')
goBack()
return
}
// 设置任务类型
if (queryTaskType) {
taskType.value = queryTaskType
}
loading.value = true
try {
const res = await CardService.getIotCardImportTaskDetail(Number(taskId))
if (res.code === 0) {
taskDetail.value = res.data
if (taskType.value === 'device') {
// 获取设备导入任务详情
const res = await DeviceService.getImportTaskDetail(Number(taskId))
if (res.code === 0) {
taskDetail.value = res.data
}
} else {
// 获取ICCID导入任务详情
const res = await CardService.getIotCardImportTaskDetail(Number(taskId))
if (res.code === 0) {
taskDetail.value = res.data
}
}
} catch (error) {
console.error(error)