Selaa lähdekoodia

fix: 修改bug

sun-chaochao 3 vuotta sitten
vanhempi
commit
66dbfbefa2

+ 0 - 2
src/pages/device/Instance/Detail/MetadataLog/Property/index.tsx

@@ -223,8 +223,6 @@ const PropertyLog = (props: Props) => {
   useEffect(() => {
   useEffect(() => {
     setRadioValue('today');
     setRadioValue('today');
     setTab('table');
     setTab('table');
-    setStart(moment().startOf('day').valueOf());
-    setEnd(new Date().getTime());
   }, []);
   }, []);
 
 
   const renderComponent = (type: string) => {
   const renderComponent = (type: string) => {

+ 1 - 1
src/pages/device/Instance/Detail/Running/Property/PropertyCard.tsx

@@ -49,7 +49,7 @@ const Property = (props: Props) => {
           <Tooltip title={title}>{title}</Tooltip>
           <Tooltip title={title}>{title}</Tooltip>
         </div>
         </div>
         <Space style={{ fontSize: 12 }}>
         <Space style={{ fontSize: 12 }}>
-          {(data.expands?.readOnly === false || data.expands?.readOnly === 'false') && (
+          {data.expands?.type.includes('write') && (
             <Tooltip placement="top" title="设置属性至设备">
             <Tooltip placement="top" title="设置属性至设备">
               <EditOutlined
               <EditOutlined
                 onClick={() => {
                 onClick={() => {

+ 2 - 0
src/pages/device/Instance/Detail/Running/Property/index.tsx

@@ -196,6 +196,8 @@ const Property = (props: Props) => {
     if (dataSource.data.length > 0) {
     if (dataSource.data.length > 0) {
       getDashboard();
       getDashboard();
       subscribeProperty();
       subscribeProperty();
+    } else {
+      setLoading(false);
     }
     }
   }, [dataSource]);
   }, [dataSource]);
 
 

+ 4 - 0
src/pages/device/Product/Save/index.tsx

@@ -87,6 +87,10 @@ const Save = (props: Props) => {
         }
         }
         props.close();
         props.close();
         form.resetFields();
         form.resetFields();
+        if ((window as any).onTabSaveSuccess) {
+          (window as any).onTabSaveSuccess(res);
+          setTimeout(() => window.close(), 300);
+        }
       }
       }
     }
     }
   };
   };

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

@@ -12,7 +12,7 @@ import {
 import Service from '@/pages/device/Product/service';
 import Service from '@/pages/device/Product/service';
 import { observer } from '@formily/react';
 import { observer } from '@formily/react';
 import { model } from '@formily/reactive';
 import { model } from '@formily/reactive';
-import { useHistory } from 'umi';
+import { useHistory, useLocation } from 'umi';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import { useEffect, useRef, useState } from 'react';
 import { useEffect, useRef, useState } from 'react';
@@ -78,6 +78,15 @@ const Product = observer(() => {
     ),
     ),
   };
   };
 
 
+  const location = useLocation();
+
+  useEffect(() => {
+    if ((location as any).query?.save === 'true') {
+      setCurrent(undefined);
+      setVisible(true);
+    }
+  }, []);
+
   const deleteItem = async (id: string) => {
   const deleteItem = async (id: string) => {
     const response: any = await service.remove(id);
     const response: any = await service.remove(id);
     if (response.status === 200) {
     if (response.status === 200) {

+ 36 - 0
src/pages/home/components/Guide.tsx

@@ -0,0 +1,36 @@
+import { Card, Col, Row } from 'antd';
+
+interface Props {
+  title: string;
+  data: any[];
+  jump?: (auth: boolean, url: string, param: string) => void;
+}
+
+const Guide = (props: Props) => {
+  const { title, data, jump } = props;
+  return (
+    <Card>
+      <div style={{ marginBottom: 15 }}>
+        <h3>{title}</h3>
+      </div>
+      <Row gutter={24}>
+        {data.map((item) => (
+          <Col key={item.key} span={8}>
+            <Card
+              bordered
+              onClick={() => {
+                if (jump) {
+                  jump(item.auth, item.url, item.param);
+                }
+              }}
+            >
+              {item.name}
+            </Card>
+          </Col>
+        ))}
+      </Row>
+    </Card>
+  );
+};
+
+export default Guide;

+ 29 - 0
src/pages/home/components/Statistics.tsx

@@ -0,0 +1,29 @@
+import { Card, Col, Row } from 'antd';
+
+const Statistics = () => {
+  return (
+    <Card
+      title={'设备统计'}
+      extra={
+        <a
+          onClick={() => {
+            // pageJump(!!getMenuPathByCode('device/DashBoard'), 'device/DashBoard');
+          }}
+        >
+          详情
+        </a>
+      }
+    >
+      <Row gutter={24}>
+        <Col span={12}>
+          <Card bordered>产品数量</Card>
+        </Col>
+        <Col span={12}>
+          <Card bordered>设备数量</Card>
+        </Col>
+      </Row>
+    </Card>
+  );
+};
+
+export default Statistics;

+ 68 - 0
src/pages/home/components/Steps.tsx

@@ -0,0 +1,68 @@
+import { RightOutlined } from '@ant-design/icons';
+import { Card, Col, Row } from 'antd';
+
+const Steps = () => {
+  return (
+    <Card title={'设备接入推荐步骤'}>
+      <Row gutter={24}>
+        <Col span={4}>
+          <Card
+            bordered
+            title="创建产品"
+            onClick={() => {
+              // pageJump(!!devicePermission.add, 'device/Instance')
+            }}
+          >
+            产品是设备的集合,通常指一组具有相同功能的设备。物联设备必须通过产品进行接入方式配置。
+          </Card>
+        </Col>
+        <Col span={1}>
+          <RightOutlined />
+        </Col>
+        <Col span={4}>
+          <Card bordered title="配置产品接入方式" onClick={() => {}}>
+            通过产品对同一类型的所有设备进行统一的接入方式配置。请参照设备铭牌说明选择匹配的接入方式。
+          </Card>
+        </Col>
+        <Col span={1}>
+          <RightOutlined />
+        </Col>
+        <Col span={4}>
+          <Card
+            bordered
+            title="添加测试设备"
+            onClick={() => {
+              // pageJump(!!devicePermission.add, 'device/Instance')
+            }}
+          >
+            添加单个设备,用于验证产品模型是否配置正确。
+          </Card>
+        </Col>
+        <Col span={1}>
+          <RightOutlined />
+        </Col>
+        <Col span={4}>
+          <Card bordered title="功能调试" onClick={() => {}}>
+            对添加的测试设备进行功能调试,验证能否连接到平台,设备功能是否配置正确。
+          </Card>
+        </Col>
+        <Col span={1}>
+          <RightOutlined />
+        </Col>
+        <Col span={4}>
+          <Card
+            bordered
+            title="批量添加设备"
+            onClick={() => {
+              // pageJump(!!devicePermission.add, 'device/Instance')
+            }}
+          >
+            批量添加同一产品下的设备
+          </Card>
+        </Col>
+      </Row>
+    </Card>
+  );
+};
+
+export default Steps;

+ 97 - 1
src/pages/home/device/index.tsx

@@ -1,4 +1,100 @@
+import { Card, Col, message, Row } from 'antd';
+import { PermissionButton } from '@/components';
+import { getMenuPathByCode } from '@/utils/menu';
+import Guide from '../components/Guide';
+import Statistics from '../components/Statistics';
+import Steps from '../components/Steps';
+
 const Device = () => {
 const Device = () => {
-  return <div>设备接入视图</div>;
+  const productPermission = PermissionButton.usePermission('device/Product').permission;
+  const devicePermission = PermissionButton.usePermission('device/Instance').permission;
+  const rulePermission = PermissionButton.usePermission('rule-engine/Instance').permission;
+  // // 跳转
+  const pageJump = (auth: boolean, url: string, param: string) => {
+    if (auth) {
+      // 判断是否有权限
+      const path = getMenuPathByCode(url);
+      if (path) {
+        const tab: any = window.open(`${origin}/#${path}${param}`);
+        tab!.onTabSaveSuccess = () => {
+          // if (value.status === 200) {
+          // }
+        };
+      }
+    } else {
+      message.error('暂无权限,请联系管理员');
+    }
+  };
+
+  const guideList = [
+    {
+      key: 'product',
+      name: '1、创建产品',
+      auth: !!productPermission.add,
+      url: 'device/Product',
+      param: '?save=true',
+    },
+    {
+      key: 'device',
+      name: '2、创建设备',
+      auth: !!devicePermission.add,
+      url: 'device/Instance',
+      param: '?save=true',
+    },
+    {
+      key: 'rule-engine',
+      name: '3、规则引擎',
+      auth: !!rulePermission.add,
+      url: 'rule-engine/Instance',
+      param: '?save=true',
+    },
+  ];
+
+  // const statisticsList = [{
+  //   key: 'product',
+  //   name: '1、创建产品',
+  //   auth: !!productPermission.add,
+  //   url: 'device/Product',
+  //   param: "?save=true"
+  // }, {
+  //   key: 'device',
+  //   name: '2、创建设备',
+  //   auth: !!devicePermission.add,
+  //   url: 'device/Instance',
+  //   param: "?save=true"
+  // },
+  // {
+  //   key: 'rule-engine',
+  //   name: '3、规则引擎',
+  //   auth: !!rulePermission.add,
+  //   url: 'rule-engine/Instance',
+  //   param: "?save=true"
+  // }
+  // ];
+
+  return (
+    <Row gutter={24}>
+      <Col span={12}>
+        <Guide
+          title="物联网引导"
+          data={guideList}
+          jump={(auth: boolean, url: string, param: string) => {
+            pageJump(auth, url, param);
+          }}
+        />
+      </Col>
+      <Col span={12}>
+        <Statistics />
+      </Col>
+      <Col span={24}>
+        <Card style={{ margin: '20px 0' }} title="平台架构图">
+          <img style={{ height: 500 }} src={require('/public/images/login.png')} />
+        </Card>
+      </Col>
+      <Col span={24}>
+        <Steps />
+      </Col>
+    </Row>
+  );
 };
 };
 export default Device;
 export default Device;

+ 7 - 0
src/pages/link/Certificate/index.tsx

@@ -25,6 +25,13 @@ const Certificate = () => {
       dataIndex: 'type',
       dataIndex: 'type',
       title: '证书标准',
       title: '证书标准',
       render: (text: any) => <span>{text?.text || '-'}</span>,
       render: (text: any) => <span>{text?.text || '-'}</span>,
+      valueType: 'select',
+      valueEnum: {
+        common: {
+          text: '国际标准',
+          status: 'common',
+        },
+      },
     },
     },
     {
     {
       dataIndex: 'name',
       dataIndex: 'name',

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

@@ -52,7 +52,7 @@ const Channel = () => {
           style={{ marginTop: 10, width: '100%' }}
           style={{ marginTop: 10, width: '100%' }}
           onClick={async () => {
           onClick={async () => {
             if (!!data) {
             if (!!data) {
-              const resp: any = await service.editBindInfo(record.gbChannelId, {
+              const resp: any = await service.editBindInfo(record.id, {
                 gbChannelId: data,
                 gbChannelId: data,
               });
               });
               if (resp.status === 200) {
               if (resp.status === 200) {
@@ -88,7 +88,7 @@ const Channel = () => {
         <span>
         <span>
           {text}
           {text}
           <Popover
           <Popover
-            visible={popVisible === record.gbChannelId}
+            visible={popVisible === record.id}
             trigger="click"
             trigger="click"
             content={content(record)}
             content={content(record)}
             title={
             title={
@@ -114,7 +114,7 @@ const Channel = () => {
               style={{ marginLeft: 10 }}
               style={{ marginLeft: 10 }}
               onClick={() => {
               onClick={() => {
                 setData('');
                 setData('');
-                setPopvisible(record.gbChannelId);
+                setPopvisible(record.id);
               }}
               }}
             >
             >
               <EditOutlined />
               <EditOutlined />

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

@@ -42,6 +42,7 @@ const UserManage = () => {
       }),
       }),
       align: 'center',
       align: 'center',
       dataIndex: 'username',
       dataIndex: 'username',
+      ellipsis: true,
     },
     },
     {
     {
       title: '创建时间',
       title: '创建时间',