Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bi
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
张苑
bi
Commits
f4f05fff
Commit
f4f05fff
authored
Sep 17, 2021
by
莫坚培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 去掉无用定时器
parent
343cf1b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
136 deletions
+1
-136
dashboard.js
js/dashboard.js
+1
-136
No files found.
js/dashboard.js
View file @
f4f05fff
...
...
@@ -24,19 +24,11 @@ var currentBoardNode = {} //树选中的节点
var
Controls
=
{}
var
Common
=
{}
var
time
=
5000
let
requestDataPool
=
[]
// 各个组件实时刷新的请求数据,放到一个集合里,原来的多个组件请求合并成一个请求发送
// 添加定时器
var
timer1
=
null
var
timer2
=
null
var
timer3
=
null
var
timer4
=
null
var
timer5
=
null
var
timer6
=
null
var
timer7
=
null
var
timer8
=
null
var
timer9
=
null
var
timer10
=
null
var
timer11
=
null
var
app
=
{
msg
:
function
(
message
,
style
)
{
var
css
=
{
...
...
@@ -299,26 +291,6 @@ function nodeCLick(e, treeId, treeNode, type) {
// 清除定时器
clearInterval
(
timer1
)
timer1
=
null
clearInterval
(
timer2
)
timer2
=
null
clearInterval
(
timer3
)
timer3
=
null
clearInterval
(
timer4
)
timer4
=
null
clearInterval
(
timer5
)
timer5
=
null
clearInterval
(
timer6
)
timer6
=
null
clearInterval
(
timer7
)
timer7
=
null
clearInterval
(
timer8
)
timer8
=
null
clearInterval
(
timer9
)
timer9
=
null
clearInterval
(
timer10
)
timer10
=
null
clearInterval
(
timer11
)
timer11
=
null
let
postData
=
{
appId
,
panelId
:
treeNode
.
id
,
...
...
@@ -438,9 +410,6 @@ function initCanvas() {
</div>
`
renderImage
(
index
)
// timer1 = setInterval(() => {
// renderImage(index)
// }, time)
}
else
if
(
item
.
ControlType
===
'datatextblock'
)
{
//数值显示
let
align
=
''
if
(
item
.
PropertyList
.
JustifyContent
===
'flex-start'
)
{
...
...
@@ -463,9 +432,6 @@ function initCanvas() {
</div>`
renderDataText
(
index
)
// timer2 = setInterval(() => {
// renderDataText(index)
// }, time)
}
else
if
(
item
.
ControlType
===
'statictextblock'
)
{
//静态文本
let
align
=
''
...
...
@@ -509,9 +475,6 @@ function initCanvas() {
</div>
`
renderDynamicText
(
index
)
// timer3 = setInterval(() => {
// renderDynamicText(index)
// }, time)
}
else
if
(
item
.
ControlType
===
'solidellipse'
)
{
//圆形
html
+=
`<div class="commonModule" draggable="false" data-id="
${
index
}
"
...
...
@@ -534,9 +497,6 @@ function initCanvas() {
`
renderEllipselamp
(
index
)
// timer4 = setInterval(() => {
// renderEllipselamp(index)
// }, time)
}
else
if
(
item
.
ControlType
===
'commonlamp'
)
{
//矩形状态灯
html
+=
`<div class="commonModule" id="commonlamp
${
index
}
" draggable="false" data-id="
${
index
}
"
...
...
@@ -548,9 +508,6 @@ function initCanvas() {
</div>
`
renderCommonlamp
(
index
)
// timer5 = setInterval(() => {
// renderCommonlamp(index)
// }, time)
}
else
if
(
item
.
ControlType
===
'cornerbutton'
)
{
//控制按钮
...
...
@@ -565,9 +522,6 @@ function initCanvas() {
</div>`
// renderCornerbutton(index)
// timer6 = setInterval(() => {
// renderCornerbutton(index)
// }, time)
}
else
if
(
item
.
ControlType
===
'rwtextbox'
)
{
//读写框
let
inputType
=
item
.
CheckData
.
type
==
'string'
||
item
.
CheckData
.
type
==
'boolean'
?
'text'
:
'number'
...
...
@@ -578,9 +532,6 @@ function initCanvas() {
</input>
</div>`
renderRwtextbox
(
index
)
// timer7 = setInterval(() => {
// renderRwtextbox(index)
// }, time)
}
else
if
(
item
.
ControlType
===
'jumplink'
)
{
//跳转链接
html
+=
`<div class="commonModule div-text" draggable="false" data-id="
${
index
}
"
...
...
@@ -782,14 +733,6 @@ function initCanvas() {
</div>`
renderPieChart
(
item
)
// timer8 = setInterval(() => {
// renderPieChart(item)
// }, time)
// timer8 = setTimeout (function () {
// // do something
// renderPieChart(item)
// setTimeout (arguments.callee, time)
// }, time)
}
else
if
(
item
.
ControlType
===
'dashboardchart'
)
{
html
+=
`<div class="commonModule" draggable="false" data-id="
${
index
}
"
...
...
@@ -798,10 +741,6 @@ function initCanvas() {
</div>`
renderDashChart
(
item
)
// timer9 = setInterval(() => {
// renderDashChart(item)
// }, time)
}
else
if
(
item
.
ControlType
===
'barchart'
)
{
html
+=
`<div class="commonModule" draggable="false" data-id="
${
index
}
"
...
...
@@ -809,9 +748,6 @@ function initCanvas() {
<div id="
${
item
.
Name
}
" class="chartModule" style="width:100%;height:100%"></div>
</div>`
renderBarChart
(
item
)
// timer10 = setInterval(() => {
// renderBarChart(item)
// }, time)
}
else
if
(
item
.
ControlType
===
'linechart'
)
{
html
+=
`<div class="commonModule" draggable="false" data-id="
${
index
}
"
...
...
@@ -820,9 +756,6 @@ function initCanvas() {
</div>`
renderLineChart
(
item
)
// timer11 = setInterval(() => {
// renderLineChart(item)
// }, time)
}
...
...
@@ -894,40 +827,6 @@ function initCanvas() {
Controls
.
ControlList
[
index
].
EndTime
=
endTime
manualTrigger
(
df
)
// if (df.PropertyList.QueryFind) { // 添加即时刷新功能
// df.EchartList.forEach(dd => {
// if (dd.name.indexOf('linechart') !== -1) { // 折线图即时刷新
// Controls.ControlList.forEach((cf, cfi) => {
// if (cf.Name === dd.name) {
// renderLineChart(cf)
// }
// })
// } else if (dd.name.indexOf('barchart') !== -1){ // 柱状图即时刷新
// Controls.ControlList.forEach((cf, cfi) => {
// if (cf.Name === dd.name) {
// renderBarChart(cf)
// }
// })
// } else if (dd.name.indexOf('dashboardchart') !== -1){ // 仪表盘即时刷新
// Controls.ControlList.forEach((cf, cfi) => {
// if (cf.Name === dd.name) {
// renderDashChart(cf)
// }
// })
// } else if (dd.name.indexOf('piehart') !== -1){ // 饼图即时刷新
// Controls.ControlList.forEach((cf, cfi) => {
// if (cf.Name === dd.name) {
// renderPieChart(cf)
// }
// })
// }
// })
// // renderBarChart()
// }
}
})
})
...
...
@@ -950,7 +849,6 @@ function initCanvas() {
//添加定时器
function
setTimer
()
{
timer1
=
setInterval
(()
=>
{
// clearInterval(timer1)
Controls
.
ControlList
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
ControlType
===
'staticimage'
||
item
.
ControlType
===
'image'
)
{
renderImage
(
index
)
...
...
@@ -2277,15 +2175,6 @@ function renderLineChart(item) {
return
}
}
// Controls.Data.LineChartItemList[cIndex].option.Variables.forEach((d, dIndex) => {
// variableSearchList.push({
// deviceId: d.CheckData.equipmentId,
// variableId: d.CheckData.id,
// variableName: d.CheckData.name
// })
// })
let
postData
=
{
limit
:
c
.
DataCount
,
variableSearchList
...
...
@@ -2366,22 +2255,6 @@ function renderLineChart(item) {
}
else
{
// 历史数据
let
variableSearchList
=
[]
let
seriesName
=
[]
// let list = c.option.Variables
// for(let i= 0;i<list.lenght;i++){
// let d = list[i]
// if(d.CheckData){
// variableSearchList.push({
// deviceId: d.CheckData.equipmentId,
// variableId: d.CheckData.id,
// variableName: d.CheckData.name
// })
// seriesName.push(d.DimensionName)
// }else{
// return
// }
// }
c
.
option
.
Variables
.
forEach
(
d
=>
{
variableSearchList
.
push
({
deviceId
:
d
.
CheckData
.
equipmentId
?
d
.
CheckData
.
equipmentId
:
d
.
CheckData
.
equipmentid
,
...
...
@@ -2536,9 +2409,6 @@ function renderLineChart(item) {
})
}
else
{
//时间
// let date = getFormatDate(c.defaultDataConfig.timedate, c.DateLately)
// let startTime = date.startDate
// let endTime = date.endDate
let
startTime
=
''
let
endTime
=
''
let
format
=
''
...
...
@@ -4623,11 +4493,6 @@ function resetData() {
nodeCLick
(
''
,
''
,
currentBoardNode
,
'reset'
)
}
// setInterval(() => {
// initCanvas()
// }, time)
// 监听全屏事件, 图表进入与退出全屏都需要刷新
document
.
addEventListener
(
"fullscreenchange"
,
function
(
e
)
{
// if (document.fullscreenElement) {
...
...
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