diff --git a/src/api/device.ts b/src/api/device.ts new file mode 100644 index 0000000..d4ceacb --- /dev/null +++ b/src/api/device.ts @@ -0,0 +1,82 @@ +import axios from 'axios'; + +export interface DeviceRecord { + size: number; + current: number; + name?: string; + clientId?: string; + productId?: number; + status?: string; + isOnline?: boolean; + pageable?: string; +} + +export interface DeviceCreateRecord { + num?: number; + prefix?: string; + name?: string; + hardwareVersion: string; + firmwareVersion: string; + extendParams: string; + properties: string; + productId: number; +} + +export interface DeviceEventRecord { + id: number; + clientId: string; + serveName: string; + params: string; +} + +// 分页查询 +export function queryDeviceList(data: DeviceRecord) { + return axios({ + url: '/api/rest/device', + method: 'get', + params: data, + }); +} + +// 查看详情 +export function queryDeviceDetail(id: number) { + return axios.get(`/api/rest/device/${id}`); +} + +// 新增 +export function createDevice(data: DeviceCreateRecord) { + return axios.post(`/api/rest/device`, data); +} + +// 修改 +export function updateDevice(id: number, data: DeviceCreateRecord) { + return axios.put(`/api/rest/device/${id}`, data); +} +// 删除 +export function deleteDevice(id: number) { + return axios.delete(`/api/rest/device/${id}`); +} + +// 查询上报 +export function queryDeviceReport(clientId: number) { + return axios({ + url: `/api/rest/device/record/photo`, + method: 'get', + params: clientId, + }); +} + +// 批量创建 +export function createDeviceBatch(data: DeviceCreateRecord) { + return axios.post(`/api/rest/device/batch`, data); +} + +// 手动触发事件 +export function triggerEvent(data: DeviceEventRecord) { + return axios({ + url: `/api/rest/device/event`, + method: 'post', + data, + }); +} + diff --git a/src/api/message.ts b/src/api/message.ts index e2d60ee..ff4cbd2 100644 --- a/src/api/message.ts +++ b/src/api/message.ts @@ -18,9 +18,10 @@ export function queryMessageList() { } interface MessageStatus { - ids: number[]; + ids: string[]; } +// 批量设置消息已读 export function setMessageStatus(data: MessageStatus) { return axios.post('/api/message/read', data); } diff --git a/src/api/product.ts b/src/api/product.ts new file mode 100644 index 0000000..3a841e0 --- /dev/null +++ b/src/api/product.ts @@ -0,0 +1,63 @@ +import axios from 'axios'; + +export interface ProductRecord { + size: number; + current: number; + name?: string; + pageable?: string; + type?: string; + links?: string; +} + +export interface ProductCreateRecord { + name: string; + model: string; + type?: string; + link?: string; + remark?: string; + params:[{ + name: string; + identifier: string; + type: string; + dataType: string; + }]; +} + + +// 分页查询 +export function queryProductList(data: ProductRecord) { + return axios({ + url: '/api/rest/product', + method: 'get', + params: data, + }); +} +// 模糊查询获取产品列表 +export function queryProductListAll(data: ProductRecord) { + return axios({ + url: '/api/rest/product/fuzzy', + method: 'get', + params: data, + }); +} + +// 查看详情 +export function queryProductDetail(id: number) { + return axios.get(`/api/rest/product/${id}`); +} + +// 新增 +export function createProduct(data: ProductCreateRecord) { + return axios.post(`/api/rest/product`, data); +} + +// 修改 +export function updateProduct(id: number, data: ProductCreateRecord){ + return axios.patch(`/api/rest/product/${id}`, data); +} + +// 删除 + export function deleteProduct(id: number) { + return axios.delete(`/api/rest/product/${id}`); + } + diff --git a/src/mock/index.ts b/src/mock/index.ts index ae390f6..97d9cc4 100644 --- a/src/mock/index.ts +++ b/src/mock/index.ts @@ -5,21 +5,10 @@ import './message-box'; import '@/views/dashboard/workplace/mock'; -import '@/views/dashboard/monitor/mock'; -import '@/views/list/card/mock'; -import '@/views/list/search-table/mock'; - -import '@/views/form/step/mock'; - -import '@/views/profile/basic/mock'; - -import '@/views/visualization/data-analysis/mock'; -import '@/views/visualization/multi-dimension-data-analysis/mock'; - -import '@/views/user/info/mock'; import '@/views/user/setting/mock'; + Mock.setup({ timeout: '600-1000', }); diff --git a/src/router/routes/modules/iot.ts b/src/router/routes/modules/iot.ts new file mode 100644 index 0000000..d5067ef --- /dev/null +++ b/src/router/routes/modules/iot.ts @@ -0,0 +1,41 @@ +import { DEFAULT_LAYOUT } from '../base'; +import { AppRouteRecordRaw } from '../types'; + +const IOT: AppRouteRecordRaw = { + path: '/iot', + name: 'iot', + component: DEFAULT_LAYOUT, + meta: { + locale: 'menu.iot', + title: '物联网管理', + icon: 'icon-empty', + requiresAuth: true, + order: 1, + }, + children: [ + { + path: 'device', + name: 'Device', + component: () => import('@/views/iot/device/index.vue'), + meta: { + // locale: 'menu.system.role', + title: '设备管理', + requiresAuth: true, + permissions: ['*'], + }, + }, + { + path: 'product', + name: 'Product', + component: () => import('@/views/iot/product/index.vue'), + meta: { + // locale: 'menu.system.dept', + title: '产品管理', + requiresAuth: true, + permissions: ['*'], + }, + }, + ], +}; + +export default IOT; diff --git a/src/router/routes/modules/notification.ts b/src/router/routes/modules/notification.ts deleted file mode 100644 index fa81e16..0000000 --- a/src/router/routes/modules/notification.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { DEFAULT_LAYOUT } from '../base'; -import { AppRouteRecordRaw } from '../types'; - -const NOTIFICATION: AppRouteRecordRaw = { - path: '/notification', - name: 'notification', - component: DEFAULT_LAYOUT, - meta: { - locale: '通知管理', - requiresAuth: true, - icon: 'icon-message', // 设置图标 - order: 0, // 排序路由菜单项。如果设置该值,值越高,越靠前 - }, - children: [ - { - path: 'notice', - name: 'notice', - component: () => import('@/views/notification/notice/index.vue'), - meta: { - locale: '公告通知', - requiresAuth: true, - permissions: ['*'], - }, - }, - { - path:'noticeSet', - name:'noticeSet', - component: () => import('@/views/notification/noticeSet/index.vue'), - meta:{ - locale: '公告管理', - requiresAuth: true, - permissions: ['*'], - } - } - ], -}; -export default NOTIFICATION; - diff --git a/src/router/routes/modules/system.ts b/src/router/routes/modules/system.ts index 201eb0b..681bcb4 100644 --- a/src/router/routes/modules/system.ts +++ b/src/router/routes/modules/system.ts @@ -27,9 +27,10 @@ const SYSTEM: AppRouteRecordRaw = { name: 'Role', component: () => import('@/views/system/role/index.vue'), meta: { - locale: 'menu.system.role', + // locale: 'menu.system.role', + title: '角色管理', requiresAuth: true, - permissions: ['admin'], + permissions: ['*'], }, }, { @@ -37,9 +38,10 @@ const SYSTEM: AppRouteRecordRaw = { name: 'Dept', component: () => import('@/views/system/dept/index.vue'), meta: { - locale: 'menu.system.dept', + // locale: 'menu.system.dept', + title: '部门管理', requiresAuth: true, - permissions: ['admin'], + permissions: ['*'], }, }, { @@ -47,19 +49,52 @@ const SYSTEM: AppRouteRecordRaw = { name: 'User', component: () => import('@/views/system/user/index.vue'), meta: { - locale: 'menu.system.user', + // locale: 'menu.system.user', + title: '用户管理', requiresAuth: true, - permissions: ['admin'], + permissions: ['*'], }, }, { path: 'authority', - name: 'authority', + name: 'Authority', component: () => import('@/views/system/authority/index.vue'), meta: { - locale: '权限管理', + // locale: '权限管理', + title: '权限管理', requiresAuth: true, - permissions: ['admin'], + permissions: ['*'], + }, + }, + { + path:'bulletin', + name:'Bulletin', + component: () => import('@/views/system/bulletin/index.vue'), + meta:{ + title: '公告管理', + requiresAuth: true, + permissions: ['*'], + }, + }, + { + path:'message', + name:'Message', + component: () => import('@/views/system/message/index.vue'), + meta:{ + title: '消息管理', + requiresAuth: true, + permissions: ['*'], + }, + }, + { + path: 'detail/:id', + name: 'Detail', + component: () => import('@/views/system/bulletin/components/detail.vue'), + meta: { + title: '公告详情', + requiresAuth: true, + showInMenu: false, + permissions: ['*'], }, }, ], diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index a663423..a56a24a 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -46,9 +46,6 @@ import { async updateAuth(params: AuthRecord) { return update(params); }, - async getAuthDetail(id: string) { - return getDetail(id); - }, }, }); diff --git a/src/views/iot/device/components/device-edit.vue b/src/views/iot/device/components/device-edit.vue new file mode 100644 index 0000000..368b786 --- /dev/null +++ b/src/views/iot/device/components/device-edit.vue @@ -0,0 +1,249 @@ + + + + + diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue new file mode 100644 index 0000000..76dee0e --- /dev/null +++ b/src/views/iot/device/index.vue @@ -0,0 +1,374 @@ + + + + + + \ No newline at end of file diff --git a/src/views/iot/product/index.vue b/src/views/iot/product/index.vue new file mode 100644 index 0000000..e69de29 diff --git a/src/views/login/components/login-form.vue b/src/views/login/components/login-form.vue index c0a4df1..b3a8aeb 100644 --- a/src/views/login/components/login-form.vue +++ b/src/views/login/components/login-form.vue @@ -1,6 +1,6 @@