Bläddra i källkod

feat: 服务提醒增加弹窗

outaozhen 5 år sedan
förälder
incheckning
d77c68b2e1
1 ändrade filer med 26 tillägg och 13 borttagningar
  1. 26 13
      src/pages/workbench/Dashboard/components/ReminderList/index.jsx

+ 26 - 13
src/pages/workbench/Dashboard/components/ReminderList/index.jsx

@@ -1,7 +1,7 @@
 import React, { useState, useEffect } from 'react'
 import { Button } from 'antd'
 import consts from '@/consts'
-import { useDispatch, useRequest, connect } from 'umi'
+import { useDispatch, connect } from 'umi'
 import ProTable from '@ant-design/pro-table'
 import { queryReminderList } from '@/services/dashboard'
 import { CloseOutlined } from '@ant-design/icons'
@@ -10,6 +10,9 @@ import styles from './index.less'
 const ReminderList = props => {
   const dispatch = useDispatch()
   const { dataType, reminderCyclical } = props
+  const [state, setState] = useState({
+    params: { dataType, reminderCyclical }
+  })
   const clientColumns = [
     {
       title: '联系人名称',
@@ -138,16 +141,16 @@ const ReminderList = props => {
       columns: businessColumns
     }
   }
-  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 [dataSource, setDataSource] = useState(null)
+  // const { run: tryGetList } = useRequest(params => queryReminderList(params), {
+  //   manual: true,
+  //   onSuccess: result => {
+  //     setDataSource(result[dataMap[dataType].key])
+  //   }
+  // })
+  // useEffect(() => {
+  //   initData({ dataType, reminderCyclical })
+  // }, [])
 
   const closeModal = () => {
     dispatch({
@@ -167,10 +170,20 @@ const ReminderList = props => {
           size="small"
           rowKey={record => record.id}
           columns={dataMap[dataType].columns}
-          dataSource={dataSource}
+          // dataSource={dataSource}
+          params={state.params}
+          request={async params => {
+            const { code = -1, data: { client = [], total = 0 } = { client: [], total: 0 } } =
+              await queryReminderList({ ...params })
+            setState({ ...state, client })
+            return {
+              data: client,
+              success: code === consts.RET_CODE.SUCCESS,
+              total
+            }
+          }}
           search={false}
           toolBarRender={false}
-          pagination={false}
         />
       </div>
       <div className={styles.modalFooter}>