Commit 50f05fee5f8284e8a20bc7d614cd43ecdefff8d7

Authored by ww
1 parent 5545abf5

perf: create terant react set tenantProfileId field default select Default option

... ... @@ -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 },
... ...