|
@@ -16,7 +16,7 @@ type ParticipantCardProps = {
|
|
|
institutionID: string | null
|
|
|
configure: ConfigureType[]
|
|
|
}
|
|
|
- institutionList: { label: string; value: string }[]
|
|
|
+ institutionList: { label: string; value: string; member?: { ID: string; name: string }[] }[]
|
|
|
updateAction: (values: Recordable<string>) => void
|
|
|
}
|
|
|
|
|
@@ -116,7 +116,14 @@ const ParticipantCard: React.FC<ParticipantCardProps> = ({
|
|
|
{ label: '单位角色模式', value: ParticipantMode.ROLE }
|
|
|
]}
|
|
|
onChange={value => {
|
|
|
- updateAction({ ...defaultData, participantMode: value })
|
|
|
+ // 切换了模式,数据清空
|
|
|
+ updateAction({
|
|
|
+ ...defaultData,
|
|
|
+ participantMode: value,
|
|
|
+ institutionID: null,
|
|
|
+ ID: null,
|
|
|
+ name: null
|
|
|
+ })
|
|
|
}}
|
|
|
/>
|
|
|
</div>
|
|
@@ -124,10 +131,19 @@ const ParticipantCard: React.FC<ParticipantCardProps> = ({
|
|
|
<Select
|
|
|
className="w-full"
|
|
|
value={defaultData.institutionID}
|
|
|
- options={institutionList}
|
|
|
- onChange={async value => {
|
|
|
+ options={
|
|
|
+ defaultData.participantMode === ParticipantMode.ACCOUNT
|
|
|
+ ? institutionList
|
|
|
+ : institutionList.filter(item => item.member?.length)
|
|
|
+ }
|
|
|
+ onChange={async (value, option) => {
|
|
|
if (value && defaultData.participantMode === ParticipantMode.ACCOUNT) {
|
|
|
await tryUpdateStaffList(value)
|
|
|
+ } else {
|
|
|
+ const staff: undefined | { ID: string; name: string } = option.member?.[0]
|
|
|
+ staff &&
|
|
|
+ updateAction({ ...defaultData, institutionID: value, ID: staff.ID, name: staff.name })
|
|
|
+ return
|
|
|
}
|
|
|
updateAction({ ...defaultData, institutionID: value, ID: null, name: null })
|
|
|
}}
|