Przeglądaj źródła

feat: 仪表盘数据汇总和排行榜的数据

outaozhen 5 lat temu
rodzic
commit
e227034d68
1 zmienionych plików z 35 dodań i 25 usunięć
  1. 35 25
      src/pages/workbench/Dashboard/index.jsx

+ 35 - 25
src/pages/workbench/Dashboard/index.jsx

@@ -1,6 +1,7 @@
 import React, { useState, useEffect } from 'react'
 import ProTable from '@ant-design/pro-table'
-import { Row, Col, List, Divider, Select } from 'antd'
+import { Row, Col, Divider, Select } from 'antd'
+import { AddressBook, City, Finance, Comment } from '@icon-park/react'
 import { DualAxes } from '@ant-design/charts'
 import consts from '@/consts'
 import { queryDashboard } from '@/services/dashboard'
@@ -13,7 +14,8 @@ const Dashboard = () => {
     clientChainRatio: {},
     customerChainRatio: {},
     businessChainRatio: {},
-    serviceLogChainRatio: {}
+    serviceLogChainRatio: {},
+    aggregation: {}
   })
   const initData = async payload => {
     const {
@@ -24,7 +26,8 @@ const Dashboard = () => {
         clientChainRatio = {},
         customerChainRatio = {},
         businessChainRatio = {},
-        serviceLogChainRatio = {}
+        serviceLogChainRatio = {},
+        aggregation = {}
       }
     } = await queryDashboard(payload)
     if (code === consts.RET_CODE.SUCCESS) {
@@ -35,7 +38,8 @@ const Dashboard = () => {
         clientChainRatio,
         customerChainRatio,
         businessChainRatio,
-        serviceLogChainRatio
+        serviceLogChainRatio,
+        aggregation
       })
     }
   }
@@ -57,7 +61,7 @@ const Dashboard = () => {
     },
     {
       title: '30天',
-      dataIndex: 'day30'
+      dataIndex: 'day15'
     },
     {
       title: '3个月',
@@ -75,7 +79,8 @@ const Dashboard = () => {
   const columnsCustomer = [
     {
       title: '排名',
-      dataIndex: 'rank'
+      dataIndex: 'rank',
+      valueType: 'indexBorder'
     },
     {
       title: '姓名',
@@ -160,14 +165,6 @@ const Dashboard = () => {
       增幅: 220
     }
   ]
-  const data = [
-    '新增客户 0 个,服务 0 条',
-    '新增联系人 0 个,服务 0 条',
-    '新增商机 0 个,金额 0 元,服务 0 条,赢单 0 个',
-    '新增开票 0 张,开票总金额 0 元',
-    '回款 0 条,回款总金额 0 元',
-    '支出 0 元,收入 0 元'
-  ]
   const config = {
     data: [uvBillData, transformData],
     height: 230,
@@ -191,6 +188,7 @@ const Dashboard = () => {
     <div>
       <div>
         <ProTable
+          rowKey={record => record.day7 + Date.now()}
           columns={columns}
           dataSource={state.reminderData}
           search={false}
@@ -206,7 +204,7 @@ const Dashboard = () => {
                 <Col span={6}>
                   <div className="w-48px h-48px border rounded-48px bg-[#0c7cd5] relative">
                     <span className="absolute top-9px left-9px">
-                      <iconpark-icon name="city" size="26" />
+                      <City size="26" fill="#fff" />
                     </span>
                   </div>
                 </Col>
@@ -227,7 +225,7 @@ const Dashboard = () => {
                 <Col span={6}>
                   <div className="w-48px h-48px border rounded-48px bg-[#0c7cd5] relative">
                     <span className="absolute top-10px left-10px">
-                      <iconpark-icon name="address-book" size="26" />
+                      <AddressBook size="26" fill="#fff" />
                     </span>
                   </div>
                 </Col>
@@ -248,7 +246,7 @@ const Dashboard = () => {
                 <Col span={6}>
                   <div className="w-48px h-48px border rounded-48px bg-[#0c7cd5] relative">
                     <span className="absolute top-10px left-10px">
-                      <iconpark-icon name="finance" size="26" />
+                      <Finance size="26" fill="#fff" />
                     </span>
                   </div>
                 </Col>
@@ -269,7 +267,7 @@ const Dashboard = () => {
                 <Col span={6}>
                   <div className="w-48px h-48px border rounded-48px bg-[#0c7cd5] relative">
                     <span className="absolute top-10px left-10px">
-                      <iconpark-icon name="comment" size="26" />
+                      <Comment size="26" fill="#fff" />
                     </span>
                   </div>
                 </Col>
@@ -305,13 +303,24 @@ const Dashboard = () => {
             </div>
           </Col>
           <Col className="gutter-row" span={8}>
-            <div className="bg-white rounded-lg">
-              <List
-                header={<div>数据汇总</div>}
-                bordered
-                dataSource={data}
-                renderItem={item => <List.Item>{item}</List.Item>}
-              />
+            <div className="bg-white border rounded-lg">
+              <h4 className="px-12px py-16px border-b-1">数据汇总</h4>
+              <ul>
+                <li className="px-12px py-16px border-b-1">
+                  新增客户<b className="px-1">{state.aggregation.customerCount}</b>个,服务
+                  <b className="px-1">{state.aggregation.customerServiceCount}</b>条
+                </li>
+                <li className="px-12px py-16px border-b-1">
+                  新增联系人<b className="px-1">{state.aggregation.clientCount}</b>个,服务
+                  <b className="px-1">{state.aggregation.clientServiceCount}</b> 条
+                </li>
+                <li className="px-12px py-16px">
+                  新增商机<b className="px-1">{state.aggregation.businessCount}</b>个,金额
+                  <b className="px-1">{state.aggregation.businessSum}</b> 元,服务
+                  <b className="px-1">{state.aggregation.businessServiceCount}</b>
+                  条,赢单<b className="px-1">{state.aggregation.businessWinCount}</b>个
+                </li>
+              </ul>
             </div>
           </Col>
         </Row>
@@ -337,6 +346,7 @@ const Dashboard = () => {
               </div>
               <div className="text-center">新增客户排行榜</div>
               <ProTable
+                rowKey={record => record.rank}
                 columns={columnsCustomer}
                 dataSource={state.leaderboard}
                 search={false}