| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- import React, { useState } from 'react'
- import consts from '@/consts'
- import { connect } from 'umi'
- import ProTable from '@ant-design/pro-table'
- import { useModal } from '@/components/Modal'
- import { queryReminderList } from '@/services/dashboard'
- // import styles from '@/pages/Customer/Company/components/ConnectCompany/index.less'
- import CustomModal from '@/components/Modal/src/components/CustomModal'
- import ContactDetail from '@/pages/Customer/Client/components/ClientDetail'
- import CompanyDetail from '@/pages/Customer/Company/components/CompanyDetail'
- import Detail from '@/pages/Customer/Business/components/BusinessDetail'
- const ReminderList = props => {
- // const dispatch = useDispatch()
- const { dataType, reminderCyclical } = props
- const { toggleDrawer, setDrawerProps } = useModal()
- const [state] = useState({
- orderIds: []
- })
- // const [state, setState] = useState({
- // params: { dataType, reminderCyclical }
- // })
- // 展示客户
- const showDrawer = id => {
- setDrawerProps({
- zIndex: 1001,
- closable: true,
- onClose: () => toggleDrawer(),
- bodyStyle: {
- height: '100vh'
- // overflowY: 'hidden'
- },
- children: <ContactDetail dataId={id} orderIds={state.orderIds} />
- })
- toggleDrawer()
- }
- // 展示单位
- const showDrawerComapny = id => {
- setDrawerProps({
- zIndex: 1001,
- closable: true,
- onClose: () => toggleDrawer(),
- bodyStyle: {
- height: '100vh'
- // overflowY: 'hidden'
- },
- children: <CompanyDetail dataId={id} orderIds={state.orderIds} />
- })
- toggleDrawer()
- }
- // 展示商机详情
- const showDrawerBusiness = (id, isCompany = false) => {
- setDrawerProps({
- zIndex: 1001,
- closable: true,
- onClose: () => toggleDrawer(),
- bodyStyle: {
- height: '100vh',
- overflowY: 'hidden'
- },
- children: isCompany ? (
- <CompanyDetail dataId={id} />
- ) : (
- <Detail dataId={id} orderIds={state.orderIds} />
- )
- })
- toggleDrawer()
- }
- const clientColumns = [
- {
- title: '客户名称',
- dataIndex: 'clientName',
- ellipsis: true,
- width: '10%',
- render: (clientName, record) => (
- <span
- onClick={() => showDrawer(record.id)}
- className="text-primary cursor-pointer hover:text-[#967bbd]">
- {clientName}
- </span>
- )
- },
- {
- title: '单位名称',
- dataIndex: 'companyName',
- width: '15%',
- ellipsis: true,
- render: (companyName, record) => (
- <span
- onClick={() => showDrawerComapny(record.companyId)}
- className="text-primary cursor-pointer hover:text-[#967bbd]">
- {companyName}
- </span>
- )
- },
- {
- title: '地区',
- dataIndex: 'districtName',
- ellipsis: true,
- width: '15%',
- renderText: text => text?.replaceAll(' / ', ' , ')
- },
- {
- title: '手机',
- dataIndex: 'telephone',
- ellipsis: true,
- width: '10%'
- },
- {
- title: '服务日期',
- dataIndex: 'serviceDate',
- ellipsis: true,
- width: '8%'
- },
- {
- title: '服务内容',
- dataIndex: 'serviceContent',
- width: '26%',
- ellipsis: true
- },
- {
- title: '备忘时间',
- dataIndex: 'memoDate',
- width: '10%',
- ellipsis: true
- },
- {
- title: '备忘内容',
- dataIndex: 'memoContent',
- width: '27%',
- ellipsis: true
- }
- ]
- const customerColumns = [
- {
- title: '单位名称',
- dataIndex: 'companyName',
- width: '15%',
- ellipsis: true,
- render: (companyName, record) => (
- <span
- onClick={() => showDrawerComapny(record.id)}
- className="text-primary cursor-pointer hover:text-[#967bbd]">
- {companyName}
- </span>
- )
- },
- {
- title: '地区',
- dataIndex: 'districtName',
- width: '15%',
- ellipsis: true,
- renderText: text => text?.replaceAll(' / ', ' , ')
- },
- {
- title: '电话',
- dataIndex: 'phone',
- width: '10%',
- ellipsis: true
- },
- {
- title: '服务日期',
- dataIndex: 'serviceDate',
- width: '8%',
- ellipsis: true
- },
- {
- title: '服务内容',
- dataIndex: 'serviceContent',
- width: '24%',
- ellipsis: true
- },
- {
- title: '备忘时间',
- dataIndex: 'memoDate',
- width: '10%',
- ellipsis: true
- },
- {
- title: '备忘内容',
- dataIndex: 'memoContent',
- width: '22%',
- ellipsis: true
- }
- ]
- const businessColumns = [
- {
- title: '商机名称',
- dataIndex: 'name',
- width: '15%',
- ellipsis: true,
- render: (text, record) => (
- <span
- onClick={() => showDrawerBusiness(record.id)}
- className="text-primary cursor-pointer hover:text-[#967bbd]">
- {text}
- </span>
- )
- },
- {
- title: '单位名称',
- dataIndex: 'customerName',
- width: '15%',
- ellipsis: true
- },
- {
- title: '服务日期',
- dataIndex: 'serviceDate',
- width: '8%',
- ellipsis: true
- },
- {
- title: '服务内容',
- dataIndex: 'serviceContent',
- width: '27%',
- ellipsis: true
- },
- {
- title: '备忘时间',
- dataIndex: 'memoDate',
- width: '10%',
- ellipsis: true
- },
- {
- title: '备忘内容',
- dataIndex: 'memoContent',
- width: '25%',
- ellipsis: true
- }
- ]
- const dataMap = {
- 0: {
- key: 'client',
- columns: clientColumns
- },
- 1: {
- key: 'customer',
- columns: customerColumns
- },
- 2: {
- key: 'business',
- columns: businessColumns
- }
- }
- const titleMap = {
- 0: { title: '客户' },
- 1: { title: '单位' },
- 2: { title: '商机' }
- }
- // const closeModal = () => {
- // dispatch({
- // type: 'single/changeModal'
- // })
- // }
- return (
- <CustomModal title={titleMap[dataType].title}>
- <div className="mx-4">
- <ProTable
- size="small"
- rowKey={record => record.id}
- columns={dataMap[dataType].columns}
- params={{ dataType, reminderCyclical }}
- scroll={{ y: 400 }}
- request={async params => {
- const { code = -1, data } = await queryReminderList({ ...params })
- return {
- data: data[dataMap[dataType].key],
- success: code === consts.RET_CODE.SUCCESS,
- total: data.total
- }
- }}
- scroll={{ y: 400 }}
- pagination={{ defaultPageSize: 10 }}
- search={false}
- toolBarRender={false}
- />
- </div>
- {/* <div className={styles.modalFooter}>
- <div className="text-right">
- <Button type="button" onClick={closeModal}>
- 关闭
- </Button>
- </div>
- </div> */}
- </CustomModal>
- )
- }
- export default connect(({ single }) => ({
- visible: single.drawer.visible
- }))(ReminderList)
|