组织架构图增加版本删除功能
This commit is contained in:
parent
8a59de812a
commit
c9005b9a08
|
|
@ -7,10 +7,12 @@
|
||||||
* @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';
|
||||||
|
import { getLabel } from '../../util/i18n.js';
|
||||||
|
|
||||||
export default class TimeLine extends React.Component {
|
export default class TimeLine extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|
@ -35,6 +37,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(`${getLabel(547484, labelData)}`, 2, 3);
|
||||||
|
window.location.reload(true);
|
||||||
|
} else {
|
||||||
|
message.error(`${getLabel(547483, labelData)}`, 2, 3);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.searchTimeLines(this.props.url);
|
this.searchTimeLines(this.props.url);
|
||||||
}
|
}
|
||||||
|
|
@ -56,6 +73,8 @@ export default class TimeLine extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { labelData } = this.props;
|
||||||
|
|
||||||
let showStyle = {};
|
let showStyle = {};
|
||||||
let positionStyle = {};
|
let positionStyle = {};
|
||||||
if (this.state.open) {
|
if (this.state.open) {
|
||||||
|
|
@ -89,14 +108,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={`${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>
|
<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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ export class TopBar extends React.Component {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{getLabel(547313, labelData)}
|
{getLabel(547313, labelData)}
|
||||||
</Button>{' '}
|
</Button>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -351,6 +351,10 @@ export default function companyPage() {
|
||||||
*/
|
*/
|
||||||
const handleExport = (type) => {
|
const handleExport = (type) => {
|
||||||
if (type == 'png') {
|
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 });
|
orgChart && orgChart.exportImg({ full: true });
|
||||||
} else {
|
} else {
|
||||||
orgChart && downloadPdf(orgChart);
|
orgChart && downloadPdf(orgChart);
|
||||||
|
|
@ -490,6 +494,7 @@ export default function companyPage() {
|
||||||
timeLineSearch(timeline);
|
timeLineSearch(timeline);
|
||||||
}}
|
}}
|
||||||
url={'/api/bs/hrmorganization/orgchart/timeLines?fclass=0'}
|
url={'/api/bs/hrmorganization/orgchart/timeLines?fclass=0'}
|
||||||
|
labelData={labelData}
|
||||||
/>
|
/>
|
||||||
<Spin size="large" spinning={spinning}>
|
<Spin size="large" spinning={spinning}>
|
||||||
<OrgChartComponent
|
<OrgChartComponent
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ export default function userPage() {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.cookie =
|
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(
|
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…
Reference in New Issue