Files
smart_grid_iot/.trae/specs/device-management-module/tasks.md
T

37 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Tasks
## 后端实现(customer_equipment)
- [x] Task 1: 客户设备台账实体与 DTO
- [x] 1.1 新建 `server/src/entity/customer_equipment.entity.ts`(含 building 关联,`timestamps:false`)
- [x] 1.2 新建 `server/src/dto/customer_equipment.dto.ts`(class-validator 校验、字段白名单)
- [x] Task 2: 客户设备台账 Service
- [x] 2.1 新建 `server/src/service/customer_equipment.service.ts`:分页列表(customer_id/building_id/type/keyword 过滤)、详情、创建、更新、删除
- [x] 2.2 设备编码唯一性(EQ+日期+序号自动生成)校验;数据按客户归属做权限隔离
- [x] Task 3: 客户设备台账 Controller 与路由注册
- [x] 3.1 新建 `server/src/controller/customer_equipment.controller.ts`,路由前缀 `/api/customer-equipments`
- [x] 3.2 全部查询使用 Sequelize 参数绑定([Op.like]/[Op.in]),杜绝 SQL 拼接
## 后端实现(smart_device)
- [x] Task 4: 智电设备型号实体、DTO、Service、Controller
- [x] 4.1 新建实体/dto/service/controller(`/api/smart-devices`),分页 CRUD,类型 device_type 字典
## 后端安全与 APP 兼容
- [x] Task 5: 鉴权接入与接口标准化
- [x] 5.1 设备端点经全局 auth + rbac 中间件(rbac.middleware 新增两条 PERMISSION_MAP 映射)
- [x] 5.2 接口返回统一 JSON(code/message/data 结构);权限码 customer-equipments→device:list、smart-devices→device:model
- [x] 5.3 rbac 中间件保证无 token→401、无权限→403
## 前端实现
- [x] Task 6: 前端 API 封装
- [x] 6.1 新建 `client/src/api/device.ts`(customerEquipmentApi + smartDeviceApi,REST 封装)
- [x] Task 7: 客户设备台账页面
- [x] 7.1 新建 `client/src/views/device/equipment/index.vue`:列表、搜索、增删改、照片上传,样式参考客户管理模块
- [x] 7.2 新建 `client/src/views/device/smart-device/index.vue`:型号目录 CRUD(Tab 容器页切换)
- [x] Task 8: 路由与菜单
- [x] 8.1 更新 `client/src/router/index.ts`:`/device` 由 Placeholder 改为 `views/device/index.vue`(保留 permission:device:list)
- [x] 8.2 前端全模块未使用 v-html,统一 Vue 插值转义防 XSS
# Task Dependencies
- [Task 4] 的 DTO/Controller 结构以 [Task 1-3] 为参考范式实现
- [Task 7-8] 依赖 [Task 6]
- [Task 5] 依赖 [Task 3][Task 4] 完成后统一接入