Explorar el Código

fix(merge): merge lind

lind hace 3 años
padre
commit
1bd9e5865b
Se han modificado 33 ficheros con 178 adiciones y 172 borrados
  1. 1 1
      src/components/BaseCrud/index.tsx
  2. 2 2
      src/components/PermissionButton/index.tsx
  3. 1 1
      src/components/ProTableCard/CardItems/AccessConfig/index.tsx
  4. 3 3
      src/components/ProTableCard/CardItems/protocol.tsx
  5. 62 57
      src/components/SearchComponent/index.tsx
  6. 2 2
      src/components/SearchComponent/readme.md
  7. 2 2
      src/hooks/index.ts
  8. 1 1
      src/hooks/route/useHistory.tsx
  9. 9 9
      src/pages/device/Instance/Detail/Config/index.tsx
  10. 7 7
      src/pages/device/Instance/Detail/Diagnose/index.tsx
  11. 3 3
      src/pages/device/Instance/Detail/Info/index.tsx
  12. 3 3
      src/pages/device/Instance/Detail/MetadataMap/EditableTable/index.tsx
  13. 1 1
      src/pages/device/Instance/Detail/index.tsx
  14. 3 3
      src/pages/device/Instance/index.tsx
  15. 7 7
      src/pages/device/Product/Detail/Access/index.tsx
  16. 2 2
      src/pages/device/Product/Detail/BaseInfo/index.tsx
  17. 3 3
      src/pages/device/Product/Detail/index.tsx
  18. 9 8
      src/pages/device/Product/index.tsx
  19. 7 7
      src/pages/device/components/Metadata/Base/index.tsx
  20. 7 7
      src/pages/device/components/Metadata/index.tsx
  21. 2 2
      src/pages/link/AccessConfig/Detail/Access/index.tsx
  22. 16 16
      src/pages/link/Protocol/index.tsx
  23. 3 3
      src/pages/link/Protocol/save/index.tsx
  24. 1 1
      src/pages/media/Device/Channel/index.tsx
  25. 11 11
      src/pages/media/Device/Save/ProviderSelect.tsx
  26. 2 2
      src/pages/media/Device/Save/SaveProduct.tsx
  27. 1 1
      src/pages/media/Device/Save/index.tsx
  28. 1 1
      src/pages/media/Device/index.tsx
  29. 1 1
      src/pages/system/Menu/Detail/buttons.tsx
  30. 1 1
      src/pages/system/Menu/Detail/edit.tsx
  31. 1 1
      src/pages/system/Menu/index.tsx
  32. 2 2
      src/pages/system/Permission/index.tsx
  33. 1 1
      src/pages/system/Role/index.tsx

+ 1 - 1
src/components/BaseCrud/index.tsx

