@ -1,11 +1,21 @@
import React from 'react' ;
import { Drawer , Space , Button , Dropdown , Menu , Table , Spin } from 'antd' ;
import {
Drawer ,
Space ,
Button ,
Dropdown ,
Menu ,
Table ,
Spin ,
Checkbox ,
} from 'antd' ;
import { OrgChartComponent } from '@/components/orgChart' ;
import * as d3 from 'd3' ;
import qs from 'qs' ;
import { message } from 'antd' ;
import jsPDF from 'jspdf' ;
import ExportJsonExcel from 'js-export-excel' ;
import './index.less' ;
let addNodeChildFunc = null ;
let orgChart = null ;
@ -21,6 +31,7 @@ export default class DrawerComponents extends React.Component {
dataSource : [ ] ,
columns : [ ] ,
spinning : true ,
showJob : true ,
} ;
}
@ -51,11 +62,11 @@ export default class DrawerComponents extends React.Component {
}
/ / 获 取 数 据
getDeatilDatas ( rootId , type = 'chart' ) {
getDeatilDatas ( rootId , type = 'chart' , showJob = '1' ) {
this . setState ( { spinning : true } ) ;
d3 . json (
'/api/bs/hrmorganization/orgchart/getDepartmentDetail?' +
qs . stringify ( { detauleType : type , rootId : rootId } ) ,
qs . stringify ( { detauleType : type , rootId : rootId , showJob } ) ,
) . then ( ( data ) => {
/ /
if ( type == 'chart' ) {
@ -228,7 +239,7 @@ export default class DrawerComponents extends React.Component {
< img src = "./img/department.png" style = "width: 58px; height: 58px;position:absolute;left:29px; border-radius: 50%; margin-top: 16px;position:absolute;left:29px;z-index:999" / >
< / div >
< div style = "display: inline-block; margin-left: 6px;width: 55%" >
< div style= "font-size: 15px;font-family: Microsoft YaHei-Regular, Microsoft YaHei;font-weight: 900;color: #333333;height: 25px;line-height: 25px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" >
< div class= "dept-box" style= "font-size: 15px;font-family: Microsoft YaHei-Regular, Microsoft YaHei;font-weight: 900;color: #333333;height: 25px;line-height: 25px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" >
$ { d . data . fname }
< / div >
< div style = "font-size: 13px;font-family: Microsoft YaHei-Bold, Microsoft YaHei;color: #333333;height: 25px;line-height: 25px;" >
@ -293,7 +304,7 @@ export default class DrawerComponents extends React.Component {
} ;
onClose = ( ) => {
this . setState ( { open : false , detailType : 'chart' } ) ;
this . setState ( { open : false , detailType : 'chart' , showJob : true } ) ;
} ;
changeDetail = ( ) => {
@ -306,8 +317,16 @@ export default class DrawerComponents extends React.Component {
} ;
render ( ) {
const { open , data , detailType , dataSource , columns , spinning } =
this . state ;
const {
rootId ,
open ,
data ,
detailType ,
dataSource ,
columns ,
spinning ,
showJob ,
} = this . state ;
let arr = [ ] ;
if ( detailType == 'chart' ) {
arr . push ( { label : '导出图片' , key : '1' } ) ;
@ -329,6 +348,23 @@ export default class DrawerComponents extends React.Component {
} }
extra = {
< Space >
< Checkbox
style = { { marginTop : '5px' , marginLeft : 100 } }
checked = { showJob }
onChange = { ( e ) => {
this . setState ( {
showJob : e . target . checked ,
} ) ;
detailType == 'chart' &&
this . getDeatilDatas (
rootId ,
detailType ,
e . target . checked ? '1' : '0' ,
) ;
} }
>
是否显示岗位
< / Checkbox >
< Dropdown overlay = { menu } >
< Button type = "primary" > 导出 < / Button >
< / Dropdown >