feat:【IoT 物联网】初始化 IoT 固件详情页 90%(取消任务)
This commit is contained in:
@ -44,9 +44,9 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="3">
|
<el-col :span="3">
|
||||||
<div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
|
<div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
|
||||||
<div class="text-32px font-bold mb-8px text-blue-400">{{
|
<div class="text-32px font-bold mb-8px text-blue-400">
|
||||||
firmwareStatistics[IoTOtaTaskRecordStatusEnum.PUSHED.value] || 0
|
{{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.PUSHED.value] || 0 }}
|
||||||
}}</div>
|
</div>
|
||||||
<div class="text-14px text-gray-600">已推送</div>
|
<div class="text-14px text-gray-600">已推送</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -68,9 +68,9 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="3">
|
<el-col :span="3">
|
||||||
<div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
|
<div class="text-center p-20px border border-solid border-gray-200 rounded bg-gray-50">
|
||||||
<div class="text-32px font-bold mb-8px text-red-500">{{
|
<div class="text-32px font-bold mb-8px text-red-500">
|
||||||
firmwareStatistics[IoTOtaTaskRecordStatusEnum.FAILURE.value] || 0
|
{{ firmwareStatistics[IoTOtaTaskRecordStatusEnum.FAILURE.value] || 0 }}
|
||||||
}}</div>
|
</div>
|
||||||
<div class="text-14px text-gray-600">升级失败</div>
|
<div class="text-14px text-gray-600">升级失败</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
@ -9,10 +9,11 @@
|
|||||||
label-width="68px"
|
label-width="68px"
|
||||||
>
|
>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="openTaskForm">
|
<el-button type="primary" @click="openTaskForm" v-hasPermi="['iot:ota-task:create']">
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<!-- TODO @AI:unocss -->
|
||||||
<el-form-item style="float: right">
|
<el-form-item style="float: right">
|
||||||
<!--TODO @AI:有个 bug:回车后,会刷新,修复下 -->
|
<!--TODO @AI:有个 bug:回车后,会刷新,修复下 -->
|
||||||
<el-input
|
<el-input
|
||||||
@ -58,13 +59,12 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="120">
|
<el-table-column label="操作" align="center" width="120">
|
||||||
<!-- TODO @AI:可能要参考别的模块,处理下?-->
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" @click="handleViewDetail(scope.row.id)"> 详情 </el-button>
|
<el-button link type="primary" @click="handleTaskDetail(scope.row.id)"> 详情 </el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.status === IoTOtaTaskStatusEnum.IN_PROGRESS.value"
|
v-if="scope.row.status === IoTOtaTaskStatusEnum.IN_PROGRESS.value"
|
||||||
link
|
link
|
||||||
type="primary"
|
type="danger"
|
||||||
@click="handleCancelTask(scope.row.id)"
|
@click="handleCancelTask(scope.row.id)"
|
||||||
v-hasPermi="['iot:ota-task:cancel']"
|
v-hasPermi="['iot:ota-task:cancel']"
|
||||||
>
|
>
|
||||||
@ -87,7 +87,7 @@
|
|||||||
ref="taskFormRef"
|
ref="taskFormRef"
|
||||||
:firmware-id="firmwareId"
|
:firmware-id="firmwareId"
|
||||||
:product-id="productId"
|
:product-id="productId"
|
||||||
@success="handleTaskSuccess"
|
@success="handleTaskCreateSuccess"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 任务详情弹窗 -->
|
<!-- 任务详情弹窗 -->
|
||||||
@ -108,11 +108,7 @@ defineOptions({ name: 'OtaTaskList' })
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
firmwareId: number
|
firmwareId: number
|
||||||
productId?: number
|
productId: number
|
||||||
}>()
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
success: []
|
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -155,16 +151,15 @@ const openTaskForm = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 处理任务创建成功 */
|
/** 处理任务创建成功 */
|
||||||
const handleTaskSuccess = () => {
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const handleTaskCreateSuccess = () => {
|
||||||
getTaskList()
|
getTaskList()
|
||||||
emit('success')
|
emit('success')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查看任务详情 */
|
/** 查看任务详情 */
|
||||||
const handleViewDetail = (id: number | undefined) => {
|
const handleTaskDetail = (id: number) => {
|
||||||
if (id) {
|
taskDetailRef.value?.open(id)
|
||||||
taskDetailRef.value?.open(id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 取消任务 */
|
/** 取消任务 */
|
||||||
@ -173,7 +168,9 @@ const handleCancelTask = async (id: number) => {
|
|||||||
await message.confirm('确认要取消该升级任务吗?')
|
await message.confirm('确认要取消该升级任务吗?')
|
||||||
await IoTOtaTaskApi.cancelOtaTask(id)
|
await IoTOtaTaskApi.cancelOtaTask(id)
|
||||||
message.success('取消成功')
|
message.success('取消成功')
|
||||||
getTaskList()
|
// 刷新数据
|
||||||
|
await getTaskList()
|
||||||
|
emit('success')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('取消任务失败', error)
|
console.error('取消任务失败', error)
|
||||||
}
|
}
|
||||||
@ -185,7 +182,5 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/** 暴露方法供父组件调用 */
|
/** 暴露方法供父组件调用 */
|
||||||
defineExpose({
|
defineExpose({ getTaskList })
|
||||||
getTaskList
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -118,7 +118,6 @@ const queryParams = reactive({
|
|||||||
createTime: []
|
createTime: []
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
|||||||
@ -166,8 +166,8 @@ export const IoTOtaTaskStatusEnum = {
|
|||||||
label: '进行中',
|
label: '进行中',
|
||||||
value: 10
|
value: 10
|
||||||
},
|
},
|
||||||
COMPLETED: {
|
END: {
|
||||||
label: '已完成',
|
label: '已结束',
|
||||||
value: 20
|
value: 20
|
||||||
},
|
},
|
||||||
CANCELED: {
|
CANCELED: {
|
||||||
|
|||||||
Reference in New Issue
Block a user