|
|
@@ -9,33 +9,8 @@ import styles from './index.less'
|
|
|
|
|
|
const ReminderList = props => {
|
|
|
const dispatch = useDispatch()
|
|
|
- const { dataType, reminderCyclical, type } = props
|
|
|
- const dataMap = {
|
|
|
- 1: 'client',
|
|
|
- 2: 'customer',
|
|
|
- 3: 'business'
|
|
|
- }
|
|
|
- const [state, setState] = useState({
|
|
|
- loading: false,
|
|
|
- client: []
|
|
|
- })
|
|
|
- const { run: tryGetList } = useRequest(params => queryReminderList(params), {
|
|
|
- manual: true,
|
|
|
- onSuccess: result => {
|
|
|
- setState({ ...state, loading: false, client: result[dataMap[type]] })
|
|
|
- }
|
|
|
- })
|
|
|
- console.log(state.client)
|
|
|
- useEffect(() => {
|
|
|
- tryGetList({ dataType, reminderCyclical, current: 1, pageSize: consts.MAX_PAGE_SIZE })
|
|
|
- }, [])
|
|
|
-
|
|
|
- const closeModal = () => {
|
|
|
- dispatch({
|
|
|
- type: 'single/changeModal'
|
|
|
- })
|
|
|
- }
|
|
|
- const columns = [
|
|
|
+ const { dataType, reminderCyclical } = props
|
|
|
+ const clientColumns = [
|
|
|
{
|
|
|
title: '客户名称',
|
|
|
dataIndex: 'staffName'
|
|
|
@@ -73,6 +48,34 @@ const ReminderList = props => {
|
|
|
dataIndex: 'serviceTime'
|
|
|
}
|
|
|
]
|
|
|
+ const dataMap = {
|
|
|
+ 0: {
|
|
|
+ key: 'client',
|
|
|
+ columns: clientColumns
|
|
|
+ },
|
|
|
+ 1: 'customer',
|
|
|
+ 2: 'business'
|
|
|
+ }
|
|
|
+ // const columnsMap = {
|
|
|
+ // 0: 'clientColumns'
|
|
|
+ // }
|
|
|
+ const [dataSource, setDataSource] = useState(null)
|
|
|
+ const { run: tryGetList } = useRequest(params => queryReminderList(params), {
|
|
|
+ manual: true,
|
|
|
+ onSuccess: result => {
|
|
|
+ setDataSource(result[dataMap[dataType].key])
|
|
|
+ }
|
|
|
+ })
|
|
|
+ useEffect(() => {
|
|
|
+ tryGetList({ dataType, reminderCyclical, current: 1, pageSize: consts.MAX_PAGE_SIZE })
|
|
|
+ }, [])
|
|
|
+
|
|
|
+ const closeModal = () => {
|
|
|
+ dispatch({
|
|
|
+ type: 'single/changeModal'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<div className={['ant-modal-content', styles.modalContainer].join(' ')}>
|
|
|
<div className={styles.modalHeader}>
|
|
|
@@ -82,9 +85,10 @@ const ReminderList = props => {
|
|
|
</div>
|
|
|
<div className="mx-4">
|
|
|
<ProTable
|
|
|
+ size="small"
|
|
|
rowKey={record => record.rank}
|
|
|
- columns={columns}
|
|
|
- dataSource={state.client}
|
|
|
+ columns={dataMap[dataType].columns}
|
|
|
+ dataSource={dataSource}
|
|
|
search={false}
|
|
|
toolBarRender={false}
|
|
|
pagination={false}
|