wzyyy 3 лет назад
Родитель
Сommit
12d57e454d

BIN
public/images/jar.png


BIN
public/images/local.png


+ 2 - 2
src/app.tsx

@@ -189,7 +189,7 @@ export const request: RequestConfig = {
               .catch(() => {
                 notification.error({
                   key: 'error',
-                  message: '系统错误',
+                  message: '系统开小差,请稍后重试',
                 });
               });
           }
@@ -198,7 +198,7 @@ export const request: RequestConfig = {
     }
     if (!response) {
       notification.error({
-        description: '您的网络发生异常,无法连接服务器',
+        description: '网络异常,请检查网络连接',
         message: '网络异常',
       });
     }

+ 1 - 1
src/components/RadioCard/index.less

@@ -26,7 +26,7 @@
     }
 
     &:not(:last-child) {
-      margin-right: 10px;
+      margin-right: 24px;
     }
 
     &:hover,

+ 20 - 13
src/pages/device/Product/Detail/Access/AccessConfig/index.tsx

@@ -98,19 +98,26 @@ const AccessConfig = (props: Props) => {
             messageProtocol: currrent.protocol,
           });
           if (resp.status === 200) {
-            service1
-              .changeDeploy(productModel.current?.id || '', 'deploy')
-              .subscribe((response) => {
-                if (response) {
-                  service1.detail(productModel.current?.id || '').then((res) => {
-                    if (res.status === 200) {
-                      productModel.current = { ...res.result };
-                      message.success('操作成功!');
-                    }
-                    close();
-                  });
-                }
-              });
+            service1.detail(productModel.current?.id || '').then((res) => {
+              if (res.status === 200) {
+                productModel.current = { ...res.result };
+                message.success('操作成功!');
+              }
+              close();
+            });
+            // service1
+            //   .changeDeploy(productModel.current?.id || '', 'deploy')
+            //   .subscribe((response) => {
+            //     if (response) {
+            //       service1.detail(productModel.current?.id || '').then((res) => {
+            //         if (res.status === 200) {
+            //           productModel.current = { ...res.result };
+            //           message.success('操作成功!');
+            //         }
+            //         close();
+            //       });
+            //     }
+            //   });
           }
         } else {
           message.success('请选择接入方式');

+ 1 - 1
src/pages/device/Product/Save/index.tsx

@@ -121,7 +121,7 @@ const Save = (props: Props) => {
         form.resetFields();
         close();
       }}
