wzyyy %!s(int64=3) %!d(string=hai) anos
pai
achega
e994d3db06

+ 2 - 1
src/pages/account/NotificationSubscription/index.tsx

@@ -96,6 +96,7 @@ const NotificationSubscription = observer(() => {
         type={'link'}
         isPermission={true}
         style={{ padding: 0 }}
+        disabled={record?.state?.value !== 'disabled'}
         popConfirm={{
           title: '确认删除?',
           onConfirm: async () => {
@@ -109,7 +110,7 @@ const NotificationSubscription = observer(() => {
           },
         }}
         tooltip={{
-          title: '删除',
+          title: record?.state?.value !== 'disabled' ? '请先禁用,再删除' : '删除',
         }}
       >
         <DeleteOutlined />

+ 12 - 34
src/pages/device/Instance/Detail/MetadataLog/Property/index.tsx

@@ -5,12 +5,11 @@ import type { PropertyMetadata } from '@/pages/device/Product/typings';
 import encodeQuery from '@/utils/encodeQuery';
 import { useEffect, useState } from 'react';
 import moment from 'moment';
-import { Axis, Chart, Geom, Legend, Slider, Tooltip } from 'bizcharts';
+import { Axis, Chart, LineAdvance, Legend, Slider, Tooltip, Point } from 'bizcharts';
 import FileComponent from '../../Running/Property/FileComponent';
 import { DownloadOutlined, SearchOutlined } from '@ant-design/icons';
 import Detail from './Detail';
 import AMap from './AMap';
-
 interface Props {
   close: () => void;
   data: Partial<PropertyMetadata>;
@@ -170,6 +169,7 @@ const PropertyLog = (props: Props) => {
       const dataList: any[] = [];
       resp.result.forEach((i: any) => {
         dataList.push({
+          ...i,
           year: moment(i.time).format('YYYY-MM-DD HH:mm:ss'),
           value: Number(i[data.id || '']),
           type: data?.name || '',
@@ -189,9 +189,10 @@ const PropertyLog = (props: Props) => {
   const scale = {
     value: { min: 0 },
     year: {
-      range: [0, 1],
-      type: 'timeCat',
+      type: 'time',
       mask: 'YYYY-MM-DD HH:mm:ss',
+      max: end,
+      min: start,
     },
   };
 
@@ -215,7 +216,7 @@ const PropertyLog = (props: Props) => {
             dataSource={dataSource?.data || []}
             columns={data?.valueType?.type === 'geoPoint' ? geoColumns : columns}
             pagination={{
-              current: dataSource?.pageIndex + 1,
+              current: (dataSource?.pageIndex || 0) + 1,
               pageSize: dataSource?.pageSize || 10,
               showSizeChanger: true,
               total: dataSource?.total || 0,
@@ -297,8 +298,8 @@ const PropertyLog = (props: Props) => {
                 </div>
               )}
             </div>
-            <div style={{ paddingTop: 15 }}>
-              <Chart height={400} data={chartsList} scale={scale} autoFit>
+            <div style={{ marginTop: 10 }}>
+              <Chart height={400} data={chartsList} scale={scale} padding="auto" autoFit>
                 <Legend />
                 <Axis name="year" />
                 <Axis
@@ -307,33 +308,9 @@ const PropertyLog = (props: Props) => {
                     formatter: (val) => parseFloat(val).toLocaleString(),
                   }}
                 />
-                <Tooltip showCrosshairs shared />
-                <Geom
-                  type="line"
-                  tooltip={[
-                    'value*type',
-                    (value, name) => {
-                      return {
-                        value: value,
-                        name,
-                      };
-                    },
-                  ]}
-                  position="year*value"
-                  size={2}
-                />
-                <Geom
-                  type="point"
-                  tooltip={false}
-                  position="year*value"
-                  size={4}
-                  shape={'circle'}
-                  style={{
-                    stroke: '#fff',
-                    lineWidth: 1,
-                  }}
-                />
-                <Geom type="area" position="year*value" shape={'circle'} tooltip={false} />
+                <Tooltip shared />
+                <Point position="year*value" />
+                <LineAdvance position="year*value" shape="smooth" area />
                 <Slider />
               </Chart>
             </div>
@@ -390,6 +367,7 @@ const PropertyLog = (props: Props) => {
           }
         });
     }
+    setDateValue([moment(start), moment(end)]);
   }, [start, end]);
 
   // @ts-ignore

+ 35 - 9
src/pages/system/Platforms/View/index.tsx

@@ -1,9 +1,10 @@
 import { PageContainer } from '@ant-design/pro-layout';
-import { Button, Card, Col, Popover, Row } from 'antd';
+import { Button, Card, Col, Input, Popover, Row } from 'antd';
 import ApiPage from '../Api/base';
 import { useEffect, useState } from 'react';
 import { useLocation } from 'umi';
 import { service } from '@/pages/system/Platforms';
+import * as moment from 'moment';
 
 const defaultHeight = 50;
 
@@ -12,6 +13,7 @@ export default () => {
 
   const [clientId, setClientId] = useState('');
   const [secureKey, setSecureKey] = useState('');
+  const [sdkDetail, setSdkDetail] = useState<any>({});
 
   const getDetail = async (id: string) => {
     const resp = await service.getDetail(id);
@@ -21,6 +23,26 @@ export default () => {
     }
   };
 
+  const getSDKDetail = async () => {
+    const resp = await service.getSdk();
+    if (resp.status === 200) {
+      setSdkDetail(resp.result[0]);
+    }
+  };
+
+  const downLoad = (url: string) => {
+    if (url) {
+      const downNode = document.createElement('a');
+      downNode.href = url;
+      downNode.download = `${moment(new Date()).format('YYYY-MM-DD-HH-mm-ss')}.sdk`;
+      downNode.style.display = 'none';
+      downNode.setAttribute('target', '_blank');
+      document.body.appendChild(downNode);
+      downNode.click();
+      document.body.removeChild(downNode);
+    }
+  };
+
   useEffect(() => {
     const param = new URLSearchParams(location.search);
     const code = param.get('code');
@@ -31,25 +53,29 @@ export default () => {
 
   useEffect(() => {
     //  请求SDK下载地址
+    getSDKDetail();
   }, []);
 
   const downLoadJDK = (
     <div>
       <div
         style={{
-          width: 300,
-          height: 120,
-          padding: 12,
-          border: '1px solid #e9e9e9',
+          width: 500,
           borderRadius: 2,
           marginBottom: 12,
         }}
       >
-        暂时没有接口
-      </div>
-      <div>
-        <Button type={'primary'}>jar下载</Button>
+        <Input.TextArea value={sdkDetail?.dependency} rows={6} readOnly />
       </div>
+      <Button
+        type={'primary'}
+        style={{ width: '100%' }}
+        onClick={() => {
+          downLoad(sdkDetail.sdk);
+        }}
+      >
+        jar下载
+      </Button>
     </div>
   );
 

+ 11 - 3
src/pages/system/Platforms/save.tsx

@@ -1,4 +1,4 @@
-import { createForm } from '@formily/core';
+import { createForm, onFieldValueChange } from '@formily/core';
 import type { Field } from '@formily/core';
 import { createSchemaField } from '@formily/react';
 import {
@@ -79,6 +79,13 @@ export default (props: SaveProps) => {
     () =>
       createForm({
         validateFirst: false,
+        effects() {
+          onFieldValueChange('enableOAuth2', (field) => {
+            form.setFieldState('redirectUrl', (state) => {
+              state.display = field.value ? 'visible' : 'none';
+            });
+          });
+        },
       }),
     [props.data],
   );
@@ -100,7 +107,8 @@ export default (props: SaveProps) => {
       } else {
         form.setValues({
           enableOAuth2: true,
-          id: randomString(),
+          id: randomString(16),
+          secureKey: randomString(),
         });
       }
     } else {
@@ -362,7 +370,7 @@ export default (props: SaveProps) => {
             ],
           },
           redirectUrl: {
-            type: 'boolean',
+            type: 'string',
             title: 'redirectUrl',
             required: true,
             'x-decorator': 'FormItem',

+ 6 - 1
src/pages/system/Platforms/service.ts

@@ -4,7 +4,7 @@ import SystemConst from '@/utils/const';
 
 class Service extends BaseService<platformsType> {
   queryRoleList = (params?: any) =>
-    request(`${SystemConst.API_BASE}/role/_query/no-paging?paging=false`, {
+    request(`/${SystemConst.API_BASE}/role/_query/no-paging?paging=false`, {
       method: 'GET',
       params,
     });
@@ -66,6 +66,11 @@ class Service extends BaseService<platformsType> {
    */
   apiOperations = () =>
     request(`/${SystemConst.API_BASE}/api-client/operations`, { method: 'GET' });
+
+  /**
+   * 获取可授权的接口ID
+   */
+  getSdk = () => request(`${this.uri}/sdk`, { method: 'GET' });
 }
 
 export default Service;