From a45b8985b6111427b82a077de983de0299d49eb2 Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Wed, 29 Jan 2025 13:33:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(iot):=20=E6=96=B0=E5=A2=9E=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=AE=A1=E7=90=86=E5=8D=A1=E7=89=87=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加设备列表页面,支持查询、重置功能 - 实现设备详情页面,展示设备信息和扩展属性 - 新增设备编辑组件,支持创建和修改设备 - 重构公告卡片组件,改为设备卡片样式 --- src/router/routes/modules/iot.ts | 11 + src/router/routes/modules/notification.ts | 2 +- src/router/routes/modules/user.ts | 11 - .../deviceCard}/components/card-wrap.vue | 43 +- .../deviceCard/components/device-detail.vue | 102 ++++ .../iot/deviceCard/components/device-edit.vue | 415 ++++++++++++++++ .../deviceCard}/index.vue | 215 ++++++--- .../noticeSet/components/notice-edit.vue | 208 -------- src/views/notification/noticeSet/index.vue | 445 ------------------ .../components/bulletin-detail.vue | 148 ------ 10 files changed, 701 insertions(+), 899 deletions(-) rename src/views/{user/bulletin-card => iot/deviceCard}/components/card-wrap.vue (72%) create mode 100644 src/views/iot/deviceCard/components/device-detail.vue create mode 100644 src/views/iot/deviceCard/components/device-edit.vue rename src/views/{user/bulletin-card => iot/deviceCard}/index.vue (53%) delete mode 100644 src/views/notification/noticeSet/components/notice-edit.vue delete mode 100644 src/views/notification/noticeSet/index.vue delete mode 100644 src/views/user/bulletin-card/components/bulletin-detail.vue diff --git a/src/router/routes/modules/iot.ts b/src/router/routes/modules/iot.ts index ea3fe8f..acdebc2 100644 --- a/src/router/routes/modules/iot.ts +++ b/src/router/routes/modules/iot.ts @@ -36,6 +36,17 @@ const IOT: AppRouteRecordRaw = { permissions: ['iot:device'], }, }, + { + path: 'deviceCard', + name: 'DeviceCard', + component: () => import('@/views/iot/deviceCard/index.vue'), + meta: { + locale: '设备管理(卡片)', + title: '设备管理(卡片)', + requiresAuth: true, + permissions: ['iot:device'], + }, + }, { path: 'product/:id', name: 'productDetail', diff --git a/src/router/routes/modules/notification.ts b/src/router/routes/modules/notification.ts index 9accd2a..042ada1 100644 --- a/src/router/routes/modules/notification.ts +++ b/src/router/routes/modules/notification.ts @@ -43,7 +43,7 @@ const NOTIFICATION: AppRouteRecordRaw = { title: '公告详情', requiresAuth: true, showInMenu: false, - permissions: ['message:bulletin:query'], + permissions: ['message:bulletin'], }, }, ], diff --git a/src/router/routes/modules/user.ts b/src/router/routes/modules/user.ts index 192959f..9dd9894 100644 --- a/src/router/routes/modules/user.ts +++ b/src/router/routes/modules/user.ts @@ -44,17 +44,6 @@ const USER: AppRouteRecordRaw = { permissions: ['*'], }, }, - { - path: 'bulletinCard', - name: 'BulletinCard', - component: () => import('@/views/user/bulletin-card/index.vue'), - meta: { - locale: '公告通知(卡片)', - title: '公告通知(卡片)', - requiresAuth: true, - permissions: ['*'], - }, - }, { path: 'messages', name: 'Messages', diff --git a/src/views/user/bulletin-card/components/card-wrap.vue b/src/views/iot/deviceCard/components/card-wrap.vue similarity index 72% rename from src/views/user/bulletin-card/components/card-wrap.vue rename to src/views/iot/deviceCard/components/card-wrap.vue index 73eb930..ace3f90 100644 --- a/src/views/user/bulletin-card/components/card-wrap.vue +++ b/src/views/iot/deviceCard/components/card-wrap.vue @@ -20,11 +20,11 @@ {{ createBy }} - {{ dayjs(publishTime).format('YYYY-MM-DD HH:mm:ss') }} - - - {{ remark }} + {{ dayjs(createTime).format('YYYY-MM-DD HH:mm:ss') }} + + + @@ -32,9 +32,17 @@ - + 详情 + + + 删除 + @@ -46,6 +54,9 @@ import router from '@/router'; import dayjs from 'dayjs'; + import { deleteDevice } from '@/api/device'; + import { Message } from '@arco-design/web-vue'; + import DeviceEdit from '@/views/iot/deviceCard/components/device-edit.vue'; const props = defineProps({ loading: { @@ -72,14 +83,28 @@ type: String, default: '', }, - publishTime: { + createTime: { type: String, default: '', }, }); - // 详情 - const handleDetail = async (id: number) => { - await router.push({ name: 'Details', params: { id } }); + // 打开详情 + function openDetail(id:number): void{ + const url = router.resolve({ + name: 'deviceDetail', + params: {id} + }).href; + router.push(url); + } + // 删除 + const handleDelete = async (id: number) => { + const res = await deleteDevice(id); + if (res.status === 200) { + Message.success({ + content: '删除成功', + duration: 5 * 1000, + }); + } }; diff --git a/src/views/iot/deviceCard/components/device-detail.vue b/src/views/iot/deviceCard/components/device-detail.vue new file mode 100644 index 0000000..e7ac284 --- /dev/null +++ b/src/views/iot/deviceCard/components/device-detail.vue @@ -0,0 +1,102 @@ + + + + + + 设备详情 + {{renderData.name }} + {{renderData.hardwareVersion }} + {{renderData.firmwareVersion }} + {{renderData.productId }} + + {{dayjs(renderData.createTime).format('YYYY-MM-DD HH:mm:ss') }} + + + + + + + + + 基本信息 + + 执行服务内容 + + + + + + + + diff --git a/src/views/iot/deviceCard/components/device-edit.vue b/src/views/iot/deviceCard/components/device-edit.vue new file mode 100644 index 0000000..7099355 --- /dev/null +++ b/src/views/iot/deviceCard/components/device-edit.vue @@ -0,0 +1,415 @@ + + + + + + + + + + + + + + + + + + + + + 修改 + + + + {{ modalTitle }} + + + + + {{ + item.name + }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 取消 + 确定 + + + + + + + diff --git a/src/views/user/bulletin-card/index.vue b/src/views/iot/deviceCard/index.vue similarity index 53% rename from src/views/user/bulletin-card/index.vue rename to src/views/iot/deviceCard/index.vue index e933dbc..21feec8 100644 --- a/src/views/user/bulletin-card/index.vue +++ b/src/views/iot/deviceCard/index.vue @@ -1,6 +1,6 @@ - + @@ -12,39 +12,48 @@ > - + - - + - - - - - - - - - - + + + + + + + + - - - + + + @@ -77,10 +86,9 @@ @@ -94,29 +102,30 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/notification/noticeSet/components/notice-edit.vue b/src/views/notification/noticeSet/components/notice-edit.vue deleted file mode 100644 index 15297c6..0000000 --- a/src/views/notification/noticeSet/components/notice-edit.vue +++ /dev/null @@ -1,208 +0,0 @@ - - - - 新建 - - - - 修改 - - - - {{ modalTitle }} - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/views/notification/noticeSet/index.vue b/src/views/notification/noticeSet/index.vue deleted file mode 100644 index 2125bab..0000000 --- a/src/views/notification/noticeSet/index.vue +++ /dev/null @@ -1,445 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 查询 - - - - - - 重置 - - - - - - - - - - - - - - - - 导出 - - - - - - - - - - - - - - - - {{ item.name }} - - - - - - - - - - - - - - - - - - - {{ item.title === '#' ? '序列号' : item.title }} - - - - - - - - - - - - {{ rowIndex + 1 + (pagination.current - 1) * pagination.size }} - - - - - - - - 详情 - - - - - - 删除 - - - - - - - - - - - diff --git a/src/views/user/bulletin-card/components/bulletin-detail.vue b/src/views/user/bulletin-card/components/bulletin-detail.vue deleted file mode 100644 index 1fbd75e..0000000 --- a/src/views/user/bulletin-card/components/bulletin-detail.vue +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - {{ renderData.title }} - - 作者: {{ renderData.createBy }} - 时间: {{ dayjs(renderData.publishTime).format('YYYY-MM-DD') }} - - - - - - - - - - {{ item.fileName }} - - - - - - - - - - - - - - -