zhgdyunapp/pages/alarmPage/indexTwo.vue

232 lines
4.5 KiB
Vue
Raw Normal View History

2022-08-02 15:11:04 +08:00
<template>
<view>
<view class="barBox">
2023-03-20 18:43:57 +08:00
<headers :themeType="'white'" clss>
2022-08-02 15:11:04 +08:00
<view class="title">
<view class="backBtn">
<view >
<span class="back" @click="goBack()">返回</span>
<span class="tip">告警提示</span>
</view>
</view>
</view>
</headers>
</view>
<view class="">
<view class="alarm-item" v-for="(item,index) in listData" :key="index" @click="goHiidden()">
<view>报警类型: {{item.alarmType}}</view>
<view>报警设备: {{item.hardwareName}}</view>
<view>报警时间: {{item.createTime}}</view>
<view>报警地址: {{item.location}}</view>
<view>报警抓拍:</view>
<image @click="saveImage(url_config+'image/'+item.imageUrl,index)" class="accessoryImg"
:src="url_config+'image/'+item.imageUrl"></image>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
listData: [],
projectSn: '',
pageNo: 1,
pageSize: 7,
systemInfo: {
statusBarHeight: 0
},
showType: [{
id: 1,
value: '安全帽报警',
},
{
id: 2,
vlaue: '明火报警'
},
{
id: 3,
value: '聚众报警'
},
{
id: 4,
value: '未戴安全帽报警'
},
{
id: 5,
value: '越界报警'
},
{
id: 6,
value: '闯入报警'
},
{
id: 7,
value: '反光衣报警'
},
{
id: 8,
value: '未穿反光衣'
},
]
}
},
mounted() {
this.systemInfo = uni.getStorageSync('systemInfo')
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
this.getListData()
},
onPullDownRefresh() {
this.getListData()
setTimeout(function() {
uni.stopPullDownRefresh()
}, 1000)
},
onReachBottom() {
// console.log("============================")
this.pageNo++;
uni.showLoading({
title: '加载中'
})
this.getListData()
},
methods: {
//获取列表数据
getListData() {
this.sendRequest({
url: 'xmgl/aiAnalyseHardWareAlarmRecord/selectPageList',
method: "post",
data: {
projectSn: this.projectSn,
pageNo: this.pageNo,
pageSize: this.pageSize,
},
success: res => {
if (res.code == 200) {
console.log('res', res)
res.result.records.forEach((item) => {
const result = this.showType.find((item2) => {
return item2.id == item.alarmType
})
item.alarmType = result.value
})
if (this.pageNo == 1) {
this.listData = []
}
// console.log('--------')
// this.listData = res.result.records
this.listData = [...this.listData, ...res.result.records]
uni.hideLoading() //关闭加载中
}
}
})
},
goBack() {
uni.reLaunch({
url: "/pages/projectEnd/projectIndex/projectIndex"
});
},
// 点击跳转
goHiidden(url) {
uni.navigateTo({
url: "/pages/projectEnd/safeManage/addExamine"
});
},
saveImage(url) {
uni.showLoading({
title: "保存中..."
})
uni.downloadFile({
url: url, //网络路径,下载下来
success: (res) => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath, //下载后的临时路径
success: res => { //下载完成后在相册里压根找不到
uni.hideLoading()
uni.showToast({
title: "保存成功!"
})
uni.navigateTo({
url: "/pages/projectEnd/safeManage/addExamine"
});
}
})
}
}
});
}
}
}
</script>
<style lang="scss" scoped>
.barBox {
background-color: #5181F6;
}
.title {
height: 44px;
line-height: 44px;
font-size: 20px;
width: 750rpx;
background-color: #5181F6;
color: #fff;
text-align: center;
position: relative;
}
.accessoryImg {
margin-top: 5px;
width: 100%;
}
.backBtn {
font-size: 16px;
position: absolute;
2023-03-20 18:43:57 +08:00
left: 20%;
2022-08-02 15:11:04 +08:00
}
.back {
font-size: 12px;
}
.tip{
2023-03-20 18:43:57 +08:00
margin-left: 5rem;
2022-08-02 15:11:04 +08:00
}
.contain2 {
width: 750rpx;
content: " ";
// background-color: #f8f8f8;
// height: calc(100vh - 44px);
// overflow: auto;
}
.alarm-item {
width: 650rpx;
margin: 20rpx auto;
background-color: #fff;
padding: 20px;
box-sizing: border-box;
border-radius: 5px;
box-shadow: 0 0 5px #ccc;
}
.alarm-lable {
display: flex;
}
.alarm-lable-1 {
width: 200rpx;
}
.alarm-lable-2 {
flex: 1;
text-align: right;
color: #888;
}
</style>