Sfoglia il codice sorgente

fix: 修改表格值为空显示-

100011797 3 anni fa
parent
commit
6d67f0ce03

+ 3 - 1
src/components/BindParentDevice/index.tsx

@@ -48,7 +48,9 @@ const BindParentDevice = (props: Props) => {
       ellipsis: true,
       width: '200px',
       valueType: 'dateTime',
-      render: (text: any) => (!!text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '/'),
+      renderText: (text: any) => {
+        return !!text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '';
+      },
       sorter: true,
     },
     {

+ 129 - 0
src/components/FIndicators/index.tsx

@@ -0,0 +1,129 @@
+import { Checkbox, InputNumber, Space, DatePicker, Input } from 'antd';
+import moment from 'moment';
+
+interface Props {
+  value: any;
+  type: any;
+  onChange: (value: any) => void;
+}
+
+const FIndicators = (props: Props) => {
+  const { value, onChange, type } = props;
+  const DatePicker1: any = DatePicker;
+
+  const renderComponent = () => {
+    if (['int', 'long', 'double', 'float'].includes(type)) {
+      return (
+        <>
+          <InputNumber
+            value={value?.value ? value?.value[0] : ''}
+            onChange={(val) => {
+              onChange({
+                ...value,
+                value: [
+                  value?.range && val < value?.value[1] ? val : value?.value[0],
+                  value?.value[1],
+                ],
+              });
+            }}
+          />
+          {value.range && (
+            <>
+              ~
+              <InputNumber
+                value={value?.value ? value?.value[1] : ''}
+                onChange={(val) => {
+                  onChange({
+                    ...value,
+                    value: [value?.value && value?.value[0], val],
+                  });
+                }}
+              />
+            </>
+          )}
+        </>
+      );
+    } else if (type === 'date') {
+      if (value.range) {
+        return (
+          <DatePicker1.RangePicker
+            allowClear={false}
+            showTime
+            value={
+              value?.value && [
+                !!value?.value[0] && moment(value.value[0], 'YYYY-MM-DD HH:mm:ss'),
+                !!value?.value[1] && moment(value.value[1], 'YYYY-MM-DD HH:mm:ss'),
+              ]
+            }
+            onChange={(_: any, date: string[]) => {
+              onChange({
+                ...value,
+                value: [...date],
+              });
+            }}
+          />
+        );
+      } else {
+        return (
+          <DatePicker1
+            showTime
+            allowClear={false}
+            value={value?.value ? moment(value.value[0], 'YYYY-MM-DD HH:mm:ss') : ''}
+            onChange={(_: any, date: string) => {
+              onChange({
+                ...value,
+                value: [date],
+              });
+            }}
+          />
+        );
+      }
+    } else {
+      return (
+        <>
+          <Input
+            value={value?.value ? value?.value[0] : ''}
+            onChange={(val) => {
+              onChange({
+                ...value,
+                value: [val, value?.value && value?.value[1]],
+              });
+            }}
+          />
+          {value.range && (
+            <>
+              ~
+              <Input
+                value={value?.value ? value?.value[1] : ''}
+                onChange={(val) => {
+                  onChange({
+                    ...value,
+                    value: [value?.value && value?.value[0], val],
+                  });
+                }}
+              />
+            </>
+          )}
+        </>
+      );
+    }
+  };
+  return (
+    <Space align="baseline">
+      {renderComponent()}
+      <Checkbox
+        style={{ minWidth: 60 }}
+        checked={value?.range}
+        onChange={(e) => {
+          onChange({
+            ...value,
+            range: e.target.checked,
+          });
+        }}
+      >
+        范围
+      </Checkbox>
+    </Space>
+  );
+};
+export default FIndicators;

+ 8 - 2
src/components/Upload/Image/index.tsx

@@ -20,7 +20,7 @@ interface UploadImageProps {
    */
   size?: number;
   style?: React.CSSProperties;
-  backgroundSize?:string;
+  backgroundSize?: string;
 }
 
 export default ({ onChange, value, ...extraProps }: UploadImageProps) => {
@@ -77,7 +77,13 @@ export default ({ onChange, value, ...extraProps }: UploadImageProps) => {
             {values ? (
               <>
                 {/*<img width={120} height={120} src={values} />*/}
-                <div className={'upload-image'} style={{ backgroundImage: `url(${values})`,backgroundSize:extraProps.backgroundSize }} />
+                <div
+                  className={'upload-image'}
+                  style={{
+                    backgroundImage: `url(${values})`,
+                    backgroundSize: extraProps.backgroundSize,
+                  }}
+                />
                 <div className={'upload-image-mask'}>点击修改</div>
               </>
             ) : (

+ 1 - 0
src/pages/Northbound/AliCloud/index.tsx

@@ -206,6 +206,7 @@ const AliCloud = () => {
         search={false}
         scroll={{ x: 1366 }}
         columns={columns}
+        columnEmptyText={''}
         actionRef={actionRef}
         params={searchParams}
         options={{ fullScreen: true }}

+ 1 - 0
src/pages/Northbound/DuerOS/index.tsx

@@ -241,6 +241,7 @@ export default () => {
         columns={columns}
         actionRef={actionRef}
         params={searchParams}
+        columnEmptyText={''}
         scroll={{ x: 1366 }}
         options={{ fullScreen: true }}
         request={(params) =>

+ 1 - 0
src/pages/cloud/DuerOS/index.tsx

@@ -102,6 +102,7 @@ const DuerOS = () => {
         search={false}
         params={param}
         columns={columns}
+        columnEmptyText={''}
         request={(params) =>
           service.query({ ...params, sorts: [{ name: 'createTime', order: 'desc' }] })
         }

+ 92 - 35
src/pages/device/Instance/Detail/Diagnose/Status/index.tsx

@@ -112,7 +112,6 @@ const Status = observer((props: Props) => {
             text: '正常',
             info: null,
           });
-          DiagnoseStatusModel.count++;
           resolve({});
         }, time);
       } else {
@@ -205,7 +204,6 @@ const Status = observer((props: Props) => {
                 if (item) {
                   DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item);
                 }
-                DiagnoseStatusModel.count++;
                 resolve({});
               }, time);
             } else {
@@ -235,7 +233,6 @@ const Status = observer((props: Props) => {
             text: '正常',
             info: null,
           });
-          DiagnoseStatusModel.count++;
           resolve({});
         }, time);
       } else {
@@ -371,7 +368,6 @@ const Status = observer((props: Props) => {
                   if (item) {
                     DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item);
                   }
-                  DiagnoseStatusModel.count++;
                   resolve({});
                 }, time);
               } else {
@@ -503,7 +499,6 @@ const Status = observer((props: Props) => {
           setTimeout(() => {
             if (item) {
               DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item);
-              DiagnoseStatusModel.count++;
             }
             resolve({});
           }, time);
@@ -527,7 +522,6 @@ const Status = observer((props: Props) => {
             text: '正常',
             info: null,
           });
-          DiagnoseStatusModel.count++;
           resolve({});
         }, time);
       } else {
@@ -562,7 +556,6 @@ const Status = observer((props: Props) => {
                 </div>
               ),
             });
-            DiagnoseStatusModel.count++;
             resolve({});
           }, time);
         } else {
@@ -651,7 +644,6 @@ const Status = observer((props: Props) => {
             setTimeout(() => {
               if (item) {
                 DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item);
-                DiagnoseStatusModel.count++;
               }
               resolve({});
             }, time);
@@ -679,7 +671,6 @@ const Status = observer((props: Props) => {
             text: '正常',
             info: null,
           });
-          DiagnoseStatusModel.count++;
           resolve({});
         }, time);
       } else {
@@ -744,7 +735,6 @@ const Status = observer((props: Props) => {
                 if (item) {
                   DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item);
                 }
-                DiagnoseStatusModel.count++;
                 resolve({});
               }, time);
             } else {
@@ -771,7 +761,6 @@ const Status = observer((props: Props) => {
             text: '正常',
             info: null,
           });
-          DiagnoseStatusModel.count++;
           resolve({});
         }, time);
       } else {
@@ -840,7 +829,6 @@ const Status = observer((props: Props) => {
           if (item) {
             DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item);
           }
-          DiagnoseStatusModel.count++;
           resolve({});
         }, time);
       }
