352 lines
7.6 KiB
Vue

<template>
<view class="addIssue">
<view class="fixedheader">
<headers :showBack="true">
<view class="headerName">
历史回放
</view>
</headers>
</view>
<view class="search-box" :style="{paddingTop: mobileTopHeight + 44 + 'px'}">
<view>
<view>{{workTicketHistoryInfo.no}}</view>
<view>{{itemDiffUp(workTicketHistoryInfo)}}</view>
</view>
<view>{{workTicketHistoryInfo.begin ? workTicketHistoryInfo.begin : '暂无'}} - {{workTicketHistoryInfo.end ? workTicketHistoryInfo.end : '暂无'}}</view>
</view>
<view class="content" :style="{paddingTop: mobileTopHeight + 105 + 'px'}">
<view v-if="policeCameraItemFileList.length > 0">
<view class="content_main-box" v-for="item in policeCameraItemFileList" :key="item.id">
<view>
<view>{{item.devName}}</view>
<view @click="onNavigateDetail(item)">查看回放</view>
</view>
<view>
<image v-if="item.pic" :src="url_config + 'image/' + item.pic" mode=""></image>
<image v-else src="/static/staffAttendance/attendance-bg2.png" mode=""></image>
<view>
<view>
<view>类别</view>
<view>{{item.typeName}}</view>
</view>
<view>
<view>编号</view>
<view>{{item.workTicketNumber}}</view>
</view>
</view>
</view>
<view>
<view>有效时长</view>
<view>{{item.startTime}} - {{item.endTime}}</view>
</view>
</view>
</view>
<view class="new-nodata" v-else>
<view></view>
<text>暂无回放...</text>
</view>
</view>
</view>
</template>
<script>
import TreeView from '@/components/tree-view/TreeView.vue';
export default {
components: {
TreeView
},
data() {
return {
mobileTopHeight: 0,
projectDetail: {},
historyId: "",
workTicketHistoryInfo: {},
policeCameraItemFileList: [],
policeCameraItemInfo: {},
itemId:"",
}
},
onLoad(opts) {
this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'));
this.historyId = opts.id;
this.getWorkTicketHistoryQueryByIdFn();
this.loadData();
},
mounted() {
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
uni.setStorageSync('systemInfo', res)
console.log(res)
}
})
},
onReachBottom() {
console.log(1)
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.pageNo += 1
this.getPoliceCameraItemFileListFn()
}
},
onPullDownRefresh() {
console.log(2)
this.pageNo = 1
this.policeCameraItemFileList = []
this.getPoliceCameraItemFileListFn()
},
methods: {
onNavigateDetail(row){
uni.navigateTo({
url: `./historicalReplayVideo?id=${row.id}`
})
},
loadData() {
this.pageNo = 1
this.policeCameraItemFileList = []
this.getPoliceCameraItemFileListFn();
},
// 分页列表查询执法记录仪文件信息
getPoliceCameraItemFileListFn() {
let data = {
pageNo: this.pageNo,
pageSize: this.pageSize,
projectSn: this.projectDetail.projectSn,
historyId: this.historyId,
}
this.sendRequest({
url: 'xmgl/policeCameraItemFile/page',
method: 'GET',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
console.log("workList======================", res)
const resultList = res.result.records.map(item => {
return {
...item,
}
})
this.policeCameraItemFileList = this.policeCameraItemFileList.concat(resultList)
if (res.result.records.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.isLoadMore = false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
}
}
})
},
// 通过id查询工作票历史记录信息
getWorkTicketHistoryQueryByIdFn() {
let that = this;
let data = {
projectSn: this.projectDetail.projectSn,
id: this.historyId,
};
this.sendRequest({
url: 'xmgl/workTicketHistory/queryById',
method: 'GET',
data: data,
success: res => {
if (res.code == 200) {
that.workTicketHistoryInfo = res.result;
}
}
})
},
},
computed: {
itemDiffUp() {
return (row) => {
// 定义两个日期
const date = this.$dayjs();
const date1 = this.$dayjs(row.begin);
const date2 = row.end ? this.$dayjs(row.end) : date;
// 计算两个日期之间的差异(默认单位是毫秒)
const diffInMilliseconds = date2.diff(date1);
const durationObj = this.$dayjs.duration(diffInMilliseconds);
const hour = durationObj.hours();
const minute = durationObj.minutes();
const second = durationObj.seconds();
return `${hour}h${minute}min${second}s`;
}
}
}
}
</script>
<style scoped lang="scss">
.addIssue {
min-height: 100vh;
background-color: #EFF3F7;
}
.content {
.content_main-box {
background-color: #FFFFFF;
padding: 26rpx;
margin-top: 20rpx;
>view:nth-child(3) {
margin-top: 20rpx;
display: flex;
align-items: center;
>view:first-child {
font-size: 26rpx;
color: #4D4D4D;
text-align: right;
}
>view:last-child {
margin-left: 40rpx;
font-size: 26rpx;
color: #4D4D4D;
}
}
>view:nth-child(2) {
margin-top: 22rpx;
display: flex;
align-items: center;
>image {
width: 80rpx;
height: 104rpx;
border-radius: 6rpx;
}
>view:last-child {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 40rpx;
height: 104rpx;
>view {
display: flex;
>view:first-child {
width: 84rpx;
font-size: 28rpx;
color: #4D4D4D;
text-align: right;
}
>view:last-child {
margin-left: 40rpx;
font-size: 28rpx;
color: #4D4D4D;
}
}
}
}
>view:first-child {
display: flex;
align-items: center;
justify-content: space-between;
>view:first-child {
font-weight: 800;
font-size: 30rpx;
color: #171717;
}
>view:last-child {
background-color: #3E89FD;
border-radius: 6rpx;
padding: 10rpx 20rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
}
}
}
}
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
/deep/ .headerBox {
border-bottom: none;
}
.headerName {
z-index: 1;
}
}
.search-box {
background-color: white;
width: 100%;
padding: 26rpx;
position: fixed;
z-index: 99;
>view:last-child {
font-weight: 500;
font-size: 28rpx;
color: #4D4D4D;
margin-top: 10rpx;
}
>view:first-child {
display: flex;
align-items: center;
justify-content: space-between;
>view:first-child {
font-size: 28rpx;
color: #4D4D4D;
}
>view:last-child {
padding: 6rpx 20rpx;
background-color: rgba(75, 141, 236, 0.1);
border-radius: 76rpx 76rpx 76rpx 76rpx;
border: 2rpx solid #FFFFFF;
font-size: 21rpx;
color: #4B8DEC;
}
}
}
.new-nodata {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
>view {
width: 300rpx;
height: 300rpx;
background-image: url('@/static/staffAttendance/nodata.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
>text {
font-size: 22rpx;
color: #808080;
margin-top: 60rpx;
}
}
</style>