Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
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
海康威视
web-project
Commits
0cd56232
Commit
0cd56232
authored
Jul 25, 2024
by
qjeslks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
7.25.1
parent
5564b5f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
411 additions
and
602 deletions
+411
-602
config.js
public/config.js
+4
-4
AlarmInfoPage.vue
src/views/AlarmPage/AlarmInfoPage.vue
+407
-598
No files found.
public/config.js
View file @
0cd56232
export
const
ExternalSERVEICE
=
'http://218.69.97.198:8001'
export
const
WithinSERVEICE
=
'http://192.168.1.252:8001'
//
export const ExternalSERVEICE='http://localhost:5013'
//
export const WithinSERVEICE='http://localhost:5013'
//
export const ExternalSERVEICE='http://218.69.97.198:8001'
//
export const WithinSERVEICE='http://192.168.1.252:8001'
export
const
ExternalSERVEICE
=
'http://localhost:5013'
export
const
WithinSERVEICE
=
'http://localhost:5013'
export
const
CURRLOGO
=
"LOGO_gangyi.png"
src/views/AlarmPage/AlarmInfoPage.vue
View file @
0cd56232
<
template
>
<!-- 条件筛选卡片 -->
<el-card
class=
"card-contianer"
>
<div
class=
"div-header"
>
<!-- 控制表格和图表的开关 -->
<el-form-item>
<el-switch
v-model=
"value"
active-text=
"表格"
inactive-text=
"曲线图"
style=
"--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949;min-width: 130px;"
@
change=
"getchart"
/>
</el-form-item>
<el-form-item
label=
"供热站:"
>
<el-select
v-model=
"HisPipeInfo.id"
multiple=
"true"
collapse-tags
placeholder=
"请选择"
style=
"min-width: 170px"
@
change=
"checkAge"
>
<el-option
v-for=
"item in options"
:label=
"item.label"
:value=
"item.value"
:disabled=
"item.disabled"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"开始时间:"
>
<el-config-provider
:locale=
"zhCn"
>
<el-date-picker
v-model=
"HisPipeInfo.startTime"
type=
"datetime"
value-format=
"YYYY-MM-DD HH:mm:ss"
placeholder=
"选择开始时间"
style=
"min-width: 180px;"
/>
<!-- 日期时间格式 2024-1-1 00:00:00-->
</el-config-provider>
</el-form-item>
<el-form-item
label=
"结束时间:"
>
<el-config-provider
:locale=
"zhCn"
>
<el-date-picker
v-model=
"HisPipeInfo.endTime"
type=
"datetime"
value-format=
"YYYY-MM-DD HH:mm:ss"
placeholder=
"选择结束时间"
style=
"min-width: 180px;"
/>
</el-config-provider>
</el-form-item>
<el-form-item
label=
"时间间隔"
>
<el-select
v-model=
"HisPipeInfo.interval"
placeholder=
"1小时/次"
style=
"min-width: 105px"
clearable
>
<el-option
label=
"全部"
:value=
0
/>
<el-option
label=
"1分钟/次"
:value=
1
/>
<el-option
label=
"1小时/次"
:value=
2
/>
<el-option
label=
"1天/次"
:value=
3
/>
<el-option
label=
"1周/次"
:value=
4
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"getdata"
style=
"min-width: 70px;"
>
查询
</el-button>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
style=
"min-width: 70px;"
@
click=
"autoColBoxShow = !autoColBoxShow"
>
自定义列
</el-button>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"exportExcel"
style=
"min-width: 70px;"
>
导出表格
</el-button>
</el-form-item>
</div>
</el-card>
<el-card
v-show=
"value"
class=
"moduleCard"
:height=
"tableHeight"
>
<el-table
:data=
"tableData"
:height=
"tableHeight"
v-loading=
"loading"
:cell-style=
"setCellStyle"
id=
"out-table"
border
highlight-current-row
:header-cell-style=
"setHeaderCellStyle"
@
sort-change=
"sortMethod"
:header-cell-class-name=
"handleHeadAddClass"
>
<el-table-column
v-for=
"(item, i) in frozenList"
:prop=
"item.field"
:label=
"item.alias"
:width=
"item.width"
:sortable=
"(item.field === 'name' || item.field === 'gatherTime') ? true : false"
fixed
/>
<template
v-for=
"(item, i) in otherList"
>
<el-table-column
v-if=
"item.isVisible"
:prop=
"item.enName"
:label=
"item.alias"
:width=
"item.width"
></el-table-column>
</
template
>
</el-table>
</el-card>
<el-footer
style=
"height: 8px;"
v-show=
"value"
>
<el-config-provider
:locale=
"zhCn"
>
<el-pagination
v-model:current-page=
"currentPage"
v-model:page-size=
"pageSize"
:page-sizes=
"[30, 40, 50, 100, 200, 300]"
:small=
"true"
:disabled=
"disabled"
:background=
"background"
layout=
"total, sizes, prev, pager, next, jumper"
:total=
"total"
@
size-change=
"getdata"
@
current-change=
"getdata"
class=
"pagination"
/>
</el-config-provider>
</el-footer>
<el-card
v-show=
"(value === false)"
>
<div
id=
"chart"
style=
"width: 99%; height: 690px"
></div>
</el-card>
<CfgSupply
v-model=
"autoColBoxShow"
@
onChangeDialog=
"onChangeDialog"
:titleData=
"value? titleData:curveTitleData"
:height=
"500"
:width=
"950"
:deviceType=
"HisPipeInfo.deviceType"
:title=
"title"
:cfgType=
"value?0:1"
/>
</template>
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
,
onMounted
,
onUnmounted
}
from
'vue'
;
import
*
as
echarts
from
'echarts'
;
//引入echarts核心模块
import
http
from
'../../api/http'
;
import
zhCn
from
'element-plus/dist/locale/zh-cn.mjs'
// // 引入导出Excel表格依赖
// import * as XLSX from "xlsx";
import
store
from
"../../store/index"
;
import
{
getFileName
}
from
'../../utils/utils'
;
import
CfgSupply
from
'../../components/CfgSupply.vue'
;
//分页设置
const
currentPage
=
ref
(
1
)
var
pageSize
=
ref
(
30
)
const
disabled
=
ref
(
false
)
const
background
=
ref
(
false
)
const
total
=
ref
()
const
options
=
reactive
([]);
var
frozenList
=
reactive
([]);
var
otherList
=
reactive
([]);
const
tableData
=
ref
([]);
const
timeList
=
reactive
([]);
const
option
=
ref
([]);
const
value
=
ref
(
true
);
//控制表格和图表的开关
const
loading
=
ref
(
true
);
const
tableHeight
=
ref
(
500
);
const
enterpriseId
=
ref
();
const
sortField
=
reactive
({});
const
titleData
=
ref
([]);
//自定义标题
const
autoColBoxShow
=
ref
(
false
);
//显示自定义列
const
curveTitleData
=
ref
([]);
//曲线图自定义标题
const
title
=
ref
(
'总管历史数据自定义列'
);
const
onChangeDialog
=
(
val
)
=>
{
// console.log('onclick',val);
autoColBoxShow
.
value
=
false
;
if
(
value
){
getPipe
();
}
else
{
getchart
();
}
}
getEnterprise
();
function
getEnterprise
(){
var
result
=
store
.
getters
.
getEnterprise
();
if
(
result
)
{
enterpriseId
.
value
=
result
[
0
].
enterpriseId
;
}
<!-- 条件筛选卡片 -->
<el-card
class=
"card-contianer"
>
<div
class=
"div-header"
>
<el-form-item
label=
"查询类型:"
>
<el-select
v-model=
"type"
placeholder=
"请选择"
style=
"width: 150px"
@
change=
"getoptions"
>
<el-option
label=
"换热机组"
value=
"GetTransAlarmData"
/>
<el-option
label=
"锅炉"
value=
"GetBoilerAlarmData"
/>
<el-option
label=
"总管"
value=
"GetPipeAlarmData"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"换热机组:"
>
<el-cascader
:options=
"options"
v-model=
"AlarmInfo.Id"
:props=
"props"
collapse-tags
clearable
:show-all-levels=
"false"
placeholder=
"请选择"
style=
"min-width: 210px;"
/>
</el-form-item>
<el-form-item
label=
"开始时间:"
>
<el-config-provider
:locale=
"zhCn"
>
<el-date-picker
v-model=
"AlarmInfo.startTime"
type=
"datetime"
value-format=
"YYYY-MM-DD HH:mm:ss"
placeholder=
"选择开始时间"
style=
"min-width: 180px;"
/>
<!-- 日期时间格式 2024-01-01 00:00:00-->
</el-config-provider>
</el-form-item>
<el-form-item
label=
"结束时间:"
>
<el-config-provider
:locale=
"zhCn"
>
<el-date-picker
v-model=
"AlarmInfo.endTime"
type=
"datetime"
value-format=
"YYYY-MM-DD HH:mm:ss"
placeholder=
"选择结束时间"
style=
"min-width: 180px;"
/>
</el-config-provider>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"getdata"
style=
"min-width: 70px;"
>
查询
</el-button>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"exportExcel"
style=
"min-width: 70px;"
>
导出表格
</el-button>
</el-form-item>
</div>
</el-card>
<el-card
class=
"moduleCard"
:height=
"tableHeight"
>
<el-table
:data=
"tableData"
:height=
"tableHeight"
v-loading=
"loading"
:cell-style=
"setCellStyle"
id=
"out-table"
border
highlight-current-row
:header-cell-style=
"setHeaderCellStyle"
@
sort-change=
"sortMethod"
:header-cell-class-name=
"handleHeadAddClass"
>
<el-table-column
prop=
"name"
label=
"设施名称"
:sortable=
"true"
width=
"200px"
fixed
/>
<el-table-column
prop=
"cnName"
label=
"报警类型"
:sortable=
"false"
width=
"200px"
fixed
/>
<el-table-column
prop=
"alarmDate"
label=
"报警时间"
:sortable=
"true"
width=
"200px"
fixed
/>
<el-table-column
prop=
"alarmMessage"
label=
"报警信息"
:sortable=
"false"
width=
"700px"
fixed
/>
<el-table-column
prop=
"alarmPlan"
label=
"报警预案"
:sortable=
"false"
fixed
/>
</el-table>
</el-card>
<el-footer
style=
"height: 8px;"
>
<el-config-provider
:locale=
"zhCn"
>
<el-pagination
v-model:current-page=
"currentPage"
v-model:page-size=
"pageSize"
:page-sizes=
"[30, 40, 50, 100, 200, 300]"
:small=
"true"
:disabled=
"disabled"
:background=
"background"
layout=
"total, sizes, prev, pager, next, jumper"
:total=
"total"
@
size-change=
"getdata"
@
current-change=
"getdata"
class=
"pagination"
/>
</el-config-provider>
</el-footer>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
,
onMounted
,
onUnmounted
}
from
'vue'
;
import
http
from
'../../api/http'
;
import
zhCn
from
'element-plus/dist/locale/zh-cn.mjs'
import
store
from
"../../store/index"
;
import
{
getFileName
}
from
'../../utils/utils'
;
import
CfgSupply
from
'../../components/CfgSupply.vue'
;
import
{
column
}
from
'element-plus/es/components/table-v2/src/common.mjs'
;
//分页设置
const
currentPage
=
ref
(
1
)
var
pageSize
=
ref
(
30
)
const
disabled
=
ref
(
false
)
const
background
=
ref
(
false
)
const
total
=
ref
()
const
options
=
reactive
([]);
const
tableData
=
ref
([]);
const
tableHeight
=
ref
(
500
);
const
enterpriseId
=
ref
();
const
loading
=
ref
(
true
);
const
sortField
=
reactive
({});
const
type
=
ref
(
'GetTransAlarmData'
);
getEnterprise
();
function
getEnterprise
(){
var
result
=
store
.
getters
.
getEnterprise
();
if
(
result
)
{
enterpriseId
.
value
=
result
[
0
].
enterpriseId
;
}
function
setContentHeight
()
{
tableHeight
.
value
=
window
.
innerHeight
-
240
;
}
//获取排序的方法
function
sortMethod
({
order
,
prop
}){
// 触发的排序和缓存的排序相同时,取消该字段的排序
if
(
!
order
||
sortField
[
prop
]
===
order
)
{
sortField
[
prop
]
=
null
}
else
{
sortField
[
prop
]
=
order
}
const
props
=
{
multiple
:
true
,
emitPath
:
false
}
function
setContentHeight
()
{
tableHeight
.
value
=
window
.
innerHeight
-
232
;
}
//获取排序的方法
function
sortMethod
({
order
,
prop
}){
// 触发的排序和缓存的排序相同时,取消该字段的排序
if
(
!
order
||
sortField
[
prop
]
===
order
)
{
sortField
[
prop
]
=
null
}
else
{
sortField
[
prop
]
=
order
}
// console.log(sortField)
let
sortname
=
""
;
let
sortnames
=
""
;
let
direction
=
''
;
for
(
const
i
in
sortField
)
{
if
(
sortField
[
i
]
==
'ascending'
)
{
direction
=
'ASC'
}
else
if
(
sortField
[
i
]
==
'descending'
)
{
direction
=
'DESC'
}
// console.log(sortField)
let
sortname
=
""
;
let
sortnames
=
""
;
let
direction
=
''
;
for
(
const
i
in
sortField
)
{
if
(
sortField
[
i
]
==
'ascending'
)
{
direction
=
'ASC'
}
else
if
(
sortField
[
i
]
==
'descending'
)
{
direction
=
'DESC'
}
if
(
i
===
"name"
){
sortname
=
"PipeName"
;
}
else
if
(
i
===
"gatherTime"
){
sortname
=
"GatherTime"
;
}
// console.log(sortname)
if
(
sortnames
===
""
){
sortnames
=
sortnames
+
sortname
+
" "
+
direction
;
}
else
{
sortnames
=
sortnames
+
","
+
sortname
+
" "
+
direction
;
}
HisPipeInfo
.
sort
=
sortnames
;
if
(
i
===
"name"
){
sortname
=
"name"
;
}
else
if
(
i
===
"alartDate"
){
sortname
=
"alartDate"
;
}
getdata
()
//调用后端查询接口
}
function
handleHeadAddClass
({
column
})
{
if
(
sortField
[
column
.
property
])
{
column
.
order
=
sortField
[
column
.
property
]
}
}
var
date
=
new
Date
();
var
year
=
date
.
getFullYear
();
var
day
=
0
;
var
dateArr
=
[
date
.
getMonth
()
+
1
,
//月份从0~11,所以加一
date
.
getDate
(),
date
.
getHours
(),
date
.
getMinutes
(),
date
.
getSeconds
(),
];
for
(
var
i
=
0
;
i
<
dateArr
.
length
;
i
++
)
{
if
(
dateArr
[
i
]
>=
1
&&
dateArr
[
i
]
<=
9
)
{
dateArr
[
i
]
=
"0"
+
dateArr
[
i
];
}
}
day
=
dateArr
[
1
]
-
1
;
if
(
day
>=
1
&&
day
<=
9
)
{
day
=
"0"
+
day
;
}
// var endTime = year + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
// var startTime = year + "-" + dateArr[0] + "-" + day + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
var
startTime
=
sessionStorage
.
getItem
(
"DeviceQueryStart"
);
if
(
!
startTime
){
startTime
=
year
+
"-"
+
dateArr
[
0
]
+
"-"
+
day
+
" "
+
dateArr
[
2
]
+
":"
+
dateArr
[
3
]
+
":"
+
dateArr
[
4
];
sessionStorage
.
setItem
(
"DeviceQueryStart"
,
startTime
);
}
var
endTime
=
sessionStorage
.
getItem
(
"DeviceQueryEnd"
);
if
(
!
endTime
){
endTime
=
year
+
"-"
+
dateArr
[
0
]
+
"-"
+
dateArr
[
1
]
+
" "
+
dateArr
[
2
]
+
":"
+
dateArr
[
3
]
+
":"
+
dateArr
[
4
];
sessionStorage
.
setItem
(
"DeviceQueryEnd"
,
endTime
);
}
const
HisPipeInfo
=
reactive
({
"enterpriseId"
:
enterpriseId
.
value
,
"supplyId"
:
[],
"deviceType"
:
8
,
"id"
:
[],
"startTime"
:
startTime
,
"endTime"
:
endTime
,
"interval"
:
2
,
"sort"
:
""
,
"pageIndex"
:
0
,
"pageCount"
:
30
})
//获取下拉列表
function
getoptions
(){
var
result
=
store
.
getters
.
getEnterprise
();
if
(
result
)
{
console
.
log
(
result
)
result
.
forEach
(
element
=>
{
if
(
element
.
enterpriseId
===
enterpriseId
.
value
){
if
(
element
.
enterpriseId
===
"9BCA54BC-8F27-4849-8D7D-50C5099E1949"
.
toLowerCase
()){
element
.
serviceCenterList
.
forEach
(
center
=>
{
center
.
supplyList
.
forEach
(
supply
=>
{
options
.
push
({
value
:
supply
.
pipeInfo
.
pipeId
,
label
:
supply
.
pipeInfo
.
pipeName
,
pipeType
:
(
supply
.
pipeInfo
.
pipeType
===
1
?
8
:
1
),
disabled
:
true
});
});
})
// console.log(sortname)
if
(
sortnames
===
""
){
sortnames
=
sortnames
+
sortname
+
" "
+
direction
;
}
else
{
element
.
supplyList
.
forEach
(
supply
=>
{
options
.
push
({
value
:
supply
.
pipeInfo
.
pipeId
,
label
:
supply
.
pipeInfo
.
pipeName
,
pipeType
:
(
supply
.
pipeInfo
.
pipeType
===
1
?
8
:
1
),
disabled
:
true
});
})
sortnames
=
sortnames
+
","
+
sortname
+
" "
+
direction
;
}
AlarmInfo
.
sort
=
sortnames
;
}
});
}
options
.
forEach
(
element
=>
{
if
(
element
.
pipeType
===
8
){
HisPipeInfo
.
id
.
push
(
element
.
value
);
}
})
console
.
log
(
AlarmInfo
.
sort
)
getdata
()
//调用后端查询接口
}
function
handleHeadAddClass
({
column
})
{
if
(
sortField
[
column
.
property
])
{
column
.
order
=
sortField
[
column
.
property
]
}
function
checkAge
()
{
options
.
forEach
(
element
=>
{
if
(
element
.
value
===
HisPipeInfo
.
id
[
0
]){
HisPipeInfo
.
deviceType
=
element
.
pipeType
;
}
});
if
(
HisPipeInfo
.
id
.
length
===
0
)
{
options
.
forEach
(
element
=>
{
element
.
disabled
=
false
;
})
}
else
{
options
.
forEach
(
element
=>
{
if
(
element
.
value
===
HisPipeInfo
.
id
[
0
]){
options
.
forEach
(
opt
=>
{
if
(
opt
.
pipeType
!==
element
.
pipeType
){
opt
.
disabled
=
true
;
}
else
{
opt
.
disabled
=
false
;
}
})
}
})
}
};
getdata
();
getoptions
();
checkAge
();
getcolumn
();
function
getdata
()
{
loading
.
value
=
true
;
sessionStorage
.
setItem
(
"DeviceQueryStart"
,
HisPipeInfo
.
startTime
);
sessionStorage
.
setItem
(
"DeviceQueryEnd"
,
HisPipeInfo
.
endTime
);
getcolumn
();
getPipe
();
getchart
();
}
var
date
=
new
Date
();
var
year
=
date
.
getFullYear
();
var
day
=
0
;
var
dateArr
=
[
date
.
getMonth
()
+
1
,
//月份从0~11,所以加一
date
.
getDate
(),
date
.
getHours
(),
date
.
getMinutes
(),
date
.
getSeconds
(),
];
for
(
var
i
=
0
;
i
<
dateArr
.
length
;
i
++
)
{
if
(
dateArr
[
i
]
>=
1
&&
dateArr
[
i
]
<=
9
)
{
dateArr
[
i
]
=
"0"
+
dateArr
[
i
];
}
function
getcolumn
()
{
http
.
post
(
"/api/pipe/Title"
,
{
enterpriseId
:
enterpriseId
.
value
,
deviceType
:
HisPipeInfo
.
deviceType
}).
then
((
result
)
=>
{
if
(
result
.
success
){
titleData
.
value
=
result
.
data
.
otherList
;
frozenList
.
length
=
0
;
result
.
data
.
frozenList
.
forEach
((
element
)
=>
{
//生成固定表头
frozenList
.
push
({
field
:
element
.
field
[
0
].
toLowerCase
()
+
element
.
field
.
substring
(
1
),
alias
:
element
.
title
,
sortable
:
element
.
sortable
,
width
:
element
.
width
,
filter
:
element
.
filter
,
color
:
element
.
color
,
isVisible
:
true
});
});
let
i
=
0
;
otherList
.
length
=
0
;
result
.
data
.
otherList
.
forEach
((
element
)
=>
{
//生成非固定表头
otherList
.
push
({
alias
:
element
.
alias
,
backColor
:
element
.
backColor
,
baseId
:
element
.
baseId
,
decimalPoint
:
element
.
decimalPoint
,
enName
:
element
.
enName
[
0
].
toLowerCase
()
+
element
.
enName
.
substring
(
1
),
orderNum
:
element
.
orderNum
,
width
:
element
.
width
,
isVisible
:
element
.
isVisible
})
i
++
;
})
}
})
}
day
=
dateArr
[
1
]
-
1
;
if
(
day
>=
1
&&
day
<=
9
)
{
day
=
"0"
+
day
;
}
var
startTime
=
sessionStorage
.
getItem
(
"DeviceQueryStart"
);
if
(
!
startTime
){
startTime
=
year
+
"-"
+
dateArr
[
0
]
+
'-'
+
day
+
" "
+
dateArr
[
2
]
+
":"
+
dateArr
[
3
]
+
":"
+
dateArr
[
4
];
sessionStorage
.
setItem
(
"DeviceQueryStart"
,
startTime
);
}
var
endTime
=
sessionStorage
.
getItem
(
"DeviceQueryEnd"
);
if
(
!
endTime
){
endTime
=
year
+
"-"
+
dateArr
[
0
]
+
"-"
+
dateArr
[
1
]
+
" "
+
dateArr
[
2
]
+
":"
+
dateArr
[
3
]
+
":"
+
dateArr
[
4
];
sessionStorage
.
setItem
(
"DeviceQueryEnd"
,
endTime
);
}
const
AlarmInfo
=
reactive
({
"Id"
:
[],
"startTime"
:
startTime
,
"endTime"
:
endTime
,
"start"
:
0
,
"count"
:
30
,
"sort"
:
""
})
getSupplys
();
getdata
();
function
getdata
()
{
sessionStorage
.
setItem
(
"DeviceQueryStart"
,
AlarmInfo
.
startTime
);
sessionStorage
.
setItem
(
"DeviceQueryEnd"
,
AlarmInfo
.
endTime
);
gettransfer
();
}
//获取选择列表
function
getoptions
(){
if
(
type
.
value
===
"GetPipeAlarmData"
){
getPipes
();
}
else
if
(
type
.
value
===
"GetBoilerAlarmData"
){
getBoilers
();
}
else
{
getSupplys
();
}
//获取数据列表
function
getPipe
()
{
console
.
log
(
HisPipeInfo
.
startTime
);
if
(
currentPage
.
value
==
1
)
{
HisPipeInfo
.
pageIndex
=
0
;
HisPipeInfo
.
pageCount
=
pageSize
.
value
;
}
else
{
HisPipeInfo
.
pageIndex
=
((
currentPage
.
value
-
1
)
*
pageSize
.
value
)
+
1
;
HisPipeInfo
.
pageCount
=
pageSize
.
value
-
1
;
}
if
(
HisPipeInfo
.
interval
===
undefined
)
{
HisPipeInfo
.
interval
=
2
;
}
http
.
post
(
"/api/pipe/History"
,
HisPipeInfo
).
then
((
result
)
=>
{
tableData
.
value
=
result
.
data
.
dataInfoList
;
total
.
value
=
result
.
data
.
rowCount
;
if
(
result
.
data
===
null
||
HisPipeInfo
.
id
.
length
<
1
){
tableData
.
value
=
null
;
total
.
value
=
0
;
gettransfer
();
}
//获取锅炉列表
function
getBoilers
(){
loading
.
value
=
true
;
tableData
.
value
.
length
=
0
;
AlarmInfo
.
Id
.
length
=
0
;
options
.
length
=
0
;
var
result
=
store
.
getters
.
getEnterprise
();
if
(
result
)
{
result
.
forEach
(
element
=>
{
if
(
element
.
enterpriseId
===
enterpriseId
.
value
){
if
(
element
.
enterpriseId
===
"9BCA54BC-8F27-4849-8D7D-50C5099E1949"
.
toLowerCase
()){
element
.
serviceCenterList
.
forEach
(
center
=>
{
center
.
supplyList
.
forEach
(
supply
=>
{
supply
.
boilerList
.
forEach
(
boiler
=>
{
options
.
push
({
value
:
boiler
.
boilerId
,
label
:
boiler
.
description
});
})
});
})
}
else
{
element
.
supplyList
.
forEach
(
supply
=>
{
supply
.
boilerList
.
forEach
(
boiler
=>
{
options
.
push
({
value
:
boiler
.
boilerId
,
label
:
boiler
.
description
});
})
})
}
}
loading
.
value
=
false
;
});
}
function
setCellStyle
({
row
,
column
,
rowIndex
,
columnIndex
})
{
let
css_color
=
{};
css_color
[
'padding-left'
]
=
'0px'
;
css_color
[
'padding-right'
]
=
'0px'
;
css_color
[
'borderColor'
]
=
'#97d5fd'
;
css_color
[
'padding'
]
=
'0px'
;
frozenList
.
forEach
(
element
=>
{
if
(
element
.
field
===
column
.
property
)
{
css_color
[
'background-color'
]
=
'#'
+
element
.
color
;
}
})
otherList
.
forEach
(
element
=>
{
if
(
element
.
enName
===
column
.
property
)
{
css_color
[
'background-color'
]
=
'#'
+
element
.
backColor
;
}
})
return
css_color
;
}
function
setHeaderCellStyle
({
row
,
column
,
rowIndex
,
columnIndex
})
{
let
css_color
;
frozenList
.
forEach
(
element
=>
{
if
(
element
.
field
===
column
.
property
)
{
var
backcolor
=
(
element
.
color
==
'FFFFFF'
)
?
'd9f1ff'
:
element
.
color
;
css_color
=
{
'background-color'
:
'#'
+
backcolor
,
'padding-left'
:
'0px'
,
'padding-right'
:
'0px'
,
'borderColor'
:
'#97d5fd'
,
'color'
:
'#000'
,
'text-align'
:
'center'
,
'vertical-align'
:
'top'
};
}
})
otherList
.
forEach
(
element
=>
{
if
(
element
.
enName
===
column
.
property
)
{
var
backcolor
=
(
element
.
backColor
==
'FFFFFF'
)
?
'd9f1ff'
:
element
.
backColor
;
css_color
=
{
'background-color'
:
'#'
+
backcolor
,
'padding-left'
:
'0px'
,
'padding-right'
:
'0px'
,
'borderColor'
:
'#97d5fd'
,
'color'
:
'#000'
,
'text-align'
:
'center'
,
'vertical-align'
:
'top'
};
}
options
.
forEach
(
element
=>
{
AlarmInfo
.
Id
.
push
(
element
.
value
);
})
return
css_color
;
}
/**
* 获取当前时间
*/
// function currentTime() {
// var date = new Date();
// var year = date.getFullYear(); //月份从0~11,所以加一
// let month = date.getMonth();
// console.log("month", month);
// var dateArr = [
// date.getMonth() + 1,
// date.getDate(),
// date.getHours(),
// date.getMinutes(),
// date.getSeconds(),
// ];
// //如果格式是MM则需要此步骤,如果是M格式则此循环注释掉
// for (var i = 0; i
<
dateArr
.
length
;
i
++
)
{
// if (dateArr[i] >= 1 && dateArr[i]
<=
9
)
{
// dateArr[i] = "0" + dateArr[i];
// }
// }
// var strDate = year + dateArr[0] + dateArr[1] + dateArr[2] + dateArr[3] + dateArr[4];
// //此处可以拿外部的变量接收 strDate:2022-05-01 13:25:30
// //this.date = strDate;
// return strDate;
// }
// 导出表格 按钮点击后触发事件
async
function
exportExcel
()
{
sessionStorage
.
setItem
(
"DeviceQueryStart"
,
HisPipeInfo
.
startTime
);
sessionStorage
.
setItem
(
"DeviceQueryEnd"
,
HisPipeInfo
.
endTime
);
HisPipeInfo
.
pageIndex
=
0
;
HisPipeInfo
.
pageCount
=
100000
;
if
(
HisPipeInfo
.
interval
===
undefined
)
{
HisPipeInfo
.
interval
=
2
;
}
var
fileName
=
getFileName
(
"总管历史数据"
);
await
http
.
post
(
"/api/pipe/hisExport"
,
HisPipeInfo
,
'正在导出数据....'
,
{
responseType
:
'blob'
}).
then
((
content
)
=>
{
try
{
const
blob
=
new
Blob
([
content
]);
if
(
'download'
in
document
.
createElement
(
'a'
))
{
// 非IE下载
const
elink
=
document
.
createElement
(
'a'
);
elink
.
download
=
fileName
;
elink
.
style
.
display
=
'none'
;
elink
.
href
=
URL
.
createObjectURL
(
blob
);
document
.
body
.
appendChild
(
elink
);
elink
.
click
();
URL
.
revokeObjectURL
(
elink
.
href
);
document
.
body
.
removeChild
(
elink
);
}
else
{
// IE10+下载
navigator
.
msSaveBlob
(
blob
,
fileName
);
}
//获取总管列表
function
getPipes
(){
loading
.
value
=
true
;
tableData
.
value
.
length
=
0
;
AlarmInfo
.
Id
.
length
=
0
;
var
result
=
store
.
getters
.
getEnterprise
();
if
(
result
)
{
options
.
length
=
0
;
result
.
forEach
(
element
=>
{
if
(
element
.
enterpriseId
===
enterpriseId
.
value
){
if
(
element
.
enterpriseId
===
"9BCA54BC-8F27-4849-8D7D-50C5099E1949"
.
toLowerCase
()){
element
.
serviceCenterList
.
forEach
(
center
=>
{
center
.
supplyList
.
forEach
(
supply
=>
{
options
.
push
({
value
:
supply
.
pipeInfo
.
pipeId
,
label
:
supply
.
pipeInfo
.
pipeName
});
});
})
}
else
{
element
.
supplyList
.
forEach
(
supply
=>
{
options
.
push
({
value
:
supply
.
pipeInfo
.
pipeId
,
label
:
supply
.
pipeInfo
.
pipeName
});
})
}
}
catch
(
error
){
console
.
log
(
error
);
}
});
// const enNameToCnName = {};
// HisPipeInfo.pageCount = 999999;
// frozenList.forEach(element => {
// enNameToCnName[element.field] = element.alias;
// })
// otherList.forEach(element => {
// enNameToCnName[element.enName] = element.alias;
// })
// console.log(enNameToCnName);
// http.post("/api/pipe/History", HisPipeInfo).then((result) => {
// console.log(result);
// let excelData = result.data.dataInfoList.map(n => {
// // console.log(Object.keys(n))
// let newItem = [];
// Object.keys(n).forEach(k => {
// // console.log(n[k])
// newItem[enNameToCnName[k]] = n[k]
// })
// return newItem
// });
// const xlsx0bj = {
// SheetNames: ['sheet1'],//指定有序 sheet 的 name
// Sheets: {
// // 表格数据内容
// ['sheet1']: XLSX.utils.json_to_sheet(excelData)
// }
// }
// XLSX.writeFile(xlsx0bj, '123.xlsx');
// });
}
onMounted
(()
=>
{
setContentHeight
();
window
.
addEventListener
(
'resize'
,
setContentHeight
);
console
.
log
(
options
);
options
.
forEach
(
element
=>
{
AlarmInfo
.
Id
.
push
(
element
.
value
);
})
onUnmounted
(()
=>
{
window
.
removeEventListener
(
'resize'
,
setContentHeight
);
})
//获取折线图
function
getchart
()
{
if
(
value
.
value
===
false
)
{
const
series
=
reactive
([]);
const
titles
=
reactive
([]);
const
title
=
ref
();
let
id
=
""
;
id
=
HisPipeInfo
.
id
[
0
];
HisPipeInfo
.
id
=
[];
HisPipeInfo
.
id
.
push
(
id
);
HisPipeInfo
.
pageCount
=
999999
;
options
.
forEach
(
element
=>
{
if
(
element
.
value
===
id
){
title
.
value
=
element
.
label
;
}
})
http
.
post
(
"/api/pipe/Curve"
,
HisPipeInfo
).
then
((
result
)
=>
{
curveTitleData
.
value
=
result
.
data
.
title
;
console
.
log
(
result
);
result
.
data
.
title
.
forEach
(
element
=>
{
titles
.
push
(
element
.
alias
);
let
da
=
new
Array
();
result
.
data
.
data
.
forEach
(
elements
=>
{
da
.
push
(
elements
[
element
.
enName
[
0
].
toLowerCase
()
+
element
.
enName
.
substring
(
1
)])
})
timeList
.
length
=
0
;
result
.
data
.
data
.
forEach
(
ele
=>
{
timeList
.
push
(
ele
.
gatherTime
)
console
.
log
(
AlarmInfo
.
Id
);
}
//获取换热机组列表
function
getSupplys
(){
loading
.
value
=
true
;
tableData
.
value
.
length
=
0
;
options
.
length
=
0
;
AlarmInfo
.
Id
.
length
=
0
;
var
result
=
store
.
getters
.
getEnterprise
();
if
(
result
)
{
result
.
forEach
(
element
=>
{
if
(
element
.
enterpriseId
===
enterpriseId
.
value
){
if
(
element
.
enterpriseId
===
"9BCA54BC-8F27-4849-8D7D-50C5099E1949"
.
toLowerCase
()){
element
.
serviceCenterList
.
forEach
(
center
=>
{
let
c
=
[];
center
.
supplyList
.
forEach
(
supply
=>
{
let
chi
=
[];
supply
.
transferList
.
forEach
(
unit
=>
{
chi
.
push
({
value
:
unit
.
unitId
,
label
:
unit
.
unitName
});
});
c
.
push
({
children
:
chi
,
label
:
supply
.
supplyName
});
});
options
.
push
({
children
:
c
,
label
:
center
.
serviceCenterName
});
})
series
.
push
({
name
:
element
.
alias
,
type
:
'line'
,
data
:
da
}
else
{
element
.
supplyList
.
forEach
(
element
=>
{
let
chi
=
[];
element
.
transferList
.
forEach
(
unit
=>
{
chi
.
push
({
value
:
unit
.
unitId
,
label
:
unit
.
unitName
});
})
options
.
push
({
children
:
chi
,
label
:
element
.
supplyName
});
})
})
option
.
value
=
{
title
:
{
text
:
title
.
value
+
'历史数据'
},
tooltip
:
{
trigger
:
'axis'
},
legend
:
{
data
:
titles
},
grid
:
{
left
:
'3%'
,
right
:
'4%'
,
bottom
:
'3%'
,
containLabel
:
true
},
toolbox
:
{
feature
:
{
saveAsImage
:
{}
}
},
xAxis
:
{
type
:
'category'
,
boundaryGap
:
false
,
data
:
timeList
},
yAxis
:
{
type
:
'value'
,
axisLabel
:
{
formatter
:
'{value} ℃'
}
},
series
:
series
};
console
.
log
(
option
.
value
);
var
myChart
=
echarts
.
init
(
document
.
getElementById
(
'chart'
));
myChart
.
setOption
(
option
.
value
);
//图表响应式
window
.
addEventListener
(
'resize'
,
()
=>
{
myChart
.
resize
();
})
})
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.moduleCard {
width: auto;
overflow: auto;
//max-height: 540px;
padding: 2px;
::v-deep .el-card__body {
padding: 0px;
}
}
.pagination {
padding: 4px;
margin-left: 20px;
height: 30px;
//background-color: #8939cf;
vertical-align: middle;
}
//鼠标所在行的颜色
::v-deep .el-table__body tr:hover>td {
background: linear-gradient(to top, rgb(0, 198, 255), rgb(255, 255, 255)) !important;
}
}
});
}
::v-deep .el-table__body tr.current-row>td {
background-color: #92cbf1 !important;
AlarmInfo
.
Id
.
push
(
options
[
0
].
children
[
0
].
children
[
0
].
value
);
}
//获取数据列表
function
gettransfer
()
{
loading
.
value
=
true
;
if
(
currentPage
.
value
==
1
)
{
AlarmInfo
.
start
=
0
;
AlarmInfo
.
count
=
pageSize
.
value
;
}
else
{
AlarmInfo
.
start
=
((
currentPage
.
value
-
1
)
*
pageSize
.
value
)
+
1
;
AlarmInfo
.
count
=
pageSize
.
value
-
1
;
}
.card-contianer {
width: auto;
height: 70px;
.div-header {
width: 100%;
display: flex;
margin: 20px;
http
.
post
(
"/api/alarm/"
+
type
.
value
,
AlarmInfo
).
then
((
result
)
=>
{
console
.
log
(
result
.
data
);
if
(
result
.
data
!==
null
){
tableData
.
value
=
result
.
data
.
dataInfoList
;
total
.
value
=
result
.
data
.
rowCount
;
}
if
(
result
.
data
===
null
||
AlarmInfo
.
Id
.
length
<
1
){
tableData
.
value
=
null
;
total
.
value
=
0
;
}
loading
.
value
=
false
;
});
}
function
setCellStyle
({
row
,
column
,
rowIndex
,
columnIndex
})
{
let
css_color
=
{};
css_color
[
'padding-left'
]
=
'0px'
;
css_color
[
'padding-right'
]
=
'0px'
;
css_color
[
'borderColor'
]
=
'#97d5fd'
;
css_color
[
'padding'
]
=
'0px'
;
return
css_color
;
}
function
setHeaderCellStyle
({
row
,
column
,
rowIndex
,
columnIndex
})
{
let
css_color
;
var
backcolor
=
'd9f1ff'
;
css_color
=
{
'background-color'
:
'#'
+
backcolor
,
'padding-left'
:
'0px'
,
'padding-right'
:
'0px'
,
'borderColor'
:
'#97d5fd'
,
'color'
:
'#000'
,
'text-align'
:
'center'
,
'vertical-align'
:
'top'
};
var
backcolor
=
'd9f1ff'
;
css_color
=
{
'background-color'
:
'#'
+
backcolor
,
'padding-left'
:
'0px'
,
'padding-right'
:
'0px'
,
'borderColor'
:
'#97d5fd'
,
'color'
:
'#000'
,
'text-align'
:
'center'
,
'vertical-align'
:
'top'
};
return
css_color
;
}
// // 导出表格 按钮点击后触发事件
// async function exportExcel () {
// sessionStorage.setItem("DeviceQueryStart", AlarmInfo.startTime);
// sessionStorage.setItem("DeviceQueryEnd", AlarmInfo.endTime);
// AlarmInfo.pageIndex = 0;
// AlarmInfo.pageCount = 100000;
// if (AlarmInfo.interval === undefined) {
// AlarmInfo.interval = 2;
// }
// var fileName = getFileName("换热站历史数据");
// await http.post("/api/transfer/hisExport", AlarmInfo, '正在导出数据....', { responseType: 'blob' }).then((content) => {
// try{
// const blob = new Blob([content]);
// if ('download' in document.createElement('a')) {
// // 非IE下载
// const elink = document.createElement('a');
// elink.download = fileName;
// elink.style.display = 'none';
// elink.href = URL.createObjectURL(blob);
// document.body.appendChild(elink);
// elink.click();
// URL.revokeObjectURL(elink.href);
// document.body.removeChild(elink);
// } else {
// // IE10+下载
// navigator.msSaveBlob(blob, fileName);
// }
// }catch(error){
// console.log(error);
// }
// });
// }
onMounted
(()
=>
{
setContentHeight
();
window
.
addEventListener
(
'resize'
,
setContentHeight
);
})
onUnmounted
(()
=>
{
window
.
removeEventListener
(
'resize'
,
setContentHeight
);
})
</
script
>
<
style
lang=
"less"
scoped
>
.moduleCard {
width: auto;
overflow: auto;
//max-height: 540px;
padding: 0px;
::v-deep .el-card__body {
padding: 0px;
}
.el-form-item {
margin-top: -20px;
margin-right: 30px;
}
.pagination {
padding: 4px;
margin-left: 20px;
height: 30px;
//background-color: #8939cf;
vertical-align: middle;
}
//鼠标所在行的颜色
::v-deep .el-table__body tr:hover>td {
background: linear-gradient(to top, rgb(0, 198, 255), rgb(255, 255, 255)) !important;
}
::v-deep .el-table__body tr.current-row>td {
background-color: #92cbf1 !important;
}
.card-contianer {
width: auto;
height: 70px;
.div-header {
width: 100%;
display: flex;
margin: 20px;
}
.search-box {
background: #fefefe;
margin-top: 0px;
border: 1px solid #eae8e8;
position: absolute;
z-index: 999;
//left: 15px;
// right: 15px;
padding: 25px 20px;
padding-bottom: 0;
border-top: 0;
box-shadow: 0 7px 18px -12px #bdc0bb;
width: 100%;
height: 160px;
}
</
style
>
\ No newline at end of file
}
.el-form-item {
margin-top: -20px;
margin-right: 30px;
}
.el-tag--mini {
height: 21px !important
}
.el-cascader .el-input .el-input__inner:focus, .el-cascader .el-input.is-focus .el-input__inner{
height: 33px; //这里高度根据需求自己设定
}
.el-cascader__tags {
display: inline-flex;
margin-right: 10px;
flex-wrap: nowrap;
}
</
style
>
\ No newline at end of file
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