Преглед изворни кода

fix: bug#4059、3952、4064

xieyonghong пре 3 година
родитељ
комит
ed9d48aeb7

+ 56 - 25
src/components/Player/ScreenPlayer.tsx

@@ -16,6 +16,8 @@ type Player = {
   url?: string;
   channelId?: string;
   key: string;
+  updateTime?: number;
+  show: boolean;
 };
 
 interface ScreenProps {
@@ -63,7 +65,14 @@ export default forwardRef((props: ScreenProps, ref) => {
 
   const replaceVideo = useCallback(
     (id: string, channelId: string, url: string) => {
-      players[playerActive] = { id, url, channelId, key: 'time_' + new Date().getTime() };
+      players[playerActive] = {
+        id,
+        url,
+        channelId,
+        key: players[playerActive].key,
+        updateTime: new Date().getTime(),
+        show: true,
+      };
       setPlayers(players);
       if (playerActive === screen - 1) {
         // 当前位置为分屏最后一位
@@ -115,11 +124,34 @@ export default forwardRef((props: ScreenProps, ref) => {
     }
   }, [players, screen, historyForm]);
 
+  const mediaInit = () => {
+    const newArr = [];
+    for (let i = 0; i < 9; i++) {
+      newArr.push({
+        id: '',
+        channelId: '',
+        url: '',
+        updateTime: 0,
+        key: 'time_' + new Date().getTime() + i,
+        show: i === 0,
+      });
+    }
+    setPlayers(newArr);
+  };
+
   const screenChange = (index: number) => {
-    const arr = new Array(index)
-      .fill(1)
-      .map(() => ({ id: '', channelId: '', url: '', key: 'time_' + new Date().getTime() }));
-    setPlayers(arr);
+    setPlayers(
+      players.map((item, i) => {
+        return {
+          id: '',
+          channelId: '',
+          url: '',
+          updateTime: 0,
+          key: item.key,
+          show: i < index,
+        };
+      }),
+    );
     setPlayerActive(0);
     setScreen(index);
   };
@@ -135,7 +167,7 @@ export default forwardRef((props: ScreenProps, ref) => {
     if (props.showScreen !== false) {
       getHistory();
     }
-    screenChange(1);
+    mediaInit();
   }, []);
 
   useImperativeHandle(ref, () => ({
@@ -178,24 +210,7 @@ export default forwardRef((props: ScreenProps, ref) => {
     </Menu>
   );
 
-  const MediaDom = (data: Player[]) => {
-    return data.map((item, index) => {
-      return (
-        <div
-          key={'player-content' + index}
-          className={classNames({
-            active: props.showScreen !== false && playerActive === index && !isFullscreen,
-            'full-screen': isFullscreen,
-          })}
-          onClick={() => {
-            setPlayerActive(index);
-          }}
-        >
-          <LivePlayer key={item.key} url={item.url} />
-        </div>
-      );
-    });
-  };
+  console.log(players);
 
   return (
     <div className={classNames('live-player-warp', props.className)}>
@@ -290,7 +305,23 @@ export default forwardRef((props: ScreenProps, ref) => {
         )}
         <div className={'player-body'}>
           <div className={classNames('player-screen', screenClass)} ref={fullscreenRef}>
-            {MediaDom(players)}
+            {players.map((item, index) => {
+              return (
+                <div
+                  key={item.key}
+                  className={classNames({
+                    active: props.showScreen !== false && playerActive === index && !isFullscreen,
+                    'full-screen': isFullscreen,
+                  })}
+                  style={{ display: item.show ? 'block' : 'none' }}
+                  onClick={() => {
+                    setPlayerActive(index);
+                  }}
+                >
+                  <LivePlayer url={item.url} updateTime={item.updateTime} />
+                </div>
+              );
+            })}
           </div>
         </div>
       </div>

+ 27 - 53
src/components/Player/index.tsx

@@ -9,6 +9,8 @@ export type PlayerProps = {
   poster?: string;
   timeout?: number;
   className?: string;
+  updateTime?: number;
+  key?: string | number;
   loading?: boolean;
   onDestroy?: () => void;
   onMessage?: (msg: any) => void;
@@ -24,12 +26,24 @@ export type PlayerProps = {
   onClick?: () => void;
 };
 
+const EventsEnum = {
+  fullscreen: 'onFullscreen',
+  message: 'onMessage',
+  error: 'onError',
+  timeupdate: 'onTimeUpdate',
+  pause: 'onPause',
+  play: 'onPlay',
+  snapOutside: 'onSnapOutside',
+  snapInside: 'onSnapInside',
+  customButtons: 'onCustomButtons',
+};
 export default (props: PlayerProps) => {
   const player = useRef<HTMLVideoElement>(null);
 
   useEffect(() => {
     return () => {
       // 销毁播放器
+      console.log('销毁', props);
       if ('onDestroy' in props && isFunction(props.onDestroy)) {
         props.onDestroy();
       }
@@ -40,61 +54,21 @@ export default (props: PlayerProps) => {
    * 事件初始化
    */
   const EventInit = () => {
-    player.current?.addEventListener('fullscreen', () => {
-      if (props.onFullscreen) {
-        props.onFullscreen();
-      }
-    });
-
-    player.current?.addEventListener('message', (e) => {
-      if (props.onMessage) {
-        props.onMessage(e);
-      }
-    });
-
-    player.current?.addEventListener('error', (e) => {
-      if (props.onError) {
-        props.onError(e);
-      }
-    });
-
-    player.current?.addEventListener('timeupdate', (e) => {
-      if (props.onTimeUpdate) {
-        props.onTimeUpdate(e);
-      }
-    });
-
-    player.current?.addEventListener('pause', () => {
-      if (props.onPause) {
-        props.onPause();
-      }
-    });
-
-    player.current?.addEventListener('play', () => {
-      if (props.onPlay) {
-        props.onPlay();
-      }
-    });
-
-    player.current?.addEventListener('snapOutside', (e) => {
-      if (props.onSnapOutside) {
-        props.onSnapOutside(e);
-      }
-    });
-
-    player.current?.addEventListener('snapInside', (e) => {
-      if (props.onSnapInside) {
-        props.onSnapInside(e);
-      }
-    });
-
-    player.current?.addEventListener('customButtons', (e) => {
-      if (props.onCustomButtons) {
-        props.onCustomButtons(e);
-      }
-    });
+    for (const key in EventsEnum) {
+      player.current?.addEventListener(key, () => {
+        if (EventsEnum[key] in props) {
+          props[EventsEnum[key]]();
+        }
+      });
+    }
   };
 
+  useEffect(() => {
+    if (props.updateTime) {
+      console.log(props.updateTime);
+    }
+  }, [props.updateTime]);
+
   return (
     // @ts-ignore: Unreachable code error
     <live-player

+ 67 - 65
src/components/ProTableCard/CardItems/AccessConfig/index.less

@@ -1,83 +1,45 @@
 @import '~antd/es/style/themes/default.less';
 
-.tableCardDisabled {
-  width: 100%;
-  background: url('/images/access-config-diaabled.png') no-repeat;
-  background-size: 100% 100%;
-}
+.access-config-card-item {
+  &.active {
+    border: 1px solid @primary-color-active;
+  }
 
-.tableCardEnabled {
-  width: 100%;
-  background: url('/images/access-config-enabled.png') no-repeat;
-  background-size: 100% 100%;
-}
+  .tableCardDisabled {
+    width: 100%;
+    background: url('/images/access-config-diaabled.png') no-repeat;
+    background-size: 100% 100%;
+  }
 
-.active {
-  border: 1px solid @primary-color-active;
-}
+  .tableCardEnabled {
+    width: 100%;
+    background: url('/images/access-config-enabled.png') no-repeat;
+    background-size: 100% 100%;
+  }
 
-.context-access {
-  display: flex;
-  width: 100%;
-  .card {
+  .context-access {
     display: flex;
-    flex-direction: column;
     width: 100%;
-    margin-left: 20px;
-    .header {
-      .title {
-        width: 70%;
-        overflow: hidden;
-        font-weight: 700;
-        font-size: 18px;
-        white-space: nowrap;
-        text-overflow: ellipsis;
-      }
-      .title::before {
-        display: none;
-      }
-      .desc {
-        width: 70%;
-        margin-top: 10px;
-        overflow: hidden;
-        color: #666;
-        font-weight: 400;
-        font-size: 12px;
-        white-space: nowrap;
-        text-overflow: ellipsis;
-      }
-    }
-
-    .container {
+    .card {
       display: flex;
+      flex-direction: column;
       width: 100%;
-      min-height: 50px;
-      margin-top: 10px;
-
-      .server,
-      .procotol {
-        width: calc(50% - 20px);
-        margin-right: 10px;
-        .subTitle {
-          width: 100%;
-          margin-bottom: 5px;
+      margin-left: 20px;
+      .header {
+        .title {
+          width: 70%;
           overflow: hidden;
-          color: rgba(0, 0, 0, 0.75);
-          font-size: 12px;
+          font-weight: 700;
+          font-size: 18px;
           white-space: nowrap;
           text-overflow: ellipsis;
         }
-        .subItem {
-          width: 100%;
-          height: 20px;
-          overflow: hidden;
-          white-space: nowrap;
-          text-overflow: ellipsis;
+        .title::before {
+          display: none;
         }
-      }
-      .procotol {
         .desc {
-          width: 100%;
+          width: 70%;
+          margin-top: 10px;
           overflow: hidden;
           color: #666;
           font-weight: 400;
@@ -86,6 +48,46 @@
           text-overflow: ellipsis;
         }
       }
+
+      .container {
+        display: flex;
+        width: 100%;
+        min-height: 50px;
+        margin-top: 10px;
+
+        .server,
+        .procotol {
+          width: calc(50% - 20px);
+          margin-right: 10px;
+          .subTitle {
+            width: 100%;
+            margin-bottom: 5px;
+            overflow: hidden;
+            color: rgba(0, 0, 0, 0.75);
+            font-size: 12px;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+          }
+          .subItem {
+            width: 100%;
+            height: 20px;
+            overflow: hidden;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+          }
+        }
+        .procotol {
+          .desc {
+            width: 100%;
+            overflow: hidden;
+            color: #666;
+            font-weight: 400;
+            font-size: 12px;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+          }
+        }
+      }
     }
   }
 }

+ 2 - 1
src/components/ProTableCard/CardItems/AccessConfig/index.tsx

@@ -5,6 +5,7 @@ import '@/style/common.less';
 import { Badge, Tooltip } from 'antd';
 import type { AccessItem } from '@/pages/link/AccessConfig/typings';
 import './index.less';
+import classNames from 'classnames';
 
 export interface AccessConfigCardProps extends AccessItem {
   detail?: React.ReactNode;
@@ -29,7 +30,7 @@ export default (props: AccessConfigCardProps) => {
       }}
       showTool={props.showTool}
       contentClassName={props.state.value === 'disabled' ? 'tableCardDisabled' : 'tableCardEnabled'}
-      className={props.activeStyle}
+      className={classNames('access-config-card-item', props.activeStyle)}
     >
       <div className="context-access">
         <div>

+ 5 - 3
src/components/ProTableCard/index.tsx

@@ -13,7 +13,7 @@ enum ModelEnum {
   CARD = 'CARD',
 }
 
-const Default_Size = 5;
+const Default_Size = 6;
 
 type ModelType = keyof typeof ModelEnum;
 
@@ -80,6 +80,8 @@ const ProTableCard = <
     };
   }, []);
 
+  const pageSizeOptions = [Default_Size * 2, Default_Size * 4, Default_Size * 8, Default_Size * 16];
+
   return (
     <div className={'pro-table-card'}>
       <ProTable<T, U, ValueType>
@@ -118,7 +120,7 @@ const ProTableCard = <
           },
           pageSize: pageSize,
           current: current,
-          pageSizeOptions: [Default_Size * 2, Default_Size * 4, 50, 100],
+          pageSizeOptions: pageSizeOptions,
         }}
         toolBarRender={(action, row) => {
           const oldBar = toolBarRender ? toolBarRender(action, row) : [];
@@ -172,7 +174,7 @@ const ProTableCard = <
             setPageIndex(page - 1);
             setPageSize(size);
           }}
-          pageSizeOptions={[Default_Size * 2, Default_Size * 4, 50, 100]}
+          pageSizeOptions={pageSizeOptions}
           pageSize={pageSize}
           showTotal={(num) => {
             const minSize = pageIndex * pageSize + 1;

+ 1 - 0
src/pages/device/Instance/index.tsx

@@ -243,6 +243,7 @@ const Instance = () => {
       dataIndex: 'describe',
       width: '15%',
       ellipsis: true,
+      hideInSearch: true,
     },
     {
       title: intl.formatMessage({

+ 33 - 0
src/pages/device/Product/index.tsx

@@ -263,7 +263,40 @@ const Product = observer(() => {
     },
     {
       title: '状态',
+      dataIndex: 'state',
       render: (_, row) => <Space size={0}>{status[row.state]}</Space>,
+      valueType: 'select',
+      valueEnum: {
+        // 2: {
+        //   text: intl.formatMessage({
+        //     id: 'pages.searchTable.titleStatus.all',
+        //     defaultMessage: '全部',
+        //   }),
+        //   status: 2,
+        // },
+        0: {
+          text: intl.formatMessage({
+            id: 'pages.device.product.status.unpublished',
+            defaultMessage: '未发布',
+          }),
+          status: 0,
+        },
+        1: {
+          text: intl.formatMessage({
+            id: 'pages.device.product.status.published',
+            defaultMessage: '已发布',
+          }),
+          status: 1,
+        },
+      },
+    },
+    {
+      dataIndex: 'describe',
+      title: intl.formatMessage({
+        id: 'pages.system.description',
+        defaultMessage: '说明',
+      }),
+      hideInSearch: true,
     },
     {
       title: intl.formatMessage({

+ 18 - 21
src/pages/media/Device/Channel/index.tsx

@@ -207,7 +207,7 @@ export default () => {
           </div>
         )}
         <div className={'right'}>
-          <SearchComponent field={columns} onSearch={searchFn} />
+          <SearchComponent field={columns} onSearch={searchFn} target={'media-channel'} />
           <ProTable<ChannelItem>
             columns={columns}
             actionRef={actionRef}
@@ -231,26 +231,23 @@ export default () => {
             }
             rowKey="id"
             search={false}
-            headerTitle={
-              type === ProviderValue.FIXED
-                ? [
-                    <Button
-                      onClick={() => {
-                        setCurrent(undefined);
-                        setVisible(true);
-                      }}
-                      key="button"
-                      icon={<PlusOutlined />}
-                      type="primary"
-                    >
-                      {intl.formatMessage({
-                        id: 'pages.data.option.add',
-                        defaultMessage: '新增',
-                      })}
-                    </Button>,
-                  ]
-                : null
-            }
+            headerTitle={[
+              <Button
+                onClick={() => {
+                  setCurrent(undefined);
+                  setVisible(true);
+                }}
+                key="button"
+                disabled={type === ProviderValue.GB281}
+                icon={<PlusOutlined />}
+                type="primary"
+              >
+                {intl.formatMessage({
+                  id: 'pages.data.option.add',
+                  defaultMessage: '新增',
+                })}
+              </Button>,
+            ]}
           />
         </div>
       </div>

+ 19 - 10
src/pages/media/Device/Save/index.tsx

@@ -1,11 +1,12 @@
 import { useCallback, useEffect, useState } from 'react';
-import { Button, Col, Form, Input, message, Modal, Radio, Row, Select } from 'antd';
+import { Button, Col, Form, Input, message, Modal, Radio, Row, Select, Tooltip } from 'antd';
 import { useIntl } from 'umi';
 import { RadioCard, UploadImage } from '@/components';
 import { PlusOutlined } from '@ant-design/icons';
 import { service } from '../index';
 import SaveProductModal from './SaveProduct';
 import type { DeviceItem } from '../typings';
+import { getButtonPermission } from '@/utils/menu';
 
 interface SaveProps {
   visible: boolean;
@@ -222,15 +223,23 @@ export default (props: SaveProps) => {
                 </Form.Item>
                 {props.model !== 'edit' && (
                   <Form.Item noStyle>
-                    <Button
-                      type={'link'}
-                      style={{ padding: '4px 10px' }}
-                      onClick={() => {
-                        setProductVisible(true);
-                      }}
-                    >
-                      <PlusOutlined />
-                    </Button>
+                    {getButtonPermission('device/Product', 'add') ? (
+                      <Tooltip title={'暂无权限,请联系管理员'}>
+                        <Button type={'link'} style={{ padding: '4px 10px' }} disabled>
+                          <PlusOutlined />
+                        </Button>
+                      </Tooltip>
+                    ) : (
+                      <Button
+                        type={'link'}
+                        style={{ padding: '4px 10px' }}
+                        onClick={() => {
+                          setProductVisible(true);
+                        }}
+                      >
+                        <PlusOutlined />
+                      </Button>
+                    )}
                   </Form.Item>
                 )}
               </Form.Item>

+ 5 - 5
src/pages/media/Device/index.tsx

@@ -206,7 +206,7 @@ const Device = () => {
         <Tooltip
           key={'updateChannel'}
           title={
-            record.provider === providerType['fixed-media']
+            record.provider === ProviderValue.FIXED
               ? '接入方式为固定地址时不支持更新通道'
               : '更新通道'
           }
@@ -217,7 +217,7 @@ const Device = () => {
             disabled={
               getButtonPermission('media/Device', 'action') ||
               record.state.value === 'offline' ||
-              record.provider === providerType['fixed-media']
+              record.provider === ProviderValue.FIXED
             }
             onClick={() => {
               updateChannel(record.id);
@@ -360,13 +360,13 @@ const Device = () => {
                 key="delete"
                 title={intl.formatMessage({
                   id:
-                    record.state.value === 'offline'
-                      ? 'pages.device.productDetail.deleteTip'
+                    record.state.value !== 'offline'
+                      ? 'pages.device.instance.deleteTip'
                       : 'page.table.isDelete',
                   defaultMessage: '是否删除?',
                 })}
                 onConfirm={async () => {
-                  if (record.state.value !== 'offline') {
+                  if (record.state.value === 'offline') {
                     await deleteItem(record.id);
                   } else {
                     message.error('在线设备不能进行删除操作');

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

@@ -54,6 +54,7 @@ const Bind = observer((props: Props) => {
         defaultMessage: '注册时间',
       }),
       dataIndex: 'registryTime',
+      valueType: 'dateTime',
     },
     {
       title: intl.formatMessage({
@@ -61,6 +62,38 @@ const Bind = observer((props: Props) => {
         defaultMessage: '状态',
       }),
       dataIndex: 'state',
+      valueType: 'select',
+      valueEnum: {
+        all: {
+          text: intl.formatMessage({
+            id: 'pages.searchTable.titleStatus.all',
+            defaultMessage: '全部',
+          }),
+          status: 'Default',
+        },
+        onLine: {
+          text: intl.formatMessage({
+            id: 'pages.device.instance.status.onLine',
+            defaultMessage: '在线',
+          }),
+          status: 'onLine',
+        },
+        offLine: {
+          text: intl.formatMessage({
+            id: 'pages.device.instance.status.offLine',
+            defaultMessage: '离线',
+          }),
+          status: 'offLine',
+        },
+        notActive: {
+          text: intl.formatMessage({
+            id: 'pages.device.instance.status.notActive',
+            defaultMessage: '未启用',
+          }),
+          status: 'notActive',
+        },
+      },
+      search: false,
       render: (_, row) => <DeviceBadge type={row.state.value} text={row.state.text} />,
     },
   ];

+ 15 - 3
src/pages/system/Department/Assets/deivce/index.tsx

@@ -12,6 +12,7 @@ import Models from './model';
 import Service from '@/pages/system/Department/Assets/service';
 import Bind from './bind';
 import SearchComponent from '@/components/SearchComponent';
+import { getButtonPermission } from '@/utils/menu';
 
 export const service = new Service<DeviceItem>('assets');
 
@@ -95,6 +96,7 @@ export default observer(() => {
         defaultMessage: '注册时间',
       }),
       dataIndex: 'registryTime',
+      valueType: 'dateTime',
     },
     {
       title: intl.formatMessage({
@@ -156,8 +158,13 @@ export default observer(() => {
           onConfirm={() => {
             singleUnBind(record.id);
           }}
+          disabled={getButtonPermission('system/Department', ['add', 'update'])}
         >
-          <a href="#">
+          <Button
+            type={'link'}
+            style={{ padding: 0 }}
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
+          >
             <Tooltip
               title={intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
@@ -166,7 +173,7 @@ export default observer(() => {
             >
               <DisconnectOutlined />
             </Tooltip>
-          </a>
+          </Button>
         </Popconfirm>,
       ],
     },
@@ -233,6 +240,7 @@ export default observer(() => {
             icon={<PlusOutlined />}
             type="primary"
             key="bind"
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
           >
             {intl.formatMessage({
               id: 'pages.data.option.assets',
@@ -246,8 +254,12 @@ export default observer(() => {
             })}
             key="unBind"
             onConfirm={handleUnBind}
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
           >
-            <Button icon={<DisconnectOutlined />} key="bind">
+            <Button
+              icon={<DisconnectOutlined />}
+              disabled={getButtonPermission('system/Department', ['add', 'update'])}
+            >
               {intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
                 defaultMessage: '批量解绑',

+ 4 - 6
src/pages/system/Department/Assets/product/bind.tsx

@@ -42,14 +42,12 @@ const Bind = observer((props: Props) => {
       },
     },
     {
-      dataIndex: 'username',
+      dataIndex: 'describe',
       title: intl.formatMessage({
-        id: 'pages.table.describe',
-        defaultMessage: '用户名',
+        id: 'pages.system.description',
+        defaultMessage: '说明',
       }),
-      search: {
-        transform: (value) => ({ username$LIKE: value }),
-      },
+      hideInSearch: true,
     },
   ];
 

+ 19 - 9
src/pages/system/Department/Assets/product/index.tsx

@@ -12,6 +12,7 @@ import Service from '@/pages/system/Department/Assets/service';
 import Models from './model';
 import Bind from './bind';
 import SearchComponent from '@/components/SearchComponent';
+import { getButtonPermission } from '@/utils/menu';
 
 export const service = new Service<ProductItem>('assets');
 
@@ -63,7 +64,7 @@ export default observer(() => {
     {
       dataIndex: 'name',
       title: intl.formatMessage({
-        id: 'pages.system.name',
+        id: 'pages.table.name',
         defaultMessage: '名称',
       }),
       search: {
@@ -72,12 +73,11 @@ export default observer(() => {
     },
     {
       title: intl.formatMessage({
-        id: 'pages.system.tenant.memberManagement.administrators',
-        defaultMessage: '管理员',
+        id: 'pages.system.description',
+        defaultMessage: '说明',
       }),
-      dataIndex: 'adminMember',
-      renderText: (text) => (text ? '是' : '否'),
-      search: false,
+      dataIndex: 'describe',
+      hideInSearch: true,
     },
     {
       title: intl.formatMessage({
@@ -97,8 +97,13 @@ export default observer(() => {
           onConfirm={() => {
             singleUnBind(record.id);
           }}
+          disabled={getButtonPermission('system/Department', ['add', 'update'])}
         >
-          <a href="#">
+          <Button
+            type={'link'}
+            style={{ padding: 0 }}
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
+          >
             <Tooltip
               title={intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
@@ -107,7 +112,7 @@ export default observer(() => {
             >
               <DisconnectOutlined />
             </Tooltip>
-          </a>
+          </Button>
         </Popconfirm>,
       ],
     },
@@ -174,6 +179,7 @@ export default observer(() => {
             icon={<PlusOutlined />}
             type="primary"
             key="bind"
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
           >
             {intl.formatMessage({
               id: 'pages.data.option.assets',
@@ -187,8 +193,12 @@ export default observer(() => {
             })}
             key="unBind"
             onConfirm={handleUnBind}
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
           >
-            <Button icon={<DisconnectOutlined />} key="bind">
+            <Button
+              icon={<DisconnectOutlined />}
+              disabled={getButtonPermission('system/Department', ['add', 'update'])}
+            >
               {intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
                 defaultMessage: '批量解绑',

+ 3 - 4
src/pages/system/Department/Assets/productCategory/bind.tsx

@@ -38,9 +38,6 @@ const Bind = observer((props: Props) => {
         id: 'pages.system.name',
         defaultMessage: '标识',
       }),
-      search: {
-        transform: (value) => ({ name$LIKE: value }),
-      },
     },
     {
       dataIndex: 'name',
@@ -48,7 +45,9 @@ const Bind = observer((props: Props) => {
         id: 'pages.system.name',
         defaultMessage: '分类名称',
       }),
-      search: false,
+      search: {
+        transform: (value) => ({ username$LIKE: value }),
+      },
     },
   ];
 

+ 20 - 10
src/pages/system/Department/Assets/productCategory/index.tsx

@@ -13,6 +13,7 @@ import Service from '@/pages/system/Department/Assets/service';
 import Bind from './bind';
 import SearchComponent from '@/components/SearchComponent';
 import { difference } from 'lodash';
+import { getButtonPermission } from '@/utils/menu';
 
 export const service = new Service<ProductCategoryItem>('assets');
 
@@ -79,17 +80,16 @@ export default observer(() => {
         id: 'pages.device.category.key',
         defaultMessage: '标识',
       }),
-      search: {
-        transform: (value) => ({ name$LIKE: value }),
-      },
     },
     {
       dataIndex: 'name',
       title: intl.formatMessage({
-        id: 'pages.device.category.name',
-        defaultMessage: '分类名称',
+        id: 'pages.table.name',
+        defaultMessage: '名称',
       }),
-      search: false,
+      search: {
+        transform: (value) => ({ name$LIKE: value }),
+      },
     },
     {
       dataIndex: 'description',
@@ -97,7 +97,7 @@ export default observer(() => {
         id: 'pages.system.description',
         defaultMessage: '说明',
       }),
-      search: false,
+      hideInSearch: true,
     },
     {
       title: intl.formatMessage({
@@ -117,8 +117,13 @@ export default observer(() => {
           onConfirm={() => {
             singleUnBind(record.id);
           }}
+          disabled={getButtonPermission('system/Department', ['add', 'update'])}
         >
-          <a href="#">
+          <Button
+            type={'link'}
+            style={{ padding: 0 }}
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
+          >
             <Tooltip
               title={intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
@@ -127,7 +132,7 @@ export default observer(() => {
             >
               <DisconnectOutlined />
             </Tooltip>
-          </a>
+          </Button>
         </Popconfirm>,
       ],
     },
@@ -242,6 +247,7 @@ export default observer(() => {
             icon={<PlusOutlined />}
             type="primary"
             key="bind"
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
           >
             {intl.formatMessage({
               id: 'pages.data.option.assets',
@@ -255,8 +261,12 @@ export default observer(() => {
             })}
             key="unBind"
             onConfirm={handleUnBind}
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
           >
-            <Button icon={<DisconnectOutlined />} key="bind">
+            <Button
+              icon={<DisconnectOutlined />}
+              disabled={getButtonPermission('system/Department', ['add', 'update'])}
+            >
               {intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
                 defaultMessage: '批量解绑',

+ 14 - 3
src/pages/system/Department/Member/index.tsx

@@ -12,6 +12,7 @@ import Service from '@/pages/system/Department/Member/service';
 import { DisconnectOutlined, PlusOutlined } from '@ant-design/icons';
 import Bind from './bind';
 import SearchComponent from '@/components/SearchComponent';
+import { getButtonPermission } from '@/utils/menu';
 
 export const service = new Service('tenant');
 
@@ -129,8 +130,13 @@ const Member = observer(() => {
           onConfirm={() => {
             singleUnBind(record.id);
           }}
+          disabled={getButtonPermission('system/Department', ['add', 'update'])}
         >
-          <a href="#">
+          <Button
+            type={'link'}
+            style={{ padding: 0 }}
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
+          >
             <Tooltip
               title={intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
@@ -139,7 +145,7 @@ const Member = observer(() => {
             >
               <DisconnectOutlined />
             </Tooltip>
-          </a>
+          </Button>
         </Popconfirm>,
       ],
     },
@@ -192,6 +198,7 @@ const Member = observer(() => {
             icon={<PlusOutlined />}
             type="primary"
             key="bind"
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
           >
             {intl.formatMessage({
               id: 'pages.system.role.option.bindUser',
@@ -205,8 +212,12 @@ const Member = observer(() => {
             })}
             key="unBind"
             onConfirm={handleUnBind}
+            disabled={getButtonPermission('system/Department', ['add', 'update'])}
           >
-            <Button icon={<DisconnectOutlined />} key="bind">
+            <Button
+              icon={<DisconnectOutlined />}
+              disabled={getButtonPermission('system/Department', ['add', 'update'])}
+            >
               {intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
                 defaultMessage: '批量解绑',

+ 3 - 7
src/pages/system/Department/index.tsx

@@ -76,6 +76,7 @@ export default observer(() => {
       search: false,
       valueType: 'digit',
       dataIndex: 'sortIndex',
+      sorter: true,
     },
     {
       title: intl.formatMessage({
@@ -88,7 +89,7 @@ export default observer(() => {
         <Button
           style={{ padding: 0 }}
           type="link"
-          disabled={getButtonPermission('system/Department', ['add', 'update'])}
+          disabled={getButtonPermission('system/Department', ['update'])}
           key="editable"
           onClick={() => {
             State.current = record;
@@ -129,7 +130,6 @@ export default observer(() => {
           type="link"
           style={{ padding: 0 }}
           key="assets"
-          disabled={getButtonPermission('system/Department', ['add', 'view', 'update'])}
           onClick={() => {
             history.push(
               `${getMenuPathByParams(
@@ -152,7 +152,6 @@ export default observer(() => {
           type="link"
           key="user"
           style={{ padding: 0 }}
-          disabled={getButtonPermission('system/Department', ['add', 'view', 'update'])}
           onClick={() =>
             history.push(
               `${getMenuPathByParams(MENUS_CODE['system/Department/Detail'], record.id)}?type=user`,
@@ -290,11 +289,8 @@ export default observer(() => {
         request={async (params) => {
           const response = await service.queryOrgThree({
             paging: false,
+            sorts: [{ name: 'sortIndex', order: 'asc' }],
             ...params,
-            sorts: [
-              { name: 'createTime', order: 'desc' },
-              { name: 'sortIndex', order: 'asc' },
-            ],
           });
           setTreeData(response.result);
           return {

+ 2 - 0
src/pages/system/Menu/index.tsx

@@ -101,6 +101,7 @@ export default observer(() => {
       }),
       width: 80,
       dataIndex: 'sortIndex',
+      valueType: 'digit',
     },
     {
       title: intl.formatMessage({
@@ -109,6 +110,7 @@ export default observer(() => {
       }),
       width: 200,
       dataIndex: 'describe',
+      hideInSearch: true,
     },
     {
       title: intl.formatMessage({