hear 3 anni fa
parent
commit
7ff12e1652

+ 3 - 0
src/pages/iot-card/Home/index.less

@@ -0,0 +1,3 @@
+.bottomImg {
+  padding-bottom: 30%;
+}

+ 3 - 1
src/pages/iot-card/Home/index.tsx

@@ -10,6 +10,7 @@ import Echarts from '@/components/DashBoard/echarts';
 import { EChartsOption } from 'echarts';
 import moment from 'moment';
 import Service from './service';
+import './index.less';
 
 export const service = new Service('');
 
@@ -210,8 +211,9 @@ export default () => {
             }
           />
         </Col>
-        <Col span={24}>
+        <Col span={24} style={{ backgroundColor: 'white', minHeight: 580 }}>
           <Body
+            className="bottomImg"
             title={'平台架构图'}
             english={'PLATFORM ARCHITECTURE DIAGRAM'}
             url={require('/public/images/iot-card/iotcard-home.png')}

+ 5 - 0
src/pages/iot-card/Recharge/index.less

@@ -0,0 +1,5 @@
+.record {
+  .ant-empty-normal {
+    margin: 12% 0;
+  }
+}

+ 1 - 0
src/pages/iot-card/Recharge/index.tsx

@@ -10,6 +10,7 @@ import { useRef, useState } from 'react';
 import Service from '../CardManagement/service';
 import Detail from './detail';
 import TopUp from './topUp';
+import './index.less';
 
 export const service = new Service('network/card');
 

+ 2 - 1
src/pages/link/DataCollect/components/Channel/index.tsx

@@ -268,7 +268,8 @@ export default observer((props: Props) => {
               justifyContent: 'flex-end',
               position: 'absolute',
               width: '100%',
-              bottom: 0,
+              bottom: 10,
+              right: '2%',
             }}
           >
             <Pagination

+ 2 - 1
src/pages/link/DataCollect/components/Device/index.tsx

@@ -361,7 +361,8 @@ export default observer((props: Props) => {
                     justifyContent: 'flex-end',
                     position: 'absolute',
                     width: '100%',
-                    bottom: 0,
+                    bottom: 10,
+                    right: '2%',
                   }}
                 >
                   <Pagination

+ 2 - 1
src/pages/link/DataCollect/components/Point/index.tsx

@@ -321,7 +321,8 @@ const PointCard = observer((props: PointCardProps) => {
                     justifyContent: 'flex-end',
                     position: 'absolute',
                     width: '100%',
-                    bottom: 0,
+                    bottom: 10,
+                    right: '2%',
                   }}
                 >
                   <Pagination

+ 21 - 3
src/pages/link/Type/Detail/index.tsx

@@ -15,7 +15,7 @@ import {
 } from '@formily/antd';
 import type { ISchema } from '@formily/json-schema';
 import { useEffect, useMemo, useRef, useState } from 'react';
-import type { Field, FieldDataSource } from '@formily/core';
+import { Field, FieldDataSource, registerValidateRules } from '@formily/core';
 import { onFormInit } from '@formily/core';
 import { createForm, onFieldReact, onFieldValueChange } from '@formily/core';
 import { Card, Col, Row } from 'antd';
@@ -261,6 +261,16 @@ const Save = observer(() => {
         value: item.id,
       })),
     );
