Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
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
wuhao
ems3.3
Commits
a06fc420
Commit
a06fc420
authored
Sep 15, 2023
by
左玲玲
😬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
状态查看
parent
24e9a501
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
394 additions
and
72 deletions
+394
-72
index.jsx
src/components/Statuschart/index.jsx
+178
-0
global.less
src/global.less
+5
-0
index.jsx
src/pages/lease/contract/index.jsx
+4
-1
index.jsx
src/pages/lease/costanalysis/index.jsx
+4
-1
index.jsx
src/pages/lease/leasedevice/index.jsx
+3
-3
Devicestatus.jsx
src/pages/lease/ledger/Devicestatus.jsx
+200
-67
No files found.
src/components/Statuschart/index.jsx
0 → 100644
View file @
a06fc420
import
React
,
{
useState
,
useMemo
,
useEffect
}
from
'react'
;
import
{
Card
,
Form
,
Divider
,
Empty
,
Spin
,
Button
}
from
'antd'
;
import
ReactEcharts
from
'echarts-for-react'
;
import
{
useRequest
,
useAsyncEffect
}
from
"ahooks"
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
*
as
echarts
from
"echarts"
;
import
moment
from
'moment'
;
const
Statuschart
=
({
statusData
=
[],
statusColorList
=
[],
barStyle
})
=>
{
const
[
datas
,
cdatas
]
=
useState
([]);
useEffect
(()
=>
{
cdatas
([]);
statusData
?.
map
((
it
,
i
)
=>
{
let
arrs
=
resetData
(
it
.
value
,
i
,
it
.
name
);
cdatas
(
datas
=>
[...
datas
,
...
arrs
]);
})
},
[
statusData
]);
function
resetData
(
data
,
index
,
parentName
)
{
let
reslist
=
data
?.
map
((
it
,
i
)
=>
{
let
time
=
it
.
value
[
0
],
endtime
=
it
.
value
[
1
];
let
typeItem
=
statusColorList
.
filter
((
item
)
=>
it
.
name
==
item
.
type
)[
0
];
let
baseTime
=
moment
(
time
).
valueOf
(),
endTime
=
moment
(
endtime
).
valueOf
(),
duration
=
moment
(
endtime
).
diff
(
moment
(
time
),
'milliseconds'
);
return
{
name
:
typeItem
?.
name
,
value
:
[
index
,
baseTime
,
endTime
,
duration
],
itemStyle
:
{
color
:
typeItem
?.
color
},
parentName
:
parentName
}
})
??
[];
return
reslist
;
}
function
renderItem
(
params
,
api
)
{
var
categoryIndex
=
api
.
value
(
0
);
var
start
=
api
.
coord
([
api
.
value
(
1
),
categoryIndex
]);
var
end
=
api
.
coord
([
api
.
value
(
2
),
categoryIndex
]);
var
height
=
api
.
size
([
0
,
1
])[
1
]
*
0.8
;
var
rectShape
=
echarts
.
graphic
.
clipRectByRect
({
x
:
start
[
0
],
y
:
start
[
1
]
-
height
/
2
,
width
:
end
[
0
]
-
start
[
0
],
height
:
height
},
{
x
:
params
.
coordSys
.
x
,
y
:
params
.
coordSys
.
y
,
width
:
params
.
coordSys
.
width
,
height
:
params
.
coordSys
.
height
*
0.8
});
return
rectShape
&&
{
type
:
'rect'
,
shape
:
rectShape
,
style
:
api
.
style
(),
transition
:
[
'shape'
]
};
};
const
options
=
useMemo
(()
=>
{
let
xAxisoption
=
{
min
:
'dataMin'
,
max
:
'dataMax'
,
scale
:
true
,
axisLine
:
{
show
:
false
},
axisTick
:
{
show
:
false
},
splitLine
:
{
show
:
false
},
axisLabel
:
{
formatter
:
(
val
)
=>
{
let
item
=
moment
(
val
).
format
(
"YYYY-MM-DD HH:mm:ss"
).
split
(
" "
)[
1
];
return
item
;
},
// rotate: 25
}
},
yAxisoption
=
{
data
:
statusData
?.
map
(
it
=>
it
.
name
)
??
[],
axisLine
:
{
show
:
false
},
axisTick
:
{
show
:
false
},
splitLine
:
{
show
:
false
},
axisLabel
:
{
formatter
:
(
params
)
=>
{
let
newParamsName
=
''
;
const
paramsNameNumber
=
params
.
length
;
const
provideNumber
=
10
;
const
rowNumber
=
Math
.
ceil
(
paramsNameNumber
/
provideNumber
);
if
(
paramsNameNumber
>
provideNumber
)
{
for
(
let
p
=
0
;
p
<
rowNumber
;
p
++
)
{
let
tempStr
=
''
;
const
start
=
p
*
provideNumber
;
const
end
=
start
+
provideNumber
;
if
(
p
==
rowNumber
-
1
)
{
tempStr
=
params
.
substring
(
start
,
paramsNameNumber
);
}
else
{
tempStr
=
params
.
substring
(
start
,
end
)
+
'
\
n'
;
}
newParamsName
+=
tempStr
;
}
}
else
{
newParamsName
=
params
;
}
return
newParamsName
;
},
// rotate:15
}
};
return
{
grid
:
{
left
:
10
,
right
:
"2%"
,
bottom
:
40
,
containLabel
:
true
},
tooltip
:
{
formatter
:
function
(
params
)
{
return
`设备:
${
params
?.
data
?.
parentName
}
<
br
/>
设备状态:
$
{
params
.
name
}
<
br
/>
开始时间:
$
{
moment
(
params
.
value
[
1
]).
format
(
"YYYY-MM-DD HH:mm:ss"
)}
<
br
/>
结束时间:
$
{
moment
(
params
.
value
[
2
]).
format
(
"YYYY-MM-DD HH:mm:ss"
)}
`
}
},
dataZoom: [{
type: 'slider',
filterMode: 'weakFilter',
showDataShadow: true,
labelFormatter: '',
bottom: "1%"
},
{
type: 'inside',
filterMode: 'weakFilter'
}],
xAxis: xAxisoption,
yAxis: yAxisoption,
series: [{
type: 'custom',
renderItem: renderItem,
itemStyle: {
opacity: 0.8
},
encode: {
x: [1, 2],
y: 0
},
data: datas
}]
}
}, [datas, statusData]);
return <div className='screenwh center'>
<ReactEcharts
style={{ height: "100%", width: "100%" }}
option={options}
/>
</div>
}
export default Statuschart;
\ No newline at end of file
src/global.less
View file @
a06fc420
...
@@ -586,3 +586,8 @@ ol {
...
@@ -586,3 +586,8 @@ ol {
}
}
}
}
}
}
.screenwh {
width: 100%;
height: 100%;
}
\ No newline at end of file
src/pages/lease/contract/index.jsx
View file @
a06fc420
...
@@ -532,6 +532,9 @@ function Contract(props) {
...
@@ -532,6 +532,9 @@ function Contract(props) {
}
}
},
[
activeTabKey
,
drawer
?.
val
,
drawer
?.
item
?.
id
]);
},
[
activeTabKey
,
drawer
?.
val
,
drawer
?.
item
?.
id
]);
const
tabList
=
useMemo
(()
=>
{
return
getcolumns
();
},
[
activeTabKey
]);
const
pathconfig
=
useMemo
(()
=>
{
const
pathconfig
=
useMemo
(()
=>
{
let
defpath
=
getcolumns
(
setdrawer
).
filter
((
it
)
=>
it
.
key
==
activeTabKey
)[
0
]?.
pathconfig
??
{};
let
defpath
=
getcolumns
(
setdrawer
).
filter
((
it
)
=>
it
.
key
==
activeTabKey
)[
0
]?.
pathconfig
??
{};
return
defpath
;
return
defpath
;
...
@@ -607,7 +610,7 @@ function Contract(props) {
...
@@ -607,7 +610,7 @@ function Contract(props) {
},
},
},
},
}
}
}
}
tabList=
{
getcolumns
()
}
tabList=
{
tabList
}
activeTabKey=
{
activeTabKey
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
(
key
)
=>
{
onTabChange=
{
(
key
)
=>
{
setactiveTabKey
(
key
);
setactiveTabKey
(
key
);
...
...
src/pages/lease/costanalysis/index.jsx
View file @
a06fc420
...
@@ -40,6 +40,9 @@ const Costanalysis = () => {
...
@@ -40,6 +40,9 @@ const Costanalysis = () => {
render
:
(
text
,
row
,
_
,
action
)
=>
rightExtra
(
text
,
row
,
_
,
action
),
render
:
(
text
,
row
,
_
,
action
)
=>
rightExtra
(
text
,
row
,
_
,
action
),
});
});
},
[
activeKey
]);
},
[
activeKey
]);
const
tabList
=
useMemo
(()
=>
{
return
getcolumns
();
},
[
activeKey
]);
const
rightExtra
=
(
text
,
row
,
_
,
action
)
=>
{
const
rightExtra
=
(
text
,
row
,
_
,
action
)
=>
{
return
[
return
[
activeKey
==
'item-1'
&&
<
PremButton
activeKey
==
'item-1'
&&
<
PremButton
...
@@ -208,7 +211,7 @@ const Costanalysis = () => {
...
@@ -208,7 +211,7 @@ const Costanalysis = () => {
setextraparams
({})
setextraparams
({})
}
}
}
}
activeTabKey=
{
activeKey
}
activeTabKey=
{
activeKey
}
tabList=
{
getcolumns
()
}
tabList=
{
tabList
}
pageextra=
{
'export'
}
pageextra=
{
'export'
}
formRef=
{
formRef
}
formRef=
{
formRef
}
dataSourceFieldsChange=
{
(
vals
)
=>
{
dataSourceFieldsChange=
{
(
vals
)
=>
{
...
...
src/pages/lease/leasedevice/index.jsx
View file @
a06fc420
...
@@ -92,7 +92,7 @@ const columnsa = [
...
@@ -92,7 +92,7 @@ const columnsa = [
key
:
'standbyRate'
,
key
:
'standbyRate'
,
search
:
false
,
search
:
false
,
render
:
(
_
,
row
)
=>
{
render
:
(
_
,
row
)
=>
{
return
<
span
style=
{
{
color
:
"#00bce4"
}
}
>
{
row
.
run
Rate
}
%
</
span
>
return
<
span
style=
{
{
color
:
"#00bce4"
}
}
>
{
row
.
standby
Rate
}
%
</
span
>
}
}
},
},
{
{
...
@@ -101,7 +101,7 @@ const columnsa = [
...
@@ -101,7 +101,7 @@ const columnsa = [
key
:
'alarmRate'
,
key
:
'alarmRate'
,
search
:
false
,
search
:
false
,
render
:
(
_
,
row
)
=>
{
render
:
(
_
,
row
)
=>
{
return
<
span
style=
{
{
color
:
"#fa4659"
}
}
>
{
row
.
run
Rate
}
%
</
span
>
return
<
span
style=
{
{
color
:
"#fa4659"
}
}
>
{
row
.
alarm
Rate
}
%
</
span
>
}
}
},
},
{
{
...
@@ -110,7 +110,7 @@ const columnsa = [
...
@@ -110,7 +110,7 @@ const columnsa = [
key
:
'offRate'
,
key
:
'offRate'
,
search
:
false
,
search
:
false
,
render
:
(
_
,
row
)
=>
{
render
:
(
_
,
row
)
=>
{
return
<
span
style=
{
{
color
:
"#6a737b"
}
}
>
{
row
.
run
Rate
}
%
</
span
>
return
<
span
style=
{
{
color
:
"#6a737b"
}
}
>
{
row
.
off
Rate
}
%
</
span
>
}
}
},
},
];
];
...
...
src/pages/lease/ledger/Devicestatus.jsx
View file @
a06fc420
This diff is collapsed.
Click to expand it.
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