diff --git a/src/api/link/certificate.js b/src/api/link/certificate.js index 24fe25f9..d4fe08a0 100644 --- a/src/api/link/certificate.js +++ b/src/api/link/certificate.js @@ -1,3 +1,6 @@ -import server from '@/utils/request' +import server from '@/utils/request'; +import { BASE_API_PATH } from '@/utils/variable'; -export const save = (data) => server.post(`/network/certificate`, data) \ No newline at end of file +export const NETWORK_CERTIFICATE_UPLOAD = `${BASE_API_PATH}/network/certificate/upload`; + +export const save = (data) => server.post(`/network/certificate`, data); diff --git a/src/utils/variable.ts b/src/utils/variable.ts index 66af2141..692d66f4 100644 --- a/src/utils/variable.ts +++ b/src/utils/variable.ts @@ -3,5 +3,3 @@ export const BASE_API_PATH = import.meta.env.VITE_APP_BASE_API export const TOKEN_KEY = 'X-Access-Token' export const Version_Code = 'version_code' - -export const NETWORK_CERTIFICATE_UPLOAD = '/network/certificate/upload' \ No newline at end of file diff --git a/src/views/home/components/BootCard.vue b/src/views/home/components/BootCard.vue index 8116e41c..f0767db4 100644 --- a/src/views/home/components/BootCard.vue +++ b/src/views/home/components/BootCard.vue @@ -23,23 +23,16 @@ diff --git a/src/views/home/components/DevOpsHome/index.vue b/src/views/home/components/DevOpsHome/index.vue index be054ca0..e3326295 100644 --- a/src/views/home/components/DevOpsHome/index.vue +++ b/src/views/home/components/DevOpsHome/index.vue @@ -2,7 +2,7 @@
- + @@ -15,7 +15,7 @@
@@ -27,74 +27,8 @@ import BasicCountCard from '../BasicCountCard.vue'; import PlatformPicCard from '../PlatformPicCard.vue'; import StepCard from '../StepCard.vue'; -import {recommendList} from '../../index' -// import {getImage} from '@/utils/comm' +import { opsBootConfig, opsStepDetails } from '../../modules/config'; -// 运维引导-数据 -const bootConfig = [ - { - english: 'STEP1', - label: '设备接入配置', - link: '/a', - auth: true, - save: true, - }, - { - english: 'STEP2', - label: '日志排查', - link: '/b', - auth: true, - save: true, - }, - { - english: 'STEP3', - label: '实时监控', - link: '/c', - auth: false, - save: true, - }, -]; -// 运维管理推荐步骤-数据 -const stepDetails = [ - { - title: '创建产品', - details: - '产品是设备的集合,通常指一组具有相同功能的设备。物联设备必须通过产品进行接入方式配置。', - iconUrl: '/images/home/bottom-4.png', - linkUrl: '/a', - auth: true, - }, - { - title: '配置产品接入方式', - details: - '通过产品对同一类型的设备进行统一的接入方式配置。请参照设备铭牌说明选择匹配的接入方式。', - iconUrl: '/images/home/bottom-1.png', - linkUrl: '/a', - auth: true, - }, - { - title: '添加测试设备', - details: '添加单个设备,用于验证产品模型是否配置正确。', - iconUrl: '/images/home/bottom-5.png', - linkUrl: '/a', - auth: true, - }, - { - title: '功能调试', - details: - '对添加的测试设备进行功能调试,验证能否连接到平台,设备功能是否配置正确。', - iconUrl: '/images/home/bottom-2.png', - linkUrl: '/a', - auth: true, - }, - { - title: '批量添加设备', - details: '批量添加同一产品下的设备', - iconUrl: '/images/home/bottom-3.png', - linkUrl: '/a', - auth: false, - }, -] as recommendList[]; diff --git a/src/views/home/index.d.ts b/src/views/home/index.d.ts index 4dcabf2c..6b8a22bb 100644 --- a/src/views/home/index.d.ts +++ b/src/views/home/index.d.ts @@ -8,11 +8,6 @@ export interface recommendList { auth: boolean; dialogTag?: 'accessMethod' | 'funcTest'; } -// 产品列表里的每项 -export interface productItem { - label: string; - value: string -} export interface deviceInfo { deviceId: string, @@ -20,4 +15,13 @@ export interface deviceInfo { productName: string, createTime: string, status: boolean +} + +export interface bootConfig { + english: string, + label: string, + link: string, + auth: boolean, + image?:string, + params?: object, } \ No newline at end of file diff --git a/src/views/home/modules/config.ts b/src/views/home/modules/config.ts new file mode 100644 index 00000000..68281b8c --- /dev/null +++ b/src/views/home/modules/config.ts @@ -0,0 +1,176 @@ +// import {getImage} from '@/utils/comm' +import { usePermissionStore } from "@/store/permission"; +import { recommendList, bootConfig } from "../index"; + + +// 权限控制 +const hasPermission = usePermissionStore().hasPermission; +const productPermission = (action: string) => + hasPermission(`device/Product:${action}"`); +const devicePermission = (action: string) => + hasPermission(`device/Instance:${action}"`); +const rulePermission = (action: string) => + hasPermission(`rule-engine/Instance:${action}"`); + + +// 物联网引导-数据 +export const deviceBootConfig: bootConfig[] = [ + { + english: 'STEP1', + label: '创建产品', + link: '/a', + auth: productPermission('add'), + params: { + save: true, + }, + }, + { + english: 'STEP2', + label: '创建设备', + link: '/b', + auth: devicePermission('add'), + params: { + save: true, + }, + }, + { + english: 'STEP3', + label: '规则引擎', + link: '/c', + auth: rulePermission('add'), + params: { + save: true, + }, + }, +]; +// 设备接入推荐步骤-数据 +export const deviceStepDetails: recommendList[] = [ + { + title: '创建产品', + details: + '产品是设备的集合,通常指一组具有相同功能的设备。物联设备必须通过产品进行接入方式配置。', + iconUrl: '/images/home/bottom-4.png', + linkUrl: '/a', + auth: productPermission('add'), + params: { + save: true, + }, + }, + { + title: '配置产品接入方式', + details: + '通过产品对同一类型的设备进行统一的接入方式配置。请参照设备铭牌说明选择匹配的接入方式。', + iconUrl: '/images/home/bottom-1.png', + linkUrl: '/a', + auth: productPermission('update'), + dialogTag: 'accessMethod', + }, + { + title: '添加测试设备', + details: '添加单个设备,用于验证产品模型是否配置正确。', + iconUrl: '/images/home/bottom-5.png', + linkUrl: '/a', + auth: devicePermission('add'), + params: { + save: true, + }, + }, + { + title: '功能调试', + details: + '对添加的测试设备进行功能调试,验证能否连接到平台,设备功能是否配置正确。', + iconUrl: '/images/home/bottom-2.png', + linkUrl: '/a', + auth: devicePermission('update'), + dialogTag: 'funcTest', + }, + { + title: '批量添加设备', + details: '批量添加同一产品下的设备', + iconUrl: '/images/home/bottom-3.png', + linkUrl: '/a', + auth: devicePermission('import'), + params: { + import: true, + }, + }, +]; + + +// 运维管理引导-数据 +export const opsBootConfig: bootConfig[] = [ + { + english: 'STEP1', + label: '设备接入配置', + link: '/a', + auth: true, + }, + { + english: 'STEP2', + label: '日志排查', + link: '/b', + auth: true, + params: { + key: 'system', + }, + }, + { + english: 'STEP3', + label: '实时监控', + link: '/c', + auth: false, + params: { + save: true, + }, + }, +]; +// 运维管理推荐步骤-数据 +export const opsStepDetails: recommendList[] = [ + { + title: '协议管理', + details: + '根据业务需求自定义开发对应的产品(设备模型)接入协议,并上传到平台。', + iconUrl: '/images/home/bottom-1.png', + linkUrl: '/a', + auth: true, + params: { + a: 1, + save: true, + }, + }, + { + title: '证书管理', + details: '统一维护平台内的证书,用于数据通信加密。', + iconUrl: '/images/home/bottom-6.png', + linkUrl: '/a', + auth: true, + params: { + a: 1, + save: false, + }, + }, + { + title: '网络组件', + details: '根据不同的传输类型配置平台底层网络组件相关参数。', + iconUrl: '/images/home/bottom-3.png', + linkUrl: '/a', + auth: true, + }, + { + title: '设备接入网关', + details: '根据不同的传输类型,关联消息协议,配置设备接入网关相关参数。', + iconUrl: '/images/home/bottom-4.png', + linkUrl: '/a', + auth: true, + }, + { + title: '日志管理', + details: '监控系统日志,及时处理系统异常。', + iconUrl: '/images/home/bottom-5.png', + linkUrl: '/a', + auth: false, + params: { + key: 'system', + } + }, +]; \ No newline at end of file diff --git a/src/views/link/AccessConfig/components/AccessCard/index.vue b/src/views/link/AccessConfig/components/AccessCard/index.vue index 66e67d13..8b77868c 100644 --- a/src/views/link/AccessConfig/components/AccessCard/index.vue +++ b/src/views/link/AccessConfig/components/AccessCard/index.vue @@ -16,13 +16,13 @@ }}
-
+
diff --git a/src/views/link/AccessConfig/components/Network.vue b/src/views/link/AccessConfig/components/Network.vue index aa354d17..209e5f1e 100644 --- a/src/views/link/AccessConfig/components/Network.vue +++ b/src/views/link/AccessConfig/components/Network.vue @@ -126,7 +126,12 @@
-
+
@@ -190,7 +195,6 @@ v-if="config.document" > -
@@ -314,10 +328,9 @@ import { } from '../Detail/data'; import AccessCard from './AccessCard/index.vue'; import { message, Form } from 'ant-design-vue'; -import type { FormInstance } from 'ant-design-vue'; +import type { FormInstance, TableColumnType } from 'ant-design-vue'; import Markdown from 'vue3-markdown-it'; - //测试数据1 const resultList1 = [ { @@ -363,13 +376,158 @@ const resultList1 = [ // metadata: '', // }; const result2 = { -"id": "MQTT", -"name": "MQTT", -"features": [], -"routes": [], -"document": "# MQTT认证说明\r\nCONNECT报文:\r\n```text\r\nclientId: 设备ID\r\nusername: secureId+\"|\"+timestamp\r\npassword: md5(secureId+\"|\"+timestamp+\"|\"+secureKey)\r\n ```\r\n\r\n说明: secureId以及secureKey在创建设备产品或设备实例时进行配置. \r\ntimestamp为当前系统时间戳(毫秒),与系统时间不能相差5分钟.\r\nmd5为32位,不区分大小写.", -"metadata": "{\"functions\":[],\"name\":\"test\",\"description\":\"测试用\",\"id\":\"test\",\"properties\":[{\"valueType\":{\"round\":\"HALF_UP\",\"type\":\"double\"},\"name\":\"温度\",\"id\":\"t\"},{\"valueType\":{\"round\":\"HALF_UP\",\"type\":\"int\"},\"name\":\"状态\",\"id\":\"state\"}],\"events\":[],\"tags\":[]}" -} + id: 'MQTT', + name: 'MQTT', + features: [ + { + id: 'supportFirmware', + name: '支持固件升级', + }, + ], + routes: [ + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/properties/report', + upstream: true, + downstream: false, + qos: 0, + group: '属性上报', + description: '上报物模型属性数据', + example: '{"properties":{"属性ID":"属性值"}}', + address: '/{productId:产品ID}/{deviceId:设备ID}/properties/report', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/properties/read', + upstream: false, + downstream: true, + qos: 0, + group: '读取属性', + description: '平台下发读取物模型属性数据指令', + example: + '{"messageId":"消息ID,回复时需要一致.","properties":["属性ID"]}', + address: '/{productId:产品ID}/{deviceId:设备ID}/properties/read', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/properties/read/reply', + upstream: true, + downstream: false, + qos: 0, + group: '读取属性', + description: '对平台下发的读取属性指令进行响应', + example: + '{"messageId":"消息ID,与读取指令中的ID一致.","properties":{"属性ID":"属性值"}}', + address: + '/{productId:产品ID}/{deviceId:设备ID}/properties/read/reply', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/properties/write', + upstream: false, + downstream: true, + qos: 0, + group: '修改属性', + description: '平台下发修改物模型属性数据指令', + example: + '{"messageId":"消息ID,回复时需要一致.","properties":{"属性ID":"属性值"}}', + address: '/{productId:产品ID}/{deviceId:设备ID}/properties/write', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/properties/write/reply', + upstream: true, + downstream: false, + qos: 0, + group: '修改属性', + description: '对平台下发的修改属性指令进行响应', + example: + '{"messageId":"消息ID,与修改指令中的ID一致.","properties":{"属性ID":"属性值"}}', + address: + '/{productId:产品ID}/{deviceId:设备ID}/properties/write/reply', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/event/{eventId:事件ID}', + upstream: true, + downstream: false, + qos: 0, + group: '事件上报', + description: '上报物模型事件数据', + example: '{"data":{"key":"value"}}', + address: + '/{productId:产品ID}/{deviceId:设备ID}/event/{eventId:事件ID}', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/function/invoke', + upstream: false, + downstream: true, + qos: 0, + group: '调用功能', + description: '平台下发功能调用指令', + example: + '{"messageId":"消息ID,回复时需要一致.","functionId":"功能标识","inputs":[{"name":"参数名","value":"参数值"}]}', + address: '/{productId:产品ID}/{deviceId:设备ID}/function/invoke', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/function/invoke/reply', + upstream: true, + downstream: false, + qos: 0, + group: '调用功能', + description: '设备响应平台下发的功能调用指令', + example: + '{"messageId":"消息ID,与下发指令中的messageId一致.","output":"输出结果,格式与物模型中定义的类型一致"', + address: + '/{productId:产品ID}/{deviceId:设备ID}/function/invoke/reply', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/child/{childDeviceId:子设备ID}/{#:子设备相应操作的topic}', + upstream: true, + downstream: true, + qos: 0, + group: '子设备消息', + description: '网关上报或者平台下发子设备消息', + address: + '/{productId:产品ID}/{deviceId:设备ID}/child/{childDeviceId:子设备ID}/{#:子设备相应操作的topic}', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/child-reply/{childDeviceId:子设备ID}/{#:子设备相应操作的topic}', + upstream: true, + downstream: true, + qos: 0, + group: '子设备消息', + description: '网关回复平台下发给子设备的指令结果', + address: + '/{productId:产品ID}/{deviceId:设备ID}/child-reply/{childDeviceId:子设备ID}/{#:子设备相应操作的topic}', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/tags', + upstream: true, + downstream: false, + qos: 0, + group: '更新标签', + description: '更新标签数据', + example: '{"tags":{"key","value"}}', + address: '/{productId:产品ID}/{deviceId:设备ID}/tags', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/online', + upstream: true, + downstream: false, + qos: 0, + group: '状态管理', + description: '设备上线', + address: '/{productId:产品ID}/{deviceId:设备ID}/online', + }, + { + topic: '/{productId:产品ID}/{deviceId:设备ID}/offline', + upstream: true, + downstream: false, + qos: 0, + group: '状态管理', + description: '设备离线', + address: '/{productId:产品ID}/{deviceId:设备ID}/offline', + }, + ], + document: + '### 认证说明\r\n\r\nCONNECT报文:\r\n```text\r\nclientId: 设备ID\r\nusername: secureId+"|"+timestamp\r\npassword: md5(secureId+"|"+timestamp+"|"+secureKey)\r\n ```\r\n\r\n说明: secureId以及secureKey在创建设备产品或设备实例时进行配置. \r\ntimestamp为当前时间戳(毫秒),与服务器时间不能相差5分钟.\r\nmd5为32位,不区分大小写.', + metadata: '', +}; function generateUUID() { var d = new Date().getTime(); @@ -400,6 +558,8 @@ const props = defineProps({ }, }); +const clientHeight = document.body.clientHeight; + const formRef = ref(); const useForm = Form.useForm; @@ -412,7 +572,7 @@ const allProcotolList = ref([]); const networkCurrent = ref(''); const procotolCurrent = ref(''); let config = ref({}); -let columnsMQTT = ref([]); +let columnsMQTT = ref([]); const form = reactive({ name: '', description: '', @@ -576,7 +736,7 @@ const next = async () => { //使用测试数据2 config.value = result2; current.value = current.value + 1; - columnsMQTT = [ + columnsMQTT.value = [ { title: '分组', dataIndex: 'group', @@ -584,20 +744,24 @@ const next = async () => { ellipsis: true, align: 'center', width: 100, - customRender: (value, row, index) => { + customCell: (record: object, rowIndex: number) => { const obj = { - children: value, - attrs: {}, + children: record, + rowSpan: 0, }; - const list = (config && config.routes) || []; - const arr = list.filter((res) => { - return res.group == row.group; - }); - if (index == 0 || list[index - 1].group !== row.group) { - obj.attrs.rowSpan = arr.length; - } else { - obj.attrs.rowSpan = 0; - } + const list = + (config.value && config.value.routes) || []; + + const arr = list.filter( + (res: object) => res.group == record.group, + ); + + if ( + rowIndex == 0 || + list[rowIndex - 1].group !== record.group + ) + obj.rowSpan = arr.length; + return obj; }, }, @@ -605,6 +769,7 @@ const next = async () => { title: 'topic', dataIndex: 'topic', key: 'topic', + align: 'center', ellipsis: true, }, { @@ -614,7 +779,6 @@ const next = async () => { ellipsis: true, align: 'center', width: 100, - scopedSlots: { customRender: 'stream' }, }, { title: '说明', @@ -755,7 +919,6 @@ watch( } .card-last { padding-right: 5px; - max-height: 580px; overflow-y: auto; overflow-x: hidden; } diff --git a/src/views/link/Certificate/Detail/CertificateFile.vue b/src/views/link/Certificate/Detail/CertificateFile.vue index ae64c8f0..1bfe23c1 100644 --- a/src/views/link/Certificate/Detail/CertificateFile.vue +++ b/src/views/link/Certificate/Detail/CertificateFile.vue @@ -10,7 +10,7 @@