@@ -126,7 +126,7 @@ const BaseCrud = <T extends Record<string, any>>(props: Props<T>) => {
               disabled={props.disableAdd}
               onClick={CurdModel.add}
               key="button"
-              icon={<PlusOutlined/>}
+              icon={<PlusOutlined />}
               type="primary"
             >
               {intl.formatMessage({

+ 2 - 2
src/components/PermissionButton/index.tsx

@@ -33,7 +33,7 @@ const PermissionButton = (props: PermissionButtonProps) => {
   const defaultButton = isButton ? (
     props.children
   ) : (
-    <Button {...buttonProps} disabled={_isPermission}/>
+    <Button {...buttonProps} disabled={_isPermission} />
   );
 
   const isTooltip = tooltip ? <Tooltip {...tooltip}>{defaultButton}</Tooltip> : null;
@@ -45,7 +45,7 @@ const PermissionButton = (props: PermissionButtonProps) => {
         defaultMessage: '没有权限',
       })}
     >
-      {<Button {...buttonProps} disabled={_isPermission}/>}
+      {<Button {...buttonProps} disabled={_isPermission} />}
     </Tooltip>
   );
 

+ 1 - 1
src/components/ProTableCard/CardItems/AccessConfig/index.tsx

@@ -52,7 +52,7 @@ export default (props: AccessConfigCardProps) => {
                 {props.channelInfo?.addresses.slice(0, 2).map((i: any, index: number) => (
                   <div className="subItem" key={i.address + `_address${index}`}>
                     <Tooltip title={i.address}>
-                      <Badge color={i.health === -1 ? 'red' : 'green'}/>
+                      <Badge color={i.health === -1 ? 'red' : 'green'} />
                       {i.address}
                     </Tooltip>
                   </div>

+ 3 - 3
src/components/ProTableCard/CardItems/protocol.tsx

@@ -28,7 +28,7 @@ export default (props: ProcotolCardProps) => {
     >
       <div className={'pro-table-card-item'}>
         <div className={'card-item-avatar'}>
-          <img width={88} height={88} src={defaultImage} alt={''}/>
+          <img width={88} height={88} src={defaultImage} alt={''} />
         </div>
         <div className={'card-item-body'}>
           <div className={'card-item-header'}>
@@ -37,7 +37,7 @@ export default (props: ProcotolCardProps) => {
           <Row gutter={24}>
             <Col span={12}>
               <div>
-                <div style={{color: 'rgba(0, 0, 0, 0.75)', fontSize: 12}}>ID</div>
+                <div style={{ color: 'rgba(0, 0, 0, 0.75)', fontSize: 12 }}>ID</div>
                 <div
                   style={{
                     width: '100%',
@@ -52,7 +52,7 @@ export default (props: ProcotolCardProps) => {
             </Col>
             <Col span={12}>
               <div>
-                <div style={{color: 'rgba(0, 0, 0, 0.75)', fontSize: 12}}>类型</div>
+                <div style={{ color: 'rgba(0, 0, 0, 0.75)', fontSize: 12 }}>类型</div>
                 <div>{props.type}</div>
               </div>
             </Col>

+ 62 - 57
src/components/SearchComponent/index.tsx

@@ -17,7 +17,7 @@ import type {Field, FieldDataSource} from '@formily/core';
 import {createForm, onFieldReact} from '@formily/core';
 import GroupNameControl from '@/components/SearchComponent/GroupNameControl';
 import {DeleteOutlined, DoubleRightOutlined, ReloadOutlined, SaveOutlined, SearchOutlined,} from '@ant-design/icons';
-import {Button, Card, Dropdown, Empty, Menu, message, Popover, Typography,} from 'antd';
+import {Button, Card, Dropdown, Empty, Menu, message, Popover, Typography} from 'antd';
 import {useEffect, useMemo, useRef, useState} from 'react';
 import type {ProColumns} from '@jetlinks/pro-table';
 import type {EnumData} from '@/utils/typings';
@@ -29,8 +29,8 @@ import classnames from 'classnames';
 import {randomString} from '@/utils/util';
 
 const ui2Server = (source: SearchTermsUI): SearchTermsServer => [
-  {terms: source.terms1},
-  {terms: source.terms2, type: source.type},
+  { terms: source.terms1 },
+  { terms: source.terms2, type: source.type },
 ];
 
 const server2Ui = (source: SearchTermsServer): SearchTermsUI => ({
@@ -59,20 +59,20 @@ interface Props<T> {
   defaultParam?: SearchTermsServer | Term[];
   // pattern?: 'simple' | 'advance';
   enableSave?: boolean;
-  initParam?: SearchTermsServer
+  initParam?: SearchTermsServer;
 }
 
 const termType = [
-  {label: '=', value: 'eq'},
-  {label: '!=', value: 'not'},
-  {label: '包含', value: 'like'},
-  {label: '不包含', value: 'nlike'},
-  {label: '>', value: 'gt'},
-  {label: '>=', value: 'gte'},
-  {label: '<', value: 'lt'},
-  {label: '<=', value: 'lte'},
-  {label: '属于', value: 'in'},
-  {label: '不属于', value: 'nin'},
+  { label: '=', value: 'eq' },
+  { label: '!=', value: 'not' },
+  { label: '包含', value: 'like' },
+  { label: '不包含', value: 'nlike' },
+  { label: '>', value: 'gt' },
+  { label: '>=', value: 'gte' },
+  { label: '<', value: 'lt' },
+  { label: '<=', value: 'lte' },
+  { label: '属于', value: 'in' },
+  { label: '不属于', value: 'nin' },
 ];
 
 const service = new Service();
@@ -117,7 +117,7 @@ const sortField = (field: ProColumns[]) => {
 };
 
 const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
-  const {field, target, onSearch, defaultParam, enableSave = true, initParam} = props;
+  const { field, target, onSearch, defaultParam, enableSave = true, initParam } = props;
 
   /**
    * 过滤不参与搜索的数据
@@ -130,14 +130,15 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
 
   // 处理后的搜索条件
   const processedField = sortField(filterSearchTerm());
-  const defaultTerms = (index: number) => ({
-    termType: 'like',
-    column: (processedField[index]?.dataIndex as string) || null,
-    type: 'or'
-  } as Partial<Term>);
+  const defaultTerms = (index: number) =>
+    ({
+      termType: 'like',
+      column: (processedField[index]?.dataIndex as string) || null,
+      type: 'or',
+    } as Partial<Term>);
   const intl = useIntl();
   const [expand, setExpand] = useState<boolean>(true);
-  const initForm = server2Ui(initParam || [{terms: [defaultTerms(0)]}]);
+  const initForm = server2Ui(initParam || [{ terms: [defaultTerms(0)] }]);
   const [aliasVisible, setAliasVisible] = useState<boolean>(false);
 
   const [initParams, setInitParams] = useState<SearchTermsUI>(initForm);
@@ -188,7 +189,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
             } else if (_field?.valueType === 'dateTime') {
               f.setFieldState(typeFiled.query('.value'), async (state) => {
                 state.componentType = 'DatePicker';
-                state.componentProps = {showTime: true};
+                state.componentProps = { showTime: true };
               });
               f.setFieldState(typeFiled.query('.termType'), async (state) => {
                 state.value = 'gt';
@@ -220,7 +221,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
     },
     'x-component': 'ArrayItems',
     type: 'array',
-    'x-value': new Array(expand ? 1 : 3).fill({termType: 'like'}),
+    'x-value': new Array(expand ? 1 : 3).fill({ termType: 'like' }),
     items: {
       type: 'object',
       'x-component': 'FormGrid',
@@ -253,7 +254,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
           'x-component-props': {
             placeholder: '请选择',
           },
-          enum: filterSearchTerm().map((i) => ({label: i.title, value: i.dataIndex} as EnumData)),
+          enum: filterSearchTerm().map((i) => ({ label: i.title, value: i.dataIndex } as EnumData)),
         },
         termType: {
           type: 'enum',
@@ -302,8 +303,8 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
             },
             default: 'and',
             enum: [
-              {label: '并且', value: 'and'},
-              {label: '或者', value: 'or'},
+              { label: '并且', value: 'and' },
+              { label: '或者', value: 'or' },
             ],
           },
           terms2: createGroup('第二组'),
@@ -326,7 +327,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
         uiParam?.[0]?.terms?.[0] || _terms1 || defaultTerms(0),
         uiParam?.[0]?.terms?.[1] || defaultTerms(1),
         uiParam?.[0]?.terms?.[2] || defaultTerms(2),
-      ]
+      ];
       value.terms2 = [
         uiParam?.[1]?.terms?.[0] || defaultTerms(3),
         uiParam?.[1]?.terms?.[1] || defaultTerms(4),
@@ -337,7 +338,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
       value.terms2 = [];
     }
     setInitParams(value);
-  }
+  };
   const handleExpand = () => {
     handleForm();
     setExpand(!expand);
@@ -354,7 +355,6 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
     if (initParam && initParam[0].terms && initParam[0].terms.length > 1) {
       handleExpand();
     }
-
   }, []);
   const simpleSchema: ISchema = {
     type: 'object',
@@ -364,10 +364,13 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
   };
   const handleHistory = (item: SearchHistory) => {
     const log = JSON.parse(item.content) as SearchTermsUI;
-    setLogVisible(false)
+    setLogVisible(false);
     uiParamRef.current = ui2Server(log);
-    const _expand = (log.terms1 && log.terms1?.length > 1) || (log.terms2 && log.terms2?.length > 1);
-    _expand && setExpand(false)
+    const _expand =
+      (log.terms1 && log.terms1?.length > 1) || (log.terms2 && log.terms2?.length > 1);
+    if (_expand) {
+      setExpand(false);
+    }
     handleForm(_expand);
   };
 
@@ -377,16 +380,18 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
         history.map((item: SearchHistory) => (
           <Menu.Item onClick={() => handleHistory(item)} key={item.id || randomString(9)}>
             <div className={styles.list}>
-              <Typography.Text ellipsis={{tooltip: item.name}}>{item.name}</Typography.Text>
-              <DeleteOutlined onClick={async (e) => {
-                e?.stopPropagation();
-                const response = await service.history.remove(`${target}-search`, item.key);
-                if (response.status === 200) {
-                  message.success('操作成功');
-                  const temp = history.filter((h: any) => h.key !== item.key);
-                  setHistory(temp);
-                }
-              }}/>
+              <Typography.Text ellipsis={{ tooltip: item.name }}>{item.name}</Typography.Text>
+              <DeleteOutlined
+                onClick={async (e) => {
+                  e?.stopPropagation();
+                  const response = await service.history.remove(`${target}-search`, item.key);
+                  if (response.status === 200) {
+                    message.success('操作成功');
+                    const temp = history.filter((h: any) => h.key !== item.key);
+                    setHistory(temp);
+                  }
+                }}
+              />
             </div>
           </Menu.Item>
         ))
@@ -400,7 +405,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
               width: '148px',
             }}
           >
-            <Empty/>
+            <Empty />
           </div>
         </Menu.Item>
       )}
@@ -414,7 +419,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
       if ('terms' in defaultParam[0]) {
         _value = _value.concat(defaultParam as SearchTermsServer);
       } else if ('value' in defaultParam[0]) {
-        _value = _value.concat([{terms: defaultParam}]);
+        _value = _value.concat([{ terms: defaultParam }]);
       }
     }
 
@@ -440,7 +445,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
     _terms.terms1 = filterTerms(_terms.terms1);
     _terms.terms2 = filterTerms(_terms.terms2);
 
-    onSearch({terms: formatValue(_terms)});
+    onSearch({ terms: formatValue(_terms) });
   };
 
   useEffect(() => {
@@ -467,8 +472,8 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
   const resetForm = async () => {
     const value = form.values;
     if (!expand) {
-      value.terms1 = [defaultTerms(0), defaultTerms(1), defaultTerms(2)]
-      value.terms2 = [defaultTerms(3), defaultTerms(4), defaultTerms(5)]
+      value.terms1 = [defaultTerms(0), defaultTerms(1), defaultTerms(2)];
+      value.terms2 = [defaultTerms(3), defaultTerms(4), defaultTerms(5)];
     } else {
       value.terms1 = [defaultTerms(0)];
       value.terms2 = [];
@@ -479,13 +484,13 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
 
   const SearchBtn = {
     simple: (
-      <Button icon={<SearchOutlined/>} onClick={handleSearch} type="primary">
+      <Button icon={<SearchOutlined />} onClick={handleSearch} type="primary">
         搜索
       </Button>
     ),
     advance: (
       <Dropdown.Button
-        icon={<SearchOutlined/>}
+        icon={<SearchOutlined />}
         placement={'bottomLeft'}
         destroyPopupOnHide
         onClick={handleSearch}
@@ -507,7 +512,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
   const SaveBtn = (
     <Popover
       content={
-        <Form style={{width: '217px'}} form={historyForm}>
+        <Form style={{ width: '217px' }} form={historyForm}>
           <SchemaField
             schema={{
               type: 'object',
@@ -522,8 +527,8 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
                     },
                     {
                       required: true,
-                      message: '请输入名称'
-                    }
+                      message: '请输入名称',
+                    },
                   ],
                 },
               },
@@ -539,7 +544,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
       title="搜索名称"
       trigger="click"
     >
-      <Button icon={<SaveOutlined/>} block>
+      <Button icon={<SaveOutlined />} block>
         {intl.formatMessage({
           id: 'pages.data.option.save',
           defaultMessage: '保存',
@@ -552,19 +557,19 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
     <Card bordered={false} className={styles.container}>
       <Form form={form} className={styles.form} labelCol={4} wrapperCol={18}>
         <div className={expand && styles.simple}>
-          <SchemaField schema={expand ? simpleSchema : schema}/>
-          <div className={styles.action} style={{marginTop: expand ? 0 : -12}}>
+          <SchemaField schema={expand ? simpleSchema : schema} />
+          <div className={styles.action} style={{ marginTop: expand ? 0 : -12 }}>
             <Space>
               {enableSave ? SearchBtn.advance : SearchBtn.simple}
               {enableSave && SaveBtn}
-              <Button icon={<ReloadOutlined/>} block onClick={resetForm}>
+              <Button icon={<ReloadOutlined />} block onClick={resetForm}>
                 重置
               </Button>
             </Space>
             <div className={classnames(styles.more, !expand ? styles.simple : styles.advance)}>
               <Button type="link" onClick={handleExpand}>
                 更多筛选
-                <DoubleRightOutlined style={{marginLeft: 32}} rotate={expand ? 90 : -90}/>
+                <DoubleRightOutlined style={{ marginLeft: 32 }} rotate={expand ? 90 : -90} />
               </Button>
             </div>
           </div>

+ 2 - 2
src/components/SearchComponent/readme.md

@@ -34,7 +34,7 @@
 - `digit` 数字类型
 - `dateTime` 日期时间
 
-## defaultParams 默认查询参数不展示到UI上
+## defaultParams 默认查询参数不展示到 UI 
 
 支持两种类型的默认参数
 
@@ -54,7 +54,7 @@ const b = {
 }
 ```
 
-## initParam 默认查询参数,展示到UI上
+## initParam 默认查询参数,展示到 UI 
 
 ```
 {[

+ 2 - 2
src/hooks/index.ts

@@ -1,2 +1,2 @@
-export {default as useHistory} from './route/useHistory';
-export {default as useLocation} from './route/useLocation';
+export { default as useHistory } from './route/useHistory';
+export { default as useLocation } from './route/useLocation';

+ 1 - 1
src/hooks/route/useHistory.tsx

@@ -3,7 +3,7 @@ import {useEffect, useState} from 'react';
 import type {LocationDescriptor, LocationState, Path} from 'history';
 import {model} from '@formily/reactive';
 
-export const historyStateModel = model<{ state: any }>({state: {}});
+export const historyStateModel = model<{ state: any }>({ state: {} });
 
 const useHistories = () => {
   const umiHistory = useHistory();

+ 9 - 9
src/pages/device/Instance/Detail/Config/index.tsx

@@ -22,7 +22,7 @@ const Config = () => {
 
   const [metadata, setMetadata] = useState<ConfigMetadata[]>([]);
   const [visible, setVisible] = useState<boolean>(false);
-  const {permission} = PermissionButton.usePermission('device/Instance');
+  const { permission } = PermissionButton.usePermission('device/Instance');
 
   const id = InstanceModel.detail?.id || params?.id;
 
@@ -77,9 +77,9 @@ const Config = () => {
   };
 
   return metadata.length > 0 ? (
-    <div style={{width: '100%', marginTop: '20px'}} className="config">
-      <div style={{display: 'flex', marginBottom: 20}}>
-        <div style={{fontSize: 16, fontWeight: 700}}>配置</div>
+    <div style={{ width: '100%', marginTop: '20px' }} className="config">
+      <div style={{ display: 'flex', marginBottom: 20 }}>
+        <div style={{ fontSize: 16, fontWeight: 700 }}>配置</div>
         <Space>
           <PermissionButton
             isPermission={permission.update}
@@ -88,7 +88,7 @@ const Config = () => {
               setVisible(true);
             }}
           >
-            <EditOutlined/>
+            <EditOutlined />
             编辑
           </PermissionButton>
           {InstanceModel.detail.state?.value !== 'notActive' && (
@@ -106,10 +106,10 @@ const Config = () => {
               isPermission={permission.update}
               type="link"
             >
-              <CheckOutlined/>
+              <CheckOutlined />
               应用配置
               <Tooltip title="修改配置后需重新应用后才能生效。">
-                <QuestionCircleOutlined/>
+                <QuestionCircleOutlined />
               </Tooltip>
             </PermissionButton>
           )}
@@ -128,12 +128,12 @@ const Config = () => {
               type="link"
               isPermission={permission.update}
             >
-              <UndoOutlined/>
+              <UndoOutlined />
               恢复默认
               <Tooltip
                 title={`该设备单独编辑过配置信息,点击此将恢复成默认的配置信息,请谨慎操作。`}
               >
-                <QuestionCircleOutlined/>
+                <QuestionCircleOutlined />
               </Tooltip>
             </PermissionButton>
           )}

+ 7 - 7
src/pages/device/Instance/Detail/Diagnose/index.tsx

@@ -74,21 +74,21 @@ const Diagnose = () => {
                   backgroundSize: '100% 100%',
                 }
               : {
-                backgroundColor: 'rgba(0, 0, 0, .08)',
-                borderLeft: '2px solid rgba(0, 0, 0, .8)',
-                cursor: 'not-allowed',
-              }
+                  backgroundColor: 'rgba(0, 0, 0, .08)',
+                  borderLeft: '2px solid rgba(0, 0, 0, .8)',
+                  cursor: 'not-allowed',
+                }
           }
           className="item-box"
         >
           <div className="item-title">消息通信</div>
           <div
             className={classNames('item-context', message !== 'disabled' ? 'item-message' : '')}
-            style={{fontWeight: 400}}
+            style={{ fontWeight: 400 }}
           >
             {message === 'disabled' ? (
-              <span style={{color: statusColor.get(message)}}>
-                <Badge color={statusColor.get(message)}/> 连接中
+              <span style={{ color: statusColor.get(message) }}>
+                <Badge color={statusColor.get(message)} /> 连接中
               </span>
             ) : (
               <>

+ 3 - 3
src/pages/device/Instance/Detail/Info/index.tsx

@@ -14,7 +14,7 @@ import {PermissionButton} from '@/components';
 const Info = observer(() => {
   const intl = useIntl();
   const [visible, setVisible] = useState<boolean>(false);
-  const {permission} = PermissionButton.usePermission('device/Instance');
+  const { permission } = PermissionButton.usePermission('device/Instance');
 
   return (
     <>
@@ -33,7 +33,7 @@ const Info = observer(() => {
                 setVisible(true);
               }}
             >
-              <EditOutlined/>
+              <EditOutlined />
               编辑
             </PermissionButton>,
           ]}
@@ -113,7 +113,7 @@ const Info = observer(() => {
             {InstanceModel.detail?.description}
           </Descriptions.Item>
         </Descriptions>
-        <Config/>
+        <Config />
         {InstanceModel.detail?.tags && InstanceModel.detail?.tags.length > 0 && <Tags />}
       </Card>
       <Save

+ 3 - 3
src/pages/device/Instance/Detail/MetadataMap/EditableTable/index.tsx

@@ -5,7 +5,7 @@ import _ from 'lodash';
 
 const EditableContext: any = React.createContext(null);
 
-const EditableRow = ({...props}) => {
+const EditableRow = ({ ...props }) => {
   const [form] = Form.useForm();
 
   return (
@@ -42,7 +42,7 @@ const EditableCell = ({
   const save = async () => {
     try {
       const values = await form.validateFields();
-      handleSave({...record, metadataId: values?.metadataId});
+      handleSave({ ...record, metadataId: values?.metadataId });
     } catch (errInfo) {
       console.log('Save failed:', errInfo);
     }
@@ -217,7 +217,7 @@ const EditableTable = (props: Props) => {
     if (item?.metadataId !== row?.metadataId) {
       const resp = await service[
         props.type === 'device' ? 'saveDeviceMetadata' : 'saveProductMetadata'
-        ](props.data?.id, [
+      ](props.data?.id, [
         {
           metadataType: 'property',
           metadataId: row.metadataId === 'use-origin-data' ? row.metadataId : row.id,

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

@@ -32,7 +32,7 @@ const InstanceDetail = observer(() => {
   const intl = useIntl();
   const [tab, setTab] = useState<string>('detail');
   const params = useParams<{ id: string }>();
-  const {permission} = PermissionButton.usePermission('device/Instance');
+  const { permission } = PermissionButton.usePermission('device/Instance');
 
   const resetMetadata = async () => {
     const resp = await service.deleteMetadata(params.id);

+ 3 - 3
src/pages/device/Instance/index.tsx

@@ -279,7 +279,7 @@ const Instance = () => {
       <Menu.Item key="1">
         <PermissionButton
           isPermission={permission.export}
-          icon={<ExportOutlined/>}
+          icon={<ExportOutlined />}
           type="default"
           onClick={() => {
             setExportVisible(true);
@@ -302,7 +302,7 @@ const Instance = () => {
       <Menu.Item key="4">
         <PermissionButton
           isPermission={permission.action}
-          icon={<CheckCircleOutlined/>}
+          icon={<CheckCircleOutlined />}
           type="primary"
           ghost
           popConfirm={{
@@ -323,7 +323,7 @@ const Instance = () => {
       <Menu.Item key="5">
         <PermissionButton
           isPermission={true}
-          icon={<SyncOutlined/>}
+          icon={<SyncOutlined />}
           type="primary"
           onClick={() => {
             setType('sync');

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

@@ -26,7 +26,7 @@ const Access = () => {
   const [access, setAccess] = useState<any>();
   const [providers, setProviders] = useState<any[]>([]);
   const [networkList, setNetworkList] = useState<any[]>([]);
-  const {permission} = usePermissions('device/Product');
+  const { permission } = usePermissions('device/Product');
 
   const MetworkTypeMapping = new Map();
   MetworkTypeMapping.set('websocket-server', 'WEB_SOCKET_SERVER');
@@ -83,9 +83,9 @@ const Access = () => {
           return res?.group == record?.group;
         });
         if (index == 0 || list[index - 1]?.group != record?.group) {
-          return {rowSpan: arr.length};
+          return { rowSpan: arr.length };
         } else {
-          return {rowSpan: 0};
+          return { rowSpan: 0 };
         }
       },
     },
@@ -148,7 +148,7 @@ const Access = () => {
           return res?.group == record?.group;
         });
         if (index == 0 || list[index - 1]?.group != record?.group) {
-          return {rowSpan: arr.length};
+          return { rowSpan: arr.length };
         } else {
           return { rowSpan: 0 };
         }
@@ -423,7 +423,7 @@ const Access = () => {
                           />
                         </div>
                       ),
-                  )
+                    )
                   : '暂无连接信息'}
               </div>
 
@@ -434,7 +434,7 @@ const Access = () => {
             <Col span={12}>
               <div className={styles.info}>
                 <div>
-                  <div style={{fontWeight: '600', marginBottom: 10}}>
+                  <div style={{ fontWeight: '600', marginBottom: 10 }}>
                     {access?.provider === 'mqtt-server-gateway' ||
                     access?.provider === 'mqtt-client-gateway'
                       ? 'topic'
@@ -445,7 +445,7 @@ const Access = () => {
                     bordered
                     columns={config.id === 'MQTT' ? columnsMQTT : columnsHTTP}
                     pagination={false}
-                    scroll={{y: 500}}
+                    scroll={{ y: 500 }}
                   />
                 </div>
               </div>

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

@@ -17,7 +17,7 @@ const BaseInfo = () => {
   // const [metadata, setMetadata] = useState<ConfigMetadata[]>([]);
   // const [state, setState] = useState<boolean>(false);
   const [visible, setVisible] = useState(false);
-  const {permission} = PermissionButton.usePermission('device/Product');
+  const { permission } = PermissionButton.usePermission('device/Product');
 
   // const form = createForm({
   //   validateFirst: true,
@@ -162,7 +162,7 @@ const BaseInfo = () => {
               setVisible(true);
             }}
           >
-            <EditOutlined/>
+            <EditOutlined />
           </PermissionButton>,
         ]}
         bordered

+ 3 - 3
src/pages/device/Product/Detail/index.tsx

@@ -31,7 +31,7 @@ const ProductDetail = observer(() => {
   const location = useLocation();
   const history = useHistory();
 
-  const {permission} = PermissionButton.usePermission('device/Product');
+  const { permission } = PermissionButton.usePermission('device/Product');
 
   const statusMap = {
     1: {
@@ -200,7 +200,7 @@ const ProductDetail = observer(() => {
               <PermissionButton
                 type={'link'}
                 isPermission={!!getMenuPathByCode(MENUS_CODE['device/Instance'])}
-                style={{padding: 0, height: 'auto'}}
+                style={{ padding: 0, height: 'auto' }}
                 onClick={() => {
                   const url = getMenuPathByCode(MENUS_CODE['device/Instance']);
                   const params = {
@@ -260,7 +260,7 @@ const ProductDetail = observer(() => {
               changeDeploy('deploy');
             },
           }}
-          tooltip={productModel.current?.state === 0 ? {title: '请先发布产品'} : undefined}
+          tooltip={productModel.current?.state === 0 ? { title: '请先发布产品' } : undefined}
           isPermission={permission.update}
           disabled={productModel.current?.state === 0}
         >

+ 9 - 8
src/pages/device/Product/index.tsx

@@ -25,8 +25,8 @@ import {downloadObject} from '@/utils/util';
 
 export const service = new Service('device-product');
 export const statusMap = {
-  1: <Badge status="processing" text="已发布"/>,
-  0: <Badge status="error" text="未发布"/>,
+  1: <Badge status="processing" text="已发布" />,
+  0: <Badge status="error" text="未发布" />,
 };
 export const productModel = model<{
   current: ProductItem | undefined;
@@ -390,6 +390,7 @@ const Product = observer(() => {
                 } catch {
                   message.error('请上传json格式文件');
                 }
+                return true;
               };
               return false;
             }}
@@ -479,17 +480,17 @@ const Product = observer(() => {
               <PermissionButton
                 key="delete"
                 type={'link'}
-                style={{padding: 0}}
+                style={{ padding: 0 }}
                 isPermission={permission.delete}
                 disabled={record.state === 1}
                 tooltip={
                   record.state === 1
                     ? {
-                      title: intl.formatMessage({
-                        id: 'pages.device.productDetail.deleteTip',
-                        defaultMessage: '已发布的产品不能进行删除操作',
-                      }),
-                    }
+                        title: intl.formatMessage({
+                          id: 'pages.device.productDetail.deleteTip',
+                          defaultMessage: '已发布的产品不能进行删除操作',
+                        }),
+                      }
                     : undefined
                 }
                 popConfirm={{

+ 7 - 7
src/pages/device/components/Metadata/Base/index.tsx

@@ -27,7 +27,7 @@ interface Props {
 }
 
 const BaseMetadata = observer((props: Props) => {
-  const {type, target = 'product'} = props;
+  const { type, target = 'product' } = props;
   const intl = useIntl();
   const param = useParams<{ id: string }>();
 
@@ -80,7 +80,7 @@ const BaseMetadata = observer((props: Props) => {
           isPermission={props.permission.update}
           type="link"
           key={'edit'}
-          style={{padding: 0}}
+          style={{ padding: 0 }}
           disabled={operateLimits('updata', type)}
           onClick={() => {
             MetadataModel.edit = true;
@@ -92,13 +92,13 @@ const BaseMetadata = observer((props: Props) => {
             title: operateLimits('add', type) ? '暂不支持' : '编辑',
           }}
         >
-          <EditOutlined/>
+          <EditOutlined />
         </PermissionButton>,
         <PermissionButton
           isPermission={props.permission.update}
           type="link"
           key={'delete'}
-          style={{padding: 0}}
+          style={{ padding: 0 }}
           popConfirm={{
             title: '确认删除?',
             onConfirm: async () => {
@@ -109,7 +109,7 @@ const BaseMetadata = observer((props: Props) => {
             title: '删除',
           }}
         >
-          <DeleteOutlined/>
+          <DeleteOutlined />
         </PermissionButton>,
       ],
     },
@@ -179,7 +179,7 @@ const BaseMetadata = observer((props: Props) => {
                 MetadataModel.importMetadata = true;
               }}
               key="button"
-              icon={<ImportOutlined/>}
+              icon={<ImportOutlined />}
               type="ghost"
             >
               导入属性
@@ -195,7 +195,7 @@ const BaseMetadata = observer((props: Props) => {
               MetadataModel.action = 'add';
             }}
             disabled={operateLimits('add', type)}
-            icon={<PlusOutlined/>}
+            icon={<PlusOutlined />}
             type="primary"
             tooltip={{
               title: operateLimits('add', type) ? '暂不支持' : '新增',

+ 7 - 7
src/pages/device/components/Metadata/index.tsx

@@ -23,14 +23,14 @@ const Metadata = observer((props: Props) => {
   const intl = useIntl();
   const [visible, setVisible] = useState<boolean>(false);
   const [cat, setCat] = useState<boolean>(false);
-  const {permission} = PermissionButton.usePermission(
+  const { permission } = PermissionButton.usePermission(
     props.type === 'device' ? 'device/Instance' : 'device/Product',
   );
   console.log(InstanceModel.detail, 'test');
   return (
-    <div style={{position: 'relative'}}>
+    <div style={{ position: 'relative' }}>
       <div className={styles.tips}>
-        <InfoCircleOutlined style={{marginRight: '3px'}}/>
+        <InfoCircleOutlined style={{ marginRight: '3px' }} />
         {InstanceModel.detail?.independentMetadata
           ? '该设备已脱离产品物模型,修改产品物模型对该设备无影响'
           : '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'}
@@ -64,7 +64,7 @@ const Metadata = observer((props: Props) => {
           })}
           key="properties"
         >
-          <BaseMetadata target={props.type} type={'properties'} permission={permission}/>
+          <BaseMetadata target={props.type} type={'properties'} permission={permission} />
         </Tabs.TabPane>
         <Tabs.TabPane
           tab={intl.formatMessage({
@@ -73,7 +73,7 @@ const Metadata = observer((props: Props) => {
           })}
           key="functions"
         >
-          <BaseMetadata target={props.type} type={'functions'} permission={permission}/>
+          <BaseMetadata target={props.type} type={'functions'} permission={permission} />
         </Tabs.TabPane>
         <Tabs.TabPane
           tab={intl.formatMessage({
@@ -82,7 +82,7 @@ const Metadata = observer((props: Props) => {
           })}
           key="events"
         >
-          <BaseMetadata target={props.type} type={'events'} permission={permission}/>
+          <BaseMetadata target={props.type} type={'events'} permission={permission} />
         </Tabs.TabPane>
         <Tabs.TabPane
           tab={intl.formatMessage({
@@ -91,7 +91,7 @@ const Metadata = observer((props: Props) => {
           })}
           key="tags"
         >
-          <BaseMetadata target={props.type} type={'tags'} permission={permission}/>
+          <BaseMetadata target={props.type} type={'tags'} permission={permission} />
         </Tabs.TabPane>
       </Tabs>
       <Import visible={visible} close={() => setVisible(false)} />

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

@@ -287,7 +287,7 @@ const Access = (props: Props) => {
                     }),
                   );
                 }}
-                style={{width: 500, margin: '20px 0'}}
+                style={{ width: 500, margin: '20px 0' }}
               />
               <PermissionButton
                 isPermission={networkPermission.add}
@@ -400,7 +400,7 @@ const Access = (props: Props) => {
                     }),
                   );
                 }}
-                style={{width: 500, margin: '20px 0'}}
+                style={{ width: 500, margin: '20px 0' }}
               />
               <PermissionButton
                 isPermission={protocolPermission.add}

+ 16 - 16
src/pages/link/Protocol/index.tsx

@@ -18,7 +18,7 @@ const Protocol = () => {
   const [visible, setVisible] = useState<boolean>(false);
   const [current, setCurrent] = useState<ProtocolItem | undefined>();
   const [searchParams, setSearchParams] = useState<any>({});
-  const {permission} = PermissionButton.usePermission('link/Protocol');
+  const { permission } = PermissionButton.usePermission('link/Protocol');
   const intl = useIntl();
 
   const modifyState = async (id: string, type: 'deploy' | 'un-deploy') => {
@@ -79,7 +79,7 @@ const Protocol = () => {
             setVisible(true);
           }}
           type={'link'}
-          style={{padding: 0}}
+          style={{ padding: 0 }}
           tooltip={{
             title: intl.formatMessage({
               id: 'pages.data.option.edit',
@@ -87,13 +87,13 @@ const Protocol = () => {
             }),
           }}
         >
-          <EditOutlined/>
+          <EditOutlined />
         </PermissionButton>,
         <PermissionButton
           isPermission={permission.action}
           key="action"
           type={'link'}
-          style={{padding: 0}}
+          style={{ padding: 0 }}
           tooltip={{
             title: record.state === 1 ? '撤销' : '发布',
           }}
@@ -108,14 +108,14 @@ const Protocol = () => {
             },
           }}
         >
-          {record.state === 1 ? <StopOutlined/> : <CheckCircleOutlined/>}
+          {record.state === 1 ? <StopOutlined /> : <CheckCircleOutlined />}
         </PermissionButton>,
         <PermissionButton
           isPermission={permission.delete}
           tooltip={{
             title: record.state !== 1 ? '删除' : '请先禁用该协议,再删除',
           }}
-          style={{padding: 0}}
+          style={{ padding: 0 }}
           disabled={record.state === 1}
           popConfirm={{
             title: '确认删除',
@@ -157,7 +157,7 @@ const Protocol = () => {
         columns={columns}
         actionRef={actionRef}
         params={searchParams}
-        options={{fullScreen: true}}
+        options={{ fullScreen: true }}
         request={(params) =>
           service.query({
             ...params,
@@ -171,17 +171,17 @@ const Protocol = () => {
         }
         rowKey="id"
         search={false}
-        pagination={{pageSize: 10}}
+        pagination={{ pageSize: 10 }}
         headerTitle={[
           <PermissionButton
             onClick={() => {
               setVisible(true);
-              setCurrent({});
+              setCurrent(undefined);
             }}
-            style={{marginRight: 12}}
+            style={{ marginRight: 12 }}
             isPermission={permission.add}
             key="button"
-            icon={<PlusOutlined/>}
+            icon={<PlusOutlined />}
             type="primary"
           >
             {intl.formatMessage({
@@ -202,7 +202,7 @@ const Protocol = () => {
                   setVisible(true);
                 }}
                 type={'link'}
-                style={{padding: 0}}
+                style={{ padding: 0 }}
                 tooltip={{
                   title: intl.formatMessage({
                     id: 'pages.data.option.edit',
@@ -210,13 +210,13 @@ const Protocol = () => {
                   }),
                 }}
               >
-                <EditOutlined/>
+                <EditOutlined />
               </PermissionButton>,
               <PermissionButton
                 isPermission={permission.action}
                 key="action"
                 type={'link'}
-                style={{padding: 0}}
+                style={{ padding: 0 }}
                 tooltip={{
                   title: record.state === 1 ? '撤销' : '发布',
                 }}
@@ -231,7 +231,7 @@ const Protocol = () => {
                   },
                 }}
               >
-                {record.state === 1 ? <StopOutlined/> : <CheckCircleOutlined/>}
+                {record.state === 1 ? <StopOutlined /> : <CheckCircleOutlined />}
               </PermissionButton>,
               <PermissionButton
                 isPermission={permission.delete}
@@ -259,7 +259,7 @@ const Protocol = () => {
                 key="delete"
                 type="link"
               >
-                <DeleteOutlined/>
+                <DeleteOutlined />
               </PermissionButton>,
             ]}
           />

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

@@ -145,8 +145,8 @@ const Save = (props: Props) => {
               },
             ],
             enum: [
-              {label: 'jar', value: 'jar'},
-              {label: 'local', value: 'local'},
+              { label: 'jar', value: 'jar' },
+              { label: 'local', value: 'local' },
               // { label: 'script', value: 'script' },
             ],
           },
@@ -248,7 +248,7 @@ const Save = (props: Props) => {
       }
     >
       <Form form={form} layout="vertical">
-        <SchemaField schema={schema}/>
+        <SchemaField schema={schema} />
       </Form>
     </Modal>
   );

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

@@ -241,7 +241,7 @@ export default () => {
               type === ProviderValue.GB281 ? (
                 <Tooltip
                   key="button"
-                  title={<div style={{width: 265}}>接入方式为GB/T28281时,不支持新增</div>}
+                  title={<div style={{ width: 265 }}>接入方式为GB/T28281时,不支持新增</div>}
                 >
                   <Button disabled>
                     {intl.formatMessage({

+ 11 - 11
src/pages/media/Device/Save/ProviderSelect.tsx

@@ -22,7 +22,7 @@ interface ProviderProps {
 const defaultImage = require('/public/images/device-access.png');
 
 export default (props: ProviderProps) => {
-  const {permission} = usePermissions('link/AccessConfig');
+  const { permission } = usePermissions('link/AccessConfig');
   const [options, setOptions] = useState<any[]>([]);
   const addItemKey = useRef('');
   const intl = useIntl();
@@ -40,7 +40,7 @@ export default (props: ProviderProps) => {
     [props],
   );
 
-  const {run: getProviderList} = useRequest(service.queryProvider, {
+  const { run: getProviderList } = useRequest(service.queryProvider, {
     manual: true,
     formatResult: (res) => res.result,
     onSuccess: (resp) => {
@@ -61,8 +61,8 @@ export default (props: ProviderProps) => {
     tab!.onTabSaveSuccess = (value: any) => {
       addItemKey.current = value.id;
       getProviderList({
-        sorts: [{name: 'createTime', value: 'asc'}],
-        terms: [{column: 'provider', value: props.type}],
+        sorts: [{ name: 'createTime', value: 'asc' }],
+        terms: [{ column: 'provider', value: props.type }],
         pageSize: 100,
       });
     };
@@ -75,7 +75,7 @@ export default (props: ProviderProps) => {
   const emptyDescription = permission.add ? (
     <>
       暂无数据,请先
-      <Button type={'link'} onClick={jumpPage} style={{padding: 0}}>
+      <Button type={'link'} onClick={jumpPage} style={{ padding: 0 }}>
         添加{providerType[props.type]} 接入网关
       </Button>
     </>
@@ -94,10 +94,10 @@ export default (props: ProviderProps) => {
             onClick={() => {
               itemClick(item);
             }}
-            style={{padding: 16}}
+            style={{ padding: 16 }}
           >
             <TableCard
-              className={classNames({active: item.id === props.value})}
+              className={classNames({ active: item.id === props.value })}
               showMask={false}
               showTool={false}
               status={item.state.value}
@@ -109,7 +109,7 @@ export default (props: ProviderProps) => {
             >
               <div className={styles.context}>
                 <div>
-                  <img width={88} height={88} src={defaultImage} alt={''}/>
+                  <img width={88} height={88} src={defaultImage} alt={''} />
                 </div>
                 <div className={styles.card}>
                   <div className={styles.header}>
@@ -119,10 +119,10 @@ export default (props: ProviderProps) => {
                   <div className={styles.container}>
                     <div className={styles.server}>
                       <div className={styles.subTitle}>{item?.channelInfo?.name || '--'}</div>
-                      <div style={{width: '100%'}}>
+                      <div style={{ width: '100%' }}>
                         {item.channelInfo?.addresses.map((i: any, index: number) => (
                           <p key={i.address + `_address${index}`}>
-                            <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address}/>
+                            <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address} />
                           </p>
                         ))}
                       </div>
@@ -138,7 +138,7 @@ export default (props: ProviderProps) => {
           </div>
         ))
       ) : (
-        <Empty description={<span>{emptyDescription}</span>}/>
+        <Empty description={<span>{emptyDescription}</span>} />
       )}
     </div>
   );

+ 2 - 2
src/pages/media/Device/Save/SaveProduct.tsx

@@ -24,8 +24,8 @@ export default (props: SaveProps) => {
   useEffect(() => {
     if (visible) {
       getProviderList({
-        sorts: [{name: 'createTime', value: 'desc'}],
-        terms: [{column: 'provider', value: props.type}],
+        sorts: [{ name: 'createTime', value: 'desc' }],
+        terms: [{ column: 'provider', value: props.type }],
         pageSize: 100,
       });
     }

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

@@ -333,7 +333,7 @@ export default (props: SaveProps) => {
                     '说明',
                   )}
                   rows={4}
-                  style={{width: '100%'}}
+                  style={{ width: '100%' }}
                   maxLength={200}
                   showCount={true}
                 />

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

@@ -17,7 +17,7 @@ import {BadgeStatus, PermissionButton, ProTableCard} from '@/components';
 import {StatusColorEnum} from '@/components/BadgeStatus';
 import SearchComponent from '@/components/SearchComponent';
 import MediaDevice from '@/components/ProTableCard/CardItems/mediaDevice';
-import {getMenuPathByCode, getMenuPathByParams, MENUS_CODE,} from '@/utils/menu';
+import {getMenuPathByCode, getMenuPathByParams, MENUS_CODE} from '@/utils/menu';
 import Service from './service';
 import Save from './Save';
 

+ 1 - 1
src/pages/system/Menu/Detail/buttons.tsx

@@ -351,7 +351,7 @@ export default (props: ButtonsProps) => {
               defaultMessage: '说明',
             })}
           >
-            <Input.TextArea disabled={disabled} placeholder={'请输入说明'}/>
+            <Input.TextArea disabled={disabled} placeholder={'请输入说明'} />
           </Form.Item>
         </Form>
       </Modal>

+ 1 - 1
src/pages/system/Menu/Detail/edit.tsx

@@ -24,7 +24,7 @@ export default (props: EditProps) => {
   const [show] = useState(true);
   const [accessSupport, setAccessSupport] = useState('unsupported');
   const history = useHistory();
-  const {getOtherPermission} = PermissionButton.usePermission('system/Menu');
+  const { getOtherPermission } = PermissionButton.usePermission('system/Menu');
 
   const [form] = Form.useForm();
 

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

@@ -169,7 +169,7 @@ export default observer(() => {
         <PermissionButton
           key="delete"
           type="link"
-          style={{padding: 0}}
+          style={{ padding: 0 }}
           isPermission={permission.delete}
           popConfirm={{
             title: intl.formatMessage({

+ 2 - 2
src/pages/system/Permission/index.tsx

@@ -78,7 +78,7 @@ const Permission: React.FC = observer(() => {
           disabled={getButtonPermission('system/Permission', ['export'])}
           title={'确认导出?'}
           onConfirm={() => {
-            service.getPermission({...param, paging: false}).subscribe((resp) => {
+            service.getPermission({ ...param, paging: false }).subscribe((resp) => {
               if (resp.status === 200) {
                 downloadObject(resp.result, '权限数据');
                 message.success('导出成功');
@@ -211,7 +211,7 @@ const Permission: React.FC = observer(() => {
         <PermissionButton
           type={'link'}
           key={'delete'}
-          style={{padding: 0}}
+          style={{ padding: 0 }}
           disabled={!!record.status}
           isPermission={permission.delete}
           tooltip={{

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

@@ -20,7 +20,7 @@ const Role: React.FC = observer(() => {
   const intl = useIntl();
   const actionRef = useRef<ActionType>();
   const permissionCode = 'system/Role';
-  const {permission} = PermissionButton.usePermission(permissionCode);
+  const { permission } = PermissionButton.usePermission(permissionCode);
 
   const columns: ProColumns<RoleItem>[] = [
     // {