2022-09-20 14:15:13 +08:00
|
|
|
|
import React from 'react'
|
|
|
|
|
|
import * as mobx from 'mobx'
|
|
|
|
|
|
import {
|
|
|
|
|
|
inject,
|
|
|
|
|
|
observer
|
|
|
|
|
|
} from 'mobx-react'
|
|
|
|
|
|
import {
|
|
|
|
|
|
WeaTop,
|
|
|
|
|
|
WeaTab,
|
|
|
|
|
|
WeaFormItem,
|
|
|
|
|
|
WeaRightMenu,
|
2022-09-22 18:55:14 +08:00
|
|
|
|
WeaAlertPage,
|
2022-12-16 16:06:51 +08:00
|
|
|
|
WeaNewScrollPagination,
|
|
|
|
|
|
WeaSlideModal
|
2022-09-20 14:15:13 +08:00
|
|
|
|
} from 'ecCom'
|
|
|
|
|
|
import {
|
|
|
|
|
|
Row,
|
|
|
|
|
|
Col,
|
|
|
|
|
|
Spin,
|
|
|
|
|
|
Modal,
|
|
|
|
|
|
Button,
|
|
|
|
|
|
message,
|
2022-09-22 18:55:14 +08:00
|
|
|
|
Switch,
|
2022-10-18 13:58:48 +08:00
|
|
|
|
Menu, Dropdown, Icon, Anchor
|
2022-09-23 16:53:25 +08:00
|
|
|
|
} from 'antd';
|
2022-09-27 17:50:56 +08:00
|
|
|
|
|
2022-09-20 14:15:13 +08:00
|
|
|
|
import {
|
|
|
|
|
|
WeaSwitch,
|
|
|
|
|
|
WeaTableNew
|
2022-09-23 16:53:25 +08:00
|
|
|
|
} from 'comsMobx';
|
2022-09-20 14:15:13 +08:00
|
|
|
|
import {
|
|
|
|
|
|
i18n
|
|
|
|
|
|
} from '../../public/i18n';
|
|
|
|
|
|
|
2022-09-22 18:55:14 +08:00
|
|
|
|
import '../../style/card.less';
|
|
|
|
|
|
import FormItem from './FormItem';
|
|
|
|
|
|
import IframeItem from './IframeItem';
|
2022-09-27 17:50:56 +08:00
|
|
|
|
import AnchorDetect from './AnchorDetect';
|
2022-09-20 14:15:13 +08:00
|
|
|
|
import { renderNoright } from '../../util'; // 从util文件引入公共的方法
|
2022-12-16 16:06:51 +08:00
|
|
|
|
import VersionsSlider from '../VersionsSlider';
|
|
|
|
|
|
import isEmpty from 'lodash/isEmpty'
|
|
|
|
|
|
|
2022-09-20 14:15:13 +08:00
|
|
|
|
|
|
|
|
|
|
const toJS = mobx.toJS;
|
|
|
|
|
|
const confirm = Modal.confirm;
|
|
|
|
|
|
|
|
|
|
|
|
@inject('resourceCard')
|
|
|
|
|
|
@observer
|
|
|
|
|
|
export default class ResourceCard extends React.Component {
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
|
super(props);
|
2022-09-27 17:50:56 +08:00
|
|
|
|
this.state = {
|
2022-10-18 13:58:48 +08:00
|
|
|
|
activity: 0,//激活的锚点
|
2022-09-27 17:50:56 +08:00
|
|
|
|
}
|
2022-10-18 13:58:48 +08:00
|
|
|
|
|
2022-09-20 14:15:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillMount() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
this.init();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-27 17:50:56 +08:00
|
|
|
|
// componentDidUpdate(prevProps) {
|
|
|
|
|
|
// // 判断items是否更新
|
|
|
|
|
|
// if (prevProps.items !== this.props.items
|
|
|
|
|
|
// && this.isDiff(prevProps.items, this.props.items)) {
|
|
|
|
|
|
// // 重新生成受监控元素
|
|
|
|
|
|
// this.buildDetectElements(this.props.items);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// // 判断两数组是否一摸一样
|
|
|
|
|
|
// isDiff = (before, after) => {
|
|
|
|
|
|
// if (before.length !== after.length) return false;
|
|
|
|
|
|
// // 先对数组进行排序
|
|
|
|
|
|
// const beforeTemp = [...before].sort(), afterTemp = [...after].sort();
|
|
|
|
|
|
// for (let i = 0; i < beforeTemp.length; i++) {
|
|
|
|
|
|
// if (beforeTemp[i] !== afterTemp[i]) {
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return true;
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
2022-09-20 14:15:13 +08:00
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
|
|
|
if (this.props.location.key !== nextProps.location.key) {
|
|
|
|
|
|
this.init();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
init() {
|
|
|
|
|
|
const {
|
|
|
|
|
|
resourceCard
|
|
|
|
|
|
} = this.props;
|
2022-10-18 13:58:48 +08:00
|
|
|
|
let { hash } = window.location;
|
|
|
|
|
|
hash = hash.split("?")[0];
|
|
|
|
|
|
let id = hash.match("[^/]+(?=/$|$)")[0];
|
|
|
|
|
|
resourceCard.userid = id;
|
2022-09-22 18:55:14 +08:00
|
|
|
|
resourceCard.init();
|
2022-09-27 17:50:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-18 13:58:48 +08:00
|
|
|
|
onScrollEnd = () => {
|
|
|
|
|
|
// resourceCard.scrollLoading = true;
|
2022-09-27 17:50:56 +08:00
|
|
|
|
|
2022-10-18 13:58:48 +08:00
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
|
// // resourceCard.data.iframeList.push({
|
|
|
|
|
|
// // id: "job",
|
|
|
|
|
|
// // title: "岗位管理",
|
|
|
|
|
|
// // url: '/spa/organization/static/index.html#/main/organization/companyExtend/7'
|
|
|
|
|
|
// // })
|
|
|
|
|
|
// resourceCard.scrollLoading = false;
|
|
|
|
|
|
// }, 2000);
|
2022-09-22 18:55:14 +08:00
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-10-18 13:58:48 +08:00
|
|
|
|
// buildDetectElements = () => {
|
|
|
|
|
|
// const {
|
|
|
|
|
|
// resourceCard
|
|
|
|
|
|
// } = this.props,{
|
|
|
|
|
|
// data
|
|
|
|
|
|
// } =resourceCard;
|
|
|
|
|
|
|
|
|
|
|
|
// !this.isEmptyObject(data) && data.anchorList.map((item, index) => {
|
|
|
|
|
|
// item.activity = index;
|
|
|
|
|
|
// item.offset = document.getElementById(item.id).offsetTop + document.getElementById(item.id).clientHeight;
|
|
|
|
|
|
// })
|
|
|
|
|
|
// resourceCard.setDetectElements(data.anchorList);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2022-09-27 17:50:56 +08:00
|
|
|
|
handleMenuClick = (e) => {
|
2023-03-27 10:47:30 +08:00
|
|
|
|
const {
|
|
|
|
|
|
resourceCard
|
|
|
|
|
|
} = this.props, {
|
|
|
|
|
|
data
|
|
|
|
|
|
} = resourceCard;
|
|
|
|
|
|
window.open(e.item.props.url.replaceAll("${id}",data.user.id),"_blank")
|
2022-09-27 17:50:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-16 16:06:51 +08:00
|
|
|
|
view = () => {
|
|
|
|
|
|
const { resourceCard } = this.props;
|
|
|
|
|
|
resourceCard.selectVersions();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onClose = () => {
|
|
|
|
|
|
const { resourceCard } = this.props;
|
|
|
|
|
|
resourceCard.open = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-27 17:50:56 +08:00
|
|
|
|
onScroll = (event) => {
|
2022-10-18 13:58:48 +08:00
|
|
|
|
const {
|
|
|
|
|
|
resourceCard
|
|
|
|
|
|
} = this.props,{
|
|
|
|
|
|
detectElements,
|
|
|
|
|
|
flag
|
|
|
|
|
|
} = resourceCard;
|
2022-09-27 17:50:56 +08:00
|
|
|
|
const postion = event.target.scrollTop;
|
|
|
|
|
|
let getActivityCurrent = this.state.activity;
|
2022-10-18 13:58:48 +08:00
|
|
|
|
detectElements.map((item, index) => {
|
|
|
|
|
|
if (postion >= document.getElementById(item.id).offsetTop && postion <= item.offset) {
|
2022-09-27 17:50:56 +08:00
|
|
|
|
return getActivityCurrent = item.activity;
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-10-18 13:58:48 +08:00
|
|
|
|
|
|
|
|
|
|
if(event.target.scrollHeight == postion + event.target.clientHeight) {
|
|
|
|
|
|
getActivityCurrent = detectElements.length - 1
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-27 17:50:56 +08:00
|
|
|
|
this.setState({
|
|
|
|
|
|
activity: getActivityCurrent
|
|
|
|
|
|
})
|
2022-10-18 13:58:48 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
2022-09-27 17:50:56 +08:00
|
|
|
|
|
2022-10-18 13:58:48 +08:00
|
|
|
|
scrollToAnchor = (anchorName, index) => {
|
|
|
|
|
|
const {
|
|
|
|
|
|
resourceCard
|
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
let _this = this;
|
2022-09-22 18:55:14 +08:00
|
|
|
|
if (anchorName) {
|
|
|
|
|
|
// 找到锚点
|
|
|
|
|
|
let anchorElement = document.getElementById(anchorName);
|
|
|
|
|
|
// 如果对应id的锚点存在,就跳转到锚点
|
|
|
|
|
|
if (anchorElement) { anchorElement.scrollIntoView({ block: 'start', behavior: 'smooth' }); }
|
|
|
|
|
|
}
|
2022-09-20 14:15:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-18 13:58:48 +08:00
|
|
|
|
isEmptyObject(obj) {
|
|
|
|
|
|
for (let key in obj) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-22 18:55:14 +08:00
|
|
|
|
render() {
|
|
|
|
|
|
const {
|
|
|
|
|
|
resourceCard
|
|
|
|
|
|
} = this.props, {
|
|
|
|
|
|
height,
|
|
|
|
|
|
scrollLoading,
|
|
|
|
|
|
offset,
|
|
|
|
|
|
overtime,
|
|
|
|
|
|
intervalTime,
|
2022-12-16 16:06:51 +08:00
|
|
|
|
data,
|
|
|
|
|
|
versionList,
|
|
|
|
|
|
open
|
2022-09-22 18:55:14 +08:00
|
|
|
|
} = resourceCard;
|
|
|
|
|
|
const menu = (
|
|
|
|
|
|
<Menu onClick={this.handleMenuClick}>
|
2022-11-11 17:05:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
!this.isEmptyObject(data) && data.buttons.slice(3).map((item,index) => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Menu.Item key="1" url={item.url}>{item.name}</Menu.Item>
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-09-22 18:55:14 +08:00
|
|
|
|
</Menu>
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
2022-10-18 13:58:48 +08:00
|
|
|
|
!this.isEmptyObject(data) && <WeaNewScrollPagination
|
|
|
|
|
|
height='100%'
|
|
|
|
|
|
onScrollEnd={this.onScrollEnd}
|
|
|
|
|
|
onScroll={this.onScroll}
|
|
|
|
|
|
>
|
|
|
|
|
|
<div className="gutter-resource-card">
|
|
|
|
|
|
<div className="gutter-row">
|
|
|
|
|
|
<div className='top'>
|
|
|
|
|
|
<img src={data.user.image} />
|
|
|
|
|
|
<div className='user'>
|
|
|
|
|
|
<div className='name'>{data.user.name}
|
|
|
|
|
|
<span>{data.user.sex == 0 ? <i className="icon-coms-men" /> : <i className="icon-coms-women" />}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className='icon-info'>
|
|
|
|
|
|
<i className="icon-coms-Send-message" />
|
|
|
|
|
|
<i className="icon-coms-message-o" />
|
|
|
|
|
|
<i className="icon-coms-Send-emails" />
|
|
|
|
|
|
<i className="icon-coms-New-schedule-o" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className='content'>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<span className='label'><i className="icon-portal-email-o" /></span>
|
|
|
|
|
|
<span className='value'>{data.user.email}</span>
|
|
|
|
|
|
<span className='label'><i className="icon-coms-contact" /></span>
|
|
|
|
|
|
<span className='value'>{data.user.phone}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style={{ marginTop: '10px' }}>
|
|
|
|
|
|
<span className='label'>账号类型:</span>
|
2022-11-21 13:49:31 +08:00
|
|
|
|
<span className='value'>{data.user.accountType}</span>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<span className='label'>状态:</span>
|
|
|
|
|
|
<span className='value'>{data.user.status}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-09-22 18:55:14 +08:00
|
|
|
|
</div>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<div className='right-button'>
|
2022-12-16 16:06:51 +08:00
|
|
|
|
<Button className='item' onClick={this.view} >{i18n.button.version()}</Button>
|
2022-11-11 17:05:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
data.buttons.slice(0,3).map((item,index) => {
|
|
|
|
|
|
return (
|
2022-11-16 09:18:19 +08:00
|
|
|
|
<Button className='item' onClick={() => { window.open(item.url.replaceAll("${id}",data.user.id),"_self")}}>{item.name}</Button>
|
2022-11-11 17:05:06 +08:00
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
{
|
|
|
|
|
|
data.buttons.length > 3 ? <Dropdown overlay={menu}>
|
|
|
|
|
|
<Button style={{ marginLeft: 8 }} className='item'>
|
|
|
|
|
|
更多操作 <Icon type="down" />
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</Dropdown> : ''
|
|
|
|
|
|
}
|
2022-09-22 18:55:14 +08:00
|
|
|
|
</div>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className='data'>
|
|
|
|
|
|
<Row type="flex" justify="space-between" style={{ height: '100%' }}>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/workflow/static/index.html#/main/workflow/listDoing?resourceid=${data.user.ecId}`)}}>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<img src="/hrm/hrm_e9/image/workflow.png" alt="" />
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<p>流程总数</p>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<p>{data.statistical.workflowCount}</p>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/document/static/index.html#/main/document/search?viewcondition=2&doccreaterid=${data.user.ecId}`)}}>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<img src="/hrm/hrm_e9/image/doc.png" alt="" />
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<div >
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<p>文档总数</p>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<p>{data.statistical.docCount}</p>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/crm/static/index.html#/main/crm/customer/hrmView?searchHrmId=${data.user.ecId}`)}}>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<img src="/hrm/hrm_e9/image/custom.png" alt="" />
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<p>我的客户</p>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<p>{data.statistical.cusCount}</p>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/cowork/static/index.html#/main/cowork/hrmview?searchHrmid=${data.user.ecId}`) }}>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<img src="/hrm/hrm_e9/image/cowork.png" alt="" />
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<p>我的协作</p>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<p>{data.statistical.collaborationCount}</p>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<Col className='ant-col' span={4} onClick={() => { window.open(`/spa/blog/static/index.html#/user/${data.user.ecId}`) }}>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<img src="/hrm/hrm_e9/image/weibo.png" alt="" />
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<p>微博总数</p>
|
2022-10-25 17:50:10 +08:00
|
|
|
|
<p>{data.statistical.weiboCount}</p>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
2022-09-22 18:55:14 +08:00
|
|
|
|
</div>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
{
|
|
|
|
|
|
data.formItems.map((item, index) => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<FormItem groupInfo={item} />
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
{
|
|
|
|
|
|
data.iframeList.map((item, index) => {
|
|
|
|
|
|
return (
|
2023-03-27 10:47:30 +08:00
|
|
|
|
<IframeItem iframeInfo={item} userid={data.user.ecId} />
|
2022-10-18 13:58:48 +08:00
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-09-22 18:55:14 +08:00
|
|
|
|
</div>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<div className="gutter-row">
|
|
|
|
|
|
<AnchorDetect
|
|
|
|
|
|
anchorList={data.anchorList}
|
|
|
|
|
|
container={window}
|
|
|
|
|
|
activity={this.state.activity}
|
|
|
|
|
|
onChange={this.scrollToAnchor}
|
|
|
|
|
|
/>
|
2022-09-22 18:55:14 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-10-18 13:58:48 +08:00
|
|
|
|
<Spin size="large" tip="" className='scroll-spin' spinning={scrollLoading} />
|
2022-12-16 16:06:51 +08:00
|
|
|
|
<WeaSlideModal visible={open}
|
|
|
|
|
|
// top={6}
|
|
|
|
|
|
width={40}
|
|
|
|
|
|
height={100}
|
|
|
|
|
|
direction={'right'}
|
|
|
|
|
|
measure={'%'}
|
2022-12-26 11:11:14 +08:00
|
|
|
|
content={!isEmpty(versionList) ? <VersionsSlider versionList={versionList} handleChange={val => resourceCard.changeVersion(val)}/> : <div style={{"textAlign":"center","color":"red","fontSize":"20px","marginTop": "50px"}}> 暂无历史版本 </div>}
|
2022-12-16 16:06:51 +08:00
|
|
|
|
onClose={this.onClose}
|
|
|
|
|
|
onAnimationEnd={() => console.log('onAnimationEnd')} />
|
2022-10-18 13:58:48 +08:00
|
|
|
|
</WeaNewScrollPagination>
|
2022-09-20 14:15:13 +08:00
|
|
|
|
)
|
|
|
|
|
|
}
|
2022-09-22 18:55:14 +08:00
|
|
|
|
|
2022-09-20 14:15:13 +08:00
|
|
|
|
}
|