Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
3
3DWeb
Project
Project
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
cms-cyx-永祥
3DWeb
Commits
3d828049
Commit
3d828049
authored
Oct 31, 2022
by
LiXiaoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:转矩变量取值不正确
parent
6edfc55e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
64 deletions
+65
-64
index.js
js/index.js
+65
-64
No files found.
js/index.js
View file @
3d828049
...
@@ -2,17 +2,17 @@ let baseUrl = 'http://183.24.11.2:8802/api/'
...
@@ -2,17 +2,17 @@ let baseUrl = 'http://183.24.11.2:8802/api/'
//图表1
//图表1
getIndicators
()
getIndicators
()
setInterval
(()
=>
{
setInterval
(()
=>
{
getIndicators
()
getIndicators
()
},
1000
)
},
1000
)
function
getIndicators
()
{
function
getIndicators
()
{
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
dataType
:
"json"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
(
[
"PRO_EFF"
,
"PRO_EFF"
,
"ACT_EFF"
]),
data
:
JSON
.
stringify
(
[
"PRO_EFF"
,
"PRO_EFF"
,
"ACT_EFF"
]),
success
:
function
(
res
)
{
success
:
function
(
res
)
{
document
.
getElementById
(
'pro_eff'
).
innerText
=
res
.
data
[
0
].
Value
document
.
getElementById
(
'pro_eff'
).
innerText
=
res
.
data
[
0
].
Value
document
.
getElementById
(
'per_eff'
).
innerText
=
res
.
data
[
1
].
Value
document
.
getElementById
(
'per_eff'
).
innerText
=
res
.
data
[
1
].
Value
document
.
getElementById
(
'act_eff'
).
innerText
=
res
.
data
[
2
].
Value
document
.
getElementById
(
'act_eff'
).
innerText
=
res
.
data
[
2
].
Value
...
@@ -22,7 +22,7 @@ function getIndicators(){
...
@@ -22,7 +22,7 @@ function getIndicators(){
//图表2
//图表2
getProcess
()
getProcess
()
function
getProcess
()
{
function
getProcess
()
{
let
mycharts
=
echarts
.
init
(
document
.
getElementById
(
'act_torque'
))
let
mycharts
=
echarts
.
init
(
document
.
getElementById
(
'act_torque'
))
let
name
=
[
'电机功率1'
,
'电机功率2'
,
'电机功率3'
,
'电机功率4'
,
'电机功率5'
]
let
name
=
[
'电机功率1'
,
'电机功率2'
,
'电机功率3'
,
'电机功率4'
,
'电机功率5'
]
let
option
=
{
let
option
=
{
...
@@ -77,16 +77,16 @@ function getProcess(){
...
@@ -77,16 +77,16 @@ function getProcess(){
verticalAlign
:
'center'
,
verticalAlign
:
'center'
,
lineHeight
:
40
,
lineHeight
:
40
,
fontSize
:
14
,
fontSize
:
14
,
formatter
:
function
(
value
)
{
formatter
:
function
(
value
)
{
return
Number
(
value
)
?
value
:
0
return
Number
(
value
)
?
value
:
0
},
},
}
}
}],
}],
series
:
[{
series
:
[{
type
:
'bar'
,
type
:
'bar'
,
data
:
[
0
,
0
,
0
,
0
,
0
],
data
:
[
0
,
0
,
0
,
0
,
0
],
showBackground
:
true
,
showBackground
:
true
,
backgroundStyle
:{
backgroundStyle
:
{
color
:
'#0C2648'
color
:
'#0C2648'
},
},
yAxisIndex
:
0
,
yAxisIndex
:
0
,
...
@@ -102,19 +102,19 @@ function getProcess(){
...
@@ -102,19 +102,19 @@ function getProcess(){
mycharts
.
setOption
(
option
)
mycharts
.
setOption
(
option
)
setInterval
(
function
()
{
setInterval
(
function
()
{
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
dataType
:
"json"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
(
[
"ACT_TORQUE1"
,
"ACT_TORQUE2"
,
"ACT_TORQUE3"
,
"ACT_TORQUE4"
,
"ACT_TORQUE5"
]),
data
:
JSON
.
stringify
(
[
"ACT_TORQUE1"
,
"ACT_TORQUE2"
,
"ACT_TORQUE3"
,
"ACT_TORQUE4"
,
"ACT_TORQUE5"
]),
success
:
function
(
res
)
{
success
:
function
(
res
)
{
let
data
=
[]
let
data
=
[]
name
.
forEach
((
item
,
i
)
=>
{
name
.
forEach
((
item
,
i
)
=>
{
data
.
push
(
res
.
data
[
i
].
Value
?
res
.
data
[
i
].
Value
:
0
)
data
.
push
(
res
.
data
[
i
].
Value
?
res
.
data
[
i
].
Value
:
0
)
})
})
mycharts
.
setOption
({
mycharts
.
setOption
({
yAxis
:
[
yAxis
:
[
{},{
{},
{
data
:
data
data
:
data
}
}
],
],
...
@@ -131,7 +131,7 @@ function getProcess(){
...
@@ -131,7 +131,7 @@ function getProcess(){
//图表3
//图表3
getTorque
()
getTorque
()
function
getTorque
()
{
function
getTorque
()
{
let
mycharts
=
echarts
.
init
(
document
.
getElementById
(
'torque'
))
let
mycharts
=
echarts
.
init
(
document
.
getElementById
(
'torque'
))
let
xAxis
=
[]
let
xAxis
=
[]
let
data1
=
[]
let
data1
=
[]
...
@@ -140,19 +140,19 @@ function getTorque(){
...
@@ -140,19 +140,19 @@ function getTorque(){
let
color
=
[
'#2E86DF'
,
'#F5BD5F'
];
let
color
=
[
'#2E86DF'
,
'#F5BD5F'
];
let
option
=
{
let
option
=
{
color
:
color
,
color
:
color
,
grid
:{
grid
:
{
top
:
40
,
top
:
40
,
right
:
10
,
right
:
10
,
bottom
:
0
,
bottom
:
0
,
left
:
10
,
left
:
10
,
containLabel
:
true
containLabel
:
true
},
},
legend
:{
legend
:
{
right
:
0
,
right
:
0
,
icon
:
'rect'
,
icon
:
'rect'
,
itemWidth
:
20
,
itemWidth
:
20
,
itemHeight
:
2
,
itemHeight
:
2
,
textStyle
:{
textStyle
:
{
color
:
'#fff'
color
:
'#fff'
}
}
},
},
...
@@ -182,7 +182,7 @@ function getTorque(){
...
@@ -182,7 +182,7 @@ function getTorque(){
},
},
splitLine
:
{
splitLine
:
{
show
:
true
,
show
:
true
,
lineStyle
:{
lineStyle
:
{
color
:
'rgba(50, 71, 106, .4)'
color
:
'rgba(50, 71, 106, .4)'
}
}
},
},
...
@@ -222,7 +222,7 @@ function getTorque(){
...
@@ -222,7 +222,7 @@ function getTorque(){
fontWeight
:
500
,
fontWeight
:
500
,
fontSize
:
14
fontSize
:
14
}
}
},{
},
{
type
:
'scatter'
,
type
:
'scatter'
,
stack
:
'1'
,
stack
:
'1'
,
symbolOffset
:
[
-
11
,
0
],
//相对于原本位置的偏移量
symbolOffset
:
[
-
11
,
0
],
//相对于原本位置的偏移量
...
@@ -239,7 +239,7 @@ function getTorque(){
...
@@ -239,7 +239,7 @@ function getTorque(){
}
}
},
},
z
:
2
z
:
2
},{
},
{
type
:
'scatter'
,
type
:
'scatter'
,
stack
:
'2'
,
stack
:
'2'
,
symbolOffset
:
[
11
,
0
],
//相对于原本位置的偏移量
symbolOffset
:
[
11
,
0
],
//相对于原本位置的偏移量
...
@@ -260,37 +260,38 @@ function getTorque(){
...
@@ -260,37 +260,38 @@ function getTorque(){
]
]
};
};
mycharts
.
setOption
(
option
)
mycharts
.
setOption
(
option
)
setInterval
(()
=>
{
setInterval
(()
=>
{
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
dataType
:
"json"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
(
[
"PROWER1"
,
"PROWER2"
]),
data
:
JSON
.
stringify
([
"PROWER1"
,
"PROWER2"
]),
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
xAxis
.
length
===
6
)
{
if
(
xAxis
.
length
===
6
)
{
data1
.
shift
()
data1
.
shift
()
data2
.
shift
()
data2
.
shift
()
xAxis
.
shift
()
xAxis
.
shift
()
dataScatter
.
shift
()
dataScatter
.
shift
()
}
}
console
.
log
(
res
)
data1
.
push
(
res
.
data
[
0
].
Value
)
data1
.
push
(
res
.
data
[
0
].
Value
)
data2
.
push
(
res
.
data
[
1
].
Value
)
data2
.
push
(
res
.
data
[
1
].
Value
)
dataScatter
.
push
(
0
)
dataScatter
.
push
(
0
)
// let now = new Date();
// let now = new Date();
xAxis
.
push
(
/* now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() */
dayjs
(
new
Date
()).
format
(
'HH:mm:ss'
))
xAxis
.
push
(
/* now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() */
dayjs
(
new
Date
()).
format
(
'HH:mm:ss'
))
mycharts
.
setOption
({
mycharts
.
setOption
({
xAxis
:{
xAxis
:
{
data
:
xAxis
data
:
xAxis
},
},
series
:
[
series
:
[
{
{
data
:
data1
data
:
data1
},{
},
{
data
:
data2
data
:
data2
},{
},
{
data
:
dataScatter
data
:
dataScatter
},{
},
{
data
:
dataScatter
data
:
dataScatter
}
}
]
]
...
@@ -316,7 +317,7 @@ function getRight1 () {
...
@@ -316,7 +317,7 @@ function getRight1 () {
legend
:
{
legend
:
{
data
:
legendData
,
data
:
legendData
,
textStyle
:
{
textStyle
:
{
color
:
'#fff'
color
:
'#fff'
},
},
right
:
0
,
right
:
0
,
},
},
...
@@ -344,7 +345,7 @@ function getRight1 () {
...
@@ -344,7 +345,7 @@ function getRight1 () {
yAxis
:
[{
yAxis
:
[{
type
:
'value'
,
type
:
'value'
,
axisTick
:
{
axisTick
:
{
show
:
false
show
:
false
},
},
axisLabel
:
{
axisLabel
:
{
color
:
'#fff'
color
:
'#fff'
...
@@ -392,31 +393,31 @@ function getRight1 () {
...
@@ -392,31 +393,31 @@ function getRight1 () {
]
]
}
}
rightChart1
.
setOption
(
rightOption1
)
rightChart1
.
setOption
(
rightOption1
)
setInterval
(()
=>
{
setInterval
(()
=>
{
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
dataType
:
"json"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
(
[
"TORQUE1"
,
"TORQUE2"
]),
data
:
JSON
.
stringify
([
"TORQUE1"
,
"TORQUE2"
]),
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
xData
.
length
===
6
)
{
if
(
xData
.
length
===
6
)
{
seriesData1
.
shift
()
seriesData1
.
shift
()
seriesData2
.
shift
()
seriesData2
.
shift
()
xData
.
shift
()
xData
.
shift
()
}
}
seriesData1
.
push
(
res
.
data
[
0
].
Value
?
res
.
data
[
0
].
Value
:
0
)
seriesData1
.
push
(
res
.
data
[
0
].
Value
?
res
.
data
[
0
].
Value
:
0
)
seriesData2
.
push
(
res
.
data
[
1
].
Value
?
res
.
data
[
0
].
Value
:
0
)
seriesData2
.
push
(
res
.
data
[
1
].
Value
?
res
.
data
[
1
].
Value
:
0
)
// let now = new Date();
// let now = new Date();
xData
.
push
(
/* now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() */
dayjs
(
new
Date
()).
format
(
'HH:mm:ss'
))
xData
.
push
(
/* now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() */
dayjs
(
new
Date
()).
format
(
'HH:mm:ss'
))
rightChart1
.
setOption
({
rightChart1
.
setOption
({
xAxis
:{
xAxis
:
{
data
:
xData
data
:
xData
},
},
series
:
[
series
:
[
{
{
data
:
seriesData1
data
:
seriesData1
},{
},
{
data
:
seriesData2
data
:
seriesData2
}
}
]
]
...
@@ -429,11 +430,11 @@ function getRight1 () {
...
@@ -429,11 +430,11 @@ function getRight1 () {
/* 右侧第二个 */
/* 右侧第二个 */
getRight2
()
getRight2
()
function
getRight2
()
{
function
getRight2
()
{
let
rightChart2
=
echarts
.
init
(
document
.
getElementById
(
'right2'
));
let
rightChart2
=
echarts
.
init
(
document
.
getElementById
(
'right2'
));
let
xData
=
[
'电机转矩1'
,
'电机转矩2'
,
'电机转矩3'
,
'电机转矩4'
,
'电机转矩5'
]
let
xData
=
[
'电机转矩1'
,
'电机转矩2'
,
'电机转矩3'
,
'电机转矩4'
,
'电机转矩5'
]
let
valueData
=
[]
let
valueData
=
[]
let
rightOption2
=
{
let
rightOption2
=
{
// tooltip: {
// tooltip: {
// trigger: 'axis',
// trigger: 'axis',
// axisPointer: {
// axisPointer: {
...
@@ -497,7 +498,7 @@ function getRight2() {
...
@@ -497,7 +498,7 @@ function getRight2() {
{
{
barWidth
:
4
,
barWidth
:
4
,
showBackground
:
true
,
showBackground
:
true
,
backgroundStyle
:{
backgroundStyle
:
{
color
:
'#0C2648'
color
:
'#0C2648'
},
},
type
:
'bar'
,
type
:
'bar'
,
...
@@ -517,19 +518,19 @@ function getRight2() {
...
@@ -517,19 +518,19 @@ function getRight2() {
rightChart2
.
setOption
(
rightOption2
);
rightChart2
.
setOption
(
rightOption2
);
setInterval
(
function
()
{
setInterval
(
function
()
{
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
url
:
baseUrl
+
"/Base/PostRediusTest"
,
dataType
:
"json"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
(
[
"ACT_TORQUE1"
,
"ACT_TORQUE2"
,
"ACT_TORQUE3"
,
"ACT_TORQUE4"
,
"ACT_TORQUE5"
]),
data
:
JSON
.
stringify
(
[
"ACT_TORQUE1"
,
"ACT_TORQUE2"
,
"ACT_TORQUE3"
,
"ACT_TORQUE4"
,
"ACT_TORQUE5"
]),
success
:
function
(
res
)
{
success
:
function
(
res
)
{
let
data
=
[]
let
data
=
[]
xData
.
forEach
((
item
,
i
)
=>
{
xData
.
forEach
((
item
,
i
)
=>
{
data
.
push
(
res
.
data
[
i
].
Value
?
res
.
data
[
i
].
Value
:
0
)
data
.
push
(
res
.
data
[
i
].
Value
?
res
.
data
[
i
].
Value
:
0
)
})
})
rightChart2
.
setOption
({
rightChart2
.
setOption
({
yAxis
:
[
yAxis
:
[
{},{
{},
{
data
:
data
data
:
data
}
}
],
],
...
@@ -550,17 +551,17 @@ setInterval(() => {
...
@@ -550,17 +551,17 @@ setInterval(() => {
getRight3
()
getRight3
()
},
1000
)
},
1000
)
let
alarmItem
=
[]
let
alarmItem
=
[]
function
getRight3
()
{
function
getRight3
()
{
let
alarm
=
document
.
getElementById
(
'alarm'
)
let
alarm
=
document
.
getElementById
(
'alarm'
)
let
alarmData
=
document
.
getElementById
(
'alarmData'
)
let
alarmData
=
document
.
getElementById
(
'alarmData'
)
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
baseUrl
+
"/HMI/HMI_GstAlarms"
,
url
:
baseUrl
+
"/HMI/HMI_GstAlarms"
,
dataType
:
"json"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
contentType
:
"application/json"
,
// '【报警时间】【报警变量】【报警地址】【报警类别】【报警组】【报警设备】【报警文本】【报警值】'
// '【报警时间】【报警变量】【报警地址】【报警类别】【报警组】【报警设备】【报警文本】【报警值】'
data
:
JSON
.
stringify
({
Lang
:
'Main_Language_ZH'
,
AlarmFormat
:
'【报警时间】【报警变量】【报警地址】【报警类别】【报警组】【报警设备】【报警文本】'
,
Variables
:
[
"A1"
,
"B1"
,
"E1"
,
"G1"
,
"in_A1"
,
"in_B1"
,
"in_E1"
,
"in_G1"
]
}),
data
:
JSON
.
stringify
({
Lang
:
'Main_Language_ZH'
,
AlarmFormat
:
'【报警时间】【报警变量】【报警地址】【报警类别】【报警组】【报警设备】【报警文本】'
,
Variables
:
[
"A1"
,
"B1"
,
"E1"
,
"G1"
,
"in_A1"
,
"in_B1"
,
"in_E1"
,
"in_G1"
]
}),
success
:
function
(
res
)
{
success
:
function
(
res
)
{
// console.log("res",res)
// console.log("res",res)
alarmData
.
innerText
=
res
.
data
.
length
alarmData
.
innerText
=
res
.
data
.
length
let
str
=
``
let
str
=
``
...
...
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