|
@@ -1,8 +1,7 @@
|
|
|
import React, { useState, useEffect } from 'react'
|
|
import React, { useState, useEffect } from 'react'
|
|
|
import { Button } from 'antd'
|
|
import { Button } from 'antd'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
-import { useDispatch } from 'dva'
|
|
|
|
|
-import { connect } from 'dva'
|
|
|
|
|
|
|
+import { useDispatch, useRequest, connect } from 'umi'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
import { queryReminderList } from '@/services/dashboard'
|
|
import { queryReminderList } from '@/services/dashboard'
|
|
|
import { CloseOutlined } from '@ant-design/icons'
|
|
import { CloseOutlined } from '@ant-design/icons'
|
|
@@ -10,25 +9,20 @@ import styles from './index.less'
|
|
|
|
|
|
|
|
const ReminderList = props => {
|
|
const ReminderList = props => {
|
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
|
- const { visible, dataId = '', dataType, reminderCyclical } = props
|
|
|
|
|
|
|
+ const { dataType, reminderCyclical } = props
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
loading: false,
|
|
loading: false,
|
|
|
client: []
|
|
client: []
|
|
|
})
|
|
})
|
|
|
- const initData = async id => {
|
|
|
|
|
- setState({ ...state, loading: true })
|
|
|
|
|
- const {
|
|
|
|
|
- data: { client = [] },
|
|
|
|
|
- code = -1
|
|
|
|
|
- } = await queryReminderList(id)
|
|
|
|
|
- if (code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
- setState({ ...state, client, loading: false })
|
|
|
|
|
|
|
+ const { run: tryGetList } = useRequest(params => queryReminderList(params), {
|
|
|
|
|
+ manual: true,
|
|
|
|
|
+ onSuccess: result => {
|
|
|
|
|
+ setState({ ...state, loading: false, client: result })
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- console.log(state.client)
|
|
|
|
|
|
|
+ })
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- visible && initData(dataId, dataType, reminderCyclical)
|
|
|
|
|
- }, [visible])
|
|
|
|
|
|
|
+ tryGetList({ dataType, reminderCyclical, current: 1, pageSize: consts.MAX_PAGE_SIZE })
|
|
|
|
|
+ }, [])
|
|
|
|
|
|
|
|
const closeModal = () => {
|
|
const closeModal = () => {
|
|
|
dispatch({
|
|
dispatch({
|