Просмотр исходного кода

feat(merge): merge sc

fix: 修改bug
Lind 3 лет назад
Родитель
Сommit
5e115f8aeb

+ 6 - 2
src/components/ProTableCard/CardItems/noticeTemplate.tsx

@@ -66,7 +66,9 @@ export default (props: NoticeCardProps) => {
         <div className={'card-item-body'}>
           <div className={'card-item-header'}>
             <span className={'card-item-header-name ellipsis'}>
-              <Tooltip title={props.name}>{props.name}</Tooltip>
+              <Tooltip placement="topLeft" title={props.name}>
+                {props.name}
+              </Tooltip>
             </span>
           </div>
           <div className={'card-item-content'}>
@@ -77,7 +79,9 @@ export default (props: NoticeCardProps) => {
             <div>
               <label>说明</label>
               <div className={'ellipsis'}>
-                <Tooltip title={props.description}>{props.description}</Tooltip>
+                <Tooltip placement="topLeft" title={props.description}>
+                  {props.description}
+                </Tooltip>
               </div>
             </div>
           </div>

+ 7 - 1
src/pages/account/NotificationSubscription/save/index.tsx

@@ -185,7 +185,13 @@ const Save = (props: Props) => {
   };
 
   return (
-    <Modal title={'详情'} visible onCancel={props.close} onOk={() => handleSave()} width={'45vw'}>
+    <Modal
+      title={props.data.id ? '编辑' : '新增'}
+      visible
+      onCancel={props.close}
+      onOk={() => handleSave()}
+      width={'45vw'}
+    >
       <Form form={form} layout="vertical">
         <SchemaField
           schema={schema}

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

@@ -223,8 +223,6 @@ const PropertyLog = (props: Props) => {
   useEffect(() => {
     setRadioValue('today');
     setTab('table');
-    setStart(moment().startOf('day').valueOf());
-    setEnd(new Date().getTime());
   }, []);
 
   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>
         </div>
         <Space style={{ fontSize: 12 }}>
-          {(data.expands?.readOnly === false || data.expands?.readOnly === 'false') && (
+          {data.expands?.type.includes('write') && (
             <Tooltip placement="top" title="设置属性至设备">
               <EditOutlined
                 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) {
       getDashboard();
       subscribeProperty();
+    } else {
+      setLoading(false);
     }
   }, [dataSource]);
 

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

@@ -87,6 +87,10 @@ const Save = (props: Props) => {
         }
         props.close();
         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 { observer } from '@formily/react';
 import { model } from '@formily/reactive';
-import { useHistory } from 'umi';
+import { useHistory, useLocation } from 'umi';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 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 response: any = await service.remove(id);
     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 = () => {
-  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;

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

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

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

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

+ 0 - 160
src/pages/rule-engine/DashBoard/index.tsx

@@ -1,160 +0,0 @@
-import { PageContainer } from '@ant-design/pro-layout';
-import { EChartsOption } from 'echarts';
-import { useState } from 'react';
-import { Statistic, StatisticCard } from '@ant-design/pro-card';
-import { Card, Select } from 'antd';
-import './index.less';
-import Header from '@/components/DashBoard/header';
-import Echarts from '@/components/DashBoard/echarts';
-
-const imgStyle = {
-  display: 'block',
-  width: 42,
-  height: 42,
-};
-
-const Dashboard = () => {
-  const [options, setOptions] = useState<EChartsOption>({});
-
-  const getEcharts = async (params: any) => {
-    // 请求数据
-    console.log(params);
-
-    setOptions({
-      xAxis: {
-        type: 'category',
-        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
-      },
-      yAxis: {
-        type: 'value',
-      },
-      series: [
-        {
-          data: [150, 230, 224, 218, 135, 147, 260],
-          type: 'line',
-        },
-      ],
-    });
-  };
-
-  return (
-    <PageContainer>
-      <div style={{ display: 'flex' }}>
-        <StatisticCard
-          title="今日告警"
-          statistic={{
-            value: 75,
-            suffix: '次',
-          }}
-          chart={
-            <img
-              src="https://gw.alipayobjects.com/zos/alicdn/PmKfn4qvD/mubiaowancheng-lan.svg"
-              width="100%"
-              alt="进度条"
-            />
-          }
-          footer={
-            <>
-              <Statistic value={15.1} title="当月告警" suffix="次" layout="horizontal" />
-            </>
-          }
-          style={{ width: '24%', marginRight: '5px' }}
-        />
-        <StatisticCard
-          statistic={{
-            title: '告警配置',
-            value: 2176,
-            icon: (
-              <img
-                style={imgStyle}
-                src="https://gw.alipayobjects.com/mdn/rms_7bc6d8/afts/img/A*dr_0RKvVzVwAAAAAAAAAAABkARQnAQ"
-                alt="icon"
-              />
-            ),
-          }}
-          style={{ width: '25%', marginRight: '5px' }}
-          footer={
-            <div style={{ display: 'flex', justifyContent: 'space-between' }}>
-              <Statistic value={76} title="正常" suffix="次" layout="horizontal" />
-              <Statistic value={76} title="禁用" suffix="次" layout="horizontal" />
-            </div>
-          }
-        />
-        <div style={{ width: '50%' }}>
-          <StatisticCard
-            title="最新告警"
-            statistic={{
-              // title: '最新告警'
-              value: undefined,
-            }}
-            chart={
-              <ul>
-                {[
-                  {
-                    dateTime: '2022-01-01 00:00:00',
-                    name: '一楼烟感告警',
-                    product: '产品',
-                    level: '1极告警',
-                  },
-                  {
-                    dateTime: '2022-01-01 00:00:00',
-                    name: '一楼烟感告警',
-                    product: '产品',
-                    level: '1极告警',
-                  },
-                  {
-                    dateTime: '2022-01-01 00:00:00',
-                    name: '一楼烟感告警',
-                    product: '产品',
-                    level: '1极告警',
-                  },
-                  {
-                    dateTime: '2022-01-01 00:00:00',
-                    name: '一楼烟感告警',
-                    product: '产品',
-                    level: '1极告警',
-                  },
-                ].map((item) => (
-                  <li>
-                    <div style={{ display: 'flex', justifyContent: 'space-between' }}>
-                      <div>{item.dateTime}</div>
-                      <div>{item.name}</div>
-                      <div>{item.product}</div>
-                      <div>{item.level}</div>
-                    </div>
-                  </li>
-                ))}
-              </ul>
-            }
-          />
-        </div>
-      </div>
-      <Card style={{ marginTop: 10 }}>
-        <div
-          // className={classNames(Style['dash-board-echarts'], className)}
-          style={{
-            height: 200,
-          }}
-        >
-          <Header
-            title={'告警统计'}
-            extraParams={{
-              key: 'test',
-              Children: (
-                <Select
-                  options={[
-                    { label: '设备', value: 'device' },
-                    { label: '产品', value: 'product' },
-                  ]}
-                ></Select>
-              ),
-            }}
-            onParamsChange={getEcharts}
-          />
-          <Echarts options={options} />
-        </div>
-      </Card>
-    </PageContainer>
-  );
-};
-export default Dashboard;

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

@@ -130,7 +130,7 @@ const DataSource = observer(() => {
         <PermissionButton
           style={{ padding: 0 }}
           type="link"
-          isPermission={userPermission.update}
+          isPermission={userPermission.action}
           key="manage"
           onClick={() => {
             const url = getMenuPathByCode(MENUS_CODE[`system/DataSource/Management`]);

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

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