Quellcode durchsuchen

Merge pull request #743 from jetlinks/next-hub

Next hub
胡彪 vor 3 Jahren
Ursprung
Commit
a0d2f11c37

BIN
public/images/home/content1.png


Datei-Diff unterdrückt, da er zu groß ist
+ 30 - 0
public/images/home/content1.svg


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

@@ -329,7 +329,7 @@ const ProTableCard = <
                     ? num / pageSize - 1
                     : parseInt(num / pageSize);
                 const min = minSize > num ? pageIndexInt * pageSize + 1 : minSize;
-
+                if (min === 1) pageChange(min, pageSize);
                 return `第 ${min} - ${max} 条/总共 ${num} 条`;
               }}
             />

+ 1 - 1
src/pages/DataCollect/Collector/components/Tree/index.tsx

@@ -154,7 +154,7 @@ export default observer((props: Props) => {
             style={{ overflow: 'hidden' }}
             className={styles['data-collect-tree']}
             showIcon
-            height={500}
+            height={document.body.clientHeight < 1000 ? document.body.clientHeight * 0.7 : 650}
             selectedKeys={TreeModel.selectedKeys}
             defaultExpandAll
             autoExpandParent

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

@@ -90,7 +90,7 @@ const Metadata = observer((props: Props) => {
             <PermissionButton isPermission={true} onClick={() => setCat(true)}>
               {intl.formatMessage({
                 id: 'pages.device.productDetail.metadata',
-                defaultMessage: '物模型',
+                defaultMessage: '物模型TSL',
               })}
               TSL
             </PermissionButton>

+ 2 - 1
src/pages/home/comprehensive/index.tsx

@@ -188,7 +188,8 @@ const Comprehensive = () => {
             <Body
               title={'平台架构图'}
               english={'PLATFORM ARCHITECTURE DIAGRAM'}
-              url={require('/public/images/home/content1.png')}
+              // url={require('/public/images/home/content1.png')}
+              url={require('/public/images/home/content1.svg')}
             />
           </Col>
         </Row>

+ 4 - 2
src/pages/iot-card/Platform/Detail/index.tsx

@@ -15,6 +15,7 @@ const Detail = observer(() => {
   const params = useParams<{ id: string }>();
   const { initialState } = useModel('@@initialState');
   const [docType, setDocType] = useState('');
+  const [loading, setLoading] = useState(false);
 
   const form = useMemo(
     () =>
@@ -364,12 +365,13 @@ const Detail = observer(() => {
 
   const handleSave = async () => {
     const data: any = await form.submit();
+    setLoading(true);
     const res: any = params.id === ':id' ? await service.save(data) : await service.update(data);
     if (res.status === 200) {
       onlyMessage('保存成功');
       history.back();
     }
-    // console.log(data);
+    setLoading(false);
   };
 
   useEffect(() => {
@@ -397,7 +399,7 @@ const Detail = observer(() => {
               />
               <FormButtonGroup.Sticky>
                 <FormButtonGroup.FormItem>
-                  <Button type="primary" onClick={() => handleSave()}>
+                  <Button type="primary" onClick={() => handleSave()} loading={loading}>
                     保存
                   </Button>
                 </FormButtonGroup.FormItem>

+ 28 - 1
src/pages/link/AccessConfig/index.tsx

@@ -85,13 +85,40 @@ const AccessConfig = () => {
       });
   };
 
+  const getUrlParams = (url) => {
+    if (!url.includes('?')) return;
+    const urlStr = url.split('?')[1];
+    const obj = {};
+    const paramsArr = urlStr.split('&');
+    for (let i = 0; i < paramsArr.length; i++) {
+      const arr = paramsArr[i].split('=');
+      obj[arr[0]] = arr[1];
+    }
+    return obj;
+  };
+
   useEffect(() => {
     service.getProviders().then((resp: any) => {
       if (resp.status === 200) {
         Store.set('access-providers', resp.result);
       }
     });
-    handleSearch(param);
+    const paramSearch = param;
+    const paramsQ = getUrlParams(decodeURIComponent(window.location.href));
+    if (paramsQ?.q) {
+      const params = JSON.parse(paramsQ?.q);
+      const terms = [
+        {
+          terms: params.terms1.filter((item) => !!item.value),
+        },
+        {
+          terms: params.terms2.filter((item) => !!item.value),
+          type: params.type,
+        },
+      ];
+      paramSearch.terms = terms;
+    }
+    handleSearch(paramSearch);
   }, []);
 
   return (

+ 4 - 17
src/pages/notice/Config/index.tsx

@@ -22,7 +22,6 @@ import SearchComponent from '@/components/SearchComponent';
 import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
 import { history } from 'umi';
 import { model } from '@formily/reactive';
-import moment from 'moment';
 import { PermissionButton, ProTableCard } from '@/components';
 import NoticeConfig from '@/components/ProTableCard/CardItems/noticeConfig';
 import Debug from '@/pages/notice/Config/Debug';
@@ -129,17 +128,12 @@ const Config = observer(() => {
           type="link"
           style={{ padding: 0 }}
           isPermission={configPermission.export}
-          onClick={() =>
-            downloadObject(
-              record,
-              `通知配置${record.name}-${moment(new Date()).format('YYYY/MM/DD HH:mm:ss')}`,
-            )
-          }
+          onClick={() => downloadObject(record, `通知配置_${record.name}`)}
           key="download"
           tooltip={{
             title: intl.formatMessage({
-              id: 'pages.data.option.download',
-              defaultMessage: '下载配置',
+              id: 'pages.data.option.export',
+              defaultMessage: '导出',
             }),
           }}
         >
@@ -376,14 +370,7 @@ const Config = observer(() => {
                         type={'link'}
                         key="export"
                         isPermission={configPermission.export}
-                        onClick={() =>
-                          downloadObject(
-                            record,
-                            `通知配置${record.name}-${moment(new Date()).format(
-                              'YYYY/MM/DD HH:mm:ss',
-                            )}`,
-                          )
-                        }
+                        onClick={() => downloadObject(record, `通知配置_${record.name}`)}
                       >
                         <ArrowDownOutlined />
                         导出

+ 2 - 6
src/pages/notice/Template/index.tsx

@@ -21,7 +21,6 @@ import { model } from '@formily/reactive';
 import Debug from './Debug';
 import Log from '@/pages/notice/Template/Log';
 import { downloadObject, onlyMessage } from '@/utils/util';
-import moment from 'moment';
 import { PermissionButton, ProTableCard } from '@/components';
 import NoticeCard, {
   typeList,
@@ -113,7 +112,7 @@ const Template = observer(() => {
           tooltip={{ title: '导出' }}
           isPermission={templatePermission.export}
           onClick={() => {
-            downloadObject(record, `${record.name}-${moment(new Date()).format('YYYY_MM_DD')}`);
+            downloadObject(record, `通知模板_${record.name}`);
           }}
         >
           <ArrowDownOutlined />
@@ -308,10 +307,7 @@ const Template = observer(() => {
                 key="export"
                 isPermission={templatePermission.export}
                 onClick={() => {
-                  downloadObject(
-                    record,
-                    `${record.name}-${moment(new Date()).format('YYYY/MM/DD HH:mm:ss')}`,
-                  );
+                  downloadObject(record, `通知模板_${record.name}`);
                 }}
               >
                 <ArrowDownOutlined />

+ 1 - 1
src/utils/util.ts

@@ -53,7 +53,7 @@ export const downloadFileByUrl = (url: string, name: string, type: string) => {
 export const downloadObject = (record: Record<string, any>, fileName: string, format?: string) => {
   // 创建隐藏的可下载链接
   const ghostLink = document.createElement('a');
-  ghostLink.download = `${record?.name || ''}${fileName}_${moment(new Date()).format(
+  ghostLink.download = `${fileName ? '' : record?.name}${fileName}_${moment(new Date()).format(
     format || 'YYYY_MM_DD',
   )}.json`;
   ghostLink.style.display = 'none';