|
|
@@ -17,6 +17,7 @@ import PermSelect, { PermDataTypeEunm } from '@/pages/Customer/Company/component
|
|
|
import { getAuthCache, getPermAuthCache, setAuthCache } from '@/utils/auth'
|
|
|
import { WORKBENCH_CYCLICAL_KEY } from '@/utils/cache/cacheEnum'
|
|
|
import styles from './index.less'
|
|
|
+import { isDevMode } from '@/utils/env'
|
|
|
|
|
|
const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
const timer = useRef(null)
|
|
|
@@ -42,13 +43,15 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
serviceLogChainRatio: {},
|
|
|
aggregation: {},
|
|
|
businessChar: {},
|
|
|
+ staffList: [],
|
|
|
params: {
|
|
|
businessGroupId: '',
|
|
|
- dataPermission: defaultPermAuthCache,
|
|
|
- staffIds: defaultStaffIds,
|
|
|
+ dataPermission: defaultPermAuthCache, // 'all' 'custom'
|
|
|
+ staffIds: defaultStaffIds, // ['xxxx'] || null
|
|
|
cyclical: defaultCyclicalValue
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
const { toggleModal, setModalProps } = useModal()
|
|
|
// 展示服务弹窗详情
|
|
|
const handleReminderList = (dataType, reminderCyclical) => {
|
|
|
@@ -75,14 +78,17 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
})
|
|
|
toggleModal()
|
|
|
}
|
|
|
- const staffList = async params => {
|
|
|
- const { code = -1, data: { list = [], total = 0 } = { list: [], total: 0 } } = await queryStaff(
|
|
|
- { ...params }
|
|
|
- )
|
|
|
- return {
|
|
|
- data: list,
|
|
|
- success: code === consts.RET_CODE.SUCCESS,
|
|
|
- total
|
|
|
+
|
|
|
+ // dataPermission-all 拉取部门下员工列表
|
|
|
+ const queryStaffList = async departmentId => {
|
|
|
+ const { code = -1, data: { list = [] } = { list: [] } } = await queryStaff({
|
|
|
+ departmentId,
|
|
|
+ current: 1,
|
|
|
+ pageSize: 100
|
|
|
+ })
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ // list存起来
|
|
|
+ setState({ ...state, staffList: list })
|
|
|
}
|
|
|
}
|
|
|
const initData = async payload => {
|
|
|
@@ -164,7 +170,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '7day')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{name}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -175,7 +182,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '15day')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{name}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -186,7 +194,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '30day')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{name}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -197,7 +206,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '3month')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{name}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -208,7 +218,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, '6month')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{name}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -219,7 +230,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
render: (name, record) => (
|
|
|
<span
|
|
|
onClick={() => handleReminderList(record.type, 'reminder')}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{name}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -297,16 +309,23 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
placeholder="办事处"
|
|
|
treeData={departments}
|
|
|
allowClear
|
|
|
- onSelect={staffList}
|
|
|
+ onSelect={queryStaffList}
|
|
|
/>
|
|
|
</span>
|
|
|
) : null}
|
|
|
- <div className="ml-4">
|
|
|
- <div className="relative w-30px h-30px rounded-1/2">
|
|
|
- <img src="/logo.png" />
|
|
|
- <span className={styles.avtraName}>欧桃珍</span>
|
|
|
+ {state.staffList.map(item => (
|
|
|
+ <div className="ml-4" key={item.id}>
|
|
|
+ <div className="relative w-30px h-30px rounded-1/2">
|
|
|
+ <img
|
|
|
+ src={
|
|
|
+ (isDevMode() ? 'http://cld2qa.com' : 'http://zhcld.com') +
|
|
|
+ (item?.avatar ? item.avatar : '/global/img/avtra_2.jpg')
|
|
|
+ }
|
|
|
+ />
|
|
|
+ <span className={styles.avtraName}>{item.username}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ ))}
|
|
|
</div>
|
|
|
<div className="mt-4">
|
|
|
<Row gutter={[8, 8]}>
|
|
|
@@ -330,7 +349,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
state.clientChainRatio.percentage.startsWith('-')
|
|
|
? 'text-green-500'
|
|
|
: 'text-red-500'
|
|
|
- ].join(' ')}>
|
|
|
+ ].join(' ')}
|
|
|
+ >
|
|
|
{state.clientChainRatio.percentage}
|
|
|
</span>
|
|
|
</div>
|
|
|
@@ -352,7 +372,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
) : (
|
|
|
<Row
|
|
|
className="cursor-pointer"
|
|
|
- onClick={() => handleRatioCard(cardTypeMap.COMPANY)}>
|
|
|
+ onClick={() => handleRatioCard(cardTypeMap.COMPANY)}
|
|
|
+ >
|
|
|
<Col span={6}>
|
|
|
<div className="w-full max-w-48px h-48px border rounded-48px bg-[#0c7cd5] flex items-center justify-center">
|
|
|
<City size="26" fill="#fff" />
|
|
|
@@ -367,7 +388,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
state.customerChainRatio.percentage.startsWith('-')
|
|
|
? 'text-green-500'
|
|
|
: 'text-red-500'
|
|
|
- ].join(' ')}>
|
|
|
+ ].join(' ')}
|
|
|
+ >
|
|
|
{state.customerChainRatio.percentage}
|
|
|
</span>
|
|
|
</div>
|
|
|
@@ -390,7 +412,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
) : (
|
|
|
<Row
|
|
|
className="cursor-pointer"
|
|
|
- onClick={() => handleRatioCard(cardTypeMap.BUSINESS)}>
|
|
|
+ onClick={() => handleRatioCard(cardTypeMap.BUSINESS)}
|
|
|
+ >
|
|
|
<Col span={6}>
|
|
|
<div className="w-full max-w-48px h-48px border rounded-48px bg-[#0c7cd5] flex items-center justify-center">
|
|
|
<Finance size="26" fill="#fff" />
|
|
|
@@ -405,7 +428,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
state.businessChainRatio.percentage.startsWith('-')
|
|
|
? 'text-green-500'
|
|
|
: 'text-red-500'
|
|
|
- ].join(' ')}>
|
|
|
+ ].join(' ')}
|
|
|
+ >
|
|
|
{state.businessChainRatio.percentage}
|
|
|
</span>
|
|
|
</div>
|
|
|
@@ -428,7 +452,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
) : (
|
|
|
<Row
|
|
|
onClick={() => handleRatioCard(cardTypeMap.SERVICE)}
|
|
|
- className="cursor-pointer">
|
|
|
+ className="cursor-pointer"
|
|
|
+ >
|
|
|
<Col span={6}>
|
|
|
<div className="w-full max-w-48px h-48px border rounded-48px bg-[#0c7cd5] flex items-center justify-center">
|
|
|
<Comment size="26" fill="#fff" />
|
|
|
@@ -443,7 +468,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
state.serviceLogChainRatio.percentage.startsWith('-')
|
|
|
? 'text-green-500'
|
|
|
: 'text-red-500'
|
|
|
- ].join(' ')}>
|
|
|
+ ].join(' ')}
|
|
|
+ >
|
|
|
{state.serviceLogChainRatio.percentage}
|
|
|
</span>
|
|
|
</div>
|
|
|
@@ -477,7 +503,8 @@ const Dashboard = ({ dispatch, departments = [] }) => {
|
|
|
title="数据汇总"
|
|
|
className="shadow-card"
|
|
|
bodyStyle={{ padding: state.loading ? '24px' : 0 }}
|
|
|
- loading={state.loading}>
|
|
|
+ loading={state.loading}
|
|
|
+ >
|
|
|
<ul>
|
|
|
<li className="px-12px py-16px border-b-1">
|
|
|
新增客户<b className="px-1">{state.aggregation.clientCount}</b>个,服务
|