数据结构重构优化

This commit is contained in:
unknown
2023-08-07 10:41:57 +08:00
parent c2fb5c2243
commit 2a6e451417
14 changed files with 103 additions and 60 deletions

View File

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