outaozhen il y a 5 ans
Parent
commit
6b6063929e

+ 8 - 2
src/pages/workbench/Dashboard/components/ReminderList/index.jsx

@@ -9,7 +9,12 @@ import styles from './index.less'
 
 const ReminderList = props => {
   const dispatch = useDispatch()
-  const { dataType, reminderCyclical } = props
+  const { dataType, reminderCyclical, type } = props
+  const dataMap = {
+    1: 'client',
+    2: 'customer',
+    3: 'business'
+  }
   const [state, setState] = useState({
     loading: false,
     client: []
@@ -17,9 +22,10 @@ const ReminderList = props => {
   const { run: tryGetList } = useRequest(params => queryReminderList(params), {
     manual: true,
     onSuccess: result => {
-      setState({ ...state, loading: false, client: result })
+      setState({ ...state, loading: false, client: result[dataMap[type]] })
     }
   })
+  console.log(state.client)
   useEffect(() => {
     tryGetList({ dataType, reminderCyclical, current: 1, pageSize: consts.MAX_PAGE_SIZE })
   }, [])

+ 7 - 12
src/pages/workbench/Dashboard/index.jsx

@@ -10,11 +10,6 @@ import ReminderList from './components/ReminderList'
 
 const Dashboard = () => {
   const { Option } = Select
-  const dataTypeNum = {
-    联系人: 0,
-    客户: 1,
-    商机: 2
-  }
   const [state, setState] = useState({
     visible: false,
     reminderData: [],
@@ -81,7 +76,7 @@ const Dashboard = () => {
       render: (name, record) => (
         // console.log(record)
         <span
-          onClick={() => handleReminderList(dataTypeNum[record.name], '7day')}
+          onClick={() => handleReminderList(record.type, '7day')}
           className="text-primary cursor-pointer hover:text-[#967bbd]">
           {name}
         </span>
@@ -92,7 +87,7 @@ const Dashboard = () => {
       dataIndex: 'day15',
       render: (name, record) => (
         <span
-          onClick={() => handleReminderList(dataTypeNum[record.name], '15day')}
+          onClick={() => handleReminderList(record.type, '15day')}
           className="text-primary cursor-pointer hover:text-[#967bbd]">
           {name}
         </span>
@@ -100,10 +95,10 @@ const Dashboard = () => {
     },
     {
       title: '30天',
-      dataIndex: 'day15',
+      dataIndex: 'day30',
       render: (name, record) => (
         <span
-          onClick={() => handleReminderList(record.day15)}
+          onClick={() => handleReminderList(record.type, '30day')}
           className="text-primary cursor-pointer hover:text-[#967bbd]">
           {name}
         </span>
@@ -114,7 +109,7 @@ const Dashboard = () => {
       dataIndex: 'month3',
       render: (name, record) => (
         <span
-          onClick={() => handleReminderList(record.day15)}
+          onClick={() => handleReminderList(record.type, '3month')}
           className="text-primary cursor-pointer hover:text-[#967bbd]">
           {name}
         </span>
@@ -125,7 +120,7 @@ const Dashboard = () => {
       dataIndex: 'month6',
       render: (name, record) => (
         <span
-          onClick={() => handleReminderList(record.day15)}
+          onClick={() => handleReminderList(record.type, '6month')}
           className="text-primary cursor-pointer hover:text-[#967bbd]">
           {name}
         </span>
@@ -136,7 +131,7 @@ const Dashboard = () => {
       dataIndex: 'remind',
       render: (name, record) => (
         <span
-          onClick={() => handleReminderList(record.day15)}
+          onClick={() => handleReminderList(record.type, 'reminder')}
           className="text-primary cursor-pointer hover:text-[#967bbd]">
           {name}
         </span>