Commit 50f05fee5f8284e8a20bc7d614cd43ecdefff8d7
1 parent
5545abf5
perf: create terant react set tenantProfileId field default select Default option
Showing
2 changed files
with
4 additions
and
4 deletions
... | ... | @@ -52,7 +52,7 @@ export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { |
52 | 52 | ...params, |
53 | 53 | orderFiled: 'createdTime', |
54 | 54 | }; |
55 | - return defHttp.get<PaginationResult>({ | |
55 | + return defHttp.get<PaginationResult<{ default: boolean; id: { id: string } }>>({ | |
56 | 56 | url: Api.getTenantProfile, |
57 | 57 | params: param, |
58 | 58 | }); | ... | ... |
... | ... | @@ -130,9 +130,9 @@ export const tenantFormSchema: FormSchema[] = [ |
130 | 130 | return { |
131 | 131 | api: async (params: QueryTenantProfilesParam) => { |
132 | 132 | const { items, total } = await getTableTenantProfileApi(params); |
133 | - const firstRecord = items.at(0); | |
134 | - if (firstRecord) { | |
135 | - setFieldsValue({ tenantProfileId: firstRecord.id.id }); | |
133 | + const defaultRecord = items.find((item) => item.default); | |
134 | + if (defaultRecord) { | |
135 | + setFieldsValue({ tenantProfileId: defaultRecord.id.id }); | |
136 | 136 | } |
137 | 137 | return { items, total }; |
138 | 138 | }, | ... | ... |