优化:后台管理系统超级管理员可以给其它后台企业添加用户

上级 7251ac82
流水线 #9013 已通过 于阶段
in 2 分 24 秒
......@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
import { SystemManageAPI } from '~/api';
import { InterDataType, PaginationProps } from '~/api/interface';
import { getCompanyInfoByIdType, listCompanyMembersType } from '~/api/interface/systemManageType';
import { Button, Descriptions, message, Modal, Table } from 'antd';
import { Button, Descriptions, message, Modal, SelectProps, Table } from 'antd';
import './index.scss';
import { ColumnsType } from 'antd/es/table';
import { PlusOutlined } from '@ant-design/icons';
......@@ -21,6 +21,8 @@ const CompanyDetail = () => {
const navigate = useNavigate();
const { userInfo } = useSelector((state: any) => state.UserInfo);
// 角色列表
const [roleList, setRoleList] = useState<SelectProps['options']>();
const tableColumns: ColumnsType<companyMembersType[0]> = [
{
......@@ -37,7 +39,7 @@ const CompanyDetail = () => {
title: '角色',
align: 'center',
dataIndex: 'leader',
render: (text: number) => (text ? '单位管理员' : '普通员工'),
render: (text) => roleList?.find((i) => i.value === text)?.label || text,
},
{
title: '手机号',
......@@ -91,6 +93,7 @@ const CompanyDetail = () => {
setCompanyDetail(result);
});
};
//
//单位成员列表
const getListCompanyMembers = (companyInfoId: number) => {
SystemManageAPI.getListCompanyMembers({
......@@ -157,11 +160,20 @@ const CompanyDetail = () => {
const backRoute = () => {
navigate(-1);
};
// 获取角色列表
const getRoleList = async () => {
const res = await SystemManageAPI.getRolesList();
if (res && res.code === '200') {
setRoleList(
res.result?.map((i) => ({ label: i?.roleName, value: i?.id, disabled: i?.id === 1 })),
);
}
};
useEffect(() => {
setCompanyId(Number(searchParams.get('id')));
getCompanyDetailInfo(Number(searchParams.get('id')));
getListCompanyMembers(Number(searchParams.get('id')));
getRoleList().then();
}, []);
return (
......@@ -214,6 +226,7 @@ const CompanyDetail = () => {
onCancel={addPeopleModalCancel}
onOk={addPeopleModalOk}
companyInfoId={companyId}
roleList={roleList}
/>
{/*转让管理员*/}
<TransferLeaderModal
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论