Przeglądaj źródła

feat: 仪表盘环比数据

outaozhen 5 lat temu
rodzic
commit
16f38c10be
2 zmienionych plików z 64 dodań i 19 usunięć
  1. 1 1
      src/pages/document.ejs
  2. 63 18
      src/pages/workbench/Dashboard/index.jsx

+ 1 - 1
src/pages/document.ejs

@@ -24,7 +24,7 @@
   <body>
     <script
       defer
-      src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_1832_48.a9a2c5f5656a3a0ef4c4ab51a31accd5.js"
+      src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_1832_49.5a251ec91e1c2f50fa8fe47441080413.js"
     ></script>
     <noscript>Out-of-the-box mid-stage front/design solution!</noscript>
     <div id="root">

+ 63 - 18
src/pages/workbench/Dashboard/index.jsx

@@ -9,15 +9,34 @@ const Dashboard = () => {
   const { Option } = Select
   const [state, setState] = useState({
     reminderData: [],
-    leaderboard: []
+    leaderboard: [],
+    clientChainRatio: {},
+    customerChainRatio: {},
+    businessChainRatio: {},
+    serviceLogChainRatio: {}
   })
   const initData = async payload => {
     const {
       code = -1,
-      data: { reminderData = [], leaderboard = [] } = { reminderData: [], leaderboard: [] }
+      data: {
+        reminderData = [],
+        leaderboard = [],
+        clientChainRatio = {},
+        customerChainRatio = {},
+        businessChainRatio = {},
+        serviceLogChainRatio = {}
+      }
     } = await queryDashboard(payload)
     if (code === consts.RET_CODE.SUCCESS) {
-      setState({ ...state, reminderData, leaderboard })
+      setState({
+        ...state,
+        reminderData,
+        leaderboard,
+        clientChainRatio,
+        customerChainRatio,
+        businessChainRatio,
+        serviceLogChainRatio
+      })
     }
   }
   useEffect(() => {
@@ -56,15 +75,15 @@ const Dashboard = () => {
   const columnsCustomer = [
     {
       title: '排名',
-      dataIndex: 'search'
+      dataIndex: 'rank'
     },
     {
       title: '姓名',
-      dataIndex: 'staff_name'
+      dataIndex: 'clientStaffName'
     },
     {
       title: '新增客户数',
-      dataIndex: 'count'
+      dataIndex: 'clientCount'
     }
   ]
   const uvBillData = [
@@ -184,13 +203,19 @@ const Dashboard = () => {
           <Col className="gutter-row" span={6}>
             <div className="p-4 bg-white border rounded-lg">
               <Row>
-                <Col span={6}>a</Col>
+                <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" />
+                    </span>
+                  </div>
+                </Col>
                 <Col span={9}>
-                  <h3 className="text-2xl">23</h3>
+                  <h3 className="text-2xl">{state.customerChainRatio.count}</h3>
                   <span>新增客户</span>
                 </Col>
                 <Col span={9} className="text-right">
-                  <h3 className="text-xl text-green-500">+10%</h3>
+                  <h3 className="text-xl text-green-500">{state.customerChainRatio.percentage}</h3>
                   <span>较上月</span>
                 </Col>
               </Row>
@@ -199,13 +224,19 @@ const Dashboard = () => {
           <Col className="gutter-row" span={6}>
             <div className="p-4 bg-white border rounded-lg">
               <Row>
-                <Col span={6}>a</Col>
+                <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" />
+                    </span>
+                  </div>
+                </Col>
                 <Col span={9}>
-                  <h3 className="text-2xl">10</h3>
+                  <h3 className="text-2xl">{state.clientChainRatio.count}</h3>
                   <span>新增联系人</span>
                 </Col>
                 <Col span={9} className="text-right">
-                  <h3 className="text-xl text-red-500">-8%</h3>
+                  <h3 className="text-xl text-red-500">{state.clientChainRatio.percentage}</h3>
                   <span>较上月</span>
                 </Col>
               </Row>
@@ -214,13 +245,19 @@ const Dashboard = () => {
           <Col className="gutter-row" span={6}>
             <div className="p-4 bg-white border rounded-lg">
               <Row>
-                <Col span={6}>a</Col>
+                <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" />
+                    </span>
+                  </div>
+                </Col>
                 <Col span={9}>
-                  <h3 className="text-2xl">5</h3>
+                  <h3 className="text-2xl">{state.businessChainRatio.count}</h3>
                   <span>新增商机</span>
                 </Col>
                 <Col span={9} className="text-right">
-                  <h3 className="text-xl text-green-500">+10%</h3>
+                  <h3 className="text-xl text-green-500">{state.businessChainRatio.percentage}</h3>
                   <span>较上月</span>
                 </Col>
               </Row>
@@ -229,13 +266,21 @@ const Dashboard = () => {
           <Col className="gutter-row" span={6}>
             <div className="p-4 bg-white border rounded-lg">
               <Row>
-                <Col span={6}>a</Col>
+                <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" />
+                    </span>
+                  </div>
+                </Col>
                 <Col span={9}>
-                  <h3 className="text-2xl">32</h3>
+                  <h3 className="text-2xl">{state.serviceLogChainRatio.count}</h3>
                   <span>服务记录</span>
                 </Col>
                 <Col span={9} className="text-right">
-                  <h3 className="text-xl text-green-500">+10%</h3>
+                  <h3 className="text-xl text-green-500">
+                    {state.serviceLogChainRatio.percentage}
+                  </h3>
                   <span>较上月</span>
                 </Col>
               </Row>