zhgdyun/src/components/areaTree.vue

682 lines
18 KiB
Vue
Raw Normal View History

2022-06-08 14:51:11 +08:00
<template>
<div
class="areaTreeBox"
2023-03-06 20:37:50 +08:00
:class="
videoType == 1 || modules == 'markingRoom' || modules == 'carManage'
? 'hasVedio'
: 'noVideo'
"
2022-06-08 14:51:11 +08:00
id="videoTreeBox"
>
<div
class="areaTreeInner whiteBlock fullHeight"
2023-03-06 20:37:50 +08:00
v-show="
expandOnoff ||
videoType == 1 ||
modules == 'markingRoom' ||
modules == 'carManage'
"
:class="$props.styleType ? 'black' : ''"
2022-06-08 14:51:11 +08:00
>
<div class="pageTitle" v-if="videoType == 1">视频列表</div>
2023-03-06 20:37:50 +08:00
<p
:class="
modules == 'markingRoom' || modules == 'carManage'
? 'pageTitle'
: 'treeTitle'
"
v-else
>
2022-06-08 14:51:11 +08:00
查看全部工地
</p>
<div class="treeBox">
<vue-scroll v-if="treeData.length > 0 || videoType != 1">
2023-03-06 20:37:50 +08:00
<el-tree
:data="treeData"
@node-click="handleNodeClick"
:props="defaultProps"
node-key="itemId"
ref="tree"
>
2022-06-08 14:51:11 +08:00
<span class="custom-tree-node" slot-scope="{ node, data }">
<span
2023-03-06 20:37:50 +08:00
v-show="data.videoName"
class="icon-video"
:class="data.deviceType == 2 ? 'icon-video2' : ''"
>
</span>
<span
:class="
data.videoName
? 'videoName'
: data.projectName
? 'projectName'
: data.companyType == 2
? 'companyName2'
: ''
"
2023-09-08 17:45:24 +08:00
:title="node.label"
2022-06-08 14:51:11 +08:00
>{{ node.label }}</span
>
2023-09-08 17:45:24 +08:00
<!-- <span
:title="data.projectNum"
v-show="data.projectNum && videoType == 0"
>{{ data.projectNum }}</span
> -->
2023-03-06 20:37:50 +08:00
<el-tooltip
effect="dark"
content="播放项目所有视频"
placement="top"
>
2022-06-08 14:51:11 +08:00
<span
class="playAllBtn"
2023-03-06 20:37:50 +08:00
v-show="
videoType == 1 && data.projectName && data.list.length > 0
"
2022-06-08 14:51:11 +08:00
@click.stop="playMutipleVideo(data)"
></span>
</el-tooltip>
2023-03-06 20:37:50 +08:00
<span
v-show="data.projectName && modules == 'markingRoom'"
class="statusImgBox"
>
<img
v-show="data.standardDevStopUsingNum != 0"
src="@/assets/images/no_alarm.png"
alt=""
srcset=""
/>
<img
v-show="data.standardDevNotOnline != 0"
src="@/assets/images/offline_alarm.png"
alt=""
srcset=""
/>
<img
v-show="data.standardTemperatureAlarmNum != 0"
src="@/assets/images/temp_alarm.png"
alt=""
srcset=""
/>
<img
v-show="data.standardHumidityAlarmNum != 0"
src="@/assets/images/humi_alarm.png"
alt=""
srcset=""
/>
2022-06-08 14:51:11 +08:00
</span>
</span>
</el-tree>
</vue-scroll>
<div class="placeholderBox" v-else>
2023-03-06 20:37:50 +08:00
<img
src="@/assets/images/longguang/noData2.png"
alt=""
srcset=""
v-if="company == 'longguang'"
/>
2022-06-08 14:51:11 +08:00
<img src="@/assets/images/noData2.png" alt="" srcset="" v-else />
<p>{{ $t('message.videoManage.empty') }}</p>
2022-06-08 14:51:11 +08:00
</div>
</div>
</div>
<div
class="onoffBtn"
:class="expandOnoff ? 'active' : ''"
2023-03-06 20:37:50 +08:00
v-show="
videoType == 0 && modules != 'markingRoom' && modules != 'carManage'
"
2022-06-08 14:51:11 +08:00
@click="expandOnoff = !expandOnoff"
>
<i v-show="expandOnoff" class="el-icon-caret-left"></i>
2023-03-06 20:37:50 +08:00
<span v-show="!expandOnoff"
><i class="el-icon-caret-right"></i>查看所有工地</span
>
2022-06-08 14:51:11 +08:00
</div>
</div>
</template>
<script>
import { getstandardDevListApi } from '@/assets/js/api/markingRoom'
2023-03-06 20:37:50 +08:00
import {
getComapnyStatisticsListApi,
getComapnyVideoListApi,
getComapnyParentNameApi
} from '@/assets/js/api/company/project'
import { getVideoItemInfoApi } from '@/assets/js/api/equipmentCenter/cameraList'
2022-06-08 14:51:11 +08:00
export default {
props: ['videoType', 'modules', 'activeLive', 'styleType', 'videoSn'],
2022-06-08 14:51:11 +08:00
data() {
return {
treeData: [],
defaultProps: {
children: 'list',
label: 'name'
2022-06-08 14:51:11 +08:00
},
expandOnoff: false,
searchsn: '',
2022-06-08 14:51:11 +08:00
videoList: [],
expandKeys: [],
numIndex: 1, //用于不用账号登录左边组织机构的点击
markRoomDevList: [],
company: ''
}
2022-06-08 14:51:11 +08:00
},
mounted() {
this.company = COMPANY
this.loadData()
2022-06-08 14:51:11 +08:00
},
methods: {
getMarkRoomDev(sn) {
2023-03-06 20:37:50 +08:00
getstandardDevListApi({ projectSn: sn }).then((res) => {
this.markRoomDevList = res.result
})
2022-06-08 14:51:11 +08:00
},
loadData() {
console.log(isDockingToWoer)
console.log(this.$props.videoSn)
if (this.$props.videoSn) {
2022-06-08 14:51:11 +08:00
this.searchsn = this.$props.videoSn
console.log(this.searchsn)
} else {
if (isDockingToWoer) {
this.searchsn = this.$store.state.projectSn
2022-06-08 14:51:11 +08:00
} else {
var backArr = this.$store.state.mapBackArr
2024-02-29 20:32:08 +08:00
console.log(Number(this.$store.state.userInfo.accountType),'778899')
2022-06-08 14:51:11 +08:00
switch (Number(this.$store.state.userInfo.accountType)) {
case 2:
this.searchsn = this.$store.state.userInfo.headquartersSn
this.numIndex = 2
2022-06-08 14:51:11 +08:00
break
2022-06-08 14:51:11 +08:00
case 3:
this.searchsn = this.$store.state.userInfo.sn
this.numIndex = 3
break
2022-06-08 14:51:11 +08:00
case 4:
this.searchsn = this.$store.state.userInfo.sn
this.numIndex = 4
break
2024-02-29 20:32:08 +08:00
case 5:
this.searchsn = this.$store.state.userInfo.sn
this.numIndex = 5
break
2024-02-29 20:32:08 +08:00
case 7:
this.searchsn = this.$store.state.userInfo.sn
this.numIndex = 7
break
2022-06-08 14:51:11 +08:00
}
if (this.videoType == 1 && backArr.length > 0) {
this.searchsn = backArr[backArr.length - 1].sn
2022-06-08 14:51:11 +08:00
}
if (this.$route.path.indexOf('/project/') != -1) {
this.searchsn = this.$store.state.projectSn
2022-06-08 14:51:11 +08:00
}
}
}
2024-02-29 20:32:08 +08:00
console.log(this.searchsn,'113355')
2022-06-08 14:51:11 +08:00
// getComapnyVideoListApi({
// sn: this.searchsn
// }).then((res) => {
// this.videoList = res.result.videoList;
// if(this.videoList[0].videoType==3){
// this.$emit('playParams',this.videoList)
// }
// });
getComapnyStatisticsListApi({
sn: this.searchsn,
videoType: this.videoType,
standardType: this.modules == 'markingRoom' ? 1 : 0
2023-03-06 20:37:50 +08:00
}).then((res) => {
2022-06-08 14:51:11 +08:00
console.log('-----tree')
this.treeData = res.result.companyList
? res.result.companyList
: res.result.projectList
2023-09-08 17:45:24 +08:00
? res.result.projectList
: res.result.videoList
console.log('this.$route.path', this.$route.path)
2022-06-08 14:51:11 +08:00
console.log(this.treeData)
if (this.$route.path.indexOf('dataBoard/digitalSite') == -1) {
console.log('areaTree.vue传递设备列表数据')
this.$emit('playParams', this.treeData)
2022-06-08 14:51:11 +08:00
console.log(this.treeData)
}
if (this.$route.path.indexOf('/firm/towerManage') != -1) {
this.$emit('getTreeData', this.treeData)
2022-06-08 14:51:11 +08:00
}
2023-03-06 20:37:50 +08:00
console.log(
'areaTree.vue传递设备列表数据 --- this.activeLive : ',
this.activeLive
)
2022-06-08 14:51:11 +08:00
if (this.activeLive) {
2023-03-06 20:37:50 +08:00
this.treeData.forEach((item) => {
2022-06-08 14:51:11 +08:00
if (this.activeLive.devSn == item.serialNumber) {
this.handleNodeClick(item)
2022-06-08 14:51:11 +08:00
this.$nextTick(() => {
this.$refs['tree'].setCurrentKey(item.itemId.toString())
})
2022-06-08 14:51:11 +08:00
}
})
2022-06-08 14:51:11 +08:00
}
})
2022-06-08 14:51:11 +08:00
},
//获取视频播放url
getVideo(itemId, videoType, item) {
//videoType 1萤石云2乐橙3ISC4大华5宇视6国标
//playType 播放方式1高清RTMP,2流畅RTMP,3高清HLS,4流畅HLS,5高清轻量级插件6流畅轻量级插件
getVideoItemInfoApi({
itemId: itemId
2023-03-06 20:37:50 +08:00
}).then((res) => {
var result = res.result
var url = ''
2022-06-08 14:51:11 +08:00
if (videoType == 1) {
switch (Number(result.projectVideoConfig.playType)) {
case 1:
url = result.videoInfo.rtmpHd
break
2022-06-08 14:51:11 +08:00
case 2:
url = result.videoInfo.rtmp
break
2022-06-08 14:51:11 +08:00
case 3:
url = result.videoInfo.hdFlvAddress
break
2022-06-08 14:51:11 +08:00
case 4:
url = result.videoInfo.flvAddress
break
2022-06-08 14:51:11 +08:00
case 5:
url = `ezopen://open.ys7.com/${result.videoInfo.deviceSerial}/${result.videoInfo.channelNo}.hd.live`
break
2022-06-08 14:51:11 +08:00
case 6:
url = `ezopen://open.ys7.com/${result.videoInfo.deviceSerial}/${result.videoInfo.channelNo}.live`
break
2022-06-08 14:51:11 +08:00
default:
url = `ezopen://open.ys7.com/${result.videoInfo.deviceSerial}/${result.videoInfo.channelNo}.live`
break
2022-06-08 14:51:11 +08:00
}
this.$emit('playParams', [
2022-06-08 14:51:11 +08:00
{
accessToken: result.accessToken,
url: url,
videoType: videoType,
playType: result.projectVideoConfig.playType
}
])
2022-06-08 14:51:11 +08:00
}
if (videoType == 2) {
// url=`imou://open.lechange.com/${item.serialNumber}/${item.channelId}/1?streamId=1`
// this.$emit('playParams',{accessToken:result.accessToken,url:url,videoType:item.videoType})
this.$emit('playParams', [
2022-06-08 14:51:11 +08:00
{
accessToken: result.accessToken,
url: item.liveRadioUrl,
videoType: item.videoType
}
])
2022-06-08 14:51:11 +08:00
}
// if(videoType==3){
// item.date = new Date()
// this.$emit('playParams',[item])
// }
// console.log('视频播放url',url)
})
2022-06-08 14:51:11 +08:00
},
handleNodeClick(data) {
console.log(data, this.videoType, '5555')
2022-06-08 14:51:11 +08:00
let companyType = data.companyType
if (this.videoType == 1) {
//用于企业级视频监控页面
if (data.videoName) {
if (data.videoType == 3) {
data.date = new Date()
this.$emit('playParams', [data])
2022-06-08 14:51:11 +08:00
} else {
this.getVideo(data.itemId, data.videoType, data)
2022-06-08 14:51:11 +08:00
}
}
} else {
let sn1 = data.projectSn ? data.projectSn : data.companySn
2022-06-08 14:51:11 +08:00
getComapnyParentNameApi({
sn: sn1
2023-03-06 20:37:50 +08:00
}).then((res) => {
let backArr = []
let data = res.result
2022-06-08 14:51:11 +08:00
console.log(res)
backArr.push({
name: data.firstCompanyName,
sn: data.firstCompanySn
})
2022-06-08 14:51:11 +08:00
if (data.secondCompanyName) {
backArr.push({
name: data.secondCompanyName,
sn: data.secondCompanySn
})
2022-06-08 14:51:11 +08:00
}
if (data.thirdCompanyName) {
backArr.push({
name: data.thirdCompanyName,
sn: data.thirdCompanySn
})
2022-06-08 14:51:11 +08:00
}
if (data.projectName) {
backArr.push({ name: data.projectName, sn: data.projectSn })
2022-06-08 14:51:11 +08:00
}
if (!companyType) {
backArr[backArr.length - 1].isProject = true
2022-06-08 14:51:11 +08:00
}
console.log(companyType, backArr)
this.$store.commit('setMapBackArr', backArr)
this.$parent.initData()
})
2022-06-08 14:51:11 +08:00
}
},
playMutipleVideo(data) {
this.$emit('playParams', data.list)
}
}
}
2022-06-08 14:51:11 +08:00
</script>
<style lang="less" scoped>
.treeTitle {
padding: 0px 0 20px 0px;
}
.pageTitle {
margin-bottom: 20px;
}
.onoffBtn {
color: white;
width: 20px;
font-size: 12px;
position: absolute;
right: -20px;
top: calc(50% - 93px);
padding: 35px 0;
text-align: center;
background-color: #bbb;
cursor: pointer;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
.el-icon-caret-left {
line-height: 116px;
}
&.active {
background-color: rgba(0, 0, 0, 0.7);
}
}
.custom-tree-node {
width: 100%;
2023-09-08 17:45:24 +08:00
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2022-06-08 14:51:11 +08:00
}
.areaTreeBox {
/deep/.el-tree {
font-size: 15px;
width: 100%;
background-color: transparent;
.el-tree-node {
width: 100%;
2022-06-08 14:51:11 +08:00
white-space: normal;
&:focus > .el-tree-node__content {
background-color: transparent;
}
&.is-current > .el-tree-node__content {
background-color: rgba(81, 129, 246, 0.14);
color: #5181f6;
}
}
.el-tree-node__content {
// height: 32px;
padding: 7px 0;
height: auto;
line-height: 16px;
position: relative;
// margin-bottom: 7px;
&:hover {
background-color: rgba(81, 129, 246, 0.14);
color: #5181f6;
// font-weight: bold;
.icon-video {
2023-03-06 20:37:50 +08:00
background: url('../assets/images/icon-video-blue.png') center center
no-repeat;
2022-06-08 14:51:11 +08:00
&.icon-video2 {
2023-03-06 20:37:50 +08:00
background: url('../assets/images/icon-video2-blue.png') center
center no-repeat;
2022-06-08 14:51:11 +08:00
}
}
}
.videoName {
font-size: 14px;
}
.projectName {
font-size: 14px;
width: calc(100% - 30px);
display: inline-block;
overflow: hidden;
2023-09-08 17:45:24 +08:00
text-overflow: ellipsis;
white-space: nowrap;
2022-06-08 14:51:11 +08:00
}
.companyName2 {
font-size: 16px;
font-weight: bold;
}
}
.el-tree-node__expand-icon {
font-size: 16px;
padding: 0 6px;
&.is-leaf {
color: transparent !important;
}
}
}
}
.noVideo.areaTreeBox {
height: calc(100% + 48px);
position: absolute;
top: -48px;
left: 0;
.treeTitle {
color: white;
}
/deep/.el-tree {
color: #ffffff;
.el-tree-node__content:hover,
.el-tree-node:focus > .el-tree-node__content {
background-color: transparent;
}
.el-tree__empty-text {
color: white;
}
}
/deep/.el-tree-node__expand-icon {
color: #ffffff;
}
}
.areaTreeInner {
background-color: rgba(0, 0, 0, 0.7);
width: 300px;
padding: 20px 15px;
height: calc(100% - 40px);
}
.treeBox {
height: calc(100% - 42px);
2023-01-11 14:00:46 +08:00
width: 306px;
2023-03-06 20:37:50 +08:00
margin-left: -15px;
2022-06-08 14:51:11 +08:00
}
.hasVedio.areaTreeBox {
height: 100%;
position: relative;
top: 0;
float: left;
.treeBox {
background-color: rgba(216, 216, 216, 0.2);
}
.el-tree {
padding: 20px 10px;
height: calc(100% - 50px);
width: calc(100% - 20px);
.disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
.treeTitle {
background-color: #f7f7f7;
margin-bottom: 10px;
}
.areaTreeInner {
background-color: #ffffff;
}
/deep/.el-tree-node__expand-icon {
// color: rgba(42, 46, 63, 0.3);
}
// /deep/.el-tree-node__expand-icon.is-leaf{
// color: rgba(42, 46, 63, 0.3);
// }
}
.icon-video {
margin-right: 13px;
width: 14px;
height: 20px;
display: inline-block;
background: url('../assets/images/icon-video.png') center center no-repeat;
2022-06-08 14:51:11 +08:00
// background-size: 14px auto ;
vertical-align: top;
&.icon-video2 {
background: url('../assets/images/icon-video2.png') center center no-repeat;
2022-06-08 14:51:11 +08:00
}
}
.playAllBtn {
width: 18px;
height: 18px;
// display: inline-block;
// margin-left: 10px;
// vertical-align: text-top;
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
background: url('../assets/images/icon-play.png') center center no-repeat;
2022-06-08 14:51:11 +08:00
&:hover {
2023-03-06 20:37:50 +08:00
background: url('../assets/images/icon-play-blue.png') center center
no-repeat;
2022-06-08 14:51:11 +08:00
}
}
.statusImgBox {
float: right;
img {
margin-left: 5px;
&:first-child {
margin-left: 0;
}
}
}
.longguang {
.el-tree-node__content {
&:hover {
background-color: rgba(81, 129, 246, 0.14);
color: #5181f6;
// font-weight: bold;
.icon-video {
2023-03-06 20:37:50 +08:00
background: url('../assets/images/longguang/icon-video-blue.png') center
center no-repeat !important;
2022-06-08 14:51:11 +08:00
&.icon-video2 {
2023-03-06 20:37:50 +08:00
background: url('../assets/images/longguang/icon-video2-blue.png')
center center no-repeat !important;
2022-06-08 14:51:11 +08:00
}
}
}
}
.playAllBtn {
&:hover {
2023-03-06 20:37:50 +08:00
background: url('../assets/images/longguang/icon-watch-video.png') center
center no-repeat !important;
}
2022-06-08 14:51:11 +08:00
}
}
// 以下为龙光大屏video组件引入此组件时的样式
.black {
float: left;
background-color: #011536 !important;
color: white !important;
height: calc(100% - 70px);
.pageTitle {
2022-06-08 14:51:11 +08:00
box-sizing: border-box;
padding: 5px 10px;
margin-bottom: 20px;
background-color: #021330;
height: 20px;
line-height: 10px;
&::before {
2022-06-08 14:51:11 +08:00
background-color: #fff;
}
font-size: 18px;
}
.treeBox {
2022-06-08 14:51:11 +08:00
background-color: #021330 !important;
position: relative;
}
.companyName2 {
color: #fff;
2022-06-08 14:51:11 +08:00
font-weight: 100 !important;
font-size: 15px;
2023-03-06 20:37:50 +08:00
font-family: '黑体', '微软雅黑', 'Helvetica Neue', Helvetica, 'PingFang SC',
'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif !important;
2022-06-08 14:51:11 +08:00
}
.custom-tree-node {
color: #fff;
2022-06-08 14:51:11 +08:00
}
.areaTreeBox {
/deep/ .el-tree-node__expand-icon {
2022-06-08 14:51:11 +08:00
color: #fff !important;
}
/deep/ .el-tree-node__content {
2022-06-08 14:51:11 +08:00
color: #fff !important;
}
}
.icon-video {
2023-03-06 20:37:50 +08:00
background: url('../assets/images/icon-video-white.png') center center
no-repeat;
2022-06-08 14:51:11 +08:00
// background-size: 14px auto ;
vertical-align: top;
&.icon-video2 {
2023-03-06 20:37:50 +08:00
background: url('../assets/images/icon-video2.png') center center
no-repeat;
2022-06-08 14:51:11 +08:00
}
}
.projectName:hover {
color: #5181f6;
2022-06-08 14:51:11 +08:00
&::before {
content: '';
2022-06-08 14:51:11 +08:00
display: inline-block;
background-color: #fff;
width: 1.5%;
height: 100%;
position: absolute;
top: 0%;
left: 0%;
background-color: #5181f6;
2022-06-08 14:51:11 +08:00
}
}
.custom-tree-node:hover {
color: #5181f6;
2022-06-08 14:51:11 +08:00
&::before {
content: '';
2022-06-08 14:51:11 +08:00
display: inline-block;
background-color: #fff;
width: 1.5%;
height: 100%;
position: absolute;
top: 0%;
left: 0%;
background-color: #5181f6;
2022-06-08 14:51:11 +08:00
}
}
}
</style>