张延森 3 年之前
父節點
當前提交
5bdd306227

+ 3
- 6
src/pages/dashboard/components/BannerStatis.jsx 查看文件

@@ -7,12 +7,9 @@ import StatisCard from './StatisCard';
7 7
 import StatisGroup from './StatisGroup';
8 8
 
9 9
 const colorList = [
10
-  { backColor: '#69c0ff', frontColor: '#000' },
11
-  { backColor: '#95de64', frontColor: '#000' },
12
-  { backColor: '#5cdbd3', frontColor: '#000' },
13
-  { backColor: '#85a5ff', frontColor: '#000' },
14
-  { backColor: '#b37feb', frontColor: '#000' },
15
-  { backColor: '#ffd666', frontColor: '#000' },
10
+  { backColor: '#126BAE', frontColor: '#fff' },
11
+  { backColor: '#66A9C9', frontColor: '#fff' },
12
+  { backColor: '#08507b', frontColor: '#fff' },
16 13
 ]
17 14
 
18 15
 export default (props) => {

+ 15
- 4
src/pages/dashboard/components/OrgSummary.jsx 查看文件

@@ -4,6 +4,7 @@ import { Card } from 'antd'
4 4
 import { getList } from '@/services/org'
5 5
 
6 6
 const barOption = {
7
+  color: ['#08507b'],
7 8
   tooltip: {
8 9
     trigger: 'axis',
9 10
     axisPointer: {
@@ -12,13 +13,17 @@ const barOption = {
12 13
     formatter: (params) => `人次: ${params[0].data.totalReportNum || 0}`
13 14
   },
14 15
   grid: {
15
-    containLabel: true
16
+    containLabel: true,
17
+    left: 0,
18
+    top: 0,
19
+    right: 60,
20
+    bottom: 0,
16 21
   }, 
17 22
   yAxis: {
18 23
     type: 'category',
19 24
     axisLabel: {
20
-      rotate: 45,
21
-      formatter: (value) => value.length > 5 ? value.substring(0, 5) + '...' : value,
25
+      // rotate: 45,
26
+      formatter: (value) => value.length > 10 ? value.substring(0, 10) + '...' : value,
22 27
       color: (value, index) => 'black'
23 28
     },
24 29
   },
@@ -30,7 +35,13 @@ const barOption = {
30 35
       type: 'slider',
31 36
       yAxisIndex: [0],
32 37
       start: 100,
33
-      end: 80
38
+      end: 80,
39
+      // width: 10,
40
+      // fillerColor: '#08507b',
41
+      selectedDataBackground: {
42
+        areaStyle: { color: '#08507b', },
43
+        lineStyle: { color: '#08507b', width: 1 },
44
+      }
34 45
     },
35 46
     {
36 47
       type: 'inside',

+ 46
- 18
src/pages/dashboard/components/ReportList.jsx 查看文件

@@ -1,5 +1,5 @@
1 1
 import moment from 'moment'
2
-import { Card, List } from 'antd'
2
+import { Card, List, Badge, Space, Carousel } from 'antd'
3 3
 import { useCallback, useEffect, useMemo, useState } from 'react'
4 4
 import { getList } from '@/services/work'
5 5
 import { random } from '@/utils/number'
@@ -39,6 +39,21 @@ const Avatar = (props) => {
39 39
   return <div style={style}>{props.children}</div>
40 40
 }
41 41
 
42
+
43
+const Content = (props) => {
44
+  const { item } = props;
45
+
46
+  const abnormal = item.antigenIsNormal === 0 || item.nucleicIsNormal === 0
47
+  const status = abnormal ? 'error' : 'success'
48
+
49
+  return (
50
+    <Space size="large">
51
+      <span><Badge status={status} /> { abnormal ? '异常' : '正常' }</span>
52
+      <span>{moment(item.createDate).format('HH:mm')}</span>
53
+    </Space>
54
+  )
55
+}
56
+
42 57
 export default (props) => {
43 58
   const [loading, setLoading] = useState(false)
44 59
   const [list, setList] = useState([])
@@ -47,13 +62,13 @@ export default (props) => {
47 62
     setLoading(true)
48 63
     getList(
49 64
       {
50
-        pageSize: 500,
65
+        pageSize: 50, // 过多会很卡
51 66
         start: moment().format('YYYY-MM-DD'),
52 67
         end: moment().format('YYYY-MM-DD'),
53 68
         isAll: true
54 69
       }).then(res => {
55 70
         setLoading(false)
56
-        setList(res.records)
71
+        setList((res.records || []).reverse())
57 72
       }).catch(er => {
58 73
         setLoading(false)
59 74
       })
@@ -65,21 +80,34 @@ export default (props) => {
65 80
 
66 81
   return (
67 82
     <Card title="今日提交记录" loading={loading} bodyStyle={{ height: 600 }}>
68
-      <List
69
-        itemLayout="horizontal"
70
-        dataSource={list}
71
-        renderItem={item => (
72
-          <List.Item>
73
-            <List.Item.Meta
74
-              avatar={<Avatar>{item.orgName.substring(0,1)}</Avatar>}
75
-              title={item.userName}
76
-              con
77
-              description={item.orgName}
78
-            />
79
-            <div>{moment(item.createDate).format('HH:mm')}</div>
80
-          </List.Item>
81
-        )}
82
-      />
83
+      <List style={{ height: '100%', overflow: 'hidden' }} itemLayout="horizontal">
84
+        <Carousel
85
+          autoplay
86
+          infinite
87
+          rtl
88
+          slidesToShow={8}
89
+          slidesToScroll={1}
90
+          dot={false}
91
+          dotPosition="right"
92
+          style={{ height: '100%' }}
93
+        >
94
+          {
95
+            list.map(item => (
96
+              <div key={item.formId} style={{ display: 'flex' }}>
97
+                <List.Item>
98
+                  <List.Item.Meta
99
+                    avatar={<Avatar>{item.orgName.substring(0,1)}</Avatar>}
100
+                    title={item.userName}
101
+                    con
102
+                    description={item.orgName}
103
+                  />
104
+                  <Content item={item} />
105
+                </List.Item>
106
+              </div>
107
+            ))
108
+          }
109
+        </Carousel>
110
+      </List>
83 111
     </Card>
84 112
   )
85 113
 }

+ 20
- 7
src/pages/dashboard/components/StatisGroup.jsx 查看文件

@@ -4,14 +4,14 @@ import { StatisticCard } from '@ant-design/pro-card';
4 4
 const { Divider } = StatisticCard;
5 5
 const iconDivStyle = {
6 6
   position: 'absolute',
7
-  top: '-20px',
8
-  right: '20px',
7
+  top: '4px',
8
+  right: '-30px',
9 9
 }
10 10
 
11 11
 const iconStyle = {
12
-  fontSize: '5em',
12
+  fontSize: '10em',
13 13
   color: '#fff',
14
-  opacity: 0.3,
14
+  opacity: 0.45,
15 15
 }
16 16
 
17 17
 export default (props) => {
@@ -24,7 +24,9 @@ export default (props) => {
24 24
 
25 25
   const bodyStyle = {
26 26
     background: backColor,
27
+    color: frontColor,
27 28
     position: 'relative',
29
+    overflow: 'hidden',
28 30
   }
29 31
 
30 32
   const groupBodyStyle = {
@@ -36,16 +38,27 @@ export default (props) => {
36 38
     color: frontColor
37 39
   }
38 40
 
41
+  const headTitleStyle = {
42
+    color: frontColor,
43
+    fontSize: '19px',
44
+    fontWeight: 700,
45
+    letterSpacing: '2px',
46
+  }
47
+
48
+  const titleStyle = {
49
+    color: frontColor,
50
+  }
51
+
39 52
   return (
40
-    <StatisticCard.Group title={title} headStyle={headStyle} bodyStyle={groupBodyStyle}>
53
+    <StatisticCard.Group title={<div style={headTitleStyle}>{title}</div>} headStyle={headStyle} bodyStyle={groupBodyStyle}>
41 54
       <StatisticCard
42 55
         bodyStyle={bodyStyle}
43
-        statistic={{ ...data1, valueStyle }}
56
+        statistic={{ ...data1, title: (<div style={titleStyle}>{data1.title}</div>), valueStyle }}
44 57
       />
45 58
       <Divider type="vertical" />
46 59
       <StatisticCard
47 60
         bodyStyle={bodyStyle}
48
-        statistic={{ ...data2, valueStyle }}
61
+        statistic={{ ...data2, title: (<div style={titleStyle}>{data2.title}</div>), valueStyle }}
49 62
       />
50 63
       {
51 64
         icon && (

+ 2
- 2
src/pages/dashboard/index.jsx 查看文件

@@ -10,8 +10,8 @@ export default (props) => {
10 10
       <BannerStatis />
11 11
 
12 12
       <Row gutter={24}>
13
-        <Col span={16}><OrgSummary /></Col>
14
-        <Col span={8}>
13
+        <Col span={12}><OrgSummary /></Col>
14
+        <Col span={12}>
15 15
           <ReportList />
16 16
         </Col>
17 17
       </Row>