feature/ais
Chengliang 2 years ago
parent be056f701f
commit 0524237ae6

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -16,13 +16,13 @@
.progressLine { .progressLine {
height: 100px; height: 100px;
width: 0px; width: 0px;
border-left: 2px solid #C9C9C9; border-left: 2px solid #c9c9c9;
margin-left: 12px; margin-left: 12px;
} }
.progressBtn { .progressBtn {
width: 16px; width: 16px;
height: 9px; height: 9px;
background-color: #C9C9C9; background-color: #c9c9c9;
position: absolute; position: absolute;
left: 5px; left: 5px;
top: 0px; top: 0px;
@ -33,6 +33,6 @@
margin-top: 20px; margin-top: 20px;
margin-bottom: 20px; margin-bottom: 20px;
margin-left: 20px; margin-left: 20px;
cursor: pointer; // cursor: pointer;
} }
} }

@ -25,8 +25,8 @@ export class TopBar extends React.Component {
levelOptions: [], //hrm levelOptions: [], //hrm
requestData: { requestData: {
date: moment(new Date()).format('YYYY-MM-DD'), // date: moment(new Date()).format('YYYY-MM-DD'), //
department: [], department: undefined,
level: '2', // level: '0', //
}, },
}; };
} }
@ -46,36 +46,17 @@ export class TopBar extends React.Component {
* @returns * @returns
*/ */
getDepartmentTreeNode = (parentId) => { getDepartmentTreeNode = (parentId) => {
// let api = let api = '/api/ais/orgChart/getDepartmentTree?department=' + parentId;
// '/api/bs/hrmorganization/jclorgchart/getDepartmentTree?department=' + fetch(api)
// parentId; .then((res) => res.json())
// fetch(api) .then((data) => {
// .then((res) => res.json()) if (data.status) {
// .then((data) => { let arr = [...this.state.deptartmentTreeData, ...data.data.deptTree];
// if (data.code == 200) {
// let arr = [...this.state.deptartmentTreeData, ...data.data];
// this.setState({
// deptartmentTreeData: arr,
// });
// }
// });
let treeData = [];
if (parentId === null) {
treeData = [
{ id: 1, pId: 0, value: '1', title: 'Expand to load' },
{ id: 2, pId: 0, value: '2', title: 'Expand to load' },
{ id: 3, pId: 0, value: '3', title: 'Tree Node', isLeaf: true },
];
} else {
treeData = [
{ id: 6, pId: 1, value: '3', title: 'Tree Node', isLeaf: true },
];
}
let arr = [...this.state.deptartmentTreeData, ...treeData];
this.setState({ this.setState({
deptartmentTreeData: arr, deptartmentTreeData: arr,
}); });
}
});
}; };
/** /**
@ -88,13 +69,12 @@ export class TopBar extends React.Component {
const { id } = treeNode.props; const { id } = treeNode.props;
setTimeout(() => { setTimeout(() => {
this.getDepartmentTreeNode(id); this.getDepartmentTreeNode(id);
resolve(); resolve(undefined);
}, 300); }, 1000);
}); });
onDepartmentChange = (value) => { onDepartmentChange = (value) => {
let department = value.length > 0 ? this.paramsUtil(value) : undefined; let requestData = { ...this.state.requestData, department: value };
let requestData = { ...this.state.requestData, department: department };
this.setState({ departmentData: value, requestData }); this.setState({ departmentData: value, requestData });
}; };
@ -112,28 +92,16 @@ export class TopBar extends React.Component {
}; };
componentDidMount() { componentDidMount() {
// fetch(this.props.url) fetch(this.props.url)
// .then((res) => res.json()) .then((res) => res.json())
// .then((data) => { .then((data) => {
// this.setState({ if (data.status) {
// levelOptions: data.levelOptions
// });
// });
const options = [
{ value: '1', label: '一级' },
{ value: '2', label: '二级' },
{ value: '3', label: '三级' },
];
const treeData = [
{ id: 1, pId: 0, value: '1', title: 'Expand to load' },
{ id: 2, pId: 0, value: '2', title: 'Expand to load' },
{ id: 3, pId: 0, value: '3', title: 'Tree Node', isLeaf: true },
];
this.setState({ this.setState({
levelOptions: options, levelOptions: data.data.deptLevel,
deptartmentTreeData: data.data.deptTree,
});
}
}); });
this.getDepartmentTreeNode(null);
} }
/** /**
@ -155,15 +123,15 @@ export class TopBar extends React.Component {
); );
render() { render() {
const { deptartmentTreeData, treeExpandedKeys } = this.state; const { deptartmentTreeData } = this.state;
return ( return (
<div className={style.topbarWrapper}> <div className={style.topbarWrapper}>
<Row> <Row gutter={[16, 16]}>
<Col span={6}> <Col span={6}>
日期追溯 日期追溯
<DatePicker <DatePicker
placeholder="日期选择" placeholder="日期选择"
style={{ width: 130 }} style={{ width: 150 }}
locale={locale} locale={locale}
allowClear={false} allowClear={false}
disabledDate={this.disabledDate} disabledDate={this.disabledDate}
@ -183,25 +151,18 @@ export class TopBar extends React.Component {
<Col span={6}> <Col span={6}>
部门 部门
<TreeSelect <TreeSelect
showSearch
allowClear
treeDataSimpleMode treeDataSimpleMode
treeCheckable
showCheckedStrategy={TreeSelect.SHOW_ALL}
treeExpandedKeys={treeExpandedKeys}
treeCheckStrictly
style={{ width: '80%' }} style={{ width: '80%' }}
value={this.state.requestData.department} value={this.state.requestData.department}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="部门选择" placeholder="请选择部门节点"
onChange={this.onDepartmentChange} onChange={this.onDepartmentChange}
loadData={this.onDepartmentLoadData} loadData={this.onDepartmentLoadData}
treeData={deptartmentTreeData} treeData={deptartmentTreeData}
onTreeExpand={this.onTreeExpand}
/> />
</Col> </Col>
<Col span={6}> <Col span={6}>
显示层级 部门层级
<Select <Select
style={{ width: 130 }} style={{ width: 130 }}
value={this.state.requestData.level} value={this.state.requestData.level}

@ -480,7 +480,6 @@ export class OrgChart {
//InnerFunctions which will update visuals //InnerFunctions which will update visuals
const attrs = this.getChartState(); const attrs = this.getChartState();
if (!attrs.data || attrs.data.length == 0) { if (!attrs.data || attrs.data.length == 0) {
console.log('ORG CHART - Data is empty');
return this; return this;
} }
@ -637,19 +636,9 @@ export class OrgChart {
({ data }) => attrs.nodeId(data) === attrs.parentNodeId(obj), ({ data }) => attrs.nodeId(data) === attrs.parentNodeId(obj),
)[0]; )[0];
if (nodeFound) { if (nodeFound) {
console.log(
`ORG CHART - ADD - Node with id "${attrs.nodeId(
obj,
)}" already exists in tree`,
);
return this; return this;
} }
if (!parentFound) { if (!parentFound) {
console.log(
`ORG CHART - ADD - Parent node with id "${attrs.parentNodeId(
obj,
)}" not found in the tree`,
);
return this; return this;
} }
if (obj._centered && !obj._expanded) obj._expanded = true; if (obj._centered && !obj._expanded) obj._expanded = true;
@ -670,19 +659,9 @@ export class OrgChart {
({ data }) => attrs.nodeId(data) === attrs.parentNodeId(obj), ({ data }) => attrs.nodeId(data) === attrs.parentNodeId(obj),
)[0]; )[0];
if (nodeFound) { if (nodeFound) {
console.log(
`ORG CHART - ADD - Node with id "${attrs.nodeId(
obj,
)}" already exists in tree`,
);
return this; return this;
} }
if (!parentFound) { if (!parentFound) {
console.log(
`ORG CHART - ADD - Parent node with id "${attrs.parentNodeId(
obj,
)}" not found in the tree`,
);
return this; return this;
} }
obj._expanded = true; obj._expanded = true;
@ -701,9 +680,6 @@ export class OrgChart {
({ data }) => attrs.nodeId(data) == nodeId, ({ data }) => attrs.nodeId(data) == nodeId,
)[0]; )[0];
if (!node) { if (!node) {
console.log(
`ORG CHART - REMOVE - Node with id "${nodeId}" not found in the tree`,
);
return this; return this;
} }
@ -866,8 +842,6 @@ export class OrgChart {
const nodes = treeData.descendants(); const nodes = treeData.descendants();
// console.table(nodes.map(d => ({ x: d.x, y: d.y, width: d.width, height: d.height, flexCompactDim: d.flexCompactDim + "" })))
// Get all links // Get all links
const links = treeData.descendants().slice(1); const links = treeData.descendants().slice(1);
nodes.forEach(attrs.layoutBindings[attrs.layout].swap); nodes.forEach(attrs.layoutBindings[attrs.layout].swap);
@ -1298,7 +1272,6 @@ export class OrgChart {
// } else { // } else {
// this.fit(); // this.fit();
// } // }
console.log(44444, centeredNodes);
this.fit({ this.fit({
animate: true, animate: true,
scale: false, scale: false,
@ -1622,7 +1595,6 @@ export class OrgChart {
const attrs = this.getChartState(); const attrs = this.getChartState();
const { root } = attrs; const { root } = attrs;
let descendants = nodes ? nodes : root.descendants(); let descendants = nodes ? nodes : root.descendants();
console.log(11111111111, nodes, descendants, scale);
const minX = d3.min( const minX = d3.min(
descendants, descendants,
(d) => d.x + attrs.layoutBindings[attrs.layout].nodeLeftX(d), (d) => d.x + attrs.layoutBindings[attrs.layout].nodeLeftX(d),
@ -1639,7 +1611,6 @@ export class OrgChart {
descendants, descendants,
(d) => d.y + attrs.layoutBindings[attrs.layout].nodeBottomY(d), (d) => d.y + attrs.layoutBindings[attrs.layout].nodeBottomY(d),
); );
console.log('333,minY', minX, maxX, minY, maxY);
this.zoomTreeBounds({ this.zoomTreeBounds({
params: { animate: animate, scale }, params: { animate: animate, scale },
x0: transform == 'export' ? minX - 700 : minX - 50, x0: transform == 'export' ? minX - 700 : minX - 50,
@ -1659,11 +1630,6 @@ export class OrgChart {
)[0]; )[0];
if (!node) { if (!node) {
console.log(
`ORG CHART - ${
expandedFlag ? 'EXPAND' : 'COLLAPSE'
} - Node with id (${id}) not found in the tree`,
);
return this; return this;
} }
node.data._expanded = expandedFlag; node.data._expanded = expandedFlag;
@ -1677,9 +1643,6 @@ export class OrgChart {
(d) => attrs.nodeId(d.data) === nodeId, (d) => attrs.nodeId(d.data) === nodeId,
)[0]; )[0];
if (!node) { if (!node) {
console.log(
`ORG CHART - CENTER - Node with id (${nodeId}) not found in the tree`,
);
return this; return this;
} }
node.data._centered = true; node.data._centered = true;
@ -1693,9 +1656,6 @@ export class OrgChart {
(d) => attrs.nodeId(d.data) === nodeId, (d) => attrs.nodeId(d.data) === nodeId,
)[0]; )[0];
if (!node) { if (!node) {
console.log(
`ORG CHART - HIGHLIGHT - Node with id (${nodeId}) not found in the tree`,
);
return this; return this;
} }
node.data._highlighted = true; node.data._highlighted = true;
@ -1710,9 +1670,6 @@ export class OrgChart {
(d) => attrs.nodeId(d.data) === nodeId, (d) => attrs.nodeId(d.data) === nodeId,
)[0]; )[0];
if (!node) { if (!node) {
console.log(
`ORG CHART - HIGHLIGHTROOT - Node with id (${nodeId}) not found in the tree`,
);
return this; return this;
} }
node.data._upToTheRootHighlighted = true; node.data._upToTheRootHighlighted = true;

@ -7,7 +7,7 @@ import ToolBar from '../components/toolBar';
import jsPDF from 'jspdf'; import jsPDF from 'jspdf';
import moment from 'moment'; import moment from 'moment';
import qs from 'qs'; import qs from 'qs';
import { message } from 'antd'; import { message, Tooltip } from 'antd';
let active = 'top'; let active = 'top';
export default function companyPage() { export default function companyPage() {
@ -37,11 +37,11 @@ export default function companyPage() {
if (topBarSearchRequest) { if (topBarSearchRequest) {
let request = { ...topBarSearchRequest, ids: idsStr }; let request = { ...topBarSearchRequest, ids: idsStr };
api = api =
'/api/bs/hrmorganization/jclorgchart/asyncCompanyData' + '/api/ais/orgChart/asyncCompanyData' +
qs.stringify(request, { addQueryPrefix: true }); qs.stringify(request, { addQueryPrefix: true });
} else { } else {
api = api =
'/api/bs/hrmorganization/jclorgchart/asyncCompanyData?fclass=0&root=0&date=' + '/api/ais/orgChart/asyncCompanyData?level=0&date=' +
moment(new Date()).format('YYYY-MM-DD') + moment(new Date()).format('YYYY-MM-DD') +
'&ids=' + '&ids=' +
idsStr; idsStr;
@ -49,9 +49,9 @@ export default function companyPage() {
fetch(api) fetch(api)
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then((resp) => {
if (data.data) { if (resp.data.data) {
data.data.forEach((item) => { resp.data.data.forEach((item) => {
window.chart.addNode(item); window.chart.addNode(item);
}); });
} }
@ -59,28 +59,39 @@ export default function companyPage() {
} }
} }
// //
function getDepartmentImage() { function getLevelImage(deptLevel, isVirtual) {
let index = Math.floor(Math.random() * 8) + 1; switch (deptLevel) {
// return `./img/department/${index}.png`; case '0':
return `./img/department/1.png`; return isVirtual == 0
? `./img/company/level1.png`
: `./img/company/level5.png`;
case '1':
return isVirtual == 0
? `./img/company/level2.png`
: `./img/company/level6.png`;
case '2':
return isVirtual == 0
? `./img/company/level3.png`
: `./img/company/level7.png`;
case '3':
return isVirtual == 0
? `./img/company/level4.png`
: `./img/company/level8.png`;
default:
return isVirtual == 0
? `./img/company/level4.png`
: `./img/company/level8.png`;
} }
//
function getSubcompanyImage() {
let index = Math.floor(Math.random() * 3) + 1;
return `./img/subcompany/2.png`;
} }
// //
useEffect(() => { useEffect(() => {
document.cookie =
'ecology_JSessionid=aaa_5XehwlWEjcCKl0cHy; JSESSIONID=aaa_5XehwlWEjcCKl0cHy; Systemlanguid=7; languageidweaver=7; loginuuids=1; loginidweaver=sysadmin; __randcode__=706b3e41-eafb-4e55-bc1c-a4cf0f9fdaa7';
d3.json( d3.json(
'/api/bs/hrmorganization/jclorgchart/companyData?fclass=0&isvitual=0&root=0&date=' + '/api/ais/orgChart/companyData?level=0&date=' +
moment(new Date()).format('YYYY-MM-DD'), moment(new Date()).format('YYYY-MM-DD'),
).then((data) => { ).then((resp) => {
setData(data.data); setData(resp.data.data);
setHasRight('true'); setHasRight('true');
}); });
}, [true]); }, [true]);
@ -110,24 +121,16 @@ export default function companyPage() {
if (d.data.ftype == 0) { if (d.data.ftype == 0) {
return 100; return 100;
} else if (d.data.ftype == 1) { } else if (d.data.ftype == 1) {
return 160; return 80;
} else if (d.data.ftype == 2) { } else if (d.data.ftype == 2) {
return 56; return 106;
} }
return 120; return 120;
}; };
const nodeContentRender = (d, i, arr, state) => { const nodeContentRender = (d, i, arr, state) => {
//
let companyUrl =
'/spa/organization/static/index.html#/main/organization/group';
//
let subcompanyUrl = `/spa/hrm/engine.html#/hrmengine/organization?showTree=false&type=subcompany&id=${d.data.fobjid}`;
//
let departmentUrl = `/spa/hrm/engine.html#/hrmengine/organization?showTree=false&isView=1&type=department&id=${d.data.fobjid}`;
if (d.data.ftype == 0) { if (d.data.ftype == 0) {
return `<div onclick="if(${d.data.fisvitual}==1) return;" style="text-align:center"> return `<div style="text-align:center">
<div style="display: inline-block; vertical-align: top;"> <div style="display: inline-block; vertical-align: top;">
<img src="./img/company.png" /> <img src="./img/company.png" />
</div> </div>
@ -144,12 +147,7 @@ export default function companyPage() {
</div> </div>
</div>`; </div>`;
} else if (d.data.ftype == 1) { } else if (d.data.ftype == 1) {
return `<div onclick="if(${ return `<div onclick="window.open('${d.data.url}', '_blank')">
d.data.fisvitual
}==1) return;window.open('${subcompanyUrl}', '_blank')">
<div style="width: 85px; height: 85px; border: 1px solid #66BAF5; border-radius: 50%;text-align: center; line-height: 85px; margin: 0 auto;display:flex;justify-content:center;align-items:center">
<img src="${getSubcompanyImage()}" />
</div>
<div style="width: 136px; border: 1px solid #66BAF5; margin: 10px auto 0px; border-radius: 23px; text-align: center; <div style="width: 136px; border: 1px solid #66BAF5; margin: 10px auto 0px; border-radius: 23px; text-align: center;
font-size: 14px; font-size: 14px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei; font-family: Microsoft YaHei-Regular, Microsoft YaHei;
@ -162,21 +160,32 @@ export default function companyPage() {
</div> </div>
</div>`; </div>`;
} else if (d.data.ftype == 2) { } else if (d.data.ftype == 2) {
let one = d.data.leader == '' ? 'none' : 'inline-block';
let three = d.data.deputyLeader == '' ? 'none' : 'inline-block';
let two = d.data.header == '' ? 'none' : 'block';
return ` return `
<div style="width: 100%; height: 100%; background-size: 100% 100%;" onclick="if(${ <div style="width: 100%; height: 100%; background-size: 100% 100%;" >
d.data.fisvitual <div style='position:absolute;height:100%'>
}==1) return;window.open('${departmentUrl}')"> <img style='width:144px;height:106px' src="${getLevelImage(
<div style='position:absolute'> d.data.deptLevel,
<img src='./img/company_job_label.png'/></div> d.data.isVirtual,
<div style="padding-left: 8px; padding-top: 23px;display:flex;align-items:center"> )}"/></div>
<img src="${getDepartmentImage()}"/> <div style="width: 144px;height: 80px;top: 35px;position: relative;font-weight: 400;font-size: 12px;
<span style=" font-family: Microsoft YaHei-Regular, Microsoft YaHei;color: #333333;text-align: center;">
margin-left: 3px;
font-size: 12px; <div title=${
font-family: Microsoft YaHei-Regular, Microsoft YaHei; d.data.fname
font-weight: 400; } style="width: 110px;margin: 0 auto;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow:ellipsis;
color: #333333; line-height: 18px;word-break: break-all;">${d.data.fname}</div>
">${d.data.fname}</span> <div style="width: 130px;margin: 0 auto;line-height: 18px;display:${two}">分管领导${
d.data.header
} </div>
<div style="width: 120px;margin: 0 auto;line-height: 18px;display:${one}">
<span style="display:${one}">${
d.data.leader
}</span><span style="display:${three}"> &nbsp;|| ${
d.data.deputyLeader
}</span></div>
</div> </div>
</div> </div>
`; `;
@ -233,10 +242,6 @@ export default function companyPage() {
orgChart && orgChart.zoomBehavior(value - 50); orgChart && orgChart.zoomBehavior(value - 50);
}; };
// tool bar end
// top bar start
function downloadPdf(chart) { function downloadPdf(chart) {
chart.exportImg({ chart.exportImg({
save: false, save: false,
@ -271,21 +276,22 @@ export default function companyPage() {
const handleSearch = (requestData) => { const handleSearch = (requestData) => {
topBarSearchRequest = requestData; topBarSearchRequest = requestData;
let api = let api =
'/api/bs/hrmorganization/jclorgchart/companyData' + '/api/ais/orgChart/companyData' +
qs.stringify(requestData, { addQueryPrefix: true }); qs.stringify(requestData, { addQueryPrefix: true });
fetch(api) fetch(api)
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then((resp) => {
if (data.data) { if (resp.status) {
if (!data.data.length) { if (!resp.data.data.length) {
setData([{}]); setData([{}]);
message.warning('暂无数据'); message.warning('暂无数据');
} else { } else {
setData(data?.data); setData(resp.data.data);
} }
} }
}); });
}; };
useEffect(() => { useEffect(() => {
if (active == 'left') { if (active == 'left') {
orgChart && orgChart &&
@ -301,7 +307,7 @@ export default function companyPage() {
.render(); .render();
} }
}, [data]); }, [data]);
// top bar end
if (hasRight === false) { if (hasRight === false) {
return ( return (
<div style={{ width: '100%', top: '40%', position: 'absolute' }}> <div style={{ width: '100%', top: '40%', position: 'absolute' }}>
@ -325,7 +331,7 @@ export default function companyPage() {
handleSearch(requestData); handleSearch(requestData);
}} }}
type="company" type="company"
url="/api/bs/hrmorganization/jclorgchart/getSearchCondition" url="/api/ais/orgChart/getSearchCondition"
/> />
<ToolBar <ToolBar
onTopLayoutClick={(progressBtn) => handleTopLayoutClick(progressBtn)} onTopLayoutClick={(progressBtn) => handleTopLayoutClick(progressBtn)}

@ -3,9 +3,9 @@
} }
.wrapper { .wrapper {
background: #F7F9FD; background: #f7f9fd;
} }
.contentWrapper { .contentWrapper {
background-color: #F7F9FD; background-color: #f7f9fd;
} }

@ -87,10 +87,10 @@ export default function userPage() {
// //
useEffect(() => { useEffect(() => {
document.cookie = document.cookie =
'ecology_JSessionid=aaa8b2PuQK_99bUdsZfuy; JSESSIONID=aaa8b2PuQK_99bUdsZfuy; loginidweaver=1; languageidweaver=7; loginuuids=1; __randcode__=fc144674-308a-4579-ba74-717559795c8b'; 'ecology_JSessionid=aaaWkjP1eWxafe-9oLVHy; JSESSIONID=aaaWkjP1eWxafe-9oLVHy; Systemlanguid=7; languageidweaver=7; loginidweaver=sysadmin; loginuuids=1; __randcode__=7dbeb514-9ed0-45cd-b615-ee71d20de8ba';
d3.json( d3.json(
// "/user/data" // "/user/data"
'/api/bs/hrmorganization/jclorgchart/userData?fclass=0&root=0&date=' + '/api/bs/hrmorganization/orgchart/userData?fclass=0&root=0&date=' +
moment(new Date()).format('YYYY-MM-DD'), moment(new Date()).format('YYYY-MM-DD'),
).then((data) => { ).then((data) => {
setData(data.data); setData(data.data);

Loading…
Cancel
Save