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

@ -1,38 +1,38 @@
.toolbarWrapper {
width: 68px;
position: fixed;
right: 10px;
z-index: 100;
background: #fff;
border-radius: 20px;
padding-top: 20px;
padding-bottom: 20px;
text-align: center;
.progressWrapper {
position: relative;
padding-top: 5px;
padding-bottom: 5px;
margin-left: 20px;
.progressLine {
height: 100px;
width: 0px;
border-left: 2px solid #C9C9C9;
margin-left: 12px;
}
.progressBtn {
width: 16px;
height: 9px;
background-color: #C9C9C9;
position: absolute;
left: 5px;
top: 0px;
}
width: 68px;
position: fixed;
right: 10px;
z-index: 100;
background: #fff;
border-radius: 20px;
padding-top: 20px;
padding-bottom: 20px;
text-align: center;
.progressWrapper {
position: relative;
padding-top: 5px;
padding-bottom: 5px;
margin-left: 20px;
.progressLine {
height: 100px;
width: 0px;
border-left: 2px solid #c9c9c9;
margin-left: 12px;
}
.toolBarItem {
display: block;
margin-top: 20px;
margin-bottom: 20px;
margin-left: 20px;
cursor: pointer;
.progressBtn {
width: 16px;
height: 9px;
background-color: #c9c9c9;
position: absolute;
left: 5px;
top: 0px;
}
}
}
.toolBarItem {
display: block;
margin-top: 20px;
margin-bottom: 20px;
margin-left: 20px;
// cursor: pointer;
}
}

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

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

@ -7,7 +7,7 @@ import ToolBar from '../components/toolBar';
import jsPDF from 'jspdf';
import moment from 'moment';
import qs from 'qs';
import { message } from 'antd';
import { message, Tooltip } from 'antd';
let active = 'top';
export default function companyPage() {
@ -37,11 +37,11 @@ export default function companyPage() {
if (topBarSearchRequest) {
let request = { ...topBarSearchRequest, ids: idsStr };
api =
'/api/bs/hrmorganization/jclorgchart/asyncCompanyData' +
'/api/ais/orgChart/asyncCompanyData' +
qs.stringify(request, { addQueryPrefix: true });
} else {
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') +
'&ids=' +
idsStr;
@ -49,9 +49,9 @@ export default function companyPage() {
fetch(api)
.then((res) => res.json())
.then((data) => {
if (data.data) {
data.data.forEach((item) => {
.then((resp) => {
if (resp.data.data) {
resp.data.data.forEach((item) => {
window.chart.addNode(item);
});
}
@ -59,28 +59,39 @@ export default function companyPage() {
}
}
//
function getDepartmentImage() {
let index = Math.floor(Math.random() * 8) + 1;
// return `./img/department/${index}.png`;
return `./img/department/1.png`;
}
//
function getSubcompanyImage() {
let index = Math.floor(Math.random() * 3) + 1;
return `./img/subcompany/2.png`;
//
function getLevelImage(deptLevel, isVirtual) {
switch (deptLevel) {
case '0':
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`;
}
}
//
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(
'/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'),
).then((data) => {
setData(data.data);
).then((resp) => {
setData(resp.data.data);
setHasRight('true');
});
}, [true]);
@ -88,7 +99,7 @@ export default function companyPage() {
// ButtonContent
const buttonContentRender = ({ node, state }) => {
if (node.children) {
return `<div style="border-radius:3px;padding:3px;font-size:10px;margin:auto auto;background-color:#66BAF5"> <div style="margin-top:0px;line-height:1.35;height:11px;font-size:25px; color: #fff;">ˆ</div> </div>`;
return `<div style="border-radius:3px;padding:3px;font-size:10px;margin:auto auto;background-color:#66BAF5"> <div style="margin-top:0px;line-height:1.35;height:11px;font-size:25px; color: #fff;">ˆ</div> </div>`;
} else {
return `<div style="border-radius:3px;padding:3px;font-size:10px;margin:auto auto;background-color:#66BAF5"> <div style="margin-top:0px;line-height:1.35;height:11px;font-size:25px; color: #fff;transform:rotate(180deg)">ˆ</div> </div>`;
}
@ -110,24 +121,16 @@ export default function companyPage() {
if (d.data.ftype == 0) {
return 100;
} else if (d.data.ftype == 1) {
return 160;
return 80;
} else if (d.data.ftype == 2) {
return 56;
return 106;
}
return 120;
};
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) {
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;">
<img src="./img/company.png" />
</div>
@ -144,12 +147,7 @@ export default function companyPage() {
</div>
</div>`;
} else if (d.data.ftype == 1) {
return `<div onclick="if(${
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>
return `<div onclick="window.open('${d.data.url}', '_blank')">
<div style="width: 136px; border: 1px solid #66BAF5; margin: 10px auto 0px; border-radius: 23px; text-align: center;
font-size: 14px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
@ -162,21 +160,32 @@ export default function companyPage() {
</div>
</div>`;
} 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 `
<div style="width: 100%; height: 100%; background-size: 100% 100%;" onclick="if(${
d.data.fisvitual
}==1) return;window.open('${departmentUrl}')">
<div style='position:absolute'>
<img src='./img/company_job_label.png'/></div>
<div style="padding-left: 8px; padding-top: 23px;display:flex;align-items:center">
<img src="${getDepartmentImage()}"/>
<span style="
margin-left: 3px;
font-size: 12px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #333333;
">${d.data.fname}</span>
<div style="width: 100%; height: 100%; background-size: 100% 100%;" >
<div style='position:absolute;height:100%'>
<img style='width:144px;height:106px' src="${getLevelImage(
d.data.deptLevel,
d.data.isVirtual,
)}"/></div>
<div style="width: 144px;height: 80px;top: 35px;position: relative;font-weight: 400;font-size: 12px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;color: #333333;text-align: center;">
<div title=${
d.data.fname
} 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>
<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>
`;
@ -233,10 +242,6 @@ export default function companyPage() {
orgChart && orgChart.zoomBehavior(value - 50);
};
// tool bar end
// top bar start
function downloadPdf(chart) {
chart.exportImg({
save: false,
@ -271,21 +276,22 @@ export default function companyPage() {
const handleSearch = (requestData) => {
topBarSearchRequest = requestData;
let api =
'/api/bs/hrmorganization/jclorgchart/companyData' +
'/api/ais/orgChart/companyData' +
qs.stringify(requestData, { addQueryPrefix: true });
fetch(api)
.then((res) => res.json())
.then((data) => {
if (data.data) {
if (!data.data.length) {
.then((resp) => {
if (resp.status) {
if (!resp.data.data.length) {
setData([{}]);
message.warning('暂无数据');
} else {
setData(data?.data);
setData(resp.data.data);
}
}
});
};
useEffect(() => {
if (active == 'left') {
orgChart &&
@ -301,7 +307,7 @@ export default function companyPage() {
.render();
}
}, [data]);
// top bar end
if (hasRight === false) {
return (
<div style={{ width: '100%', top: '40%', position: 'absolute' }}>
@ -325,7 +331,7 @@ export default function companyPage() {
handleSearch(requestData);
}}
type="company"
url="/api/bs/hrmorganization/jclorgchart/getSearchCondition"
url="/api/ais/orgChart/getSearchCondition"
/>
<ToolBar
onTopLayoutClick={(progressBtn) => handleTopLayoutClick(progressBtn)}

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

@ -87,10 +87,10 @@ export default function userPage() {
//
useEffect(() => {
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(
// "/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'),
).then((data) => {
setData(data.data);

Loading…
Cancel
Save