|
@@ -29,6 +29,11 @@ function Department(props) {
|
|
const [current, setCurrent] = useState(null);
|
|
const [current, setCurrent] = useState(null);
|
|
const [currentDep, setCurrentDep] = useState(null);
|
|
const [currentDep, setCurrentDep] = useState(null);
|
|
const chartRef = useRef(null);
|
|
const chartRef = useRef(null);
|
|
|
|
+ const filterRef = useRef({ pageSize: 99999 });
|
|
|
|
+ //控制图表部门选择参数
|
|
|
|
+ const [loadedDepKey, setLoadedDepKey] = useState([]);
|
|
|
|
+ const [expandedDepKey, setExpandedDepKey] = useState([]);
|
|
|
|
+
|
|
const columns = [
|
|
const columns = [
|
|
{
|
|
{
|
|
title: '部门名称',
|
|
title: '部门名称',
|
|
@@ -88,12 +93,15 @@ function Department(props) {
|
|
// render: percent => (percent * 100).toFixed(2) + '%',
|
|
// render: percent => (percent * 100).toFixed(2) + '%',
|
|
// },
|
|
// },
|
|
];
|
|
];
|
|
- const filterRef = useRef({ pageSize: 99999 });
|
|
|
|
const handleSearch = () => {
|
|
const handleSearch = () => {
|
|
const { time } = form.getFieldsValue();
|
|
const { time } = form.getFieldsValue();
|
|
filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM') : null;
|
|
filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM') : null;
|
|
filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM') : null;
|
|
filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM') : null;
|
|
|
|
|
|
|
|
+ //重置图表部门选择
|
|
|
|
+ setLoadedDepKey([]);
|
|
|
|
+ setExpandedDepKey([]);
|
|
|
|
+
|
|
dispatch({
|
|
dispatch({
|
|
type: 'report/queryDepReport',
|
|
type: 'report/queryDepReport',
|
|
payload: {
|
|
payload: {
|
|
@@ -125,7 +133,12 @@ function Department(props) {
|
|
</Form>
|
|
</Form>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
- const onExpand = (expanded, record) => {
|
|
|
|
|
|
+
|
|
|
|
+ //控制图表部门选择展开/加载
|
|
|
|
+ const onExpandDep = keys => {
|
|
|
|
+ setExpandedDepKey(keys);
|
|
|
|
+ };
|
|
|
|
+ const onLoadDep = (expanded, record) => {
|
|
return new Promise(resolve => {
|
|
return new Promise(resolve => {
|
|
if (expanded && !record.isLoad) {
|
|
if (expanded && !record.isLoad) {
|
|
dispatch({
|
|
dispatch({
|
|
@@ -141,6 +154,7 @@ function Department(props) {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+
|
|
const showUserModal = item => {
|
|
const showUserModal = item => {
|
|
// const showDepCompare = item => {
|
|
// const showDepCompare = item => {
|
|
const { s_time, e_time } = filterRef.current;
|
|
const { s_time, e_time } = filterRef.current;
|
|
@@ -200,11 +214,11 @@ function Department(props) {
|
|
backgroundColor: 'transparent',
|
|
backgroundColor: 'transparent',
|
|
formatter: () => ' ',
|
|
formatter: () => ' ',
|
|
},
|
|
},
|
|
- itemStyle: { color: '#f7f7f7' },
|
|
|
|
|
|
+ itemStyle: { color: '#fff' },
|
|
emphasis: {
|
|
emphasis: {
|
|
label: { show: false },
|
|
label: { show: false },
|
|
labelLine: { show: false },
|
|
labelLine: { show: false },
|
|
- itemStyle: { color: '#f7f7f7' },
|
|
|
|
|
|
+ itemStyle: { color: '#fff' },
|
|
},
|
|
},
|
|
label: { show: false },
|
|
label: { show: false },
|
|
labelLine: { show: false },
|
|
labelLine: { show: false },
|
|
@@ -235,7 +249,10 @@ function Department(props) {
|
|
onSelect={(_, node) => {
|
|
onSelect={(_, node) => {
|
|
handleChangeCurrent(node);
|
|
handleChangeCurrent(node);
|
|
}}
|
|
}}
|
|
- loadData={node => onExpand(true, node)}
|
|
|
|
|
|
+ treeExpandedKeys={expandedDepKey}
|
|
|
|
+ onTreeExpand={keys => onExpandDep(keys)}
|
|
|
|
+ treeLoadedKeys={loadedDepKey}
|
|
|
|
+ loadData={node => onLoadDep(true, node)}
|
|
value={currentDep}
|
|
value={currentDep}
|
|
/>
|
|
/>
|
|
);
|
|
);
|
|
@@ -271,7 +288,7 @@ function Department(props) {
|
|
columns={columns}
|
|
columns={columns}
|
|
dataSource={dep.list}
|
|
dataSource={dep.list}
|
|
pagination={false}
|
|
pagination={false}
|
|
- onExpand={onExpand}
|
|
|
|
|
|
+ onExpand={onLoadDep}
|
|
/>
|
|
/>
|
|
<Affix offsetTop={20}>
|
|
<Affix offsetTop={20}>
|
|
<Card
|
|
<Card
|