Merge pull request '组织架构图多语言设置' (#10) from feature/cl into master
Reviewed-on: http://221.226.25.34:3000/liang.cheng/org-chart-frant/pulls/10
This commit is contained in:
commit
68402ffb6e
|
|
@ -10,103 +10,106 @@ import * as d3 from 'd3';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
import { HomeOutlined } from '@ant-design/icons';
|
import { HomeOutlined } from '@ant-design/icons';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
import { getLabel } from '../../util/i18n.js';
|
||||||
|
|
||||||
const layout = {
|
const layout = {
|
||||||
labelCol: { span: 8 },
|
labelCol: { span: 8 },
|
||||||
wrapperCol: { span: 14 },
|
wrapperCol: { span: 14 },
|
||||||
};
|
};
|
||||||
|
|
||||||
const CopyDialog = forwardRef(({ open, onCreate, onCancel }, ref) => {
|
const CopyDialog = forwardRef(
|
||||||
const [treeData, setData] = useState([]);
|
({ open, onCreate, onCancel, labelData }, ref) => {
|
||||||
const [form] = Form.useForm();
|
const [treeData, setData] = useState([]);
|
||||||
const formRef = useRef(null);
|
const [form] = Form.useForm();
|
||||||
|
const formRef = useRef(null);
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
getTreeData() {
|
getTreeData() {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
d3.json('/api/bs/hrmorganization/orgchart/getSubCompanyTree').then(
|
d3.json('/api/bs/hrmorganization/orgchart/getSubCompanyTree').then(
|
||||||
(data) => {
|
(data) => {
|
||||||
data.companyTree.map((item, index) => {
|
data.companyTree.map((item, index) => {
|
||||||
item.icon = <HomeOutlined />;
|
item.icon = <HomeOutlined />;
|
||||||
|
});
|
||||||
|
setData(data.companyTree);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根节点树异步加载
|
||||||
|
* @param {} parentId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const onRootLoadData = (treeNode) =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
const { id } = treeNode.props;
|
||||||
|
setTimeout(() => {
|
||||||
|
d3.json(
|
||||||
|
`/api/bs/hrmorganization/orgchart/getSubCompanyTree?subcompany=${id}`,
|
||||||
|
).then((data) => {
|
||||||
|
data.companyTree.map((item, index) => {
|
||||||
|
item.icon = <HomeOutlined />;
|
||||||
|
});
|
||||||
|
let arr = [...treeData, ...data.companyTree];
|
||||||
|
setData(arr);
|
||||||
});
|
});
|
||||||
setData(data.companyTree);
|
resolve(undefined);
|
||||||
},
|
}, 200);
|
||||||
);
|
});
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
/**
|
return (
|
||||||
* 根节点树异步加载
|
<Modal
|
||||||
* @param {} parentId
|
open={open}
|
||||||
* @returns
|
title={getLabel(547505, labelData)}
|
||||||
*/
|
okText={getLabel(547319, labelData)}
|
||||||
const onRootLoadData = (treeNode) =>
|
cancelText={getLabel(547318, labelData)}
|
||||||
new Promise((resolve) => {
|
onCancel={onCancel}
|
||||||
const { id } = treeNode.props;
|
onOk={() => {
|
||||||
setTimeout(() => {
|
form
|
||||||
d3.json(
|
.validateFields()
|
||||||
`/api/bs/hrmorganization/orgchart/getSubCompanyTree?subcompany=${id}`,
|
.then((values) => {
|
||||||
).then((data) => {
|
onCreate(values);
|
||||||
data.companyTree.map((item, index) => {
|
})
|
||||||
item.icon = <HomeOutlined />;
|
.catch((info) => {
|
||||||
});
|
console.log('Validate Failed:', info);
|
||||||
let arr = [...treeData, ...data.companyTree];
|
});
|
||||||
setData(arr);
|
}}
|
||||||
});
|
>
|
||||||
resolve(undefined);
|
<Form ref={formRef} {...layout} form={form} name="form_in_modal">
|
||||||
}, 200);
|
<Form.Item
|
||||||
});
|
name="company"
|
||||||
|
label={getLabel(547506, labelData)}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: `${getLabel(547507, labelData)}`,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<TreeSelect
|
||||||
|
className="custom-tree-select"
|
||||||
|
treeDataSimpleMode
|
||||||
|
allowClear
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||||
|
loadData={onRootLoadData}
|
||||||
|
treeData={treeData}
|
||||||
|
treeIcon
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
return (
|
<Form.Item
|
||||||
<Modal
|
name="copySubDept"
|
||||||
open={open}
|
valuePropName="checked"
|
||||||
title="部门复制"
|
label={getLabel(547262, labelData)}
|
||||||
okText="确认"
|
>
|
||||||
cancelText="取消"
|
<Checkbox />
|
||||||
onCancel={onCancel}
|
</Form.Item>
|
||||||
onOk={() => {
|
</Form>
|
||||||
form
|
</Modal>
|
||||||
.validateFields()
|
);
|
||||||
.then((values) => {
|
},
|
||||||
onCreate(values);
|
);
|
||||||
})
|
|
||||||
.catch((info) => {
|
|
||||||
console.log('Validate Failed:', info);
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Form ref={formRef} {...layout} form={form} name="form_in_modal">
|
|
||||||
<Form.Item
|
|
||||||
name="company"
|
|
||||||
label="复制到分部"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '【复制到分部】为必填项!',
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<TreeSelect
|
|
||||||
className="custom-tree-select"
|
|
||||||
treeDataSimpleMode
|
|
||||||
allowClear
|
|
||||||
style={{ width: '100%' }}
|
|
||||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
||||||
loadData={onRootLoadData}
|
|
||||||
treeData={treeData}
|
|
||||||
treeIcon
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
|
||||||
name="copySubDept"
|
|
||||||
valuePropName="checked"
|
|
||||||
label="是否复制子部门信息"
|
|
||||||
>
|
|
||||||
<Checkbox />
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
export default CopyDialog;
|
export default CopyDialog;
|
||||||
|
|
|
||||||
|
|
@ -10,114 +10,117 @@ import * as d3 from 'd3';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
import { HomeOutlined, FolderOutlined } from '@ant-design/icons';
|
import { HomeOutlined, FolderOutlined } from '@ant-design/icons';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
import { getLabel } from '../../util/i18n.js';
|
||||||
|
|
||||||
const layout = {
|
const layout = {
|
||||||
labelCol: { span: 6 },
|
labelCol: { span: 6 },
|
||||||
wrapperCol: { span: 14 },
|
wrapperCol: { span: 14 },
|
||||||
};
|
};
|
||||||
|
|
||||||
const MergeDialog = forwardRef(({ open, onCreate, onCancel }, ref) => {
|
const MergeDialog = forwardRef(
|
||||||
const [treeData, setData] = useState([]);
|
({ open, onCreate, onCancel, labelData }, ref) => {
|
||||||
const [form] = Form.useForm();
|
const [treeData, setData] = useState([]);
|
||||||
const formRef = useRef(null);
|
const [form] = Form.useForm();
|
||||||
|
const formRef = useRef(null);
|
||||||
|
|
||||||
const [treeLine, setTreeLine] = useState(true);
|
const [treeLine, setTreeLine] = useState(true);
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
getTreeData() {
|
getTreeData() {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
d3.json('/api/bs/hrmorganization/orgchart/getDepartmentTree').then(
|
d3.json('/api/bs/hrmorganization/orgchart/getDepartmentTree').then(
|
||||||
(data) => {
|
(data) => {
|
||||||
data.departmentTree.map((item, index) => {
|
data.departmentTree.map((item, index) => {
|
||||||
item.icon = <HomeOutlined />;
|
|
||||||
});
|
|
||||||
setData(data.departmentTree);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根节点树异步加载
|
|
||||||
* @param {} parentId
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const onRootLoadData = (treeNode) =>
|
|
||||||
new Promise((resolve) => {
|
|
||||||
const { id } = treeNode.props;
|
|
||||||
setTimeout(() => {
|
|
||||||
d3.json(
|
|
||||||
`/api/bs/hrmorganization/orgchart/getDepartmentTree?subcompany=${id}`,
|
|
||||||
).then((data) => {
|
|
||||||
data.departmentTree.map((item, index) => {
|
|
||||||
if (item.key.indexOf('d') > -1) {
|
|
||||||
item.icon = <FolderOutlined />;
|
|
||||||
} else {
|
|
||||||
item.icon = <HomeOutlined />;
|
item.icon = <HomeOutlined />;
|
||||||
}
|
});
|
||||||
});
|
setData(data.departmentTree);
|
||||||
let arr = [...treeData, ...data.departmentTree];
|
},
|
||||||
setData(arr);
|
);
|
||||||
});
|
},
|
||||||
resolve(undefined);
|
}));
|
||||||
}, 200);
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
/**
|
||||||
<Modal
|
* 根节点树异步加载
|
||||||
open={open}
|
* @param {} parentId
|
||||||
title="部门合并"
|
* @returns
|
||||||
okText="确认"
|
*/
|
||||||
cancelText="取消"
|
const onRootLoadData = (treeNode) =>
|
||||||
onCancel={onCancel}
|
new Promise((resolve) => {
|
||||||
onOk={() => {
|
const { id } = treeNode.props;
|
||||||
form
|
setTimeout(() => {
|
||||||
.validateFields()
|
d3.json(
|
||||||
.then((values) => {
|
`/api/bs/hrmorganization/orgchart/getDepartmentTree?subcompany=${id}`,
|
||||||
onCreate(values);
|
).then((data) => {
|
||||||
})
|
data.departmentTree.map((item, index) => {
|
||||||
.catch((info) => {
|
if (item.key.indexOf('d') > -1) {
|
||||||
console.log('Validate Failed:', info);
|
item.icon = <FolderOutlined />;
|
||||||
|
} else {
|
||||||
|
item.icon = <HomeOutlined />;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let arr = [...treeData, ...data.departmentTree];
|
||||||
|
setData(arr);
|
||||||
});
|
});
|
||||||
}}
|
resolve(undefined);
|
||||||
>
|
}, 200);
|
||||||
<Form ref={formRef} {...layout} form={form} name="form_in_modal">
|
});
|
||||||
<Form.Item
|
|
||||||
name="department"
|
|
||||||
label="合并到部门"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '【合并到部门】为必填项!',
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<TreeSelect
|
|
||||||
className="custom-tree-select"
|
|
||||||
treeDataSimpleMode
|
|
||||||
allowClear
|
|
||||||
style={{ width: '100%' }}
|
|
||||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
||||||
loadData={onRootLoadData}
|
|
||||||
treeData={treeData}
|
|
||||||
treeIcon
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
return (
|
||||||
name="mergeName"
|
<Modal
|
||||||
label="合并后名称"
|
open={open}
|
||||||
rules={[
|
title={getLabel(547508, labelData)}
|
||||||
{
|
okText={getLabel(547319, labelData)}
|
||||||
required: true,
|
cancelText={getLabel(547318, labelData)}
|
||||||
message: '【合并后的名称】为必填项!',
|
onCancel={onCancel}
|
||||||
},
|
onOk={() => {
|
||||||
]}
|
form
|
||||||
>
|
.validateFields()
|
||||||
<Input />
|
.then((values) => {
|
||||||
</Form.Item>
|
onCreate(values);
|
||||||
</Form>
|
})
|
||||||
</Modal>
|
.catch((info) => {
|
||||||
);
|
console.log('Validate Failed:', info);
|
||||||
});
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Form ref={formRef} {...layout} form={form} name="form_in_modal">
|
||||||
|
<Form.Item
|
||||||
|
name="department"
|
||||||
|
label={getLabel(547264, labelData)}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: `${getLabel(547509, labelData)}`,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<TreeSelect
|
||||||
|
className="custom-tree-select"
|
||||||
|
treeDataSimpleMode
|
||||||
|
allowClear
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||||
|
loadData={onRootLoadData}
|
||||||
|
treeData={treeData}
|
||||||
|
treeIcon
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="mergeName"
|
||||||
|
label={getLabel(547265, labelData)}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: `${getLabel(547510, labelData)}`,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
export default MergeDialog;
|
export default MergeDialog;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import { message } from 'antd';
|
||||||
import jsPDF from 'jspdf';
|
import jsPDF from 'jspdf';
|
||||||
import ExportJsonExcel from 'js-export-excel';
|
import ExportJsonExcel from 'js-export-excel';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
import { getLabel } from '../../util/i18n.js';
|
||||||
|
|
||||||
let addNodeChildFunc = null;
|
let addNodeChildFunc = null;
|
||||||
let orgChart = null;
|
let orgChart = null;
|
||||||
|
|
@ -175,6 +176,7 @@ export default class DrawerComponents extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleExport = (e) => {
|
handleExport = (e) => {
|
||||||
|
const { labelData } = this.props;
|
||||||
let type = e.key == '1' ? 'png' : e.key == '1' ? 'pdf' : 'excel';
|
let type = e.key == '1' ? 'png' : e.key == '1' ? 'pdf' : 'excel';
|
||||||
if (type == 'png') {
|
if (type == 'png') {
|
||||||
orgChart && orgChart.exportImg({ full: true });
|
orgChart && orgChart.exportImg({ full: true });
|
||||||
|
|
@ -201,30 +203,30 @@ export default class DrawerComponents extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
option.fileName = '组织信息';
|
option.fileName = `${getLabel(547468, labelData)}`;
|
||||||
option.datas = [
|
option.datas = [
|
||||||
{
|
{
|
||||||
sheetData: dataTable,
|
sheetData: dataTable,
|
||||||
sheetName: 'sheet',
|
sheetName: 'sheet',
|
||||||
sheetFilter: [
|
sheetFilter: [
|
||||||
'序号',
|
`${getLabel(547327, labelData)}`,
|
||||||
'工号',
|
`${getLabel(547328, labelData)}`,
|
||||||
'姓名',
|
`${getLabel(547329, labelData)}`,
|
||||||
'性别',
|
`${getLabel(547330, labelData)}`,
|
||||||
'部门',
|
`${getLabel(547331, labelData)}`,
|
||||||
'分部',
|
`${getLabel(547332, labelData)}`,
|
||||||
'岗位',
|
`${getLabel(547333, labelData)}`,
|
||||||
'手机号',
|
`${getLabel(547334, labelData)}`,
|
||||||
],
|
],
|
||||||
sheetHeader: [
|
sheetHeader: [
|
||||||
'序号',
|
`${getLabel(547327, labelData)}`,
|
||||||
'工号',
|
`${getLabel(547328, labelData)}`,
|
||||||
'姓名',
|
`${getLabel(547329, labelData)}`,
|
||||||
'性别',
|
`${getLabel(547330, labelData)}`,
|
||||||
'部门',
|
`${getLabel(547331, labelData)}`,
|
||||||
'分部',
|
`${getLabel(547332, labelData)}`,
|
||||||
'岗位',
|
`${getLabel(547333, labelData)}`,
|
||||||
'手机号',
|
`${getLabel(547334, labelData)}`,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
@ -237,6 +239,8 @@ export default class DrawerComponents extends React.Component {
|
||||||
* 节点渲染
|
* 节点渲染
|
||||||
*/
|
*/
|
||||||
nodeContentRender = (d, i, arr, state) => {
|
nodeContentRender = (d, i, arr, state) => {
|
||||||
|
const { labelData } = this.props;
|
||||||
|
|
||||||
if (d.data.ftype == 2) {
|
if (d.data.ftype == 2) {
|
||||||
return `<div style="position: relative;">
|
return `<div style="position: relative;">
|
||||||
<div style=" height: 152px;background-size: 100% 100%;box-sizing: border-box;padding-top: 30px;position:relative;z-index:2">
|
<div style=" height: 152px;background-size: 100% 100%;box-sizing: border-box;padding-top: 30px;position:relative;z-index:2">
|
||||||
|
|
@ -254,11 +258,13 @@ export default class DrawerComponents extends React.Component {
|
||||||
${d.data.fname}
|
${d.data.fname}
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 13px;font-family: Microsoft YaHei-Bold, Microsoft YaHei;color: #333333;height: 25px;line-height: 25px;">
|
<div style="font-size: 13px;font-family: Microsoft YaHei-Bold, Microsoft YaHei;color: #333333;height: 25px;line-height: 25px;">
|
||||||
负责人:${d.data.fleader}
|
${getLabel(547322, labelData)}:${d.data.fleader}
|
||||||
</div>
|
</div>
|
||||||
<div style="display:flex" >
|
<div style="display:flex" >
|
||||||
<div style="height: 25px; line-height: 25px; min-width: 80px;">
|
<div style="height: 25px; line-height: 25px; min-width: 80px;">
|
||||||
在岗: ${d.data.fonjob} 人
|
${getLabel(547323, labelData)}: ${
|
||||||
|
d.data.fonjob
|
||||||
|
} ${getLabel(547525, labelData)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -273,9 +279,13 @@ export default class DrawerComponents extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
<img src="./img/user-card/jobicon-orange.png" style="margin-left: 20px; vertical-align: top;"/>
|
<img src="./img/user-card/jobicon-orange.png" style="margin-left: 20px; vertical-align: top;"/>
|
||||||
<div style="display: inline-block; margin-left: 15px;">
|
<div style="display: inline-block; margin-left: 15px;">
|
||||||
<div style="font-size: 15px;height: 25px;line-height: 25px;font-family: Microsoft YaHei-Bold, Microsoft YaHei;font-weight: bold;color: #333333;">${d.data.fname}</div>
|
<div style="font-size: 15px;height: 25px;line-height: 25px;font-family: Microsoft YaHei-Bold, Microsoft YaHei;font-weight: bold;color: #333333;">${
|
||||||
|
d.data.fname
|
||||||
|
}</div>
|
||||||
<div style="font-size: 13px;font-family: Microsoft YaHei-Regular, Microsoft YaHei;font-weight: 400;color: #333333;display: flex;height: 25px;line-height: 25px;">
|
<div style="font-size: 13px;font-family: Microsoft YaHei-Regular, Microsoft YaHei;font-weight: 400;color: #333333;display: flex;height: 25px;line-height: 25px;">
|
||||||
<span>在岗: ${d.data.fonjob} 人</span>
|
<span>${getLabel(547323, labelData)}: ${
|
||||||
|
d.data.fonjob
|
||||||
|
} ${getLabel(547525, labelData)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -295,13 +305,15 @@ export default class DrawerComponents extends React.Component {
|
||||||
}" style="width: 58px; height: 58px; border-radius: 50%; margin-top: 16px;margin-left: -6px;z-index:999" />
|
}" style="width: 58px; height: 58px; border-radius: 50%; margin-top: 16px;margin-left: -6px;z-index:999" />
|
||||||
</div>
|
</div>
|
||||||
<div style="display: inline-block; margin-left: 6px;width: 55%;height:100%">
|
<div style="display: inline-block; margin-left: 6px;width: 55%;height:100%">
|
||||||
<div style='display:flex;align-items:center;height: 25px;line-height: 25px;margin-top:15px'>
|
<div style='display:flex;align-items:center;height: 25px;line-height: 25px;margin-top:2px'>
|
||||||
<div style="font-weight: bold;font-size: 15px;ont-family: Microsoft YaHei-Bold, Microsoft YaHei;color: #333333;">${
|
<div style="font-weight: bold;font-size: 15px;ont-family: Microsoft YaHei-Bold, Microsoft YaHei;color: #333333;">${
|
||||||
d.data.fname
|
d.data.fname
|
||||||
}</div>
|
}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 13px;font-family: Microsoft YaHei-Regular, Microsoft YaHei;font-weight: 400;color: #333333;display: flex;height: 25px;line-height: 25px;">
|
<div style="font-size: 13px;font-family: Microsoft YaHei-Regular, Microsoft YaHei;font-weight: 400;color: #333333;display: flex;height: 25px;line-height: 25px;">
|
||||||
<span>司龄: ${d.data.companyWorkYear} 年</span>
|
<span>${getLabel(547324, labelData)}: ${
|
||||||
|
d.data.companyWorkYear
|
||||||
|
} ${getLabel(547526, labelData)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -340,8 +352,11 @@ export default class DrawerComponents extends React.Component {
|
||||||
showJob,
|
showJob,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
let arr = [];
|
let arr = [];
|
||||||
|
|
||||||
|
const { labelData } = this.props;
|
||||||
|
|
||||||
if (detailType == 'chart') {
|
if (detailType == 'chart') {
|
||||||
arr.push({ label: '导出图片', key: '1' });
|
arr.push({ label: `${getLabel(547315, labelData)}`, key: '1' });
|
||||||
//arr.push({ label: '导出PDF', key: '2' });
|
//arr.push({ label: '导出PDF', key: '2' });
|
||||||
} else {
|
} else {
|
||||||
arr.push({ label: '导出表格', key: '3' });
|
arr.push({ label: '导出表格', key: '3' });
|
||||||
|
|
@ -351,7 +366,7 @@ export default class DrawerComponents extends React.Component {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
title="详细信息"
|
title={getLabel(547321, labelData)}
|
||||||
width={1100}
|
width={1100}
|
||||||
onClose={this.onClose}
|
onClose={this.onClose}
|
||||||
open={open}
|
open={open}
|
||||||
|
|
@ -376,14 +391,14 @@ export default class DrawerComponents extends React.Component {
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
是否显示岗位
|
{getLabel(547447, labelData)}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
)}
|
)}
|
||||||
<Dropdown overlay={menu}>
|
<Dropdown overlay={menu}>
|
||||||
<Button type="primary">导出</Button>
|
<Button type="primary">{getLabel(547314, labelData)}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<Button type="primary" onClick={this.changeDetail}>
|
<Button type="primary" onClick={this.changeDetail}>
|
||||||
切换
|
{getLabel(547326, labelData)}
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
|
|
@ -393,7 +408,7 @@ export default class DrawerComponents extends React.Component {
|
||||||
<Spin
|
<Spin
|
||||||
size="large"
|
size="large"
|
||||||
spinning={spinning}
|
spinning={spinning}
|
||||||
tip="正在读取数据...."
|
tip={getLabel(547320, labelData)}
|
||||||
className="loading-center"
|
className="loading-center"
|
||||||
/>
|
/>
|
||||||
{data.length > 0 && (
|
{data.length > 0 && (
|
||||||
|
|
@ -418,13 +433,11 @@ export default class DrawerComponents extends React.Component {
|
||||||
scroll={{ y: 600 }}
|
scroll={{ y: 600 }}
|
||||||
loading={spinning}
|
loading={spinning}
|
||||||
pagination={{
|
pagination={{
|
||||||
locale: {
|
showSizeChanger: false,
|
||||||
// 翻页文本替换
|
showTotal: (total) =>
|
||||||
items_per_page: '条/页',
|
`${getLabel(547523, labelData)} ${
|
||||||
jump_to: '跳至',
|
dataSource.length
|
||||||
page: '页',
|
} ${getLabel(547524, labelData)}`,
|
||||||
},
|
|
||||||
showTotal: (total) => `共 ${dataSource.length} 条`,
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import {
|
||||||
Modal,
|
Modal,
|
||||||
Input,
|
Input,
|
||||||
message,
|
message,
|
||||||
|
notification,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
|
|
@ -23,6 +24,8 @@ import 'moment/locale/zh-cn';
|
||||||
import locale from 'antd/lib/date-picker/locale/zh_CN';
|
import locale from 'antd/lib/date-picker/locale/zh_CN';
|
||||||
import { HomeOutlined } from '@ant-design/icons';
|
import { HomeOutlined } from '@ant-design/icons';
|
||||||
moment.locale('zh-cn');
|
moment.locale('zh-cn');
|
||||||
|
import { getLabel } from '../../util/i18n.js';
|
||||||
|
import { SmileOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
export class TopBar extends React.Component {
|
export class TopBar extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|
@ -63,8 +66,9 @@ export class TopBar extends React.Component {
|
||||||
*/
|
*/
|
||||||
handleOk = () => {
|
handleOk = () => {
|
||||||
const { description, requestData } = this.state;
|
const { description, requestData } = this.state;
|
||||||
|
const { labelData } = this.props;
|
||||||
if (description.length == 0) {
|
if (description.length == 0) {
|
||||||
return message.error('请填写描述信息');
|
return message.error(`${getLabel(547512, labelData)}`);
|
||||||
}
|
}
|
||||||
this.setState({ confirmLoading: true });
|
this.setState({ confirmLoading: true });
|
||||||
let api =
|
let api =
|
||||||
|
|
@ -80,9 +84,9 @@ export class TopBar extends React.Component {
|
||||||
open: false,
|
open: false,
|
||||||
confirmLoading: false,
|
confirmLoading: false,
|
||||||
});
|
});
|
||||||
message.success('版本记录成功,请重新刷新页面', 2, 3);
|
message.success(`${getLabel(547513, labelData)}`, 2, 3);
|
||||||
} else {
|
} else {
|
||||||
message.error('版本记录失败,请联系相关人员处理数据', 2, 3);
|
message.error(`${getLabel(547514, labelData)}`, 2, 3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -175,7 +179,7 @@ export class TopBar extends React.Component {
|
||||||
onClick={this.handleExportMenuClick.bind(this)}
|
onClick={this.handleExportMenuClick.bind(this)}
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
label: '导出图片',
|
label: `${getLabel(547315, this.props.labelData)}`,
|
||||||
key: '1',
|
key: '1',
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
|
|
@ -187,14 +191,14 @@ export class TopBar extends React.Component {
|
||||||
);
|
);
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { disabled, type } = this.props;
|
const { disabled, type, labelData } = this.props;
|
||||||
const { rootTreeData, open, confirmLoading, treeExpandedKeys } = this.state;
|
const { rootTreeData, open, confirmLoading, treeExpandedKeys } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.topbarWrapper}>
|
<div className={style.topbarWrapper}>
|
||||||
<Row>
|
<Row>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
维度:
|
{getLabel(547293, labelData)}:
|
||||||
<Select
|
<Select
|
||||||
defaultValue="0"
|
defaultValue="0"
|
||||||
style={{ width: 140 }}
|
style={{ width: 140 }}
|
||||||
|
|
@ -226,14 +230,14 @@ export class TopBar extends React.Component {
|
||||||
</Select>
|
</Select>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
根节点:
|
{getLabel(547294, labelData)}:
|
||||||
<TreeSelect
|
<TreeSelect
|
||||||
treeDataSimpleMode
|
treeDataSimpleMode
|
||||||
allowClear
|
allowClear
|
||||||
style={{ width: '75%' }}
|
style={{ width: '65%' }}
|
||||||
value={this.state.requestData.root}
|
value={this.state.requestData.root}
|
||||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||||
placeholder="请选择根节点"
|
placeholder={getLabel(547298, labelData)}
|
||||||
onChange={this.onRootChange}
|
onChange={this.onRootChange}
|
||||||
loadData={this.onRootLoadData}
|
loadData={this.onRootLoadData}
|
||||||
treeData={rootTreeData}
|
treeData={rootTreeData}
|
||||||
|
|
@ -250,10 +254,10 @@ export class TopBar extends React.Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
隐藏部门
|
{getLabel(547296, labelData)}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title="提示:开启后将只显示分部组织架构!!!"
|
title={getLabel(547303, labelData)}
|
||||||
color="#0082fb"
|
color="#0082fb"
|
||||||
placement="rightTop"
|
placement="rightTop"
|
||||||
>
|
>
|
||||||
|
|
@ -263,17 +267,17 @@ export class TopBar extends React.Component {
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
部门层级:
|
{getLabel(547299, labelData)}:
|
||||||
<Select
|
<Select
|
||||||
defaultValue="3"
|
defaultValue="3"
|
||||||
style={{ width: 140 }}
|
style={{ width: 140 }}
|
||||||
value={this.state.requestData.level}
|
value={this.state.requestData.level}
|
||||||
onChange={(value) => this.handleFormChange({ level: value })}
|
onChange={(value) => this.handleFormChange({ level: value })}
|
||||||
>
|
>
|
||||||
<Option value="1">全部</Option>
|
<Option value="1">{getLabel(547301, labelData)}</Option>
|
||||||
<Option value="2">一级</Option>
|
<Option value="2">{getLabel(547463, labelData)}</Option>
|
||||||
<Option value="3">二级</Option>
|
<Option value="3">{getLabel(547464, labelData)}</Option>
|
||||||
<Option value="4">三级</Option>
|
<Option value="4">{getLabel(547465, labelData)}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
@ -288,10 +292,10 @@ export class TopBar extends React.Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
显示虚拟组织
|
{getLabel(547302, labelData)}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title="提示:若启用虚拟组织,需要在分部自定义表增加字段(名称 fblx) 字段类型 下拉框(0实体 1虚拟) 部门自定义表同上(字段名称 bmlx)。"
|
title={getLabel(547304, labelData)}
|
||||||
color="#0082fb"
|
color="#0082fb"
|
||||||
placement="rightTop"
|
placement="rightTop"
|
||||||
>
|
>
|
||||||
|
|
@ -309,7 +313,7 @@ export class TopBar extends React.Component {
|
||||||
this.setState({ open: true });
|
this.setState({ open: true });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
版本记录
|
{getLabel(547305, labelData)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
@ -319,7 +323,7 @@ export class TopBar extends React.Component {
|
||||||
this.props.onSearch(this.state.requestData);
|
this.props.onSearch(this.state.requestData);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
查询
|
{getLabel(547307, labelData)}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -328,7 +332,7 @@ export class TopBar extends React.Component {
|
||||||
window.open('#/dragtree', 'blank');
|
window.open('#/dragtree', 'blank');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
组织调整
|
{getLabel(547310, labelData)}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -337,29 +341,27 @@ export class TopBar extends React.Component {
|
||||||
window.open('#/statistics', 'blank');
|
window.open('#/statistics', 'blank');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
人数统计
|
{getLabel(547313, labelData)}
|
||||||
</Button>
|
</Button>
|
||||||
<Dropdown overlay={this.menu}>
|
<Dropdown overlay={this.menu}>
|
||||||
<Button type="primary">导出</Button>
|
<Button type="primary">{getLabel(547314, labelData)}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Modal
|
<Modal
|
||||||
title="版本记录"
|
title={getLabel(547305, labelData)}
|
||||||
cancelText="取消"
|
cancelText={getLabel(547318, labelData)}
|
||||||
okText="确定"
|
okText={getLabel(547319, labelData)}
|
||||||
open={open}
|
open={open}
|
||||||
onOk={this.handleOk}
|
onOk={this.handleOk}
|
||||||
confirmLoading={confirmLoading}
|
confirmLoading={confirmLoading}
|
||||||
onCancel={() => this.setState({ open: false })}
|
onCancel={() => this.setState({ open: false })}
|
||||||
>
|
>
|
||||||
<p style={{ color: 'red' }}>
|
<p style={{ color: 'red' }}>{getLabel(547316, labelData)}</p>
|
||||||
提示:版本记录耗时较长,请谨慎操作(仅记录当前维度的数据版本)
|
<p>{getLabel(547317, labelData)}:</p>
|
||||||
</p>
|
|
||||||
<p>主题:</p>
|
|
||||||
<TextArea
|
<TextArea
|
||||||
showCount
|
showCount
|
||||||
maxLength={10}
|
maxLength={20}
|
||||||
style={{ height: 120, resize: 'none' }}
|
style={{ height: 120, resize: 'none' }}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
placeholder="please enter"
|
placeholder="please enter"
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import moment from 'moment';
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
import { message, Spin, notification } from 'antd';
|
import { message, Spin, notification } from 'antd';
|
||||||
import { SmileOutlined } from '@ant-design/icons';
|
import { SmileOutlined } from '@ant-design/icons';
|
||||||
|
import { getLabel } from '../util/i18n.js';
|
||||||
|
|
||||||
let active = 'top';
|
let active = 'top';
|
||||||
let drawerCom = null;
|
let drawerCom = null;
|
||||||
|
|
@ -32,17 +33,13 @@ export default function companyPage() {
|
||||||
const [timelineId, setTimelineId] = useState(0);
|
const [timelineId, setTimelineId] = useState(0);
|
||||||
const infoRef = useRef();
|
const infoRef = useRef();
|
||||||
|
|
||||||
useEffect(() => {
|
const [labelData, setLabelData] = useState({});
|
||||||
notification.open({
|
const [lebelCompleted, setLabelCompleted] = useState(false);
|
||||||
message: '提示',
|
|
||||||
description:
|
|
||||||
'组织架构图中编制数和在编数显示初始化需参考文档配置定时任务并执行!!!(编制数默认取本年度最新编制信息,人数统计展示仅限于行政维度)',
|
|
||||||
icon: <SmileOutlined style={{ color: '#108ee9' }} />,
|
|
||||||
});
|
|
||||||
}, []);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
infoRef.current = timelineId;
|
infoRef.current = timelineId;
|
||||||
}, [timelineId]);
|
}, [timelineId]);
|
||||||
|
|
||||||
const [spinning, setSpinning] = useState(false);
|
const [spinning, setSpinning] = useState(false);
|
||||||
|
|
||||||
// 点击节点
|
// 点击节点
|
||||||
|
|
@ -106,15 +103,30 @@ export default function companyPage() {
|
||||||
return fisvitual == '0' ? `./img/back/level1.png` : `./img/back/level5.png`;
|
return fisvitual == '0' ? `./img/back/level1.png` : `./img/back/level5.png`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 多语言获取
|
||||||
|
useEffect(() => {
|
||||||
|
d3.json('/api/bs/hrmorganization/orgchart/i18n').then((res) => {
|
||||||
|
setLabelData(res.data);
|
||||||
|
setLabelCompleted(true);
|
||||||
|
notification.open({
|
||||||
|
message: `${getLabel(547283, res.data)}`,
|
||||||
|
description: `${getLabel(547292, res.data)}`,
|
||||||
|
icon: <SmileOutlined style={{ color: '#108ee9' }} />,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
d3.json(
|
if (lebelCompleted) {
|
||||||
'/api/bs/hrmorganization/orgchart/companyData?fclass=0&fisvitual=0&hidedept=0&root=0&level=2&id=0',
|
d3.json(
|
||||||
).then((data) => {
|
'/api/bs/hrmorganization/orgchart/companyData?fclass=0&fisvitual=0&hidedept=0&root=0&level=2&id=0',
|
||||||
setData(data.data);
|
).then((data) => {
|
||||||
setHasRight(data?.hasRight);
|
setData(data.data);
|
||||||
});
|
setHasRight(data?.hasRight);
|
||||||
}, [true]);
|
});
|
||||||
|
}
|
||||||
|
}, [lebelCompleted]);
|
||||||
|
|
||||||
// ButtonContent渲染
|
// ButtonContent渲染
|
||||||
const buttonContentRender = ({ node, state }) => {
|
const buttonContentRender = ({ node, state }) => {
|
||||||
|
|
@ -381,7 +393,7 @@ export default function companyPage() {
|
||||||
if (data.data) {
|
if (data.data) {
|
||||||
if (!data.data.length) {
|
if (!data.data.length) {
|
||||||
setData([{}]);
|
setData([{}]);
|
||||||
message.warning('暂无数据');
|
message.warning(`${getLabel(547516, labelData)}`);
|
||||||
} else {
|
} else {
|
||||||
setData(data?.data);
|
setData(data?.data);
|
||||||
}
|
}
|
||||||
|
|
@ -428,13 +440,14 @@ export default function companyPage() {
|
||||||
style={{ display: 'block', margin: '0 auto' }}
|
style={{ display: 'block', margin: '0 auto' }}
|
||||||
src="./img/permission.png"
|
src="./img/permission.png"
|
||||||
/>
|
/>
|
||||||
<p style={{ textAlign: 'center' }}>对不起,您暂时没有权限!</p>
|
<p style={{ textAlign: 'center' }}>{getLabel(547515, labelData)}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
hasRight && (
|
hasRight &&
|
||||||
|
Object.keys(labelData).length != 0 && (
|
||||||
<div className={styles.contentWrapper}>
|
<div className={styles.contentWrapper}>
|
||||||
<TopBar
|
<TopBar
|
||||||
ref={(r) => (topbar = r)}
|
ref={(r) => (topbar = r)}
|
||||||
|
|
@ -449,6 +462,7 @@ export default function companyPage() {
|
||||||
}}
|
}}
|
||||||
type="company"
|
type="company"
|
||||||
url="/api/bs/hrmorganization/orgchart/getCondition?fclass=0&type=company&id=0"
|
url="/api/bs/hrmorganization/orgchart/getCondition?fclass=0&type=company&id=0"
|
||||||
|
labelData={labelData}
|
||||||
/>
|
/>
|
||||||
<ToolBar
|
<ToolBar
|
||||||
onTopLayoutClick={(progressBtn) => handleTopLayoutClick(progressBtn)}
|
onTopLayoutClick={(progressBtn) => handleTopLayoutClick(progressBtn)}
|
||||||
|
|
@ -485,11 +499,12 @@ export default function companyPage() {
|
||||||
nodeContent={nodeContentRender}
|
nodeContent={nodeContentRender}
|
||||||
/>
|
/>
|
||||||
</Spin>
|
</Spin>
|
||||||
<DrawerComponents ref={(r) => (drawerCom = r)} />
|
<DrawerComponents ref={(r) => (drawerCom = r)} labelData={labelData} />
|
||||||
<OperateDialog
|
<OperateDialog
|
||||||
ref={(r) => (operateCom = r)}
|
ref={(r) => (operateCom = r)}
|
||||||
addFolderNode={addFolderNode}
|
addFolderNode={addFolderNode}
|
||||||
deleteNode={deleteNode}
|
deleteNode={deleteNode}
|
||||||
|
labelData={labelData}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import qs from 'qs';
|
||||||
import MergeDialog from '../components/dialog/mergeDialog';
|
import MergeDialog from '../components/dialog/mergeDialog';
|
||||||
import CopyDialog from '../components/dialog/copyDialog';
|
import CopyDialog from '../components/dialog/copyDialog';
|
||||||
import inset from '../../public/img/back/inset.png';
|
import inset from '../../public/img/back/inset.png';
|
||||||
|
import { getLabel } from '../util/i18n.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
HomeOutlined,
|
HomeOutlined,
|
||||||
|
|
@ -21,7 +22,7 @@ const DragTree = () => {
|
||||||
const [expandedKeys, setExpandedKeys] = useState([undefined]);
|
const [expandedKeys, setExpandedKeys] = useState([undefined]);
|
||||||
const childRef = useRef(null);
|
const childRef = useRef(null);
|
||||||
const copyChildRef = useRef(null);
|
const copyChildRef = useRef(null);
|
||||||
const [tip, setTip] = useState('正在加载,请稍候...');
|
const [tip, setTip] = useState('');
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [showCanceled, setShowCanceled] = useState(0);
|
const [showCanceled, setShowCanceled] = useState(0);
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
|
|
@ -31,8 +32,13 @@ const DragTree = () => {
|
||||||
const [mergeId, setMergeId] = useState(null);
|
const [mergeId, setMergeId] = useState(null);
|
||||||
const [copyopen, setCopyOpen] = useState(false);
|
const [copyopen, setCopyOpen] = useState(false);
|
||||||
const [copyId, setCopyId] = useState(null);
|
const [copyId, setCopyId] = useState(null);
|
||||||
|
const [labelData, setLabelData] = useState({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
d3.json('/api/bs/hrmorganization/orgchart/i18n').then((res) => {
|
||||||
|
setLabelData(res.data);
|
||||||
|
setTip(`${getLabel(547473, res.data)}`);
|
||||||
|
});
|
||||||
getMoveTree(0);
|
getMoveTree(0);
|
||||||
}, [true]);
|
}, [true]);
|
||||||
|
|
||||||
|
|
@ -72,19 +78,24 @@ const DragTree = () => {
|
||||||
info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
||||||
|
|
||||||
if (dropPosition == -1) {
|
if (dropPosition == -1) {
|
||||||
return message.error('不支持该操作!!!', 2);
|
return message.error(`${getLabel(547475, labelData)}`, 2);
|
||||||
}
|
}
|
||||||
let pos = dropPosition == 0 ? '内部' : '下方';
|
let pos =
|
||||||
|
dropPosition == 0
|
||||||
|
? `${getLabel(547476, labelData)}`
|
||||||
|
: `${getLabel(547477, labelData)}`;
|
||||||
|
|
||||||
let title = `确定将【${info.dragNode.title}】移到 【${info.node.title}】${pos}`;
|
let title = `${getLabel(547478, labelData)}【${
|
||||||
|
info.dragNode.title
|
||||||
|
} ${getLabel(547479, labelData)} 【${info.node.title}】${pos}`;
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '转移操作',
|
title: `${getLabel(547480, labelData)}`,
|
||||||
content: title,
|
content: title,
|
||||||
okText: '确认',
|
okText: `${getLabel(547319, labelData)}`,
|
||||||
cancelText: '取消',
|
cancelText: `${getLabel(547318, labelData)}`,
|
||||||
onOk() {
|
onOk() {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setTip('正在转移,请稍候...');
|
setTip(`${getLabel(547481, labelData)}`);
|
||||||
|
|
||||||
fetch('/api/bs/hrmorganization/dept/dragDepartment', {
|
fetch('/api/bs/hrmorganization/dept/dragDepartment', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
@ -142,14 +153,14 @@ const DragTree = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setGData(data);
|
setGData(data);
|
||||||
message.success('转移成功', 2);
|
message.success(`${getLabel(547482, labelData)}`, 2);
|
||||||
} else {
|
} else {
|
||||||
message.warning(res.msg, 2);
|
message.warning(res.msg, 2);
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
message.error('接口异常,请联系管理员');
|
message.error(`${getLabel(547483, labelData)}`);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onCancel() {},
|
onCancel() {},
|
||||||
|
|
@ -178,14 +189,14 @@ const DragTree = () => {
|
||||||
arr.splice(index, 1);
|
arr.splice(index, 1);
|
||||||
});
|
});
|
||||||
setGData(data);
|
setGData(data);
|
||||||
message.success('删除成功', 2);
|
message.success(`${getLabel(547484, labelData)}`, 2);
|
||||||
} else {
|
} else {
|
||||||
message.warning(res.data.message, 2);
|
message.warning(res.data.message, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
message.error('接口异常,请联系管理员');
|
message.error(`${getLabel(547483, labelData)}`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -211,7 +222,7 @@ const DragTree = () => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
const data = [...gData];
|
const data = [...gData];
|
||||||
if (nodeData.canceled != '0') {
|
if (nodeData.canceled != '0') {
|
||||||
message.success('恢复成功', 2);
|
message.success(`${getLabel(547485, labelData)}`, 2);
|
||||||
loop(data, nodeData.key, (item, index, arr) => {
|
loop(data, nodeData.key, (item, index, arr) => {
|
||||||
arr[index].canceled = '0';
|
arr[index].canceled = '0';
|
||||||
});
|
});
|
||||||
|
|
@ -219,7 +230,7 @@ const DragTree = () => {
|
||||||
loop(data, nodeData.key, (item, index, arr) => {
|
loop(data, nodeData.key, (item, index, arr) => {
|
||||||
arr.splice(index, 1);
|
arr.splice(index, 1);
|
||||||
});
|
});
|
||||||
message.success('封存成功', 2);
|
message.success(`${getLabel(547486, labelData)}`, 2);
|
||||||
}
|
}
|
||||||
setGData(data);
|
setGData(data);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -227,7 +238,7 @@ const DragTree = () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
message.error('接口异常,请联系管理员');
|
message.error(`${getLabel(547483, labelData)}`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -260,14 +271,14 @@ const DragTree = () => {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
getMoveTree(0, values.department);
|
getMoveTree(0, values.department);
|
||||||
message.success('合并成功', 2);
|
message.success(`${getLabel(547487, labelData)}`, 2);
|
||||||
} else {
|
} else {
|
||||||
message.warning(res.msg, 2);
|
message.warning(res.msg, 2);
|
||||||
}
|
}
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
message.error('接口异常,请联系管理员');
|
message.error(`${getLabel(547483, labelData)}`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -301,13 +312,13 @@ const DragTree = () => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
setCopyOpen(false);
|
setCopyOpen(false);
|
||||||
getMoveTree(0, values.company);
|
getMoveTree(0, values.company);
|
||||||
message.success('复制成功', 2);
|
message.success(`${getLabel(547488, labelData)}`, 2);
|
||||||
} else {
|
} else {
|
||||||
message.warning(res.msg, 2);
|
message.warning(res.msg, 2);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
message.error('接口异常,请联系管理员');
|
message.error(`${getLabel(547483, labelData)}`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -333,7 +344,7 @@ const DragTree = () => {
|
||||||
{nodeData.title}
|
{nodeData.title}
|
||||||
{nodeData.canceled == '1' ? (
|
{nodeData.canceled == '1' ? (
|
||||||
<span style={{ color: 'red', marginLeft: '5px' }}>
|
<span style={{ color: 'red', marginLeft: '5px' }}>
|
||||||
(已封存)
|
({getLabel(547489, labelData)})
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
''
|
''
|
||||||
|
|
@ -352,24 +363,28 @@ const DragTree = () => {
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
查看
|
{getLabel(547490, labelData)}
|
||||||
</span>
|
</span>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`确认要删除[${nodeData.title}] 吗?`}
|
title={`${getLabel(547491, labelData)}[${nodeData.title}]?`}
|
||||||
onConfirm={() => onDelete(nodeData)}
|
onConfirm={() => onDelete(nodeData)}
|
||||||
okText="确认"
|
okText={getLabel(547319, labelData)}
|
||||||
cancelText="取消"
|
cancelText={getLabel(547318, labelData)}
|
||||||
>
|
|
||||||
<span className="drag-button">删除</span>
|
|
||||||
</Popconfirm>
|
|
||||||
<Popconfirm
|
|
||||||
title={`确认要封存或恢复 [${nodeData.title}] 吗?`}
|
|
||||||
onConfirm={() => onCancel(nodeData)}
|
|
||||||
okText="确认"
|
|
||||||
cancelText="取消"
|
|
||||||
>
|
>
|
||||||
<span className="drag-button">
|
<span className="drag-button">
|
||||||
{nodeData.canceled == '0' ? '封存' : '恢复'}
|
{getLabel(547492, labelData)}
|
||||||
|
</span>
|
||||||
|
</Popconfirm>
|
||||||
|
<Popconfirm
|
||||||
|
title={`${getLabel(547493, labelData)} [${nodeData.title}]?`}
|
||||||
|
onConfirm={() => onCancel(nodeData)}
|
||||||
|
okText={getLabel(547319, labelData)}
|
||||||
|
cancelText={getLabel(547318, labelData)}
|
||||||
|
>
|
||||||
|
<span className="drag-button">
|
||||||
|
{nodeData.canceled == '0'
|
||||||
|
? `${getLabel(547494, labelData)}`
|
||||||
|
: `${getLabel(547495, labelData)}`}
|
||||||
</span>
|
</span>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
<span
|
<span
|
||||||
|
|
@ -377,14 +392,14 @@ const DragTree = () => {
|
||||||
className="drag-button"
|
className="drag-button"
|
||||||
onClick={() => onMerge(nodeData)}
|
onClick={() => onMerge(nodeData)}
|
||||||
>
|
>
|
||||||
合并
|
{getLabel(547194, labelData)}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
style={{ display: attr }}
|
style={{ display: attr }}
|
||||||
className="drag-button"
|
className="drag-button"
|
||||||
onClick={() => onCopy(nodeData)}
|
onClick={() => onCopy(nodeData)}
|
||||||
>
|
>
|
||||||
复制
|
{getLabel(547196, labelData)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
@ -398,82 +413,84 @@ const DragTree = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="drag-wrapper">
|
Object.keys(labelData).length != 0 && (
|
||||||
<Spin tip={tip} spinning={loading}>
|
<div className="drag-wrapper">
|
||||||
<div className="drag-layout">
|
<Spin tip={tip} spinning={loading}>
|
||||||
<div className="drag-header">
|
<div className="drag-layout">
|
||||||
<img src={inset} />
|
<div className="drag-header">
|
||||||
<div>组织快速调整</div>
|
<img src={inset} />
|
||||||
</div>
|
<div>{getLabel(547282, labelData)}</div>
|
||||||
<div className="drag-content">
|
</div>
|
||||||
<ApartmentOutlined
|
<div className="drag-content">
|
||||||
className="drag-showcanceled"
|
<ApartmentOutlined
|
||||||
style={{ color: showCanceled == 0 ? '#000' : '#1890ff' }}
|
className="drag-showcanceled"
|
||||||
onClick={() => {
|
style={{ color: showCanceled == 0 ? '#000' : '#1890ff' }}
|
||||||
const value = showCanceled == 0 ? 1 : 0;
|
onClick={() => {
|
||||||
setTip('正在加载,请稍候...');
|
const value = showCanceled == 0 ? 1 : 0;
|
||||||
setShowCanceled(value);
|
setTip(`${getLabel(547473, labelData)}`);
|
||||||
getMoveTree(value);
|
setShowCanceled(value);
|
||||||
}}
|
getMoveTree(value);
|
||||||
/>
|
}}
|
||||||
<Tree
|
/>
|
||||||
className="draggable-tree"
|
<Tree
|
||||||
//defaultExpandedKeys={expandedKeys}
|
className="draggable-tree"
|
||||||
expandedKeys={expandedKeys}
|
//defaultExpandedKeys={expandedKeys}
|
||||||
onExpand={onExpand}
|
expandedKeys={expandedKeys}
|
||||||
draggable
|
onExpand={onExpand}
|
||||||
icon={false}
|
draggable
|
||||||
blockNode
|
icon={false}
|
||||||
onDragEnter={onDragEnter}
|
blockNode
|
||||||
onDrop={onDrop}
|
onDragEnter={onDragEnter}
|
||||||
treeData={gData}
|
onDrop={onDrop}
|
||||||
titleRender={onTitleRender}
|
treeData={gData}
|
||||||
/>
|
titleRender={onTitleRender}
|
||||||
</div>
|
/>
|
||||||
<Drawer
|
</div>
|
||||||
width="60%"
|
<Drawer
|
||||||
placement="right"
|
width="60%"
|
||||||
closable={false}
|
placement="right"
|
||||||
onClose={() => setDrawerOpen(false)}
|
closable={false}
|
||||||
open={drawerOpen}
|
onClose={() => setDrawerOpen(false)}
|
||||||
>
|
open={drawerOpen}
|
||||||
<iframe src={iframe} width="100%" height="100%" />
|
>
|
||||||
</Drawer>
|
<iframe src={iframe} width="100%" height="100%" />
|
||||||
|
</Drawer>
|
||||||
|
|
||||||
<div className="drag-footer">
|
<div className="drag-footer">
|
||||||
<p>
|
<p>
|
||||||
<QuestionCircleOutlined />
|
<QuestionCircleOutlined />
|
||||||
小提示
|
{getLabel(547283, labelData)}
|
||||||
</p>
|
</p>
|
||||||
<div className="tips">
|
<div className="tips">
|
||||||
<div>1.鼠标拖拽Tree节点到任一分部部门下可快速完成组织转移;</div>
|
<div>1.{getLabel(547284, labelData)}</div>
|
||||||
<div>2.点击【查看】侧滑打开组织详细信息,可快速编辑;</div>
|
<div>2.{getLabel(547285, labelData)}</div>
|
||||||
<div>
|
<div>3.{getLabel(547286, labelData)}</div>
|
||||||
3.鼠标悬停树节点 一键开启【删除】【封存】【合并】【复制】等功能;
|
<div>4.{getLabel(547287, labelData)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>4.顶部小图标点击可显示已封存的组织架构。</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Spin>
|
||||||
</Spin>
|
|
||||||
|
|
||||||
<MergeDialog
|
<MergeDialog
|
||||||
ref={childRef}
|
ref={childRef}
|
||||||
open={open}
|
open={open}
|
||||||
onCreate={onMergeCreate}
|
onCreate={onMergeCreate}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}}
|
}}
|
||||||
/>
|
labelData={labelData}
|
||||||
<CopyDialog
|
/>
|
||||||
ref={copyChildRef}
|
<CopyDialog
|
||||||
open={copyopen}
|
ref={copyChildRef}
|
||||||
onCreate={onCopyCreate}
|
open={copyopen}
|
||||||
onCancel={() => {
|
onCreate={onCopyCreate}
|
||||||
setCopyOpen(false);
|
onCancel={() => {
|
||||||
}}
|
setCopyOpen(false);
|
||||||
/>
|
}}
|
||||||
</div>
|
labelData={labelData}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default DragTree;
|
export default DragTree;
|
||||||
|
|
|
||||||
|
|
@ -10,73 +10,82 @@ import React, { useEffect, useState, useRef } from 'react';
|
||||||
import * as d3 from 'd3';
|
import * as d3 from 'd3';
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
import { Table } from 'antd';
|
import { Table } from 'antd';
|
||||||
|
import { getLabel } from '../util/i18n.js';
|
||||||
|
|
||||||
const StatisticsTable = () => {
|
const StatisticsTable = () => {
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [dataSource, setDataSource] = useState([]);
|
const [dataSource, setDataSource] = useState([]);
|
||||||
const [columns, setColumns] = useState([]);
|
const [columns, setColumns] = useState([]);
|
||||||
|
const [labelData, setLabelData] = useState({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const columns = [
|
d3.json('/api/bs/hrmorganization/orgchart/i18n').then((res) => {
|
||||||
{
|
setLabelData(res.data);
|
||||||
title: '序号',
|
const columns = [
|
||||||
dataIndex: 'key',
|
{
|
||||||
key: 'key',
|
title: `${getLabel(547327, res.data)}`,
|
||||||
},
|
dataIndex: 'key',
|
||||||
{
|
key: 'key',
|
||||||
title: '名称',
|
|
||||||
dataIndex: 'dataIdName',
|
|
||||||
key: 'dataIdName',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '上级',
|
|
||||||
dataIndex: 'superIdName',
|
|
||||||
key: 'superIdName',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
key: 'type',
|
|
||||||
render(value, row, index) {
|
|
||||||
if (value == 1) {
|
|
||||||
return '分部';
|
|
||||||
} else {
|
|
||||||
return '部门';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
title: `${getLabel(547517, res.data)}`,
|
||||||
title: '在编数',
|
dataIndex: 'dataIdName',
|
||||||
dataIndex: 'onJobNum',
|
key: 'dataIdName',
|
||||||
key: 'onJobNum',
|
},
|
||||||
},
|
{
|
||||||
{
|
title: `${getLabel(547518, res.data)}`,
|
||||||
title: '编制数',
|
dataIndex: 'superIdName',
|
||||||
dataIndex: 'staffNum',
|
key: 'superIdName',
|
||||||
key: 'staffNum',
|
},
|
||||||
},
|
{
|
||||||
{
|
title: `${getLabel(547519, res.data)}`,
|
||||||
title: '创建人',
|
dataIndex: 'type',
|
||||||
dataIndex: 'creator',
|
key: 'type',
|
||||||
key: 'creator',
|
render(value, row, index) {
|
||||||
},
|
if (value == 1) {
|
||||||
{
|
return `${getLabel(547332, res.data)}`;
|
||||||
title: '创建时间',
|
} else {
|
||||||
dataIndex: 'createTime',
|
return `${getLabel(547331, res.data)}`;
|
||||||
key: 'createTime',
|
}
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
title: '更新时间',
|
{
|
||||||
dataIndex: 'updateTime',
|
title: `${getLabel(547346, res.data)}`,
|
||||||
key: 'updateTime',
|
dataIndex: 'onJobNum',
|
||||||
},
|
key: 'onJobNum',
|
||||||
];
|
},
|
||||||
setColumns(columns);
|
{
|
||||||
|
title: `${getLabel(547345, res.data)}`,
|
||||||
|
dataIndex: 'staffNum',
|
||||||
|
key: 'staffNum',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: `${getLabel(547520, res.data)}`,
|
||||||
|
dataIndex: 'creator',
|
||||||
|
key: 'creator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: `${getLabel(547521, res.data)}`,
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: `${getLabel(547522, res.data)}`,
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
key: 'updateTime',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
setColumns(columns);
|
||||||
|
selectData();
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const selectData = () => {
|
||||||
d3.json(`/api/bs/hrmorganization/orgchart/selectStatistics`).then((res) => {
|
d3.json(`/api/bs/hrmorganization/orgchart/selectStatistics`).then((res) => {
|
||||||
setDataSource(res.data.result);
|
setDataSource(res.data.result);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
});
|
});
|
||||||
}, [true]);
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -86,12 +95,11 @@ const StatisticsTable = () => {
|
||||||
columns={columns}
|
columns={columns}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
pagination={{
|
pagination={{
|
||||||
locale: {
|
showTotal: (total) =>
|
||||||
items_per_page: '条/页',
|
`${getLabel(547523, labelData)} ${dataSource.length} ${getLabel(
|
||||||
jump_to: '跳至',
|
547524,
|
||||||
page: '页',
|
labelData,
|
||||||
},
|
)}`,
|
||||||
showTotal: (total) => `共 ${dataSource.length} 条`,
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ export default function userPage() {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.cookie =
|
document.cookie =
|
||||||
'ecology_JSessionid=aaahTt6JHXEIM-HoSW-Xy; JSESSIONID=aaahTt6JHXEIM-HoSW-Xy; Systemlanguid=7; languageidweaver=7; loginuuids=2773; __randcode__=a8294fa0-56d7-430f-a35b-139d73474682; loginidweaver=zhangxy16';
|
'ecology_JSessionid=aaayUiSEKCD-Z-Y9A1i-y; JSESSIONID=aaayUiSEKCD-Z-Y9A1i-y; loginuuids=1; Systemlanguid=7; loginidweaver=sysadmin; languageidweaver=8; __randcode__=4ba2aadd-0de6-4ebc-b9d4-584ba46c0969';
|
||||||
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) => {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
let languageIdWeaver = document.cookie
|
||||||
|
.split('; ')
|
||||||
|
.find((row) => row.startsWith('languageidweaver='))
|
||||||
|
?.split('=')[1];
|
||||||
|
if (languageIdWeaver == undefined) {
|
||||||
|
languageIdWeaver = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getLabel = (key, labelData) => {
|
||||||
|
if (labelData[key]) {
|
||||||
|
return labelData[key].labelName;
|
||||||
|
} else {
|
||||||
|
return languageIdWeaver == 7 ? '标签不存在' : 'Label does not exist';
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue