|
|
|
@ -5,20 +5,22 @@ import requestaxios from 'axios';
|
|
|
|
|
import utils from "@/microhost/common"
|
|
|
|
|
import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
|
|
|
import { history, useModel, } from 'umi'
|
|
|
|
|
import {Dropdown, Menu, Modal} from "antd"
|
|
|
|
|
import {UserOutlined, QuestionCircleOutlined, StopOutlined, InfoCircleOutlined, BgColorsOutlined, LogoutOutlined, KeyOutlined, OrderedListOutlined} from "@ant-design/icons"
|
|
|
|
|
import { Dropdown, Menu, Modal } from "antd"
|
|
|
|
|
import { UserOutlined, QuestionCircleOutlined, StopOutlined, InfoCircleOutlined, BgColorsOutlined, LogoutOutlined, KeyOutlined, OrderedListOutlined } from "@ant-design/icons"
|
|
|
|
|
import styles from "./page.less"
|
|
|
|
|
import {Runtime} from "../../system"
|
|
|
|
|
import { Runtime } from "../../system"
|
|
|
|
|
import UserEditor from "../userEdit"
|
|
|
|
|
import MicroApps from '@/microhost/system/apps'
|
|
|
|
|
import { SystemData } from '@/microhost/models/system'
|
|
|
|
|
import { string } from 'prop-types';
|
|
|
|
|
import { FrameMessage as message1 } from '@/library/union';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 头部右侧内容区
|
|
|
|
|
* @author 秦健
|
|
|
|
|
* @date 2022-10-17
|
|
|
|
|
* @returns
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
const RightInfo = () => {
|
|
|
|
|
const userInfo = MicroApps.GetRuntimeUser().data
|
|
|
|
@ -26,32 +28,31 @@ const RightInfo = () => {
|
|
|
|
|
const [showFuncs, setShowFuncs] = useState<boolean>(false)
|
|
|
|
|
const [showEditor, setShowEditor] = useState<boolean>(false)
|
|
|
|
|
const [thisForm] = Form.useForm()
|
|
|
|
|
const userModel = new SystemData()
|
|
|
|
|
const [isLoading, setIsLoading] = useState<boolean>(false)
|
|
|
|
|
const userModel = new SystemData()
|
|
|
|
|
const [isLoading, setIsLoading] = useState<boolean>(false)
|
|
|
|
|
const [activeThemeName, setActiveThemeName] = useState<any>("")
|
|
|
|
|
const [searchList, setSearchList] = useState<any[]>([])
|
|
|
|
|
const [msgnum,setmsgnum]=useState<any>("");
|
|
|
|
|
const [msgnum, setmsgnum] = useState<any>("");
|
|
|
|
|
//const [isHidden, setIsHidden] = useState(true); // 初始化状态变量为 false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
msglog();
|
|
|
|
|
}, [])
|
|
|
|
|
useLayoutEffect(() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener("click", () => {
|
|
|
|
|
//setShowFuncs(false)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
window.removeEventListener("click", () => {})
|
|
|
|
|
window.removeEventListener("click", () => { })
|
|
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const msglog=()=>
|
|
|
|
|
{
|
|
|
|
|
const msglog = () => {
|
|
|
|
|
setmsgnum("0");
|
|
|
|
|
// console.log("开始请求");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const date={
|
|
|
|
|
// mid: "41f852c5-dfa3-3057-c62d-197d82f71b58" ,//指定模块id,可在导航管理获得,用户需有权限
|
|
|
|
|
// app: "", //预留
|
|
|
|
@ -65,111 +66,111 @@ const RightInfo = () => {
|
|
|
|
|
// //参数名:参数值
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
const loginName = utils.loadCookie("loginName")
|
|
|
|
|
//const loginName='chengzhigang';
|
|
|
|
|
const loginName = utils.loadCookie("loginName")
|
|
|
|
|
//const loginName='chengzhigang';
|
|
|
|
|
requestaxios
|
|
|
|
|
.post("http://172.15.89.222:8081/WF/API/EmpWorksNums?UserNo="+loginName)
|
|
|
|
|
.then(({ data }) => {
|
|
|
|
|
setmsgnum(data.replace("EmpWorksNums:",""));
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
document.getElementById('MSGNUM').style.display = 'none';
|
|
|
|
|
// setIsVisible(false); // 2000ms后将isVisible设置为不可见状态
|
|
|
|
|
}, 60000);
|
|
|
|
|
})
|
|
|
|
|
.catch((reason) => {
|
|
|
|
|
message.error('推送代办信息报错' + reason);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
.post("http://172.15.89.222:8081/WF/API/EmpWorksNums?UserNo=" + loginName)
|
|
|
|
|
.then(({ data }) => {
|
|
|
|
|
setmsgnum(data.replace("EmpWorksNums:", ""));
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
document.getElementById('MSGNUM').style.display = 'none';
|
|
|
|
|
// setIsVisible(false); // 2000ms后将isVisible设置为不可见状态
|
|
|
|
|
}, 60000);
|
|
|
|
|
})
|
|
|
|
|
.catch((reason) => {
|
|
|
|
|
message.error('推送代办信息报错' + reason);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const changePassword = async () => {
|
|
|
|
|
await thisForm.validateFields()
|
|
|
|
|
let vals: any = thisForm.getFieldsValue()
|
|
|
|
|
await thisForm.validateFields()
|
|
|
|
|
let vals: any = thisForm.getFieldsValue()
|
|
|
|
|
|
|
|
|
|
if(!vals.newpassword || vals.newpassword.length == 0
|
|
|
|
|
|| !vals.newpassword2 || vals.newpassword2.length == 0
|
|
|
|
|
|| !vals.oldpassword || vals.oldpassword.length == 0){
|
|
|
|
|
if (!vals.newpassword || vals.newpassword.length == 0
|
|
|
|
|
|| !vals.newpassword2 || vals.newpassword2.length == 0
|
|
|
|
|
|| !vals.oldpassword || vals.oldpassword.length == 0) {
|
|
|
|
|
message.error("密码不能为空")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setIsLoading(true)
|
|
|
|
|
let clientData: any = await userModel.userData(MicroApps.GetRuntimeUser().loginId)
|
|
|
|
|
setIsLoading(false)
|
|
|
|
|
|
|
|
|
|
let postData: any = lodash.cloneDeep(clientData)
|
|
|
|
|
let needRelogin: boolean = false
|
|
|
|
|
|
|
|
|
|
if(vals.newpassword.length > 0 || vals.newpassword2.length > 0){
|
|
|
|
|
if(vals.newpassword != vals.newpassword2){
|
|
|
|
|
message.error("输入密码不相同")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let old: any = userModel.createPassword(vals.oldpassword)
|
|
|
|
|
|
|
|
|
|
if(old != clientData.Password){
|
|
|
|
|
message.error("旧密码不正确")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(vals.newpassword.length < 5){
|
|
|
|
|
message.error("密码不少于5位")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clientData.Password = userModel.createPassword(vals.newpassword)
|
|
|
|
|
|
|
|
|
|
needRelogin = true
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
let clientData: any = await userModel.userData(MicroApps.GetRuntimeUser().loginId)
|
|
|
|
|
setIsLoading(false)
|
|
|
|
|
|
|
|
|
|
let postData: any = lodash.cloneDeep(clientData)
|
|
|
|
|
let needRelogin: boolean = false
|
|
|
|
|
|
|
|
|
|
if (vals.newpassword.length > 0 || vals.newpassword2.length > 0) {
|
|
|
|
|
if (vals.newpassword != vals.newpassword2) {
|
|
|
|
|
message.error("输入密码不相同")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let old: any = userModel.createPassword(vals.oldpassword)
|
|
|
|
|
|
|
|
|
|
if (old != clientData.Password) {
|
|
|
|
|
message.error("旧密码不正确")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vals.newpassword.length < 5) {
|
|
|
|
|
message.error("密码不少于5位")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clientData.Password = userModel.createPassword(vals.newpassword)
|
|
|
|
|
|
|
|
|
|
needRelogin = true
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!clientData){
|
|
|
|
|
message.error("数据出现错误")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!clientData) {
|
|
|
|
|
message.error("数据出现错误")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(var d in clientData){
|
|
|
|
|
if(postData.hasOwnProperty(d)){
|
|
|
|
|
postData[d] = clientData[d]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (var d in clientData) {
|
|
|
|
|
if (postData.hasOwnProperty(d)) {
|
|
|
|
|
postData[d] = clientData[d]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//console.log("new data", postData)
|
|
|
|
|
//console.log("new data", postData)
|
|
|
|
|
|
|
|
|
|
setIsLoading(true)
|
|
|
|
|
setIsLoading(true)
|
|
|
|
|
|
|
|
|
|
let result: any = await userModel.updateUserData(postData)
|
|
|
|
|
let result: any = await userModel.updateUserData(postData)
|
|
|
|
|
|
|
|
|
|
setIsLoading(false)
|
|
|
|
|
setIsLoading(false)
|
|
|
|
|
|
|
|
|
|
if(!result){
|
|
|
|
|
message.error("请求失败")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!result) {
|
|
|
|
|
message.error("请求失败")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(needRelogin){
|
|
|
|
|
message.success("请求成功,需要重新登录")
|
|
|
|
|
if (needRelogin) {
|
|
|
|
|
message.success("请求成功,需要重新登录")
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// userModel.logout().then(() => {
|
|
|
|
|
// location.href = "/login"
|
|
|
|
|
// })
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// userModel.logout().then(() => {
|
|
|
|
|
// location.href = "/login"
|
|
|
|
|
// })
|
|
|
|
|
MicroApps.GetRuntimeUser().logout(true)
|
|
|
|
|
}, 1000)
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
message.success("请求成功")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
message.success("请求成功")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={styles.luna_right_info} onMouseEnter={() => {
|
|
|
|
|
setShowFuncs(true)
|
|
|
|
|
}}>
|
|
|
|
|
|
|
|
|
|
{/* <Popover open={showFuncs} placement={"bottomRight"} content={
|
|
|
|
|
<div className={styles.luna_right_info} onMouseEnter={() => {
|
|
|
|
|
setShowFuncs(true)
|
|
|
|
|
}}>
|
|
|
|
|
|
|
|
|
|
{/* <Popover open={showFuncs} placement={"bottomRight"} content={
|
|
|
|
|
<div style={{width: "114px"}} onMouseLeave={() => {
|
|
|
|
|
setShowFuncs(false)
|
|
|
|
|
}}>
|
|
|
|
@ -223,9 +224,10 @@ const RightInfo = () => {
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
}> */}
|
|
|
|
|
<Dropdown overlay={
|
|
|
|
|
<Menu items={[
|
|
|
|
|
{key: "changePassword", icon: <KeyOutlined style={{color: "var(--daye-primary-color)"}} />, label: <span style={{color: "var(--daye-primary-color)"}}>修改密码</span>, onClick: () => {
|
|
|
|
|
<Dropdown overlay={
|
|
|
|
|
<Menu items={[
|
|
|
|
|
{
|
|
|
|
|
key: "changePassword", icon: <KeyOutlined style={{ color: "var(--daye-primary-color)" }} />, label: <span style={{ color: "var(--daye-primary-color)" }}>修改密码</span>, onClick: () => {
|
|
|
|
|
setShowFuncs(false)
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
prefixCls: "daye-modal",
|
|
|
|
@ -234,14 +236,14 @@ const RightInfo = () => {
|
|
|
|
|
okText: '确认',
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
content: (
|
|
|
|
|
<Form form={thisForm} wrapperCol={{span: 18}} labelCol={{span: 6}}>
|
|
|
|
|
<Form.Item label="旧的密码" name={"oldpassword"} rules={[{required: true, message: "请填写旧密码"}]}>
|
|
|
|
|
<Form form={thisForm} wrapperCol={{ span: 18 }} labelCol={{ span: 6 }}>
|
|
|
|
|
<Form.Item label="旧的密码" name={"oldpassword"} rules={[{ required: true, message: "请填写旧密码" }]}>
|
|
|
|
|
<Input type={"password"} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label="新的密码" name={"newpassword"} rules={[{required: true, message: "请填写新密码"}]}>
|
|
|
|
|
<Form.Item label="新的密码" name={"newpassword"} rules={[{ required: true, message: "请填写新密码" }]}>
|
|
|
|
|
<Input type={"password"} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label="确认密码" name={"newpassword2"} rules={[{required: true, message: "请填写新密码"}]}>
|
|
|
|
|
<Form.Item label="确认密码" name={"newpassword2"} rules={[{ required: true, message: "请填写新密码" }]}>
|
|
|
|
|
<Input type={"password"} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
@ -250,8 +252,10 @@ const RightInfo = () => {
|
|
|
|
|
await changePassword()
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}},
|
|
|
|
|
{key: "logout", icon: <LogoutOutlined style={{color: "var(--daye-primary-color)"}} />, label: <span style={{color: "var(--daye-primary-color)"}}>退出系统</span>, onClick: () => {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "logout", icon: <LogoutOutlined style={{ color: "var(--daye-primary-color)" }} />, label: <span style={{ color: "var(--daye-primary-color)" }}>退出系统</span>, onClick: () => {
|
|
|
|
|
setShowFuncs(false)
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
title: '确认退出系统?',
|
|
|
|
@ -264,29 +268,64 @@ const RightInfo = () => {
|
|
|
|
|
Runtime.logout()
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}},
|
|
|
|
|
]}></Menu>
|
|
|
|
|
}>
|
|
|
|
|
{/* <div className={styles.info_content} onClick={() => {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
]}></Menu>
|
|
|
|
|
}>
|
|
|
|
|
{/* <div className={styles.info_content} onClick={() => {
|
|
|
|
|
|
|
|
|
|
}}>
|
|
|
|
|
<img src="/statics/home/ustb-logo.jpg" width={128} height={32} className="ibk-menu-img" style={{marginTop: 4, borderLeft: "2px solid #ccc", paddingLeft: 4}} />
|
|
|
|
|
</div> */}
|
|
|
|
|
<div className={styles.info_content} style={{}}>
|
|
|
|
|
|
|
|
|
|
<span><UserOutlined /></span>
|
|
|
|
|
<div style={{marginLeft: 8, whiteSpace: "nowrap"}}>{!nickname ? "-" : `${nickname},您好!`}<span id='MSGNUM' style={{fontSize:'16PX',color:'rgb(225 70 70)'}}>{`您有${msgnum}条待办`}</span></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</Dropdown>
|
|
|
|
|
{/* </Popover> */}
|
|
|
|
|
|
|
|
|
|
<UserEditor visible={showEditor} userData={userInfo} callback={(ret: any) => {
|
|
|
|
|
setShowEditor(false)
|
|
|
|
|
setShowFuncs(false)
|
|
|
|
|
}} />
|
|
|
|
|
</div>
|
|
|
|
|
<div className={styles.info_content} style={{}}>
|
|
|
|
|
|
|
|
|
|
<span><UserOutlined /></span>
|
|
|
|
|
<div style={{ marginLeft: 8, whiteSpace: "nowrap" }}>{!nickname ? "-" : `${nickname},您好!`}<span
|
|
|
|
|
|
|
|
|
|
onClick={(event) => {
|
|
|
|
|
// Cookies.set('InputListData', JSON.stringify(record));
|
|
|
|
|
|
|
|
|
|
let body: message1 = new message1();
|
|
|
|
|
body.code = '@host#control#openPage';
|
|
|
|
|
body.data = {
|
|
|
|
|
newPage: false,
|
|
|
|
|
params: {
|
|
|
|
|
// recordData: JSON.stringify(record),
|
|
|
|
|
},
|
|
|
|
|
moduleId: '41f852c5-dfa3-3057-c62d-197d82f71b58', //要打开的模块id(系统配置-导航菜单-找到所在模块的id)
|
|
|
|
|
};
|
|
|
|
|
body.msg = '跳转';
|
|
|
|
|
body.to = 'iBKLinker-union-framework';
|
|
|
|
|
body.from = 'prd';
|
|
|
|
|
window.top?.postMessage(body, '*');
|
|
|
|
|
// history.replace({
|
|
|
|
|
// pathname: '/NewProductCalculation/InputList/InputList',
|
|
|
|
|
// state: {
|
|
|
|
|
// recordData: record,
|
|
|
|
|
// },
|
|
|
|
|
// });
|
|
|
|
|
// setTab(() => {
|
|
|
|
|
// let titles: any = [];
|
|
|
|
|
// titles.push(
|
|
|
|
|
// '新成本测算输入表',
|
|
|
|
|
// '/NewProductCalculation/InputList/InputList',
|
|
|
|
|
// '/新成本测算/输入表数据回显',
|
|
|
|
|
// );
|
|
|
|
|
// return titles;
|
|
|
|
|
// });
|
|
|
|
|
}}
|
|
|
|
|
id='MSGNUM' style={{ fontSize: '16PX', color: 'rgb(225 70 70)' }}>{`您有${msgnum}条待办`}</span></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</Dropdown>
|
|
|
|
|
{/* </Popover> */}
|
|
|
|
|
|
|
|
|
|
<UserEditor visible={showEditor} userData={userInfo} callback={(ret: any) => {
|
|
|
|
|
setShowEditor(false)
|
|
|
|
|
setShowFuncs(false)
|
|
|
|
|
}} />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default RightInfo
|
|
|
|
|
export default RightInfo
|
|
|
|
|