lanjianrong пре 5 година
родитељ
комит
58da67963e
1 измењених фајлова са 17 додато и 11 уклоњено
  1. 17 11
      src/pages/workbench/Dashboard/index.jsx

+ 17 - 11
src/pages/workbench/Dashboard/index.jsx

@@ -11,8 +11,7 @@ import ReminderList from './components/ReminderList'
 import LeaderBoard from './components/LeaderBoard'
 import { cyclicalOp } from './consts'
 
-const Dashboard = ({ permData }) => {
-  const { Option } = Select
+const Dashboard = ({ dispatch, permData = {}, groupList = [] }) => {
   const [state, setState] = useState({
     visible: false,
     reminderData: [],
@@ -24,7 +23,7 @@ const Dashboard = ({ permData }) => {
     aggregation: {},
     char: [],
     thread: [],
-    params: {}
+    params: { businessGroupId: null, dataPermission: 'oneself', cyclical: 'month' }
   })
   const { toggleModal, setModalProps } = useModal()
   // 展示服务弹窗详情
@@ -67,8 +66,15 @@ const Dashboard = ({ permData }) => {
     }
   }
   useEffect(() => {
-    initData(state.params)
-  }, [state.params])
+    if (!groupList.length) {
+      dispatch({
+        type: 'business/fetchGroup'
+      })
+    }
+    if (groupList[0]?.value) {
+      initData({ ...state.params, businessGroupId: groupList[0]?.value })
+    }
+  }, [state.params, groupList])
   const columns = [
     {
       title: '超过周期未服务提醒',
@@ -78,7 +84,6 @@ const Dashboard = ({ permData }) => {
       title: '7天',
       dataIndex: 'day7',
       render: (name, record) => (
-        // console.log(record)
         <span
           onClick={() => handleReminderList(record.type, '7day')}
           className="text-primary cursor-pointer hover:text-[#967bbd]">
@@ -364,9 +369,9 @@ const Dashboard = ({ permData }) => {
               <div className="relative">
                 <span>销售漏斗</span>
                 <div className="absolute right-1 top-0">
-                  <Select defaultValue="销售漏斗组">
-                    <Option value="销售漏斗组">销售漏斗组</Option>
-                  </Select>
+                  {groupList[0]?.value ? (
+                    <Select defaultValue={groupList[0]?.value} options={groupList} />
+                  ) : null}
                 </div>
               </div>
               <Divider />
@@ -409,6 +414,7 @@ const Dashboard = ({ permData }) => {
   )
 }
 
-export default connect(({ global }) => ({
-  permData: global.premData
+export default connect(({ business, global }) => ({
+  permData: global.premData,
+  groupList: business.groupList
 }))(Dashboard)