303 lines
7.7 KiB
Vue
Raw Permalink 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 class="dangerList">
<view class="fixedheader">
<headers :themeType="true" :showBack="true">
<view class="headerName">
{{headerTitle}}
</view>
</headers>
</view>
<scroll-view class="smallHeight" :style="{ 'padding-top': (statusBarHeight + 45) * 1.5 + 'rpx' }" scroll-y>
<view class="danger-list">
<view v-if="dataList&&dataList.length>0">
<view class="danger-item"
v-for="(item, index) in dataList" :key="index"
@click="previewDetail(item)">
<view class="item-title flex" v-if="item.checkContent">
<text class="item-lv" :class="{'lv2': item.faultLevel == 2}" v-if="item.faultLevel">{{item.faultLevel == 1 ? '一般':'重大'}}</text>
<text class="item-h2">{{item.checkContent}}</text>
</view>
<view class="item-content flex">
<view class="item-type">检查类型:{{item.inspectTypeName}}</view>
<view>检查人:{{item.createUserName}}</view>
</view>
<view class="item-content flex">
<view>检查时间:{{item.inspectTime}}</view>
</view>
<view class="item-bottom flex">
<view class="item-address flex">
<image src="/static/safeMange/address_icon.png"></image>
{{item.dutyRegion}}
</view>
<view class="item-tag" :class="{'status1': item.status == 2, 'status2': item.status == 3, 'status3': item.status == 1 || item.status == 4 }">
{{item.status == 2 ? '待整改': item.status == 3 ? '待复核' : item.status == 1 || item.status == 4 ? '已闭合' : ''}}
</view>
</view>
</view>
<view class="loadMoreBox" v-if="isLoadMore">
<uni-load-more :status="loadStatus" iconType="auto"></uni-load-more>
</view>
</view>
<view class="no-data" v-else>
<image class="img" src="/static/noData.png"></image>
<text class="txt">暂无数据</text>
</view>
</view>
</scroll-view>
<levitatedsphere :x="100" :y="80"></levitatedsphere>
</view>
</template>
<script>
import levitatedsphere from "@/components/levitatedsphere/levitatedsphere.vue"
import headers from '../../../components/headers/headers.vue'
export default{
data(){
return{
statusBarHeight: 0,
pageType: 0,
headerTitle: "",
dataList:[],
userId: "",
itemId: "",
loadStatus:'more',
isLoadMore: false,
pageNo: 1,
pageSize: 10,
engineeringId: ""
}
},
components:{
headers
},
onShow(){
this.dataList = []
this.pageNo = 1
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
this.userId = JSON.parse(uni.getStorageSync('userInfo')).userId
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
this.queryData()
console.log(this)
},
onLoad(val){
if(val.engineeringId){
this.engineeringId = val.engineeringId
}
this.pageType = val.type
if(val.type == 1){
this.headerTitle = "待整改"
} else if(val.type == 2){
this.headerTitle = "待复核"
} else if(val.type == 3){
this.headerTitle = "检查台账"
} else if(val.type == 4){
this.headerTitle = "整改单列表"
} else if(val.type == 5){
this.headerTitle = "隐患问题"
} else if(val.type == 6){
this.headerTitle = "排查记录"
}
if(val.itemId){
this.itemId = val.itemId
}
this.userId = JSON.parse(uni.getStorageSync('userInfo')).userId
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
// this.queryData()
console.log(this.projectSn)
},
onReachBottom() {
console.log(1)
if(!this.isLoadMore){ //此处判断,上锁,防止重复请求
this.isLoadMore=true
this.pageNo+=1
this.queryData()
}
},
onPullDownRefresh() {
console.log(2)
this.pageNo=1
this.dataList=[]
this.queryData()
},
methods:{
queryData(){
let _this = this
let data = {
changeUser: "",
createUser: "",
reviewId: "",
itemId: "",
pageNo: this.pageNo,
pageSize: this.pageSize,
projectSn: this.projectSn,
engineeringId: this.engineeringId
}
if(this.itemId){
data.itemId = this.itemId
}
if(this.pageType == 1){
data.changeUser = this.userId
data.status = 2
} else if(this.pageType == 2){
data.reviewId = this.userId
data.status = 3
} else if(this.pageType == 5){
data.recordType = 1
} else if(this.pageType == 6){
data.recordType = 2
}
console.log(this.userId)
this.sendRequest({
url: 'xmgl/hiddenDangerInspectRecord/list',
// url: 'xmgl/xzSecurityQualityInspectionRecord/list',
method: 'post',
data: data,
success: res => {
this.dataList=this.dataList.concat(res.result.records)
// this.dataList=res.result.records
if(res.result.records.length<this.pageSize){ //判断接口返回数据量小于请求数据量则表示此为最后一页
this.isLoadMore=true
this.loadStatus='nomore'
}else{
this.isLoadMore=false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
console.log(res.result, '-----list')
}
})
},
previewDetail(val){
if(uni.getStorageSync('dangerData')){
uni.removeStorageSync('dangerData');
}
uni.setStorageSync('detailData', val);
if(this.pageType == 1){
uni.navigateTo({
url: "./addExamine?type=2"
})
} else if(this.pageType == 2){
uni.navigateTo({
url: "./addExamine?type=3"
})
} else if(this.pageType == 3 || this.pageType == 4 || this.pageType == 5 || this.pageType == 6){
uni.navigateTo({
url: "./addExamine?type=4"
})
}
}
}
}
</script>
<style lang="scss" scoped>
.dangerList{
.fixedheader{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
}
.smallHeight{
height: 100%;
box-sizing: border-box;
}
.flex{
display: flex;
}
.danger-list{
padding: 24rpx 30rpx 80rpx 30rpx;
.danger-item{
width: 100%;
padding: 30rpx 20rpx 30rpx 42rpx;
box-shadow: 0 4rpx 16rpx 4rpx rgba(0, 0, 0, 0.11);
box-sizing: border-box;
border-radius: 10rpx;
margin-bottom: 24rpx;
.item-title{
height: 40rpx;
align-items: center;
margin-bottom: 26rpx;
.item-lv{
display: inline-block;
background: #2b8df3;
color: #fff;
padding: 4rpx 18rpx;
font-size: 24rpx;
border-radius: 8rpx;
margin-right: 14rpx;
white-space: nowrap;
}
.lv2{
background: #FE6565;
}
.item-h2{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 600;
font-size: 30rpx;
}
}
.item-content{
font-size: 26rpx;
margin-bottom: 10rpx;
.item-type{
margin-right: 76rpx;
}
}
.item-bottom{
align-items: center;
justify-content: space-between;
font-size: 24rpx;
.item-address{
color: #CECFD3;
align-items: center;
uni-image{
width: 24rpx;
height: 24rpx;
margin-right: 20rpx;
}
}
.item-tag{
height: 40rpx;
width: 100rpx;
line-height: 40rpx;
padding-left: 14rpx;
box-sizing: border-box;
border-radius: 22rpx;
}
.status1{
color: #FE7322;
background: linear-gradient(to right, rgba(255,113,30, 0.2), rgba(255,113,30, 0.01));
}
.status2{
color: #8556F2;
background: linear-gradient(to right, rgba(133,86,242, 0.2), rgba(133,86,242, 0.01));
}
.status3{
color: #fff;
background: linear-gradient(to right, rgba(103,178,253, 0.8), rgba(103,178,253, 0.01));
}
}
}
}
.no-data{
text-align: center;
margin-top: 50%;
.img{
display: block;
height: 200rpx;
width: 200rpx;
margin: 0 auto;
margin-top: 60rpx;
margin-bottom: 60rpx;
}
.txt{
color: #C0C4CC;
}
}
}
</style>