|
@@ -4,21 +4,19 @@ import { Row, Col, Select, Card, Skeleton, TreeSelect } from 'antd'
|
|
|
import { AddressBook, City, Comment } from '@icon-park/react'
|
|
import { AddressBook, City, Comment } from '@icon-park/react'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
import { connect, useModel } from 'umi'
|
|
import { connect, useModel } from 'umi'
|
|
|
-import { useModal } from '@/components/Modal'
|
|
|
|
|
import { queryDashboard } from '@/services/dashboard'
|
|
import { queryDashboard } from '@/services/dashboard'
|
|
|
import { queryStaff } from '@/services/staff'
|
|
import { queryStaff } from '@/services/staff'
|
|
|
-import ReminderList from './components/ReminderList'
|
|
|
|
|
import LeaderBoard from './components/LeaderBoard'
|
|
import LeaderBoard from './components/LeaderBoard'
|
|
|
import SoftLeaderboard from './components/SoftLeaderboard'
|
|
import SoftLeaderboard from './components/SoftLeaderboard'
|
|
|
import { cardTypeMap, cyclicalOp } from './consts'
|
|
import { cardTypeMap, cyclicalOp } from './consts'
|
|
|
// import BusinessChar from './components/BusinessChar'
|
|
// import BusinessChar from './components/BusinessChar'
|
|
|
-import RatioPanels from './components/RatioPanels'
|
|
|
|
|
import PermSelect, { PermDataTypeEunm } from '@/pages/Customer/Company/components/PermSelect'
|
|
import PermSelect, { PermDataTypeEunm } from '@/pages/Customer/Company/components/PermSelect'
|
|
|
import { getAuthCache, getPermAuthCache, setAuthCache } from '@/utils/auth'
|
|
import { getAuthCache, getPermAuthCache, setAuthCache } from '@/utils/auth'
|
|
|
import { WORKBENCH_CYCLICAL_KEY } from '@/utils/cache/cacheEnum'
|
|
import { WORKBENCH_CYCLICAL_KEY } from '@/utils/cache/cacheEnum'
|
|
|
import styles from './index.less'
|
|
import styles from './index.less'
|
|
|
import { isDevMode } from '@/utils/env'
|
|
import { isDevMode } from '@/utils/env'
|
|
|
import { isMobile } from '@/utils/is'
|
|
import { isMobile } from '@/utils/is'
|
|
|
|
|
+import { useModal } from '@/components/ModalStore'
|
|
|
|
|
|
|
|
const Dashboard = ({ dispatch, departments = [] }) => {
|
|
const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
const { initialState: { currentUser } = { currentUser: {} } } = useModel('@@initialState')
|
|
const { initialState: { currentUser } = { currentUser: {} } } = useModel('@@initialState')
|
|
@@ -54,31 +52,20 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- const { toggleModal, setModalProps } = useModal()
|
|
|
|
|
|
|
+ const dispatchModal = useModal()
|
|
|
|
|
+
|
|
|
// 展示服务弹窗详情
|
|
// 展示服务弹窗详情
|
|
|
const handleReminderList = (dataType, reminderCyclical) => {
|
|
const handleReminderList = (dataType, reminderCyclical) => {
|
|
|
- setModalProps({
|
|
|
|
|
- width: '90vw',
|
|
|
|
|
- modalRender: () => <ReminderList dataType={dataType} reminderCyclical={reminderCyclical} />,
|
|
|
|
|
- onCancel: () => toggleModal()
|
|
|
|
|
- })
|
|
|
|
|
- toggleModal()
|
|
|
|
|
|
|
+ dispatchModal('M_REMINDER_LIST', { dataType, reminderCyclical })
|
|
|
}
|
|
}
|
|
|
// 展示卡片详情
|
|
// 展示卡片详情
|
|
|
const handleRatioCard = dataType => {
|
|
const handleRatioCard = dataType => {
|
|
|
- setModalProps({
|
|
|
|
|
- width: '90vw',
|
|
|
|
|
- modalRender: () => (
|
|
|
|
|
- <RatioPanels
|
|
|
|
|
- dataType={dataType}
|
|
|
|
|
- staffIds={state.params.staffIds}
|
|
|
|
|
- retioCyclical={state.params.cyclical}
|
|
|
|
|
- dataPermission={state.params.dataPermission}
|
|
|
|
|
- />
|
|
|
|
|
- ),
|
|
|
|
|
- onCancel: () => toggleModal()
|
|
|
|
|
|
|
+ dispatchModal('M_RATIO_PANELS', {
|
|
|
|
|
+ dataType,
|
|
|
|
|
+ staffIds: state.params.staffIds,
|
|
|
|
|
+ retioCyclical: state.params.cyclical,
|
|
|
|
|
+ dataPermission: state.params.dataPermission
|
|
|
})
|
|
})
|
|
|
- toggleModal()
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// dataPermission-all 拉取部门下员工列表
|
|
// dataPermission-all 拉取部门下员工列表
|
|
@@ -200,7 +187,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
render: (name, record) => (
|
|
|
<span
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '7day')}
|
|
onClick={() => handleReminderList(record.type, '7day')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
|
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
|
|
+ >
|
|
|
{name}
|
|
{name}
|
|
|
</span>
|
|
</span>
|
|
|
)
|
|
)
|
|
@@ -211,7 +199,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
render: (name, record) => (
|
|
|
<span
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '15day')}
|
|
onClick={() => handleReminderList(record.type, '15day')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
|
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
|
|
+ >
|
|
|
{name}
|
|
{name}
|
|
|
</span>
|
|
</span>
|
|
|
)
|
|
)
|
|
@@ -222,7 +211,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
render: (name, record) => (
|
|
|
<span
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '30day')}
|
|
onClick={() => handleReminderList(record.type, '30day')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
|
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
|
|
+ >
|
|
|
{name}
|
|
{name}
|
|
|
</span>
|
|
</span>
|
|
|
)
|
|
)
|
|
@@ -233,7 +223,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
render: (name, record) => (
|
|
|
<span
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '3month')}
|
|
onClick={() => handleReminderList(record.type, '3month')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
|
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
|
|
+ >
|
|
|
{name}
|
|
{name}
|
|
|
</span>
|
|
</span>
|
|
|
)
|
|
)
|
|
@@ -244,7 +235,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
render: (name, record) => (
|
|
|
<span
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '6month')}
|
|
onClick={() => handleReminderList(record.type, '6month')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
|
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
|
|
+ >
|
|
|
{name}
|
|
{name}
|
|
|
</span>
|
|
</span>
|
|
|
)
|
|
)
|
|
@@ -255,7 +247,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
render: (name, record) => (
|
|
|
<span
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, 'reminder')}
|
|
onClick={() => handleReminderList(record.type, 'reminder')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
|
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
|
|
+ >
|
|
|
{name}
|
|
{name}
|
|
|
</span>
|
|
</span>
|
|
|
)
|
|
)
|
|
@@ -362,7 +355,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
'relative',
|
|
'relative',
|
|
|
'cursor-pointer',
|
|
'cursor-pointer',
|
|
|
state.selectId === item.id ? styles.imgBg : styles.paddingBg
|
|
state.selectId === item.id ? styles.imgBg : styles.paddingBg
|
|
|
- ].join(' ')}>
|
|
|
|
|
|
|
+ ].join(' ')}
|
|
|
|
|
+ >
|
|
|
<img
|
|
<img
|
|
|
className="w-full max-w-30px h-30px border rounded-30px"
|
|
className="w-full max-w-30px h-30px border rounded-30px"
|
|
|
src={
|
|
src={
|
|
@@ -400,7 +394,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
state.clientChainRatio.percentage.startsWith('-')
|
|
state.clientChainRatio.percentage.startsWith('-')
|
|
|
? 'text-green-500'
|
|
? 'text-green-500'
|
|
|
: 'text-red-500'
|
|
: 'text-red-500'
|
|
|
- ].join(' ')}>
|
|
|
|
|
|
|
+ ].join(' ')}
|
|
|
|
|
+ >
|
|
|
{state.clientChainRatio.percentage}
|
|
{state.clientChainRatio.percentage}
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -422,7 +417,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
) : (
|
|
) : (
|
|
|
<Row
|
|
<Row
|
|
|
className="cursor-pointer"
|
|
className="cursor-pointer"
|
|
|
- onClick={() => handleRatioCard(cardTypeMap.COMPANY)}>
|
|
|
|
|
|
|
+ onClick={() => handleRatioCard(cardTypeMap.COMPANY)}
|
|
|
|
|
+ >
|
|
|
<Col span={6}>
|
|
<Col span={6}>
|
|
|
<div className="w-full max-w-48px h-48px border rounded-48px bg-[#0c7cd5] flex items-center justify-center">
|
|
<div className="w-full max-w-48px h-48px border rounded-48px bg-[#0c7cd5] flex items-center justify-center">
|
|
|
<City size="26" fill="#fff" />
|
|
<City size="26" fill="#fff" />
|
|
@@ -437,7 +433,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
state.customerChainRatio.percentage.startsWith('-')
|
|
state.customerChainRatio.percentage.startsWith('-')
|
|
|
? 'text-green-500'
|
|
? 'text-green-500'
|
|
|
: 'text-red-500'
|
|
: 'text-red-500'
|
|
|
- ].join(' ')}>
|
|
|
|
|
|
|
+ ].join(' ')}
|
|
|
|
|
+ >
|
|
|
{state.customerChainRatio.percentage}
|
|
{state.customerChainRatio.percentage}
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -498,7 +495,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
) : (
|
|
) : (
|
|
|
<Row
|
|
<Row
|
|
|
onClick={() => handleRatioCard(cardTypeMap.SERVICE)}
|
|
onClick={() => handleRatioCard(cardTypeMap.SERVICE)}
|
|
|
- className="cursor-pointer">
|
|
|
|
|
|
|
+ className="cursor-pointer"
|
|
|
|
|
+ >
|
|
|
<Col span={6}>
|
|
<Col span={6}>
|
|
|
<div className="w-full max-w-48px h-48px border rounded-48px bg-[#0c7cd5] flex items-center justify-center">
|
|
<div className="w-full max-w-48px h-48px border rounded-48px bg-[#0c7cd5] flex items-center justify-center">
|
|
|
<Comment size="26" fill="#fff" />
|
|
<Comment size="26" fill="#fff" />
|
|
@@ -513,7 +511,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
state.serviceLogChainRatio.percentage.startsWith('-')
|
|
state.serviceLogChainRatio.percentage.startsWith('-')
|
|
|
? 'text-green-500'
|
|
? 'text-green-500'
|
|
|
: 'text-red-500'
|
|
: 'text-red-500'
|
|
|
- ].join(' ')}>
|
|
|
|
|
|
|
+ ].join(' ')}
|
|
|
|
|
+ >
|
|
|
{state.serviceLogChainRatio.percentage}
|
|
{state.serviceLogChainRatio.percentage}
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -547,7 +546,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
title="数据汇总"
|
|
title="数据汇总"
|
|
|
className="shadow-card"
|
|
className="shadow-card"
|
|
|
bodyStyle={{ padding: state.loading ? '24px' : 0 }}
|
|
bodyStyle={{ padding: state.loading ? '24px' : 0 }}
|
|
|
- loading={state.loading}>
|
|
|
|
|
|
|
+ loading={state.loading}
|
|
|
|
|
+ >
|
|
|
<ul>
|
|
<ul>
|
|
|
<li className="px-12px py-16px border-b-1">
|
|
<li className="px-12px py-16px border-b-1">
|
|
|
新增客户<b className="px-1">{state.aggregation.clientCount}</b>个,服务
|
|
新增客户<b className="px-1">{state.aggregation.clientCount}</b>个,服务
|