-      width={610}
+      width={640}
       title={intl.formatMessage({
         id: `pages.data.option.${props.model || 'add'}`,
         defaultMessage: '新增',

+ 38 - 17
src/pages/link/Protocol/save/index.tsx

@@ -1,4 +1,4 @@
-import { Button, message, Modal } from 'antd';
+import { Button, Modal } from 'antd';
 import { createForm, registerValidateRules } from '@formily/core';
 import { createSchemaField } from '@formily/react';
 import React, { useEffect, useState } from 'react';
@@ -9,7 +9,8 @@ import { service } from '@/pages/link/Protocol';
 import FileUpload from '../FileUpload';
 import type { ProtocolItem } from '@/pages/link/Protocol/typings';
 import { PermissionButton } from '@/components';
-
+import { RadioCard } from '@/components';
+import { onlyMessage } from '@/utils/util';
 interface Props {
   data: ProtocolItem | undefined;
   close: () => void;
@@ -44,6 +45,7 @@ const Save = (props: Props) => {
       Select,
       FileUpload,
       FormGrid,
+      RadioCard,
     },
     scope: {
       icon(name: any) {
@@ -59,8 +61,9 @@ const Save = (props: Props) => {
         type: 'void',
         'x-component': 'FormGrid',
         'x-component-props': {
-          maxColumns: 1,
-          minColumns: 1,
+          maxColumns: 2,
+          minColumns: 2,
+          columnGap: 24,
         },
         properties: {
           id: {
@@ -69,7 +72,7 @@ const Save = (props: Props) => {
             'x-decorator': 'FormItem',
             'x-disabled': !!props.data?.id,
             'x-decorator-props': {
-              gridSpan: 1,
+              gridSpan: 2,
             },
             'x-validator': [
               {
@@ -112,7 +115,7 @@ const Save = (props: Props) => {
             'x-component': 'Input',
             'x-decorator': 'FormItem',
             'x-decorator-props': {
-              gridSpan: 1,
+              gridSpan: 2,
             },
             'x-component-props': {
               placeholder: '请输入名称',
@@ -130,14 +133,30 @@ const Save = (props: Props) => {
           },
           type: {
             title: '类型',
-            'x-component': 'Select',
+            'x-component': 'RadioCard',
             'x-decorator': 'FormItem',
             'x-disabled': !!props.data?.id,
             'x-decorator-props': {
+              gridSpan: 2,
               tooltip: <div>jar:上传协议jar包,文件格式支持.jar或.zip</div>,
             },
             'x-component-props': {
-              placeholder: '请选择类型',
+              model: 'singular',
+              itemStyle: {
+                width: '50%',
+              },
+              options: [
+                {
+                  label: 'Jar',
+                  value: 'jar',
+                  imgUrl: require('/public/images/jar.png'),
+                },
+                {
+                  label: 'Local',
+                  value: 'local',
+                  imgUrl: require('/public/images/local.png'),
+                },
+              ],
             },
             'x-validator': [
               {
@@ -145,11 +164,11 @@ const Save = (props: Props) => {
                 message: '请选择类型',
               },
             ],
-            enum: [
-              { label: 'jar', value: 'jar' },
-              { label: 'local', value: 'local' },
-              // { label: 'script', value: 'script' },
-            ],
+            // enum: [
+            //   { label: 'jar', value: 'jar' },
+            //   { label: 'local', value: 'local' },
+            //   // { label: 'script', value: 'script' },
+            // ],
           },
           configuration: {
             type: 'object',
@@ -159,10 +178,9 @@ const Save = (props: Props) => {
                 'x-decorator': 'FormItem',
                 'x-visible': false,
                 'x-decorator-props': {
+                  gridSpan: 2,
                   tooltip: (
-                    <div>
-                      local:填写本地协议编译目录绝对地址,如:d:/workspace/protocol/target/classes
-                    </div>
+                    <div>local:填写本地协议编译目录绝对地址,如:d:/protocol/target/classes</div>
                   ),
                 },
                 'x-validator': [
@@ -189,6 +207,9 @@ const Save = (props: Props) => {
             title: '说明',
             'x-component': 'Input.TextArea',
             'x-decorator': 'FormItem',
+            'x-decorator-props': {
+              gridSpan: 2,
+            },
             'x-component-props': {
               rows: 3,
               showCount: true,
@@ -209,7 +230,7 @@ const Save = (props: Props) => {
       response = await service.update(value);
     }
     if (response && response.status === 200) {
-      message.success('操作成功');
+      onlyMessage('操作成功');
       if (deploy) {
         await service.modifyState(value.id, 'deploy');
       }

+ 33 - 18
src/pages/media/Cascade/Save/index.tsx

@@ -80,6 +80,10 @@ const Save = () => {
                 host: sipConfigs.host,
                 port: sipConfigs.port,
               },
+              remotePublic: {
+                host: sipConfigs.publicHost,
+                port: sipConfigs.publicPort,
+              },
             },
           };
           form.setFieldsValue(data);
@@ -117,6 +121,8 @@ const Save = () => {
               remotePort: values.sipConfigs.public.port,
               host: values.sipConfigs.local.host,
               port: values.sipConfigs.local.port,
+              publicHost: values.sipConfigs.remotePublic.host,
+              publicPort: values.sipConfigs.remotePublic.port,
             };
             delete values.sipConfigs;
             delete sipConfigs.public;
@@ -227,24 +233,6 @@ const Save = () => {
             </Col>
             <Col span={12}>
               <Form.Item
-                label="传输协议"
-                name={['sipConfigs', 'transport']}
-                rules={[{ required: true, message: '请选择传输协议' }]}
-              >
-                <Radio.Group
-                  optionType="button"
-                  buttonStyle="solid"
-                  onChange={(e) => {
-                    setTransport(e.target.value);
-                  }}
-                >
-                  <Radio.Button value="UDP">UDP</Radio.Button>
-                  <Radio.Button value="TCP">TCP</Radio.Button>
-                </Radio.Group>
-              </Form.Item>
-            </Col>
-            <Col span={12}>
-              <Form.Item
                 label={
                   <span>
                     SIP本地地址
@@ -264,6 +252,33 @@ const Save = () => {
             </Col>
             <Col span={12}>
               <Form.Item
+                label="SIP远程地址"
+                name={['sipConfigs', 'remotePublic']}
+                rules={[{ required: true, message: '请输入SIP远程地址' }, { validator: checkSIP }]}
+              >
+                <SipComponent />
+              </Form.Item>
+            </Col>
+            <Col span={24}>
+              <Form.Item
+                label="传输协议"
+                name={['sipConfigs', 'transport']}
+                rules={[{ required: true, message: '请选择传输协议' }]}
+              >
+                <Radio.Group
+                  optionType="button"
+                  buttonStyle="solid"
+                  onChange={(e) => {
+                    setTransport(e.target.value);
+                  }}
+                >
+                  <Radio.Button value="UDP">UDP</Radio.Button>
+                  <Radio.Button value="TCP">TCP</Radio.Button>
+                </Radio.Group>
+              </Form.Item>
+            </Col>
+            <Col span={12}>
+              <Form.Item
                 label="用户"
                 name={['sipConfigs', 'user']}
                 rules={[{ required: true, message: '请输入用户' }]}

+ 1 - 1
src/pages/media/Device/Save/index.tsx

@@ -122,7 +122,7 @@ export default (props: SaveProps) => {
           form.resetFields();
           close();
         }}
-        width={610}
+        width={640}
         title={intl.formatMessage({
           id: `pages.data.option.${props.model || 'add'}`,
           defaultMessage: '新增',

+ 1 - 1
src/pages/system/Basis/index.tsx

@@ -123,7 +123,7 @@ const Basis = () => {
               <Form.Item
                 label="系统名称"
                 name="title"
-                rules={[{ required: true, message: '请输入系统名称' }]}
+                // rules={[{ required: true, message: '请输入系统名称' }]}
               >
                 <Input />
               </Form.Item>

+ 10 - 1
src/utils/util.ts

@@ -2,7 +2,7 @@ import moment from 'moment';
 import type { Field, FieldDataSource } from '@formily/core';
 import { action } from '@formily/reactive';
 import Token from '@/utils/token';
-
+import { message } from 'antd';
 /**
  * 下载文件
  * @param url 下载链接
@@ -118,3 +118,12 @@ export const getDomFullHeight = (className: string, extraHeight: number = 0): nu
   }
   return 0;
 };
+export const onlyMessage = (
+  msg: string,
+  type: 'success' | 'error' | 'warning' = 'success',
+  key: number = 1,
+) =>
+  message[type]({
+    content: msg,
+    key: key,
+  });