From 91ae45d227493aee9039b0f005ef6f46aa2ef85f Mon Sep 17 00:00:00 2001 From: jackhoo_98 Date: Wed, 15 Feb 2023 13:34:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E7=BD=91=E7=BB=9C=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=20=E5=8D=A1=E7=89=87/=E5=88=97=E8=A1=A8=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/link/type.ts | 16 + src/views/link/AccessConfig/index.vue | 10 +- src/views/link/Protocol/index.vue | 6 +- src/views/link/Type/Detail/index.vue | 9 + src/views/link/Type/data.ts | 0 src/views/link/Type/index.vue | 465 ++++++++++++++++++++++++ src/views/link/Type/type.d.ts | 0 src/views/media/Stream/Detail/index.vue | 2 +- src/views/media/Stream/index.vue | 10 +- 9 files changed, 503 insertions(+), 15 deletions(-) create mode 100644 src/api/link/type.ts create mode 100644 src/views/link/Type/Detail/index.vue create mode 100644 src/views/link/Type/data.ts create mode 100644 src/views/link/Type/index.vue create mode 100644 src/views/link/Type/type.d.ts diff --git a/src/api/link/type.ts b/src/api/link/type.ts new file mode 100644 index 00000000..bc3546b0 --- /dev/null +++ b/src/api/link/type.ts @@ -0,0 +1,16 @@ +import server from '@/utils/request'; + +export const queryNetworkConfig = (params: object) => + server.post(`/network/config/_query`, params); + +export const remove = (id: string) => server.remove(`/network/config/${id}`); + +export const shutdown = (data: object) => + server.post(`/network/config/${data}/_shutdown`); + +export const start = (data: object) => + server.post(`/network/config/${data}/_start`); + +export const supports = () => server.get(`/network/config/supports`); + +export const query = (data: Object) => server.post(`/network/config/_query`, data); diff --git a/src/views/link/AccessConfig/index.vue b/src/views/link/AccessConfig/index.vue index 699a994c..90cbaaa1 100644 --- a/src/views/link/AccessConfig/index.vue +++ b/src/views/link/AccessConfig/index.vue @@ -45,11 +45,9 @@

- {{ - slotProps.name - }} + {{ slotProps.name }}

{ min-height: 100px; .card-item-content-title-a { - // color: #000 !important; + color: #1890ff !important; font-weight: 700; - font-size: 18px; + font-size: 16px; overflow: hidden; //超出的文本隐藏 text-overflow: ellipsis; //溢出用省略号显示 white-space: nowrap; //溢出不换行 diff --git a/src/views/link/Protocol/index.vue b/src/views/link/Protocol/index.vue index 5b9b351b..3ae666c1 100644 --- a/src/views/link/Protocol/index.vue +++ b/src/views/link/Protocol/index.vue @@ -31,7 +31,7 @@ - - + + 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>) => {