From 6acc522ed54ee1f0d3358aa2d9e25176ac12dcf5 Mon Sep 17 00:00:00 2001 From: jackhoo_98 Date: Wed, 15 Feb 2023 21:01:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BD=91=E7=BB=9C=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=AF=A6=E6=83=85=20=E8=A1=A8=E5=8D=95=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=9F=BA=E6=9C=AC=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/link/type.ts | 18 +- src/views/link/Type/Detail/index.vue | 1337 +++++++++++++++++++++++++- src/views/link/Type/data.ts | 82 ++ src/views/link/Type/index.vue | 38 +- 4 files changed, 1450 insertions(+), 25 deletions(-) diff --git a/src/api/link/type.ts b/src/api/link/type.ts index bc3546b0..887d395f 100644 --- a/src/api/link/type.ts +++ b/src/api/link/type.ts @@ -13,4 +13,20 @@ export const start = (data: object) => export const supports = () => server.get(`/network/config/supports`); -export const query = (data: Object) => server.post(`/network/config/_query`, data); +export const query = (data: Object) => + server.post(`/network/config/_query`, data); + +export const providers = () => server.get(`/gateway/device/providers`); + +export const resourcesCurrent = () => + server.get(`/network/resources/alive/_current`); + +export const resourceClusters = () => server.get(`network/resources/clusters`); + +export const resourceClustersById = (id: string) => + server.get(`/network/resources/alive/${id}`); + +export const allResources = () => server.get(`/network/resources/alive/_all`); + +export const certificates = () => + server.get(`/network/certificate/_query/no-paging?paging=false`); diff --git a/src/views/link/Type/Detail/index.vue b/src/views/link/Type/Detail/index.vue index 639f8949..9fca900e 100644 --- a/src/views/link/Type/Detail/index.vue +++ b/src/views/link/Type/Detail/index.vue @@ -1,9 +1,1340 @@ - - + + diff --git a/src/views/link/Type/data.ts b/src/views/link/Type/data.ts index e69de29b..d6814539 100644 --- a/src/views/link/Type/data.ts +++ b/src/views/link/Type/data.ts @@ -0,0 +1,82 @@ +export const FormStates = { + name: '', + type: 'UDP', + shareCluster: true, + parserType: '', + configuration: { + port: '', + host: '0.0.0.0', + publicPort: '', + publicHost: '', + remoteHost: '', + remotePort: '', + secure: false, + username: '', + password: '', + topicPrefix: '', + maxMessageSize: '', + certId: '', + privateKeyAlias: '', + clientId: '', + parserConfiguration: { + delimited: '', + lang: '', + script: '', + size: '', + length: '', + offset: '', + little: '', + }, + }, + description: '', +}; + +const VisibleMost = [ + 'COAP_SERVER', + 'MQTT_SERVER', + 'WEB_SOCKET_SERVER', + 'TCP_SERVER', + 'UDP', + 'HTTP_SERVER', +]; + +export const VisibleData = { + parserType: ['TCP_SERVER'], + // configuration: { + port: VisibleMost, + host: VisibleMost, + publicPort: VisibleMost, + publicHost: VisibleMost, + remoteHost: ['MQTT_CLIENT'], + remotePort: ['MQTT_CLIENT'], + secure: ['TCP_SERVER', 'UDP', 'COAP_SERVER'], + username: ['MQTT_CLIENT'], + password: ['MQTT_CLIENT'], + topicPrefix: ['MQTT_CLIENT'], + maxMessageSize: ['MQTT_SERVER', 'MQTT_CLIENT'], + // certId: '', + // privateKeyAlias: '', + clientId: ['MQTT_CLIENT'], + // parserConfiguration: { + delimited: ['DELIMITED'], + lang: ['SCRIPT'], + script: ['SCRIPT'], + size: ['FIXED_LENGTH'], + length: ['LENGTH_FIELD'], + offset: ['LENGTH_FIELD'], + little: ['LENGTH_FIELD'], + // }, + + // }, +}; + +export const ParserTypeOptions = [ + { value: 'DIRECT', label: '不处理' }, + { value: 'DELIMITED', label: '分隔符' }, + { value: 'SCRIPT', label: '自定义脚本' }, + { value: 'FIXED_LENGTH', label: '固定长度' }, + { value: 'LENGTH_FIELD', label: '长度字段' }, +]; + +export const isVisible = (LastName: string, dependencies: string | boolean) => + VisibleData[LastName].includes(dependencies); diff --git a/src/views/link/Type/index.vue b/src/views/link/Type/index.vue index 53cde88e..bc37ec86 100644 --- a/src/views/link/Type/index.vue +++ b/src/views/link/Type/index.vue @@ -357,36 +357,32 @@ const getActions = ( }; const handlAdd = () => { - // router.push({ - // path: `/iot/link/certificate/detail/:id`, - // query: { view: false }, - // }); + router.push({ + path: `/iot/link/type/detail/:id`, + query: { view: false }, + }); }; const handlEye = (id: string) => { - console.log(111, id); - - // router.push({ - // path: `/iot/link/certificate/detail/${id}`, - // query: { view: true }, - // }); + router.push({ + path: `/iot/link/type/detail/${id}`, + query: { view: true }, + }); }; const handlEdit = (id: string) => { - console.log(111, id); - - // router.push({ - // path: `/iot/link/certificate/detail/${id}`, - // query: { view: false }, - // }); + router.push({ + path: `/iot/link/type/detail/${id}`, + query: { view: false }, + }); }; const handlDelete = async (id: string) => { - // const res = await remove(id); - // if (res.success) { - // message.success('操作成功'); - // tableRef.value.reload(); - // } + const res = await remove(id); + if (res.success) { + message.success('操作成功'); + tableRef.value.reload(); + } }; const getDetails = (slotProps: Partial>) => {