mirror of
https://github.com/PlayEdu/backend
synced 2025-12-30 05:19:53 +08:00
数据结构重构优化
This commit is contained in:
@@ -10,6 +10,11 @@ interface PropInterface {
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
type selRoleModel = {
|
||||
label: string;
|
||||
value: number;
|
||||
};
|
||||
|
||||
export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
||||
roleId,
|
||||
refresh,
|
||||
@@ -17,8 +22,8 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
||||
onCancel,
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [roles, setRoles] = useState<any>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [roles, setRoles] = useState<selRoleModel[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
@@ -43,7 +48,7 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
|
||||
const getParams = () => {
|
||||
adminUser.createAdminUser().then((res: any) => {
|
||||
const arr = [];
|
||||
let roles = res.data.roles;
|
||||
let roles: RoleModel[] = res.data.roles;
|
||||
for (let i = 0; i < roles.length; i++) {
|
||||
arr.push({
|
||||
label: roles[i].name,
|
||||
|
||||
Reference in New Issue
Block a user