diff --git a/config/vite.config.dev.ts b/config/vite.config.dev.ts index e2d05a1..7ed0243 100644 --- a/config/vite.config.dev.ts +++ b/config/vite.config.dev.ts @@ -14,7 +14,7 @@ export default mergeConfig( proxy: { '/api': { // target: 'http://8.134.75.234:8081', - target: 'http://127.0.0.1:8081', + target: 'http://192.168.3.238:8081', changeOrigin: true, }, }, diff --git a/src/api/dept.ts b/src/api/dept.ts index 877c0ae..d6939eb 100644 --- a/src/api/dept.ts +++ b/src/api/dept.ts @@ -11,6 +11,17 @@ export interface DeptRecord extends DeptCreateRecord { id: string; } +// 获取部门树 +export function getAllDeptTree(id: number | string) { + return axios({ + method: 'get', + url: '/api/rest/dept/tree', + params: { + id, + } + }); +} + // 添加区域 export function create(data: DeptCreateRecord) { return axios.post(`/api/rest/dept`, data); diff --git a/src/api/message-mgmt.ts b/src/api/message-mgmt.ts index b9e65f0..34e575d 100644 --- a/src/api/message-mgmt.ts +++ b/src/api/message-mgmt.ts @@ -24,8 +24,6 @@ export interface MessageCreateRecord { attachmentIds?: string[]; } - - // 查看详情 export function queryMessage(userId: number, messageId: number) { return axios.get(`/api/rest/message/${userId}/${messageId}`); diff --git a/src/api/tsl.ts b/src/api/tsl.ts new file mode 100644 index 0000000..f15f26f --- /dev/null +++ b/src/api/tsl.ts @@ -0,0 +1,75 @@ +import axios from 'axios'; + +export interface Record { + current: number; + size: number; +} + +export interface ServeRecord extends Record { + name?: string; + identifier?: string; + productId: number; +} + +export interface PropertyRecord extends Record { + name?: string; + identifier?: string; + productId: number; + dataType?: string; + ioType?: string; +} + +export interface eventRecord extends Record { + name?: string; + level?: string; + identifier?: string; + productId?: number; +} + +export function queryServeList(data: ServeRecord) { + return axios({ + url: '/api/rest/tsl/serve', + method: 'get', + params: data, + }); +} + +export function queryPropertyList(data: PropertyRecord) { + return axios({ + url: '/api/rest/tsl/property', + method: 'get', + params: data, + }); +} + +export function queryEventList(data: eventRecord) { + return axios({ + url: '/api/rest/tsl/event', + method: 'get', + params: data, + }); +} + +export function createServe(data: any) { + return axios.post(`/api/rest/tsl/serve`, data); +} + +export function createProperty(data: any) { + return axios.post(`/api/rest/tsl/property`, data); +} + +export function createEvent(data: any) { + return axios.post(`/api/rest/tsl/event`, data); +} + +export function deleteServe(data: any) { + return axios.delete(`/api/rest/tsl/serve/${data}`, ); +} + +export function deleteProperty(data: any) { + return axios.delete(`/api/rest/tsl/property/${data}`); +} + +export function deleteEvent(data: any) { + return axios.delete(`/api/rest/tsl/event/${data}`); +} \ No newline at end of file diff --git a/src/assets/objectNetwork.png b/src/assets/objectNetwork.png new file mode 100644 index 0000000..bef6f50 Binary files /dev/null and b/src/assets/objectNetwork.png differ diff --git a/src/mock/deptTree.ts b/src/mock/deptTree.ts new file mode 100644 index 0000000..89e993f --- /dev/null +++ b/src/mock/deptTree.ts @@ -0,0 +1,34 @@ +import Mock from 'mockjs'; +import setupMock, { successResponseWrap } from '@/utils/setup-mock'; + +// 生成部门树数据 +const deptTree = Mock.mock({ + 'totalDept': { + 'dept': '总部门', + 'children': [ + { + 'dept': '部门1', + 'members': [ + {'name': '@cname'}, + {'name': '@cname'} + ] + }, + { + 'dept': '部门2', + 'members': [ + {'name': '@cname'}, + {'name': '@cname'} + ] + } + ] + } +}); + +setupMock({ + setup: () => { + Mock.mock(new RegExp('/api/deptTree'), () => { + return successResponseWrap(deptTree); + }) + } +}) +// 假设你需要将这个数据作为一个 API 的响应 diff --git a/src/router/routes/modules/iot.ts b/src/router/routes/modules/iot.ts index bc65654..2cd262f 100644 --- a/src/router/routes/modules/iot.ts +++ b/src/router/routes/modules/iot.ts @@ -46,6 +46,29 @@ const IOT: AppRouteRecordRaw = { permissions: ['*'], }, }, + { + path: 'device/:id', + name: 'deviceDetail', + component: () => import('@/views/iot/device/components/device-detail.vue'), + meta: { + title: '设备详情', + requiresAuth: true, + showInMenu: false, + permissions: ['*'], + }, + }, + { + path: 'product/tsl/:id', + name: 'productTsl', + component: () => import('@/views/iot/product/components/product-tsl.vue'), + meta: { + title: '物模型', + requiresAuth: true, + showInMenu: false, + permissions: ['*'], + }, + } + ], }; diff --git a/src/views/dashboard/workplace/components/announcement.vue b/src/views/dashboard/workplace/components/announcement.vue new file mode 100644 index 0000000..d8ab12a --- /dev/null +++ b/src/views/dashboard/workplace/components/announcement.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/src/views/dashboard/workplace/components/quick-operation.vue b/src/views/dashboard/workplace/components/quick-operation.vue new file mode 100644 index 0000000..fad1a21 --- /dev/null +++ b/src/views/dashboard/workplace/components/quick-operation.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/src/views/dashboard/workplace/components/recently-visited.vue b/src/views/dashboard/workplace/components/recently-visited.vue new file mode 100644 index 0000000..805c4f7 --- /dev/null +++ b/src/views/dashboard/workplace/components/recently-visited.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/src/views/iot/device/components/device-detail.vue b/src/views/iot/device/components/device-detail.vue index 4d47e58..2dc6de9 100644 --- a/src/views/iot/device/components/device-detail.vue +++ b/src/views/iot/device/components/device-detail.vue @@ -1,70 +1,102 @@ diff --git a/src/views/iot/device/components/device-edit.vue b/src/views/iot/device/components/device-edit.vue index 540db64..7254c53 100644 --- a/src/views/iot/device/components/device-edit.vue +++ b/src/views/iot/device/components/device-edit.vue @@ -82,13 +82,25 @@ - + + + + +
+
+ + + + + + + +
+ + + +
@@ -108,6 +120,7 @@ import { useMessageStore } from '@/store'; import '@wangeditor/editor/dist/css/style.css' import { createDevice, updateDevice } from '@/api/device'; + import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface'; const props = defineProps({ prem: { @@ -115,6 +128,58 @@ }, isCreate: Boolean, }); + const paramsData = ref([ + { + name: '', + identifier: '', + dataType: '', + type: '', + }, + ]); + const dataTypeOptions = computed(() => [ + { + label: '整型', + value: 'INT', + }, + { + label: '单精度浮点型', + value: 'FLOAT', + }, + { + label: '双精度浮点型', + value: 'DOUBLE', + }, + { + label: '布尔型', + value: 'BOOLEAN', + }, + { + label: '字符串', + value: 'STRING', + }, + { + label: '日期型', + value: 'DATE', + }, + { + label: '透传', + value: 'RAW', + }, + ]); + const typeOptions = computed(() => [ + { + label: '物模型输入', + value: 'INPUT', + }, + { + label: '物模型输出', + value: 'OUTPUT', + }, + { + label: '读写属性', + value: 'RW', + }, + ]); const emit = defineEmits(['refresh']); const modalTitle = computed(() => { return props.isCreate ? '创建设备' : '编辑设备'; @@ -142,7 +207,22 @@ options.value = [] } }; - + // 点击添加参数 + const handleAddParams = () => { + // paramsVisible.value = true; + paramsData.value.push({ + name: '', + identifier: '', + dataType: '', + type: '', + }); + }; + // 删除参数 + const handleDeleteParams = (record: any) => { + if (record !== -1) { + paramsData.value.splice(record, 1); + } + }; // 组件被点击 const handleClick = () => { setVisible(true); @@ -153,6 +233,7 @@ const valid = await CreateRef.value?.validate(); if (!valid) { // 新增 + formData.value.extendParams = paramsData.value; if (props.isCreate) { // formData.value.username = formData.value.email; const res = await createDevice(formData.value); diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 29470e9..462d1ed 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -162,17 +162,16 @@ {{ record.online == true? '是' : '否' }} @@ -27,7 +34,7 @@ const route = useRoute(); const id = Number(route.params.id); - const columns=[ + const columns = [ { title: '参数名称', dataIndex: 'name', @@ -49,72 +56,34 @@ slotName: 'type', }, ]; - const renderData = ref( - { - name: '产品名称', - productType: '设备', - model: '123456', - link: 'TCP', - remark: '123456', - createTime: '2023-08-08 10:10:10', - params:[ - { - name:'设备名称', - identifier:'1.0.0', - dataType:'1.0.0', - type:'123456', - }, - { - name:'设备名称', - identifier:'1.0.0', - dataType:'1.0.0', - type:'123456', - }, - { - name:'设备名称', - identifier:'1.0.0', - dataType:'1.0.0', - type:'123456', - }, - ] - }, - ); - // const fetchData = async (Id: number) => { - // const res = await queryProductDetail(Id); - // renderData.value = res.data; - // }; - // onMounted(() => { - // fetchData(id); - // }); + const activeKey = ref('1'); + const renderData = ref([]); + const fetchData = async (Id: number) => { + const res = await queryProductDetail(Id); + renderData.value = res.data; + }; + const handleMenuClick = (e: any) => { + activeKey.value = e; + }; + onMounted(() => { + fetchData(id); + }); - - - diff --git a/src/views/iot/product/components/product-edit.vue b/src/views/iot/product/components/product-edit.vue new file mode 100644 index 0000000..fd2404a --- /dev/null +++ b/src/views/iot/product/components/product-edit.vue @@ -0,0 +1,445 @@ + + + + + diff --git a/src/views/iot/product/components/product-tsl.vue b/src/views/iot/product/components/product-tsl.vue new file mode 100644 index 0000000..7ea5aba --- /dev/null +++ b/src/views/iot/product/components/product-tsl.vue @@ -0,0 +1,648 @@ + + + + + diff --git a/src/views/iot/product/index.vue b/src/views/iot/product/index.vue index 431fbcb..b0b0774 100644 --- a/src/views/iot/product/index.vue +++ b/src/views/iot/product/index.vue @@ -172,6 +172,16 @@ 详情 + + + 物模型 + { const res = await deleteProduct(id); diff --git a/src/views/system/message/components/message-edit.vue b/src/views/system/message/components/message-edit.vue index bfcb000..b33ef4a 100644 --- a/src/views/system/message/components/message-edit.vue +++ b/src/views/system/message/components/message-edit.vue @@ -134,11 +134,12 @@ + > + 全选 @@ -146,11 +147,11 @@ :data="selectedDepartmentMembers" :columns="columns" style="height: 520px"> -