组织架构图版本控制功能增加

上海中远重工组织架构图
Chengliang 9 months ago
parent 7ac5656df7
commit df21ceb502

@ -7,10 +7,11 @@
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
import React from 'react'; import React from 'react';
import { Timeline, Drawer } from 'antd'; import { Timeline, Drawer, Popconfirm, message } from 'antd';
import styles from './index.less'; import styles from './index.less';
import leftTreeShow from './img/leftTree-show.png'; import leftTreeShow from './img/leftTree-show.png';
import leftHide from './img/leftTree-hide.png'; import leftHide from './img/leftTree-hide.png';
import { CloseCircleOutlined } from '@ant-design/icons';
export default class TimeLine extends React.Component { export default class TimeLine extends React.Component {
constructor(props) { constructor(props) {
@ -35,6 +36,21 @@ export default class TimeLine extends React.Component {
this.props.onClick(data); this.props.onClick(data);
} }
handleDelete(key) {
const { labelData } = this.props;
let api = `/api/bs/hrmorganization/orgchart/versionDelete?versionId=${key}`;
fetch(api)
.then((res) => res.json())
.then((data) => {
if (data.api_status) {
message.success(`删除成功`, 2, 3);
window.location.reload(true);
} else {
message.error(`系统错误`, 2, 3);
}
});
}
componentDidMount() { componentDidMount() {
this.searchTimeLines(this.props.url); this.searchTimeLines(this.props.url);
} }
@ -89,14 +105,27 @@ export default class TimeLine extends React.Component {
return ( return (
<Timeline.Item <Timeline.Item
key={item.key} key={item.key}
onClick={this.handleLineClick.bind(this, item)}
className={styles.timeline} className={styles.timeline}
color={item.color} color={item.color}
style={{ style={{
color: item.color == 'blue' ? '#1890ff' : 'dimgray', color: item.color == 'blue' ? '#1890ff' : 'dimgray',
}} }}
> >
<div>{item.title}</div> <div onClick={this.handleLineClick.bind(this, item)}>
{item.title}
</div>
{item.key != 0 && (
<Popconfirm
title={`确认要删除[${item.title}]版本?`}
onConfirm={this.handleDelete.bind(this, item.key)}
okText="确认"
cancelText="取消"
>
<div className={styles.delete}>
<CloseCircleOutlined />
</div>
</Popconfirm>
)}
<div className={styles.time}>{item.time}</div> <div className={styles.time}>{item.time}</div>
</Timeline.Item> </Timeline.Item>
); );

@ -22,14 +22,18 @@
.time { .time {
color: dimgray; color: dimgray;
} }
.delete :hover {
color: red;
}
} }
.leftRightLayoutBtn { .leftRightLayoutBtn {
width: 18px; width: 18px;
height: 60px; height: 60px;
position: absolute; position: fixed;
top: 50%; top: 50%;
margin-top: -30px; // margin-top: -30px;
z-index: 101; z-index: 101;
cursor: pointer; cursor: pointer;
} }

@ -332,7 +332,7 @@ export class TopBar extends React.Component {
> >
查询 查询
</Button> </Button>
<Button {/* <Button
type="primary" type="primary"
style={{ marginRight: '10px' }} style={{ marginRight: '10px' }}
onClick={() => { onClick={() => {
@ -349,7 +349,7 @@ export class TopBar extends React.Component {
}} }}
> >
人数统计 人数统计
</Button> </Button> */}
<Dropdown overlay={this.menu}> <Dropdown overlay={this.menu}>
<Button type="primary">导出</Button> <Button type="primary">导出</Button>
</Dropdown> </Dropdown>

@ -158,6 +158,8 @@ export default function companyPage() {
const nodeContentRender = (d, i, arr, state) => { const nodeContentRender = (d, i, arr, state) => {
let fclass = topbar.state.requestData.fclass; let fclass = topbar.state.requestData.fclass;
let statisticsStyle = fclass == 0 ? 'block' : 'none'; let statisticsStyle = fclass == 0 ? 'block' : 'none';
let flevelStyle =
d.data.ftype == 2 && d.data.deptLevel == 0 ? 'inline-block' : 'none';
if (d.data.ftype == 0) { if (d.data.ftype == 0) {
return `<div> return `<div>
<div style="display: inline-block; text-align: center; margin-left: 5px;"> <div style="display: inline-block; text-align: center; margin-left: 5px;">
@ -185,7 +187,9 @@ export default function companyPage() {
} style="width: 110px;margin: 0 auto;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow:ellipsis; } style="width: 110px;margin: 0 auto;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow:ellipsis;
line-height: 18px;word-break: break-all;">${d.data.fname}</div> line-height: 18px;word-break: break-all;">${d.data.fname}</div>
<div style="display: ${statisticsStyle}"> <div style="display: ${statisticsStyle}">
<span style="color:red">${d.data.staffNum}</span> / <span style="color:red;display: ${flevelStyle}">${
d.data.staffNum
} /</span>
<span style="color:green">${d.data.onJobNum}</span> <span style="color:green">${d.data.onJobNum}</span>
</div> </div>
</div> </div>
@ -204,7 +208,9 @@ export default function companyPage() {
<div style="width: 110px;margin: 0 auto;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; <div style="width: 110px;margin: 0 auto;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;
line-height: 18px;word-break: break-all;">${d.data.fname}</div> line-height: 18px;word-break: break-all;">${d.data.fname}</div>
<div style="display: ${statisticsStyle}"> <div style="display: ${statisticsStyle}">
<span style="color:red">${d.data.staffNum}</span> / <span style="color:red;display: ${flevelStyle}">${
d.data.staffNum
} /</span>
<span style="color:green">${d.data.onJobNum}</span> <span style="color:green">${d.data.onJobNum}</span>
</div> </div>
</div> </div>
@ -472,6 +478,13 @@ export default function companyPage() {
onZoomIn={(progressBtn) => handleZoomIn(progressBtn)} onZoomIn={(progressBtn) => handleZoomIn(progressBtn)}
onZoomBehavior={(value) => handleZoomBehavior(value)} onZoomBehavior={(value) => handleZoomBehavior(value)}
/> />
<TimeLine
ref={(r) => (timeLine = r)}
onClick={(timeline) => {
timeLineSearch(timeline);
}}
url={'/api/bs/hrmorganization/orgchart/timeLines?fclass=0'}
/>
<Spin size="large" spinning={spinning}> <Spin size="large" spinning={spinning}>
<OrgChartComponent <OrgChartComponent
setChart={(chart) => (orgChart = chart)} setChart={(chart) => (orgChart = chart)}

@ -99,7 +99,7 @@ export default function userPage() {
// //
useEffect(() => { useEffect(() => {
document.cookie = document.cookie =
'ecology_JSessionid=aaaSjdYP0FDFSd1hMbt8y; JSESSIONID=aaaSjdYP0FDFSd1hMbt8y; Systemlanguid=7; languageidweaver=7; loginuuids=1; loginidweaver=sysadmin;'; 'ecology_JSessionid=aaaOSu6bA71rZb9EYCuhz; JSESSIONID=aaaOSu6bA71rZb9EYCuhz; Systemlanguid=7; languageidweaver=7; loginidweaver=sysadmin; loginuuids=1;';
d3.json( d3.json(
'/api/bs/hrmorganization/orgchart/userData?fclass=0&fisvitual=0&root=0&level=3&id=0', '/api/bs/hrmorganization/orgchart/userData?fclass=0&fisvitual=0&root=0&level=3&id=0',
).then((data) => { ).then((data) => {

Loading…
Cancel
Save