Files
fe_service_ebtp_frontend/src/pages/MainPage/ProjectManager/managerSubAdmin.js

149 lines
7.3 KiB
JavaScript
Raw Normal View History

2022-03-10 14:24:13 +08:00
import React, { PureComponent } from 'react';
import { history } from 'umi';
import { Row, Col, Tooltip, Card, List, DatePicker, Button, Statistic, Spin, Empty, message } from 'antd';
import { connect } from 'dva';
import './index.less';
import talkPng from '@/images/talk/talk.png';
import { routerRedux } from 'dva/router';
import { RightOutlined } from '@ant-design/icons';
import moment from 'moment';
2022-06-09 14:20:40 +08:00
import { getSessionUserData, getRA } from '@/utils/session';
2022-03-10 14:24:13 +08:00
import { getURLInformation } from '@/utils/CommonUtils';
import NoticeDetail from '@/pages/notice/noticeList/components/NoticeDetail'
2022-05-19 10:37:01 +08:00
import ChatUI from '@/pages/customerservice/support/conversation' //智慧客服
2022-03-10 14:24:13 +08:00
@connect(({ dashboard, loading }) => ({
...dashboard,
}))
class manager extends PureComponent {
state = {
detailId: '1', // 公告id
noticeDetail: false, // 公告弹窗
2022-05-19 10:37:01 +08:00
isModalVisible: false, //智慧客服
isFlash: false, //智慧客服
isCloseWs: true, //智慧客服
optionsModal: false, //智慧客服
projectModal: false, //智慧客服
supplierNumber: '', //智慧客服
staffId: '', //智慧客服'
staffName:'', //智慧客服
kfType:0,//智慧客服
questionType:0,//智慧客服
2022-06-09 14:20:40 +08:00
roleIds:'',//智慧客服
2022-03-10 14:24:13 +08:00
}
componentDidMount() {
this.props.dispatch({
type: "dashboard/fetchtlist",
payload: { limit: 7 }
})
NTKF_PARAM = {
siteid: "bl_1000",                    //企业ID,为固定值
settingid: "bl_1000_1492484340268",           //接待组ID为固定值必填
uid: getSessionUserData()?.userId,
uname: getSessionUserData()?.deptName + "-" + getSessionUserData()?.fullName,            //用户名未登录可以为空但是不能给nulluname赋予的值显示到小能客户端
isvip: "0",                              //是否为vip用户0代表非会员1代表会员取值显示到小能客户端
userlevel: "1",                       //网站自定义会员级别1-N可根据选择判断取值显示到小能客户端
erpparam: "abc"                          //erpparam为erp功能的扩展字段可选购买erp功能后用于erp功能集成
}
2022-05-19 10:37:01 +08:00
//智慧客服,获取供应商编码
let userData = getSessionUserData()
2022-06-09 14:20:40 +08:00
let roleAuthority = getRA()
this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds})
2022-05-19 10:37:01 +08:00
this.setState({staffId: userData.userId})
this.setState({staffName: userData.fullName})
this.setState({supplierNumber: userData.organizationId})
//<<<<<<智慧客服end
2022-03-10 14:24:13 +08:00
}
lookInfo = (id) => { // 公告查看
this.setState({
detailId: id,
noticeDetail: true
})
}
noticeModel = () => { // 公告关闭消息弹窗
this.setState({
noticeDetail: false
})
}
2022-05-19 10:37:01 +08:00
initChatUI = () => {
//智慧客服
if(this.state.isCloseWs && window.isCloseChatUIModal==undefined){ //弹窗主动关闭或者页面刷新
2022-05-19 10:37:01 +08:00
this.setState({optionsModal: true})
}else{
this.setState({isModalVisible: true})
this.setState({isCloseWs: false})
this.setState({isFlash :false})
}
2022-03-10 14:24:13 +08:00
}
render() {
const { tlist, trelist } = this.props;
2022-06-09 14:20:40 +08:00
const { detailId, noticeDetail, isModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, kfType, questionType, isFlash, roleIds} = this.state; //智慧客服state
2022-03-10 14:24:13 +08:00
return (
<>
2022-05-19 10:37:01 +08:00
<a className={isFlash && !isModalVisible ? "talk text-effect":"talk"} onClick={() => this.initChatUI()}>咨询服务<span>8:30</span><span>|</span><span>12:30</span><span>13:00</span><span>|</span><span>17:00</span><img src={talkPng} /></a>
2022-03-10 14:24:13 +08:00
<div className="dashboard" style={{ height: innerHeight - 70, overflow: "hidden" }}>
<Row className="topt">
<Col span={24}><Card title="系统公告" bordered={false} className="cardtre" extra={<div className="moret" onClick={() => history.push('/notice/noticeList')}>更多<RightOutlined /></div>}>
{tlist != [] && tlist.map((item, index) => {
return (
<div className="messagetre" onClick={() => { this.lookInfo(item.id) }} key={item.id}>
<div className="round">{index+1}</div>
<div className="txt" title={item.noticeTitle}>{item.noticeTitle}</div>
<div className="time">{item.updateDate}</div>
</div>
)
})}</Card>
</Col>
</Row>
</div>
{noticeDetail && <NoticeDetail detailId={detailId} onCancel={() => { this.noticeModel() }} modalVisible={noticeDetail} />}
2022-05-19 10:37:01 +08:00
{/*智慧客服*/}
<ChatUI
openProjectWin={()=>{
this.setState({kfType: 2})
this.setState({projectModal: true})
}}
openWin={(kfType, questionType)=>{
this.setState({questionType: questionType})
this.setState({kfType: kfType})
this.setState({optionsModal: false})
this.setState({isModalVisible: true})
this.setState({isCloseWs: false})
this.setState({isFlash :false})
}}
closeWin={()=>{
this.setState({kfType: 0})
this.setState({questionType: 0})
this.setState({optionsModal: false})
this.setState({isModalVisible: false})
this.setState({isCloseWs: true})
this.setState({projectModal: false})
}}
optionsModal={optionsModal}
projectModal={projectModal}
isModalVisible={isModalVisible}
kfType={kfType}
questionType={questionType}
staffId={staffId}
staffName={staffName}
supplierNumber={supplierNumber}
isCloseWs={isCloseWs}
2022-06-09 14:20:40 +08:00
roleIds={roleIds}
2022-05-19 10:37:01 +08:00
hideWin={()=>{
this.setState({optionsModal: false})
this.setState({isModalVisible: false})
}}
closeOptionsModal={()=>{
this.setState({optionsModal: false})
}}
closeProjectModal={()=>{
this.setState({projectModal: false})
}}
msgAlert={()=>{
if(!isModalVisible) this.setState({isFlash: true})
}}
/>
2022-03-10 14:24:13 +08:00
</>
)
}
}
export default manager;