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

fix: 去掉数据采集按钮权限

100011797 3 лет назад
Родитель
Сommit
f208ae7ed2

+ 27 - 14
src/pages/device/data.ts

@@ -1,3 +1,5 @@
+import { isNoCommunity } from '@/utils/util';
+
 export const DataTypeList: { label: string; value: string }[] = [
   {
     value: 'int',
@@ -53,20 +55,31 @@ export const DataTypeList: { label: string; value: string }[] = [
   },
 ];
 
-export const PropertySource: { label: string; value: string }[] = [
-  {
-    value: 'device',
-    label: '设备',
-  },
-  {
-    value: 'manual',
-    label: '手动',
-  },
-  {
-    value: 'rule',
-    label: '规则',
-  },
-];
+export const PropertySource: { label: string; value: string }[] = isNoCommunity
+  ? [
+      {
+        value: 'device',
+        label: '设备',
+      },
+      {
+        value: 'manual',
+        label: '手动',
+      },
+      {
+        value: 'rule',
+        label: '规则',
+      },
+    ]
+  : [
+      {
+        value: 'device',
+        label: '设备',
+      },
+      {
+        value: 'manual',
+        label: '手动',
+      },
+    ];
 
 export const FileTypeList: { label: string; value: string }[] = [
   {

+ 0 - 3
src/pages/link/DataCollect/components/Channel/Save/index.tsx

@@ -6,7 +6,6 @@ import * as ICONS from '@ant-design/icons';
 import { Form, FormGrid, FormItem, Input, Select, NumberPicker, Password } from '@formily/antd';
 import type { ISchema } from '@formily/json-schema';
 import service from '@/pages/link/DataCollect/service';
-import { PermissionButton } from '@/components';
 import { onlyMessage } from '@/utils/util';
 import { action } from '@formily/reactive';
 
@@ -17,7 +16,6 @@ interface Props {
 }
 
 export default (props: Props) => {
-  const { permission } = PermissionButton.usePermission('link/Protocol');
   const [data, setData] = useState<Partial<ChannelItem>>(props.data);
   const [loading, setLoading] = useState<boolean>(false);
 
@@ -333,7 +331,6 @@ export default (props: Props) => {
             save();
           }}
           loading={loading}
-          disabled={props.data?.id ? !permission.update : !permission.add}
         >
           确定
         </Button>,

+ 0 - 3
src/pages/link/DataCollect/components/Device/Save/index.tsx

@@ -6,7 +6,6 @@ import * as ICONS from '@ant-design/icons';
 import { Form, FormGrid, FormItem, Input, Select, NumberPicker, Password } from '@formily/antd';
 import type { ISchema } from '@formily/json-schema';
 import service from '@/pages/link/DataCollect/service';
-import { PermissionButton } from '@/components';
 import { onlyMessage } from '@/utils/util';
 
 interface Props {
@@ -17,7 +16,6 @@ interface Props {
 }
 
 export default (props: Props) => {
-  const { permission } = PermissionButton.usePermission('link/Protocol');
   const [data, setData] = useState<Partial<ChannelItem>>(props.data);
 
   useEffect(() => {
@@ -195,7 +193,6 @@ export default (props: Props) => {
           onClick={() => {
             save();
           }}
-          disabled={props.data?.id ? !permission.update : !permission.add}
         >
           确定
         </Button>,

+ 0 - 3
src/pages/link/DataCollect/components/Point/Save/modbus.tsx

@@ -15,7 +15,6 @@ import {
 } from '@formily/antd';
 import type { ISchema } from '@formily/json-schema';
 import service from '@/pages/link/DataCollect/service';
-import { PermissionButton } from '@/components';
 import { onlyMessage } from '@/utils/util';
 
 interface Props {
@@ -25,7 +24,6 @@ interface Props {
 }
 
 export default (props: Props) => {
-  const { permission } = PermissionButton.usePermission('link/Protocol');
   const [data, setData] = useState<Partial<PointItem>>(props.data);
 
   useEffect(() => {
@@ -297,7 +295,6 @@ export default (props: Props) => {
           onClick={() => {
             save();
           }}
-          disabled={props.data?.id ? !permission.update : !permission.add}
         >
           确定
         </Button>,

+ 0 - 3
src/pages/link/DataCollect/components/Point/Save/opc-ua.tsx

@@ -15,7 +15,6 @@ import {
 } from '@formily/antd';
 import type { ISchema } from '@formily/json-schema';
 import service from '@/pages/link/DataCollect/service';
-import { PermissionButton } from '@/components';
 import { onlyMessage } from '@/utils/util';
 import { action } from '@formily/reactive';
 
@@ -26,7 +25,6 @@ interface Props {
 }
 
 export default (props: Props) => {
-  const { permission } = PermissionButton.usePermission('link/Protocol');
   const [data, setData] = useState<Partial<PointItem>>(props.data);
 
   useEffect(() => {
@@ -213,7 +211,6 @@ export default (props: Props) => {
           onClick={() => {
             saveData();
           }}
-          disabled={props.data?.id ? !permission.update : !permission.add}
         >
           确定
         </Button>,

+ 4 - 0
src/pages/link/DataCollect/components/Point/Save/scan.tsx

@@ -178,6 +178,7 @@ export default (props: Props) => {
   const [targetKeys, setTargetKeys] = useState<string[]>([]);
   const [treeData, setTreeData] = useState<any[]>([]);
   const [loading, setLoading] = useState<boolean>(false);
+  const [spinning, setSpinning] = useState<boolean>(false);
   const [arr, setArr] = useState<any[]>([]);
   const onChange = (keys: any[]) => {
     setTargetKeys(keys);
@@ -221,6 +222,7 @@ export default (props: Props) => {
         <Button
           type="primary"
           key={2}
+          loading={spinning}
           onClick={async () => {
             const list = arr.map((item) => {
               return {
@@ -229,6 +231,7 @@ export default (props: Props) => {
                 type: item.type,
               };
             });
+            setSpinning(true);
             const resp = await service.savePointBatch(props.collector?.id, props.collector?.name, [
               ...list,
             ]);
@@ -236,6 +239,7 @@ export default (props: Props) => {
               onlyMessage('操作成功');
               props.reload();
             }
+            setSpinning(false);
           }}
         >
           确定

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

@@ -65,7 +65,7 @@ const Publish = (props: Props) => {
               <a
                 style={{ marginLeft: 20 }}
                 onClick={() => {
-                  downloadObject(errMessage, props.data.name + '-推送失败');
+                  downloadObject(errMessage || '', props.data.name + '-推送失败');
                 }}
               >
                 下载

+ 3 - 2
src/pages/system/DataSource/Management/index.tsx

@@ -1,5 +1,5 @@
 import { PageContainer } from '@ant-design/pro-layout';
-import { Card, Input, message, Spin, Tooltip, Tree, Empty } from 'antd';
+import { Card, Input, message, Spin, Tooltip, Tree } from 'antd';
 import { useEffect, useState } from 'react';
 import { service } from '@/pages/system/DataSource';
 import { useLocation } from 'umi';
@@ -10,6 +10,7 @@ import EditTable from './EditTable';
 import _ from 'lodash';
 import { useDomFullHeight } from '@/hooks';
 import { Store } from 'jetlinks-store';
+import { Empty } from '@/components';
 
 const Management = () => {
   const location = useLocation<{ id: string }>();
@@ -154,7 +155,7 @@ const Management = () => {
               </div>
             </div>
             <div className={styles.right}>
-              {defaultSelectedKeys.length > 0 ? (
+              {defaultSelectedKeys.length && !!defaultSelectedKeys[0] ? (
                 <EditTable
                   table={{ id, table: defaultSelectedKeys[0] }}
                   data={tableList}

+ 2 - 0
src/pages/system/Relationship/Save/index.tsx

@@ -234,6 +234,8 @@ const Save = (props: Props) => {
             'x-component-props': {
               rows: 5,
               placeholder: '请输入说明',
+              showCount: true,
+              maxLength: 200,
             },
             'x-decorator-props': {
               gridSpan: 2,