From ef605de159d659568e9ff4c71c3e92c6f3a5aa75 Mon Sep 17 00:00:00 2001 From: Johnton Chen <504071088@qq.com> Date: Fri, 31 Jul 2026 17:58:51 +0800 Subject: [PATCH] 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. --- src/pages/user/Popup.tsx | 4 +++- src/pages/user/index.tsx | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/user/Popup.tsx b/src/pages/user/Popup.tsx index dbb9479..56b7f78 100644 --- a/src/pages/user/Popup.tsx +++ b/src/pages/user/Popup.tsx @@ -29,6 +29,7 @@ export default (props: { action: NewAction; visible: boolean; roleList: API.RolesListItem[]; + currentCompanyId: number | string; companyList: API.CompanyListItem[]; dataSourceList: API.DataSourceListItem[]; formValues: Partial; @@ -48,6 +49,7 @@ export default (props: { roleList, companyList, dataSourceList, + currentCompanyId, } = props; const dataSourceForm = ( @@ -165,7 +167,7 @@ export default (props: { } : { enabled: true, - companyId: companyList[0]?.id, + companyId: currentCompanyId || companyList[0]?.id, } } open={visible} diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index b51a864..f047b81 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -412,6 +412,7 @@ const User: React.FC = () => { visible={visible} formValues={formValues} roleList={roleList} + currentCompanyId={companyType} companyList={companyList} dataSourceList={dataSourceList} onDone={handleDone}