@@ -884,7 +872,6 @@ const Status = observer((props: Props) => {
                   text: '正常',
                   info: null,
                 });
-                DiagnoseStatusModel.count++;
                 resolve({});
               }, time);
             } else if (
@@ -941,7 +928,6 @@ const Status = observer((props: Props) => {
                     </div>
                   ),
                 });
-                DiagnoseStatusModel.count++;
                 resolve({});
               }, time);
             } else {
@@ -1002,7 +988,6 @@ const Status = observer((props: Props) => {
                     </div>
                   ),
                 });
-                DiagnoseStatusModel.count++;
                 resolve({});
               }, time);
             }
@@ -1051,7 +1036,6 @@ const Status = observer((props: Props) => {
                   text: '正常',
                   info: null,
                 });
-                DiagnoseStatusModel.count++;
                 resolve({});
               }, time);
             } else if (
@@ -1108,7 +1092,6 @@ const Status = observer((props: Props) => {
                     </div>
                   ),
                 });
-                DiagnoseStatusModel.count++;
                 resolve({});
               }, time);
             } else {
@@ -1169,7 +1152,6 @@ const Status = observer((props: Props) => {
                     </div>
                   ),
                 });
-                DiagnoseStatusModel.count++;
                 resolve({});
               }, time);
             }
