|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useState, useEffect } from 'react'
|
|
|
|
|
|
|
+import React, { useState, useEffect, useRef } from 'react'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
import { connect, useModel } from 'umi'
|
|
import { connect, useModel } from 'umi'
|
|
|
import { Row, Col, Select, Card, Skeleton } from 'antd'
|
|
import { Row, Col, Select, Card, Skeleton } from 'antd'
|
|
@@ -12,9 +12,11 @@ import LeaderBoard from './components/LeaderBoard'
|
|
|
import { cyclicalOp } from './consts'
|
|
import { cyclicalOp } from './consts'
|
|
|
|
|
|
|
|
const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
|
|
+ const timer = useRef(null)
|
|
|
const { initialState: { permData } = { permData: {} } } = useModel('@@initialState')
|
|
const { initialState: { permData } = { permData: {} } } = useModel('@@initialState')
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
loading: true,
|
|
loading: true,
|
|
|
|
|
+ immediate: false,
|
|
|
visible: false,
|
|
visible: false,
|
|
|
reminderData: [],
|
|
reminderData: [],
|
|
|
leaderboard: [],
|
|
leaderboard: [],
|
|
@@ -24,7 +26,7 @@ const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
serviceLogChainRatio: {},
|
|
serviceLogChainRatio: {},
|
|
|
aggregation: {},
|
|
aggregation: {},
|
|
|
businessChar: {},
|
|
businessChar: {},
|
|
|
- params: { businessGroupId: null, dataPermission: 'oneself', cyclical: 'month' }
|
|
|
|
|
|
|
+ params: { businessGroupId: '', dataPermission: 'oneself', cyclical: 'month' }
|
|
|
})
|
|
})
|
|
|
const { toggleModal, setModalProps } = useModal()
|
|
const { toggleModal, setModalProps } = useModal()
|
|
|
// 展示服务弹窗详情
|
|
// 展示服务弹窗详情
|
|
@@ -37,6 +39,7 @@ const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
toggleModal()
|
|
toggleModal()
|
|
|
}
|
|
}
|
|
|
const initData = async payload => {
|
|
const initData = async payload => {
|
|
|
|
|
+ if (timer.current) clearTimeout(timer.current)
|
|
|
const {
|
|
const {
|
|
|
code = -1,
|
|
code = -1,
|
|
|
data: {
|
|
data: {
|
|
@@ -51,10 +54,11 @@ const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
}
|
|
}
|
|
|
} = await queryDashboard(payload)
|
|
} = await queryDashboard(payload)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
- setTimeout(() => {
|
|
|
|
|
|
|
+ if (state.immediate) {
|
|
|
setState({
|
|
setState({
|
|
|
...state,
|
|
...state,
|
|
|
loading: false,
|
|
loading: false,
|
|
|
|
|
+ immediate: false,
|
|
|
reminderData,
|
|
reminderData,
|
|
|
leaderboard,
|
|
leaderboard,
|
|
|
clientChainRatio,
|
|
clientChainRatio,
|
|
@@ -64,7 +68,22 @@ const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
aggregation,
|
|
aggregation,
|
|
|
businessChar
|
|
businessChar
|
|
|
})
|
|
})
|
|
|
- }, 1000)
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ timer.current = setTimeout(() => {
|
|
|
|
|
+ setState({
|
|
|
|
|
+ ...state,
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ reminderData,
|
|
|
|
|
+ leaderboard,
|
|
|
|
|
+ clientChainRatio,
|
|
|
|
|
+ customerChainRatio,
|
|
|
|
|
+ businessChainRatio,
|
|
|
|
|
+ serviceLogChainRatio,
|
|
|
|
|
+ aggregation,
|
|
|
|
|
+ businessChar
|
|
|
|
|
+ })
|
|
|
|
|
+ }, 1000)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -78,8 +97,8 @@ const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
}
|
|
}
|
|
|
}, [groupList])
|
|
}, [groupList])
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- state.params.businessGroupId && initData(state.params)
|
|
|
|
|
- }, [state.params.businessGroupId, state.params.cyclical, state.params.dataPermission])
|
|
|
|
|
|
|
+ initData(state.params)
|
|
|
|
|
+ }, [state.params.businessGroupId, state.params.dataPermission, state.params.cyclical])
|
|
|
const columns = [
|
|
const columns = [
|
|
|
{
|
|
{
|
|
|
title: '超过周期未服务提醒',
|
|
title: '超过周期未服务提醒',
|
|
@@ -221,17 +240,23 @@ const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
</div>
|
|
</div>
|
|
|
<div className="mt-4">
|
|
<div className="mt-4">
|
|
|
<Select
|
|
<Select
|
|
|
|
|
+ loading={state.loading}
|
|
|
options={permData?.workbench || []}
|
|
options={permData?.workbench || []}
|
|
|
dropdownMatchSelectWidth={false}
|
|
dropdownMatchSelectWidth={false}
|
|
|
defaultValue="oneself"
|
|
defaultValue="oneself"
|
|
|
- onChange={e => setState({ ...state, params: { ...state.params, dataPermission: e } })}
|
|
|
|
|
|
|
+ onChange={e =>
|
|
|
|
|
+ setState({ ...state, immediate: true, params: { ...state.params, dataPermission: e } })
|
|
|
|
|
+ }
|
|
|
/>
|
|
/>
|
|
|
<span className="ml-4">
|
|
<span className="ml-4">
|
|
|
<Select
|
|
<Select
|
|
|
|
|
+ loading={state.loading}
|
|
|
options={cyclicalOp}
|
|
options={cyclicalOp}
|
|
|
dropdownMatchSelectWidth={false}
|
|
dropdownMatchSelectWidth={false}
|
|
|
defaultValue="month"
|
|
defaultValue="month"
|
|
|
- onChange={e => setState({ ...state, params: { ...state.params, cyclical: e } })}
|
|
|
|
|
|
|
+ onChange={e =>
|
|
|
|
|
+ setState({ ...state, immediate: true, params: { ...state.params, cyclical: e } })
|
|
|
|
|
+ }
|
|
|
/>
|
|
/>
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -406,10 +431,8 @@ const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
}>
|
|
}>
|
|
|
{char && thread && <DualAxes {...config} />}
|
|
{char && thread && <DualAxes {...config} />}
|
|
|
</Card>
|
|
</Card>
|
|
|
- {/* <div className="p-4 bg-white border rounded-lg shadow-card"> */}
|
|
|
|
|
- {/* <Divider /> */}
|
|
|
|
|
- {/* </div> */}
|
|
|
|
|
</Col>
|
|
</Col>
|
|
|
|
|
+
|
|
|
<Col className="gutter-row" span={8}>
|
|
<Col className="gutter-row" span={8}>
|
|
|
<Card
|
|
<Card
|
|
|
headStyle={{ padding: '0 12px' }}
|
|
headStyle={{ padding: '0 12px' }}
|
|
@@ -437,11 +460,9 @@ const Dashboard = ({ dispatch, groupList = [] }) => {
|
|
|
</Row>
|
|
</Row>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="mt-4">
|
|
<div className="mt-4">
|
|
|
- <Row gutter={16}>
|
|
|
|
|
|
|
+ <Row gutter={24}>
|
|
|
<Col className="gutter-row" span={12}>
|
|
<Col className="gutter-row" span={12}>
|
|
|
- {/* <div className="bg-white border rounded-lg shadow-card"> */}
|
|
|
|
|
<LeaderBoard dataList={state.leaderboard} loading={state.loading} />
|
|
<LeaderBoard dataList={state.leaderboard} loading={state.loading} />
|
|
|
- {/* </div> */}
|
|
|
|
|
</Col>
|
|
</Col>
|
|
|
</Row>
|
|
</Row>
|
|
|
</div>
|
|
</div>
|