+
+  registerValidateRules({
+    IpOrDomain(value) {
+      if (!value) return '';
+      const regIp = /((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/;
+      const regDomain = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
+      return regIp.test(value) || regDomain.test(value) ? '' : '请输入IP或者域名';
+    },
+  });
+
   const clusterConfig: ISchema = {
     type: 'void',
     'x-component': 'FormGrid',
@@ -374,7 +384,11 @@ const Save = observer(() => {
         required: true,
         'x-decorator': 'FormItem',
         'x-component': 'Input',
-        'x-validator': ['ipv4'],
+        'x-validator': [
+          {
+            IpOrDomain: true,
+          },
+        ],
         'x-component-props': {
           placeholder: '请输入公网地址',
         },
@@ -447,7 +461,11 @@ const Save = observer(() => {
               placeholder: '请输入远程地址',
             },
             required: true,
-            'x-validator': ['ipv4'],
+            'x-validator': [
+              {
+                IpOrDomain: true,
+              },
+            ],
             'x-decorator': 'FormItem',
             'x-component': 'Input',
           },

+ 3 - 2
src/pages/media/Cascade/Save/index.tsx

@@ -18,7 +18,7 @@ import {
 } from 'antd';
 import SipComponent from '@/components/SipComponent';
 import SipSelectComponent from '@/components/SipSelectComponent';
-import { testIP } from '@/utils/util';
+// import { testIP } from '@/utils/util';
 import { useEffect, useState } from 'react';
 import { service } from '../index';
 import { useLocation } from 'umi';
@@ -31,13 +31,14 @@ const Save = () => {
   const id = location?.query?.id || '';
   const [list, setList] = useState<any[]>([]);
   const [transport, setTransport] = useState<'UDP' | 'TCP'>('UDP');
+  const regDomain = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
 
   const checkSIP = (_: any, value: { host: string; port: number }) => {
     if (!value) {
       return Promise.resolve();
     } else if (!value.host) {
       return Promise.reject(new Error('请输入IP 地址'));
-    } else if (value?.host && !testIP(value.host)) {
+    } else if (value?.host && !regDomain.test(value.host)) {
       return Promise.reject(new Error('请输入正确的IP地址'));
     } else if (!value?.port) {
       return Promise.reject(new Error('请输入端口'));

+ 15 - 10
src/pages/media/Device/Save/ProviderSelect.tsx

@@ -118,19 +118,24 @@ export default (props: ProviderProps) => {
                     <div className={styles.desc}>{item.description || ''}</div>
                   </div>
                   <div className={styles.container}>
-                    <div className={styles.server}>
-                      <div className={styles.subTitle}>{item?.channelInfo?.name || ''}</div>
-                      <div style={{ width: '100%' }}>
-                        {item.channelInfo?.addresses.map((i: any, index: number) => (
-                          <p key={i.address + `_address${index}`}>
-                            <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address} />
-                          </p>
-                        ))}
+                    {props.type === 'gb28181-2016' && (
+                      <div className={styles.server}>
+                        <div className={styles.subTitle}>{item?.channelInfo?.name || ''}</div>
+                        <div style={{ width: '100%' }}>
+                          {item.channelInfo?.addresses.map((i: any, index: number) => (
+                            <p key={i.address + `_address${index}`}>
+                              <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address} />
+                            </p>
+                          ))}
+                        </div>
                       </div>
-                    </div>
+                    )}
+
                     <div className={styles.procotol}>
                       <div className={styles.subTitle}>{item?.protocolDetail?.name || ''}</div>
-                      <p>{item.protocolDetail?.description || ''}</p>
+                      <p style={props.type === 'gb28181-2016' ? { width: 250 } : {}}>
+                        {item.protocolDetail?.description || ''}
+                      </p>
                     </div>
                   </div>
                 </div>

+ 8 - 7
src/pages/media/Stream/Detail/index.tsx

@@ -5,7 +5,7 @@ import { service, StreamModel } from '@/pages/media/Stream';
 import { useParams } from 'umi';
 import { QuestionCircleOutlined } from '@ant-design/icons';
 import SipComponent from '@/components/SipComponent';
-import { onlyMessage, testIP } from '@/utils/util';
+import { onlyMessage } from '@/utils/util';
 import useLocation from '@/hooks/route/useLocation';
 
 interface RTPComponentProps {
@@ -167,14 +167,15 @@ const Detail = () => {
     }
   }, [params.id]);
 
+  const regDomain = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
   const checkSIP = (_: any, value: { host: string; port: number }) => {
     if (!value) {
       return Promise.resolve();
     }
     if (!value || !value.host) {
       return Promise.reject(new Error('请输入API HOST'));
-    } else if (value?.host && !testIP(value.host)) {
-      return Promise.reject(new Error('请输入正确的IP地址'));
+    } else if (value?.host && !regDomain.test(value.host)) {
+      return Promise.reject(new Error('请输入正确的IP地址或者域名'));
     } else if (!value?.port) {
       return Promise.reject(new Error('请输入端口'));
     } else if ((value?.port && Number(value.port) < 1) || Number(value.port) > 65535) {
@@ -201,11 +202,11 @@ const Detail = () => {
     }
     if (!value || !value.rtpIp) {
       return Promise.reject(new Error('请输入RTP IP'));
-    } else if (value?.rtpIp && !testIP(value.rtpIp)) {
-      return Promise.reject(new Error('请输入正确的IP地址'));
+    } else if (value?.rtpIp && !regDomain.test(value.rtpIp)) {
+      return Promise.reject(new Error('请输入正确的IP地址或者域名'));
     } else if (!value.dynamicRtpPort) {
-      if (value.rtpIp && !testIP(value.rtpIp)) {
-        return Promise.reject(new Error('请输入正确的IP地址'));
+      if (value.rtpIp && !regDomain.test(value.rtpIp)) {
+        return Promise.reject(new Error('请输入正确的IP地址或者域名'));
       }
       if (!value?.rtpPort) {
         return Promise.reject(new Error('请输入端口'));

+ 1 - 0
src/pages/system/Platforms/Api/swagger-ui/base.tsx

@@ -246,6 +246,7 @@ export default observer(() => {
             }}
             value={ApiModel.swagger.url}
             readOnly
+            disabled
           />
         </Input.Group>
       </div>

+ 22 - 2
src/pages/system/Platforms/Api/swagger-ui/debugging.tsx

@@ -2,7 +2,7 @@ import { TitleComponent } from '@/components';
 import ReactJson from 'react-json-view';
 import { request } from 'umi';
 import MonacoEditor from 'react-monaco-editor';
-import { Button, Input } from 'antd';
+import { Button, Input, Popconfirm } from 'antd';
 import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
 import { createSchemaField, FormProvider, observer } from '@formily/react';
 import { ApiModel } from '@/pages/system/Platforms/Api/base';
@@ -11,6 +11,7 @@ import { ArrayTable, Editable, FormItem, Input as FormilyInput } from '@formily/
 import type { ISchema } from '@formily/json-schema';
 import SystemConst from '@/utils/const';
 import classNames from 'classnames';
+import { DeleteOutlined } from '@ant-design/icons';
 
 export default observer(() => {
   const [result, setResult] = useState({});
@@ -18,6 +19,22 @@ export default observer(() => {
 
   const editor: any = useRef(null);
 
+  const RemoveButton = () => {
+    const index = ArrayTable.useIndex!();
+    const array = ArrayTable.useArray!();
+    return (
+      <Popconfirm
+        title="确定删除"
+        onConfirm={() => {
+          array.field?.remove?.(index);
+          array.props?.onRemove?.(index);
+        }}
+      >
+        <DeleteOutlined />
+      </Popconfirm>
+    );
+  };
+
   useEffect(() => {
     if (ApiModel.debugger.body && editor.current) {
       const { editor: MEditor } = editor.current;
@@ -36,6 +53,7 @@ export default observer(() => {
       Editable,
       Input: FormilyInput,
       ArrayTable,
+      RemoveButton,
     },
   });
 
@@ -100,6 +118,7 @@ export default observer(() => {
   }, [body]);
 
   useEffect(() => {
+    // console.log('ApiModel.debugger',ApiModel.debugger)
     if (form && ApiModel.debugger && ApiModel.debugger.params) {
       const arr = ApiModel.debugger.params.map((item: any) => {
         return {
@@ -168,7 +187,7 @@ export default observer(() => {
                   properties: {
                     remove: {
                       type: 'void',
-                      'x-component': 'ArrayTable.Remove',
+                      'x-component': 'RemoveButton',
                     },
                   },
                 },
@@ -200,6 +219,7 @@ export default observer(() => {
               width: `calc(100% - ${ApiModel.swagger.method !== 'delete' ? '140px' : '150px'})`,
             }}
             value={ApiModel.swagger.url}
+            disabled
           />
           <Button type="primary" onClick={onSearch}>
             发送