@@ -1235,7 +1217,6 @@ const Status = observer((props: Props) => {
   //               DiagnoseStatusModel.list.length,
   //             );
   //           }
-  //           DiagnoseStatusModel.count++;
   //           resolve({});
   //         }, time);
   //       }
@@ -1291,7 +1272,6 @@ const Status = observer((props: Props) => {
   //       //     if (item) {
   //       //       DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item, DiagnoseStatusModel.list.length);
   //       //     }
-  //       //     DiagnoseStatusModel.count++;
   //       //     resolve({});
   //       //   }, time);
   //       // }
@@ -1354,7 +1334,6 @@ const Status = observer((props: Props) => {
   //               DiagnoseStatusModel.list.length,
   //             );
   //           }
-  //           DiagnoseStatusModel.count++;
   //           resolve({});
   //         }, time);
   //       }
@@ -1488,7 +1467,6 @@ const Status = observer((props: Props) => {
               DiagnoseStatusModel.list.length,
             );
           }
-          DiagnoseStatusModel.count++;
           resolve({});
         }, time);
       } else {
@@ -1604,7 +1582,6 @@ const Status = observer((props: Props) => {
               DiagnoseStatusModel.list.length,
             );
           }
-          DiagnoseStatusModel.count++;
           resolve({});
         }, time);
       } else {
@@ -1777,6 +1754,7 @@ const Status = observer((props: Props) => {
 
   useEffect(() => {
     if (DiagnoseStatusModel.status === 'finish') {
+      DiagnoseStatusModel.count = 0;
       const list = _.uniq(_.map(DiagnoseStatusModel.list, 'status'));
       if (device.state?.value !== 'online') {
         DiagnoseStatusModel.state = 'error';
@@ -1786,6 +1764,9 @@ const Status = observer((props: Props) => {
       } else {
         DiagnoseStatusModel.state = 'success';
       }
+    } else if (DiagnoseStatusModel.status === 'loading') {
+      const arr = _.map(DiagnoseStatusModel.list, 'status').filter((i) => i !== 'loading');
+      DiagnoseStatusModel.count = arr.length;
     }
   }, [DiagnoseStatusModel.status, DiagnoseStatusModel.list]);
 
@@ -1802,7 +1783,6 @@ const Status = observer((props: Props) => {
       product: [],
       device: [],
     };
-    DiagnoseStatusModel.count = 0;
     DiagnoseStatusModel.status = 'loading';
     DiagnoseStatusModel.percent = 0;
     let arr: any[] = [];
@@ -2022,17 +2002,94 @@ const Status = observer((props: Props) => {
           onCancel={() => {
             setBindParentVisible(false);
           }}
-          onOk={(parentId: string) => {
-            DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, {
-              key: 'parent-device',
-              name: '网关父设备',
-              desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
-              status: 'success',
-              text: '正常',
-              info: null,
-            });
-            InstanceModel.detail.parentId = parentId;
-            setBindParentVisible(false);
+          onOk={async (parentId: string) => {
+            let item: ListProps | undefined = undefined;
+            const response = await service.detail(parentId);
+            if (response.status === 200) {
+              if (response?.result?.state?.value === 'notActive') {
+                item = {
+                  key: 'parent-device',
+                  name: '网关父设备',
+                  desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+                  status: 'error',
+                  text: '异常',
+                  info: (
+                    <div>
+                      <div className={styles.infoItem}>
+                        <Badge
+                          status="default"
+                          text={
+                            productPermission.action ? (
+                              <span>
+                                网关父设备已禁用,请先
+                                <Popconfirm
+                                  title="确认启用"
+                                  onConfirm={async () => {
+                                    const resp = await service.deployDevice(
+                                      response?.result?.id || '',
+                                    );
+                                    if (resp.status === 200) {
+                                      onlyMessage('操作成功!');
+                                      DiagnoseStatusModel.list = modifyArrayList(
+                                        DiagnoseStatusModel.list,
+                                        {
+                                          key: 'parent-device',
+                                          name: '网关父设备',
+                                          desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+                                          status: 'success',
+                                          text: '正常',
+                                          info: null,
+                                        },
+                                      );
+                                    }
+                                  }}
+                                >
+                                  <a>启用</a>
+                                </Popconfirm>
+                              </span>
+                            ) : (
+                              '暂无权限,请联系管理员处理'
+                            )
+                          }
+                        />
+                      </div>
+                    </div>
+                  ),
+                };
+              } else if (response?.state?.value === 'online') {
+                item = {
+                  key: 'parent-device',
+                  name: '网关父设备',
+                  desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+                  status: 'success',
+                  text: '正常',
+                  info: null,
+                };
+              } else {
+                item = {
+                  key: 'parent-device',
+                  name: '网关父设备',
+                  desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
+                  status: 'error',
+                  text: '异常',
+                  info: (
+                    <div>
+                      <div className={styles.infoItem}>
+                        <Badge
+                          status="default"
+                          text={<span>网关父设备已离线,请先排查网关设备故障</span>}
+                        />
+                      </div>
+                    </div>
+                  ),
+                };
+              }
+              if (item) {
+                DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item);
+              }
+              InstanceModel.detail.parentId = parentId;
+              setBindParentVisible(false);
+            }
           }}
         />
       )}

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

@@ -558,6 +558,7 @@ const Instance = () => {
         actionRef={actionRef}
         params={searchParams}
         options={{ fullScreen: true }}
+        columnEmptyText={''}
         request={(params) =>
           service.query({
             ...params,

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

@@ -422,6 +422,7 @@ const Product = observer(() => {
       <ProTableCard<ProductItem>
         columns={columns}
         actionRef={actionRef}
+        columnEmptyText={''}
         options={{ fullScreen: true }}
         scroll={{ x: 1366 }}
         // request={async (params = {}) => {

+ 143 - 102
src/pages/device/components/Metadata/Base/Edit/index.tsx

@@ -50,6 +50,7 @@ import DB from '@/db';
 import _ from 'lodash';
 import { InstanceModel } from '@/pages/device/Instance';
 import FRuleEditor from '@/components/FRuleEditor';
+import FIndicators from '@/components/FIndicators';
 import { action } from '@formily/reactive';
 import { asyncUpdateMedata, updateMetadata } from '../../metadata';
 import { onlyMessage } from '@/utils/util';
@@ -160,6 +161,7 @@ const Edit = observer((props: Props) => {
       Checkbox,
       FormGrid,
       DatePicker,
+      FIndicators,
     },
     scope: {
       async asyncOtherConfig(field: Field) {
@@ -778,121 +780,160 @@ const Edit = observer((props: Props) => {
                         },
                       ],
                     },
-                    space: {
-                      type: 'void',
+                    '{value, range}': {
                       title: '指标值',
                       'x-decorator': 'FormItem',
-                      'x-component': 'FormGrid',
+                      'x-component': 'FIndicators',
                       'x-decorator-props': {
                         labelAlign: 'left',
                         layout: 'vertical',
                       },
+                      'x-reactions': {
+                        dependencies: ['valueType.type'],
+                        fulfill: {
+                          state: {
+                            componentProps: {
+                              type: '{{$deps[0]}}',
+                            },
+                          },
+                        },
+                      },
                       'x-validator': [
                         {
                           required: true,
                           message: '请输入指标值',
                         },
-                      ],
-                      'x-component-props': {
-                        maxColumns: 12,
-                        minColumns: 12,
-                      },
-                      properties: {
-                        'value[0]': {
-                          'x-decorator': 'FormItem',
-                          'x-component': 'Input',
-                          'x-decorator-props': {
-                            gridSpan: 5,
-                          },
-                          'x-validator': [
-                            {
-                              required: true,
-                              message: '请输入',
-                            },
-                          ],
-                          'x-reactions': {
-                            dependencies: ['..range', 'valueType.type'],
-                            fulfill: {
-                              state: {
-                                decoratorProps: {
-                                  gridSpan: '{{!!$deps[0]?5:$deps[1]==="boolean"?12:10}}',
-                                },
-                                componentType:
-                                  '{{["int","long","double","float"].includes($deps[1])?"NumberPicker":["date"].includes($deps[1])?"DatePicker":"Input"}}',
-                              },
-                            },
-                          },
-                          // 根据数据类型来渲染不同的组件
-                        },
-                        'value[1]': {
-                          title: '~',
-                          'x-decorator': 'FormItem',
-                          'x-component': 'Input',
-                          'x-decorator-props': {
-                            gridSpan: 5,
-                          },
-                          'x-validator': [
-                            {
-                              required: true,
-                              message: '请输入',
-                            },
-                          ],
-                          'x-reactions': [
-                            {
-                              dependencies: ['..range', 'valueType.type'],
-                              fulfill: {
-                                state: {
-                                  visible: '{{!!$deps[0]}}',
-                                  componentType:
-                                    '{{["int","long","double","float"].includes($deps[1])?"NumberPicker":["date"].includes($deps[1])?"DatePicker":"Input"}}',
-                                },
-                              },
-                            },
-                            {
-                              dependencies: ['valueType.type'],
-                              fulfill: {
-                                state: {
-                                  visible: '{{!$deps[0]==="boolean"}}',
-                                },
-                              },
-                            },
-                          ],
-                        },
-                        // 根据数据类型来渲染不同的组件
-                        range: {
-                          type: 'boolean',
-                          default: false,
-                          'x-decorator': 'FormItem',
-                          'x-component': 'Checkbox',
-                          'x-component-props': {
-                            children: '范围',
-                          },
-                          'x-decorator-props': {
-                            gridSpan: 2,
-                          },
-                          'x-reactions': {
-                            dependencies: ['valueType.type'],
-                            when: '{{$deps[0]==="boolean"}}',
-                            fulfill: {
-                              state: {
-                                visible: false,
-                                decoratorProps: {
-                                  gridSpan: 0,
-                                },
-                              },
-                            },
-                            otherwise: {
-                              state: {
-                                visible: true,
-                                decoratorProps: {
-                                  gridSpan: 2,
-                                },
-                              },
-                            },
+                        {
+                          validator: (value: any) => {
+                            if (value?.range) {
+                              if (!value?.value || !value?.value[0] || !value?.value[1]) {
+                                return Promise.reject(new Error('请输入指标值'));
+                              }
+                            } else {
+                              if (value?.value && !value?.value[0]) {
+                                return Promise.reject(new Error('请输入指标值'));
+                              }
+                            }
+                            return Promise.resolve();
                           },
                         },
-                      },
+                      ],
                     },
+                    // space: {
+                    //   type: 'void',
+                    //   title: '指标值',
+                    //   'x-decorator': 'FormItem',
+                    //   'x-component': 'FormGrid',
+                    //   'x-decorator-props': {
+                    //     labelAlign: 'left',
+                    //     layout: 'vertical',
+                    //   },
+                    //   'x-validator': [
+                    //     {
+                    //       required: true,
+                    //       message: '请输入指标值',
+                    //     },
+                    //   ],
+                    //   'x-component-props': {
+                    //     maxColumns: 12,
+                    //     minColumns: 12,
+                    //   },
+                    //   properties: {
+                    //     'value[0]': {
+                    //       'x-decorator': 'FormItem',
+                    //       'x-component': 'Input',
+                    //       'x-decorator-props': {
+                    //         gridSpan: 5,
+                    //       },
+                    //       'x-validator': [
+                    //         {
+                    //           required: true,
+                    //           message: '请输入',
+                    //         },
+                    //       ],
+                    //       'x-reactions': {
+                    //         dependencies: ['..range', 'valueType.type'],
+                    //         fulfill: {
+                    //           state: {
+                    //             decoratorProps: {
+                    //               gridSpan: '{{!!$deps[0]?5:$deps[1]==="boolean"?12:10}}',
+                    //             },
+                    //             componentType:
+                    //               '{{["int","long","double","float"].includes($deps[1])?"NumberPicker":["date"].includes($deps[1])?"DatePicker":"Input"}}',
+                    //           },
+                    //         },
+                    //       },
+                    //       // 根据数据类型来渲染不同的组件
+                    //     },
+                    //     'value[1]': {
+                    //       title: '~',
+                    //       'x-decorator': 'FormItem',
+                    //       'x-component': 'Input',
+                    //       'x-decorator-props': {
+                    //         gridSpan: 5,
+                    //       },
+                    //       'x-validator': [
+                    //         {
+                    //           required: true,
+                    //           message: '请输入',
+                    //         },
+                    //       ],
+                    //       'x-reactions': [
+                    //         {
+                    //           dependencies: ['..range', 'valueType.type'],
+                    //           fulfill: {
+                    //             state: {
+                    //               visible: '{{!!$deps[0]}}',
+                    //               componentType:
+                    //                 '{{["int","long","double","float"].includes($deps[1])?"NumberPicker":["date"].includes($deps[1])?"DatePicker":"Input"}}',
+                    //             },
+                    //           },
+                    //         },
+                    //         {
+                    //           dependencies: ['valueType.type'],
+                    //           fulfill: {
+                    //             state: {
+                    //               visible: '{{!$deps[0]==="boolean"}}',
+                    //             },
+                    //           },
+                    //         },
+                    //       ],
+                    //     },
+                    //     // 根据数据类型来渲染不同的组件
+                    //     range: {
+                    //       type: 'boolean',
+                    //       default: false,
+                    //       'x-decorator': 'FormItem',
+                    //       'x-component': 'Checkbox',
+                    //       'x-component-props': {
+                    //         children: '范围',
+                    //       },
+                    //       'x-decorator-props': {
+                    //         gridSpan: 2,
+                    //       },
+                    //       'x-reactions': {
+                    //         dependencies: ['valueType.type'],
+                    //         when: '{{$deps[0]==="boolean"}}',
+                    //         fulfill: {
+                    //           state: {
+                    //             visible: false,
+                    //             decoratorProps: {
+                    //               gridSpan: 0,
+                    //             },
+                    //           },
+                    //         },
+                    //         otherwise: {
+                    //           state: {
+                    //             visible: true,
+                    //             decoratorProps: {
+                    //               gridSpan: 2,
+                    //             },
+                    //           },
+                    //         },
+                    //       },
+                    //     },
+                    //   },
+                    // },
                   },
                 },
                 right: {
@@ -1084,7 +1125,7 @@ const Edit = observer((props: Props) => {
     if (params?.id) {
       const result1 = await DB.getDB().table(`${type}`).where('id').equals(params.id).toArray();
 
-      if (result1.length > 0) {
+      if (result1.length > 0 && MetadataModel.action === 'add') {
         message.error('标识已存在');
         setLoading(false);
         return;

+ 376 - 369
src/pages/link/Channel/new.tsx

@@ -1,383 +1,390 @@
 import { Button, Card, Divider, Dropdown, Input, Menu } from 'antd';
 import { useDomFullHeight } from '@/hooks';
-import './index.less'
+import './index.less';
 import SearchComponent from '@/components/SearchComponent';
 import ProTable, { ActionType, ProColumns } from '@jetlinks/pro-table';
 import PermissionButton from '@/components/PermissionButton';
-import { DeleteOutlined, EditOutlined, ExportOutlined, ImportOutlined, PlayCircleOutlined, PlusOutlined, StopOutlined } from '@ant-design/icons';
+import {
+  DeleteOutlined,
+  EditOutlined,
+  ExportOutlined,
+  ImportOutlined,
+  PlayCircleOutlined,
+  PlusOutlined,
+  StopOutlined,
+} from '@ant-design/icons';
 import { useRef, useState } from 'react';
 import { useIntl } from 'umi';
-import ChannelCard from './channelCard'
+import ChannelCard from './channelCard';
 
 const NewModbus = () => {
-    const { minHeight } = useDomFullHeight(`.modbus`);
-    const intl = useIntl();
-    const actionRef = useRef<ActionType>();
-    const { permission } = PermissionButton.usePermission('link/Channel/Modbus');
-    const [param, setParam] = useState({});
-    const [activeKey, setActiveKey] = useState<any>('')
-    const data = [
-        {
-            id: 1,
-            status: 'connect',
-            state: {
-                text: '正常',
-                value: 'enabled'
-            }
-        },
-        {
-            id: 2,
-            status: 'disconnect',
-            state: {
-                text: '禁用',
-                value: 'disabled'
-            }
-        },
-    ]
-
-    const columns: ProColumns<any>[] = [
-        {
-            title: '名称',
-            dataIndex: 'name',
-            ellipsis: true,
-            fixed: 'left',
-        },
-        {
-            title: '功能码',
-            dataIndex: 'host',
-        },
-        {
-            title: '从站ID',
-            dataIndex: 'port',
-            search: false,
-            valueType: 'digit',
-        },
-        {
-            title: '寄存器数量',
-            dataIndex: 'port',
-            search: false,
-            valueType: 'digit',
-        },
-        {
-            title: '地址',
-            dataIndex: 'port',
-            search: false,
-            valueType: 'digit',
-        },
-        {
-            title: '当前数据',
-            dataIndex: 'port',
-            search: false,
-            valueType: 'digit',
-        },
-        {
-            title: '采集状态',
-            dataIndex: 'port',
-            search: false,
-            valueType: 'digit',
-        },
-        {
-            title: '状态',
-            dataIndex: 'port',
-            search: false,
-            valueType: 'digit',
-        },
-        // {
-        //   title: '状态',
-        //   dataIndex: 'state',
-        //   renderText: (state) => (
-        //     <Badge text={state?.text} status={state?.value === 'disabled' ? 'error' : 'success'} />
-        //   ),
-        //   valueType: 'select',
-        //   valueEnum: {
-        //     disabled: {
-        //       text: intl.formatMessage({
-        //         id: 'pages.data.option.disabled',
-        //         defaultMessage: '禁用',
-        //       }),
-        //       status: 'disabled',
-        //     },
-        //     enabled: {
-        //       text: '正常',
-        //       status: 'enabled',
-        //     },
-        //   },
-        //   filterMultiple: false,
-        // },
-        // {
-        //   title: '操作',
-        //   valueType: 'option',
-        //   align: 'center',
-        //   width: 200,
-        //   fixed: 'right',
-        //   render: (text, record) => [
-        //     <PermissionButton
-        //       isPermission={permission.update}
-        //       key="edit"
-        //       onClick={() => {
-        //         setVisible(true);
-        //         setCurrent(record);
-        //       }}
-        //       type={'link'}
-        //       style={{ padding: 0 }}
-        //       tooltip={{
-        //         title: intl.formatMessage({
-        //           id: 'pages.data.option.edit',
-        //           defaultMessage: '编辑',
-        //         }),
-        //       }}
-        //     >
-        //       <EditOutlined />
-        //     </PermissionButton>,
-        //     <PermissionButton
-        //       type="link"
-        //       key={'action'}
-        //       style={{ padding: 0 }}
-        //       popConfirm={{
-        //         title: intl.formatMessage({
-        //           id: `pages.data.option.${
-        //             record.state.value !== 'disabled' ? 'disabled' : 'enabled'
-        //           }.tips`,
-        //           defaultMessage: '确认禁用?',
-        //         }),
-        //         onConfirm: async () => {
-        //           if (record.state.value === 'disabled') {
-        //             await service.edit({
-        //               ...record,
-        //               state: 'enabled',
-        //             });
-        //           } else {
-        //             await service.edit({
-        //               ...record,
-        //               state: 'disabled',
-        //             });
-        //           }
-        //           onlyMessage(
-        //             intl.formatMessage({
-        //               id: 'pages.data.option.success',
-        //               defaultMessage: '操作成功!',
-        //             }),
-        //           );
-        //           actionRef.current?.reload();
-        //         },
-        //       }}
-        //       isPermission={permission.action}
-        //       tooltip={{
-        //         title: intl.formatMessage({
-        //           id: `pages.data.option.${record.state.value !== 'disabled' ? 'disabled' : 'enabled'}`,
-        //           defaultMessage: record.state.value !== 'disabled' ? '禁用' : '启用',
-        //         }),
-        //       }}
-        //     >
-        //       {record.state.value !== 'disabled' ? <StopOutlined /> : <PlayCircleOutlined />}
-        //     </PermissionButton>,
-        //     <PermissionButton
-        //       isPermission={permission.view}
-        //       style={{ padding: 0 }}
-        //       key="link"
-        //       type="link"
-        //       tooltip={{
-        //         title: '数据点绑定',
-        //       }}
-        //       onClick={() => {
-        //         history.push(`${getMenuPathByCode('link/Channel/Modbus/Access')}?id=${record.id}`);
-        //       }}
-        //     >
-        //       <ControlOutlined />
-        //     </PermissionButton>,
-        //     <PermissionButton
-        //       isPermission={permission.delete}
-        //       style={{ padding: 0 }}
-        //       disabled={record.state.value === 'enabled'}
-        //       popConfirm={{
-        //         title: '确认删除',
-        //         disabled: record.state.value === 'enabled',
-        //         onConfirm: async () => {
-        //           const resp: any = await service.remove(record.id);
-        //           if (resp.status === 200) {
-        //             onlyMessage(
-        //               intl.formatMessage({
-        //                 id: 'pages.data.option.success',
-        //                 defaultMessage: '操作成功!',
-        //               }),
-        //             );
-        //             actionRef.current?.reload();
-        //           }
-        //         },
-        //       }}
-        //       key="delete"
-        //       type="link"
-        //     >
-        //       <DeleteOutlined />
-        //     </PermissionButton>,
-        //   ],
-        // },
-    ];
+  const { minHeight } = useDomFullHeight(`.modbus`);
+  const intl = useIntl();
+  const actionRef = useRef<ActionType>();
+  const { permission } = PermissionButton.usePermission('link/Channel/Modbus');
+  const [param, setParam] = useState({});
+  const [activeKey, setActiveKey] = useState<any>('');
+  const data = [
+    {
+      id: 1,
+      status: 'connect',
+      state: {
+        text: '正常',
+        value: 'enabled',
+      },
+    },
+    {
+      id: 2,
+      status: 'disconnect',
+      state: {
+        text: '禁用',
+        value: 'disabled',
+      },
+    },
+  ];
 
-    const menu = (
-        <Menu>
-            <Menu.Item key="1">
-                <PermissionButton
-                    isPermission={permission.export}
-                    icon={<ExportOutlined />}
-                    type="default"
-                    onClick={() => {
-                        // setExportVisible(true);
-                    }}
-                >
-                    批量导出设备
-                </PermissionButton>
-            </Menu.Item>
-            <Menu.Item key="2">
-                <PermissionButton
-                    isPermission={permission.import}
-                    icon={<ImportOutlined />}
-                    onClick={() => {
-                        // setImportVisible(true);
-                    }}
-                >
-                    批量导入设备
-                </PermissionButton>
-            </Menu.Item>
-        </Menu>
-    );
+  const columns: ProColumns<any>[] = [
+    {
+      title: '名称',
+      dataIndex: 'name',
+      ellipsis: true,
+      fixed: 'left',
+    },
+    {
+      title: '功能码',
+      dataIndex: 'host',
+    },
+    {
+      title: '从站ID',
+      dataIndex: 'port',
+      search: false,
+      valueType: 'digit',
+    },
+    {
+      title: '寄存器数量',
+      dataIndex: 'port',
+      search: false,
+      valueType: 'digit',
+    },
+    {
+      title: '地址',
+      dataIndex: 'port',
+      search: false,
+      valueType: 'digit',
+    },
+    {
+      title: '当前数据',
+      dataIndex: 'port',
+      search: false,
+      valueType: 'digit',
+    },
+    {
+      title: '采集状态',
+      dataIndex: 'port',
+      search: false,
+      valueType: 'digit',
+    },
+    {
+      title: '状态',
+      dataIndex: 'port',
+      search: false,
+      valueType: 'digit',
+    },
+    // {
+    //   title: '状态',
+    //   dataIndex: 'state',
+    //   renderText: (state) => (
+    //     <Badge text={state?.text} status={state?.value === 'disabled' ? 'error' : 'success'} />
+    //   ),
+    //   valueType: 'select',
+    //   valueEnum: {
+    //     disabled: {
+    //       text: intl.formatMessage({
+    //         id: 'pages.data.option.disabled',
+    //         defaultMessage: '禁用',
+    //       }),
+    //       status: 'disabled',
+    //     },
+    //     enabled: {
+    //       text: '正常',
+    //       status: 'enabled',
+    //     },
+    //   },
+    //   filterMultiple: false,
+    // },
+    // {
+    //   title: '操作',
+    //   valueType: 'option',
+    //   align: 'center',
+    //   width: 200,
+    //   fixed: 'right',
+    //   render: (text, record) => [
+    //     <PermissionButton
+    //       isPermission={permission.update}
+    //       key="edit"
+    //       onClick={() => {
+    //         setVisible(true);
+    //         setCurrent(record);
+    //       }}
+    //       type={'link'}
+    //       style={{ padding: 0 }}
+    //       tooltip={{
+    //         title: intl.formatMessage({
+    //           id: 'pages.data.option.edit',
+    //           defaultMessage: '编辑',
+    //         }),
+    //       }}
+    //     >
+    //       <EditOutlined />
+    //     </PermissionButton>,
+    //     <PermissionButton
+    //       type="link"
+    //       key={'action'}
+    //       style={{ padding: 0 }}
+    //       popConfirm={{
+    //         title: intl.formatMessage({
+    //           id: `pages.data.option.${
+    //             record.state.value !== 'disabled' ? 'disabled' : 'enabled'
+    //           }.tips`,
+    //           defaultMessage: '确认禁用?',
+    //         }),
+    //         onConfirm: async () => {
+    //           if (record.state.value === 'disabled') {
+    //             await service.edit({
+    //               ...record,
+    //               state: 'enabled',
+    //             });
+    //           } else {
+    //             await service.edit({
+    //               ...record,
+    //               state: 'disabled',
+    //             });
+    //           }
+    //           onlyMessage(
+    //             intl.formatMessage({
+    //               id: 'pages.data.option.success',
+    //               defaultMessage: '操作成功!',
+    //             }),
+    //           );
+    //           actionRef.current?.reload();
+    //         },
+    //       }}
+    //       isPermission={permission.action}
+    //       tooltip={{
+    //         title: intl.formatMessage({
+    //           id: `pages.data.option.${record.state.value !== 'disabled' ? 'disabled' : 'enabled'}`,
+    //           defaultMessage: record.state.value !== 'disabled' ? '禁用' : '启用',
+    //         }),
+    //       }}
+    //     >
+    //       {record.state.value !== 'disabled' ? <StopOutlined /> : <PlayCircleOutlined />}
+    //     </PermissionButton>,
+    //     <PermissionButton
+    //       isPermission={permission.view}
+    //       style={{ padding: 0 }}
+    //       key="link"
+    //       type="link"
+    //       tooltip={{
+    //         title: '数据点绑定',
+    //       }}
+    //       onClick={() => {
+    //         history.push(`${getMenuPathByCode('link/Channel/Modbus/Access')}?id=${record.id}`);
+    //       }}
+    //     >
+    //       <ControlOutlined />
+    //     </PermissionButton>,
+    //     <PermissionButton
+    //       isPermission={permission.delete}
+    //       style={{ padding: 0 }}
+    //       disabled={record.state.value === 'enabled'}
+    //       popConfirm={{
+    //         title: '确认删除',
+    //         disabled: record.state.value === 'enabled',
+    //         onConfirm: async () => {
+    //           const resp: any = await service.remove(record.id);
+    //           if (resp.status === 200) {
+    //             onlyMessage(
+    //               intl.formatMessage({
+    //                 id: 'pages.data.option.success',
+    //                 defaultMessage: '操作成功!',
+    //               }),
+    //             );
+    //             actionRef.current?.reload();
+    //           }
+    //         },
+    //       }}
+    //       key="delete"
+    //       type="link"
+    //     >
+    //       <DeleteOutlined />
+    //     </PermissionButton>,
+    //   ],
+    // },
+  ];
 
-    return (
-        <Card className='modbus' style={{ minHeight }}>
-            <div className='item'>
-                <div className='item-left'>
-                    <div style={{ width: 220 }}>
-                        <Input.Search
-                            placeholder="请输入名称"
-                            allowClear
-                            onSearch={(value) => {
-                                console.log(value)
-                            }}
-                        />
-                        <PermissionButton
-                            onClick={() => {
-                                // setDeviceVisiable(true);
-                            }}
-                            isPermission={permission.add}
-                            key="add"
-                            icon={<PlusOutlined />}
-                            type="default"
-                            style={{ width: '100%', marginTop: 16}}
-                        >
-                            新增
-                        </PermissionButton>
-                        <div className='item-left-list'>
-                            {
-                                data.map(item => <ChannelCard
-                                    active={activeKey === item.id}
-                                    data={item}
-                                    onClick={() => {
-                                        setActiveKey(item.id)
-                                    }}
-                                    actions={
-                                        <>
-                                            <PermissionButton
-                                                isPermission={permission.update}
-                                                key="edit"
-                                                onClick={() => {
-                                                    // setVisible(true);
-                                                    // setCurrent(record);
-                                                }}
-                                                type={'link'}
-                                                style={{ padding: 0 }}
-                                            >
-                                                <EditOutlined />编辑
-                                            </PermissionButton>
-                                            <Divider type="vertical" />
-                                            <PermissionButton
-                                                isPermission={permission.update}
-                                                key="enbale"
-                                                type={'link'}
-                                                style={{ padding: 0 }}
-                                                popConfirm={{
-                                                    title: intl.formatMessage({
-                                                        id: `pages.data.option.${item.state.value !== 'disabled' ? 'disabled' : 'enabled'
-                                                            }.tips`,
-                                                        defaultMessage: '确认禁用?',
-                                                    }),
-                                                    onConfirm: async () => {
+  const menu = (
+    <Menu>
+      <Menu.Item key="1">
+        <PermissionButton
+          isPermission={permission.export}
+          icon={<ExportOutlined />}
+          type="default"
+          onClick={() => {
+            // setExportVisible(true);
+          }}
+        >
+          批量导出设备
+        </PermissionButton>
+      </Menu.Item>
+      <Menu.Item key="2">
+        <PermissionButton
+          isPermission={permission.import}
+          icon={<ImportOutlined />}
+          onClick={() => {
+            // setImportVisible(true);
+          }}
+        >
+          批量导入设备
+        </PermissionButton>
+      </Menu.Item>
+    </Menu>
+  );
 
-                                                    },
-                                                }}
-                                            >
-                                                {item.state.value === 'enabled' ? <StopOutlined /> : <PlayCircleOutlined />}
-                                                {item.state.value === 'enabled' ? '禁用' : '启用'}
-                                            </PermissionButton>
-                                            <Divider type="vertical" />
-                                            <PermissionButton
-                                                isPermission={permission.delete}
-                                                style={{ padding: 0 }}
-                                                disabled={item.state.value === 'enabled'}
-                                                popConfirm={{
-                                                    title: '确认删除',
-                                                    disabled: item.state.value === 'enabled',
-                                                    onConfirm: async () => {
-
-                                                    },
-                                                }}
-                                                key="delete"
-                                                type="link"
-                                            >
-                                                <DeleteOutlined />
-                                            </PermissionButton>
-                                        </>} />)
-                            }
-
-                        </div>
-                    </div>
-                </div>
-                <div className='item-right'>
-                    <SearchComponent<any>
-                        field={columns}
-                        target="modbus"
-                        onSearch={(data) => {
-                            actionRef.current?.reset?.();
-                            setParam(data);
+  return (
+    <Card className="modbus" style={{ minHeight }}>
+      <div className="item">
+        <div className="item-left">
+          <div style={{ width: 220 }}>
+            <Input.Search
+              placeholder="请输入名称"
+              allowClear
+              onSearch={(value) => {
+                console.log(value);
+              }}
+            />
+            <PermissionButton
+              onClick={() => {
+                // setDeviceVisiable(true);
+              }}
+              isPermission={permission.add}
+              key="add"
+              icon={<PlusOutlined />}
+              type="default"
+              style={{ width: '100%', marginTop: 16 }}
+            >
+              新增
+            </PermissionButton>
+            <div className="item-left-list">
+              {data.map((item) => (
+                <ChannelCard
+                  active={activeKey === item.id}
+                  data={item}
+                  onClick={() => {
+                    setActiveKey(item.id);
+                  }}
+                  actions={
+                    <>
+                      <PermissionButton
+                        isPermission={permission.update}
+                        key="edit"
+                        onClick={() => {
+                          // setVisible(true);
+                          // setCurrent(record);
+                        }}
+                        type={'link'}
+                        style={{ padding: 0 }}
+                      >
+                        <EditOutlined />
+                        编辑
+                      </PermissionButton>
+                      <Divider type="vertical" />
+                      <PermissionButton
+                        isPermission={permission.update}
+                        key="enbale"
+                        type={'link'}
+                        style={{ padding: 0 }}
+                        popConfirm={{
+                          title: intl.formatMessage({
+                            id: `pages.data.option.${
+                              item.state.value !== 'disabled' ? 'disabled' : 'enabled'
+                            }.tips`,
+                            defaultMessage: '确认禁用?',
+                          }),
+                          onConfirm: async () => {},
+                        }}
+                      >
+                        {item.state.value === 'enabled' ? <StopOutlined /> : <PlayCircleOutlined />}
+                        {item.state.value === 'enabled' ? '禁用' : '启用'}
+                      </PermissionButton>
+                      <Divider type="vertical" />
+                      <PermissionButton
+                        isPermission={permission.delete}
+                        style={{ padding: 0 }}
+                        disabled={item.state.value === 'enabled'}
+                        popConfirm={{
+                          title: '确认删除',
+                          disabled: item.state.value === 'enabled',
+                          onConfirm: async () => {},
                         }}
-                    />
-                    <ProTable
-                        actionRef={actionRef}
-                        params={param}
-                        columns={columns}
-                        rowKey="id"
-                        scroll={{ x: '60%' }}
-                        search={false}
-                        headerTitle={
-                            <>
-                                <PermissionButton
-                                    onClick={() => {
-                                        // setMode('add');
-                                        // setVisible(true);
-                                        // setCurrent({});
-                                    }}
-                                    isPermission={permission.add}
-                                    key="add"
-                                    icon={<PlusOutlined />}
-                                    type="primary"
-                                    style={{marginRight: 10 }}
-                                >
-                                    {intl.formatMessage({
-                                        id: 'pages.data.option.add',
-                                        defaultMessage: '新增',
-                                    })}
-                                </PermissionButton>
-                                <Dropdown key={'more'} overlay={menu} placement="bottom" >
-                                    <Button>批量操作</Button>
-                                </Dropdown>
-                            </>
-                        }
-                    // request={async (params) =>
-                    //     service.query({ ...params, sorts: [{ name: 'createTime', order: 'desc' }] })
-                    // }
-                    />
-                </div>
+                        key="delete"
+                        type="link"
+                      >
+                        <DeleteOutlined />
+                      </PermissionButton>
+                    </>
+                  }
+                />
+              ))}
             </div>
-        </Card >
-    )
-}
-export default NewModbus;
+          </div>
+        </div>
+        <div className="item-right">
+          <SearchComponent<any>
+            field={columns}
+            target="modbus"
+            onSearch={(data1) => {
+              actionRef.current?.reset?.();
+              setParam(data1);
+            }}
+          />
+          <ProTable
+            actionRef={actionRef}
+            params={param}
+            columns={columns}
+            rowKey="id"
+            scroll={{ x: '60%' }}
+            search={false}
+            headerTitle={
+              <>
+                <PermissionButton
+                  onClick={() => {
+                    // setMode('add');
+                    // setVisible(true);
+                    // setCurrent({});
+                  }}
+                  isPermission={permission.add}
+                  key="add"
+                  icon={<PlusOutlined />}
+                  type="primary"
+                  style={{ marginRight: 10 }}
+                >
+                  {intl.formatMessage({
+                    id: 'pages.data.option.add',
+                    defaultMessage: '新增',
+                  })}
+                </PermissionButton>
+                <Dropdown key={'more'} overlay={menu} placement="bottom">
+                  <Button>批量操作</Button>
+                </Dropdown>
+              </>
+            }
+            // request={async (params) =>
+            //     service.query({ ...params, sorts: [{ name: 'createTime', order: 'desc' }] })
+            // }
+          />
+        </div>
+      </div>
+    </Card>
+  );
+};
+export default NewModbus;

+ 1 - 0
src/pages/link/Protocol/index.tsx

@@ -199,6 +199,7 @@ const Protocol = () => {
         actionRef={actionRef}
         scroll={{ x: 1366 }}
         params={searchParams}
+        columnEmptyText={''}
         options={{ fullScreen: true }}
         request={(params) =>
           service.query({

+ 1 - 0
src/pages/link/Type/index.tsx

@@ -254,6 +254,7 @@ const Network = () => {
         columns={columns}
         scroll={{ x: 1366 }}
         search={false}
+        columnEmptyText={''}
         headerTitle={
           <PermissionButton
             isPermission={networkPermission.add}

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

@@ -326,6 +326,7 @@ const Cascade = () => {
         actionRef={actionRef}
         params={searchParams}
         scroll={{ x: 1366 }}
+        columnEmptyText={''}
         options={{ fullScreen: true }}
         request={async (params = {}) => {
           return await lastValueFrom(

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

@@ -318,6 +318,7 @@ const Device = () => {
         actionRef={actionRef}
         options={{ fullScreen: true }}
         params={queryParam}
+        columnEmptyText={''}
         scroll={{ x: 1366 }}
         request={(params = {}) =>
           service.query({

+ 1 - 0
src/pages/notice/Config/index.tsx

@@ -263,6 +263,7 @@ const Config = observer(() => {
         actionRef={actionRef}
         search={false}
         params={param}
+        columnEmptyText={''}
         columns={columns}
         scroll={{ x: 1366 }}
         headerTitle={

+ 1 - 0
src/pages/notice/Template/index.tsx

@@ -229,6 +229,7 @@ const Template = observer(() => {
         search={false}
         params={param}
         columns={columns}
+        columnEmptyText={''}
         headerTitle={
           <Space>
             <PermissionButton

+ 77 - 175
src/pages/rule-engine/Alarm/Config/index.tsx

@@ -1,23 +1,29 @@
 import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, Col, Divider, Image, Row, Table, Tooltip } from 'antd';
+import { Badge, Button, Card, Col, Descriptions, Divider, Image, Row, Table, Tooltip } from 'antd';
 import TitleComponent from '@/components/TitleComponent';
 import { createSchemaField } from '@formily/react';
 import { ArrayItems, Form, FormButtonGroup, FormGrid, FormItem, Input } from '@formily/antd';
 import type { ISchema } from '@formily/json-schema';
-import { useMemo, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
 import { createForm, onFormInit } from '@formily/core';
 import FLevelInput from '@/components/FLevelInput';
-import type { IOConfigItem } from '@/pages/rule-engine/Alarm/Config/typing';
 import Service from '@/pages/rule-engine/Alarm/Config/service';
 import styles from './index.less';
 import ReactMarkdown from 'react-markdown';
-import { QuestionCircleOutlined } from '@ant-design/icons';
+import { EditOutlined, QuestionCircleOutlined } from '@ant-design/icons';
 import { onlyMessage } from '@/utils/util';
+import OutputSave from './Save/output';
+import InputSave from './Save/input';
 
 export const service = new Service('alarm/config');
 const ioImg = require('/public/images/alarm/io.png');
 const Config = () => {
   const [tab, setTab] = useState<'io' | 'config' | string>('config');
+  const [inputVisible, setInputVisible] = useState<boolean>(false);
+  const [outputVisible, setOutputVisible] = useState<boolean>(false);
+  const [input, setInput] = useState<any>({});
+  const [output, setOutput] = useState<any>({});
+
   const outputData = [
     {
       key: 'alarmName',
@@ -183,39 +189,6 @@ const Config = () => {
     [],
   );
 
-  const inputForm = useMemo(
-    () =>
-      createForm({
-        validateFirst: true,
-        effects() {
-          onFormInit(async (f) => {
-            const resp = await service.getDataExchange('consume');
-            if (resp.status === 200) {
-              f.setInitialValues(resp.result?.config.config);
-              f.setValuesIn('id', resp.result?.id);
-            }
-          });
-        },
-      }),
-    [],
-  );
-  const outputForm = useMemo(
-    () =>
-      createForm({
-        validateFirst: true,
-        effects() {
-          onFormInit(async (f) => {
-            const resp = await service.getDataExchange('producer');
-            if (resp.status === 200) {
-              f.setInitialValues(resp.result?.config.config);
-              f.setValuesIn('id', resp.result?.id);
-            }
-          });
-        },
-      }),
-    [],
-  );
-
   const levelSchema: ISchema = {
     type: 'object',
     properties: {
@@ -266,131 +239,6 @@ const Config = () => {
     },
   };
 
-  const outputSchema: ISchema = {
-    type: 'object',
-    properties: {
-      id: {
-        'x-component': 'Input',
-        'x-hidden': true,
-      },
-      address: {
-        title: 'kafka地址',
-        type: 'string',
-        required: true,
-        'x-decorator': 'FormItem',
-        'x-component': 'Input',
-        'x-component-props': {
-          placeholder: '请输入kafka地址',
-        },
-      },
-      topic: {
-        title: 'topic',
-        type: 'string',
-        required: true,
-        'x-decorator': 'FormItem',
-        'x-component': 'Input',
-        'x-component-props': {
-          placeholder: '请输入topic',
-        },
-      },
-      // layout2: {
-      //   type: 'void',
-      //   'x-decorator': 'FormGrid',
-      //   'x-decorator-props': {
-      //     maxColumns: 2,
-      //     minColumns: 2,
-      //     columnGap: 24,
-      //   },
-      //   properties: {
-      //     username: {
-      //       title: '用户名',
-      //       type: 'string',
-      //       // required: true,
-      //       'x-decorator': 'FormItem',
-      //       'x-component': 'Input',
-      //       'x-component-props': {
-      //         placeholder: '请输入用户名',
-      //       },
-      //       'x-decorator-props': {
-      //         gridSpan: 1,
-      //       },
-      //     },
-      //     password: {
-      //       title: '密码',
-      //       type: 'string',
-      //       // required: true,
-      //       'x-decorator': 'FormItem',
-      //       'x-component': 'Input',
-      //       'x-decorator-props': {
-      //         gridSpan: 1,
-      //       },
-      //       'x-component-props': {
-      //         placeholder: '请输入密码',
-      //       },
-      //     },
-      //   },
-      // },
-    },
-  };
-
-  const inputSchema: ISchema = {
-    type: 'object',
-    properties: {
-      id: {
-        'x-component': 'Input',
-        'x-hidden': true,
-      },
-      address: {
-        title: 'kafka地址',
-        type: 'string',
-        required: true,
-        'x-decorator': 'FormItem',
-        'x-component': 'Input',
-        'x-component-props': {
-          placeholder: '请输入kafka地址',
-        },
-      },
-      topic: {
-        title: 'topic',
-        type: 'string',
-        required: true,
-        'x-decorator': 'FormItem',
-        'x-component': 'Input',
-        'x-component-props': {
-          placeholder: '请输入topic',
-        },
-      },
-    },
-  };
-
-  const handleSaveIO = async () => {
-    outputForm.validate();
-    inputForm.validate();
-    const inputConfig: IOConfigItem = await inputForm.submit();
-    const outputConfig: IOConfigItem = await outputForm.submit();
-    const inputResp = await service.saveOutputData({
-      config: {
-        config: outputConfig,
-      },
-      id: outputConfig.id,
-      sourceType: 'kafka',
-      exchangeType: 'producer',
-    });
-    const outputResp = await service.saveOutputData({
-      config: {
-        sourceType: 'kafka',
-        config: inputConfig,
-      },
-      id: inputConfig.id,
-      sourceType: 'kafka',
-      exchangeType: 'consume',
-    });
-
-    if (inputResp.status === 200 && outputResp.status === 200) {
-      onlyMessage('操作成功');
-    }
-  };
-
   const handleSaveLevel = async () => {
     const values: { level: string[] } = await levelForm.submit();
     const _level = values?.level.map((l: string, i: number) => ({ level: i + 1, title: l }));
@@ -400,6 +248,19 @@ const Config = () => {
     }
   };
 
+  useEffect(() => {
+    service.getDataExchange('consume').then((resp) => {
+      if (resp.status === 200) {
+        setInput(resp.result);
+      }
+    });
+    service.getDataExchange('producer').then((resp) => {
+      if (resp.status === 200) {
+        setOutput(resp.result);
+      }
+    });
+  }, []);
+
   const outputText = `
   ~~~json
   {
@@ -469,12 +330,29 @@ const Config = () => {
                   <Tooltip title={'将告警数据输出到其他第三方系统'}>
                     <QuestionCircleOutlined style={{ marginLeft: 5 }} />
                   </Tooltip>
+                  <a
+                    style={{ marginLeft: 10 }}
+                    onClick={() => {
+                      setOutputVisible(true);
+                    }}
+                  >
+                    <EditOutlined />
+                  </a>
                 </span>
               }
             />
-            <Form form={outputForm} layout="vertical">
-              <SchemaField schema={outputSchema} />
-            </Form>
+            <Descriptions bordered column={2}>
+              <Descriptions.Item label="kafka地址">
+                {output?.config?.config?.kafka || ''}
+              </Descriptions.Item>
+              <Descriptions.Item label="topic">
+                {output?.config?.config?.topic || ''}
+              </Descriptions.Item>
+              <Descriptions.Item label="状态" span={2}>
+                <Badge status={output?.state?.value === 'enabled' ? 'success' : 'error'} />
+                {output?.state?.text || ''}
+              </Descriptions.Item>
+            </Descriptions>
             <Divider />
             <TitleComponent
               data={
@@ -483,19 +361,29 @@ const Config = () => {
                   <Tooltip title={'接收第三方系统处理的告警结果'}>
                     <QuestionCircleOutlined style={{ marginLeft: 5 }} />
                   </Tooltip>
+                  <a
+                    style={{ marginLeft: 10 }}
+                    onClick={() => {
+                      setInputVisible(true);
+                    }}
+                  >
+                    <EditOutlined />
+                  </a>
                 </span>
               }
             />
-            <Form form={inputForm} layout="vertical">
-              <SchemaField schema={inputSchema} />
-              <FormButtonGroup.Sticky>
-                <FormButtonGroup.FormItem>
-                  <Button type="primary" onClick={handleSaveIO}>
-                    保存
-                  </Button>
-                </FormButtonGroup.FormItem>
-              </FormButtonGroup.Sticky>
-            </Form>
+            <Descriptions bordered column={2}>
+              <Descriptions.Item label="kafka地址">
+                {input?.config?.config?.kafka || ''}
+              </Descriptions.Item>
+              <Descriptions.Item label="topic">
+                {input?.config?.config?.topic || ''}
+              </Descriptions.Item>
+              <Descriptions.Item label="状态" span={2}>
+                <Badge status={input?.state?.value === 'enabled' ? 'success' : 'error'} />
+                {input?.state?.text || ''}
+              </Descriptions.Item>
+            </Descriptions>
           </Card>
         </div>
       </Col>
@@ -541,6 +429,20 @@ const Config = () => {
   return (
     <PageContainer onTabChange={setTab} tabActiveKey={tab} tabList={list}>
       {list.find((k) => k.key === tab)?.component}
+      {inputVisible && (
+        <InputSave
+          close={() => {
+            setInputVisible(false);
+          }}
+        />
+      )}
+      {outputVisible && (
+        <OutputSave
+          close={() => {
+            setOutputVisible(false);
+          }}
+        />
+      )}
     </PageContainer>
   );
 };

+ 1 - 0
src/pages/rule-engine/Instance/index.tsx

@@ -278,6 +278,7 @@ const Instance = () => {
         actionRef={actionRef}
         params={searchParams}
         scroll={{ x: 1366 }}
+        columnEmptyText={''}
         options={{ fullScreen: true }}
         request={(params) =>
           service.query({

+ 1 - 0
src/pages/rule-engine/Scene/index.tsx

@@ -263,6 +263,7 @@ const Scene = () => {
         actionRef={actionRef}
         scroll={{ x: 1366 }}
         params={searchParams}
+        columnEmptyText={''}
         options={{ fullScreen: true }}
         request={(params) =>
           service.query({

+ 84 - 86
src/pages/system/Basis/init.tsx

@@ -1,92 +1,90 @@
 import { UploadImage } from '@/components';
-import { Card, Col, Form, Input, Row, Select, } from 'antd';
-import { useEffect} from 'react';
+import { Card, Col, Form, Input, Row, Select } from 'antd';
+import { useEffect } from 'react';
 
-interface Props{
-    getData:Function
+interface Props {
+  getData: Function;
 }
 
-const Init = (props:Props) => {
-    const [form] = Form.useForm();
+const Init = (props: Props) => {
+  const [form] = Form.useForm();
 
-    useEffect(()=>{
-        props.getData(form)
-    },[])
+  useEffect(() => {
+    props.getData(form);
+  }, []);
 
-    return (
-        <Card>
-            <Form layout="vertical" form={form} >
-                <Row gutter={[24, 24]}>
-                    <Col span={10}>
-                        <Form.Item
-                            label="系统名称"
-                            name="title"
-                        >
-                            <Input />
-                        </Form.Item>
-                        <Form.Item
-                            label="主题色"
-                            name="headerTheme"
-                            initialValue="light"
-                            rules={[{ required: true, message: '请选择主题色' }]}
-                        >
-                            <Select>
-                                <Select.Option value="light">白色</Select.Option>
-                                <Select.Option value="dark">黑色</Select.Option>
-                            </Select>
-                        </Form.Item>
-                        <Form.Item
-                            label="高德API Key"
-                            name="apikey"
-                            tooltip="配置后平台可调用高德地图GIS服务"
-                        >
-                            <Input />
-                        </Form.Item>
-                        <Row gutter={[24, 24]}>
-                            <Col>
-                                <Form.Item name={'logo'} label="系统logo" extra={
-                                    <>
-                                        <div>推荐尺寸200*200</div>
-                                        <div>支持jpg,png</div>
-                                    </>
-                                }>
-                                    <UploadImage />
-                                </Form.Item>
-                            </Col>
-                            <Col>
-                                <Form.Item
-                                    name={'ico'}
-                                    label="浏览器页签"
-                                    tooltip='浏览器tab页中显示的图片元素'
-                                    extra={
-                                        <>
-                                            <div>推荐尺寸64*64</div>
-                                            <div>支持ico格式</div>
-                                        </>
-                                    }
-                                >
-                                    <UploadImage size={1} types={['image/x-icon']} backgroundSize={'inherit'} />
-                                </Form.Item>
-                            </Col>
-                        </Row>
-                    </Col>
-                    <Col span={14}>
-                        <Form.Item
-                            name={'backgroud'}
-                            label="登录背景图"
-                            extra={
-                                <>
-                                    <div>支持4M以内的图片:支持jpg、png</div>
-                                    <div>建议尺寸1400x1080</div>
-                                </>
-                            }
-                            rules={[{ required: true, message: '请上传背景图' }]}>
-                            <UploadImage size={4} style={{ width: 570, height: 415 }} />
-                        </Form.Item>
-                    </Col>
-                </Row>
-            </Form>
-        </Card>
-    )
-}
-export default Init
+  return (
+    <Card>
+      <Form layout="vertical" form={form}>
+        <Row gutter={[24, 24]}>
+          <Col span={10}>
+            <Form.Item label="系统名称" name="title">
+              <Input />
+            </Form.Item>
+            <Form.Item
+              label="主题色"
+              name="headerTheme"
+              initialValue="light"
+              rules={[{ required: true, message: '请选择主题色' }]}
+            >
+              <Select>
+                <Select.Option value="light">白色</Select.Option>
+                <Select.Option value="dark">黑色</Select.Option>
+              </Select>
+            </Form.Item>
+            <Form.Item label="高德API Key" name="apikey" tooltip="配置后平台可调用高德地图GIS服务">
+              <Input />
+            </Form.Item>
+            <Row gutter={[24, 24]}>
+              <Col>
+                <Form.Item
+                  name={'logo'}
+                  label="系统logo"
+                  extra={
+                    <>
+                      <div>推荐尺寸200*200</div>
+                      <div>支持jpg,png</div>
+                    </>
+                  }
+                >
+                  <UploadImage />
+                </Form.Item>
+              </Col>
+              <Col>
+                <Form.Item
+                  name={'ico'}
+                  label="浏览器页签"
+                  tooltip="浏览器tab页中显示的图片元素"
+                  extra={
+                    <>
+                      <div>推荐尺寸64*64</div>
+                      <div>支持ico格式</div>
+                    </>
+                  }
+                >
+                  <UploadImage size={1} types={['image/x-icon']} backgroundSize={'inherit'} />
+                </Form.Item>
+              </Col>
+            </Row>
+          </Col>
+          <Col span={14}>
+            <Form.Item
+              name={'backgroud'}
+              label="登录背景图"
+              extra={
+                <>
+                  <div>支持4M以内的图片:支持jpg、png</div>
+                  <div>建议尺寸1400x1080</div>
+                </>
+              }
+              rules={[{ required: true, message: '请上传背景图' }]}
+            >
+              <UploadImage size={4} style={{ width: 570, height: 415 }} />
+            </Form.Item>
+          </Col>
+        </Row>
+      </Form>
+    </Card>
+  );
+};
+export default Init;

+ 1 - 0
src/pages/system/Department/Assets/deivce/bind.tsx

@@ -213,6 +213,7 @@ const Bind = observer((props: Props) => {
           rowKey="id"
           search={false}
           gridColumn={2}
+          columnEmptyText={''}
           cardRender={(record) => (
             <ExtraDeviceCard showBindBtn={false} showTool={false} {...record} cardType={'bind'} />
           )}

+ 1 - 0
src/pages/system/Department/Assets/deivce/index.tsx

@@ -328,6 +328,7 @@ export default observer((props: { parentId: string }) => {
         rowKey="id"
         search={false}
         params={searchParam}
+        columnEmptyText={''}
         gridColumn={2}
         height={'none'}
         scroll={{ x: 1366 }}

+ 1 - 0
src/pages/system/Department/Assets/product/bind.tsx

@@ -133,6 +133,7 @@ const Bind = observer((props: Props) => {
             rowKey="id"
             search={false}
             gridColumn={2}
+            columnEmptyText={''}
             rowSelection={{
               selectedRowKeys: Models.bindKeys,
               onChange: (selectedRowKeys, selectedRows) => {

+ 1 - 0
src/pages/system/Department/Assets/product/index.tsx

@@ -277,6 +277,7 @@ export default observer((props: { parentId: string }) => {
         search={false}
         gridColumn={2}
         params={searchParam}
+        columnEmptyText={''}
         height={'none'}
         request={async (params) => {
           params.sorts = [{ name: 'createTime', order: 'desc' }];