Sfoglia il codice sorgente

fix: merge next

Next
hear 2 anni fa
parent
commit
fa6edfc76b

+ 2 - 2
config/proxy.ts

@@ -17,8 +17,8 @@ export default {
       // 测试环境
       target: 'http://120.77.179.54:8844/',
       ws: 'ws://120.77.179.54:8844/',
-      // target: 'http://192.168.32.65:8844/',
-      // ws: 'ws://192.168.32.65:8844/',
+      // target: 'http://192.168.32.86:8844/',
+      // ws: 'ws://192.168.32.86:8844/',
       //v2环境
       // ws: 'ws://47.109.52.230:8844',
       // target: 'http://47.109.52.230:8844',

+ 5 - 2
src/components/Player/ScreenPlayer.tsx

@@ -324,7 +324,10 @@ export default forwardRef((props: ScreenProps, ref) => {
                 {/*  <QuestionCircleOutlined />*/}
                 {/*</Tooltip>*/}
               </div>
-              <div className={'screen-tool-save'}>
+              <div
+                className={'screen-tool-save'}
+                style={{ display: 'flex', flexDirection: 'row-reverse', alignItems: 'center' }}
+              >
                 <Popover
                   content={
                     <Form style={{ width: '217px' }} form={historyForm}>
@@ -353,7 +356,7 @@ export default forwardRef((props: ScreenProps, ref) => {
                         type={'primary'}
                         onClick={saveHistory}
                         loading={loading}
-                        style={{ width: '100%', marginTop: 16 }}
+                        style={{ width: '100%', marginRight: 16 }}
                       >
                         保存
                       </Button>

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

@@ -237,7 +237,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
                   f.setFieldState(typeFiled.query('.termType'), async (state) => {
                     state.value = 'eq';
                     state.dataSource = termType;
-                    if (_field?.dataIndex === 'state') {
+                    if (_field?.dataIndex === 'state' || _field?.dataIndex === 'status') {
                       state.dataSource = [
                         { label: '=', value: 'eq' },
                         { label: '!=', value: 'not' },

+ 66 - 22
src/pages/DataCollect/Channel/Save/index.tsx

@@ -19,15 +19,11 @@ interface Props {
 export default (props: Props) => {
   const [data, setData] = useState<Partial<ChannelItem>>(props.data);
   const [authTypeList, setAuthTypeList] = useState<any[]>([]);
+  const [providerList, setProviderList] = useState<any[]>([]);
+  const [securityModesList, setSecurityModesList] = useState<any[]>([]);
+  const [securityPolicyList, setSecurityPolicyList] = useState<any[]>([]);
 
-  useEffect(() => {
-    if (props.data?.id) {
-      service.queryChannelByID(props.data.id).then((resp) => {
-        if (resp.status === 200) {
-          setData(resp.result);
-        }
-      });
-    }
+  const getAuth = () => {
     service.queryAuthTypeList({}).then((resp) => {
       if (resp.status === 200) {
         setAuthTypeList(
@@ -40,6 +36,61 @@ export default (props: Props) => {
         );
       }
     });
+  };
+
+  const getSecurityModesList = async () => {
+    const res = await service.querySecurityModesList({});
+    if (res.status === 200) {
+      const list = res.result.map((item: any) => ({
+        label: item,
+        value: item,
+      }));
+      setSecurityModesList(list);
+    }
+  };
+
+  const getSecurityPolicyList = async () => {
+    const res = await service.querySecurityPolicyList({});
+    if (res.status === 200) {
+      const list = res.result.map((item: any) => ({
+        label: item,
+        value: item,
+      }));
+      setSecurityPolicyList(list);
+    }
+  };
+
+  const getProviders = () => {
+    service.getProviders().then((resp) => {
+      if (resp.status === 200) {
+        const list = [
+          { label: 'OPC UA', value: 'OPC_UA' },
+          { label: 'Modbus TCP', value: 'MODBUS_TCP' },
+        ];
+        const arr = resp.result
+          .filter((item: any) => item.id === 'modbus-tcp' || item.id === 'opc-ua')
+          .map((it: any) => (it?.id === 'opc-ua' ? 'OPC_UA' : 'MODBUS_TCP'));
+        const providers = list.filter((item: any) => arr.includes(item.value));
+        setProviderList(providers);
+        if (arr.includes('OPC_UA')) {
+          getAuth();
+          getSecurityModesList();
+          getSecurityPolicyList();
+        }
+        // console.log('providers---',providers)
+      }
+    });
+  };
+
+  useEffect(() => {
+    if (props.data?.id) {
+      service.queryChannelByID(props.data.id).then((resp) => {
+        if (resp.status === 200) {
+          setData(resp.result);
+        }
+      });
+    }
+    getProviders();
   }, [props.data]);
 
   const form = createForm({
@@ -47,8 +98,8 @@ export default (props: Props) => {
     initialValues: data || {},
   });
 
-  const getSecurityPolicyList = () => service.querySecurityPolicyList({});
-  const getSecurityModesList = () => service.querySecurityModesList({});
+  // const getSecurityPolicyList = () => service.querySecurityPolicyList({});
+  // const getSecurityModesList = () => service.querySecurityModesList({});
   const getCertificateList = () => service.queryCertificateList({});
 
   const useAsyncDataSource = (services: (arg0: Field) => Promise<any>) => (field: Field) => {
@@ -138,16 +189,7 @@ export default (props: Props) => {
               placeholder: '请选择通讯协议',
             },
             'x-disabled': props.data?.id,
-            enum: [
-              { label: 'OPC UA', value: 'OPC_UA' },
-              { label: 'Modbus TCP', value: 'MODBUS_TCP' },
-            ],
-            'x-validator': [
-              {
-                required: true,
-                message: '请选择通讯协议',
-              },
-            ],
+            enum: providerList,
           },
           'configuration.host': {
             title: 'Modbus主机IP',
@@ -275,8 +317,9 @@ export default (props: Props) => {
                 message: '请选择安全策略',
               },
             ],
+            enum: securityPolicyList,
             'x-reactions': [
-              '{{useAsyncDataSource(getSecurityPolicyList)}}',
+              // '{{useAsyncDataSource(getSecurityPolicyList)}}',
               {
                 dependencies: ['..provider'],
                 fulfill: {
@@ -303,8 +346,9 @@ export default (props: Props) => {
                 message: '请选择安全模式',
               },
             ],
+            enum: securityModesList,
             'x-reactions': [
-              '{{useAsyncDataSource(getSecurityModesList)}}',
+              // '{{useAsyncDataSource(getSecurityModesList)}}',
               {
                 dependencies: ['..provider'],
                 fulfill: {

+ 10 - 4
src/pages/DataCollect/Dashboard/index.tsx

@@ -105,10 +105,11 @@ const DeviceBoard = () => {
           format: 'HH:mm',
         };
       default:
-        console.log('swich---');
         const time = dt.end - dt.start;
         const hour = 60 * 60 * 1000;
         const days = hour * 24;
+        const year = days * 365;
+        // console.log('month---',month);
         if (time <= hour) {
           return {
             limit: Math.abs(Math.ceil(time / (60 * 60))),
@@ -121,6 +122,12 @@ const DeviceBoard = () => {
             interval: '1h',
             format: 'HH:mm',
           };
+        } else if (time >= year) {
+          return {
+            limit: Math.abs(Math.ceil(time / days / 31)) + 1,
+            interval: '1M',
+            format: 'yyyy年-M月',
+          };
         } else {
           return {
             limit: Math.abs(Math.ceil(time / days)) + 1,
@@ -133,7 +140,6 @@ const DeviceBoard = () => {
 
   const getEcharts = async () => {
     const data = ref.current!.getValues();
-    console.log('data---', data);
     const res = await service.dashboard([
       {
         dashboard: 'collector',
@@ -167,8 +173,8 @@ const DeviceBoard = () => {
         grid: {
           top: '2%',
           bottom: '5%',
-          left: '65px',
-          right: 0,
+          left: '55px',
+          right: '2.5%',
         },
         series: [
           {

+ 4 - 0
src/pages/DataCollect/service.ts

@@ -174,6 +174,10 @@ class Service {
       method: 'GET',
       params: data,
     });
+  public getProviders = () =>
+    request(`/${SystemConst.API_BASE}/gateway/device/providers`, {
+      method: 'GET',
+    });
 }
 
 const service = new Service();

+ 10 - 2
src/pages/Log/Access/index.tsx

@@ -10,6 +10,7 @@ import { useIntl } from '@@/plugin-locale/localeExports';
 import SearchComponent from '@/components/SearchComponent';
 import Detail from '@/pages/Log/Access/Detail';
 import { useDomFullHeight } from '@/hooks';
+import { Ellipsis } from '@/components';
 
 const service = new BaseService('logger/access');
 
@@ -96,9 +97,16 @@ const Access = () => {
         defaultMessage: '请求用户',
       }),
       dataIndex: 'context.username',
-      width: 100,
+      width: 200,
       render: (text, record: any) =>
-        record?.context?.username ? <Tag color="geekblue">{record?.context?.username}</Tag> : '',
+        record?.context?.username ? (
+          <Tag color="geekblue">
+            {/* {record?.context?.username} */}
+            <Ellipsis title={record?.context?.username} style={{ maxWidth: 170 }} />
+          </Tag>
+        ) : (
+          ''
+        ),
     },
     {
       title: intl.formatMessage({

+ 8 - 1
src/pages/device/Instance/Detail/Tags/index.tsx

@@ -24,6 +24,7 @@ const Tags = () => {
   useEffect(() => {
     if (tag) {
       setTags([...tag] || []);
+      console.log(tag);
     }
   }, [tag]);
 
@@ -59,7 +60,13 @@ const Tags = () => {
           <Descriptions.Item span={1} label={`${item.name}(${item.key})`} key={item.key}>
             <Tooltip title={item.value || ''} placement="topLeft">
               <div className="ellipsis" style={{ maxWidth: 300 }}>
-                {item.value || ''}
+                {/* {item.value || ''} */}
+                {item.type === 'enum'
+                  ? `${
+                      item?.dataType?.elements?.find((it: any) => it.value === item.value)?.text ||
+                      ''
+                    }`
+                  : `${item.value || ''}`}
               </div>
             </Tooltip>
           </Descriptions.Item>

+ 32 - 10
src/pages/device/Product/Detail/Access/index.tsx

@@ -626,11 +626,12 @@ const Access = () => {
           <Col span={12}>
             <div className={styles.config}>
               <div className={styles.item}>
-                <TitleComponent
-                  data={
-                    <span>
-                      接入方式
-                      <Tooltip
+                <div style={{ display: 'flex', width: 150, alignItems: 'flex-start' }}>
+                  <TitleComponent
+                    data={
+                      <span>
+                        接入方式
+                        {/* <Tooltip
                         title={
                           !!(productModel.current?.count && productModel.current?.count > 0)
                             ? '产品下有设备实例时不能更换接入方式'
@@ -651,13 +652,34 @@ const Access = () => {
                         >
                           更换
                         </Button>
-                      </Tooltip>
-                      {/* <Button onClick={async()=>{
+                      </Tooltip> */}
+                        {/* <Button onClick={async()=>{
                           await service.productGuideDetail()
                         }}>删除</Button> */}
-                    </span>
-                  }
-                />
+                      </span>
+                    }
+                  />
+                  <Tooltip
+                    title={
+                      !!(productModel.current?.count && productModel.current?.count > 0)
+                        ? '产品下有设备实例时不能更换接入方式'
+                        : ''
+                    }
+                  >
+                    <Button
+                      size="small"
+                      type="primary"
+                      ghost
+                      style={{ marginLeft: 20 }}
+                      disabled={!!(productModel.current?.count && productModel.current?.count > 0)}
+                      onClick={() => {
+                        setConfigVisible(true);
+                      }}
+                    >
+                      更换
+                    </Button>
+                  </Tooltip>
+                </div>
                 <div className={styles.context}>
                   {/*<Tooltip placement="topLeft" title={access?.name}>*/}
                   {/*  <div className="ellipsis-70">{access?.name}</div>*/}

+ 14 - 6
src/pages/edge/Device/index.tsx

@@ -86,6 +86,9 @@ export default () => {
           }
         });
       }}
+      tooltip={{
+        title: type === 'list' ? '远程控制' : '',
+      }}
       isPermission={permission.setting}
       style={{ padding: 0 }}
       key={'control'}
@@ -102,7 +105,7 @@ export default () => {
       isPermission={permission.password}
       key={'reset'}
       popConfirm={{
-        title: '确认重置密码?',
+        title: '确认重置密码为P@ssw0rd?',
         onConfirm: () => {
           service.restPassword(record.id).then((resp: any) => {
             if (resp.status === 200) {
@@ -162,10 +165,15 @@ export default () => {
       }}
       isPermission={permission.action}
       tooltip={{
-        title: intl.formatMessage({
-          id: `pages.data.option.${record.state.value !== 'notActive' ? 'disabled' : 'enabled'}`,
-          defaultMessage: record.state.value !== 'notActive' ? '禁用' : '启用',
-        }),
+        title:
+          type === 'list'
+            ? intl.formatMessage({
+                id: `pages.data.option.${
+                  record.state.value !== 'notActive' ? 'disabled' : 'enabled'
+                }`,
+                defaultMessage: record.state.value !== 'notActive' ? '禁用' : '启用',
+              })
+            : '',
       }}
     >
       {record.state.value !== 'notActive' ? <StopOutlined /> : <PlayCircleOutlined />}
@@ -185,7 +193,7 @@ export default () => {
       tooltip={
         record.state.value !== 'notActive'
           ? { title: intl.formatMessage({ id: 'pages.device.instance.deleteTip' }) }
-          : undefined
+          : { title: type !== 'list' ? '' : '删除' }
       }
       disabled={record.state.value !== 'notActive'}
       popConfirm={{

+ 1 - 1
src/pages/edge/Resource/index.tsx

@@ -267,7 +267,7 @@ export default () => {
           status: 'enabled',
         },
         disabled: {
-          text: '异常',
+          text: '禁用',
           status: 'disabled',
         },
       },

+ 40 - 4
src/pages/iot-card/CardManagement/ImportModal.tsx

@@ -4,7 +4,7 @@ import { useRequest } from 'ahooks';
 import { service } from '@/pages/iot-card/CardManagement/index';
 import Token from '@/utils/token';
 import SystemConst from '@/utils/const';
-import { downloadFile } from '@/utils/util';
+import { downloadFile, onlyMessage } from '@/utils/util';
 import { CheckOutlined } from '@ant-design/icons';
 
 type ImportModalType = {
@@ -17,6 +17,7 @@ const ImportModal = (props: ImportModalType) => {
   const [configId, setConfigId] = useState('');
   const [total, setTotal] = useState(0);
   const [loading, setLoading] = useState(false);
+  const [form] = Form.useForm();
 
   const { data: platformList, run: platformRun } = useRequest(service.queryPlatformNoPage, {
     manual: true,
@@ -47,6 +48,9 @@ const ImportModal = (props: ImportModalType) => {
       const resp = info.file.response || { result: '' };
       submitData(resp.result);
     }
+    if (!info.file.status) {
+      setLoading(false);
+    }
   };
 
   const downFileFn = (type: string) => {
@@ -62,9 +66,26 @@ const ImportModal = (props: ImportModalType) => {
   }, []);
 
   return (
-    <Modal title={'导入'} visible={true} onOk={props.onCancel} onCancel={props.onCancel}>
-      <Form layout={'vertical'}>
-        <Form.Item label={'平台对接'}>
+    <Modal
+      title={'导入'}
+      visible={true}
+      onOk={async () => {
+        // props.onCancel()
+        const res = await form.validateFields();
+        if (res) {
+          props.onCancel();
+          // console.log(res)
+        }
+      }}
+      onCancel={props.onCancel}
+    >
+      <Form layout={'vertical'} form={form}>
+        <Form.Item
+          label={'平台对接'}
+          name={'platform'}
+          required
+          rules={[{ required: true, message: '请选择平台对接' }]}
+        >
           <Select
             showSearch
             placeholder={'请选择平台对接'}
@@ -106,6 +127,21 @@ const ImportModal = (props: ImportModalType) => {
                 }}
                 showUploadList={false}
                 onChange={fileChange}
+                beforeUpload={(file) => {
+                  const type = fileType === 'csv' ? 'csv' : 'xlsx';
+
+                  const isCsv = file.type === 'text/csv';
+                  const isXlsx =
+                    file.type ===
+                    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
+                  if (!isCsv && type !== 'xlsx') {
+                    onlyMessage('请上传.csv格式文件', 'warning');
+                  }
+                  if (!isXlsx && type !== 'csv') {
+                    onlyMessage('请上传.xlsx格式文件', 'warning');
+                  }
+                  return (isCsv && type !== 'xlsx') || (isXlsx && type !== 'csv');
+                }}
               >
                 <Button loading={loading}>上传文件</Button>
               </Upload>

+ 5 - 5
src/pages/link/DashBoard/index.tsx

@@ -250,7 +250,7 @@ export default () => {
       xAxis: {
         type: 'category',
         data: xAxis,
-        boundaryGap: false,
+        boundaryGap: true,
       },
       tooltip: {
         trigger: 'axis',
@@ -260,8 +260,8 @@ export default () => {
         type: 'value',
       },
       grid: {
-        left: 60,
-        right: 0,
+        left: 70,
+        right: 10,
         top: 10,
         bottom: 20,
       },
@@ -298,7 +298,7 @@ export default () => {
     setJvmOptions({
       xAxis: {
         type: 'category',
-        boundaryGap: false,
+        boundaryGap: true,
         data: arrayReverse(xAxis),
       },
       tooltip: {
@@ -359,7 +359,7 @@ export default () => {
     setCpuOptions({
       xAxis: {
         type: 'category',
-        boundaryGap: false,
+        boundaryGap: true,
         data: arrayReverse(xAxis),
       },
       tooltip: {

+ 7 - 0
src/pages/notice/Config/Debug/index.tsx

@@ -165,6 +165,13 @@ const Debug = observer(() => {
         required: true,
         'x-component': 'Select',
         'x-reactions': '{{useAsyncDataSource(getTemplate)}}',
+        'x-component-props': {
+          showSearch: true,
+          allowClear: true,
+          showArrow: true,
+          filterOption: (input: string, option: any) =>
+            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
+        },
       },
       variableDefinitions: {
         title: '变量',

+ 10 - 3
src/pages/notice/Template/Detail/index.tsx

@@ -165,6 +165,7 @@ const Detail = observer(() => {
           });
           onFieldValueChange('type', async (field, f) => {
             const value = field.value;
+
             setTypeItem(value);
             if (!value) return;
             f.setFieldState('provider', (state1) => {
@@ -173,6 +174,12 @@ const Detail = observer(() => {
               }
               state1.dataSource = typeList[value];
             });
+            if (field.modified) {
+              // console.log('value------',value)
+              f.setFieldState('configId', (state2) => {
+                state2.value = undefined;
+              });
+            }
           });
           onFieldValueChange('provider', async (field, form1) => {
             const value = field.value;
@@ -1359,7 +1366,7 @@ const Detail = observer(() => {
                     'x-validator': [
                       {
                         required: true,
-                        message: '请输入签名',
+                        message: '请选择签名',
                       },
                     ],
                     'x-component': 'Select',
@@ -1368,7 +1375,7 @@ const Detail = observer(() => {
                       tooltip: '用于短信内容签名信息显示',
                     },
                     'x-component-props': {
-                      placeholder: '请输入签名',
+                      placeholder: '请选择签名',
                     },
                     'x-reactions': {
                       dependencies: ['configId'],
@@ -1590,7 +1597,7 @@ const Detail = observer(() => {
             message: '最多可输入500个字符',
           },
           {
-            require: true,
+            required: true,
             message: '请输入模版内容',
           },
         ],

+ 6 - 0
src/pages/rule-engine/Scene/Save/action/ListItem/FilterCondition.tsx

@@ -53,6 +53,7 @@ export default observer((props: FilterProps) => {
 
   const [deleteVisible, setDeleteVisible] = useState(false);
   const columnsRef = useRef<string[]>([]);
+  const oldLableRef = useRef<any>();
 
   const ValueRef = useRef<Partial<TermsType>>({
     column: '',
@@ -82,6 +83,7 @@ export default observer((props: FilterProps) => {
     (columnValue?: string) => {
       if (columnValue) {
         const labelOptions = columnOptionsMap.get(columnValue);
+        console.log('labelOptions------', labelOptions, props.data);
         if (labelOptions) {
           const _termTypeOptions: any[] =
             labelOptions?.termTypes?.map((tItem: any) => ({ title: tItem.name, key: tItem.id })) ||
@@ -140,6 +142,10 @@ export default observer((props: FilterProps) => {
 
   useEffect(() => {
     labelCache.current = props.label || [undefined, undefined, {}, 'and'];
+    console.log('labelCache.current-------', props.label);
+    if (props.label) {
+      oldLableRef.current = props.label;
+    }
   }, [props.label]);
 
   useEffect(() => {

+ 7 - 2
src/pages/rule-engine/Scene/Save/terms/paramsItem.tsx

@@ -90,8 +90,13 @@ export const handleOptionsLabel = (data: any, type?: string) => {
         const str = termsTypeKey[t].replace('_value', _value[0]).replace('_value2', _value[1]);
         return `${c} ${str} ${typeStr} `;
       } else if (DoubleFilter.includes(t) && !!range && _value.length === 1) {
-        console.log(_value, range);
-        const str = termsTypeKey[t].replace('_value和_value2', _value[0]);
+        console.log(_value, range, t);
+        let str;
+        if (t === 'in' || t === 'nin') {
+          str = termsTypeKey[t].replace('_value,_value2', _value[0]);
+        } else {
+          str = termsTypeKey[t].replace('_value和_value2', _value[0]);
+        }
         return `${c} ${str} ${typeStr} `;
       } else {
         const str = termsTypeKey[t].replace('_value', _value[0]);

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

@@ -181,7 +181,7 @@ const Apply = () => {
         ) : null,
         isApiService(record.integrationModes) ? (
           <PermissionButton
-            key={'api'}
+            key={'viewApi'}
             type={'link'}
             style={{ padding: 0 }}
             isPermission={permission.update || permission.add}

+ 1 - 1
src/pages/system/Department/Assets/deivce/bind.tsx

@@ -374,7 +374,7 @@ const Bind = observer((props: Props) => {
             if (resp.status === 200) {
               newData = [...resp.result.data];
               const assetsResp = await service.getBindingAssets(
-                'product',
+                'device',
                 resp.result.data.map((item: any) => item.id),
               );
               if (assetsResp.status === 200) {

+ 1 - 2
src/pages/system/Menu/Detail/edit.tsx

@@ -167,10 +167,9 @@ export default (props: EditProps) => {
                     rules={[
                       { required: true, message: '请输入编码' },
                       { max: 64, message: '最多可输入64个字符' },
-
                       () => ({
                         async validator(_, value) {
-                          if (value) {
+                          if (value && value.length < 64) {
                             const res = await service.isCode({ code: value, owner: 'iot' });
                             if (res.result.passed) {
                               return Promise.resolve();

+ 2 - 1
src/pages/system/Platforms/Api/base.tsx

@@ -17,6 +17,7 @@ export const ApiModel = model<{
   components: any;
   swagger: any;
   debugger: any;
+  key?: any;
 }>({
   data: [],
   baseUrl: '',
@@ -80,7 +81,7 @@ export default observer((props: ApiPageProps) => {
         }
       });
     } else {
-      console.log(props.code, 1111111);
+      // console.log(props.code, 1111111);
       service.getApiGranted(code!).then((resp: any) => {
         if (resp.status === 200) {
           setGrantKeys(resp.result);

+ 30 - 10
src/pages/system/Platforms/Api/basePage.tsx

@@ -5,6 +5,7 @@ import { service } from '../index';
 import { ApiModel } from '@/pages/system/Platforms/Api/base';
 import { onlyMessage } from '@/utils/util';
 import PermissionButton from '@/components/PermissionButton';
+import _ from 'lodash';
 
 interface TableProps {
   data: any;
@@ -21,7 +22,7 @@ export default (props: TableProps) => {
   const [selectKeys, setSelectKeys] = useState<string[]>([]);
   const [dataSource, setDataSource] = useState<any[]>([]);
   const [loading, setLoading] = useState(false);
-  const [GrantKeys, setGrantKeys] = useState<string[] | undefined>(undefined);
+  const [GrantKeys, setGrantKeys] = useState<any>([]);
   const { permission } = PermissionButton.usePermission('system/Platforms/Setting');
 
   const grantCache = useRef<string[]>([]);
@@ -90,14 +91,14 @@ export default (props: TableProps) => {
     const code = param.get('code');
     // 和原有已授权数据进行对比
     const addGrant = selectKeys.filter((key) => {
-      if (grantCache.current.includes(key)) {
+      if (GrantKeys.includes(key)) {
         return false;
       }
       return true;
     });
 
     // 获取删除的数据
-    const removeGrant = grantCache.current.filter((key) => {
+    const removeGrant = GrantKeys.filter((key: any) => {
       if (selectKeys.includes(key)) {
         return false;
       }
@@ -124,9 +125,8 @@ export default (props: TableProps) => {
 
     setLoading(true);
     if (props.isOpenGranted === false) {
-      // console.log(props.grantKeys)
-      // console.log(addGrant,'add')
-      // console.log(removeGrant,'del')
+      // console.log('del-------', removeGrant);
+      // console.log('add-------', addGrant);
       const resp2 = removeGrant.length ? await service.apiOperationsRemove(removeGrant) : {};
       const resp = await service.apiOperationsAdd(addGrant);
       if (resp.status === 200 || resp2.status === 200) {
@@ -134,8 +134,12 @@ export default (props: TableProps) => {
         onlyMessage('操作成功');
       }
     } else {
-      const resp2 = await service.removeApiGrant(code!, { operations: removeOperations });
-      const resp = await service.addApiGrant(code!, { operations: addOperations });
+      const resp2 = await service.removeApiGrant(code!, {
+        operations: removeOperations.filter((item: any) => item.permissions),
+      });
+      const resp = await service.addApiGrant(code!, {
+        operations: addOperations.filter((item) => item.permissions),
+      });
       if (resp.status === 200 || resp2.status === 200) {
         getApiGrant();
         onlyMessage('操作成功');
@@ -144,6 +148,13 @@ export default (props: TableProps) => {
     setLoading(false);
   }, [selectKeys, location, dataSource, props.isOpenGranted]);
 
+  useEffect(() => {
+    // console.log('GrantKeys-=========', GrantKeys);
+    if (GrantKeys) {
+      setSelectKeys(GrantKeys);
+    }
+  }, [GrantKeys]);
+
   return (
     <div className={'platforms-api-table'}>
       <Table<any>
@@ -181,6 +192,7 @@ export default (props: TableProps) => {
             ? {
                 selectedRowKeys: selectKeys,
                 onSelect: (record, selected) => {
+                  console.log('selected----', selected);
                   if (selected) {
                     const newArr = [...selectKeys, record.operationId];
                     setSelectKeys(newArr);
@@ -189,6 +201,7 @@ export default (props: TableProps) => {
                   }
                 },
                 onSelectAll: (selected, selectedRows) => {
+                  // console.log('selectedRows',selected,selectedRows)
                   if (selected) {
                     // const items = selectedRows.filter((item) => !!item).map((item) => item.operationId).concat(props.grantKeys)
                     // console.log(items)
@@ -199,7 +212,14 @@ export default (props: TableProps) => {
                         .concat(GrantKeys),
                     );
                   } else {
-                    setSelectKeys([]);
+                    // setSelectKeys([]);
+                    // console.log(dataSource,GrantKeys)
+                    const diffList = _.difference(
+                      GrantKeys,
+                      dataSource.map((item) => item.operationId),
+                    );
+                    // console.log('diffList---',diffList)
+                    setSelectKeys(diffList);
                   }
                 },
               }
@@ -214,7 +234,7 @@ export default (props: TableProps) => {
             onClick={save}
             key={'update'}
             type={'primary'}
-            style={{ padding: 0, width: 50 }}
+            style={{ padding: 0, width: 80 }}
             loading={loading}
           >
             保存