Quellcode durchsuchen

fix: 国标级联搜索修改

sun-chaochao vor 3 Jahren
Ursprung
Commit
2387accecf

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

@@ -28,7 +28,7 @@ const AccessConfig = (props: Props) => {
   });
   const [param, setParam] = useState<any>({ pageSize: 4 });
 
-  const [currrent] = useState<any>({
+  const [currrent, setCurrrent] = useState<any>({
     id: productModel.current?.accessId,
     name: productModel.current?.accessName,
     protocol: productModel.current?.messageProtocol,
@@ -147,11 +147,11 @@ const AccessConfig = (props: Props) => {
             span={12}
             // style={{
             //   width: '100%',
-            //   borderColor: currrent?.id === item.id ? 'var(--ant-primary-color-active)' : ''
-            // }}
-            // onClick={() => {
-            //   setCurrrent(item);
+            //   borderColor: currrent?.id === item.id ? 'var(--ant-primary-color-active)' : 'red',
             // }}
+            onClick={() => {
+              setCurrrent(item);
+            }}
           >
             <TableCard
               showMask={false}
@@ -174,13 +174,13 @@ const AccessConfig = (props: Props) => {
                   <div className={styles.container}>
                     <div className={styles.server}>
                       <div className={styles.subTitle}>{item?.channelInfo?.name || '--'}</div>
-                      <p>
+                      <div style={{ width: '100%' }}>
                         {item.channelInfo?.addresses.map((i: any) => (
-                          <div key={i.address}>
+                          <p key={i.address}>
                             <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address} />
-                          </div>
+                          </p>
                         ))}
-                      </p>
+                      </div>
                     </div>
                     <div className={styles.procotol}>
                       <div className={styles.subTitle}>{item?.protocolDetail?.name || '--'}</div>

+ 2 - 0
src/pages/device/Product/Detail/Access/index.tsx

@@ -33,6 +33,8 @@ const Access = () => {
   MetworkTypeMapping.set('mqtt-client-gateway', 'MQTT_CLIENT');
   MetworkTypeMapping.set('mqtt-server-gateway', 'MQTT_SERVER');
   MetworkTypeMapping.set('tcp-server-gateway', 'TCP_SERVER');
+  MetworkTypeMapping.set('fixed-media', 'TCP_CLIENT');
+  MetworkTypeMapping.set('gb28181-2016', 'UDP');
 
   const [configVisible, setConfigVisible] = useState<boolean>(false);
 

+ 1 - 1
src/pages/media/Cascade/Channel/index.tsx

@@ -11,7 +11,7 @@ import BindChannel from './BindChannel';
 import BadgeStatus, { StatusColorEnum } from '@/components/BadgeStatus';
 
 const Channel = () => {
-  const location = useLocation();
+  const location: any = useLocation();
   const actionRef = useRef<ActionType>();
   const [param, setParam] = useState({});
   const intl = useIntl();

+ 1 - 0
src/pages/media/Cascade/Publish/index.tsx

@@ -28,6 +28,7 @@ const Publish = (props: Props) => {
         const temp = res.result.total;
         dt += temp;
         setCount(dt);
+        // setCountErr(0);
       } else {
         setCountErr(0);
         setErrMessage(res.message);

+ 6 - 5
src/pages/media/Cascade/Save/index.tsx

@@ -21,9 +21,10 @@ import { service } from '../index';
 import { useLocation } from 'umi';
 
 const Save = () => {
-  const location = useLocation();
+  const location: any = useLocation();
   const [form] = Form.useForm();
   const [clusters, setClusters] = useState<any[]>([]);
+  const id = location?.query?.id || '';
 
   const checkSIP = (_: any, value: { host: string; port: number }) => {
     if (!value) {
@@ -42,8 +43,8 @@ const Save = () => {
         setClusters(resp.result);
       }
     });
-    if (location?.query && location?.query?.id) {
-      service.detail(location?.query?.id).then((resp) => {
+    if (!!id) {
+      service.detail(id).then((resp) => {
         if (resp.status === 200) {
           const sipConfigs = resp.result?.sipConfigs[0];
           const data = {
@@ -92,8 +93,8 @@ const Save = () => {
             delete sipConfigs.local;
             const param = { ...values, sipConfigs: [sipConfigs] };
             let resp = undefined;
-            if (location?.query?.id) {
-              resp = await service.update({ ...param, id: location?.query?.id });
+            if (id) {
+              resp = await service.update({ ...param, id });
             } else {
               resp = await service.save(param);
             }

+ 33 - 4
src/pages/media/Cascade/index.tsx

@@ -144,6 +144,7 @@ const Cascade = () => {
     {
       dataIndex: 'count',
       title: '通道数量',
+      hideInSearch: true,
     },
     {
       dataIndex: 'status',
@@ -151,16 +152,44 @@ const Cascade = () => {
         id: 'pages.searchTable.titleStatus',
         defaultMessage: '状态',
       }),
-      render: (text: any) => (
-        <Badge status={text?.value === 'disabled' ? 'error' : 'success'} text={text?.text} />
+      render: (text: any, record: any) => (
+        <Badge
+          status={record.status?.value === 'disabled' ? 'error' : 'success'}
+          text={record.status?.text}
+        />
       ),
+      valueType: 'select',
+      valueEnum: {
+        disabled: {
+          text: '已停止',
+          status: 'disabled',
+        },
+        enabled: {
+          text: '已启动',
+          status: 'enabled',
+        },
+      },
     },
     {
       dataIndex: 'onlineStatus',
       title: '级联状态',
-      render: (text: any) => (
-        <Badge status={text?.value === 'offline' ? 'error' : 'success'} text={text?.text} />
+      render: (text: any, record: any) => (
+        <Badge
+          status={record.onlineStatus?.value === 'offline' ? 'error' : 'success'}
+          text={record.onlineStatus?.text}
+        />
       ),
+      valueType: 'select',
+      valueEnum: {
+        online: {
+          text: '在线',
+          status: 'online',
+        },
+        offline: {
+          text: '离线',
+          status: 'offline',
+        },
+      },
     },
     {
       title: intl.formatMessage({

+ 1 - 0
src/pages/system/Role/Detail/Permission/index.tsx

@@ -76,6 +76,7 @@ const Permission = () => {
             .subscribe((resp) => {
               if (resp.status === 200) {
                 message.success('操作成功');
+                history.goBack();
               }
             });
         }}