/* * @Author: your name * @Date: 2022-01-12 17:11:11 * @LastEditTime: 2023-09-18 18:07:16 * @LastEditors: code4eat awesomedema@gmail.com * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/userManage/modal.tsx */ import React from 'react'; import KCModal from '@/components/KCModal'; import KCProSelect from '@/components/KCProSelect'; import { roleManageModelState, Dispatch } from 'umi'; import { ProFormText, ProFormTextArea } from '@ant-design/pro-form'; import { getHospList, getShareHospList } from '@/service/hospList'; import { AddUsersDataType, getYoushuUsers } from '@/service/user'; import { TableActType } from '..'; import { Form } from 'antd'; import MenuEditer from '@/pages/platform/components/menuEditer/menu'; import UserEditer from '@/pages/platform/components/usersEditer'; interface ActModalProps extends roleManageModelState { dispatch: Dispatch | undefined; } const ActModal: React.FC = ({ dispatch, isShowModal, tableAct, currentEdit, hospId }) => { const onVisibleChangeHandle = (bool: boolean) => { // console.log({bool}); if (!bool) { dispatch && dispatch({ type: 'roleManageModel/cancelTableAct', }); } }; const onFinishHandle = (data: any & AddUsersDataType) => { if (tableAct == TableActType.ADD) { dispatch && dispatch({ type: 'roleManageModel/postAddData', payload: data, }); } if (tableAct == TableActType.EDIT || tableAct == TableActType.EDITMENU || tableAct == TableActType.EDITRELAUSER) { dispatch && dispatch({ type: 'roleManageModel/postEditData', payload: data, }); } return true; }; const setModalTitle = () => { if (tableAct == TableActType.EDIT) { return '编辑角色'; } if (tableAct == TableActType.ADD) { return '新增角色'; } if (tableAct == TableActType.EDITMENU) { return '绑定菜单'; } if (tableAct == TableActType.EDITRELAUSER) { return '绑定人员'; } }; const setInitialValues = () => { if (tableAct == TableActType.EDIT) { return { ...currentEdit }; } if (tableAct == TableActType.ADD) { console.log({hospId}); return { hospId: hospId }; } if (tableAct == TableActType.EDITMENU || tableAct == TableActType.EDITRELAUSER) { return { ...currentEdit }; } }; return ( onFinishHandle(data)} > {tableAct == TableActType.EDITMENU && ( )} {tableAct == TableActType.EDITRELAUSER && ( )} {(tableAct == TableActType.ADD || tableAct == TableActType.EDIT) && ( <> { const hospList = await getShareHospList(); if (hospList) { return hospList.map((t) => ({ label: t.name, value: t.id, })); } return []; }} /> { const resp = await getYoushuUsers(); if (resp) { return resp.map((t) => ({ label: t.name, value: t.id, })); } return []; }} /> )} ); }; export default ActModal;