|
@@ -4,10 +4,10 @@
|
|
|
<div class="videoTopLeft">
|
|
|
选择站点:
|
|
|
<el-select
|
|
|
- filterable
|
|
|
+ filterable
|
|
|
v-model="store.state.siteId"
|
|
|
placeholder="请选择"
|
|
|
- style="width: 150px; margin-right: 20px"
|
|
|
+ style="width: 250px; margin-right: 20px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="site in store.state.siteList"
|
|
@@ -57,6 +57,11 @@
|
|
|
stripe
|
|
|
:header-cell-style="headClass"
|
|
|
:height="Height"
|
|
|
+
|
|
|
+ v-loading="loadingStatus"
|
|
|
+ element-loading-text="摄像头打开中...."
|
|
|
+ element-loading-background="rgba(255, 255, 255, 0.6)"
|
|
|
+
|
|
|
>
|
|
|
<el-table-column
|
|
|
prop="stationStatus"
|
|
@@ -68,9 +73,9 @@
|
|
|
<el-avatar
|
|
|
class="status"
|
|
|
:style="
|
|
|
- scope.row.stationStatus == 0
|
|
|
- ? 'background-color:red'
|
|
|
- : 'background-color:#04F21C'
|
|
|
+ scope.row.ALIVEVALUE == 3
|
|
|
+ ? 'background-color:#04F21C'
|
|
|
+ : 'background-color:red'
|
|
|
"
|
|
|
></el-avatar>
|
|
|
</template>
|
|
@@ -121,18 +126,14 @@
|
|
|
label="sim卡号"
|
|
|
align="center"
|
|
|
></el-table-column>
|
|
|
- <!-- <el-table-column label="视频画面" align="center" width="150">
|
|
|
+ <el-table-column label="视频画面" align="center" width="150">
|
|
|
<template #default="scope" style="text-align: center">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- style="color: #409eff"
|
|
|
- @click.prevent="LookUp(scope.$index, scope.row)"
|
|
|
- >
|
|
|
- 查看
|
|
|
- </el-button>
|
|
|
+ <a v-if="scope.row.ALIVEVALUE == 3" @click="open_video(scope.row)">
|
|
|
+ 查看
|
|
|
+ </a>
|
|
|
+ <span v-else style="color: #aaa">--</span>
|
|
|
</template>
|
|
|
- </el-table-column> -->
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<div class="listPagination">
|
|
|
<el-pagination
|
|
@@ -161,18 +162,20 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { useStore } from 'vuex'
|
|
|
-import { defineComponent, ref, onMounted } from 'vue'
|
|
|
+import { defineComponent, ref, onMounted,watch } from 'vue'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
import * as api from '@/api/deviceManage/videoEquip.js'
|
|
|
import checkVideo from './checkVideo'
|
|
|
+import axios from 'axios'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'powerEquip',
|
|
|
components: { checkVideo },
|
|
|
props: {
|
|
|
Height: String,
|
|
|
+ activeName: String,
|
|
|
},
|
|
|
- setup() {
|
|
|
+ setup(props) {
|
|
|
const store = useStore()
|
|
|
|
|
|
const dialogTitle = ref('')
|
|
@@ -182,9 +185,17 @@ export default defineComponent({
|
|
|
const pageSize = ref(15)
|
|
|
const currentPage = ref(1)
|
|
|
const filterText = ref('')
|
|
|
- const activeName = 'powerEquip'
|
|
|
+ // const activeName = 'powerEquip'
|
|
|
const tableData = ref([])
|
|
|
|
|
|
+ const onLineVideoList = ref([])
|
|
|
+ const openId = ref('')
|
|
|
+ const reCount = ref(0)
|
|
|
+ const count = ref(0)
|
|
|
+ const loadingStatus = ref(false)
|
|
|
+ const timer = ref('')
|
|
|
+ const deviceCode = ref('')
|
|
|
+
|
|
|
//查看视频画面
|
|
|
const LookUp = (ind, row) => {
|
|
|
// alert(2)
|
|
@@ -230,9 +241,149 @@ export default defineComponent({
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- onMounted(() => {
|
|
|
- videoMonitoringDeviceList()
|
|
|
- })
|
|
|
+ //请求视频cgi数据
|
|
|
+ const chk_video = () => {
|
|
|
+ axios
|
|
|
+ .post(
|
|
|
+ 'https://fire.usky.cn:8443/YtIoT/cgi-bin/demo2.cgi',
|
|
|
+ 'queryJson:' +
|
|
|
+ JSON.stringify({
|
|
|
+ CMD: 1,
|
|
|
+ }),
|
|
|
+ {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
|
|
+ },
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then((response) => {
|
|
|
+ console.log('response cgi')
|
|
|
+ console.log(response.data.RESULT.LIST)
|
|
|
+ console.log(openId.value)
|
|
|
+ onLineVideoList.value = response.data.RESULT.LIST
|
|
|
+
|
|
|
+ if (openId.value.length > 0) {
|
|
|
+ // start
|
|
|
+ console.log('doododododododo')
|
|
|
+ for (var n = 0; n < onLineVideoList.value.length; n++) {
|
|
|
+ if (openId.value == onLineVideoList.value[n].DEVICE) {
|
|
|
+ console.log('再次打开摄像头')
|
|
|
+ console.log(openId.value)
|
|
|
+ console.log(onLineVideoList.value[n].DEVICE)
|
|
|
+ console.log(onLineVideoList.value[n].ONAIR)
|
|
|
+ reCount.value++
|
|
|
+ console.log(reCount.value)
|
|
|
+ if (onLineVideoList.value[n].ONAIR) {
|
|
|
+ if (++count.value > 2) {
|
|
|
+ loadingStatus.value = false
|
|
|
+
|
|
|
+ dialogTitle.value = '查看视频'
|
|
|
+ showDialog.value = true
|
|
|
+ } else {
|
|
|
+ store.state.siteCameraTimer = setTimeout(chk_video, 5000)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (reCount.value > 7) {
|
|
|
+ loadingStatus.value = false
|
|
|
+ alert('远程摄像头链接超时,请稍后再试')
|
|
|
+
|
|
|
+ break
|
|
|
+ }
|
|
|
+ store.state.siteCameraTimer = setTimeout(chk_video, 5000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // end
|
|
|
+ } else {
|
|
|
+ for (var i = 0; i < onLineVideoList.value.length; i++) {
|
|
|
+ for (var j = 0; j < tableData.value.length; j++) {
|
|
|
+ if (
|
|
|
+ onLineVideoList.value[i].DEVICE ==
|
|
|
+ tableData.value[j].deviceCode
|
|
|
+ ) {
|
|
|
+ // alert(1)
|
|
|
+ tableData.value[j].ALIVEVALUE =
|
|
|
+ onLineVideoList.value[i].ALIVEVALUE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('处理后的,tableData.value')
|
|
|
+ console.log(tableData.value)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查看视频
|
|
|
+ const open_video = (item) => {
|
|
|
+ deviceCode.value = item.deviceCode
|
|
|
+ if (openId.value != item.deviceCode) {
|
|
|
+ openId.value = item.deviceCode
|
|
|
+ }
|
|
|
+ for (var n = 0; n < onLineVideoList.value.length; n++) {
|
|
|
+ if (onLineVideoList.value[n].DEVICE == openId.value) {
|
|
|
+ console.log('第一次打开时设备及其状态')
|
|
|
+ console.log(onLineVideoList.value[n].DEVICE)
|
|
|
+ console.log(openId.value)
|
|
|
+ console.log(onLineVideoList.value[n].ONAIR)
|
|
|
+ if (onLineVideoList.value[n].ONAIR) {
|
|
|
+ dialogTitle.value = '查看视频'
|
|
|
+ showDialog.value = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ count.value = 0
|
|
|
+ reCount.value = 0
|
|
|
+ loadingStatus.value = true
|
|
|
+ axios
|
|
|
+ .post(
|
|
|
+ 'https://fire.usky.cn:8443/YtIoT/cgi-bin/demo2.cgi',
|
|
|
+ 'queryJson:' +
|
|
|
+ JSON.stringify({
|
|
|
+ CMD: 3,
|
|
|
+ BODY: {
|
|
|
+ DEVICE: item.deviceCode,
|
|
|
+ ACTION: 1,
|
|
|
+ IDX: 7,
|
|
|
+ },
|
|
|
+ }),
|
|
|
+ {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
|
|
+ },
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then((response) => {
|
|
|
+ response
|
|
|
+ store.state.siteCameraTimer = window.setTimeout(function () {
|
|
|
+ chk_video()
|
|
|
+ }, 5000)
|
|
|
+ })
|
|
|
+
|
|
|
+ // end
|
|
|
+ }
|
|
|
+
|
|
|
+ watch(
|
|
|
+ () => props.activeName,
|
|
|
+ (newVal) => {
|
|
|
+ // alert(newVal)
|
|
|
+ if (newVal == 'videoEquip') {
|
|
|
+ // clearTimeOut(timer.value)
|
|
|
+ // window.clearTimeOut() //关闭定时器// alert('关闭定时器?')
|
|
|
+ reCount.value = 0
|
|
|
+ openId.value = ''
|
|
|
+ loadingStatus.value = false
|
|
|
+
|
|
|
+ videoMonitoringDeviceList()
|
|
|
+ chk_video()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
+ onMounted(() => {})
|
|
|
|
|
|
return {
|
|
|
headClass,
|
|
@@ -243,12 +394,22 @@ export default defineComponent({
|
|
|
|
|
|
filterText,
|
|
|
tableData,
|
|
|
- activeName,
|
|
|
+ // activeName,
|
|
|
currentPage,
|
|
|
closeDialog,
|
|
|
dialogTitle,
|
|
|
showDialog,
|
|
|
store,
|
|
|
+ chk_video,
|
|
|
+
|
|
|
+ openId,
|
|
|
+ onLineVideoList,
|
|
|
+ reCount,
|
|
|
+ count,
|
|
|
+ loadingStatus,
|
|
|
+ open_video,
|
|
|
+ timer,
|
|
|
+ deviceCode,
|
|
|
}
|
|
|
},
|
|
|
})
|