|
@@ -5,6 +5,7 @@ import consts from '@/utils/consts'
|
|
import {
|
|
import {
|
|
addAccount,
|
|
addAccount,
|
|
updateAccount,
|
|
updateAccount,
|
|
|
|
+ queryAccountDetail,
|
|
queryInstitutionList,
|
|
queryInstitutionList,
|
|
queryOrganizationalStructureList
|
|
queryOrganizationalStructureList
|
|
} from '@/services/api/institution'
|
|
} from '@/services/api/institution'
|
|
@@ -25,6 +26,7 @@ type StaffModalProps = ConnectProps & {
|
|
onVisibleChange: (visible: boolean) => void
|
|
onVisibleChange: (visible: boolean) => void
|
|
institutionDisable: boolean
|
|
institutionDisable: boolean
|
|
type: ModalType
|
|
type: ModalType
|
|
|
|
+ dataId: string
|
|
defaultFormData?: {
|
|
defaultFormData?: {
|
|
ID: string
|
|
ID: string
|
|
name: string
|
|
name: string
|
|
@@ -44,12 +46,38 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
schema,
|
|
schema,
|
|
dispatch,
|
|
dispatch,
|
|
type,
|
|
type,
|
|
|
|
+ dataId,
|
|
defaultFormData,
|
|
defaultFormData,
|
|
accountTypeList,
|
|
accountTypeList,
|
|
reload
|
|
reload
|
|
}) => {
|
|
}) => {
|
|
const form = useForm()
|
|
const form = useForm()
|
|
|
|
+
|
|
|
|
+ const { run: tryUpdateAccount } = useRequest(updateAccount, {
|
|
|
|
+ manual: true,
|
|
|
|
+ onSuccess: () => {
|
|
|
|
+ message.success('更新成功')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ const { run: tryAddAccount } = useRequest(addAccount, {
|
|
|
|
+ manual: true,
|
|
|
|
+ onSuccess: () => {
|
|
|
|
+ message.success('创建成功')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ const { run: tryGetAccountDetail } = useRequest(queryAccountDetail, {
|
|
|
|
+ manual: true,
|
|
|
|
+ onSuccess: () => {
|
|
|
|
+ setState({ ...state, accountDetail: result })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
+ if (type === ModalType.PREVIEW) {
|
|
|
|
+ tryGetAccountDetail({ ID: dataId })
|
|
|
|
+ }
|
|
if (visible) {
|
|
if (visible) {
|
|
if (!schema) {
|
|
if (!schema) {
|
|
dispatch({
|
|
dispatch({
|
|
@@ -84,20 +112,6 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
// }
|
|
// }
|
|
// }, [organizationList?.length])
|
|
// }, [organizationList?.length])
|
|
|
|
|
|
- const { run: tryUpdateAccount } = useRequest(updateAccount, {
|
|
|
|
- manual: true,
|
|
|
|
- onSuccess: () => {
|
|
|
|
- message.success('更新成功')
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- const { run: tryAddAccount } = useRequest(addAccount, {
|
|
|
|
- manual: true,
|
|
|
|
- onSuccess: () => {
|
|
|
|
- message.success('创建成功')
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
const queryInstitutionOptions = async params => {
|
|
const queryInstitutionOptions = async params => {
|
|
const { code = -1, data = {} } = await queryInstitutionList({
|
|
const { code = -1, data = {} } = await queryInstitutionList({
|
|
...params,
|
|
...params,
|