factory_mp_old/pages/home/list/event.vue

260 lines
5.2 KiB
Vue

<template>
<view class="event-wrap">
<uni-nav-bar @clickLeft="goBack()" height="110rpx" leftWidth="200rpx" leftText="实时报警" leftIcon="left" border
backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="my-top-search-nav">
<view class="search-wrap">
<view class="search-body">
<image class="left-img" src="/static/home/searchIcon.png" mode=""></image>
<input class="search-input" type="text" v-model="searchWord" placeholder="请输入关键字" />
<view class="right-btn" @click="getSearch">
搜索
</view>
</view>
</view>
</view>
<view class="empty-view"></view>
<view class="content">
<view class="item-wrap" v-for="event in eventList" :key="event.id">
<view class="event-item">
<view class="center-info">
<view class="info-details">{{event.voice_msg}}</view>
<view class="info-details">事件类型:
<text v-for="cate in event.cates_">{{cate.name}}</text>
</view>
<view class="info-details" v-if="event.area_!==null">报警区域:{{event.area_.name}}</view>
<view class="info-details" v-if="event.obj_cate==='people'&&event.employee_!=null">触发人:{{event.employee_.name}}</view>
<view class="info-details" v-else-if="event.obj_cate==='opl'">触发事件:{{event.operation_name}}</view>
<view class="info-details" v-if="event.employee_!=null">触发人部门:{{event.employee_.belong_dept_name}} </view>
<view class="info-details">触发时间:{{event.create_time}} </view>
</view>
<view class="bottom-btns">
<view class="shenhezhong bottom-btn" @click="eventHandle(event,'handle')">
<image src="../../../static/my/my_apply/blue-time.png" mode=""></image>
处理
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'warning',
data() {
return {
searchWord: '',
eventStatus: "",
pageSize: 10,
page: 1,
totalNum: 0,
eventList: [],
}
},
//上拉加载
onReachBottom() {
this.page += 1;
this.getEvent();
/* const totalPage = Math.ceil(this.totalNum / this.pageSize);
if (this.pageNum < totalPage) {
this.pageNum += 1;
this.getEvent();
} else {
uni.showToast({
title: "已全部加载",
icon: 'none'
})
} */
},
onShow() {
this.page = 1;
this.eventList = [];
this.getEvent();
},
//下拉刷新
onPullDownRefresh() {
this.page = 1;
this.eventList = [];
this.getEvent();
},
methods: {
goBack() {
uni.navigateBack({
delta: 1
})
},
getEvent() {
let that = this;
let params = {page: this.page};
that.$u.api.eventList(params).then(res => {
if(res.results.length>0){
res.results.forEach(item=>{
that.eventList.push(item);
})
}else{
uni.showToast({
title: "已全部加载",
icon: 'none'
})
}
})
},
eventHandle(val) {
let params = `?eventId=${val.id}`;
uni.navigateTo({
url: '../detail/eventHandle' + params,
})
},
getSearch() {},
}
}
</script>
<style scoped>
.empty-view {
height: 120rpx;
}
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(254deg,
#0ca7ee 0%,
#005aff 100%,
#2a8cff 100%,
#54bdff 100%),
linear-gradient(#e60012,
#e60012);
}
.event-wrap {
background-color: #f3fbff;
}
.event-wrap>>>.uni-navbar-btn-text text {
font-size: 32rpx !important;
}
.content {
padding: 14rpx;
}
.item-wrap {
margin-bottom: 14rpx;
}
.event-item {
width: 720rpx;
background-color: #ffffff;
border-radius: 10rpx;
margin: 0 auto;
padding: 24rpx 21rpx;
box-sizing: border-box;
}
.info-title {
font-family: PingFang-SC-Medium;
font-size: 30rpx;
line-height: 72rpx;
color: #3d3d3d;
flex: 1;
}
.right-time {
font-size: 24rpx;
line-height: 72rpx;
color: #ababab;
}
.center-info {
padding-bottom: 30rpx;
border-bottom: 1rpx solid #eeeeee;
}
.info-details {
font-size: 28rpx;
line-height: 40rpx;
color: #5b5b5b;
}
.bottom-btns {
text-align: center;
font-family: PingFang-SC-Medium;
font-size: 28rpx;
line-height: 83rpx;
}
.shenhezhong {
color: #2c6fd9;
}
.shenhe-status image {
width: 26rpx;
height: 26rpx;
margin-right: 10rpx;
vertical-align: middle;
}
.my-top-search-nav {
position: fixed;
left: 0;
right: 0;
z-index: 999;
}
.search-wrap {
background-blend-mode: normal,
normal;
padding-bottom: 44rpx;
padding-top: 20rpx;
}
.search-body {
width: 715rpx;
height: 78rpx;
background-color: #ffffff;
border-radius: 39rpx;
margin: 0 auto;
padding: 13rpx;
padding-left: 25rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.search-body .search-input {
height: 100%;
flex: 1;
padding-left: 12rpx;
box-sizing: border-box;
}
.left-img {
width: 26rpx;
height: 26rpx;
}
.right-btn {
width: 110rpx;
height: 58rpx;
line-height: 58rpx;
background-image: linear-gradient(0deg,
#2da0f3 0%,
#54bcff 100%);
border-radius: 29rpx;
font-size: 28rpx;
color: #ffffff;
text-align: center;
}
.bottom-btn image {
width: 26rpx;
height: 26rpx;
margin-right: 10rpx;
vertical-align: middle;
}
</style>