|
|
@@ -1,11 +1,11 @@
|
|
|
-import React from 'react'
|
|
|
-import styles from '@/pages/Customer/Company/components/ConnectCompany/index.less'
|
|
|
-import { Button } from 'antd'
|
|
|
+import React, { useState } from 'react'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
-import { useDispatch } from 'umi'
|
|
|
import CustomModal from '@/components/Modal/src/components/CustomModal'
|
|
|
-import { queryRatioPanelsList } from '@/services/dashboard'
|
|
|
+import { queryRatioPanelsList, queryServiceRatioPanelsList } from '@/services/dashboard'
|
|
|
import consts from '@/consts'
|
|
|
+import { servicelogEnum } from '@/pages/Customer/Company/components/CompanyDetail/LowerList'
|
|
|
+import { Badge } from 'antd'
|
|
|
+import { cardTypeMap } from '../consts'
|
|
|
|
|
|
const dataTypeEunm = {
|
|
|
0: 'client',
|
|
|
@@ -13,13 +13,110 @@ const dataTypeEunm = {
|
|
|
2: 'business'
|
|
|
}
|
|
|
|
|
|
+const renderBadge = (count, active = false) => {
|
|
|
+ return active ? (
|
|
|
+ <Badge
|
|
|
+ count={count}
|
|
|
+ style={{
|
|
|
+ marginTop: -2,
|
|
|
+ marginLeft: 4,
|
|
|
+ color: active ? '#1890FF' : '#999',
|
|
|
+ backgroundColor: active ? '#E6F7FF' : '#eee'
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ ) : null
|
|
|
+}
|
|
|
+
|
|
|
+/** 服务环比数据Tab切换表格 */
|
|
|
+const ServiceRatioPanels = ({ cyclical, dataPermission }) => {
|
|
|
+ const [state, setState] = useState({
|
|
|
+ activeKey: '0',
|
|
|
+ total: 0
|
|
|
+ })
|
|
|
+
|
|
|
+ const columns = [
|
|
|
+ {
|
|
|
+ dataIndex: 'status',
|
|
|
+ title: '服务类型',
|
|
|
+ width: '25%',
|
|
|
+ render: type => servicelogEnum[type]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ dataIndex: 'date',
|
|
|
+ title: '服务日期',
|
|
|
+ width: '25%',
|
|
|
+ valueType: 'date'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ dataIndex: 'mark',
|
|
|
+ width: '50%',
|
|
|
+ title: '服务内容'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+ return (
|
|
|
+ <ProTable
|
|
|
+ size="small"
|
|
|
+ params={{ dataType: state.activeKey, cyclical, dataPermission }}
|
|
|
+ rowKey={record => record.id}
|
|
|
+ scroll={{ y: 400 }}
|
|
|
+ columns={columns}
|
|
|
+ search={false}
|
|
|
+ toolbar={{
|
|
|
+ settings: false,
|
|
|
+ menu: {
|
|
|
+ type: 'tab',
|
|
|
+ activeKey: state.activeKey,
|
|
|
+ items: [
|
|
|
+ {
|
|
|
+ key: '0',
|
|
|
+ label: (
|
|
|
+ <span>
|
|
|
+ 联系人服务记录
|
|
|
+ {renderBadge(state.total, state.activeKey === '0')}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: '1',
|
|
|
+ label: (
|
|
|
+ <span>
|
|
|
+ 客户服务记录
|
|
|
+ {renderBadge(state.total, state.activeKey === '1')}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: '2',
|
|
|
+ label: (
|
|
|
+ <span>
|
|
|
+ 商机服务记录
|
|
|
+ {renderBadge(state.total, state.activeKey === '2')}
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ onChange: key => {
|
|
|
+ setState({ ...state, activeKey: key })
|
|
|
+ // redoHeight()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ pagination={{ defaultPageSize: 10, showQuickJumper: true }}
|
|
|
+ request={async params => {
|
|
|
+ const { code = -1, data } = await queryServiceRatioPanelsList(params)
|
|
|
+ setState({ ...state, total: data.total || 0 })
|
|
|
+ return {
|
|
|
+ data: data.log,
|
|
|
+ success: code === consts.RET_CODE.SUCCESS,
|
|
|
+ total: data.total
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
const RatioPanels = ({ dataType, retioCyclical, dataPermission }) => {
|
|
|
- const dispatch = useDispatch()
|
|
|
- const closeModal = () => {
|
|
|
- dispatch({
|
|
|
- type: 'single/changeModal'
|
|
|
- })
|
|
|
- }
|
|
|
const columnsMap = {
|
|
|
0: [
|
|
|
{
|
|
|
@@ -113,54 +210,41 @@ const RatioPanels = ({ dataType, retioCyclical, dataPermission }) => {
|
|
|
width: '7%'
|
|
|
}
|
|
|
]
|
|
|
- // 3: [
|
|
|
- // {
|
|
|
- // dataIndex: '',
|
|
|
- // title: '栏目'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // dataIndex: '',
|
|
|
- // title: '类型'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // dataIndex: '',
|
|
|
- // title: '服务时间'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // dataIndex: '',
|
|
|
- // title: '服务内容'
|
|
|
- // }
|
|
|
- // ]
|
|
|
}
|
|
|
+
|
|
|
return (
|
|
|
<CustomModal title="卡片详情">
|
|
|
- <div className="mx-4">
|
|
|
- <ProTable
|
|
|
- size="small"
|
|
|
- pagination={{ defaultPageSize: 10 }}
|
|
|
- rowKey={record => record.id}
|
|
|
- scroll={{ y: 400 }}
|
|
|
- columns={columnsMap[dataType]}
|
|
|
- params={{ dataType, dataPermission, cyclical: retioCyclical }}
|
|
|
- request={async params => {
|
|
|
- const { code = -1, data } = await queryRatioPanelsList(params)
|
|
|
- return {
|
|
|
- data: data[dataTypeEunm[dataType]],
|
|
|
- success: code === consts.RET_CODE.SUCCESS,
|
|
|
- total: data.total
|
|
|
- }
|
|
|
- }}
|
|
|
- search={false}
|
|
|
- toolBarRender={false}
|
|
|
- />
|
|
|
+ <div className="mx-4 pb-4">
|
|
|
+ {dataType === cardTypeMap.SERVICE ? (
|
|
|
+ <ServiceRatioPanels cyclical={retioCyclical} dataPermission={dataPermission} />
|
|
|
+ ) : (
|
|
|
+ <ProTable
|
|
|
+ size="small"
|
|
|
+ pagination={{ defaultPageSize: 10 }}
|
|
|
+ rowKey={record => record.id}
|
|
|
+ scroll={{ y: 400 }}
|
|
|
+ columns={columnsMap[dataType]}
|
|
|
+ params={{ dataType, dataPermission, cyclical: retioCyclical }}
|
|
|
+ request={async params => {
|
|
|
+ const { code = -1, data } = await queryRatioPanelsList(params)
|
|
|
+ return {
|
|
|
+ data: data[dataTypeEunm[dataType]],
|
|
|
+ success: code === consts.RET_CODE.SUCCESS,
|
|
|
+ total: data.total
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ search={false}
|
|
|
+ toolBarRender={false}
|
|
|
+ />
|
|
|
+ )}
|
|
|
</div>
|
|
|
- <div className={styles.modalFooter}>
|
|
|
+ {/* <div className={styles.modalFooter}>
|
|
|
<div className="text-right">
|
|
|
<Button type="button" onClick={closeModal}>
|
|
|
关闭
|
|
|
</Button>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div> */}
|
|
|
</CustomModal>
|
|
|
)
|
|
|
}
|