diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index 5148bca8..5acdcb02 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -482,4 +482,59 @@ export const getPropertiesInfo = (deviceId: string, data: Record) => server.post(`/device-instance/${deviceId}/property/${property}/_query`, data) \ No newline at end of file +export const getPropertiesList = (deviceId: string, property: string, data: Record) => server.post(`/device-instance/${deviceId}/property/${property}/_query`, data) + +/** + * 获取指定协议 + * @param id + * @param transport + * @returns + */ +export const getProtocal = (id: string, transport: string) => server.get(`/protocol/${id}/transport/${transport}`) + +/** + * 获取产品解析规则 + * @param productId + * @returns + */ +export const productCode = (productId: string) => server.get(`/device/transparent-codec/${productId}`) +/** + * 保存产品解析规则 + * @param productId + * @returns + */ +export const saveProductCode = (productId: string,data: Record) => server.post(`/device/transparent-codec/${productId}`,data) +/** + * 获取设备解析规则 + * @param productId + * @param deviceId + * @returns + */ +export const deviceCode = (productId: string,deviceId:string) => server.get(`device/transparent-codec/${productId}/${deviceId}`) +/** + * 保存设备解析规则 + * @param productId + * @param deviceId + * @param data + * @returns + */ +export const saveDeviceCode = (productId: string,deviceId:string,data: Record) => server.post(`/device/transparent-codec/${productId}/${deviceId}`,data) +/** + * 编码测试 + * @param data + * @returns + */ +export const testCode = (data: Record) => server.post(`/device/transparent-codec/decode-test`,data) +/** + * 删除设备解析规则 + * @param productId + * @param deviceId + * @returns + */ +export const delDeviceCode = (productId: string, deviceId: string) => server.remove(`/device/transparent-codec/${productId}/${deviceId}`) +/** + * 删除产品解析规则 + * @param productId + * @returns + */ +export const delProductCode = (productId: string) => server.remove(`/device/transparent-codec/${productId}`) \ No newline at end of file diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx index 2c589ac5..cdf932a1 100644 --- a/src/components/AIcon/index.tsx +++ b/src/components/AIcon/index.tsx @@ -58,6 +58,7 @@ const iconKeys = [ 'PauseOutlined', 'ControlOutlined', 'RedoOutlined', + 'ExpandOutlined' ] const Icon = (props: {type: string}) => { diff --git a/src/views/device/Instance/Detail/Parsing/index.vue b/src/views/device/Instance/Detail/Parsing/index.vue new file mode 100644 index 00000000..5aebe4e2 --- /dev/null +++ b/src/views/device/Instance/Detail/Parsing/index.vue @@ -0,0 +1,306 @@ + + + + + + \ No newline at end of file diff --git a/src/views/device/Instance/Detail/index.vue b/src/views/device/Instance/Detail/index.vue index f775e847..1a841466 100644 --- a/src/views/device/Instance/Detail/index.vue +++ b/src/views/device/Instance/Detail/index.vue @@ -79,7 +79,7 @@ @@ -116,6 +116,7 @@ import Function from './Function/index.vue'; import Modbus from './Modbus/index.vue'; import OPCUA from './OPCUA/index.vue'; import EdgeMap from './EdgeMap/index.vue'; +import Parsing from './Parsing/index.vue' import { _deploy, _disconnect } from '@/api/device/instance'; import { message } from 'ant-design-vue'; import { getImage } from '@/utils/comm'; @@ -167,6 +168,7 @@ const tabs = { Modbus, OPCUA, EdgeMap, + Parsing }; const getStatus = (id: string) => { @@ -275,6 +277,15 @@ watchEffect(() => { tab: '边缘端映射', }); } + if ( + instanceStore.current.features?.find((item: any) => item.id === 'transparentCodec') && + !keys.includes('Parsing') + ) { + list.value.push({ + key: 'Parsing', + tab: '数据解析', + }); + } }); onUnmounted(() => { diff --git a/src/views/device/Product/Detail/DataAnalysis/index.vue b/src/views/device/Product/Detail/DataAnalysis/index.vue index 4866d236..07deadd9 100644 --- a/src/views/device/Product/Detail/DataAnalysis/index.vue +++ b/src/views/device/Product/Detail/DataAnalysis/index.vue @@ -1,4 +1,246 @@ - - - - + + + + + + \ No newline at end of file diff --git a/src/views/device/Product/Detail/index.vue b/src/views/device/Product/Detail/index.vue index 90bec07c..cbf6fc20 100644 --- a/src/views/device/Product/Detail/index.vue +++ b/src/views/device/Product/Detail/index.vue @@ -123,6 +123,7 @@ const tabs = { Info, Metadata, Device, + DataAnalysis }; watch( @@ -188,7 +189,7 @@ const handleUndeploy = async () => { */ const getProtocol = async () => { if (productStore.current?.messageProtocol) { - const res = await getProtocolDetail( + const res:any = await getProtocolDetail( productStore.current?.messageProtocol, ); if (res.status === 200) {