From 9b9b316a5a9358877d367e6c2504a12fb86fab9c Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Thu, 27 Jul 2023 09:52:39 +0800 Subject: [PATCH] =?UTF-8?q?=20fix:=20=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=80=8F=E4=BC=A0=E9=BB=98=E8=AE=A4=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 优化物模型-全屏编辑 * fix: 优化物模型-枚举校验 * fix: 修改设备透传默认脚本 --- src/components/FRuleEditor/index.vue | 3 +++ src/components/ValueItem/index.vue | 8 ++++++++ src/views/device/Instance/Detail/Parsing/index.vue | 11 ++++++++++- .../device/Product/Detail/DataAnalysis/index.vue | 11 ++++++++++- .../device/components/Metadata/Base/columns.tsx | 1 - .../Metadata/Base/components/Constraint.vue | 2 ++ .../Base/components/Events/SelectColumn.vue | 5 ++++- .../Base/components/Function/AsyncSelect.vue | 7 ++++--- .../Properties/Metrics/BooleanSelect.vue | 4 ++++ .../Base/components/Properties/Metrics/Metrics.vue | 14 +++++++++++--- .../components/Properties/Metrics/ValueItem.vue | 5 ++++- .../Base/components/Properties/Metrics/item.vue | 4 ++++ .../Base/components/Properties/OtherSetting.vue | 5 +++++ .../Base/components/Properties/StorageSetting.vue | 4 +++- .../components/Metadata/Base/components/Source.vue | 10 ++++++++-- .../Metadata/Base/components/Tags/Type.vue | 4 +++- src/views/link/DashBoard/components/Network.vue | 9 ++------- yarn.lock | 4 ++-- 18 files changed, 87 insertions(+), 24 deletions(-) diff --git a/src/components/FRuleEditor/index.vue b/src/components/FRuleEditor/index.vue index 9415e7fb..c45a2204 100644 --- a/src/components/FRuleEditor/index.vue +++ b/src/components/FRuleEditor/index.vue @@ -5,6 +5,7 @@ visible width="70vw" title="编辑规则" + :getContainer="(node) => fullRef || node" @cancel="handleCancel" :destroyOnClose="true" > @@ -57,6 +58,7 @@ import Editor from './Editor/index.vue'; import Debug from './Debug/index.vue'; import Operator from './Operator/index.vue'; +import { FULL_CODE } from 'jetlinks-ui-components/es/DataTable' interface Emits { (e: 'save', data: string | undefined): void; @@ -73,6 +75,7 @@ const props = defineProps({ const _value = ref(props.value); const _disabled = ref(true); +const fullRef = inject(FULL_CODE); const handleCancel = () => { emit('close'); diff --git a/src/components/ValueItem/index.vue b/src/components/ValueItem/index.vue index 0b5c4b1d..da46528a 100644 --- a/src/components/ValueItem/index.vue +++ b/src/components/ValueItem/index.vue @@ -8,6 +8,7 @@ :options="options" allowClear style="width: 100%" + :getPopupContainer="getPopupContainer" @change='selectChange' /> '', + }, + getPopupContainer: { + type: Function, + default: undefined } }); // type Props = { diff --git a/src/views/device/Instance/Detail/Parsing/index.vue b/src/views/device/Instance/Detail/Parsing/index.vue index c047bf1b..d70bd7e4 100644 --- a/src/views/device/Instance/Detail/Parsing/index.vue +++ b/src/views/device/Instance/Detail/Parsing/index.vue @@ -164,7 +164,16 @@ import { isBoolean } from 'lodash'; import { onlyMessage } from '@/utils/comm'; const defaultValue = - '//解码函数\r\nfunction decode(context) {\r\n //原始报文\r\n var buffer = context.payload();\r\n // 转为json\r\n // var json = context.json();\r\n //mqtt 时通过此方法获取topic\r\n // var topic = context.topic();\r\n\r\n // 提取变量\r\n // var topicVars = context.pathVars("/{deviceId}/**",topic)\r\n //温度属性\r\n var temperature = buffer.getShort(3) * 10;\r\n //湿度属性\r\n var humidity = buffer.getShort(6) * 10;\r\n return {\r\n "temperature": temperature,\r\n "humidity": humidity\r\n };\r\n}\r\n'; + `//注册设备下行数据监听器,当平台下发指令给设备时,回调将被调用,用于构造下发给设备的报文 + codec.onDownstream(function(ctx){ + + }); + + //注册设备上行数据监听器,当设备上行数据时,回调将被调用,用于解析设备上报的数据. + codec.onUpstream(function(ctx){ + + }); + `; const el = ref(null); const { toggle } = useFullscreen(el); diff --git a/src/views/device/Product/Detail/DataAnalysis/index.vue b/src/views/device/Product/Detail/DataAnalysis/index.vue index c3fec662..1d117db8 100644 --- a/src/views/device/Product/Detail/DataAnalysis/index.vue +++ b/src/views/device/Product/Detail/DataAnalysis/index.vue @@ -123,7 +123,16 @@ import { isBoolean } from 'lodash'; import { onlyMessage } from '@/utils/comm'; const defaultValue = - '//解码函数\r\nfunction decode(context) {\r\n //原始报文\r\n var buffer = context.payload();\r\n // 转为json\r\n // var json = context.json();\r\n //mqtt 时通过此方法获取topic\r\n // var topic = context.topic();\r\n\r\n // 提取变量\r\n // var topicVars = context.pathVars("/{deviceId}/**",topic)\r\n //温度属性\r\n var temperature = buffer.getShort(3) * 10;\r\n //湿度属性\r\n var humidity = buffer.getShort(6) * 10;\r\n return {\r\n "temperature": temperature,\r\n "humidity": humidity\r\n };\r\n}\r\n'; + `//注册设备下行数据监听器,当平台下发指令给设备时,回调将被调用,用于构造下发给设备的报文 + codec.onDownstream(function(ctx){ + + }); + + //注册设备上行数据监听器,当设备上行数据时,回调将被调用,用于解析设备上报的数据. + codec.onUpstream(function(ctx){ + + }); + `; const el = ref(null); const { toggle } = useFullscreen(el); diff --git a/src/views/device/components/Metadata/Base/columns.tsx b/src/views/device/components/Metadata/Base/columns.tsx index 829b8226..007a0372 100644 --- a/src/views/device/components/Metadata/Base/columns.tsx +++ b/src/views/device/components/Metadata/Base/columns.tsx @@ -341,7 +341,6 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n const fieldIndex = Number(field[1]) const values = dataSource.find((item, index) => index === fieldIndex) - return validatorConfig(values.output) } }] diff --git a/src/views/device/components/Metadata/Base/components/Constraint.vue b/src/views/device/components/Metadata/Base/components/Constraint.vue index 754f6cff..e73f125b 100644 --- a/src/views/device/components/Metadata/Base/components/Constraint.vue +++ b/src/views/device/components/Metadata/Base/components/Constraint.vue @@ -12,6 +12,7 @@