325 lines
6.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<view class="barBox">
<headers :themeType="'white'" :showBack="true">
<view class="title">
<view class="backBtn">
<view>
<!-- <span class="back" @click="goBack()">返回</span> -->
<span class="tip">告警提示</span>
</view>
</view>
</view>
</headers>
</view>
<view v-if="typeState.length>0" class="flex evenly typeState">
<view :class="status==item.val?'this_class':''" v-for="(item,index) in typeState" :key="index"
@click="typeStateEve(item.val)">
{{item.txt}}
</view>
</view>
<view class="">
<view class="alarm-item" v-for="(item,index) in listData" :key="item.id" @click="goHiidden(item)">
<view>报警类型: {{alarmType[item.alarmType]}}报警</view>
<view>报警设备: {{item.hardwareName}}</view>
<view>报警时间: {{item.createTime}}</view>
<view>报警地址: {{item.location}}</view>
<!-- <image @click="saveImage(url_config+'image/'+item.imageUrl,index)" class="accessoryImg"
:src="url_config+'image/'+item.imageUrl"></image> -->
<!-- <image class="accessoryImg"
:src="url_config+'image/'+item.imageUrl"></image> -->
</view>
</view>
<view class="noData" v-if="listData.length==0">
暂无数据~
</view>
<!-- <Select/> -->
</view>
</template>
<script>
import Select from "./components/Select.vue";
export default {
components: {
Select
},
data() {
return {
listData: [],
projectSn: '',
pageNo: 1,
pageSize: 7,
systemInfo: {
statusBarHeight: 0
},
alarmType: {
1: "烟感",
2: "明火",
3: "人员倒地",
4: "未戴安全帽",
5: "区域入侵",
6: "越界入侵",
7: "人员聚集衣",
8: "反光衣",
9: "裸土覆盖",
13: "口罩识别",
14: "徘徊预警",
15: "物体滞留监测",
16: "绊线监测"
},
userInfo: {},
typeState: [{
txt: '待发起',
val: 1
}, {
txt: '已整改',
val: 3
}], //status整改状态 1:待发起 ,2:待整改 3已整改
status: 1
}
},
onLoad() {
},
onShow() {
if (JSON.parse(uni.getStorageSync('projectDetail'))) {
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
} else {
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).projectSn;
}
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
if (this.userInfo.accountType == 6) { //整改人状态
this.typeState = [];
this.status = 2;
} else {
this.typeState = [{
txt: '待发起',
val: 1
}, {
txt: '已整改',
val: 3
}]
}
this.listData = [];
this.pageNo = 1;
this.getListData();
},
mounted() {
this.systemInfo = uni.getStorageSync('systemInfo')
},
onPullDownRefresh() {
this.getListData()
setTimeout(function() {
uni.stopPullDownRefresh()
}, 1000)
},
onReachBottom() {
// console.log("============================")
this.pageNo++;
uni.showLoading({
title: '加载中'
})
this.getListData()
},
methods: {
typeStateEve(v) {
this.status = v;
this.pageNo = 1;
this.listData = [];
this.getListData();
},
//获取列表数据
getListData() {
console.log(this.userInfo, "=======================================================")
let qData = {
projectSn: this.projectSn,
pageNo: this.pageNo,
pageSize: this.pageSize,
accountType: this.userInfo.accountType,
status: this.status,
isPushed: 1
}
if (this.userInfo.accountType == 6) {
qData.pushPersonId=this.userInfo.userId
}
this.sendRequest({
url: 'xmgl/aiAnalyseHardWareAlarmRecord/selectPageList',
method: "post",
data: qData,
success: res => {
if (res.code == 200) {
console.log('res', res)
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(item) {
// uni.navigateTo({
// url: "/pages/projectEnd/safeManage/addExamine"
// });
// uni.navigateTo({
// url: "/pages/potentialRisk/potentialRisk?dangerInfo="+ encodeURIComponent(JSON.stringify(item))
// });
uni.navigateTo({
url: "/pages/potentialRisk/potentialRisk?id=" + item.id
});
},
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>
.noData {
text-align: center;
padding: 120rpx 0;
color: #999;
}
.this_class {
color: #007AFF;
}
.typeState {
height: 80rpx;
background-color: #fff;
font-size: 28rpx;
width: 100%;
}
.barBox {
background-color: #5181F6;
}
.title {
height: 44px;
line-height: 44px;
font-size: 40rpx;
width: 750rpx;
background-color: #5181F6;
color: #fff;
text-align: center;
position: relative;
}
.accessoryImg {
margin-top: 10rpx;
width: 100%;
}
.backBtn {
font-size: 32rpx;
position: absolute;
left: 20%;
}
.back {
font-size: 24rpx;
}
.tip{
margin-left: 5rem;
}
.contain2 {
width: 750rpx;
content: " ";
// background-color: #f8f8f8;
// height: calc(100vh - 44px);
// overflow: auto;
}
.alarm-item {
width: 650rpx;
margin: 20rpx auto;
background-color: #fff;
padding: 40rpx;
box-sizing: border-box;
border-radius: 10rpx;
box-shadow: 0 0 10rpx #ccc;
}
.alarm-lable {
display: flex;
}
.alarm-lable-1 {
width: 200rpx;
}
.alarm-lable-2 {
flex: 1;
text-align: right;
color: #888;
}
.flex {
display: flex;
align-items: center;
}
.center {
justify-content: center;
}
.between {
justify-content: space-between;
}
.warp {
flex-wrap: wrap;
}
.evenly {
justify-content: space-evenly;
}
</style>