|
@@ -13,6 +13,7 @@ import { dateFormatter } from '../utils/formatTime';
|
|
|
import UploadImg from './lockCabinet/UploadImg';
|
|
import UploadImg from './lockCabinet/UploadImg';
|
|
|
import { Button as UIButton } from './ui/button';
|
|
import { Button as UIButton } from './ui/button';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
+import PermissionWrapper from './PermissionWrapper';
|
|
|
|
|
|
|
|
interface PadLockManagementProps {
|
|
interface PadLockManagementProps {
|
|
|
subMenu?: string;
|
|
subMenu?: string;
|
|
@@ -400,24 +401,28 @@ export default function PadLockManagement({ subMenu }: PadLockManagementProps) {
|
|
|
fixed: 'right',
|
|
fixed: 'right',
|
|
|
render: (_: any, record: PadLockVO) => (
|
|
render: (_: any, record: PadLockVO) => (
|
|
|
<div className="flex items-center gap-2 justify-center">
|
|
<div className="flex items-center gap-2 justify-center">
|
|
|
- <UIButton
|
|
|
|
|
- variant="ghost"
|
|
|
|
|
- size="sm"
|
|
|
|
|
- onClick={() => openPadLockForm('update', record.lockId || record.id)}
|
|
|
|
|
- className="h-8 px-2"
|
|
|
|
|
- >
|
|
|
|
|
- <Edit2 className="w-4 h-4" />
|
|
|
|
|
- <span className="ml-1">编辑</span>
|
|
|
|
|
- </UIButton>
|
|
|
|
|
- <UIButton
|
|
|
|
|
- variant="ghost"
|
|
|
|
|
- size="sm"
|
|
|
|
|
- onClick={() => handleDelete(record.lockId || record.id)}
|
|
|
|
|
- className="h-8 px-2 text-red-600 hover:text-red-700"
|
|
|
|
|
- >
|
|
|
|
|
- <Trash2 className="w-4 h-4" />
|
|
|
|
|
- <span className="ml-1">删除</span>
|
|
|
|
|
- </UIButton>
|
|
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:update">
|
|
|
|
|
+ <UIButton
|
|
|
|
|
+ variant="ghost"
|
|
|
|
|
+ size="sm"
|
|
|
|
|
+ onClick={() => openPadLockForm('update', record.lockId || record.id)}
|
|
|
|
|
+ className="h-8 px-2"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Edit2 className="w-4 h-4" />
|
|
|
|
|
+ <span className="ml-1">编辑</span>
|
|
|
|
|
+ </UIButton>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:delete">
|
|
|
|
|
+ <UIButton
|
|
|
|
|
+ variant="ghost"
|
|
|
|
|
+ size="sm"
|
|
|
|
|
+ onClick={() => handleDelete(record.lockId || record.id)}
|
|
|
|
|
+ className="h-8 px-2 text-red-600 hover:text-red-700"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Trash2 className="w-4 h-4" />
|
|
|
|
|
+ <span className="ml-1">删除</span>
|
|
|
|
|
+ </UIButton>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
</div>
|
|
</div>
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
@@ -487,15 +492,17 @@ export default function PadLockManagement({ subMenu }: PadLockManagementProps) {
|
|
|
fixed: 'right',
|
|
fixed: 'right',
|
|
|
render: (_: any, record: PadLockTypeVO) => (
|
|
render: (_: any, record: PadLockTypeVO) => (
|
|
|
<div className="flex items-center gap-2 justify-center">
|
|
<div className="flex items-center gap-2 justify-center">
|
|
|
- <UIButton
|
|
|
|
|
- variant="ghost"
|
|
|
|
|
- size="sm"
|
|
|
|
|
- onClick={() => openTypeForm('update', record.lockTypeId || record.id)}
|
|
|
|
|
- className="h-8 px-2"
|
|
|
|
|
- >
|
|
|
|
|
- <Edit2 className="w-4 h-4" />
|
|
|
|
|
- <span className="ml-1">修改</span>
|
|
|
|
|
- </UIButton>
|
|
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:update">
|
|
|
|
|
+ <UIButton
|
|
|
|
|
+ variant="ghost"
|
|
|
|
|
+ size="sm"
|
|
|
|
|
+ onClick={() => openTypeForm('update', record.lockTypeId || record.id)}
|
|
|
|
|
+ className="h-8 px-2"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Edit2 className="w-4 h-4" />
|
|
|
|
|
+ <span className="ml-1">修改</span>
|
|
|
|
|
+ </UIButton>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
<UIButton
|
|
<UIButton
|
|
|
variant="ghost"
|
|
variant="ghost"
|
|
|
size="sm"
|
|
size="sm"
|
|
@@ -547,44 +554,52 @@ export default function PadLockManagement({ subMenu }: PadLockManagementProps) {
|
|
|
|
|
|
|
|
{/* 操作按钮组 */}
|
|
{/* 操作按钮组 */}
|
|
|
<Space className="flex-shrink-0">
|
|
<Space className="flex-shrink-0">
|
|
|
- <Button
|
|
|
|
|
- type="primary"
|
|
|
|
|
- icon={<Search className="w-4 h-4" />}
|
|
|
|
|
- onClick={handleQuery}
|
|
|
|
|
- >
|
|
|
|
|
- 搜索
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:query">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon={<Search className="w-4 h-4" />}
|
|
|
|
|
+ onClick={handleQuery}
|
|
|
|
|
+ >
|
|
|
|
|
+ 搜索
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
|
|
+
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:query">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ icon={<RefreshCw className="w-4 h-4" />}
|
|
|
|
|
+ onClick={resetQuery}
|
|
|
|
|
+ >
|
|
|
|
|
+ 重置
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
|
|
+
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:create">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon={<Plus className="w-4 h-4" />}
|
|
|
|
|
+ onClick={() => openPadLockForm('create')}
|
|
|
|
|
+ >
|
|
|
|
|
+ 新增
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
|
|
+
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:delete">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ danger
|
|
|
|
|
+ icon={<Trash2 className="w-4 h-4" />}
|
|
|
|
|
+ onClick={() => handleDelete()}
|
|
|
|
|
+ disabled={selectedRowKeys.length === 0}
|
|
|
|
|
+ >
|
|
|
|
|
+ 批量删除
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
|
|
|
|
|
<Button
|
|
<Button
|
|
|
- icon={<RefreshCw className="w-4 h-4" />}
|
|
|
|
|
- onClick={resetQuery}
|
|
|
|
|
|
|
+ icon={<Settings className="w-4 h-4" />}
|
|
|
|
|
+ onClick={() => setViewMode('type')}
|
|
|
>
|
|
>
|
|
|
- 重置
|
|
|
|
|
|
|
+ 设置挂锁类型
|
|
|
</Button>
|
|
</Button>
|
|
|
-
|
|
|
|
|
- <Button
|
|
|
|
|
- type="primary"
|
|
|
|
|
- icon={<Plus className="w-4 h-4" />}
|
|
|
|
|
- onClick={() => openPadLockForm('create')}
|
|
|
|
|
- >
|
|
|
|
|
- 新增
|
|
|
|
|
- </Button>
|
|
|
|
|
-
|
|
|
|
|
- <Button
|
|
|
|
|
- danger
|
|
|
|
|
- icon={<Trash2 className="w-4 h-4" />}
|
|
|
|
|
- onClick={() => handleDelete()}
|
|
|
|
|
- disabled={selectedRowKeys.length === 0}
|
|
|
|
|
- >
|
|
|
|
|
- 批量删除
|
|
|
|
|
- </Button>
|
|
|
|
|
-
|
|
|
|
|
- <Button
|
|
|
|
|
- icon={<Settings className="w-4 h-4" />}
|
|
|
|
|
- onClick={() => setViewMode('type')}
|
|
|
|
|
- >
|
|
|
|
|
- 设置挂锁类型
|
|
|
|
|
- </Button>
|
|
|
|
|
</Space>
|
|
</Space>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -669,28 +684,34 @@ export default function PadLockManagement({ subMenu }: PadLockManagementProps) {
|
|
|
|
|
|
|
|
{/* 操作按钮组 */}
|
|
{/* 操作按钮组 */}
|
|
|
<Space className="flex-shrink-0">
|
|
<Space className="flex-shrink-0">
|
|
|
- <Button
|
|
|
|
|
- type="primary"
|
|
|
|
|
- icon={<Search className="w-4 h-4" />}
|
|
|
|
|
- onClick={handleTypeQuery}
|
|
|
|
|
- >
|
|
|
|
|
- 搜索
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:query">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon={<Search className="w-4 h-4" />}
|
|
|
|
|
+ onClick={handleTypeQuery}
|
|
|
|
|
+ >
|
|
|
|
|
+ 搜索
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
|
|
|
|
|
- <Button
|
|
|
|
|
- icon={<RefreshCw className="w-4 h-4" />}
|
|
|
|
|
- onClick={resetTypeQuery}
|
|
|
|
|
- >
|
|
|
|
|
- 重置
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:query">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ icon={<RefreshCw className="w-4 h-4" />}
|
|
|
|
|
+ onClick={resetTypeQuery}
|
|
|
|
|
+ >
|
|
|
|
|
+ 重置
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
|
|
|
|
|
- <Button
|
|
|
|
|
- type="primary"
|
|
|
|
|
- icon={<Plus className="w-4 h-4" />}
|
|
|
|
|
- onClick={() => openTypeForm('create')}
|
|
|
|
|
- >
|
|
|
|
|
- 新增
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <PermissionWrapper permission="iscs:lock:create">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon={<Plus className="w-4 h-4" />}
|
|
|
|
|
+ onClick={() => openTypeForm('create')}
|
|
|
|
|
+ >
|
|
|
|
|
+ 新增
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PermissionWrapper>
|
|
|
|
|
|
|
|
<Button
|
|
<Button
|
|
|
icon={<ArrowUpDown className="w-4 h-4" />}
|
|
icon={<ArrowUpDown className="w-4 h-4" />}
|