fix(user): default to current company in user edit popup

Pass currentCompanyId to Popup so the form defaults to the
currently active company instead of always picking the first
item from companyList.
This commit is contained in:
2026-07-31 17:58:51 +08:00
parent 08e695b9ad
commit ef605de159
2 changed files with 4 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ export default (props: {
action: NewAction; action: NewAction;
visible: boolean; visible: boolean;
roleList: API.RolesListItem[]; roleList: API.RolesListItem[];
currentCompanyId: number | string;
companyList: API.CompanyListItem[]; companyList: API.CompanyListItem[];
dataSourceList: API.DataSourceListItem[]; dataSourceList: API.DataSourceListItem[];
formValues: Partial<UserListItem | undefined>; formValues: Partial<UserListItem | undefined>;
@@ -48,6 +49,7 @@ export default (props: {
roleList, roleList,
companyList, companyList,
dataSourceList, dataSourceList,
currentCompanyId,
} = props; } = props;
const dataSourceForm = ( const dataSourceForm = (
@@ -165,7 +167,7 @@ export default (props: {
} }
: { : {
enabled: true, enabled: true,
companyId: companyList[0]?.id, companyId: currentCompanyId || companyList[0]?.id,
} }
} }
open={visible} open={visible}

View File

@@ -412,6 +412,7 @@ const User: React.FC = () => {
visible={visible} visible={visible}
formValues={formValues} formValues={formValues}
roleList={roleList} roleList={roleList}
currentCompanyId={companyType}
companyList={companyList} companyList={companyList}
dataSourceList={dataSourceList} dataSourceList={dataSourceList}
onDone={handleDone} onDone={handleDone}