detail.vue
5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<template>
<el-dialog
class="manage-dialog shot-detail-dialog"
:visible.sync="detailVisible"
:close-on-click-modal="false"
@close="detailDialogClose"
:title="$t('button.historicalShot')">
<el-row style="padding-bottom:5px">
<el-col :span="22">
<el-select v-model="channelValue" filterable :placeholder="$t('pholder.deviceNumber')" style="width:230px">
<el-option v-for="item in channelList" :key="item.id" :label="item.serialnum" :value="item.serialnum">
</el-option>
</el-select>
<el-date-picker
v-model="date"
type="date"
:placeholder="$t('pholder.date')"
:picker-options="pickerOptions"
style="width:160px"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-col>
<el-col :span="2">
<el-button type="primary" class="search-btn" style="float:right;margin-right:10px" plain size="mini" @click="getSnapshotHisory">{{$t('button.search')}}</el-button>
</el-col>
</el-row>
<div class="">
<ul class="screenshot-ul shot-ul">
<p v-if="shotHistoryData.length == 0" style="text-align:center"><span>{{$t('echartsTitle.noData')}}</span></p>
<li v-for="item in shotHistoryData" :key="item.id" :class="screenshotLi" :style="liWidth">
<div class="label-box">
<!-- <p>{{ $t('table.deviceNum') + ': ' + item.serialnum }}</p>
<p>{{ $t('table.monitorSiteName') + ': ' + item.gate.name }}</p>
<p>{{ $t('table.localIP') + ': ' + item.device.localIp }}</p> -->
<p>{{ $t('table.time') + ': ' + item.counttime}}</p>
</div>
<div v-lazy-container="{ selector: 'img' }">
<img class="screenshot-img" :data-src="dealImg(item.snapshot)" :data-error="defaultImage">
</div>
<!-- <img class="screenshot-img" v-lazy="dealImg(item.snapshot)" :onerror="defaultImage"><img> -->
</li>
</ul>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="detailDialogClose" class="dialog-btn">{{$t('button.closed')}}</el-button>
</div>
</el-dialog>
</template>
<script>
import defaultImg from "@/assets/img/manage/screenshot.png";
export default {
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
}
},
defaultImage: require('../../../assets/img/manage/screenshot.png'),
detailVisible: false,
screenshotLi: 'screenshot-li screenshot3n',
channelList: [],
channelValue: '',
shotHistoryData: [],
date: dateUnit.dateFormat(new Date(),'yyyy-MM-dd')
}
},
methods: {
dialogInit(data,list) {
this.detailVisible = true;
this.channelList = list;
this.channelValue = data.serialnum;
this.getSnapshotHisory();
},
getSnapshotHisory(serialnum,date) {
let params = {
channelSerialnum: this.channelValue,
countdate: this.date,
}
this.$api.management.channelSnapshots(params)
.then(res => {
let result = res.data.data;
this.shotHistoryData = result;
this.liWidth = this.computedW()
})
.catch(err => {})
},
computedW() {
let imgLen = this.shotHistoryData.length;
if(imgLen == 1) {
return 'width: 100%';
} else if(imgLen > 1 && imgLen < 5) {
this.screenshotLi = 'screenshot-li screenshot2n'
return 'width: 48.5%;';
} else {
this.screenshotLi = 'screenshot-li screenshot3n'
return 'width: 32.5%;';
}
},
dealImg(snapshot){
if(snapshot){
var zoomImgUrl = this.getWindowHost() + '/' + snapshot;
return zoomImgUrl;
}else{
return defaultImage;
}
},
getWindowHost() {
return window._vionConfig.picUrl;
if(window._vionConfig.apiUrl.indexOf('http') != -1){
var apiUrl = window._vionConfig.apiUrl.match(/^http(s)?:\/\/\w+(\.\w+)*/)
return apiUrl[0]
}else{
return ""
}
},
detailDialogClose() {
this.shotHistoryData = [];
this.detailVisible = false;
},
},
}
</script>
<style scoped>
.shot-ul {
max-height: 720px;
}
.label-box {
position: absolute;
left: 5px;
bottom: 5%;
color: #f00;
}
@media (max-width: 1680px){
.shot-ul {
max-height: 700px;
}
}
@media (max-width: 1440px){
.shot-ul {
max-height: 565px;
}
}
@media (max-width: 1366px){
.shot-ul {
max-height: 440px;
}
.label-box {
font-size: 12px
}
}
@media (max-width: 1280px){
.shot-ul {
max-height: 390px;
}
}
</style>