forked from gzzfw/frontEnd/gzDyh

xusd
2024-09-18 3ae864f005e8a874de01c15e14b83196a3f6f11b
gz-customerSystem/src/components/Layout/Header.jsx
@@ -2,7 +2,7 @@
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-03-11 11:33:21
 * @LastEditTime: 2024-08-22 11:51:48
 * @LastEditTime: 2024-09-11 09:45:36
 * @LastEditors: dminyi 1301963064@qq.com
 * @Version: 1.0.0
 * @Description: 头部组件
@@ -13,6 +13,7 @@
import { Menu, Badge, Avatar, Dropdown, Space, Form, Input, Button, Radio } from 'antd';
import { BellOutlined, LogoutOutlined, UserOutlined, FormOutlined, UserSwitchOutlined, DownCircleFilled } from '@ant-design/icons';
import { mediationCenter, mediationCenter_active, operateCenter, operateCenter_active } from '../../assets/images/icon';
import { yewu } from '../../assets/images';
import * as $$ from '../../utils/utility';
import MyMessage from '../../views/myMessage';
import MyModal from '../MyModal';
@@ -36,10 +37,9 @@
 * handleClickMenu: function 头部导航点击
 * handleChangeRole: function 切换角色
 */
const Header = ({ roleActive, headerMenu, headerMenuActive, headerUserChange, handleClickMenu, handleChangeRole }) => {
  let navigate = useNavigate();
const Header = ({ roleActive, headerMenu, headerMenuActive, headerUserChange, handleClickMenu, handleChangeRole,userData }) => {
  const [data, setData] = useState([]);
  let navigate = useNavigate();
  // 修改密码窗口显示隐藏
  const [visible, setVisible] = useState(false);
@@ -51,7 +51,7 @@
  const [myMessageVisible, setMyMessageVisible] = useState(false);
  const headerMenuIcon = {
    'mediate': { icon: mediationCenter, iconActive: mediationCenter_active },
    'mediate': { icon: yewu, iconActive: yewu },
    'operation': { icon: operateCenter, iconActive: operateCenter_active },
  };
@@ -72,7 +72,7 @@
  const userMenu = (
    <Menu>
      {data?.ctUseroleList?.length > 1 && (
      {userData?.ctUseroleList?.length > 1 && (
        <>
          <Menu.Item key="changeRole" onClick={() => setRoleModal({ visible: true, value: roleActive.id })}>
            <UserSwitchOutlined style={{ marginRight: '8px' }} />
@@ -109,9 +109,6 @@
    }
  }
  useEffect(() => {
    setData($$.getLocal('customerSystemUser') || {});
  }, [headerUserChange]);
  return (
    <header className="header">
@@ -154,9 +151,9 @@
            <div className="header-user-avatar">
              <Avatar icon={<UserOutlined />} />
              <div>
                <div className="header-user-name">{data?.trueName || '-'}</div>
                <div className="header-user-name">{userData?.trueName || '-'}</div>
                <div className="header-user-unit">
                  <span>{data?.unit || '-'}</span>
                  <span>{userData?.unit || '-'}</span>
                  <span className="public-rightBorder">{roleActive.roleName || '-'}</span>
                  <DownCircleFilled style={{ fontSize: '10px', marginLeft: '8px', color: '#ffffff' }} />
                </div>
@@ -172,7 +169,7 @@
            value={roleModal.value}
            onChange={(e) => setRoleModal({ visible: true, value: e.target.value, name: e.target.label, roleCode: e.target.roleCode })}
          >
            {data?.ctUseroleList?.map((x) => (
            {userData?.ctUseroleList?.map((x) => (
              <Radio key={x.roleId} value={x.roleId} label={x.roleName} roleCode={x.roleCode}>
                {x.roleName}
              </Radio>