Browse Source

fix(user): org、role select

lind 3 năm trước cách đây
mục cha
commit
b8ed158dd7
1 tập tin đã thay đổi với 10 bổ sung6 xóa
  1. 10 6
      src/pages/system/User/Save/index.tsx

+ 10 - 6
src/pages/system/User/Save/index.tsx

@@ -299,6 +299,7 @@ const Save = (props: Props) => {
                         state.dataSource = state.dataSource?.concat([
                           { label: value.name, value: value.id },
                         ]);
+                        state.value = [...state.value, value.id];
                       });
                     };
                   }}
@@ -332,12 +333,15 @@ const Save = (props: Props) => {
                   onClick={() => {
                     const tab: any = window.open(`${origin}/#/system/department?save=true`);
                     tab!.onTabSaveSuccess = (value: any) => {
-                      console.log(value, 'value');
-                      form.setFieldState('orgIdList', (state) => {
-                        state.dataSource = state.dataSource?.concat({
-                          name: value.name,
-                          id: value.id,
-                        });
+                      form.setFieldState('orgIdList', async (state) => {
+                        state.dataSource = await getOrg().then((resp) =>
+                          resp.result?.map((item: Record<string, unknown>) => ({
+                            ...item,
+                            label: item.name,
+                            value: item.id,
+                          })),
+                        );
+                        state.value = [...state.value, value.id];
                       });
                     };
                   }}