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
3f349bc5
Commit
3f349bc5
authored
Sep 28, 2021
by
莫坚培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复请求分组造成的bug
parent
b314040f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
31 deletions
+58
-31
dashboard.js
js/dashboard.js
+48
-27
tokenSetting.js
js/tokenSetting.js
+8
-2
webpack.config.js
webpack.config.js
+2
-2
No files found.
js/dashboard.js
View file @
3f349bc5
...
@@ -935,7 +935,13 @@ function startRequestLoop() {
...
@@ -935,7 +935,13 @@ function startRequestLoop() {
requestLoopTimer
=
setInterval
(
async
()
=>
{
requestLoopTimer
=
setInterval
(
async
()
=>
{
if
(
requestLoopStopFlag
)
{
if
(
requestLoopStopFlag
)
{
return
return
}
}
// 每一轮都把标记清除
Object
.
values
(
Controls
.
dataPoolMap
).
forEach
(
item
=>
{
item
.
isHasMeetVariable
=
false
})
// 使用await等待前一组完成,再进行下一组,且利用requestLoopStopFlag控制每一批(一批多个组)完成才能进行下一批
// 使用await等待前一组完成,再进行下一组,且利用requestLoopStopFlag控制每一批(一批多个组)完成才能进行下一批
for
(
let
i
=
0
,
len
=
requestLoopGroupSliceRes
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
requestLoopGroupSliceRes
.
length
;
i
<
len
;
i
++
)
{
requestLoopStopFlag
=
true
// 进入循环即表示已经开始请求
requestLoopStopFlag
=
true
// 进入循环即表示已经开始请求
...
@@ -986,7 +992,7 @@ function sendLoopDataRequest(list, i, len, isInit) {
...
@@ -986,7 +992,7 @@ function sendLoopDataRequest(list, i, len, isInit) {
if
(
i
===
len
-
1
)
{
if
(
i
===
len
-
1
)
{
requestLoopStopFlag
=
false
requestLoopStopFlag
=
false
}
}
reject
(
err
)
reject
(
err
)
})
})
})
})
...
@@ -1267,15 +1273,9 @@ function loopRenderPiechart(poolData, resData, resCode) {
...
@@ -1267,15 +1273,9 @@ function loopRenderPiechart(poolData, resData, resCode) {
// 渲染动态图片、动态文本
// 渲染动态图片、动态文本
function
loopRenderImage
(
poolData
,
resData
,
label
)
{
function
loopRenderImage
(
poolData
,
resData
,
label
)
{
// 给默认值
if
(
poolData
.
isHasMeetVariable
)
{
if
(
label
===
'image'
)
{
return
$
(
`#image-img
${
poolData
.
dataPoolMapIndex
}
`
).
attr
(
'src'
,
poolData
.
DefaultImg
)
}
if
(
label
===
'dynamictext'
)
{
$
(
`#dynamictext-text
${
poolData
.
dataPoolMapIndex
}
`
).
text
(
poolData
.
DefaultText
)
$
(
`#dynamictext-text
${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
poolData
.
DefaultColor
)
}
}
let
labelMap
=
{
let
labelMap
=
{
dynamictext
:
'num'
,
dynamictext
:
'num'
,
image
:
'presetText'
image
:
'presetText'
...
@@ -1308,6 +1308,14 @@ function loopRenderImage(poolData, resData, label) {
...
@@ -1308,6 +1308,14 @@ function loopRenderImage(poolData, resData, label) {
})
})
if
(
!
flagItem
)
{
if
(
!
flagItem
)
{
// 给默认值
if
(
label
===
'image'
)
{
$
(
`#image-img
${
poolData
.
dataPoolMapIndex
}
`
).
attr
(
'src'
,
poolData
.
DefaultImg
)
}
if
(
label
===
'dynamictext'
)
{
$
(
`#dynamictext-text
${
poolData
.
dataPoolMapIndex
}
`
).
text
(
poolData
.
DefaultText
)
$
(
`#dynamictext-text
${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
poolData
.
DefaultColor
)
}
return
return
}
}
// 只要有一个满足条件,则渲染该条件
// 只要有一个满足条件,则渲染该条件
...
@@ -1317,11 +1325,16 @@ function loopRenderImage(poolData, resData, label) {
...
@@ -1317,11 +1325,16 @@ function loopRenderImage(poolData, resData, label) {
if
(
label
===
'dynamictext'
)
{
if
(
label
===
'dynamictext'
)
{
$
(
`#dynamictext-text
${
poolData
.
dataPoolMapIndex
}
`
).
text
(
flagItem
.
presetText
)
$
(
`#dynamictext-text
${
poolData
.
dataPoolMapIndex
}
`
).
text
(
flagItem
.
presetText
)
$
(
`#dynamictext-text
${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
flagItem
.
backColor
)
$
(
`#dynamictext-text
${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
flagItem
.
backColor
)
}
}
poolData
.
isHasMeetVariable
=
true
}
}
// 渲染数值显示、读写框
// 渲染数值显示、读写框
function
loopRenderDatatextblock
(
poolData
,
resData
,
label
)
{
function
loopRenderDatatextblock
(
poolData
,
resData
,
label
)
{
if
(
poolData
.
isHasMeetVariable
)
{
return
}
let
dight
=
poolData
.
DecimalDigits
===
null
?
0
:
poolData
.
DecimalDigits
let
dight
=
poolData
.
DecimalDigits
===
null
?
0
:
poolData
.
DecimalDigits
let
valueInfo
=
JSON
.
parse
(
resData
[
Object
.
keys
(
resData
)[
0
]])
let
valueInfo
=
JSON
.
parse
(
resData
[
Object
.
keys
(
resData
)[
0
]])
let
resDataValue
=
valueInfo
[
poolData
.
CheckData
.
name
]
let
resDataValue
=
valueInfo
[
poolData
.
CheckData
.
name
]
...
@@ -1330,16 +1343,6 @@ function loopRenderDatatextblock(poolData, resData, label) {
...
@@ -1330,16 +1343,6 @@ function loopRenderDatatextblock(poolData, resData, label) {
return
return
}
}
// 给读写框赋值、默认颜色
if
(
label
===
'datatextblock'
)
{
resDataValue
=
resDataValue
.
toFixed
(
Number
(
dight
))
$
(
`#datatextblock
${
poolData
.
dataPoolMapIndex
}
`
).
text
(
resDataValue
)
$
(
`#datatextblock
${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
'#000'
)
}
else
{
$
(
`#rwtextbox-text
${
poolData
.
dataPoolMapIndex
}
`
).
val
(
resDataValue
)
$
(
`#rwtextbox-text
${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
'#000'
)
}
let
flagItem
=
poolData
.
DataList
.
find
(
item
=>
{
let
flagItem
=
poolData
.
DataList
.
find
(
item
=>
{
let
flag
=
transFlag
(
item
.
flag
)
let
flag
=
transFlag
(
item
.
flag
)
return
(
return
(
...
@@ -1352,20 +1355,30 @@ function loopRenderDatatextblock(poolData, resData, label) {
...
@@ -1352,20 +1355,30 @@ function loopRenderDatatextblock(poolData, resData, label) {
)
)
})
})
if
(
!
flagItem
)
{
// 给读写框赋值、默认颜色
if
(
label
===
'datatextblock'
)
{
resDataValue
=
resDataValue
.
toFixed
(
Number
(
dight
))
$
(
`#datatextblock
${
poolData
.
dataPoolMapIndex
}
`
).
text
(
resDataValue
)
$
(
`#datatextblock
${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
'#000'
)
}
else
{
$
(
`#rwtextbox-text
${
poolData
.
dataPoolMapIndex
}
`
).
val
(
resDataValue
)
$
(
`#rwtextbox-text
${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
'#000'
)
}
return
}
// 只要有一个满足条件,则渲染该条件的颜色
// 只要有一个满足条件,则渲染该条件的颜色
if
(
flagItem
&&
poolData
.
conCheck
)
{
if
(
flagItem
&&
poolData
.
conCheck
)
{
$
(
`#
${
label
===
'datatextblock'
?
'datatextblock'
:
'rwtextbox-text'
}${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
flagItem
.
backColor
)
$
(
`#
${
label
===
'datatextblock'
?
'datatextblock'
:
'rwtextbox-text'
}${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'color'
,
flagItem
.
backColor
)
poolData
.
isHasMeetVariable
=
true
}
}
}
}
// 渲染矩形、圆形状态灯 label: commonlamp矩形状态灯 ellipselamp圆形状态灯
// 渲染矩形、圆形状态灯 label: commonlamp矩形状态灯 ellipselamp圆形状态灯
function
loopRenderLamp
(
poolData
,
resData
,
label
)
{
function
loopRenderLamp
(
poolData
,
resData
,
label
)
{
// 给默认颜色、闪烁
if
(
poolData
.
isHasMeetVariable
)
{
$
(
`#
${
label
}${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'background-color'
,
poolData
.
DefaultColor
)
return
if
(
poolData
.
DefaultFlashing
)
{
// 默认闪烁
$
(
`#
${
label
}${
poolData
.
dataPoolMapIndex
}
`
).
addClass
(
'animated-flash'
)
}
else
{
$
(
`#
${
label
}${
poolData
.
dataPoolMapIndex
}
`
).
removeClass
(
'animated-flash'
)
}
}
let
flagItem
=
poolData
.
DataList
.
find
((
item
,
index
)
=>
{
let
flagItem
=
poolData
.
DataList
.
find
((
item
,
index
)
=>
{
...
@@ -1390,6 +1403,13 @@ function loopRenderLamp(poolData, resData, label) {
...
@@ -1390,6 +1403,13 @@ function loopRenderLamp(poolData, resData, label) {
})
})
if
(
!
flagItem
)
{
if
(
!
flagItem
)
{
// 给默认颜色、闪烁
$
(
`#
${
label
}${
poolData
.
dataPoolMapIndex
}
`
).
css
(
'background-color'
,
poolData
.
DefaultColor
)
if
(
poolData
.
DefaultFlashing
)
{
// 默认闪烁
$
(
`#
${
label
}${
poolData
.
dataPoolMapIndex
}
`
).
addClass
(
'animated-flash'
)
}
else
{
$
(
`#
${
label
}${
poolData
.
dataPoolMapIndex
}
`
).
removeClass
(
'animated-flash'
)
}
return
return
}
}
// 只要有一个满足条件,则渲染该条件的颜色
// 只要有一个满足条件,则渲染该条件的颜色
...
@@ -1399,6 +1419,7 @@ function loopRenderLamp(poolData, resData, label) {
...
@@ -1399,6 +1419,7 @@ function loopRenderLamp(poolData, resData, label) {
}
else
{
}
else
{
$
(
`#
${
label
}${
poolData
.
dataPoolMapIndex
}
`
).
removeClass
(
'animated-flash'
)
$
(
`#
${
label
}${
poolData
.
dataPoolMapIndex
}
`
).
removeClass
(
'animated-flash'
)
}
}
poolData
.
isHasMeetVariable
=
true
}
}
// 整合所有组件的请求数据,放到一个数组里
// 整合所有组件的请求数据,放到一个数组里
...
...
js/tokenSetting.js
View file @
3f349bc5
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* @description: 文件描述
* @description: 文件描述
* @Date: 2021-09-16 18:33:55
* @Date: 2021-09-16 18:33:55
* @LastEditors: 莫靓仔
* @LastEditors: 莫靓仔
* @LastEditTime: 2021-09-2
6 16:29:19
* @LastEditTime: 2021-09-2
8 10:24:42
*/
*/
let
setObj
=
{
let
setObj
=
{
// 厂家大佬
// 厂家大佬
...
@@ -17,10 +17,16 @@ let setObj = {
...
@@ -17,10 +17,16 @@ let setObj = {
devToken
:
'5b0784dd-ad5b-43ec-a851-053763233c91'
,
devToken
:
'5b0784dd-ad5b-43ec-a851-053763233c91'
,
devAppId
:
'TEST123_o582'
,
devAppId
:
'TEST123_o582'
,
devTenantId
:
'TEST123_o582'
devTenantId
:
'TEST123_o582'
},
// ashu
set3
:
{
devToken
:
'94e6b95f-1e96-47dd-8a69-b6753bc5b83f'
,
devAppId
:
'ASAS_3Y73'
,
devTenantId
:
'ASAS_3Y73'
}
}
}
}
let
defaultObj
=
'set
2
'
let
defaultObj
=
'set
3
'
window
.
devToken
=
setObj
[
defaultObj
].
devToken
window
.
devToken
=
setObj
[
defaultObj
].
devToken
window
.
devAppId
=
setObj
[
defaultObj
].
devAppId
window
.
devAppId
=
setObj
[
defaultObj
].
devAppId
window
.
devTenantId
=
setObj
[
defaultObj
].
devTenantId
window
.
devTenantId
=
setObj
[
defaultObj
].
devTenantId
webpack.config.js
View file @
3f349bc5
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* @description: 本地run的webpack配置
* @description: 本地run的webpack配置
* @Date: 2021-08-19 17:10:54
* @Date: 2021-08-19 17:10:54
* @LastEditors: 莫靓仔
* @LastEditors: 莫靓仔
* @LastEditTime: 2021-09-2
4 18:00:04
* @LastEditTime: 2021-09-2
8 13:44:20
*/
*/
const
path
=
require
(
'path'
)
const
path
=
require
(
'path'
)
// const webpack = require('webpack')
// const webpack = require('webpack')
...
@@ -31,7 +31,7 @@ module.exports = {
...
@@ -31,7 +31,7 @@ module.exports = {
// hot: true,
// hot: true,
// 端口号
// 端口号
port
:
8002
,
port
:
8002
,
host
:
'192.168.1.1
08
'
,
// 本机ip
host
:
'192.168.1.1
19
'
,
// 本机ip
// 是否压缩
// 是否压缩
compress
:
true
,
compress
:
true
,
// 当前目录
// 当前目录
...
...
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