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

update: pda菜单禁止删除和修改菜单id

xyh 3 лет назад
Родитель
Сommit
5a0f4b0d47

+ 4 - 18
packages/app/src/pages/pda-menu/table/hooks.tsx

@@ -1,15 +1,13 @@
-import {deleteMenu} from '@apis';
 import {MenuListData} from '@models';
 import {Button} from 'antd';
 import {ColumnsType} from 'antd/es/table';
 import {
-  DOUBLE_BTN_WIDTH,
   HUGE_TABLE_WIDTH,
   MIDDLE_TABLE_WIDTH,
   NORMAL_TABLE_WIDTH,
   SMALL_TABLE_WIDTH,
 } from '@utils';
-import {useTableModalEvent, useTableDeleteEvent} from '@hooks';
+import {useTableModalEvent} from '@hooks';
 
 const tableColumns: ColumnsType<MenuListData> = [
   {
@@ -45,12 +43,9 @@ const tableColumns: ColumnsType<MenuListData> = [
   },
 ];
 
-export function useHandle(refetch: () => void) {
+export function useHandle() {
   const [{visible, editId}, {onAdd, onEdit, onClose: onModalClose}] =
     useTableModalEvent();
-  const [pendingId, onDelete] = useTableDeleteEvent(deleteMenu, refetch, {
-    label: 'PDA菜单',
-  });
 
   const columns: ColumnsType<MenuListData> = [
     ...tableColumns,
@@ -59,26 +54,17 @@ export function useHandle(refetch: () => void) {
       dataIndex: 'id',
       key: 'id',
       fixed: 'right',
-      width: DOUBLE_BTN_WIDTH,
-      render(_, {id, name}) {
+      width: SMALL_TABLE_WIDTH,
+      render(_, {id}) {
         return (
           <>
             <Button
               type='text'
               className='ant-text-btn-color-primary'
-              disabled={pendingId === id}
               onClick={onEdit(id)}
             >
               修改
             </Button>
-            <Button
-              type='text'
-              danger
-              loading={pendingId === id}
-              onClick={onDelete(id, name)}
-            >
-              删除
-            </Button>
           </>
         );
       },

+ 1 - 2
packages/app/src/pages/pda-menu/table/index.tsx

@@ -16,8 +16,7 @@ const TableList: FC = function () {
     pageContext,
     searchContext,
   });
-  const [{columns, visible, editId}, {onModalClose, onAdd}] =
-    useHandle(refetch);
+  const [{columns, visible, editId}, {onModalClose, onAdd}] = useHandle();
 
   return (
     <>

+ 6 - 1
packages/app/src/pages/pda-menu/table/modal/Info.tsx

@@ -12,7 +12,12 @@ const Info: FC<Props> = function ({id}) {
 
   return (
     <>
-      <ModalField name='menuID' label='菜单ID' control={control} />
+      <ModalField
+        name='menuID'
+        label='菜单ID'
+        control={control}
+        disabled={Boolean(id)}
+      />
       <ModalField name='menuName' label='菜单名称' control={control} />
       <ModalField
         name='menuOrderBy'