Merge branch 'tcy' of http://192.168.110.2:3000/taoge_xiaodi/maintenance_system into lx
This commit is contained in:
@ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源场站智慧运维平台
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 开发环境
|
# 开发环境
|
||||||
VITE_APP_BASE_API = 'http://192.168.110.149:18899'
|
VITE_APP_BASE_API = 'http://192.168.110.194:18899'
|
||||||
|
|
||||||
# 应用访问路径 例如使用前缀 /admin/
|
# 应用访问路径 例如使用前缀 /admin/
|
||||||
VITE_APP_CONTEXT_PATH = '/'
|
VITE_APP_CONTEXT_PATH = '/'
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
"echarts": "5.6.0",
|
"echarts": "5.6.0",
|
||||||
"echarts-liquidfill": "^3.1.0",
|
"echarts-liquidfill": "^3.1.0",
|
||||||
"element-plus": "2.9.8",
|
"element-plus": "2.9.8",
|
||||||
|
"ezuikit-js": "^8.1.10",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"highlight.js": "11.9.0",
|
"highlight.js": "11.9.0",
|
||||||
"image-conversion": "2.1.1",
|
"image-conversion": "2.1.1",
|
||||||
|
|||||||
BIN
public/assets/dialog2.png
Normal file
BIN
public/assets/dialog2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 685 KiB |
74
src/api/devicePreset/index.ts
Normal file
74
src/api/devicePreset/index.ts
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import { AxiosPromise } from 'axios';
|
||||||
|
import { DevicePresetVO, DevicePresetForm, DevicePresetQuery } from '@/api/camera/devicePreset/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询摄像头预置位列表
|
||||||
|
* @param query
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const listDevicePreset = (query?: DevicePresetQuery): AxiosPromise<DevicePresetVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/camera/devicePreset/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询摄像头预置位详细
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getDevicePreset = (id: string | number): AxiosPromise<DevicePresetVO> => {
|
||||||
|
return request({
|
||||||
|
url: '/camera/devicePreset/' + id,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增摄像头预置位
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addDevicePreset = (data: DevicePresetForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/camera/devicePreset',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改摄像头预置位
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const updateDevicePreset = (data: DevicePresetForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/camera/devicePreset',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除摄像头预置位
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const delDevicePreset = (id: string | number | Array<string | number>) => {
|
||||||
|
return request({
|
||||||
|
url: '/camera/devicePreset/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 调用摄像头预置位
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const callDevicePreset = (data: DevicePresetForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/camera/devicePreset/call',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
86
src/api/devicePreset/types.ts
Normal file
86
src/api/devicePreset/types.ts
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
export interface DevicePresetVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备序列号
|
||||||
|
*/
|
||||||
|
deviceSerial: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道号
|
||||||
|
*/
|
||||||
|
channelNo: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置点序号
|
||||||
|
*/
|
||||||
|
presetIndex: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置点
|
||||||
|
*/
|
||||||
|
presetName: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DevicePresetForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备序列号
|
||||||
|
*/
|
||||||
|
deviceSerial?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道号
|
||||||
|
*/
|
||||||
|
channelNo?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置点序号
|
||||||
|
*/
|
||||||
|
presetIndex?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置点
|
||||||
|
*/
|
||||||
|
presetName?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DevicePresetQuery extends PageQuery {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备序列号
|
||||||
|
*/
|
||||||
|
deviceSerial?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道号
|
||||||
|
*/
|
||||||
|
channelNo?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置点序号
|
||||||
|
*/
|
||||||
|
presetIndex?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预置点
|
||||||
|
*/
|
||||||
|
presetName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
16
src/api/securitySurveillance/index.js
Normal file
16
src/api/securitySurveillance/index.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
// 获取萤石云Token
|
||||||
|
export function getToken() {
|
||||||
|
return request({
|
||||||
|
url: '/ops/monitoriing/getToken',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 获取摄像头列表
|
||||||
|
export function getMonitoringList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ops/monitoriing/getMonitoringList',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
16
src/assets/styles/1.html
Normal file
16
src/assets/styles/1.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<div class="card">
|
||||||
|
<div id="content">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// 定义每个状态对应的图片URL
|
||||||
|
const titleList = ['运行正常', '运行异常', '未运行']
|
||||||
|
let titleHtml = ""
|
||||||
|
titleList.forEach((title, index) => {
|
||||||
|
titleHtml += `我是标题${title}<br>`
|
||||||
|
})
|
||||||
|
document.getElementById('content').innerHTML = titleHtml
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -1,16 +1,230 @@
|
|||||||
|
.no-header-dialog {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
#custom-dialog {
|
#custom-dialog {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
top: 0;
|
||||||
|
|
||||||
.el-dialog__header {
|
.el-dialog__header {
|
||||||
display: none;
|
// display: none;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dialog__body {
|
.el-dialog__body {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
|
// height: auto !important;
|
||||||
|
max-height: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert-content {
|
.status-alert-content {
|
||||||
padding: 80px;
|
|
||||||
background: linear-gradient(180deg, rgba(0, 119, 255, 0.23) 0%, rgba(255, 255, 255, 0) 100%);
|
background: linear-gradient(180deg, rgba(0, 119, 255, 0.23) 0%, rgba(255, 255, 255, 0) 100%);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-left: 20px;
|
||||||
|
padding-right: 50px;
|
||||||
|
|
||||||
|
.info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
color: rgba(0, 30, 59, 1);
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
color: rgba(0, 30, 59, 1);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
.last-update {
|
||||||
|
// font-size: ;
|
||||||
|
color: rgba(113, 128, 150, 1);
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 240px;
|
||||||
|
height: 240px;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-box {
|
||||||
|
font-size: 12px;
|
||||||
|
display: flex;
|
||||||
|
gap: 40px;
|
||||||
|
margin-left: 30px;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
color: rgba(113, 128, 150, 1);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-weight: bold;
|
||||||
|
color: rgba(0, 30, 59, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-alert-content .success {
|
||||||
|
color: rgba(0, 184, 122, 1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-alert-content .orange {
|
||||||
|
color: rgba(255, 153, 0, 1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-alert-content .red {
|
||||||
|
color: rgba(227, 39, 39, 1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back {
|
||||||
|
background-image: url("/assets/dialog2.png");
|
||||||
|
background-size: 455px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 780px -65px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alarm-alert-content {
|
||||||
|
background: linear-gradient(180deg, rgba(255, 87, 51, 0.23) 0%, rgba(255, 219, 219, 0) 100%);
|
||||||
|
padding-left: 50px;
|
||||||
|
padding-right: 50px;
|
||||||
|
padding-bottom: 50px;
|
||||||
|
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
gap: 50px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 50px 0;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
|
||||||
|
|
||||||
|
.info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 15px;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
color: rgba(227, 39, 39, 1);
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alarm-id {
|
||||||
|
color: rgba(0, 30, 59, 1);
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-box {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
|
||||||
|
.status {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.last-update {
|
||||||
|
color: rgba(113, 128, 150, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-box {
|
||||||
|
.list {
|
||||||
|
display: flex;
|
||||||
|
gap: 90px;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 30px;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
color: rgba(113, 128, 150, 1);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: rgba(0, 30, 59, 1);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-box {
|
||||||
|
.title {
|
||||||
|
color: rgba(0, 30, 59, 1);
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 20px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-box {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
color: rgba(113, 128, 150, 1);
|
||||||
|
|
||||||
|
.time {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.title.active {
|
||||||
|
color: rgba(247, 89, 10, 1);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.alarm-alert-content .red {
|
||||||
|
color: rgba(227, 39, 39, 1) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row>
|
<el-row v-if="titleStatus">
|
||||||
<el-col>
|
<el-col>
|
||||||
<div style="color: rgba(0, 30, 59, 1);font-family: 'Alibaba-PuHuiTi-Bold';margin: 10px 0 0 0;"
|
<div style="color: rgba(0, 30, 59, 1);font-family: 'Alibaba-PuHuiTi-Bold';margin: 10px 0 0 0;"
|
||||||
:style="{ fontSize: fontLevelMap[props.fontLevel] }">
|
:style="{ fontSize: fontLevelMap[props.fontLevel] }">
|
||||||
@ -11,10 +11,10 @@
|
|||||||
{{ props.subtitle }}
|
{{ props.subtitle }}
|
||||||
</p>
|
</p>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
const titleStatus = ref(false)
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: String,
|
title: String,
|
||||||
subtitle: String,
|
subtitle: String,
|
||||||
|
|||||||
288
src/views/camera/components/presetAdd.vue
Normal file
288
src/views/camera/components/presetAdd.vue
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
<template>
|
||||||
|
<div class="system-busPresettingBit-add">
|
||||||
|
<el-dialog v-model="isShowDialog" width="1250px" :close-on-click-modal="false" :destroy-on-close="true">
|
||||||
|
<template #header>
|
||||||
|
<div
|
||||||
|
v-drag="['.system-busPresettingBit-add .el-dialog', '.system-busPresettingBit-add .el-dialog__header']">
|
||||||
|
{{ title }}:添加摄像头预置位
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div class="info_list">
|
||||||
|
<div class="video_box">
|
||||||
|
<div class="video-container" id="video-container" style="width: 870px; height: 600px"></div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" style="margin: 0 20px 10px" @click="addPre">
|
||||||
|
<el-icon>
|
||||||
|
<Plus />
|
||||||
|
</el-icon>
|
||||||
|
添加预置点
|
||||||
|
</el-button>
|
||||||
|
<el-table v-loading="loading" :data="tableData.data" border>
|
||||||
|
<el-table-column label="序号" align="center" type="index" width="55" />
|
||||||
|
<el-table-column label="名称" align="center" prop="presetName" width="120px"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-input v-model="scope.row.presetName" placeholder="请输入内容"
|
||||||
|
@change="handleEdit(scope.row)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="135px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="primary" link @click="handleDebug(scope.row)">
|
||||||
|
<el-icon>
|
||||||
|
<View />
|
||||||
|
</el-icon>调用
|
||||||
|
</el-button>
|
||||||
|
<el-button type="danger" link @click="handleDelete(scope.row)">
|
||||||
|
<el-icon>
|
||||||
|
<DeleteFilled />
|
||||||
|
</el-icon>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination style="padding: 5px 16px" v-show="tableData.total > 0" :total="tableData.total"
|
||||||
|
v-model:page="tableData.param.pageNum" v-model:limit="tableData.param.pageSize"
|
||||||
|
@pagination="busPresettingBitList" :layout="layout" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, onBeforeUnmount, getCurrentInstance, nextTick } from 'vue';
|
||||||
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
|
import { listDevicePreset, addDevicePreset, updateDevicePreset, delDevicePreset, callDevicePreset } from '@/api/devicePreset';
|
||||||
|
import EZUIKit from 'ezuikit-js';
|
||||||
|
|
||||||
|
const emit = defineEmits(['update']);
|
||||||
|
const { proxy } = getCurrentInstance() as any;
|
||||||
|
|
||||||
|
const formRef = ref<HTMLElement | null>(null);
|
||||||
|
const menuRef = ref();
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const isShowDialog = ref(false);
|
||||||
|
const layout = ref('total, prev, pager, next');
|
||||||
|
const title = ref('');
|
||||||
|
const updateRow = ref<any>(null);
|
||||||
|
const src = ref(null);
|
||||||
|
const flvPlayer = ref<any>(null);
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
deviceSerial: undefined,
|
||||||
|
channelNo: '1',
|
||||||
|
presetName: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const tableData = ref({
|
||||||
|
data: [],
|
||||||
|
total: 0,
|
||||||
|
loading: false,
|
||||||
|
param: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 15,
|
||||||
|
deviceSerial: ''
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
function openDialog(row: any) {
|
||||||
|
resetForm();
|
||||||
|
updateRow.value = row;
|
||||||
|
title.value = row.deviceName;
|
||||||
|
formData.value.deviceSerial = row.deviceSerial;
|
||||||
|
tableData.value.param.deviceSerial = row.deviceSerial;
|
||||||
|
isShowDialog.value = true;
|
||||||
|
busPresettingBitList();
|
||||||
|
nextTick(() => {
|
||||||
|
videoPlay(row);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加预置点
|
||||||
|
function addPre() {
|
||||||
|
ElMessageBox.prompt('请输入预置点名称', '添加预置点', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
inputErrorMessage: '请输入预置点名称'
|
||||||
|
})
|
||||||
|
.then(({ value }) => {
|
||||||
|
formData.value.presetName = value;
|
||||||
|
addDevicePreset(formData.value)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('添加成功');
|
||||||
|
busPresettingBitList();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 视频播放
|
||||||
|
function videoPlay(obj: any) {
|
||||||
|
console.log('objobjobj', obj);
|
||||||
|
|
||||||
|
getAccessToken().then((res: any) => {
|
||||||
|
if (res.code == 200 && obj.deviceSerial) {
|
||||||
|
flvPlayer.value = new EZUIKit.EZUIKitPlayer({
|
||||||
|
audio: '0',
|
||||||
|
id: 'video-container',
|
||||||
|
accessToken: res.data,
|
||||||
|
url: `ezopen://open.ys7.com/${obj.deviceSerial}/1.hd.live`,
|
||||||
|
template: 'pcLive',
|
||||||
|
width: 870,
|
||||||
|
height: 600,
|
||||||
|
plugin: ['talk'],
|
||||||
|
handleError: function (err: any) {
|
||||||
|
console.log(err);
|
||||||
|
|
||||||
|
if (err?.data?.ret === 20020) {
|
||||||
|
// 20020 是并发连接限制的错误码
|
||||||
|
ElMessage.error('当前观看人数已达上限,请稍后再试');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
function closeDialog() {
|
||||||
|
if (flvPlayer.value) {
|
||||||
|
flvPlayer.value.destroy().then((data: any) => {
|
||||||
|
console.log('promise 获取 数据', data);
|
||||||
|
});
|
||||||
|
flvPlayer.value = null;
|
||||||
|
}
|
||||||
|
isShowDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取列表
|
||||||
|
function busPresettingBitList() {
|
||||||
|
loading.value = true;
|
||||||
|
listDevicePreset(tableData.value.param).then((res: any) => {
|
||||||
|
tableData.value.data = res.rows ?? [];
|
||||||
|
tableData.value.total = res.total;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消
|
||||||
|
function onCancel() {
|
||||||
|
closeDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
function handleDelete(row: any) {
|
||||||
|
let msg = '你确定要删除所选数据?';
|
||||||
|
let id: number[] = [];
|
||||||
|
if (row) {
|
||||||
|
msg = '此操作将永久删除数据,是否继续?';
|
||||||
|
id = [row.id];
|
||||||
|
}
|
||||||
|
if (id.length === 0) {
|
||||||
|
ElMessage.error('请选择要删除的数据。');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm(msg, '提示', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
const obj = {
|
||||||
|
deviceSerial: row.deviceSerial,
|
||||||
|
ids: id
|
||||||
|
};
|
||||||
|
delDevicePreset(id).then((res: any) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success('删除成功');
|
||||||
|
busPresettingBitList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
function handleDebug(row: any) {
|
||||||
|
callDevicePreset(row.id).then((res: any) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success('调用成功');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
function handleEdit(row: any) {
|
||||||
|
const param = {
|
||||||
|
id: row.id,
|
||||||
|
deviceSerial: row.deviceSerial,
|
||||||
|
presetName: row.presetName
|
||||||
|
};
|
||||||
|
updateDevicePreset(param)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('修改成功');
|
||||||
|
busPresettingBitList();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置表单
|
||||||
|
function resetForm() {
|
||||||
|
formData.value = {
|
||||||
|
deviceSerial: undefined,
|
||||||
|
channelNo: '1',
|
||||||
|
presetName: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (flvPlayer.value) {
|
||||||
|
flvPlayer.value.destroy().then((data: any) => {
|
||||||
|
console.log('promise 获取 数据', data);
|
||||||
|
});
|
||||||
|
flvPlayer.value = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// ✅ 关键:暴露方法给父组件调用
|
||||||
|
defineExpose({
|
||||||
|
openDialog,
|
||||||
|
closeDialog
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.system-busPresettingBit-add {
|
||||||
|
.info_list {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.video_box {
|
||||||
|
width: 75%;
|
||||||
|
height: 600px;
|
||||||
|
margin-right: 10px;
|
||||||
|
|
||||||
|
.iframe {
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video_air {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: fill;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
371
src/views/camera/index.vue
Normal file
371
src/views/camera/index.vue
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
<template>
|
||||||
|
<div class="system-ys7Devices-container">
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<div class="system-ys7Devices-search mb8">
|
||||||
|
<el-form :model="tableData.param" ref="queryRef" :inline="true" label-width="100px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8" class="colBlock">
|
||||||
|
<el-form-item label="设备名称" prop="deviceName">
|
||||||
|
<el-input v-model="tableData.param.deviceName" placeholder="请输入设备名称" clearable
|
||||||
|
@keyup.enter.native="ys7DevicesList" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" class="colBlock">
|
||||||
|
<el-form-item label="设备类型" prop="deviceType">
|
||||||
|
<el-input v-model="tableData.param.deviceType" placeholder="请输入设备类型" clearable
|
||||||
|
@keyup.enter.native="ys7DevicesList" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" :class="!showAll ? 'colBlock' : 'colNone'">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="ys7DevicesList"><el-icon>
|
||||||
|
<Search />
|
||||||
|
</el-icon>搜索</el-button>
|
||||||
|
<el-button @click="resetQuery(queryRef)"><el-icon>
|
||||||
|
<Refresh />
|
||||||
|
</el-icon>重置</el-button>
|
||||||
|
<el-button type="primary" link @click="toggleSearch">
|
||||||
|
{{ word }}
|
||||||
|
<el-icon v-show="showAll">
|
||||||
|
<ArrowUp />
|
||||||
|
</el-icon>
|
||||||
|
<el-icon v-show="!showAll">
|
||||||
|
<ArrowDown />
|
||||||
|
</el-icon>
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||||
|
<el-form-item label="设备序列号" prop="deviceSerial">
|
||||||
|
<el-input v-model="tableData.param.deviceSerial" placeholder="请输入设备串号" clearable
|
||||||
|
@keyup.enter.native="ys7DevicesList" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="tableData.param.status" placeholder="请选择设备状态" clearable>
|
||||||
|
<el-option label="在线" :value="1" />
|
||||||
|
<el-option label="离线" :value="0" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||||
|
<el-form-item label="设备版本" prop="deviceVersion">
|
||||||
|
<el-input v-model="tableData.param.deviceVersion" placeholder="请输入设备版本" clearable
|
||||||
|
@keyup.enter.native="ys7DevicesList" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||||
|
<el-form-item label="所属项目" prop="projectId">
|
||||||
|
<el-select v-model="tableData.param.projectId" placeholder="请选择所属项目" clearable
|
||||||
|
filterable>
|
||||||
|
<el-option v-for="item in projectList" class="device_row" :key="item.id"
|
||||||
|
:label="item.name" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="ys7DevicesList"><el-icon>
|
||||||
|
<Search />
|
||||||
|
</el-icon>搜索</el-button>
|
||||||
|
<el-button @click="resetQuery(queryRef)"><el-icon>
|
||||||
|
<Refresh />
|
||||||
|
</el-icon>重置</el-button>
|
||||||
|
<el-button type="primary" link @click="toggleSearch">
|
||||||
|
{{ word }}
|
||||||
|
<el-icon v-show="showAll">
|
||||||
|
<ArrowUp />
|
||||||
|
</el-icon>
|
||||||
|
<el-icon v-show="!showAll">
|
||||||
|
<ArrowDown />
|
||||||
|
</el-icon>
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button type="primary" @click="handleAdd" v-auth="'api/v1/system/ys7Devices/add'"
|
||||||
|
><el-icon><Plus /></el-icon>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col> -->
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" :disabled="single" @click="handleUpdate(null)"
|
||||||
|
v-auth="'api/v1/system/ys7Devices/edit'"><el-icon>
|
||||||
|
<Edit />
|
||||||
|
</el-icon>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" :disabled="multiple" @click="handleDelete(null)"
|
||||||
|
v-auth="'api/v1/system/ys7Devices/delete'"><el-icon>
|
||||||
|
<Delete />
|
||||||
|
</el-icon>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" :disabled="multiple" @click="onLinkProject(null)"
|
||||||
|
v-auth="'api/v1/system/ys7Devices/add'"><el-icon>
|
||||||
|
<Link />
|
||||||
|
</el-icon>设备分配</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<el-table v-loading="loading" :data="tableData.data" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="设备序列号" align="center" prop="deviceSerial" min-width="100px" />
|
||||||
|
<el-table-column label="设备名称" align="center" prop="deviceName" min-width="100px" />
|
||||||
|
<el-table-column label="设备类型" align="center" prop="deviceType" min-width="100px" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" min-width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag type="success" v-if="scope.row.status === 1">在线</el-tag>
|
||||||
|
<el-tag type="danger" v-if="scope.row.status === 0">离线</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column label="视频加密" align="center" prop="videoEncrypted" min-width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch v-model="scope.row.videoEncrypted" class="ml-2" :active-value="1" :inactive-value="0"
|
||||||
|
:loading="scope.row.enctyptLoading" @change="encryptChange(scope.row)" inline-prompt
|
||||||
|
active-text="开启" inactive-text="关闭"
|
||||||
|
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" />
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<!-- <el-table-column label="" align="center" prop="defence" min-width="100px" /> -->
|
||||||
|
<el-table-column label="设备版本" align="center" prop="deviceVersion" min-width="100px" />
|
||||||
|
<!-- <el-table-column label="所属项目" align="center" prop="projectId" min-width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row.projectName ? scope.row.projectName : '未分配' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" min-width="100px" />
|
||||||
|
<!-- <el-table-column label="创建时间" align="center" prop="deviceCreateTime" min-width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ proxy.parseTime(scope.row.deviceCreateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding" min-width="160px" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="primary" link @click="handleUpdate(scope.row)"
|
||||||
|
v-auth="'api/v1/system/ys7Devices/edit'"><el-icon>
|
||||||
|
<EditPen />
|
||||||
|
</el-icon>修改</el-button>
|
||||||
|
<el-button type="primary" link @click="handleDelete(scope.row)"
|
||||||
|
v-auth="'api/v1/system/ys7Devices/delete'"><el-icon>
|
||||||
|
<DeleteFilled />
|
||||||
|
</el-icon>删除</el-button>
|
||||||
|
<el-button type="primary" link @click="onLinkProject(scope.row)"
|
||||||
|
v-auth="'api/v1/system/ys7Devices/delete'"><el-icon>
|
||||||
|
<Link />
|
||||||
|
</el-icon>设备分配</el-button>
|
||||||
|
<el-button type="primary" link @click="addPreset(scope.row)"><el-icon>
|
||||||
|
<Plus />
|
||||||
|
</el-icon>添加预置位</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination v-show="tableData.total > 0" :total="tableData.total" v-model:page="tableData.param.pageNum"
|
||||||
|
v-model:limit="tableData.param.pageSize" @pagination="ys7DevicesList" />
|
||||||
|
</el-card>
|
||||||
|
<presetAdd ref="presetAddRef"></presetAdd>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ElMessageBox, ElMessage, FormInstance } from 'element-plus';
|
||||||
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
|
import { getMonitoringList } from '@/api/securitySurveillance/index.js';
|
||||||
|
import presetAdd from './components/presetAdd.vue';
|
||||||
|
// proxy 获取
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
// ref 定义
|
||||||
|
const loading = ref(false);
|
||||||
|
const queryRef = ref<FormInstance>();
|
||||||
|
const addRef = ref();
|
||||||
|
const editRef = ref();
|
||||||
|
const detailRef = ref();
|
||||||
|
const bindProRef = ref();
|
||||||
|
const presetAddRef = ref();
|
||||||
|
|
||||||
|
// 展开/收起搜索项
|
||||||
|
const showAll = ref(false);
|
||||||
|
const word = computed(() => (showAll.value ? '收起搜索' : '展开搜索'));
|
||||||
|
|
||||||
|
// 多选控制
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
|
||||||
|
// 获取用户 store
|
||||||
|
const userStore = useUserStoreHook();
|
||||||
|
// 从 store 中获取项目列表和当前选中的项目
|
||||||
|
const currentProject = computed(() => userStore.selectedProject);
|
||||||
|
const projects = computed(() => userStore.projects);
|
||||||
|
|
||||||
|
// 状态管理
|
||||||
|
const state = reactive<any>({
|
||||||
|
ids: [],
|
||||||
|
serials: [],
|
||||||
|
tableData: {
|
||||||
|
data: [],
|
||||||
|
total: 0,
|
||||||
|
loading: false,
|
||||||
|
param: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
id: undefined,
|
||||||
|
createdAt: undefined,
|
||||||
|
deviceSerial: undefined,
|
||||||
|
deviceName: undefined,
|
||||||
|
deviceType: undefined,
|
||||||
|
status: undefined,
|
||||||
|
defence: undefined,
|
||||||
|
deviceVersion: undefined,
|
||||||
|
projectId: currentProject.value?.id,
|
||||||
|
dateRange: [],
|
||||||
|
isFront: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
projectList: projects.value
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
const initTableData = () => {
|
||||||
|
ys7DevicesList();
|
||||||
|
// sysProjectList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索重置
|
||||||
|
const resetQuery = (formEl: FormInstance | undefined) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
ys7DevicesList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取设备列表
|
||||||
|
const ys7DevicesList = () => {
|
||||||
|
loading.value = true;
|
||||||
|
getMonitoringList({
|
||||||
|
pageStart: 1,
|
||||||
|
pageSize: 10
|
||||||
|
}).then((res: any) => {
|
||||||
|
let list = res.data ?? [];
|
||||||
|
state.tableData.data = list.map((item) => {
|
||||||
|
item.enctyptLoading = false;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
state.tableData.total = res.total;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 展开/收起搜索项
|
||||||
|
const toggleSearch = () => {
|
||||||
|
showAll.value = !showAll.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 多选事件
|
||||||
|
const handleSelectionChange = (selection: any[]) => {
|
||||||
|
state.ids = selection.map((item) => item.id);
|
||||||
|
state.serials = selection.map((item) => item.deviceSerial);
|
||||||
|
single.value = selection.length !== 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const handleAdd = () => {
|
||||||
|
addRef.value.openDialog();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const handleUpdate = (row?: Ys7DeviceVO) => {
|
||||||
|
if (!row) {
|
||||||
|
row = state.tableData.data.find((item) => item.id === state.ids[0])!;
|
||||||
|
}
|
||||||
|
editRef.value.openDialog(toRaw(row));
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const handleDelete = (row?: Ys7DeviceVO) => {
|
||||||
|
let msg = row ? `此操作将永久删除数据,是否继续?` : '你确定要删除所选数据?';
|
||||||
|
let id = row ? [row.id] : state.ids;
|
||||||
|
|
||||||
|
if (id.length === 0) {
|
||||||
|
ElMessage.error('请选择要删除的数据。');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ElMessageBox.confirm(msg, '提示', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
delYs7Device(id).then(() => {
|
||||||
|
ElMessage.success('删除成功');
|
||||||
|
ys7DevicesList();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
};
|
||||||
|
|
||||||
|
// 绑定项目
|
||||||
|
const onLinkProject = (row?: Ys7DeviceVO) => {
|
||||||
|
let serials = row ? [row.deviceSerial] : state.ids;
|
||||||
|
|
||||||
|
if (serials.length === 0) {
|
||||||
|
ElMessage.error('请选择要绑定项目的设备');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let info = { serials, row };
|
||||||
|
bindProRef.value.openDialog(toRaw(info));
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加预置位
|
||||||
|
const addPreset = (row: any) => {
|
||||||
|
presetAddRef.value.openDialog(row);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 开关加密
|
||||||
|
const encryptChange = (row: Ys7DeviceVO | any) => {
|
||||||
|
row.enctyptLoading = true;
|
||||||
|
// const action = row.videoEncrypted === 0 ? 1 : 0;
|
||||||
|
console.log(row.videoEncrypted);
|
||||||
|
|
||||||
|
toggleEncrypt({ videoEncrypted: row.videoEncrypted, id: row.id })
|
||||||
|
.then(() => {
|
||||||
|
proxy?.$modal.msgSuccess(row.videoEncrypted === 0 ? '关闭成功' : '开启成功');
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
row.enctyptLoading = false;
|
||||||
|
ys7DevicesList();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
//监听项目id刷新数据
|
||||||
|
const listeningProject = watch(
|
||||||
|
() => currentProject.value?.id,
|
||||||
|
(nid, oid) => {
|
||||||
|
tableData.value.param.projectId = nid;
|
||||||
|
initTableData();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 页面加载
|
||||||
|
onMounted(() => {
|
||||||
|
initTableData();
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
listeningProject();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 暴露变量
|
||||||
|
const { tableData, projectList } = toRefs(state);
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.colBlock {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colNone {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<div style="padding: 20px;">
|
<div style="padding: 20px;">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="15">
|
<el-col :span="15">
|
||||||
<el-row>
|
<el-row style="margin: 20px 0;">
|
||||||
<TitleComponent title="设备情况" subtitle="电站一次监控数据" />
|
<TitleComponent title="设备情况" subtitle="电站一次监控数据" />
|
||||||
<sbqk />
|
<sbqk />
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|||||||
@ -0,0 +1,95 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :visible="dialogVisible" width="1200" id="custom-dialog" class="no-header-dialog normal">
|
||||||
|
<div class="back">
|
||||||
|
<div class="alarm-alert-content success">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="20">
|
||||||
|
<div class="top">
|
||||||
|
<div class="info">
|
||||||
|
<div class="title">通信中断</div>
|
||||||
|
<div class="alarm-id">告警ID:INV-2023-003</div>
|
||||||
|
<div class="status-box">
|
||||||
|
<div class="status red">状态:待处理</div>
|
||||||
|
<div class="last-update">最后更新:刚刚</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="info-box">
|
||||||
|
<div class="list">
|
||||||
|
<div class="item">
|
||||||
|
<div>
|
||||||
|
<div class="title">告警位置</div>
|
||||||
|
<div class="text">光伏区A区-3排-08号</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="title">告警级别</div>
|
||||||
|
<div class="text">二级告警(紧急)</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div>
|
||||||
|
<div class="title">预计解决时间</div>
|
||||||
|
<div class="text">2025-09-19 18:00</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="title">上报时间</div>
|
||||||
|
<div class="text">2025-09-18 18:00</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div>
|
||||||
|
<div class="title">设备负责人</div>
|
||||||
|
<div class="text">李华(现场运维组)</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="title">通知方式</div>
|
||||||
|
<div class="text">系统消息、短信、电话</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-divider vertical border-style="dashed"></el-divider>
|
||||||
|
<!-- 进度 -->
|
||||||
|
<div class="progress-box" style="margin-bottom: 24px;">
|
||||||
|
<div class="title">处理进度</div>
|
||||||
|
<el-progress :text-inside="true" color="#ABABAB" :stroke-width="10" :percentage="3"
|
||||||
|
:show-text="false" />
|
||||||
|
</div>
|
||||||
|
<div class="notice-box">
|
||||||
|
<div class="item">
|
||||||
|
<div class="title active">告警产生并通知</div>
|
||||||
|
<div class="time">2025-09-19 18:05</div>
|
||||||
|
<div class="content">系统检测到告警并通知负责人</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="title">任务指派</div>
|
||||||
|
<div class="time"></div>
|
||||||
|
<div class="content">指派任务给相关责任人</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="title">开始处理</div>
|
||||||
|
<div class="time"></div>
|
||||||
|
<div class="content">运维人员开始处理告警</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="title">告警产生</div>
|
||||||
|
<div class="time"></div>
|
||||||
|
<div class="content">告警已解决并记录结果</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
dialogVisible: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true, // 若外部必传,设为true;否则可加default: false
|
||||||
|
default: false // 可选:若外部可能不传,设置默认值
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
File diff suppressed because one or more lines are too long
@ -2,13 +2,16 @@
|
|||||||
<div class="cardItem">
|
<div class="cardItem">
|
||||||
<el-card>
|
<el-card>
|
||||||
<div class="tianqi"
|
<div class="tianqi"
|
||||||
style="display: flex; flex-direction: column; align-items: center; background-color: #fafafa; border-radius: 10px; padding-bottom: 40px">
|
style="display: flex; flex-direction: column; align-items: center; background-color: #fafafa; border-radius: 10px; padding-bottom: 40px;padding: 20px;">
|
||||||
<div>
|
<div
|
||||||
<img src="/assets/Sunny.png" style="display: block; width: 100px; height: 100px" alt="" />
|
style="width: 100%;display: flex;flex-direction: column;align-items: center;background-color: #FFFFFF;margin: 0 20px;border-radius: 15px;padding: 20px;">
|
||||||
|
<div>
|
||||||
|
<img src="/assets/Sunny.png" style="display: block; width: 100px; height: 100px" alt="" />
|
||||||
|
</div>
|
||||||
|
<div style="font-family: 'Alibaba-PuHuiTi-Bold'; font-size: 24px">31℃</div>
|
||||||
|
<div>晴朗</div>
|
||||||
|
<div style="color: rgba(154, 154, 154, 1); font-size: 14px">紫外线强度:<span>高</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-family: 'Alibaba-PuHuiTi-Bold'; font-size: 24px">31℃</div>
|
|
||||||
<div>晴朗</div>
|
|
||||||
<div style="color: rgba(154, 154, 154, 1); font-size: 14px">紫外线强度:<span>高</span></div>
|
|
||||||
<div class="tianqi2">
|
<div class="tianqi2">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<el-card shadow="never" style="border-radius: 10px;">
|
<el-card shadow="never" style="border-radius: 10px;">
|
||||||
<el-form :inline="true" :model="formInline" label-width="120" style="display: flex; justify-content: center;">
|
<el-form ref="formRef" :inline="true" :model="formInline" label-width="120"
|
||||||
|
style="display: flex; justify-content: center;">
|
||||||
<el-form-item label="规则编号">
|
<el-form-item label="规则编号">
|
||||||
<el-input v-model="formInline.user" placeholder="请输入规则编号" clearable />
|
<el-input v-model="formInline.user" placeholder="请输入规则编号" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -43,7 +44,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary">详情</el-button>
|
<el-button link type="primary" @click="handleDetail(scope.row)">详情</el-button>
|
||||||
<el-button link type="danger">处理</el-button>
|
<el-button link type="danger">处理</el-button>
|
||||||
<el-button link type="warning">维护记录</el-button>
|
<el-button link type="warning">维护记录</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -54,37 +55,24 @@
|
|||||||
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||||
@pagination="getList" />
|
@pagination="getList" />
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-dialog v-model="dialogVisible" width="1000" id="custom-dialog" class="no-header-dialog normal">
|
<CustomDialogStatus v-model="CustomDialogStatusVisible" v-model:dialogVisible="dialogVisible" :height="dialogHeight"
|
||||||
<div class="alert-content">
|
close-on-click-modal />
|
||||||
<div class="img">
|
<CustomDialogAlarm ref=" dialogAlarmRef" v-model="CustomDialogAlarmVisible" :height="dialogHeight"
|
||||||
<img src="/assets/dialog1.png" alt="">
|
@opened="adjustDialogHeight" close-on-click-modal />
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
<style lang="scss">
|
|
||||||
// #custom-dialog {
|
|
||||||
// padding: 0;
|
|
||||||
|
|
||||||
// .el-dialog__header {
|
|
||||||
// display: none;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .el-dialog__body {
|
|
||||||
// padding: 0 !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .alert-content {
|
|
||||||
// padding: 80px;
|
|
||||||
// background: linear-gradient(180deg, rgba(0, 119, 255, 0.23) 0%, rgba(255, 255, 255, 0) 100%);
|
|
||||||
// }
|
|
||||||
// }</style>
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import CustomDialogStatus from './CustomDialogStatus.vue'
|
||||||
|
import CustomDialogAlarm from './CustomDialogAlarm.vue'
|
||||||
|
|
||||||
const formInline = ref({})
|
const formInline = ref({})
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const dialogVisible = ref(true);
|
const CustomDialogStatusVisible = ref(false);
|
||||||
|
const CustomDialogAlarmVisible = ref(false);
|
||||||
|
|
||||||
|
|
||||||
const listData = [
|
const listData = [
|
||||||
{ id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 1 },
|
{ id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 1 },
|
||||||
{ id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 1 },
|
{ id: "INV-2023-001", shuchu: "12.8kw", xiaolv: "98.2%", wendu: "42℃", fadian: "158.5kWh", status: 1 },
|
||||||
@ -110,6 +98,13 @@ const statusMap = {
|
|||||||
const initFormData = {
|
const initFormData = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
const handleDetail = (row) => {
|
||||||
|
if (row.status === 1) {
|
||||||
|
CustomDialogStatusVisible.value = true;
|
||||||
|
} else {
|
||||||
|
CustomDialogAlarmVisible.value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: { ...initFormData },
|
form: { ...initFormData },
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
<TitleComponent title="XXX电站·逆变器综合监控" subtitle="实时监控X台逆变器运行状态、发电趋势及环境信息" />
|
<TitleComponent title="XXX电站·逆变器综合监控" subtitle="实时监控X台逆变器运行状态、发电趋势及环境信息" />
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- 外层col:控制整体宽度并右对齐,同时作为flex容器 -->
|
<!-- 外层col:控制整体宽度并右对齐,同时作为flex容器 -->
|
||||||
<el-col :span="12" style="display: flex; justify-content: flex-end; align-items: center;">
|
<el-col :span="12"
|
||||||
|
style="display: flex; justify-content: flex-end; align-items: center;margin-bottom: 20px;">
|
||||||
<!-- 子col1:输入框容器 -->
|
<!-- 子col1:输入框容器 -->
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-input placeholder="请输入逆变器...">
|
<el-input placeholder="请输入逆变器...">
|
||||||
@ -32,7 +33,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row style="display: flex; gap: 30px;" class="card">
|
<el-row style="display: flex; gap: 30px;margin: 20px 0;" class="card">
|
||||||
<el-col style="flex: 1;" class="item">
|
<el-col style="flex: 1;" class="item">
|
||||||
<div class="box" style="height: 100%;display: flex;">
|
<div class="box" style="height: 100%;display: flex;">
|
||||||
<div class="left"
|
<div class="left"
|
||||||
@ -161,7 +162,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row style="margin: 20px 0;">
|
||||||
<el-col :span="15">
|
<el-col :span="15">
|
||||||
<el-row style="display: flex;flex-direction: column;height: 100%;">
|
<el-row style="display: flex;flex-direction: column;height: 100%;">
|
||||||
<div>
|
<div>
|
||||||
@ -177,7 +178,7 @@
|
|||||||
<QiXiang />
|
<QiXiang />
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20"> <!-- gutter:列之间的间距(单位px),控制垂直/水平间距 -->
|
<el-row style="margin: 20px 0;"> <!-- gutter:列之间的间距(单位px),控制垂直/水平间距 -->
|
||||||
<!-- 标题列:占满12列(栅格系统默认12列) -->
|
<!-- 标题列:占满12列(栅格系统默认12列) -->
|
||||||
<el-col> <!-- span=12 表示占满一行宽度 -->
|
<el-col> <!-- span=12 表示占满一行宽度 -->
|
||||||
<TitleComponent title="逆变器运行状态" :fontLevel="2" />
|
<TitleComponent title="逆变器运行状态" :fontLevel="2" />
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row style="height: 100%;">
|
<el-row style="height: 100%;">
|
||||||
<el-card style="width: 100%;border-radius: 12px;height: 100%;">
|
<el-card style="width: 100%;border-radius: 12px;height: 100%;">
|
||||||
<div style="display: flex;width: 100%;justify-content: space-between;align-items: center;">
|
<div style="display: flex;width: 100%;justify-content: flex-end;align-items: center;padding-bottom: 15px;">
|
||||||
<TitleComponent title="实时视频监控" subtitle="查看所有已完成的巡检记录,跟进巡检报告" />
|
<TitleComponent title="实时视频监控" subtitle="查看所有已完成的巡检记录,跟进巡检报告" />
|
||||||
<span style="color: rgba(24, 109, 245, 1);display: flex;align-items: center; cursor: pointer;">
|
<span style="color: rgba(24, 109, 245, 1);display: flex;align-items: center; cursor: pointer;">
|
||||||
<span>
|
<span>
|
||||||
@ -14,36 +14,52 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="video-container">
|
<div class="video-container">
|
||||||
<el-row gutter="20">
|
<el-row :gutter="20">
|
||||||
<!-- 扩展布局:左侧大视频 + 右侧小视频列 -->
|
<!-- 扩展布局:左侧大视频 + 右侧小视频列 -->
|
||||||
<template v-if="isExpanded">
|
<template v-if="isExpanded">
|
||||||
<!-- 左侧大视频(占 16 列) -->
|
<!-- 左侧大视频(占 16 列) -->
|
||||||
<el-col :span="16">
|
<el-col :span="16" class="video-wrapper">
|
||||||
<div class="item large" @click="() => { isExpanded = false; }">
|
<div class="item large" @click="() => { isExpanded = false; }" ref="bigVideoRef"
|
||||||
<img :src="videoList[activeIndex].url" alt="">
|
:id="`bigVideo`">
|
||||||
<div class="title" v-if="isExpanded"
|
<div class="title" v-if="isExpanded"
|
||||||
style="display: flex;justify-content: space-between;">
|
style="display: flex;justify-content: space-between;">
|
||||||
<div class="text">
|
<!-- <div class="text">
|
||||||
{{ videoList[activeIndex].name }}
|
{{ videoList[activeIndex].name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="tools">
|
<div class="tools">
|
||||||
<img src="/assets/svg/huanyuan.svg" alt=""></img>
|
<img src="/assets/svg/huanyuan.svg" alt=""></img>
|
||||||
<img src="/assets/svg/quanpin.svg" alt=""></img>
|
<img src="/assets/svg/quanpin.svg" alt=""></img>
|
||||||
<img src="/assets/svg/jietu.svg" alt="">
|
<img src="/assets/svg/jietu.svg" alt="">
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="title" v-else>{{ videoList[activeIndex].name }}</div>
|
</div>
|
||||||
|
<!-- 大视频的切换视图按钮 -->
|
||||||
|
<div class="video-action-btn">
|
||||||
|
<el-button type="primary" @click.stop="() => {
|
||||||
|
isExpanded = false;
|
||||||
|
}">切换视图</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- 右侧小视频列(占 8 列) -->
|
<!-- 右侧小视频列(占 8 列) -->
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-row gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="24" v-for="i in 3" :key="i">
|
<el-col :span="24" v-for="i in 3" :key="i" class="video-wrapper">
|
||||||
<div class="item small" @click="() => {
|
<div class="item small" @click="() => {
|
||||||
activeIndex = videoList.length - 3 + i - 1;
|
// 计算要显示的视频索引 - 按照当前视频后面三个排序
|
||||||
}">
|
const displayIndex = (activeIndex + i) % videoList.length;
|
||||||
<img :src="videoList[videoList.length - 3 + i - 1].url" alt="">
|
activeIndex = displayIndex;
|
||||||
<div class="title">{{ videoList[videoList.length - 3 + i - 1].name }}</div>
|
}" :id="`smallVideo-expanded-${i}`">
|
||||||
|
<!-- <div class="title">{{ videoList[(activeIndex + i) % videoList.length].name }}
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<!-- 小视频的两个按钮:切换视图和查看视频 -->
|
||||||
|
<div class="video-action-btn expanded">
|
||||||
|
|
||||||
|
<el-button type="success" size="small" @click.stop="() => {
|
||||||
|
const displayIndex = (activeIndex + i) % videoList.length;
|
||||||
|
activeIndex = displayIndex;
|
||||||
|
// 不需要改变isExpanded,因为已经在扩展布局
|
||||||
|
}">查看视频</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -52,22 +68,25 @@
|
|||||||
|
|
||||||
<!-- 普通布局:所有视频均匀排列 -->
|
<!-- 普通布局:所有视频均匀排列 -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<el-col :span="8" v-for="(item, index) in videoList" :key="index">
|
<el-col :span="8" v-for="(item, index) in videoList" :key="index" class="video-wrapper">
|
||||||
<div class="item" @click="() => {
|
<!-- 视频容器 -->
|
||||||
activeIndex = index;
|
<div class="item" :id="`smallVideo-${index + 1}`" ref="smallVideoRef">
|
||||||
isExpanded = true;
|
<!-- <div class="title">{{ item.name }}</div> -->
|
||||||
}">
|
</div>
|
||||||
<img :src="item.url" alt="">
|
<!-- 按钮放在最外层,与视频容器同级 -->
|
||||||
<div class="title">{{ item.name }}</div>
|
<div class="video-action-btn">
|
||||||
|
<el-button type="primary" @click.stop="() => {
|
||||||
|
activeIndex = index;
|
||||||
|
isExpanded = true;
|
||||||
|
}">切换视图</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row v-if="isExpanded">
|
<el-row v-if="!isExpanded">
|
||||||
<div class="pagination" v-if="activeTab !== 'record'">
|
<div class="pagination" v-if="activeTab !== 'record'">
|
||||||
<el-pagination layout="prev, pager, next, jumper, sizes" :total="totalRecords"
|
<el-pagination layout="prev, pager, next, jumper, sizes" :total="totalRecords"
|
||||||
v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[20, 50, 100]"
|
v-model:current-page="pageStart" v-model:page-size="pageSize" :page-sizes="[20, 50, 100]"
|
||||||
@current-change="handlePageChange" @size-change="handleSizeChange"></el-pagination>
|
@current-change="handlePageChange" @size-change="handleSizeChange"></el-pagination>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -76,63 +95,254 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
|
||||||
import { Refresh } from '@element-plus/icons-vue';
|
import { Refresh } from '@element-plus/icons-vue';
|
||||||
import TitleComponent from '@/components/TitleComponent';
|
import EZUIKit from 'ezuikit-js';
|
||||||
const activeIndex = ref(-1); // 初始无选中,选中后为对应索引
|
// import TitleComponent from '@/components/TitleComponent';
|
||||||
const isExpanded = ref(false); // 初始为普通布局
|
import { getToken, getMonitoringList } from '@/api/securitySurveillance/index.js';
|
||||||
const pageSize = ref(20);
|
import { ref, onMounted, watch, nextTick, onUnmounted } from 'vue';
|
||||||
const totalRecords = ref(100);
|
|
||||||
const videoList = ref([
|
const activeIndex = ref(0); // 初始选中第一个视频
|
||||||
{
|
const isExpanded = ref(true); // 初始为扩展
|
||||||
name: 'A区d厂',
|
const accessToken = ref('')
|
||||||
url: 'https://img.js.design/assets/img/68c144e8ba276a0e8a4a55c2.jpeg#bab7e2e06aae943525cacb13bd63e30d'
|
const pageStart = ref(1);
|
||||||
},
|
const pageSize = ref(4); // 默认请求4个视频(扩展布局)
|
||||||
{
|
const totalRecords = ref(0);
|
||||||
name: 'A区d厂',
|
const activeTab = ref('live');
|
||||||
url: 'https://img.js.design/assets/img/68c144efb5e8b987e5ca6462.jpeg#5523cf094b2f8c3a79ea4eb330c99a30'
|
const bigVideoRef = ref<HTMLDivElement>(null);
|
||||||
},
|
const smallVideoRef = ref<HTMLDivElement>(null);
|
||||||
{
|
|
||||||
name: 'A区d厂',
|
const videoList = ref([]);
|
||||||
url: 'https://img.js.design/assets/img/68c144fbbad414f81995e90c.webp#230d8ca5ca39982518439db26e0ea899'
|
// 存储第二页的数据,用于处理扩展视图右边视频不足的情况
|
||||||
},
|
const nextPageVideoList = ref([]);
|
||||||
{
|
// 标记是否已经使用了下一页的数据
|
||||||
name: 'A区d厂',
|
const hasUsedNextPageData = ref(false);
|
||||||
url: 'https://img.js.design/assets/img/68c1450640d5d2a02e2540b2.webp#adad2379a0b04d6968364e4fb1133f77'
|
|
||||||
},
|
const StructureEZUIKitPlayer = (item: any, index: number, isBig = false) => {
|
||||||
{
|
const containerId = isBig ? 'bigVideo' : isExpanded.value ? `smallVideo-expanded-${index + 1}` : `smallVideo-${index + 1}`;
|
||||||
name: 'A区d厂',
|
const container = document.getElementById(containerId);
|
||||||
url: 'https://img.js.design/assets/img/68c14543d56431f9d6f6808e.webp#16f0a0d8fab4f8ff3b39b04bfabac054'
|
|
||||||
},
|
// 先销毁旧的播放器实例(如果存在)
|
||||||
{
|
if (item.player) {
|
||||||
name: 'A区d厂',
|
try {
|
||||||
url: 'https://img.js.design/assets/img/68c14578d56431f9d6f68981.jpg#e77150417f28a971be4846eb0be90373'
|
item.player.destroy();
|
||||||
},
|
}
|
||||||
{
|
catch (error) {
|
||||||
name: 'A区d厂',
|
console.error('销毁播放器失败:', error);
|
||||||
url: 'https://img.js.design/assets/img/68c145e03f22157da619a7ce.png#546ff44289a22bf175e1eca1f69cd8f9'
|
}
|
||||||
},
|
item.player = null;
|
||||||
{
|
|
||||||
name: 'A区d厂',
|
|
||||||
url: 'https://img.js.design/assets/img/68c1461fb5e8b987e5caa293.jpeg#870e4d2b88b487ecb8f2f0b956c45c08'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'A区d厂',
|
|
||||||
url: 'https://img.js.design/assets/img/68c1462dcbf9ed2271880b95.webp#ae7ae94ca84ce980e2d2281869335f06'
|
|
||||||
}
|
}
|
||||||
]);
|
|
||||||
|
if (container) {
|
||||||
|
item.player = new EZUIKit.EZUIKitPlayer({
|
||||||
|
audio: '0',
|
||||||
|
id: containerId,
|
||||||
|
accessToken: accessToken.value,
|
||||||
|
url: `ezopen://open.ys7.com/${item.deviceSerial}/1.hd.live`,
|
||||||
|
template: "pcLive",
|
||||||
|
width: container.clientWidth,
|
||||||
|
height: container.clientHeight,
|
||||||
|
plugin: ['talk']
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取萤石云Token
|
||||||
|
const getTokenData = async () => {
|
||||||
|
const { data } = await getToken()
|
||||||
|
accessToken.value = data
|
||||||
|
}
|
||||||
|
// 获取摄像头列表
|
||||||
|
const getMonitoringListData = async () => {
|
||||||
|
// 根据当前视图类型设置请求数量
|
||||||
|
const currentPageSize = isExpanded.value ? 4 : 9;
|
||||||
|
const { data } = await getMonitoringList({
|
||||||
|
pageStart: pageStart.value,
|
||||||
|
pageSize: currentPageSize
|
||||||
|
})
|
||||||
|
// totalRecords.value = data.total
|
||||||
|
videoList.value = data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取下一页视频数据
|
||||||
|
const getNextPageData = async () => {
|
||||||
|
const { data } = await getMonitoringList({
|
||||||
|
pageStart: pageStart.value + 1,
|
||||||
|
pageSize: 3 // 只需要3个视频
|
||||||
|
})
|
||||||
|
nextPageVideoList.value = data;
|
||||||
|
// 标记已经使用了下一页的数据
|
||||||
|
hasUsedNextPageData.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
// 先清理所有播放器
|
||||||
|
cleanupPlayers();
|
||||||
|
// 不再每次都获取token,token只在组件挂载时获取一次
|
||||||
|
await getMonitoringListData()
|
||||||
|
// 不再重置activeIndex,保留用户之前选择的视频索引
|
||||||
|
// 等待DOM更新后初始化视频
|
||||||
|
await nextTick();
|
||||||
|
initVideo()
|
||||||
|
}
|
||||||
|
|
||||||
|
const initVideo = async () => {
|
||||||
|
// 先清理所有视频容器的内容,避免残留
|
||||||
|
if (bigVideoRef.value) {
|
||||||
|
bigVideoRef.value.innerHTML = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isExpanded.value) {
|
||||||
|
// 扩展布局:初始化大视频和右侧3个小视频
|
||||||
|
StructureEZUIKitPlayer(videoList.value[activeIndex.value], 0, true);
|
||||||
|
|
||||||
|
// 检查当前视频后面是否有足够的视频
|
||||||
|
const remainingVideos = videoList.value.length - activeIndex.value - 1;
|
||||||
|
|
||||||
|
if (remainingVideos >= 3) {
|
||||||
|
// 当前页后面有足够的视频,直接使用当前页的数据
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
const displayIndex = activeIndex.value + i + 1;
|
||||||
|
StructureEZUIKitPlayer(videoList.value[displayIndex], i);
|
||||||
|
}
|
||||||
|
// 重置已使用下一页数据的标记
|
||||||
|
hasUsedNextPageData.value = false;
|
||||||
|
} else {
|
||||||
|
// 当前页后面视频不足3个,需要获取下一页的数据
|
||||||
|
await getNextPageData();
|
||||||
|
// 使用当前页后面的视频和下一页的前几个视频
|
||||||
|
let displayCount = 0;
|
||||||
|
|
||||||
|
// 先显示当前页后面的视频
|
||||||
|
for (let i = activeIndex.value + 1; i < videoList.value.length && displayCount < 3; i++) {
|
||||||
|
StructureEZUIKitPlayer(videoList.value[i], displayCount);
|
||||||
|
displayCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 再显示下一页的视频补充到3个
|
||||||
|
for (let i = 0; i < nextPageVideoList.value.length && displayCount < 3; i++) {
|
||||||
|
StructureEZUIKitPlayer(nextPageVideoList.value[i], displayCount);
|
||||||
|
displayCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 普通布局:如果之前在扩展视图中使用了下一页数据,现在需要更新页码
|
||||||
|
if (hasUsedNextPageData.value) {
|
||||||
|
pageStart.value += 1;
|
||||||
|
// 重新获取第二页的9个视频数据
|
||||||
|
await getMonitoringListData();
|
||||||
|
hasUsedNextPageData.value = false;
|
||||||
|
}
|
||||||
|
// 初始化所有视频
|
||||||
|
videoList.value.forEach((item, index) => {
|
||||||
|
StructureEZUIKitPlayer(item, index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageChange = (page: number) => {
|
||||||
|
pageStart.value = page;
|
||||||
|
// 这里可以添加分页逻辑
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSizeChange = (size: number) => {
|
||||||
|
pageSize.value = size;
|
||||||
|
pageStart.value = 1;
|
||||||
|
// 这里可以添加分页逻辑
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理所有播放器实例
|
||||||
|
const cleanupPlayers = () => {
|
||||||
|
videoList.value.forEach(item => {
|
||||||
|
if (item.player) {
|
||||||
|
try {
|
||||||
|
item.player.destroy();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error('销毁播放器失败:', error);
|
||||||
|
}
|
||||||
|
item.player = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 清理下一页视频的播放器
|
||||||
|
nextPageVideoList.value.forEach(item => {
|
||||||
|
if (item.player) {
|
||||||
|
try {
|
||||||
|
item.player.destroy();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error('销毁下一页视频播放器失败:', error);
|
||||||
|
}
|
||||||
|
item.player = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听isExpanded变化,根据不同情况处理数据请求
|
||||||
|
watch(isExpanded, async (newValue, oldValue) => {
|
||||||
|
// 保存当前activeIndex的值
|
||||||
|
const currentActiveIndex = activeIndex.value;
|
||||||
|
|
||||||
|
// 从扩展视图切换到普通视图,需要重新请求9个视频
|
||||||
|
if (newValue === false && oldValue === true) {
|
||||||
|
// 重新请求9个视频数据
|
||||||
|
await getData();
|
||||||
|
// 恢复保存的activeIndex值
|
||||||
|
activeIndex.value = currentActiveIndex;
|
||||||
|
}
|
||||||
|
// 从普通视图切换到扩展视图,不需要重新请求数据
|
||||||
|
else if (newValue === true && oldValue === false) {
|
||||||
|
// 但是需要重新初始化视频布局
|
||||||
|
await nextTick();
|
||||||
|
initVideo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(activeIndex, (newIndex) => {
|
||||||
|
if (isExpanded.value) {
|
||||||
|
// 当activeIndex变化时,重新初始化扩展布局中的视频
|
||||||
|
initVideo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 组件挂载时获取一次token
|
||||||
|
getTokenData().then(() => {
|
||||||
|
// token获取成功后,获取视频数据
|
||||||
|
getData();
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('获取token失败:', error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 组件卸载时销毁所有播放器
|
||||||
|
onUnmounted(() => {
|
||||||
|
cleanupPlayers();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.video-container {
|
.el-col {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 视频包装器样式
|
||||||
|
.video-wrapper {
|
||||||
|
position: relative;
|
||||||
|
// 确保按钮在视频容器上方
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-container {
|
||||||
.item {
|
.item {
|
||||||
height: 220px;
|
height: 220px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
position: relative;
|
position: relative;
|
||||||
border: 2px solid rgba(45, 119, 249, 1);
|
border: 2px solid rgba(45, 119, 249, 1);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
// 确保子元素正确定位
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -150,12 +360,53 @@ const videoList = ref([
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
z-index: 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 视频动作按钮样式(放在最外层)
|
||||||
|
.video-action-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
z-index: 20;
|
||||||
|
pointer-events: none; // 防止按钮阻止鼠标悬停事件
|
||||||
|
}
|
||||||
|
|
||||||
|
// 右侧小视频的按钮容器样式
|
||||||
|
.video-action-btn.expanded {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 鼠标悬停在视频包装器上时显示按钮
|
||||||
|
.video-wrapper:hover .video-action-btn {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 鼠标悬停在视频上时添加半透明背景效果
|
||||||
|
.video-wrapper:hover .item::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按钮本身需要有点击事件
|
||||||
|
.video-action-btn button {
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
// 大视频样式(高度与右侧三个小视频总高度对齐,考虑间距)
|
// 大视频样式(高度与右侧三个小视频总高度对齐,考虑间距)
|
||||||
.large {
|
.large {
|
||||||
height: calc(220px * 3 + 20px * 2); // 高度为3个小视频高度加上2个间距
|
height: calc(220px * 3 + 20px * 2 + 40px); // 高度为3个小视频高度加上2个间距
|
||||||
|
|
||||||
.tools {
|
.tools {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -171,7 +422,7 @@ const videoList = ref([
|
|||||||
|
|
||||||
// 小视频样式(保持原高度,适配右侧单列)
|
// 小视频样式(保持原高度,适配右侧单列)
|
||||||
.small {
|
.small {
|
||||||
height: 220px;
|
height: 235px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
</el-row> <!-- 闭合内层 el-row -->
|
</el-row> <!-- 闭合内层 el-row -->
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row style="margin-top: 20px;">
|
||||||
<Top />
|
<Top />
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row style="margin-top: 20px;" :gutter="25">
|
<el-row style="margin-top: 20px;" :gutter="25">
|
||||||
|
|||||||
Reference in New Issue
Block a user