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

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