Forráskód Böngészése

fix: opc及bug修复

wzyyy 3 éve
szülő
commit
d8b92649d2

+ 3 - 1
src/components/DashBoard/echarts.tsx

@@ -60,7 +60,7 @@ export default (props: EchartsProps) => {
 
   const initEcharts = (dom: HTMLDivElement) => {
     chartsRef.current = chartsRef.current || echarts.init(dom);
-
+    // chartsRef.current.clear()
     if (props.options) {
       chartsRef.current.setOption(props.options);
     } else {
@@ -80,6 +80,7 @@ export default (props: EchartsProps) => {
     return () => {
       (window as Window).removeEventListener('resize', updateSize);
       if (chartsRef.current) {
+        // chartsRef.current.clear();
         chartsRef.current.dispose();
         chartsRef.current = null;
       }
@@ -88,6 +89,7 @@ export default (props: EchartsProps) => {
 
   useEffect(() => {
     if (chartsRef.current && props.options) {
+      // chartsRef.current.clear()
       chartsRef.current.setOption(props.options);
     }
   }, [props.options, chartsRef.current]);

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

@@ -23,7 +23,7 @@ const FUpload = connect((props: Props) => {
       const api = await service.querySystemApi(['paths']);
       const f = {
         ...result,
-        url: `${api?.result[0]?.properties?.basePath}/file/${result?.id}?accessKey=${result?.others?.accessKey}`,
+        url: `${api?.result[0]?.properties['base-path']}/file/${result?.id}?accessKey=${result?.others?.accessKey}`,
       };
       setUrl(f.url);
       props.onChange(f);

+ 1 - 1
src/pages/Log/Access/index.tsx

@@ -102,7 +102,7 @@ const Access = () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       fixed: 'right',
       render: (text, record) => [
         <a

+ 2 - 2
src/pages/Log/System/index.tsx

@@ -101,8 +101,8 @@ const System = () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
-      width: 200,
+      align: 'left',
+      width: 100,
       fixed: 'right',
       render: (text, record) => [
         <a

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

@@ -187,7 +187,7 @@ const AliCloud = () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       fixed: 'right',
       render: (text, record) => Tools(record, 'table'),

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

@@ -230,7 +230,7 @@ export default () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       fixed: 'right',
       render: (text, record) => Tools(record, 'table'),

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

@@ -102,7 +102,7 @@ const ChildDevice = () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       fixed: 'right',
       render: (text, record) => [

+ 2 - 1
src/pages/device/Instance/Detail/Diagnose/Status/ManualInspection.tsx

@@ -15,6 +15,7 @@ interface Props {
 const ManualInspection = (props: Props) => {
   const { data } = props;
   const { permission } = PermissionButton.usePermission('device/Product');
+  const { update } = PermissionButton.usePermission('device/Instance').permission;
 
   const history = useHistory<Record<string, string>>();
 
@@ -214,7 +215,7 @@ const ManualInspection = (props: Props) => {
       width={900}
       footer={[
         <PermissionButton
-          isPermission={permission.update}
+          isPermission={data.type === 'product' ? permission.update : update}
           // type={'link'}
           key="back"
           style={{ marginRight: 10 }}

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

@@ -74,7 +74,7 @@ const BaseMetadata = observer((props: Props) => {
     {
       title: '操作',
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       render: (_: unknown, record: MetadataItem) => [
         <PermissionButton

+ 4 - 4
src/pages/init-home/components/basis.tsx

@@ -24,7 +24,7 @@ const Basis = forwardRef((props: Props, ref) => {
             properties: {
               ...formData,
               apikey: '',
-              basePath: '',
+              'base-path': '',
             },
           },
           {
@@ -36,7 +36,7 @@ const Basis = forwardRef((props: Props, ref) => {
           {
             scope: 'paths',
             properties: {
-              basePath: formData.basePath,
+              'base-path': formData['base-path'],
             },
           },
         ];
@@ -83,7 +83,7 @@ const Basis = forwardRef((props: Props, ref) => {
         ico: require('/public/favicon.ico'),
         backgroud: require('/public/images/login.png'),
         apikey: '',
-        basePath: `${window.location.origin}/api`,
+        'base-path': `${window.location.origin}/api`,
       }}
     >
       <Row gutter={[24, 24]}>
@@ -115,7 +115,7 @@ const Basis = forwardRef((props: Props, ref) => {
           </Form.Item>
           <Form.Item
             label="base-path"
-            name="basePath"
+            name="base-path"
             tooltip="系统后台访问的url"
             required
             rules={[{ required: true, message: 'base-path必填' }]}

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

@@ -12,6 +12,7 @@ const Provider = (props: Props) => {
   const [dataSource, setDataSource] = useState<any[]>([]);
 
   useEffect(() => {
+    console.log(props.data);
     const media: any[] = [];
     const network: any[] = [];
     const cloud: any[] = [];
@@ -70,7 +71,7 @@ const Provider = (props: Props) => {
 
   return (
     <div>
-      {dataSource.map((i) => (
+      {/* {dataSource.map((i) => (
         <Card key={i.type} style={{ marginTop: 20 }}>
           <TitleComponent data={i.title} />
           <Row gutter={[24, 24]}>
@@ -107,7 +108,51 @@ const Provider = (props: Props) => {
             ))}
           </Row>
         </Card>
-      ))}
+      ))} */}
+      {dataSource.map((i) => {
+        if (i.list && i.list.length !== 0) {
+          return (
+            <Card key={i.type} style={{ marginTop: 20 }}>
+              <TitleComponent data={i.title} />
+              <Row gutter={[24, 24]}>
+                {(i?.list || []).map((item: any) => (
+                  <Col key={item.name} span={12}>
+                    <div className={styles.provider}>
+                      <div className={styles.box}>
+                        <div className={styles.left}>
+                          <div className={styles.images}>
+                            <img src={backMap.get(item.id)} />
+                          </div>
+                          <div className={styles.context}>
+                            <div style={{ fontWeight: 600 }}>{item.name}</div>
+                            <div className={styles.desc}>
+                              <Tooltip title={item?.description || ''}>
+                                {item?.description || ''}
+                              </Tooltip>
+                            </div>
+                          </div>
+                        </div>
+                        <div style={{ width: '70px' }}>
+                          <Button
+                            type="primary"
+                            onClick={() => {
+                              props.change(item, i.type);
+                            }}
+                          >
+                            接入
+                          </Button>
+                        </div>
+                      </div>
+                    </div>
+                  </Col>
+                ))}
+              </Row>
+            </Card>
+          );
+        } else {
+          return <></>;
+        }
+      })}
     </div>
   );
 };

+ 1 - 1
src/pages/link/Channel/Modbus/index.tsx

@@ -201,7 +201,7 @@ const NewModbus = () => {
     {
       title: '操作',
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 120,
       fixed: 'right',
       render: (text, record) => [

+ 3 - 3
src/pages/link/Channel/Opcua/index.tsx

@@ -160,7 +160,7 @@ const NewOpc = () => {
     {
       title: '操作',
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 120,
       fixed: 'right',
       render: (text, record) => [
@@ -311,8 +311,8 @@ const NewOpc = () => {
       })
         ?.pipe(map((res: any) => res.payload))
         .subscribe((payload: any) => {
-          const { value } = payload;
-          current[value.property] = value.formatValue;
+          const { pointId, parseData } = payload;
+          current[pointId] = parseData;
           setCurrentData({ ...current });
         });
     }

+ 9 - 9
src/pages/link/Channel/Opcua/savePoint.tsx

@@ -87,15 +87,15 @@ const SavePoint = (props: Props) => {
               required
               rules={[
                 { required: true, message: '点位ID必填' },
-                ({}) => ({
-                  validator(_, value) {
-                    const item = value.substring(0, 2);
-                    if (item === 'i=' || item === 's=' || item === 'g=' || item === 'b=') {
-                      return Promise.resolve();
-                    }
-                    return Promise.reject(new Error('前两个字符必须为i=、s=、g=、b=中的一个'));
-                  },
-                }),
+                // ({}) => ({
+                //   validator(_, value) {
+                //     const item = value.substring(0, 2);
+                //     if (item === 'i=' || item === 's=' || item === 'g=' || item === 'b=') {
+                //       return Promise.resolve();
+                //     }
+                //     return Promise.reject(new Error('前两个字符必须为i=、s=、g=、b=中的一个'));
+                //   },
+                // }),
               ]}
             >
               <Input placeholder="请输入点位ID" />

+ 1 - 2
src/pages/link/DashBoard/service.ts

@@ -3,8 +3,7 @@ import SystemConst from '@/utils/const';
 import { request } from 'umi';
 
 class Service extends BaseService<any> {
-  serverNode = () =>
-    request(`/${SystemConst.API_BASE}/network/resources/clusters`, { method: 'GET' });
+  serverNode = () => request(`/${SystemConst.API_BASE}/dashboard/cluster/nodes`, { method: 'GET' });
 
   /**
    * echarts数据

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

@@ -23,7 +23,7 @@ const FileUpload = connect((props: Props) => {
       onlyMessage('上传成功!');
       const result = info.file.response?.result;
       const api = await service.querySystemApi(['paths']);
-      const f = `${api?.result[0]?.properties?.basePath}/file/${result?.id}?accessKey=${result?.others?.accessKey}`;
+      const f = `${api?.result[0]?.properties['base-path']}/file/${result?.id}?accessKey=${result?.others?.accessKey}`;
       setUrl(f);
       setLoading(false);
       props.onChange(f);

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

@@ -207,7 +207,7 @@ const Cascade = () => {
       ellipsis: true,
       fixed: 'right',
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       render: (text, record) => [
         <PermissionButton
           isPermission={permission.update}

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

@@ -138,7 +138,7 @@ export default () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       render: (_, record) => [
         <Tooltip

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

@@ -126,6 +126,25 @@ const Device = () => {
         defaultMessage: '设备厂家',
       }),
     },
+    {
+      title: intl.formatMessage({
+        id: 'pages.table.productName',
+        defaultMessage: '产品名称',
+      }),
+      dataIndex: 'productId',
+      ellipsis: true,
+      valueType: 'select',
+      hideInTable: false,
+      request: async () => {
+        const res = await service.getProductList();
+        if (res.status === 200) {
+          return res.result.map((pItem: any) => ({ label: pItem.name, value: pItem.id }));
+        }
+        return [];
+      },
+      // render: (_, row) => row.productName,
+      filterMultiple: true,
+    },
     // {
     //   dataIndex: 'model',
     //   title: intl.formatMessage({
@@ -189,7 +208,7 @@ const Device = () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       fixed: 'right',
       render: (text, record) => [

+ 6 - 0
src/pages/media/Device/service.ts

@@ -30,6 +30,12 @@ class Service extends BaseService<DeviceItem> {
     request(`/${SystemConst.API_BASE}/gateway/device/detail/_query`, { method: 'POST', data });
   //视频设备详情
   getDetail = (id: string) => request(`${this.uri}/${id}`, { method: 'GET' });
+  // 查询产品列表
+  getProductList = (params?: any) =>
+    request(`/${SystemConst.API_BASE}/device/product/_query/no-paging?paging=false`, {
+      method: 'GET',
+      params,
+    });
 }
 
 export default Service;

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

@@ -159,7 +159,7 @@ const Instance = () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       fixed: 'right',
       render: (text, record) => [

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

@@ -295,7 +295,7 @@ const Scene = () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       fixed: 'right',
       render: (text, record) => Tools(record, 'table'),

+ 7 - 4
src/pages/system/Basis/index.tsx

@@ -27,7 +27,7 @@ const Basis = () => {
       form.setFieldsValue({
         ...basis[0].properties,
         apikey: api[0].properties.api,
-        basePath: basePath[0].properties.basePath,
+        'base-path': basePath[0].properties['base-path'],
       });
       setInitialState({
         ...initialState,
@@ -46,7 +46,7 @@ const Basis = () => {
           properties: {
             ...formData,
             apikey: '',
-            basePath: '',
+            'base-path': '',
           },
         },
         {
@@ -58,8 +58,11 @@ const Basis = () => {
         {
           scope: 'paths',
           properties: {
-            basePath: formData.basePath,
+            'base-path': formData['base-path'],
           },
+          // properties: {
+          //   basePath: formData.basePath,
+          // },
         },
       ];
       const res = await service.save(item);
@@ -109,7 +112,7 @@ const Basis = () => {
               </Form.Item>
               <Form.Item
                 label="base-path"
-                name="basePath"
+                name="base-path"
                 tooltip="访问后台服务器的url"
                 required
                 rules={[{ required: true, message: 'base-path必填' }]}

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

@@ -140,7 +140,8 @@ export default observer(() => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      width: 240,
+      width: 140,
+      align: 'left',
       fixed: 'right',
       render: (_, record) => [
         <Button

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

@@ -113,7 +113,7 @@ export default () => {
         defaultMessage: '操作',
       }),
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 250,
       fixed: 'right',
       render: (_, record: any) => [

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

@@ -57,7 +57,7 @@ const Relationship = () => {
     {
       title: '操作',
       valueType: 'option',
-      align: 'center',
+      align: 'left',
       width: 200,
       fixed: 'right',
       render: (text, record) => [

+ 8 - 2
src/pages/user/Login/index.less

@@ -65,13 +65,17 @@
         .desc {
           margin-top: 12px;
           margin-bottom: 40px;
-          color: @text-color-secondary;
-          font-size: @font-size-base;
+          // color: @heading-color;
+          color: rgb(0 0 0 / 70%);
+          font-weight: 600;
+          font-size: 22px;
+          font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif;
         }
 
         .main {
           width: 70%;
           margin: 60px auto 0;
+
           @media screen and (max-width: @screen-sm) {
             width: 95%;
             max-width: 328px;
@@ -82,10 +86,12 @@
               margin: auto;
               font-size: 16px;
             }
+
             .ant-formily-item-size-large .ant-formily-item-help {
               text-align: left;
             }
           }
+
           .icon {
             margin-left: 16px;
             color: rgba(0, 0, 0, 0.2);

+ 3 - 8
src/pages/user/Login/index.tsx

@@ -95,6 +95,7 @@ const Login: React.FC = () => {
         const ico: any = document.querySelector('link[rel="icon"]');
         ico.href = res.result.ico;
         setBasis(res.result);
+        console.log(res.result);
         if (res.result.title) {
           document.title = res.result.title;
         } else {
@@ -232,16 +233,10 @@ const Login: React.FC = () => {
             <div className={styles.top}>
               <div className={styles.header}>
                 <Link to="/">
-                  <img alt="logo" className={styles.logo} src="/logo.svg" />
-                  {/*<span className={styles.title}>{SystemConst.SYSTEM_NAME}</span>*/}
+                  <img alt="logo" className={styles.logo} src={basis.logo || '/logo.svg'} />
                 </Link>
               </div>
-              <div className={styles.desc}>
-                {intl.formatMessage({
-                  id: 'pages.layouts.userLayout.title',
-                  defaultMessage: 'Jetlinks',
-                })}
-              </div>
+              <div className={styles.desc}>{basis.title || SystemConst.SYSTEM_NAME}</div>
               <div className={styles.main}>
                 <Form form={loginForm} layout="horizontal" size="large" onAutoSubmit={doLogin}>
                   <SchemaField schema={schema} />