<template> <div class="video"> <div ref="tree"> <el-col :span="6"> <video-tree @click="handleCameraClicked"/> </el-col> </div> <el-col :span="18"> <div style="z-index: 9999;margin-left: 10px;margin-top: 25px"> <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="搜索起始时间" end-placeholder="搜索截止时间" arrow-control="true" :clearable="false" @focus="dateClick" @blur="dateSelected" @change="dateSelected"/> </div> <div id="tabDiv"> <iframe name="playHK" class="iframe-body" src="/static/webCtrl/hk/demo_embedded_for_iframe.html?wmode=opaque"/> </div> </el-col> </div> </template> <script> import VideoTree from './videoTree' import { formatToString, getDate, oneDayTime } from '@/utils/calendarUtil' export default { name: 'VideoHistory', components: { VideoTree }, data() { const validTime = (rule, value, callback) => { if (value !== '' && value.length > 0) { if (this.timeRange[1] === '') { callback(new Error('请选择搜索起止时间')) } else { callback() } } else { callback(new Error('请选择搜索起止时间')) } } return { timeRange: [], listQuery: { indexCode: '', startTime: '', endTime: '' }, rules: { startTime: [{ required: true, validator: validTime, trigger: ['blur'] }] } } }, watch: { timeRange(val) { if (val && val.length > 0) { this.listQuery.startTime = val[0] this.listQuery.endTime = val[1] } else { this.listQuery.startTime = '' this.listQuery.endTime = '' } } }, mounted() { this.listQuery.startTime = getDate(0, 'DATE') + ' 00:00:00' this.listQuery.endTime = getDate(0, 'SECOND') this.timeRange = [this.listQuery.startTime, this.listQuery.endTime] console.log(this.timeRange) setTimeout(() => { window.frames['playHK'].initPlugin('back',document.getElementById('tabDiv').getBoundingClientRect().left + 20) }, 100) }, beforeDestroy() { window.frames['playHK'].destoryPlugin() }, methods: { search() { window.frames['playHK'].show() if (this.listQuery.indexCode === '') { this.$message.warning('请先选中一个监控点') return } if (this.timeRange !== []) { window.frames['playHK'].search(this.listQuery.indexCode, this.listQuery.startTime, this.listQuery.endTime) } }, handleCameraClicked(camera) { if (typeof camera.indexCode === 'undefined' || camera.indexCode === '') { return false } else { this.listQuery.indexCode = camera.indexCode window.frames['playHK'].search(this.listQuery.indexCode, this.listQuery.startTime, this.listQuery.endTime) } }, dateClick() { this.videoShow = false window.frames['playHK'].hide() }, dateSelected() { window.frames['playHK'].show() this.search() } } } </script> <style scoped> .iframe-body{ height: calc(100vh - 200px); width: 100%; frameBorder: 0; scrolling: no; border: 0; vspale: 0; z-index: -1; padding:0 !important; margin-top: -10px; } .playWnd { margin: 10px 0 0 20px; width: 1px; height: 1px; border: 1px solid white; z-index: -1; } .video{ background: white; width: 100%; height: calc(100vh - 80px); } </style>