Merge pull request '组织架构图增加版本删除功能' (#16) from feature/cl into master
Reviewed-on: http://221.226.25.34:3000/liang.cheng/org-chart-frant/pulls/16
This commit is contained in:
commit
2b8751d7dd
|
|
@ -7,10 +7,12 @@
|
|||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
import React from 'react';
|
||||
import { Timeline, Drawer } from 'antd';
|
||||
import { Timeline, Drawer, Popconfirm, message } from 'antd';
|
||||
import styles from './index.less';
|
||||
import leftTreeShow from './img/leftTree-show.png';
|
||||
import leftHide from './img/leftTree-hide.png';
|
||||
import { CloseCircleOutlined } from '@ant-design/icons';
|
||||
import { getLabel } from '../../util/i18n.js';
|
||||
|
||||
export default class TimeLine extends React.Component {
|
||||
constructor(props) {
|
||||
|
|
@ -35,6 +37,21 @@ export default class TimeLine extends React.Component {
|
|||
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(`${getLabel(547484, labelData)}`, 2, 3);
|
||||
window.location.reload(true);
|
||||
} else {
|
||||
message.error(`${getLabel(547483, labelData)}`, 2, 3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.searchTimeLines(this.props.url);
|
||||
}
|
||||
|
|
@ -56,6 +73,8 @@ export default class TimeLine extends React.Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { labelData } = this.props;
|
||||
|
||||
let showStyle = {};
|
||||
let positionStyle = {};
|
||||
if (this.state.open) {
|
||||
|
|
@ -89,14 +108,27 @@ export default class TimeLine extends React.Component {
|
|||
return (
|
||||
<Timeline.Item
|
||||
key={item.key}
|
||||
onClick={this.handleLineClick.bind(this, item)}
|
||||
className={styles.timeline}
|
||||
color={item.color}
|
||||
style={{
|
||||
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={`${getLabel(547491, labelData)}[${item.title}]?`}
|
||||
onConfirm={this.handleDelete.bind(this, item.key)}
|
||||
okText={getLabel(547319, labelData)}
|
||||
cancelText={getLabel(547318, labelData)}
|
||||
>
|
||||
<div className={styles.delete}>
|
||||
<CloseCircleOutlined />
|
||||
</div>
|
||||
</Popconfirm>
|
||||
)}
|
||||
<div className={styles.time}>{item.time}</div>
|
||||
</Timeline.Item>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -22,14 +22,18 @@
|
|||
.time {
|
||||
color: dimgray;
|
||||
}
|
||||
|
||||
.delete :hover {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
.leftRightLayoutBtn {
|
||||
width: 18px;
|
||||
height: 60px;
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
margin-top: -30px;
|
||||
// margin-top: -30px;
|
||||
z-index: 101;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ export class TopBar extends React.Component {
|
|||
}}
|
||||
>
|
||||
{getLabel(547313, labelData)}
|
||||
</Button>{' '}
|
||||
</Button>
|
||||
</span>
|
||||
)}
|
||||
|
||||
|
|
|
|||
|
|
@ -351,6 +351,10 @@ export default function companyPage() {
|
|||
*/
|
||||
const handleExport = (type) => {
|
||||
if (type == 'png') {
|
||||
const hiddenElements = document.querySelectorAll('.tooltitle');
|
||||
const hiddenElementsArray = Array.from(hiddenElements);
|
||||
// 从 DOM 中移除隐藏内容
|
||||
hiddenElementsArray.forEach((el) => (el.style.display = 'none'));
|
||||
orgChart && orgChart.exportImg({ full: true });
|
||||
} else {
|
||||
orgChart && downloadPdf(orgChart);
|
||||
|
|
@ -490,6 +494,7 @@ export default function companyPage() {
|
|||
timeLineSearch(timeline);
|
||||
}}
|
||||
url={'/api/bs/hrmorganization/orgchart/timeLines?fclass=0'}
|
||||
labelData={labelData}
|
||||
/>
|
||||
<Spin size="large" spinning={spinning}>
|
||||
<OrgChartComponent
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export default function userPage() {
|
|||
// 获取数据
|
||||
useEffect(() => {
|
||||
document.cookie =
|
||||
'ecology_JSessionid=aaa5JLqrHUV6R9P1cmTbz; JSESSIONID=aaa5JLqrHUV6R9P1cmTbz; loginuuids=1; languageidweaver=7; Systemlanguid=7; loginidweaver=sysadmin; __randcode__=72a0b641-7599-4301-a47f-61620f350ec5';
|
||||
'ecology_JSessionid=aaav03Zyuvq3A9TG0PEdz; JSESSIONID=aaav03Zyuvq3A9TG0PEdz; Systemlanguid=7; languageidweaver=7; loginuuids=1; loginidweaver=sysadmin; __randcode__=62316935-a99b-4cbf-a23f-0ac9c37db0da';
|
||||
d3.json(
|
||||
'/api/bs/hrmorganization/orgchart/userData?fclass=0&fisvitual=0&root=0&level=3&id=0',
|
||||
).then((data) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue