|
@@ -1,5 +1,5 @@
|
|
|
import React, { useMemo, useRef, useState } from 'react'
|
|
import React, { useMemo, useRef, useState } from 'react'
|
|
|
-import { Tabs, message, Dropdown, Menu, Typography, Button, Table } from 'antd'
|
|
|
|
|
|
|
+import { Tabs, message, Dropdown, Menu, Typography, Button, Table, Tag } from 'antd'
|
|
|
import { apiAddClient, apiAddCustomerService, updateClient } from '@/services/customer'
|
|
import { apiAddClient, apiAddCustomerService, updateClient } from '@/services/customer'
|
|
|
import { formatValues } from '@/components/LazyCascader'
|
|
import { formatValues } from '@/components/LazyCascader'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
@@ -15,17 +15,28 @@ import { useModal } from '@/components/ModalStore'
|
|
|
import { Plus } from '@icon-park/react'
|
|
import { Plus } from '@icon-park/react'
|
|
|
import { VList } from 'virtuallist-antd'
|
|
import { VList } from 'virtuallist-antd'
|
|
|
import classNames from 'classnames'
|
|
import classNames from 'classnames'
|
|
|
|
|
+import { queryRoadPricingListWithParams } from '@/services/product'
|
|
|
|
|
+import { cloudTitleEnum } from '@/pages/Product/Cloud/components/Detail/Form'
|
|
|
|
|
|
|
|
const { Text } = Typography
|
|
const { Text } = Typography
|
|
|
|
|
+
|
|
|
|
|
+const tabEnum = {
|
|
|
|
|
+ CLIENT: '1',
|
|
|
|
|
+ SOFTWARE: '2',
|
|
|
|
|
+ BUSINESS: '3',
|
|
|
|
|
+ CLOUD: '4'
|
|
|
|
|
+}
|
|
|
const CompanyTabList = ({ initData, customerId, client, software, customer, business, updatePayload }) => {
|
|
const CompanyTabList = ({ initData, customerId, client, software, customer, business, updatePayload }) => {
|
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
|
const dispatchModal = useModal()
|
|
const dispatchModal = useModal()
|
|
|
const { TabPane } = Tabs
|
|
const { TabPane } = Tabs
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
params: {},
|
|
params: {},
|
|
|
- visible: false
|
|
|
|
|
|
|
+ cloud: [],
|
|
|
|
|
+ loading: false // 云版loading
|
|
|
})
|
|
})
|
|
|
- const [clientHeight] = useState((document.body.clientHeight - 48 - 92 - 64 - 120) / 2)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const tableHeight = (document.body.clientHeight - 48 - 92 - 64 - 120) / 2
|
|
|
|
|
|
|
|
const changePriority = async (key, clientId) => {
|
|
const changePriority = async (key, clientId) => {
|
|
|
const { code = -1 } = await updateClient({
|
|
const { code = -1 } = await updateClient({
|
|
@@ -75,7 +86,6 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
|
|
|
{
|
|
{
|
|
|
title: '所有部门',
|
|
title: '所有部门',
|
|
|
dataIndex: 'department',
|
|
dataIndex: 'department',
|
|
|
- onFilter: true,
|
|
|
|
|
width: 100,
|
|
width: 100,
|
|
|
filters: Array.from(
|
|
filters: Array.from(
|
|
|
new Set(client.client?.map(item => item.department)).map(item => ({
|
|
new Set(client.client?.map(item => item.department)).map(item => ({
|
|
@@ -212,56 +222,97 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
- const columnBusiness = [
|
|
|
|
|
|
|
+ // const columnBusiness = [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // title: '商机名称',
|
|
|
|
|
+ // dataIndex: 'name',
|
|
|
|
|
+ // width: 185,
|
|
|
|
|
+ // render: (text, record) => (
|
|
|
|
|
+ // <span
|
|
|
|
|
+ // onClick={() => dispatchModal('D_BUSINESS_DETAIL', { dataId: record.id })}
|
|
|
|
|
+ // className="text-primary cursor-pointer hover:text-hex-967bbd">
|
|
|
|
|
+ // {text}
|
|
|
|
|
+ // </span>
|
|
|
|
|
+ // )
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // title: '状态',
|
|
|
|
|
+ // width: 90,
|
|
|
|
|
+ // dataIndex: 'businessStatusName'
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // title: '负责人',
|
|
|
|
|
+ // width: 90,
|
|
|
|
|
+ // dataIndex: 'responsible'
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // title: '商机金额',
|
|
|
|
|
+ // width: 90,
|
|
|
|
|
+ // dataIndex: 'price'
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // title: '预计成交',
|
|
|
|
|
+ // width: 90,
|
|
|
|
|
+ // dataIndex: 'finalTime'
|
|
|
|
|
+ // }
|
|
|
|
|
+ // ]
|
|
|
|
|
+
|
|
|
|
|
+ const cloudColumns = [
|
|
|
|
|
+ {
|
|
|
|
|
+ dataIndex: 'project_type',
|
|
|
|
|
+ title: '云版名称',
|
|
|
|
|
+ width: '20%',
|
|
|
|
|
+ filters: Object.keys(cloudTitleEnum).map(item => ({ text: cloudTitleEnum[item], value: item })),
|
|
|
|
|
+ onFilter: (projectType, record) => record.project_type.toString() === projectType,
|
|
|
|
|
+ render: text => cloudTitleEnum[text]
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
- title: '商机名称',
|
|
|
|
|
- dataIndex: 'name',
|
|
|
|
|
- width: 185,
|
|
|
|
|
|
|
+ dataIndex: 'mobile',
|
|
|
|
|
+ title: '账号',
|
|
|
|
|
+ width: '20%',
|
|
|
render: (text, record) => (
|
|
render: (text, record) => (
|
|
|
- <span
|
|
|
|
|
- onClick={() => dispatchModal('D_BUSINESS_DETAIL', { dataId: record.id })}
|
|
|
|
|
|
|
+ <div
|
|
|
className="text-primary cursor-pointer hover:text-hex-967bbd"
|
|
className="text-primary cursor-pointer hover:text-hex-967bbd"
|
|
|
|
|
+ onClick={() =>
|
|
|
|
|
+ dispatchModal('D_CLOUD_DETAIL', {
|
|
|
|
|
+ dataId: record.ssoId,
|
|
|
|
|
+ projectType: record.project_type
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
>
|
|
>
|
|
|
{text}
|
|
{text}
|
|
|
- </span>
|
|
|
|
|
|
|
+ </div>
|
|
|
)
|
|
)
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- title: '状态',
|
|
|
|
|
- width: 90,
|
|
|
|
|
- dataIndex: 'businessStatusName'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- title: '负责人',
|
|
|
|
|
- width: 90,
|
|
|
|
|
- dataIndex: 'responsible'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- title: '商机金额',
|
|
|
|
|
- width: 90,
|
|
|
|
|
- dataIndex: 'price'
|
|
|
|
|
|
|
+ dataIndex: 'real_name',
|
|
|
|
|
+ title: '姓名',
|
|
|
|
|
+ width: '20%'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- title: '预计成交',
|
|
|
|
|
- width: 90,
|
|
|
|
|
- dataIndex: 'finalTime'
|
|
|
|
|
|
|
+ dataIndex: 'upgrade_list',
|
|
|
|
|
+ title: '已升级专业版',
|
|
|
|
|
+ width: '40%',
|
|
|
|
|
+ render: text => (
|
|
|
|
|
+ <div className="children:m-2px">
|
|
|
|
|
+ {text
|
|
|
|
|
+ .filter(item => item.isUpgrade)
|
|
|
|
|
+ .map(item => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Tag color="purple" key={item.compilationID}>
|
|
|
|
|
+ {item.name}
|
|
|
|
|
+ </Tag>
|
|
|
|
|
+ )
|
|
|
|
|
+ })}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
-
|
|
|
|
|
- const [addCustomerService, setAddCustomerService] = useState({
|
|
|
|
|
- visible: false,
|
|
|
|
|
- loading: false
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
const handleAddCustomerService = async values => {
|
|
const handleAddCustomerService = async values => {
|
|
|
- setAddCustomerService({ ...addCustomerService, loading: true })
|
|
|
|
|
const { code = -1 } = await apiAddCustomerService({ ...values, customerId })
|
|
const { code = -1 } = await apiAddCustomerService({ ...values, customerId })
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
message.success('新增成功')
|
|
message.success('新增成功')
|
|
|
- setState({ ...state, data: values })
|
|
|
|
|
// 请求完了
|
|
// 请求完了
|
|
|
- setAddCustomerService({ ...addCustomerService, loading: false, visible: false })
|
|
|
|
|
- // 刷新数据
|
|
|
|
|
dispatch({
|
|
dispatch({
|
|
|
type: 'refresh/commitAction',
|
|
type: 'refresh/commitAction',
|
|
|
payload: updatePayload
|
|
payload: updatePayload
|
|
@@ -285,17 +336,37 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
|
|
|
return code === consts.RET_CODE.SUCCESS
|
|
return code === consts.RET_CODE.SUCCESS
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const vList = useMemo(() => {
|
|
|
|
|
|
|
+ const initCloudData = async () => {
|
|
|
|
|
+ setState({ ...state, loading: true })
|
|
|
|
|
+ const { data = [] } = await queryRoadPricingListWithParams({ customerId })
|
|
|
|
|
+ setState({ ...state, cloud: data, loading: false })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const handleTabChange = activeKey => {
|
|
|
|
|
+ if (activeKey === tabEnum.CLOUD) {
|
|
|
|
|
+ initCloudData()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 联系人虚拟表格
|
|
|
|
|
+ const vClientList = useMemo(() => {
|
|
|
return VList({
|
|
return VList({
|
|
|
- height: clientHeight,
|
|
|
|
|
|
|
+ height: tableHeight,
|
|
|
vid: 'client_list'
|
|
vid: 'client_list'
|
|
|
})
|
|
})
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
+ // 云版虚拟表格
|
|
|
|
|
+ const vCloudList = useMemo(() => {
|
|
|
|
|
+ return VList({
|
|
|
|
|
+ height: tableHeight,
|
|
|
|
|
+ vid: 'cloud_list'
|
|
|
|
|
+ })
|
|
|
|
|
+ }, [])
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
<div className="pl-15px">
|
|
<div className="pl-15px">
|
|
|
- <Tabs>
|
|
|
|
|
- <TabPane tab={<span>客户{renderBadge(client.total, true)}</span>} key="1">
|
|
|
|
|
|
|
+ <Tabs onChange={handleTabChange}>
|
|
|
|
|
+ <TabPane tab={<span>客户{renderBadge(client.total, true)}</span>} key={tabEnum.CLIENT}>
|
|
|
<div className="sheet-right-panel">
|
|
<div className="sheet-right-panel">
|
|
|
<Table
|
|
<Table
|
|
|
rowKey="id"
|
|
rowKey="id"
|
|
@@ -303,12 +374,12 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
|
|
|
columns={columns}
|
|
columns={columns}
|
|
|
dataSource={client.client}
|
|
dataSource={client.client}
|
|
|
pagination={false}
|
|
pagination={false}
|
|
|
- scroll={{ y: clientHeight }}
|
|
|
|
|
- components={vList}
|
|
|
|
|
|
|
+ scroll={{ y: tableHeight }}
|
|
|
|
|
+ components={vClientList}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</TabPane>
|
|
</TabPane>
|
|
|
- <TabPane tab={<span>软件锁{renderBadge(software.total, true)}</span>} key="2">
|
|
|
|
|
|
|
+ <TabPane tab={<span>软件锁{renderBadge(software.total, true)}</span>} key={tabEnum.SOFTWARE}>
|
|
|
<div className="sheet-right-panel">
|
|
<div className="sheet-right-panel">
|
|
|
<ProTable
|
|
<ProTable
|
|
|
size="small"
|
|
size="small"
|
|
@@ -318,11 +389,24 @@ const CompanyTabList = ({ initData, customerId, client, software, customer, busi
|
|
|
rowKey={record => record.id}
|
|
rowKey={record => record.id}
|
|
|
dataSource={software.longle}
|
|
dataSource={software.longle}
|
|
|
pagination={false}
|
|
pagination={false}
|
|
|
- scroll={{ y: clientHeight }}
|
|
|
|
|
|
|
+ scroll={{ y: tableHeight }}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</TabPane>
|
|
</TabPane>
|
|
|
- {/* <TabPane tab={<span>商机{renderBadge(business.total, true)}</span>} key="3">
|
|
|
|
|
|
|
+ <TabPane tab="云版" key={tabEnum.CLOUD}>
|
|
|
|
|
+ <Table
|
|
|
|
|
+ className="sheet-right-panel"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ loading={state.loading}
|
|
|
|
|
+ columns={cloudColumns}
|
|
|
|
|
+ rowKey="_id"
|
|
|
|
|
+ pagination={false}
|
|
|
|
|
+ scroll={{ y: tableHeight }}
|
|
|
|
|
+ components={vCloudList}
|
|
|
|
|
+ dataSource={state.cloud}
|
|
|
|
|
+ />
|
|
|
|
|
+ </TabPane>
|
|
|
|
|
+ {/* <TabPane tab={<span>商机{renderBadge(business.total, true)}</span>} key={tabEnum.BUSINESS}>
|
|
|
<div className="sheet-right-panel">
|
|
<div className="sheet-right-panel">
|
|
|
<ProTable
|
|
<ProTable
|
|
|
size="small"
|
|
size="small"
|