xieyonghong 3 lat temu
rodzic
commit
0c6b1ee5d5

+ 1 - 0
src/locales/en-US/pages.ts

@@ -246,6 +246,7 @@ export default {
   'pages.device.instanceDetail.metadata.readOnly.yes': 'Yes',
   'pages.device.instanceDetail.metadata.readOnly.no': 'No',
   'pages.device.instanceDetail.functions': 'Functions',
+  'pages.device.instanceDetail.parsing': 'Parsing',
   'pages.device.instanceDetail.log': 'Log',
   'pages.device.instanceDetail.alarm': 'Alarm',
   'pages.device.instanceDetail.visualization': 'Visualization',

+ 1 - 0
src/locales/zh-CN/pages.ts

@@ -290,6 +290,7 @@ export default {
   'pages.device.instanceDetail.metadata.readOnly.no': '否',
   'pages.device.instanceDetail.metadata.unit': '单位',
   'pages.device.instanceDetail.functions': '设备功能',
+  'pages.device.instanceDetail.parsing': '数据解析',
   'pages.device.instanceDetail.log': '日志管理',
   'pages.device.instanceDetail.alarm': '告警设置',
   'pages.device.instanceDetail.visualization': '可视化',

+ 4 - 0
src/pages/device/Instance/Detail/Parsing/index.tsx

@@ -0,0 +1,4 @@
+const Parsing = () => {
+  return <>数据解析</>;
+};
+export default Parsing;

+ 20 - 1
src/pages/device/Instance/Detail/index.tsx

@@ -24,10 +24,11 @@ import SystemConst from '@/utils/const';
 import { getMenuPathByCode, getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
 import useSendWebsocketMessage from '@/hooks/websocket/useSendWebsocketMessage';
 import { PermissionButton } from '@/components';
-import { QuestionCircleOutlined } from '@ant-design/icons';
+import { ExclamationCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
 import Service from '@/pages/device/Instance/service';
 import useLocation from '@/hooks/route/useLocation';
 import { onlyMessage } from '@/utils/util';
+import Parsing from './Parsing';
 
 export const deviceStatus = new Map();
 deviceStatus.set('online', <Badge status="success" text={'在线'} />);
@@ -135,6 +136,14 @@ const InstanceDetail = observer(() => {
       component: <Functions />,
     },
     {
+      key: 'parsing',
+      tab: intl.formatMessage({
+        id: 'pages.device.instanceDetail.parsing',
+        defaultMessage: '数据解析',
+      }),
+      component: <Parsing />,
+    },
+    {
       key: 'log',
       tab: intl.formatMessage({
         id: 'pages.device.instanceDetail.log',
@@ -379,6 +388,16 @@ const InstanceDetail = observer(() => {
                 断开连接
               </PermissionButton>
             )}
+            {InstanceModel.detail?.accessProvider === 'child-device' ? (
+              <div style={{ fontSize: 14, marginLeft: 10, fontWeight: 400 }}>
+                <ExclamationCircleOutlined style={{ fontSize: 14, marginRight: 5 }} />
+                {InstanceModel.detail?.features?.find((item) => item.id === 'selfManageState')
+                  ? '该设备的在线状态与父设备(网关设备)保持一致'
+                  : '该设备在线状态由设备自身运行状态决定,不继承父设备(网关设备)的在线状态'}
+              </div>
+            ) : (
+              ''
+            )}
           </Space>
         </div>
       }

+ 1 - 1
src/pages/device/Instance/Export/index.tsx

@@ -119,7 +119,7 @@ const Export = (props: Props) => {
       <div style={{ background: 'rgb(236, 237, 238)' }}>
         <p style={{ padding: 10 }}>
           <ExclamationCircleOutlined style={{ marginRight: 5 }} />
-          选择单个产品时可导出其下属设备的详细数据,不选择产品时导出所有设备的基础数
+          选择单个产品时可导出其下属设备的详细数据,不选择产品时导出所有设备的基础数
         </p>
       </div>
       <div style={{ marginTop: '20px' }}>

+ 1 - 0
src/pages/device/Instance/typings.d.ts

@@ -41,6 +41,7 @@ export type DeviceInstance = {
   photoUrl: string;
   independentMetadata?: boolean;
   accessProvider?: string;
+  features?: any[];
 };
 
 type Unit = {

+ 6 - 2
src/pages/link/AccessConfig/Detail/Access/index.tsx

@@ -440,9 +440,13 @@ const Access = (props: Props) => {
                         borderColor:
                           procotolCurrent === item.id ? 'var(--ant-primary-color-active)' : '',
                       }}
-                      hoverable
+                      hoverable={!props.data.id}
                       onClick={() => {
-                        setProcotolCurrent(item.id);
+                        if (!props.data.id) {
+                          setProcotolCurrent(item.id);
+                        } else {
+                          onlyMessage('消息协议不可修改', 'warning');
+                        }
                       }}
                     >
                       <div style={{ height: '45px' }}>

+ 1 - 0
src/pages/link/Channel/Modbus/Access/bindDevice/index.tsx

@@ -101,6 +101,7 @@ const BindDevice = (props: Props) => {
     >
       <SearchComponent
         field={columns}
+        model={'simple'}
         target="bindDevice"
         defaultParam={[
           { column: 'id$modbus-master$not', value: props.id },

+ 5 - 4
src/pages/link/Channel/Opcua/Access/bindDevice/index.tsx

@@ -2,7 +2,7 @@ import { Modal } from '@/components';
 import SearchComponent from '@/components/SearchComponent';
 import ProTable, { ActionType, ProColumns } from '@jetlinks/pro-table';
 import { Badge } from 'antd';
-import { useEffect, useRef, useState } from 'react';
+import { useRef, useState } from 'react';
 import { service } from '@/pages/link/Channel/Opcua';
 import moment from 'moment';
 import { onlyMessage } from '@/utils/util';
@@ -92,9 +92,9 @@ const BindDevice = (props: Props) => {
     }
   };
 
-  useEffect(() => {
-    console.log(props.id);
-  }, []);
+  // useEffect(() => {
+  //   console.log(props.id);
+  // }, []);
 
   return (
     <Modal
@@ -111,6 +111,7 @@ const BindDevice = (props: Props) => {
     >
       <SearchComponent
         field={columns}
+        model={'simple'}
         target="bindDevice"
         defaultParam={[
           { column: 'productId$dev-protocol', value: 'opc-ua' },

+ 44 - 44
src/pages/link/Protocol/save/index.tsx

@@ -87,50 +87,50 @@ const Save = (props: Props) => {
           columnGap: 24,
         },
         properties: {
-          id: {
-            title: 'ID',
-            'x-component': 'Input',
-            'x-decorator': 'FormItem',
-            'x-disabled': !!props.data?.id,
-            'x-decorator-props': {
-              gridSpan: 2,
-            },
-            'x-validator': [
-              {
-                required: true,
-                message: '请输入ID',
-              },
-              {
-                max: 64,
-                message: '最多可输入64个字符',
-              },
-              {
-                validateId: true,
-                message: 'ID只能由数字、26个英文字母或者下划线组成',
-              },
-              {
-                triggerType: 'onBlur',
-                validator: (value: string) => {
-                  if (!value) return;
-                  return new Promise((resolve) => {
-                    service
-                      .validator(value)
-                      .then((resp) => {
-                        if (!!resp?.result) {
-                          resolve('ID已存在');
-                        } else {
-                          resolve('');
-                        }
-                      })
-                      .catch(() => '验证失败!');
-                  });
-                },
-              },
-            ],
-            'x-component-props': {
-              placeholder: '请输入ID',
-            },
-          },
+          // id: {
+          //   title: 'ID',
+          //   'x-component': 'Input',
+          //   'x-decorator': 'FormItem',
+          //   'x-disabled': !!props.data?.id,
+          //   'x-decorator-props': {
+          //     gridSpan: 2,
+          //   },
+          //   'x-validator': [
+          //     {
+          //       required: true,
+          //       message: '请输入ID',
+          //     },
+          //     {
+          //       max: 64,
+          //       message: '最多可输入64个字符',
+          //     },
+          //     {
+          //       validateId: true,
+          //       message: 'ID只能由数字、26个英文字母或者下划线组成',
+          //     },
+          //     {
+          //       triggerType: 'onBlur',
+          //       validator: (value: string) => {
+          //         if (!value) return;
+          //         return new Promise((resolve) => {
+          //           service
+          //             .validator(value)
+          //             .then((resp) => {
+          //               if (!!resp?.result) {
+          //                 resolve('ID已存在');
+          //               } else {
+          //                 resolve('');
+          //               }
+          //             })
+          //             .catch(() => '验证失败!');
+          //         });
+          //       },
+          //     },
+          //   ],
+          //   'x-component-props': {
+          //     placeholder: '请输入ID',
+          //   },
+          // },
           name: {
             title: '名称',
             'x-component': 'Input',