增加新版本web页面
This commit is contained in:
576
web/src/views/cloudRecord/detail.vue
Executable file
576
web/src/views/cloudRecord/detail.vue
Executable file
@@ -0,0 +1,576 @@
|
||||
<template>
|
||||
<div id="recordDetail" class="app-container">
|
||||
<div :style="boxStyle">
|
||||
<div>
|
||||
<div v-if="this.$route.query.mediaServerId" class="page-header-btn" style="padding-right: 1rem">
|
||||
<b>节点:</b> {{ mediaServerId }}
|
||||
</div>
|
||||
<div v-if="this.$route.params.mediaServerId">
|
||||
<span>流媒体:{{ this.$route.params.mediaServerId }}</span>
|
||||
</div>
|
||||
<div class="record-list-box-box">
|
||||
<div v-if="showSidebar">
|
||||
<el-date-picker
|
||||
v-model="chooseDate"
|
||||
size="mini"
|
||||
:picker-options="pickerOptions"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="日期"
|
||||
style="width: 190px"
|
||||
@change="dateChange()"
|
||||
/>
|
||||
<!-- <el-button :disabled="!mediaServerId" size="mini" type="primary" icon="fa fa-cloud-download" style="margin: auto; margin-left: 12px " title="裁剪合并" @click="drawerOpen"></el-button>-->
|
||||
</div>
|
||||
<div class="record-list-box" style="height: calc(100vh - 170px); overflow: auto">
|
||||
<ul v-if="detailFiles.length >0" v-infinite-scroll="infiniteScroll" class="infinite-list record-list">
|
||||
<li v-for="(item,index) in detailFiles" :key="index" class="infinite-list-item record-list-item">
|
||||
<el-tag v-if="chooseFileIndex !== index" @click="chooseFile(index)">
|
||||
<i class="el-icon-video-camera" />
|
||||
{{ getFileShowName(item) }}
|
||||
</el-tag>
|
||||
<el-tag v-if="chooseFileIndex === index" type="danger">
|
||||
<i class="el-icon-video-camera" />
|
||||
{{ getFileShowName(item) }}
|
||||
</el-tag>
|
||||
<a
|
||||
class="el-icon-download"
|
||||
style="color: #409EFF;font-weight: 600;margin-left: 10px;"
|
||||
target="_blank"
|
||||
@click="downloadFile(item)"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-if="detailFiles.length === 0" class="record-list-no-val">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="playerBox">
|
||||
<div class="playBox" style="height: calc(100% - 90px); width: 100%; background-color: #000000">
|
||||
<div v-if="playLoading" style="position: relative; left: calc(50% - 32px); top: 43%; z-index: 100;color: #fff;float: left; text-align: center;">
|
||||
<div class="el-icon-loading" />
|
||||
<div style="width: 100%; line-height: 2rem">正在加载</div>
|
||||
</div>
|
||||
<h265web ref="recordVideoPlayer" :video-url="videoUrl" :height="'calc(100vh - 250px)'" :show-button="false" @playTimeChange="showPlayTimeChange" @playStatusChange="playingChange"/>
|
||||
</div>
|
||||
<div class="player-option-box">
|
||||
<VideoTimeline
|
||||
ref="Timeline"
|
||||
:init-time="initTime"
|
||||
:time-segments="timeSegments"
|
||||
:init-zoom-index="4"
|
||||
@timeChange="playTimeChange"
|
||||
@mousedown="timelineMouseDown"
|
||||
@mouseup="mouseupTimeline"
|
||||
/>
|
||||
<div v-if="showTime" class="time-line-show">{{ showTimeValue }}</div>
|
||||
</div>
|
||||
<div style="height: 40px; background-color: #383838; display: grid; grid-template-columns: 1fr 600px 1fr">
|
||||
<div style="text-align: left;">
|
||||
<div class="record-play-control" style="background-color: transparent; box-shadow: 0 0 10px transparent">
|
||||
<a target="_blank" class="record-play-control-item iconfont icon-list" title="列表" @click="sidebarControl()" />
|
||||
<a target="_blank" class="record-play-control-item iconfont icon-camera1196054easyiconnet" title="截图" @click="snap()" />
|
||||
<!-- <a target="_blank" class="record-play-control-item iconfont icon-xiazai011" title="下载" @click="gbPause()" />-->
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center;">
|
||||
<div class="record-play-control">
|
||||
<a v-if="chooseFileIndex > 0" target="_blank" class="record-play-control-item iconfont icon-diyigeshipin" title="上一个" @click="playLast()" />
|
||||
<a v-else style="color: #acacac; cursor: not-allowed" target="_blank" class="record-play-control-item iconfont icon-diyigeshipin" title="上一个" />
|
||||
<a target="_blank" class="record-play-control-item iconfont icon-kuaijin" title="快退五秒" @click="seekBackward()" />
|
||||
<a target="_blank" class="record-play-control-item iconfont icon-stop1" style="font-size: 14px" title="停止" @click="stopPLay()" />
|
||||
<a v-if="playing" target="_blank" class="record-play-control-item iconfont icon-zanting" title="暂停" @click="pausePlay()" />
|
||||
<a v-if="!playing" target="_blank" class="record-play-control-item iconfont icon-kaishi" title="播放" @click="play()" />
|
||||
<a target="_blank" class="record-play-control-item iconfont icon-houtui" title="快进五秒" @click="seekForward()" />
|
||||
<a v-if="chooseFileIndex < detailFiles.length - 1" target="_blank" class="record-play-control-item iconfont icon-zuihouyigeshipin" title="下一个" @click="playNext()" />
|
||||
<a v-else style="color: #acacac; cursor: not-allowed" target="_blank" class="record-play-control-item iconfont icon-zuihouyigeshipin" title="下一个" @click="playNext()" />
|
||||
<el-dropdown @command="changePlaySpeed">
|
||||
<a target="_blank" class="record-play-control-item record-play-control-speed" title="倍速播放">{{ playSpeed }}X</a>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
v-for="item in playSpeedRange"
|
||||
:key="item"
|
||||
:command="item"
|
||||
>{{ item }}X</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<div class="record-play-control" style="background-color: transparent; box-shadow: 0 0 10px transparent">
|
||||
<a v-if="!isFullScreen" target="_blank" class="record-play-control-item iconfont icon-fangdazhanshi" title="全屏" @click="fullScreen()" />
|
||||
<a v-else target="_blank" class="record-play-control-item iconfont icon-suoxiao1" title="全屏" @click="fullScreen()" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import h265web from '../common/h265web.vue'
|
||||
import VideoTimeline from '../common/VideoTimeLine/index.vue'
|
||||
import moment from 'moment'
|
||||
import screenfull from 'screenfull'
|
||||
|
||||
export default {
|
||||
name: 'CloudRecordDetail',
|
||||
components: {
|
||||
h265web, VideoTimeline
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSidebar: false,
|
||||
app: this.$route.params.app,
|
||||
stream: this.$route.params.stream,
|
||||
mediaServerId: null,
|
||||
dateFilesObj: [],
|
||||
mediaServerList: [],
|
||||
detailFiles: [],
|
||||
videoUrl: null,
|
||||
streamInfo: null,
|
||||
loading: false,
|
||||
chooseDate: null,
|
||||
playTime: null,
|
||||
playerTime: null,
|
||||
playSpeed: 1,
|
||||
chooseFileIndex: null,
|
||||
queryDate: new Date(),
|
||||
currentPage: 1,
|
||||
count: 1000000, // TODO 分页导致滑轨视频有效值无法获取完全
|
||||
total: 0,
|
||||
playLoading: false,
|
||||
showTime: true,
|
||||
isFullScreen: false,
|
||||
playSeekValue: 0,
|
||||
playing: false,
|
||||
taskTimeRange: [],
|
||||
timeFormat: '00:00:00',
|
||||
initTime: null,
|
||||
timelineControl: false,
|
||||
showOtherSpeed: true,
|
||||
timeSegments: [],
|
||||
pickerOptions: {
|
||||
cellClassName: (date) => {
|
||||
// 通过显示一个点标识这一天有录像
|
||||
const time = moment(date).format('YYYY-MM-DD')
|
||||
if (this.dateFilesObj[time]) {
|
||||
return 'data-picker-true'
|
||||
} else {
|
||||
return 'data-picker-false'
|
||||
}
|
||||
}
|
||||
},
|
||||
playSpeedRange: [1, 2, 4, 6, 8, 16, 20]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
boxStyle() {
|
||||
if (this.showSidebar) {
|
||||
return {
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '210px minmax(0, 1fr)'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
display: 'grid', gridTemplateColumns: '0 minmax(0, 1fr)'
|
||||
}
|
||||
}
|
||||
},
|
||||
showTimeValue() {
|
||||
return moment(this.playTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 查询当年有视频的日期
|
||||
this.getDateInYear(() => {
|
||||
if (Object.values(this.dateFilesObj).length > 0) {
|
||||
this.chooseDate = Object.values(this.dateFilesObj)[Object.values(this.dateFilesObj).length - 1]
|
||||
this.dateChange()
|
||||
}
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
this.$destroy('recordVideoPlayer')
|
||||
},
|
||||
methods: {
|
||||
sidebarControl() {
|
||||
this.showSidebar = !this.showSidebar
|
||||
},
|
||||
snap() {
|
||||
this.$refs.recordVideoPlayer.screenshot()
|
||||
},
|
||||
playLast() {
|
||||
// 播放上一个
|
||||
if (this.chooseFileIndex === 0) {
|
||||
return
|
||||
}
|
||||
this.chooseFile(this.chooseFileIndex - 1)
|
||||
},
|
||||
playNext() {
|
||||
// 播放上一个
|
||||
if (this.chooseFileIndex === this.detailFiles.length - 1) {
|
||||
return
|
||||
}
|
||||
this.chooseFile(this.chooseFileIndex + 1)
|
||||
},
|
||||
changePlaySpeed(speed) {
|
||||
console.log(speed)
|
||||
// 倍速播放
|
||||
this.playSpeed = speed
|
||||
this.$store.dispatch('cloudRecord/speed', {
|
||||
mediaServerId: this.streamInfo.mediaServerId,
|
||||
app: this.streamInfo.app,
|
||||
stream: this.streamInfo.stream,
|
||||
speed: this.playSpeed,
|
||||
schema: 'ts'
|
||||
})
|
||||
this.$refs.recordVideoPlayer.setPlaybackRate(this.playSpeed)
|
||||
},
|
||||
seekBackward() {
|
||||
// 快退五秒
|
||||
this.playSeekValue -= 5 * 1000
|
||||
this.playRecord()
|
||||
},
|
||||
seekForward() {
|
||||
// 快进五秒
|
||||
this.playSeekValue += 5 * 1000
|
||||
this.playRecord()
|
||||
},
|
||||
stopPLay() {
|
||||
// 停止
|
||||
this.$refs.recordVideoPlayer.destroy()
|
||||
},
|
||||
pausePlay() {
|
||||
// 暂停
|
||||
this.$refs.recordVideoPlayer.pause()
|
||||
},
|
||||
play() {
|
||||
if (this.$refs.recordVideoPlayer.loaded) {
|
||||
this.$refs.recordVideoPlayer.unPause()
|
||||
} else {
|
||||
this.playRecord()
|
||||
}
|
||||
},
|
||||
fullScreen() {
|
||||
// 全屏
|
||||
if (this.isFullScreen) {
|
||||
screenfull.exit()
|
||||
this.isFullScreen = false
|
||||
return
|
||||
}
|
||||
const playerWidth = this.$refs.recordVideoPlayer.playerWidth
|
||||
const playerHeight = this.$refs.recordVideoPlayer.playerHeight
|
||||
screenfull.request(document.getElementById('playerBox'))
|
||||
screenfull.on('change', (event) => {
|
||||
this.$refs.recordVideoPlayer.resize(playerWidth, playerHeight)
|
||||
this.isFullScreen = screenfull.isFullscreen
|
||||
})
|
||||
this.isFullScreen = true
|
||||
},
|
||||
dateChange() {
|
||||
this.detailFiles = []
|
||||
this.currentPage = 1
|
||||
const chooseFullDate = new Date(this.chooseDate + ' ' + this.timeFormat)
|
||||
if (chooseFullDate.getFullYear() !== this.queryDate.getFullYear() ||
|
||||
chooseFullDate.getMonth() !== this.queryDate.getMonth()) {
|
||||
this.queryDate = chooseFullDate
|
||||
this.getDateInYear()
|
||||
}
|
||||
this.queryRecordDetails()
|
||||
},
|
||||
infiniteScroll() {
|
||||
if (this.total > this.detailFiles.length) {
|
||||
this.currentPage++
|
||||
this.queryRecordDetails()
|
||||
}
|
||||
},
|
||||
queryRecordDetails: function(callback) {
|
||||
this.timeSegments = []
|
||||
this.$store.dispatch('cloudRecord/queryList', {
|
||||
app: this.app,
|
||||
stream: this.stream,
|
||||
startTime: this.chooseDate + ' 00:00:00',
|
||||
endTime: this.chooseDate + ' 23:59:59',
|
||||
page: this.currentPage,
|
||||
count: this.count,
|
||||
mediaServerId: this.mediaServerId,
|
||||
ascOrder: true
|
||||
})
|
||||
.then(data => {
|
||||
this.total = data.total
|
||||
this.detailFiles = this.detailFiles.concat(data.list)
|
||||
const temp = new Set()
|
||||
this.initTime = Number.parseInt(this.detailFiles[0].startTime)
|
||||
for (let i = 0; i < this.detailFiles.length; i++) {
|
||||
temp.add(this.detailFiles[i].mediaServerId)
|
||||
this.timeSegments.push({
|
||||
beginTime: Number.parseInt(this.detailFiles[i].startTime),
|
||||
endTime: Number.parseInt(this.detailFiles[i].endTime),
|
||||
color: '#01901d',
|
||||
startRatio: 0.7,
|
||||
endRatio: 0.85,
|
||||
index: i
|
||||
})
|
||||
}
|
||||
this.mediaServerList = Array.from(temp)
|
||||
if (this.mediaServerList.length === 1) {
|
||||
this.mediaServerId = this.mediaServerList[0]
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
if (callback) callback()
|
||||
})
|
||||
},
|
||||
chooseFile(index) {
|
||||
this.chooseFileIndex = index
|
||||
let timeLength = 0
|
||||
for (let i = 0; i < this.detailFiles.length; i++) {
|
||||
if (i < index) {
|
||||
timeLength += this.detailFiles[i].timeLen
|
||||
}
|
||||
}
|
||||
this.playSeekValue = timeLength
|
||||
this.playRecord()
|
||||
},
|
||||
playRecord() {
|
||||
if (!this.$refs.recordVideoPlayer.playing) {
|
||||
this.$refs.recordVideoPlayer.destroy()
|
||||
}
|
||||
this.$store.dispatch('cloudRecord/loadRecord', {
|
||||
app: this.app,
|
||||
stream: this.stream,
|
||||
date: this.chooseDate
|
||||
})
|
||||
.then(data => {
|
||||
this.streamInfo = data
|
||||
if (location.protocol === 'https:') {
|
||||
this.videoUrl = data['https_fmp4'] + '&time=' + new Date().getTime()
|
||||
} else {
|
||||
this.videoUrl = data['fmp4'] + '&time=' + new Date().getTime()
|
||||
}
|
||||
this.seekRecord()
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
.finally(() => {
|
||||
this.playLoading = false
|
||||
})
|
||||
},
|
||||
seekRecord() {
|
||||
this.$store.dispatch('cloudRecord/seek', {
|
||||
mediaServerId: this.streamInfo.mediaServerId,
|
||||
app: this.streamInfo.app,
|
||||
stream: this.streamInfo.stream,
|
||||
seek: this.playSeekValue,
|
||||
schema: 'fmp4'
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
downloadFile(file) {
|
||||
this.$store.dispatch('cloudRecord/getPlayPath', file.id)
|
||||
.then(data => {
|
||||
const link = document.createElement('a')
|
||||
link.target = '_blank'
|
||||
if (location.protocol === 'https:') {
|
||||
link.href = data.httpsPath + '&save_name=' + file.fileName
|
||||
} else {
|
||||
link.href = data.httpPath + '&save_name=' + file.fileName
|
||||
}
|
||||
link.click()
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
backToList() {
|
||||
this.$router.back()
|
||||
},
|
||||
getFileShowName(item) {
|
||||
return moment(item.startTime).format('HH:mm:ss') + '-' + moment(item.endTime).format('HH:mm:ss')
|
||||
},
|
||||
|
||||
showPlayTimeChange(val) {
|
||||
this.playTime += (val * 1000 - this.playerTime)
|
||||
this.playerTime = val * 1000
|
||||
},
|
||||
playingChange(val) {
|
||||
this.playing = val
|
||||
},
|
||||
playTimeChange(val) {
|
||||
if (val === this.playTime) {
|
||||
return
|
||||
}
|
||||
this.playTime = val
|
||||
},
|
||||
timelineMouseDown() {
|
||||
this.timelineControl = true
|
||||
},
|
||||
mouseupTimeline(event) {
|
||||
if (!this.timelineControl) {
|
||||
this.timelineControl = false
|
||||
return
|
||||
}
|
||||
this.timelineControl = false
|
||||
let timeLength = 0
|
||||
for (let i = 0; i < this.detailFiles.length; i++) {
|
||||
const item = this.detailFiles[i]
|
||||
if (this.playTime > item.endTime) {
|
||||
timeLength += item.timeLen
|
||||
} else if (this.playTime === item.endTime) {
|
||||
timeLength += item.timeLen
|
||||
this.chooseFileIndex = i
|
||||
break
|
||||
} else if (this.playTime > item.startTime && this.playTime < item.endTime) {
|
||||
timeLength += (this.playTime - item.startTime)
|
||||
this.chooseFileIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
this.playSeekValue = timeLength
|
||||
this.playRecord()
|
||||
},
|
||||
getTimeForFile(file) {
|
||||
const starTime = new Date(file.startTime * 1000)
|
||||
let endTime = new Date(file.endTime * 1000)
|
||||
if (this.checkIsOver24h(starTime, endTime)) {
|
||||
endTime = new Date(this.chooseDate + ' ' + '23:59:59')
|
||||
}
|
||||
return [starTime, endTime, endTime.getTime() - starTime.getTime()]
|
||||
},
|
||||
checkIsOver24h(starTime, endTime) {
|
||||
return starTime > endTime
|
||||
},
|
||||
playTimeFormat(val) {
|
||||
const h = parseInt(val / 3600)
|
||||
const m = parseInt((val - h * 3600) / 60)
|
||||
const s = parseInt(val - h * 3600 - m * 60)
|
||||
|
||||
let hStr = h
|
||||
let mStr = m
|
||||
let sStr = s
|
||||
if (h < 10) {
|
||||
hStr = '0' + hStr
|
||||
}
|
||||
if (m < 10) {
|
||||
mStr = '0' + mStr
|
||||
s
|
||||
}
|
||||
if (s < 10) {
|
||||
sStr = '0' + sStr
|
||||
}
|
||||
return hStr + ':' + mStr + ':' + sStr
|
||||
},
|
||||
getDateInYear(callback) {
|
||||
this.dateFilesObj = {}
|
||||
this.$store.dispatch('cloudRecord/queryListByData', {
|
||||
app: this.app,
|
||||
stream: this.stream,
|
||||
year: this.queryDate.getFullYear(),
|
||||
month: this.queryDate.getMonth() + 1,
|
||||
mediaServerId: this.mediaServerId
|
||||
})
|
||||
.then((data) => {
|
||||
if (data.length > 0) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
this.dateFilesObj[data[i]] = data[i]
|
||||
}
|
||||
console.log(this.dateFilesObj)
|
||||
}
|
||||
if (callback) callback()
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
this.$router.push('/cloudRecord')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.record-list-box-box {
|
||||
width: fit-content;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.record-list-box {
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: #FFF;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.record-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: #FFF;
|
||||
|
||||
}
|
||||
|
||||
.record-list-no-val {
|
||||
width: fit-content;
|
||||
position: relative;
|
||||
color: #9f9f9f;
|
||||
top: 50%;
|
||||
left: calc(50% - 2rem);
|
||||
}
|
||||
|
||||
.record-list-item {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin: 0.5rem 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.record-play-control {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
display: inline-block;
|
||||
width: fit-content;
|
||||
padding: 0 10px;
|
||||
-webkit-box-shadow: 0 0 10px #262626;
|
||||
box-shadow: 0 0 10px #262626;
|
||||
background-color: #262626;
|
||||
margin: 4px 0;
|
||||
}
|
||||
.record-play-control-item {
|
||||
display: inline-block;
|
||||
padding: 0 10px;
|
||||
color: #fff;
|
||||
margin-right: 2px;
|
||||
}
|
||||
.record-play-control-item:hover {
|
||||
color: #1f83e6;
|
||||
}
|
||||
.record-play-control-speed {
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
user-select: none;
|
||||
}
|
||||
.player-option-box {
|
||||
height: 50px
|
||||
}
|
||||
.time-line-show {
|
||||
position: relative;
|
||||
color: rgba(250, 249, 249, 0.89);
|
||||
left: calc(50% - 85px);
|
||||
top: -72px;
|
||||
text-shadow: 1px 0 #5f6b7c, -1px 0 #5f6b7c, 0 1px #5f6b7c, 0 -1px #5f6b7c, 1.1px 1.1px #5f6b7c, 1.1px -1.1px #5f6b7c, -1.1px 1.1px #5f6b7c, -1.1px -1.1px #5f6b7c;
|
||||
}
|
||||
</style>
|
||||
315
web/src/views/cloudRecord/index.vue
Executable file
315
web/src/views/cloudRecord/index.vue
Executable file
@@ -0,0 +1,315 @@
|
||||
<template>
|
||||
<div id="app" class="app-container">
|
||||
<div style="height: calc(100vh - 124px);">
|
||||
<el-form :inline="true" size="mini">
|
||||
<el-form-item label="搜索">
|
||||
<el-input
|
||||
v-model="search"
|
||||
style="margin-right: 1rem; width: auto;"
|
||||
placeholder="关键字"
|
||||
prefix-icon="el-icon-search"
|
||||
clearable
|
||||
@input="initData"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间">
|
||||
<el-date-picker
|
||||
v-model="startTime"
|
||||
type="datetime"
|
||||
size="mini"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择日期时间"
|
||||
@change="initData"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间">
|
||||
<el-date-picker
|
||||
v-model="endTime"
|
||||
type="datetime"
|
||||
size="mini"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择日期时间"
|
||||
@change="initData"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="节点选择">
|
||||
<el-select
|
||||
v-model="mediaServerId"
|
||||
size="mini"
|
||||
style="width: 16rem; margin-right: 1rem;"
|
||||
placeholder="请选择"
|
||||
@change="initData"
|
||||
>
|
||||
<el-option label="全部" value="" />
|
||||
<el-option
|
||||
v-for="item in mediaServerList"
|
||||
:key="item.id"
|
||||
:label="item.id"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
icon="el-icon-delete"
|
||||
style="margin-right: 1rem;"
|
||||
:disabled="multipleSelection.length === 0"
|
||||
type="danger"
|
||||
@click="deleteRecord"
|
||||
>移除
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item style="float: right;">
|
||||
<el-button icon="el-icon-refresh-right" circle :loading="loading" @click="initData()" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--设备列表-->
|
||||
<el-table :data="recordList" style="width: 100%" size="small" :loading="loading" height="calc(100% - 64px)" @selection-change="handleSelectionChange">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
/>
|
||||
<el-table-column prop="app" label="应用名" />
|
||||
<el-table-column prop="stream" label="流ID" width="380" />
|
||||
<el-table-column label="开始时间">
|
||||
<template v-slot:default="scope">
|
||||
{{ formatTimeStamp(scope.row.startTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间">
|
||||
<template v-slot:default="scope">
|
||||
{{ formatTimeStamp(scope.row.endTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="时长">
|
||||
<template v-slot:default="scope">
|
||||
<el-tag v-if="myServerId !== scope.row.serverId" style="border-color: #ecf1af">{{ formatTime(scope.row.timeLen) }}</el-tag>
|
||||
<el-tag v-if="myServerId === scope.row.serverId">{{ formatTime(scope.row.timeLen) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="fileName" label="文件名称" width="200" />
|
||||
<el-table-column prop="mediaServerId" label="流媒体" />
|
||||
<el-table-column label="操作" fixed="right" width="260">
|
||||
<template v-slot:default="scope">
|
||||
<el-button size="medium" icon="el-icon-video-play" type="text" @click="play(scope.row)">播放
|
||||
</el-button>
|
||||
<el-button size="medium" icon="el-icon-download" type="text" @click="downloadFile(scope.row)">下载
|
||||
</el-button>
|
||||
<el-button size="medium" icon="el-icon-info" type="text" @click="showDetail(scope.row)">详情
|
||||
</el-button>
|
||||
<el-button
|
||||
size="medium"
|
||||
icon="el-icon-delete"
|
||||
type="text"
|
||||
style="color: #f56c6c"
|
||||
@click="deleteOneRecord(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
style="text-align: right"
|
||||
:current-page="currentPage"
|
||||
:page-size="count"
|
||||
:page-sizes="[15, 25, 35, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
:total="total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="currentChange"
|
||||
/>
|
||||
</div>
|
||||
<el-dialog
|
||||
:title="playerTitle"
|
||||
:visible.sync="showPlayer"
|
||||
top="2rem"
|
||||
width="1200px"
|
||||
height="560px"
|
||||
>
|
||||
<h265web ref="recordVideoPlayer" :video-url="videoUrl" :height="false" :show-button="true" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import h265web from '../common/h265web.vue'
|
||||
import moment from 'moment'
|
||||
import Vue from 'vue'
|
||||
|
||||
export default {
|
||||
name: 'CloudRecord',
|
||||
components: { h265web },
|
||||
data() {
|
||||
return {
|
||||
search: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
showPlayer: false,
|
||||
playerTitle: '',
|
||||
videoUrl: '',
|
||||
mediaServerList: [], // 滅体节点列表
|
||||
multipleSelection: [],
|
||||
mediaServerId: '', // 媒体服务
|
||||
mediaServerPath: null, // 媒体服务地址
|
||||
recordList: [], // 设备列表
|
||||
chooseRecord: null, // 媒体服务
|
||||
updateLooper: 0, // 数据刷新轮训标志
|
||||
currentPage: 1,
|
||||
count: 15,
|
||||
total: 0,
|
||||
loading: false
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
Vue() {
|
||||
return Vue
|
||||
},
|
||||
myServerId() {
|
||||
return this.$store.getters.serverId
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initData()
|
||||
this.getMediaServerList()
|
||||
},
|
||||
destroyed() {
|
||||
// this.$destroy('recordVideoPlayer')
|
||||
},
|
||||
methods: {
|
||||
initData: function() {
|
||||
this.getRecordList()
|
||||
},
|
||||
currentChange: function(val) {
|
||||
this.currentPage = val
|
||||
this.getRecordList()
|
||||
},
|
||||
handleSizeChange: function(val) {
|
||||
this.count = val
|
||||
this.getRecordList()
|
||||
},
|
||||
handleSelectionChange: function(val) {
|
||||
this.multipleSelection = val
|
||||
},
|
||||
getMediaServerList: function() {
|
||||
this.$store.dispatch('server/getOnlineMediaServerList')
|
||||
.then((data) => {
|
||||
this.mediaServerList = data
|
||||
})
|
||||
},
|
||||
getRecordList: function() {
|
||||
this.$store.dispatch('cloudRecord/queryList', {
|
||||
query: this.search,
|
||||
startTime: this.startTime,
|
||||
endTime: this.endTime,
|
||||
mediaServerId: this.mediaServerId,
|
||||
page: this.currentPage,
|
||||
count: this.count
|
||||
})
|
||||
.then((data) => {
|
||||
this.total = data.total
|
||||
this.recordList = data.list
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
play(row) {
|
||||
console.log(row)
|
||||
this.chooseRecord = row
|
||||
this.$store.dispatch('cloudRecord/getPlayPath', row.id)
|
||||
.then((data) => {
|
||||
if (location.protocol === 'https:') {
|
||||
this.videoUrl = data.httpsPath
|
||||
} else {
|
||||
this.videoUrl = data.httpPath
|
||||
}
|
||||
this.showPlayer = true
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
downloadFile(row) {
|
||||
this.$store.dispatch('cloudRecord/getPlayPath', row.id)
|
||||
.then((data) => {
|
||||
const link = document.createElement('a')
|
||||
link.target = '_blank'
|
||||
if (location.protocol === 'https:') {
|
||||
link.href = data.httpsPath + '&save_name=' + row.fileName
|
||||
} else {
|
||||
link.href = data.httpPath + '&save_name=' + row.fileName
|
||||
}
|
||||
link.click()
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
showDetail(row) {
|
||||
this.$router.push(`/cloudRecord/detail/${row.app}/${row.stream}`)
|
||||
},
|
||||
deleteRecord() {
|
||||
this.$confirm(`确定删除选中的${this.multipleSelection.length}个文件?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const ids = []
|
||||
for (let i = 0; i < this.multipleSelection.length; i++) {
|
||||
ids.push(this.multipleSelection[i].id)
|
||||
}
|
||||
this.$store.dispatch('cloudRecord/deleteRecord', ids)
|
||||
.then((data) => {
|
||||
this.$message.success({
|
||||
showClose: true,
|
||||
message: '删除成功'
|
||||
})
|
||||
this.getRecordList()
|
||||
})
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
},
|
||||
deleteOneRecord(row) {
|
||||
this.$confirm(`确定删除?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const ids = []
|
||||
ids.push(row.id)
|
||||
this.$store.dispatch('cloudRecord/deleteRecord', ids)
|
||||
.then((data) => {
|
||||
this.$message.success({
|
||||
showClose: true,
|
||||
message: '删除成功'
|
||||
})
|
||||
this.getRecordList()
|
||||
})
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
},
|
||||
formatTime(time) {
|
||||
const h = parseInt(time / 3600 / 1000)
|
||||
const minute = parseInt((time - h * 3600 * 1000) / 60 / 1000)
|
||||
let second = Math.ceil((time - h * 3600 * 1000 - minute * 60 * 1000) / 1000)
|
||||
if (second < 0) {
|
||||
second = 0
|
||||
}
|
||||
return (h > 0 ? h + `小时` : '') + (minute > 0 ? minute + '分' : '') + (second > 0 ? second + '秒' : '')
|
||||
},
|
||||
formatTimeStamp(time) {
|
||||
return moment.unix(time / 1000).format('yyyy-MM-DD HH:mm:ss')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-dialog__body {
|
||||
padding: 30px 0 !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user