Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hnyc-portrait
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
hnyc-portrait
Commits
c5057e02
Commit
c5057e02
authored
Apr 26, 2020
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
最多保留小数点后两位
parent
3aec206a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
7 deletions
+19
-7
index.js
src/util/index.js
+9
-0
Dashboard.jsx
src/view/Dashboard.jsx
+2
-1
Radar.recharts.jsx
src/view/Radar.recharts.jsx
+6
-5
mDashboard.jsx
src/view/mDashboard.jsx
+2
-1
No files found.
src/util/index.js
0 → 100644
View file @
c5057e02
export
const
Fixed
=
function
(
value
,
fractionDigits
)
{
let
index
=
value
.
indexOf
(
'.'
);
if
(
index
!=-
1
&&
value
.
length
>
index
+
fractionDigits
+
1
)
{
return
parseFloat
(
value
).
toFixed
(
fractionDigits
);
}
return
value
;
}
\ No newline at end of file
src/view/Dashboard.jsx
View file @
c5057e02
...
...
@@ -8,6 +8,7 @@ import Pie from './Pie';
import
Line
from
'./Line'
;
import
'./Dashboard.css'
;
import
{
Layout
,
Row
,
Col
,
Card
,
Spin
,
Divider
,
Table
,
Select
,
Empty
,
ConfigProvider
}
from
'antd'
;
import
{
Fixed
}
from
'../util'
;
const
{
Content
}
=
Layout
;
const
{
Option
}
=
Select
;
...
...
@@ -255,7 +256,7 @@ class Dashboard extends Component {
var
validateDimension
=
[];
dimension
.
map
(
item
=>
{
if
(
data
[
item
.
key
]
!=
null
)
{
validateDimension
.
push
({
key
:
item
.
key
,
name
:
item
.
name
,
value
:(
isCZD
===
true
)?
parseFloat
(
data
[
item
.
key
]).
toFixed
(
2
):
data
[
item
.
key
]});
validateDimension
.
push
({
key
:
item
.
key
,
name
:
item
.
name
,
value
:(
isCZD
===
true
)?
Fixed
(
data
[
item
.
key
],
2
):
data
[
item
.
key
]});
}
return
item
;
})
...
...
src/view/Radar.recharts.jsx
View file @
c5057e02
import
React
from
"react"
;
import
{
ResponsiveContainer
,
RadarChart
,
PolarGrid
,
PolarAngleAxis
,
PolarRadiusAxis
,
Radar
,
Tooltip
}
from
"recharts"
;
import
{
Fixed
}
from
'../util'
;
class
Basic
extends
React
.
Component
{
...
...
@@ -33,27 +34,27 @@ class Basic extends React.Component {
const
data
=
[
{
item
:
`规范度:
${
gfdLevel
}
`
,
value
:
parseFloat
(
_data
.
modelGFD
).
toFixed
(
2
)
,
value
:
Fixed
(
_data
.
modelGFD
,
2
)
,
b
:
30
},
{
item
:
`预警度:
${
yjdLevel
}
`
,
value
:
parseFloat
(
_data
.
modelYJD
).
toFixed
(
2
),
value
:
Fixed
(
_data
.
modelYJD
,
2
),
b
:
70
},
{
item
:
`配合度:
${
phdLevel
}
`
,
value
:
parseFloat
(
_data
.
modelPHD
).
toFixed
(
2
),
value
:
Fixed
(
_data
.
modelPHD
,
2
),
b
:
60
},
{
item
:
`成长度:
${
czdLevel
}
`
,
value
:
parseFloat
(
_data
.
modelCZD
).
toFixed
(
2
),
value
:
Fixed
(
_data
.
modelCZD
,
2
),
b
:
50
},
{
item
:
`诚信度:
${
cxdLevel
}
`
,
value
:
parseFloat
(
_data
.
modelCXD
).
toFixed
(
2
),
value
:
Fixed
(
_data
.
modelCXD
,
2
),
b
:
70
},
];
...
...
src/view/mDashboard.jsx
View file @
c5057e02
...
...
@@ -10,6 +10,7 @@ import './Dashboard.css';
import
{
Row
,
Col
,
Card
,
Spin
,
Divider
,
Table
,
Select
,
Empty
,
ConfigProvider
}
from
'antd'
;
import
Swiper
from
'swiper/js/swiper.js'
;
import
'swiper/css/swiper.min.css'
;
import
{
Fixed
}
from
'../util'
;
const
{
Option
}
=
Select
;
...
...
@@ -265,7 +266,7 @@ class mDashboard extends Component {
var
validateDimension
=
[];
dimension
.
map
(
item
=>
{
if
(
data
[
item
.
key
]
!=
null
)
{
validateDimension
.
push
({
key
:
item
.
key
,
name
:
item
.
name
,
value
:(
isCZD
===
true
)?
parseFloat
(
data
[
item
.
key
]).
toFixed
(
2
):
data
[
item
.
key
]});
validateDimension
.
push
({
key
:
item
.
key
,
name
:
item
.
name
,
value
:(
isCZD
===
true
)?
Fixed
(
data
[
item
.
key
],
2
):
data
[
item
.
key
]});
}
return
item
;
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment