|
@@ -14,9 +14,10 @@ import { ModalForm, ProFormText } from '@ant-design/pro-form'
|
|
type RoleMenuProps = {
|
|
type RoleMenuProps = {
|
|
menuId: string
|
|
menuId: string
|
|
onSelect?: (id: string) => void
|
|
onSelect?: (id: string) => void
|
|
|
|
+ itemCount?: number
|
|
}
|
|
}
|
|
|
|
|
|
-const RoleMenu: React.FC<RoleMenuProps> = ({ menuId, onSelect }) => {
|
|
|
|
|
|
+const RoleMenu: React.FC<RoleMenuProps> = ({ menuId, onSelect, itemCount }) => {
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
value: ''
|
|
value: ''
|
|
})
|
|
})
|
|
@@ -141,7 +142,12 @@ const RoleMenu: React.FC<RoleMenuProps> = ({ menuId, onSelect }) => {
|
|
title="确认删除吗?"
|
|
title="确认删除吗?"
|
|
okText="确认"
|
|
okText="确认"
|
|
cancelText="取消"
|
|
cancelText="取消"
|
|
- onConfirm={() => tryDeleteRole(item.id)}>
|
|
|
|
|
|
+ onConfirm={() => {
|
|
|
|
+ if (itemCount && itemCount !== 0) {
|
|
|
|
+ return message.warning('请先移除已经关联的员工')
|
|
|
|
+ }
|
|
|
|
+ return tryDeleteRole(item.id)
|
|
|
|
+ }}>
|
|
<li className="text-red-500">删除</li>
|
|
<li className="text-red-500">删除</li>
|
|
</Popconfirm>
|
|
</Popconfirm>
|
|
</ul>
|
|
</ul>
|