修改物联网OTA升级页面和接口不可用的问题

This commit is contained in:
Administrator
2025-10-22 18:22:16 +08:00
parent 495a924d56
commit 7ea4f836a4
16 changed files with 74 additions and 62 deletions

View File

@@ -29,7 +29,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '所属产品',
component: 'ApiSelect',
componentProps: {
api: getSimpleProductList,
api: () => getSimpleProductList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择产品',
@@ -85,7 +85,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '产品',
component: 'ApiSelect',
componentProps: {
api: getSimpleProductList,
api: () => getSimpleProductList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择产品',

View File

@@ -29,7 +29,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '所属产品',
component: 'ApiSelect',
componentProps: {
api: getSimpleProductList,
api: () => getSimpleProductList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择产品',
@@ -86,7 +86,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '产品',
component: 'ApiSelect',
componentProps: {
api: getSimpleProductList,
api: () => getSimpleProductList(),
labelField: 'name',
valueField: 'id',
placeholder: '请选择产品',

View File

@@ -36,10 +36,6 @@ function handleEdit(row: IoTOtaFirmwareApi.Firmware) {
formModalApi.setData({ type: 'update', id: row.id }).open();
}
/** 查看固件详情 */
function handleDetail(row: IoTOtaFirmwareApi.Firmware) {
formModalApi.setData({ type: 'view', id: row.id }).open();
}
/** 删除固件 */
async function handleDelete(row: IoTOtaFirmwareApi.Firmware) {
@@ -113,18 +109,19 @@ const [Grid, gridApi] = useVbenVxeGrid({
<!-- 固件文件列 -->
<template #fileUrl="{ row }">
<a
v-if="row.fileUrl"
:href="row.fileUrl"
target="_blank"
download
class="text-primary cursor-pointer hover:underline"
>
<IconifyIcon icon="ant-design:download-outlined" class="mr-1" />
下载固件
</a>
<span v-else class="text-gray-400">无文件</span>
</template>
<div v-if="row.fileUrl" class="inline-flex items-center gap-1.5 align-middle leading-none">
<IconifyIcon icon="ant-design:download-outlined" class="shrink-0 text-base align-middle text-primary" />
<a
:href="row.fileUrl"
target="_blank"
download
class="text-primary cursor-pointer hover:underline align-middle"
>
下载固件
</a>
</div>
<span v-else class="text-gray-400">无文件</span>
</template>
<!-- 操作列 -->
<template #actions="{ row }">
@@ -134,7 +131,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
label: $t('common.detail'),
type: 'link',
icon: ACTION_ICON.VIEW,
onClick: handleDetail.bind(null, row),
onClick: () => $router.push({ name: 'IoTOtaFirmwareDetail', params: { id: row.id } }),
},
{
label: $t('common.edit'),

View File

@@ -59,8 +59,8 @@ onMounted(() => {
<template>
<div class="p-4">
<!-- 固件信息 -->
<Card title="固件信息" class="mb-5" :loading="firmwareLoading">
<Descriptions :column="3" bordered>
<Card title="固件信息" class="mb-3" :loading="firmwareLoading">
<Descriptions :column="3" bordered size="small">
<Descriptions.Item label="固件名称">
{{ firmware?.name }}
</Descriptions.Item>
@@ -86,15 +86,15 @@ onMounted(() => {
<!-- 升级设备统计 -->
<Card
title="升级设备统计"
class="mb-5"
class="mb-3"
:loading="firmwareStatisticsLoading"
>
<Row :gutter="20" class="py-5">
<Row :gutter="20" class="py-3">
<Col :span="6">
<div
class="rounded border border-solid border-gray-200 bg-gray-50 p-5 text-center"
class="rounded border border-solid border-gray-200 bg-gray-50 p-3 text-center"
>
<div class="mb-2 text-3xl font-bold text-blue-500">
<div class="mb-1 text-3xl font-bold text-blue-500">
{{
Object.values(firmwareStatistics).reduce(
(sum: number, count) => sum + (count || 0),
@@ -107,9 +107,9 @@ onMounted(() => {
</Col>
<Col :span="3">
<div
class="rounded border border-solid border-gray-200 bg-gray-50 p-5 text-center"
class="rounded border border-solid border-gray-200 bg-gray-50 p-3 text-center"
>
<div class="mb-2 text-3xl font-bold text-gray-400">
<div class="mb-1 text-3xl font-bold text-gray-400">
{{
firmwareStatistics[IoTOtaTaskRecordStatusEnum.PENDING.value] ||
0
@@ -120,9 +120,9 @@ onMounted(() => {
</Col>
<Col :span="3">
<div
class="rounded border border-solid border-gray-200 bg-gray-50 p-5 text-center"
class="rounded border border-solid border-gray-200 bg-gray-50 p-3 text-center"
>
<div class="mb-2 text-3xl font-bold text-blue-400">
<div class="mb-1 text-3xl font-bold text-blue-400">
{{
firmwareStatistics[IoTOtaTaskRecordStatusEnum.PUSHED.value] || 0
}}
@@ -132,9 +132,9 @@ onMounted(() => {
</Col>
<Col :span="3">
<div
class="rounded border border-solid border-gray-200 bg-gray-50 p-5 text-center"
class="rounded border border-solid border-gray-200 bg-gray-50 p-3 text-center"
>
<div class="mb-2 text-3xl font-bold text-yellow-500">
<div class="mb-1 text-3xl font-bold text-yellow-500">
{{
firmwareStatistics[
IoTOtaTaskRecordStatusEnum.UPGRADING.value
@@ -146,9 +146,9 @@ onMounted(() => {
</Col>
<Col :span="3">
<div
class="rounded border border-solid border-gray-200 bg-gray-50 p-5 text-center"
class="rounded border border-solid border-gray-200 bg-gray-50 p-3 text-center"
>
<div class="mb-2 text-3xl font-bold text-green-500">
<div class="mb-1 text-3xl font-bold text-green-500">
{{
firmwareStatistics[IoTOtaTaskRecordStatusEnum.SUCCESS.value] ||
0
@@ -159,9 +159,9 @@ onMounted(() => {
</Col>
<Col :span="3">
<div
class="rounded border border-solid border-gray-200 bg-gray-50 p-5 text-center"
class="rounded border border-solid border-gray-200 bg-gray-50 p-3 text-center"
>
<div class="mb-2 text-3xl font-bold text-red-500">
<div class="mb-1 text-3xl font-bold text-red-500">
{{
firmwareStatistics[IoTOtaTaskRecordStatusEnum.FAILURE.value] ||
0
@@ -172,9 +172,9 @@ onMounted(() => {
</Col>
<Col :span="3">
<div
class="rounded border border-solid border-gray-200 bg-gray-50 p-5 text-center"
class="rounded border border-solid border-gray-200 bg-gray-50 p-3 text-center"
>
<div class="mb-2 text-3xl font-bold text-gray-400">
<div class="mb-1 text-3xl font-bold text-gray-400">
{{
firmwareStatistics[IoTOtaTaskRecordStatusEnum.CANCELED.value] ||
0