Commit f4f05fff authored by 莫坚培's avatar 莫坚培

fix: 去掉无用定时器

parent 343cf1b0
...@@ -24,19 +24,11 @@ var currentBoardNode = {} //树选中的节点 ...@@ -24,19 +24,11 @@ var currentBoardNode = {} //树选中的节点
var Controls = {} var Controls = {}
var Common = {} var Common = {}
var time = 5000 var time = 5000
let requestDataPool = [] // 各个组件实时刷新的请求数据,放到一个集合里,原来的多个组件请求合并成一个请求发送
// 添加定时器 // 添加定时器
var timer1 = null 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 timer8 = null
var timer9 = null
var timer10 = null
var timer11 = null
var app = { var app = {
msg: function (message, style) { msg: function (message, style) {
var css = { var css = {
...@@ -299,26 +291,6 @@ function nodeCLick(e, treeId, treeNode, type) { ...@@ -299,26 +291,6 @@ function nodeCLick(e, treeId, treeNode, type) {
// 清除定时器 // 清除定时器
clearInterval(timer1) clearInterval(timer1)
timer1 = null 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 = { let postData = {
appId, appId,
panelId: treeNode.id, panelId: treeNode.id,
...@@ -438,9 +410,6 @@ function initCanvas() { ...@@ -438,9 +410,6 @@ function initCanvas() {
</div> </div>
` `
renderImage(index) renderImage(index)
// timer1 = setInterval(() => {
// renderImage(index)
// }, time)
} else if (item.ControlType === 'datatextblock') { //数值显示 } else if (item.ControlType === 'datatextblock') { //数值显示
let align = '' let align = ''
if (item.PropertyList.JustifyContent === 'flex-start') { if (item.PropertyList.JustifyContent === 'flex-start') {
...@@ -463,9 +432,6 @@ function initCanvas() { ...@@ -463,9 +432,6 @@ function initCanvas() {
</div>` </div>`
renderDataText(index) renderDataText(index)
// timer2 = setInterval(() => {
// renderDataText(index)
// }, time)
} else if (item.ControlType === 'statictextblock') { //静态文本 } else if (item.ControlType === 'statictextblock') { //静态文本
let align = '' let align = ''
...@@ -509,9 +475,6 @@ function initCanvas() { ...@@ -509,9 +475,6 @@ function initCanvas() {
</div> </div>
` `
renderDynamicText(index) renderDynamicText(index)
// timer3 = setInterval(() => {
// renderDynamicText(index)
// }, time)
} else if (item.ControlType === 'solidellipse') { //圆形 } else if (item.ControlType === 'solidellipse') { //圆形
html += `<div class="commonModule" draggable="false" data-id="${index}" html += `<div class="commonModule" draggable="false" data-id="${index}"
...@@ -534,9 +497,6 @@ function initCanvas() { ...@@ -534,9 +497,6 @@ function initCanvas() {
` `
renderEllipselamp(index) renderEllipselamp(index)
// timer4 = setInterval(() => {
// renderEllipselamp(index)
// }, time)
} else if (item.ControlType === 'commonlamp') { //矩形状态灯 } else if (item.ControlType === 'commonlamp') { //矩形状态灯
html += `<div class="commonModule" id="commonlamp${index}" draggable="false" data-id="${index}" html += `<div class="commonModule" id="commonlamp${index}" draggable="false" data-id="${index}"
...@@ -548,9 +508,6 @@ function initCanvas() { ...@@ -548,9 +508,6 @@ function initCanvas() {
</div> </div>
` `
renderCommonlamp(index) renderCommonlamp(index)
// timer5 = setInterval(() => {
// renderCommonlamp(index)
// }, time)
} else if (item.ControlType === 'cornerbutton') { //控制按钮 } else if (item.ControlType === 'cornerbutton') { //控制按钮
...@@ -565,9 +522,6 @@ function initCanvas() { ...@@ -565,9 +522,6 @@ function initCanvas() {
</div>` </div>`
// renderCornerbutton(index) // renderCornerbutton(index)
// timer6 = setInterval(() => {
// renderCornerbutton(index)
// }, time)
} else if (item.ControlType === 'rwtextbox') { //读写框 } else if (item.ControlType === 'rwtextbox') { //读写框
let inputType = item.CheckData.type == 'string' || item.CheckData.type == 'boolean' ? 'text' : 'number' let inputType = item.CheckData.type == 'string' || item.CheckData.type == 'boolean' ? 'text' : 'number'
...@@ -578,9 +532,6 @@ function initCanvas() { ...@@ -578,9 +532,6 @@ function initCanvas() {
</input> </input>
</div>` </div>`
renderRwtextbox(index) renderRwtextbox(index)
// timer7 = setInterval(() => {
// renderRwtextbox(index)
// }, time)
} else if (item.ControlType === 'jumplink') { //跳转链接 } else if (item.ControlType === 'jumplink') { //跳转链接
html += `<div class="commonModule div-text" draggable="false" data-id="${index}" html += `<div class="commonModule div-text" draggable="false" data-id="${index}"
...@@ -782,14 +733,6 @@ function initCanvas() { ...@@ -782,14 +733,6 @@ function initCanvas() {
</div>` </div>`
renderPieChart(item) renderPieChart(item)
// timer8 = setInterval(() => {
// renderPieChart(item)
// }, time)
// timer8 = setTimeout (function () {
// // do something
// renderPieChart(item)
// setTimeout (arguments.callee, time)
// }, time)
} else if (item.ControlType === 'dashboardchart') { } else if (item.ControlType === 'dashboardchart') {
html += `<div class="commonModule" draggable="false" data-id="${index}" html += `<div class="commonModule" draggable="false" data-id="${index}"
...@@ -798,10 +741,6 @@ function initCanvas() { ...@@ -798,10 +741,6 @@ function initCanvas() {
</div>` </div>`
renderDashChart(item) renderDashChart(item)
// timer9 = setInterval(() => {
// renderDashChart(item)
// }, time)
} else if (item.ControlType === 'barchart') { } else if (item.ControlType === 'barchart') {
html += `<div class="commonModule" draggable="false" data-id="${index}" html += `<div class="commonModule" draggable="false" data-id="${index}"
...@@ -809,9 +748,6 @@ function initCanvas() { ...@@ -809,9 +748,6 @@ function initCanvas() {
<div id="${item.Name}" class="chartModule" style="width:100%;height:100%"></div> <div id="${item.Name}" class="chartModule" style="width:100%;height:100%"></div>
</div>` </div>`
renderBarChart(item) renderBarChart(item)
// timer10 = setInterval(() => {
// renderBarChart(item)
// }, time)
} else if (item.ControlType === 'linechart') { } else if (item.ControlType === 'linechart') {
html += `<div class="commonModule" draggable="false" data-id="${index}" html += `<div class="commonModule" draggable="false" data-id="${index}"
...@@ -820,9 +756,6 @@ function initCanvas() { ...@@ -820,9 +756,6 @@ function initCanvas() {
</div>` </div>`
renderLineChart(item) renderLineChart(item)
// timer11 = setInterval(() => {
// renderLineChart(item)
// }, time)
} }
...@@ -894,40 +827,6 @@ function initCanvas() { ...@@ -894,40 +827,6 @@ function initCanvas() {
Controls.ControlList[index].EndTime = endTime Controls.ControlList[index].EndTime = endTime
manualTrigger(df) 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() { ...@@ -950,7 +849,6 @@ function initCanvas() {
//添加定时器 //添加定时器
function setTimer() { function setTimer() {
timer1 = setInterval(() => { timer1 = setInterval(() => {
// clearInterval(timer1)
Controls.ControlList.forEach((item, index) => { Controls.ControlList.forEach((item, index) => {
if (item.ControlType === 'staticimage' || item.ControlType === 'image') { if (item.ControlType === 'staticimage' || item.ControlType === 'image') {
renderImage(index) renderImage(index)
...@@ -2277,15 +2175,6 @@ function renderLineChart(item) { ...@@ -2277,15 +2175,6 @@ function renderLineChart(item) {
return 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 = { let postData = {
limit: c.DataCount, limit: c.DataCount,
variableSearchList variableSearchList
...@@ -2366,22 +2255,6 @@ function renderLineChart(item) { ...@@ -2366,22 +2255,6 @@ function renderLineChart(item) {
} else { // 历史数据 } else { // 历史数据
let variableSearchList = [] let variableSearchList = []
let seriesName = [] 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 => { c.option.Variables.forEach(d => {
variableSearchList.push({ variableSearchList.push({
deviceId: d.CheckData.equipmentId ? d.CheckData.equipmentId : d.CheckData.equipmentid, deviceId: d.CheckData.equipmentId ? d.CheckData.equipmentId : d.CheckData.equipmentid,
...@@ -2536,9 +2409,6 @@ function renderLineChart(item) { ...@@ -2536,9 +2409,6 @@ function renderLineChart(item) {
}) })
} else {//时间 } else {//时间
// let date = getFormatDate(c.defaultDataConfig.timedate, c.DateLately)
// let startTime = date.startDate
// let endTime = date.endDate
let startTime = '' let startTime = ''
let endTime = '' let endTime = ''
let format = '' let format = ''
...@@ -4623,11 +4493,6 @@ function resetData() { ...@@ -4623,11 +4493,6 @@ function resetData() {
nodeCLick('', '', currentBoardNode, 'reset') nodeCLick('', '', currentBoardNode, 'reset')
} }
// setInterval(() => {
// initCanvas()
// }, time)
// 监听全屏事件, 图表进入与退出全屏都需要刷新 // 监听全屏事件, 图表进入与退出全屏都需要刷新
document.addEventListener("fullscreenchange", function (e) { document.addEventListener("fullscreenchange", function (e) {
// if (document.fullscreenElement) { // if (document.fullscreenElement) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment