2025-05-11 08:01:45 +08:00
|
|
|
|
<template>
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<div id="channelList" style="height: calc(100vh - 124px);">
|
2025-05-11 08:01:45 +08:00
|
|
|
|
<div v-if="!jtChannel">
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<div class="page-header">
|
2025-05-11 08:01:45 +08:00
|
|
|
|
<div class="page-title">
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="showDevice" />
|
|
|
|
|
|
<el-divider direction="vertical" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
通道列表
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="page-header-btn">
|
|
|
|
|
|
<div style="display: inline;">
|
|
|
|
|
|
搜索:
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
v-model="searchSrt"
|
|
|
|
|
|
style="margin-right: 1rem; width: auto;"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
placeholder="关键字"
|
|
|
|
|
|
prefix-icon="el-icon-search"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
@input="search"
|
|
|
|
|
|
/>
|
2025-05-11 08:01:45 +08:00
|
|
|
|
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="add">添加通道</el-button>
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-container v-loading="isLoging" style="height: 82vh;">
|
|
|
|
|
|
<el-main style="padding: 5px;">
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-table
|
|
|
|
|
|
ref="channelListTable"
|
|
|
|
|
|
:data="deviceChannelList"
|
|
|
|
|
|
:height="winHeight"
|
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
|
header-row-class-name="table-header"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-table-column prop="channelId" label="通道编号" min-width="180" />
|
|
|
|
|
|
<el-table-column prop="name" label="名称" min-width="180" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
<el-table-column label="快照" min-width="100">
|
|
|
|
|
|
<template v-slot:default="scope">
|
|
|
|
|
|
<el-image
|
|
|
|
|
|
:src="getSnap(scope.row)"
|
|
|
|
|
|
:preview-src-list="getBigSnap(scope.row)"
|
|
|
|
|
|
:fit="'contain'"
|
2025-05-12 18:01:10 +08:00
|
|
|
|
style="width: 60px"
|
|
|
|
|
|
@error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)"
|
|
|
|
|
|
>
|
2025-05-11 08:01:45 +08:00
|
|
|
|
<div slot="error" class="image-slot">
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<i class="el-icon-picture-outline" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</el-image>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="开启音频" min-width="100">
|
|
|
|
|
|
<template slot-scope="scope">
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-switch v-model="scope.row.hasAudio" active-color="#409EFF" @change="updateChannel(scope.row)" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="操作" min-width="340" fixed="right">
|
|
|
|
|
|
<template slot-scope="scope">
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
size="medium"
|
|
|
|
|
|
:disabled="device == null || device.online === 0"
|
|
|
|
|
|
icon="el-icon-video-play"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click="sendDevicePush(scope.row)"
|
|
|
|
|
|
>播放
|
2025-05-11 08:01:45 +08:00
|
|
|
|
</el-button>
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
v-if="!!scope.row.stream"
|
|
|
|
|
|
size="medium"
|
|
|
|
|
|
:disabled="device == null || device.online === 0"
|
|
|
|
|
|
icon="el-icon-switch-button"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
style="color: #f56c6c"
|
|
|
|
|
|
@click="stopDevicePush(scope.row)"
|
|
|
|
|
|
>停止
|
2025-05-11 08:01:45 +08:00
|
|
|
|
</el-button>
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-divider direction="vertical" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
size="medium"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
|
@click="handleEdit(scope.row)"
|
|
|
|
|
|
>
|
|
|
|
|
|
编辑
|
|
|
|
|
|
</el-button>
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-divider direction="vertical" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
<el-dropdown @command="(command)=>{moreClick(command, scope.row)}">
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-button size="medium" type="text">
|
|
|
|
|
|
更多功能<i class="el-icon-arrow-down el-icon--right" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-dropdown-item command="records" :disabled="device == null || device.online === 0">
|
2025-05-11 08:01:45 +08:00
|
|
|
|
设备录像</el-dropdown-item>
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<el-dropdown-item command="cloudRecords" :disabled="device == null || device.online === 0">
|
2025-05-11 08:01:45 +08:00
|
|
|
|
云端录像</el-dropdown-item>
|
|
|
|
|
|
<!-- <el-dropdown-item command="shooting" v-bind:disabled="device == null || device.online === 0" >-->
|
|
|
|
|
|
<!-- 立即拍摄</el-dropdown-item>-->
|
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<el-pagination
|
|
|
|
|
|
style="float: right"
|
|
|
|
|
|
:current-page="currentPage"
|
|
|
|
|
|
:page-size="count"
|
|
|
|
|
|
:page-sizes="[15, 25, 35, 50]"
|
|
|
|
|
|
layout="total, sizes, prev, pager, next"
|
2025-05-12 18:01:10 +08:00
|
|
|
|
:total="total"
|
|
|
|
|
|
@size-change="handleSizeChange"
|
|
|
|
|
|
@current-change="currentChange"
|
|
|
|
|
|
/>
|
2025-05-11 08:01:45 +08:00
|
|
|
|
</el-main>
|
|
|
|
|
|
</el-container>
|
|
|
|
|
|
</div>
|
2025-05-12 18:01:10 +08:00
|
|
|
|
<devicePlayer ref="devicePlayer" />
|
|
|
|
|
|
<channelEdit v-if="jtChannel" ref="channelEdit" :jt-channel="jtChannel" :close-edit="closeEdit" />
|
2025-05-11 08:01:45 +08:00
|
|
|
|
<!--设备列表-->
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-05-12 18:01:10 +08:00
|
|
|
|
import devicePlayer from '../jtDevicePlayer.vue'
|
|
|
|
|
|
import channelEdit from './edit.vue'
|
2025-05-14 15:48:35 +08:00
|
|
|
|
import { play } from '@/api/jtDevice'
|
2025-05-11 08:01:45 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
name: 'ChannelList',
|
2025-05-11 08:01:45 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
channelEdit,
|
2025-05-12 18:01:10 +08:00
|
|
|
|
devicePlayer
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-14 15:48:35 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
deviceId: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: null
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-05-11 08:01:45 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
device: null,
|
|
|
|
|
|
deviceChannelList: [],
|
2025-05-12 18:01:10 +08:00
|
|
|
|
updateLooper: 0, // 数据刷新轮训标志
|
|
|
|
|
|
searchSrt: '',
|
|
|
|
|
|
channelType: '',
|
|
|
|
|
|
online: '',
|
2025-05-11 08:01:45 +08:00
|
|
|
|
winHeight: window.innerHeight - 200,
|
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
|
count: 15,
|
|
|
|
|
|
total: 0,
|
2025-05-12 18:01:10 +08:00
|
|
|
|
beforeUrl: '/jtDeviceList',
|
2025-05-11 08:01:45 +08:00
|
|
|
|
isLoging: false,
|
|
|
|
|
|
loadSnap: {},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
jtChannel: null
|
|
|
|
|
|
}
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
mounted() {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
this.initParam()
|
|
|
|
|
|
this.initData()
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
destroyed() {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
this.$destroy('videojs')
|
|
|
|
|
|
clearTimeout(this.updateLooper)
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
initData: function() {
|
|
|
|
|
|
this.getDeviceChannelList()
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
initParam: function() {
|
|
|
|
|
|
this.deviceId = this.$route.params.deviceId
|
|
|
|
|
|
this.currentPage = 1
|
|
|
|
|
|
this.count = 15
|
2025-05-14 15:48:35 +08:00
|
|
|
|
this.$store.dispatch('jtDevice/queryDeviceById', this.deviceId)
|
|
|
|
|
|
.then(data => {
|
|
|
|
|
|
this.device = data
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(err => {
|
|
|
|
|
|
console.error(err)
|
|
|
|
|
|
})
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
currentChange: function(val) {
|
|
|
|
|
|
this.currentPage = val
|
|
|
|
|
|
this.initData()
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
handleSizeChange: function(val) {
|
|
|
|
|
|
this.count = val
|
|
|
|
|
|
this.getDeviceChannelList()
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
getDeviceChannelList: function() {
|
|
|
|
|
|
if (typeof (this.deviceId) === 'undefined') return
|
2025-05-14 15:48:35 +08:00
|
|
|
|
this.$store.dispatch('jtDevice/queryChannels', {
|
|
|
|
|
|
page: this.currentPage,
|
|
|
|
|
|
count: this.count,
|
|
|
|
|
|
query: this.searchSrt,
|
|
|
|
|
|
deviceId: this.deviceId
|
|
|
|
|
|
})
|
|
|
|
|
|
.then(data => {
|
|
|
|
|
|
this.total = data.total
|
|
|
|
|
|
this.deviceChannelList = data.list
|
2025-05-11 08:01:45 +08:00
|
|
|
|
// 防止出现表格错位
|
|
|
|
|
|
this.$nextTick(() => {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
this.$refs.channelListTable.doLayout()
|
2025-05-11 08:01:45 +08:00
|
|
|
|
})
|
2025-05-14 15:48:35 +08:00
|
|
|
|
})
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2025-05-12 18:01:10 +08:00
|
|
|
|
// 通知设备上传媒体流
|
|
|
|
|
|
sendDevicePush: function(itemData) {
|
|
|
|
|
|
this.isLoging = true
|
|
|
|
|
|
const channelId = itemData.channelId
|
|
|
|
|
|
console.log('通知设备推流1:' + this.device.phoneNumber + ' : ' + channelId)
|
2025-05-14 15:48:35 +08:00
|
|
|
|
|
|
|
|
|
|
this.$store.dispatch('jtDevice/play', {
|
|
|
|
|
|
phoneNumber: this.device.phoneNumber,
|
|
|
|
|
|
channelId: channelId,
|
|
|
|
|
|
type: 0
|
|
|
|
|
|
})
|
|
|
|
|
|
.then(data => {
|
2025-05-11 08:01:45 +08:00
|
|
|
|
setTimeout(() => {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
const snapId = this.device.phoneNumber + '_' + channelId
|
|
|
|
|
|
this.loadSnap[this.device.phoneNumber + channelId] = 0
|
2025-05-11 08:01:45 +08:00
|
|
|
|
this.getSnapErrorEvent(snapId)
|
|
|
|
|
|
}, 5000)
|
2025-05-14 15:48:35 +08:00
|
|
|
|
itemData.streamId = data.stream
|
2025-05-12 18:01:10 +08:00
|
|
|
|
this.$refs.devicePlayer.openDialog('media', this.device.phoneNumber, channelId, {
|
2025-05-14 15:48:35 +08:00
|
|
|
|
streamInfo: data,
|
2025-05-11 08:01:45 +08:00
|
|
|
|
hasAudio: itemData.hasAudio
|
2025-05-12 18:01:10 +08:00
|
|
|
|
})
|
2025-05-11 08:01:45 +08:00
|
|
|
|
setTimeout(() => {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
this.initData()
|
2025-05-11 08:01:45 +08:00
|
|
|
|
}, 1000)
|
2025-05-14 15:48:35 +08:00
|
|
|
|
})
|
|
|
|
|
|
.catch(err => {
|
|
|
|
|
|
console.error(err)
|
|
|
|
|
|
})
|
|
|
|
|
|
.finally(() => {
|
|
|
|
|
|
this.isLoging = false
|
|
|
|
|
|
})
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
moreClick: function(command, itemData) {
|
|
|
|
|
|
if (command === 'records') {
|
2025-05-11 08:01:45 +08:00
|
|
|
|
this.queryRecords(itemData)
|
2025-05-12 18:01:10 +08:00
|
|
|
|
} else if (command === 'cloudRecords') {
|
2025-05-11 08:01:45 +08:00
|
|
|
|
this.queryCloudRecords(itemData)
|
2025-05-12 18:01:10 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.info('尚不支持')
|
2025-05-11 08:01:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
queryRecords: function(itemData) {
|
2025-05-14 15:48:35 +08:00
|
|
|
|
this.$router.push(`/jtDevice/record/${this.device.phoneNumber}/${itemData.channelId}`)
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
queryCloudRecords: function(itemData) {
|
2025-05-14 15:48:35 +08:00
|
|
|
|
const deviceId = this.device.phoneNumber
|
2025-05-12 18:01:10 +08:00
|
|
|
|
const channelId = itemData.channelId
|
2025-05-14 15:48:35 +08:00
|
|
|
|
this.$router.push(`/cloudRecord/detail/rtp/${deviceId}_${channelId}`)
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
stopDevicePush: function(itemData) {
|
2025-05-14 15:48:35 +08:00
|
|
|
|
this.$store.dispatch('jtDevice/stopPlay', {
|
|
|
|
|
|
phoneNumber: this.device.phoneNumber,
|
|
|
|
|
|
channelId: itemData.channelId
|
2025-05-12 18:01:10 +08:00
|
|
|
|
})
|
2025-05-14 15:48:35 +08:00
|
|
|
|
.then((data) => {
|
|
|
|
|
|
this.initData()
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function(error) {
|
|
|
|
|
|
console.error(error)
|
|
|
|
|
|
})
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
getSnap: function(row) {
|
|
|
|
|
|
const baseUrl = window.baseUrl ? window.baseUrl : ''
|
2025-05-14 15:48:35 +08:00
|
|
|
|
return ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + '/api/device/query/snap/' + this.device.phoneNumber + '/' + row.channelId
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
getBigSnap: function(row) {
|
2025-05-11 08:01:45 +08:00
|
|
|
|
return [this.getSnap(row)]
|
|
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
getSnapErrorEvent: function(deviceId, channelId) {
|
|
|
|
|
|
if (typeof (this.loadSnap[deviceId + channelId]) !== 'undefined') {
|
|
|
|
|
|
console.log('下载截图' + this.loadSnap[deviceId + channelId])
|
2025-05-11 08:01:45 +08:00
|
|
|
|
if (this.loadSnap[deviceId + channelId] > 5) {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
delete this.loadSnap[deviceId + channelId]
|
|
|
|
|
|
return
|
2025-05-11 08:01:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
setTimeout(() => {
|
2025-05-14 15:48:35 +08:00
|
|
|
|
const baseUrl = window.baseUrl ? window.baseUrl : ''
|
|
|
|
|
|
const url = (process.env.NODE_ENV === 'development' ? process.env.VUE_APP_BASE_API : baseUrl) + '/api/device/query/snap/' + deviceId + '/' + channelId
|
2025-05-11 08:01:45 +08:00
|
|
|
|
this.loadSnap[deviceId + channelId]++
|
2025-05-12 18:01:10 +08:00
|
|
|
|
document.getElementById(deviceId + channelId).setAttribute('src', url + '?' + new Date().getTime())
|
2025-05-11 08:01:45 +08:00
|
|
|
|
}, 1000)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
showDevice: function() {
|
2025-05-14 15:48:35 +08:00
|
|
|
|
this.$emit('show-device')
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
search: function() {
|
|
|
|
|
|
this.currentPage = 1
|
|
|
|
|
|
this.total = 0
|
|
|
|
|
|
this.initData()
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
updateChannel: function(row) {
|
2025-05-14 15:48:35 +08:00
|
|
|
|
this.$store.dispatch('jtDevice/updateChannel', row)
|
|
|
|
|
|
.then(data => {
|
|
|
|
|
|
|
|
|
|
|
|
})
|
2025-05-11 08:01:45 +08:00
|
|
|
|
this.$axios({
|
|
|
|
|
|
method: 'post',
|
|
|
|
|
|
url: `/api/jt1078/terminal/channel/update`,
|
|
|
|
|
|
params: row
|
2025-05-12 18:01:10 +08:00
|
|
|
|
}).then(function(res) {
|
|
|
|
|
|
console.log(JSON.stringify(res))
|
|
|
|
|
|
})
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
refresh: function() {
|
|
|
|
|
|
this.initData()
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
2025-05-12 18:01:10 +08:00
|
|
|
|
add: function() {
|
2025-05-11 08:01:45 +08:00
|
|
|
|
this.jtChannel = {
|
|
|
|
|
|
terminalDbId: this.deviceId
|
2025-05-12 18:01:10 +08:00
|
|
|
|
}
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 编辑
|
|
|
|
|
|
handleEdit(row) {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
this.jtChannel = row
|
2025-05-11 08:01:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 编辑
|
|
|
|
|
|
closeEdit(row) {
|
2025-05-12 18:01:10 +08:00
|
|
|
|
this.jtChannel = null
|
2025-05-11 08:01:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-05-12 18:01:10 +08:00
|
|
|
|
}
|
2025-05-11 08:01:45 +08:00
|
|
|
|
</script>
|