|
@@ -6,7 +6,6 @@
|
|
|
flex: 'none',
|
|
flex: 'none',
|
|
|
width: isFullScreen ? '100%' : '75%',
|
|
width: isFullScreen ? '100%' : '75%',
|
|
|
height: '100%',
|
|
height: '100%',
|
|
|
- backgroundColor: '#0c5cab',
|
|
|
|
|
padding: '10px 0 10px 10px', // 上10px 右0 下10px 左10px
|
|
padding: '10px 0 10px 10px', // 上10px 右0 下10px 左10px
|
|
|
}"
|
|
}"
|
|
|
>
|
|
>
|
|
@@ -14,9 +13,29 @@
|
|
|
<el-image
|
|
<el-image
|
|
|
style="width: 20px; height: 20px; cursor: pointer; flex-shrink: 0"
|
|
style="width: 20px; height: 20px; cursor: pointer; flex-shrink: 0"
|
|
|
@click="showFull"
|
|
@click="showFull"
|
|
|
- :src="require('@/assets/img/small.svg')"
|
|
|
|
|
|
|
+ :src="
|
|
|
|
|
+ isFullScreen
|
|
|
|
|
+ ? require('@/assets/img/small.svg')
|
|
|
|
|
+ : require('@/assets/img/iconMore.svg')
|
|
|
|
|
+ "
|
|
|
fit="contain"
|
|
fit="contain"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="selectedScreen"
|
|
|
|
|
+ placeholder="选择分屏"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ @change="changeWndNum"
|
|
|
|
|
+ style="margin-left: 10px; flex-shrink: 0; width: 120px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option label="1x1" :value="1" style="color: black" />
|
|
|
|
|
+ <el-option label="1x2" :value="12" style="color: black" />
|
|
|
|
|
+ <el-option label="2x1" :value="21" style="color: black" />
|
|
|
|
|
+ <el-option label="2x2" :value="2" style="color: black" />
|
|
|
|
|
+ <el-option label="3x3" :value="3" style="color: black" />
|
|
|
|
|
+ <el-option label="4x4" :value="4" style="color: black" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </div>
|
|
|
<div
|
|
<div
|
|
|
style="
|
|
style="
|
|
|
margin-left: 8px;
|
|
margin-left: 8px;
|
|
@@ -39,9 +58,8 @@
|
|
|
@handleVideoPlay="handleVideoPlay"
|
|
@handleVideoPlay="handleVideoPlay"
|
|
|
@changeWindow="handleChangeWindow"
|
|
@changeWindow="handleChangeWindow"
|
|
|
:num="selectedScreen"
|
|
:num="selectedScreen"
|
|
|
- :bofang="issbofang"
|
|
|
|
|
|
|
+ :bofang="isBofang"
|
|
|
:chooseWindow="selectWindow"
|
|
:chooseWindow="selectWindow"
|
|
|
- :chooseData="bofangyuan"
|
|
|
|
|
:companyVideoData="bigcamaraData.data"
|
|
:companyVideoData="bigcamaraData.data"
|
|
|
:isFullScreen="isFullScreen"
|
|
:isFullScreen="isFullScreen"
|
|
|
@init="HKbigCamaraInit"
|
|
@init="HKbigCamaraInit"
|
|
@@ -54,42 +72,66 @@
|
|
|
flex: 'none',
|
|
flex: 'none',
|
|
|
width: isFullScreen ? '0%' : '25%',
|
|
width: isFullScreen ? '0%' : '25%',
|
|
|
height: '100%',
|
|
height: '100%',
|
|
|
- backgroundColor: '#0c5cab',
|
|
|
|
|
padding: '10px 10px 10px 0px', // 上10px 右10px 下10px 左0px
|
|
padding: '10px 10px 10px 0px', // 上10px 右10px 下10px 左0px
|
|
|
boxSizing: 'border-box', // 让padding参与宽度计算
|
|
boxSizing: 'border-box', // 让padding参与宽度计算
|
|
|
display: 'flex', // 新增
|
|
display: 'flex', // 新增
|
|
|
flexDirection: 'column', // 新增
|
|
flexDirection: 'column', // 新增
|
|
|
}"
|
|
}"
|
|
|
>
|
|
>
|
|
|
- <div style="height: 30px; display: flex; align-items: center">
|
|
|
|
|
- <span style="font-size: 18px">窗口分割数</span>
|
|
|
|
|
|
|
+ <!-- 搜索栏 -->
|
|
|
|
|
+ <div
|
|
|
|
|
+ style="
|
|
|
|
|
+ height: 36px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 8px;
|
|
|
|
|
+ padding: 0 4px;
|
|
|
|
|
+ "
|
|
|
|
|
+ >
|
|
|
|
|
+ <!-- 输入框:回车自动查询 -->
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="searchName"
|
|
|
|
|
+ placeholder="视频名称"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ @keyup.enter.native="handleSearch"
|
|
|
|
|
+ style="width: 120px"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 选择框:改变后自动查询 -->
|
|
|
<el-select
|
|
<el-select
|
|
|
- v-model="selectedScreen"
|
|
|
|
|
- placeholder="选择分屏"
|
|
|
|
|
|
|
+ v-model="searchDeviceType"
|
|
|
|
|
+ placeholder="设备类型"
|
|
|
|
|
+ size="small"
|
|
|
clearable
|
|
clearable
|
|
|
- @change="changeWndNum"
|
|
|
|
|
- style="color: black; width: 150px; margin-left: 10px"
|
|
|
|
|
|
|
+ @change="handleSearch"
|
|
|
|
|
+ style="width: 120px"
|
|
|
>
|
|
>
|
|
|
- <el-option label="1x1" :value="1" style="color: black" />
|
|
|
|
|
- <el-option label="1x2" :value="12" style="color: black" />
|
|
|
|
|
- <el-option label="2x1" :value="21" style="color: black" />
|
|
|
|
|
- <el-option label="2x2" :value="2" style="color: black" />
|
|
|
|
|
- <el-option label="3x3" :value="3" style="color: black" />
|
|
|
|
|
- <el-option label="4x4" :value="4" style="color: black" />
|
|
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ style="color: black"
|
|
|
|
|
+ v-for="item in deviceTypeOptions"
|
|
|
|
|
+ :key="item.value"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.value"
|
|
|
|
|
+ />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
- <el-button
|
|
|
|
|
- size="mini"
|
|
|
|
|
- icon="el-icon-circle-close"
|
|
|
|
|
- @click="stopAllVideo"
|
|
|
|
|
- class="close-btn"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <!-- 查询按钮 -->
|
|
|
|
|
+ <el-button type="primary" size="small" @click="handleSearch"
|
|
|
|
|
+ >查询</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button type="primary" size="small" @click="batchPlayVideos"
|
|
|
|
|
+ >批量播放</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button type="primary" size="small" @click="stopAllVideo"
|
|
|
|
|
+ >关闭</el-button
|
|
|
|
|
+ >
|
|
|
</div>
|
|
</div>
|
|
|
- <div style="height: calc(100% - 30px); width: 100%; flex: 1">
|
|
|
|
|
|
|
+ <div style="display: flex; flex-direction: column; overflow: hidden">
|
|
|
<el-table
|
|
<el-table
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
:data="bigcamaraData.data"
|
|
:data="bigcamaraData.data"
|
|
|
- :header-cell-style="changeHeaderCellStyle"
|
|
|
|
|
border
|
|
border
|
|
|
|
|
+ :header-cell-style="changeHeaderCellStyle"
|
|
|
>
|
|
>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
type="index"
|
|
type="index"
|
|
@@ -105,7 +147,7 @@
|
|
|
/>
|
|
/>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
label="播放窗口"
|
|
label="播放窗口"
|
|
|
- prop="windowList"
|
|
|
|
|
|
|
+ :formatter="(row) => row.windowList.join(',')"
|
|
|
align="center"
|
|
align="center"
|
|
|
min-width="50"
|
|
min-width="50"
|
|
|
/>
|
|
/>
|
|
@@ -128,15 +170,17 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
+ <!-- 分页 -->
|
|
|
<el-pagination
|
|
<el-pagination
|
|
|
- style="margin-top: 0px; float: right"
|
|
|
|
|
- :total="bigcamaraData.total"
|
|
|
|
|
|
|
+ class="custom-pagination"
|
|
|
|
|
+ style="margin-top: 20px; text-align: right;"
|
|
|
:current-page="bigcamaraData.currentPage"
|
|
:current-page="bigcamaraData.currentPage"
|
|
|
:page-size="bigcamaraData.pageSize"
|
|
:page-size="bigcamaraData.pageSize"
|
|
|
- :page-sizes="[10, 15, 20]"
|
|
|
|
|
- layout="total, prev, pager, next, sizes"
|
|
|
|
|
- @current-change="onCurrentPageChange_bigcamaraData"
|
|
|
|
|
- @size-change="onPageSizeChange_bigcamaraData"
|
|
|
|
|
|
|
+ :total="bigcamaraData.total"
|
|
|
|
|
+ :page-sizes="[10, 15, 20, 25, 30]"
|
|
|
|
|
+ layout="total, prev, pager, next, jumper, sizes"
|
|
|
|
|
+ @current-change="handlePageChange"
|
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -198,7 +242,7 @@ export default {
|
|
|
left: "0px",
|
|
left: "0px",
|
|
|
width: "100%",
|
|
width: "100%",
|
|
|
height: "100%",
|
|
height: "100%",
|
|
|
- backgroundColor: "#10d519",
|
|
|
|
|
|
|
+ backgroundColor: '#0c5cab',
|
|
|
},
|
|
},
|
|
|
isFullScreen: false,
|
|
isFullScreen: false,
|
|
|
selectedScreen: 1, // 分屏数
|
|
selectedScreen: 1, // 分屏数
|
|
@@ -206,20 +250,7 @@ export default {
|
|
|
selectCamaraRow: 0,
|
|
selectCamaraRow: 0,
|
|
|
stopCamara: false,
|
|
stopCamara: false,
|
|
|
stopCamaraRow: 0,
|
|
stopCamaraRow: 0,
|
|
|
- bofangyuan: {
|
|
|
|
|
- // 当前选择视频源
|
|
|
|
|
- window: 0,
|
|
|
|
|
- data: [],
|
|
|
|
|
- Password: "sgw123456",
|
|
|
|
|
- Port: "80",
|
|
|
|
|
- Username: "admin",
|
|
|
|
|
- channelName: "test1",
|
|
|
|
|
- ip: "172.3.11.115",
|
|
|
|
|
- name: "11",
|
|
|
|
|
- isbofang: 0,
|
|
|
|
|
- windowList: [],
|
|
|
|
|
- },
|
|
|
|
|
- issbofang: false, // 播放状态
|
|
|
|
|
|
|
+ isBofang: false, // 播放状态
|
|
|
dataSrc:
|
|
dataSrc:
|
|
|
"https://cctvwbndbd.a.bdydns.com/cctvwbnd/cctv1_2/index.m3u8?BR=single",
|
|
"https://cctvwbndbd.a.bdydns.com/cctvwbnd/cctv1_2/index.m3u8?BR=single",
|
|
|
isShow: false,
|
|
isShow: false,
|
|
@@ -236,6 +267,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
bigcamaraSrc: [],
|
|
bigcamaraSrc: [],
|
|
|
bigcamaraName: [],
|
|
bigcamaraName: [],
|
|
|
|
|
+ searchName: "",
|
|
|
|
|
+ searchDeviceType: "",
|
|
|
|
|
+ deviceTypeOptions: [
|
|
|
|
|
+ { label: "网络摄像机 (IPC)", value: "IPC" },
|
|
|
|
|
+ { label: "人脸门禁终端 (MINMOE)", value: "MINMOE" },
|
|
|
|
|
+ { label: "车牌识别一体机 (LPR_GATE)", value: "LPR_GATE" },
|
|
|
|
|
+ { label: "通道控制设备 / 摆闸 (TURNSTILE)", value: "TURNSTILE" }
|
|
|
|
|
+ ],
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -272,112 +311,211 @@ export default {
|
|
|
},
|
|
},
|
|
|
activated() {
|
|
activated() {
|
|
|
if (!this.bigcamaraData.data.length) {
|
|
if (!this.bigcamaraData.data.length) {
|
|
|
- this.loadBigCamaraList();
|
|
|
|
|
|
|
+ this.getVideoInfo();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // 初始化
|
|
|
init() {
|
|
init() {
|
|
|
- console.log("传递的参数", this.$route.query);
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
this.HKbigCamaraShow = true;
|
|
this.HKbigCamaraShow = true;
|
|
|
}, 500);
|
|
}, 500);
|
|
|
// 只在第一次加载时初始化
|
|
// 只在第一次加载时初始化
|
|
|
if (!this.bigcamaraData.data.length) {
|
|
if (!this.bigcamaraData.data.length) {
|
|
|
- this.loadBigCamaraList();
|
|
|
|
|
|
|
+ this.getVideoInfo();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 查询视频流信息
|
|
|
|
|
+ handleSearch() {
|
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
|
+ this.getVideoInfo();
|
|
|
|
|
+ },
|
|
|
|
|
+ // 分页切换
|
|
|
|
|
+ async getVideoInfo() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 发起分页+查询请求
|
|
|
|
|
+ const res = await request({
|
|
|
|
|
+ url: "/video/list",
|
|
|
|
|
+ method: "POST",
|
|
|
|
|
+ data: {
|
|
|
|
|
+ page: this.bigcamaraData.currentPage,
|
|
|
|
|
+ size: this.bigcamaraData.pageSize,
|
|
|
|
|
+ name: this.searchName?.trim() || null, // 去掉多余空格,避免 "" 导致条件错乱
|
|
|
|
|
+ deviceType: this.searchDeviceType || null, // 为空时传 null
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 判断返回结构
|
|
|
|
|
+ if (res && res.list) {
|
|
|
|
|
+ this.bigcamaraData.total = res.total || 0;
|
|
|
|
|
+ this.bigcamaraData.data = res.list.map((item) => ({
|
|
|
|
|
+ name: item.name,
|
|
|
|
|
+ ip: item.ip,
|
|
|
|
|
+ port: item.port,
|
|
|
|
|
+ userName: item.username,
|
|
|
|
|
+ password: item.password,
|
|
|
|
|
+ channelName: item.channelName,
|
|
|
|
|
+ url: item.url,
|
|
|
|
|
+ playUrl: item.playUrl,
|
|
|
|
|
+ windowList: [],
|
|
|
|
|
+ }));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.bigcamaraData.total = 0;
|
|
|
|
|
+ this.bigcamaraData.data = [];
|
|
|
|
|
+ this.$message.warning("未获取到视频数据");
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error("获取视频信息失败:", error);
|
|
|
|
|
+ this.$message.error("获取视频列表失败,请检查网络或后端接口!");
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- async loadBigCamaraList() {
|
|
|
|
|
- const res = await request({
|
|
|
|
|
- url: "/video/list",
|
|
|
|
|
- method: "POST",
|
|
|
|
|
- data: {
|
|
|
|
|
- page: this.bigcamaraData.currentPage,
|
|
|
|
|
- size: this.bigcamaraData.pageSize,
|
|
|
|
|
- name: "",
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // 批量播放视频(顺序播放,稳定版)
|
|
|
|
|
+ async batchPlayVideos() {
|
|
|
|
|
+ // 1. 映射布局到实际窗口数
|
|
|
|
|
+ const layoutMap = {
|
|
|
|
|
+ 1: 1, // 1x1
|
|
|
|
|
+ 12: 2, // 1x2
|
|
|
|
|
+ 21: 2, // 2x1
|
|
|
|
|
+ 2: 4, // 2x2
|
|
|
|
|
+ 3: 9, // 3x3
|
|
|
|
|
+ 4: 16, // 4x4
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const totalWindows = layoutMap[this.selectedScreen] || 1;
|
|
|
|
|
+ const videoList = this.bigcamaraData.data;
|
|
|
|
|
+
|
|
|
|
|
+ if (!videoList.length) return this.$message.warning("没有可播放的视频");
|
|
|
|
|
+
|
|
|
|
|
+ console.log("批量播放开始,窗口数:", totalWindows, "视频数:", videoList.length);
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 停止所有窗口播放
|
|
|
|
|
+ await this.$refs.hkbigCamara.stopAllRealPlay();
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 清空所有视频 windowList
|
|
|
|
|
+ videoList.forEach(video => {
|
|
|
|
|
+ this.$set(video, 'windowList', []);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- this.bigcamaraData.total = res.total;
|
|
|
|
|
- this.bigcamaraData.data = res.list.map((item) => ({
|
|
|
|
|
- name: item.name,
|
|
|
|
|
- ip: item.ip,
|
|
|
|
|
- port: item.port,
|
|
|
|
|
- userName: item.username,
|
|
|
|
|
- password: item.password,
|
|
|
|
|
- channelName: item.channelName,
|
|
|
|
|
- url: item.url,
|
|
|
|
|
- playUrl: item.playUrl,
|
|
|
|
|
- windowList: [],
|
|
|
|
|
- }));
|
|
|
|
|
|
|
+ // 4. 窗口数和视频数取最小
|
|
|
|
|
+ const playCount = Math.min(totalWindows, videoList.length);
|
|
|
|
|
+ console.log(`批量播放 ${playCount} 个视频`);
|
|
|
|
|
+
|
|
|
|
|
+ // 5. 顺序播放视频
|
|
|
|
|
+ for (let i = 0; i < playCount; i++) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await this.playCameraVideoInSelectWindow({ row: videoList[i], $index: i }, i);
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.error(`窗口 ${i} 播放失败`, err);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.$message.success("批量播放完成");
|
|
|
|
|
+ console.log("批量播放结束,当前窗口列表状态:", videoList.map(v => v.windowList));
|
|
|
|
|
+ },
|
|
|
|
|
+ // 播放某个视频到指定窗口
|
|
|
|
|
+ async playCameraVideoInSelectWindow(camera, iWndIndex) {
|
|
|
|
|
+ const bofangyuan = {
|
|
|
|
|
+ name: camera.row.name,
|
|
|
|
|
+ channelName: camera.row.channelName,
|
|
|
|
|
+ ip: camera.row.ip,
|
|
|
|
|
+ port: camera.row.port,
|
|
|
|
|
+ username: camera.row.userName,
|
|
|
|
|
+ password: camera.row.password,
|
|
|
|
|
+ url: camera.row.url,
|
|
|
|
|
+ playUrl: camera.row.playUrl,
|
|
|
|
|
+ windowList: camera.row.windowList || [],
|
|
|
|
|
+ iWndIndex: iWndIndex,
|
|
|
|
|
+ isbofang: 1,
|
|
|
|
|
+ channelId: camera.row.channelId || 1, // 默认通道1
|
|
|
|
|
+ };
|
|
|
|
|
+ console.log("播放视频源", bofangyuan);
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ const loginResult = await this.$refs.hkbigCamara.login([bofangyuan]);
|
|
|
|
|
+ const deviceResult = loginResult[0]; // 单设备登录结果
|
|
|
|
|
+
|
|
|
|
|
+ if (!deviceResult.success) {
|
|
|
|
|
+ this.$message.error(`登录摄像机失败: ${bofangyuan.ip}, 错误码: ${deviceResult.errorCode}`);
|
|
|
|
|
+ console.error("登录失败信息:", deviceResult);
|
|
|
|
|
+ return; // 登录失败就不继续播放
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 停止目标窗口已有视频
|
|
|
|
|
+ await this.checkWindow(iWndIndex);
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 播放视频
|
|
|
|
|
+ await this.$refs.hkbigCamara.playVideoInSelectWindow(bofangyuan);
|
|
|
|
|
+
|
|
|
|
|
+ // 4. 更新 windowList(保证响应式)
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ camera.row,
|
|
|
|
|
+ 'windowList',
|
|
|
|
|
+ [...new Set([...camera.row.windowList, iWndIndex])].sort((a, b) => a - b)
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ this.isBofang = true;
|
|
|
|
|
+ console.log("窗口列表更新:", camera.row.windowList);
|
|
|
|
|
+
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ this.$message.error(`播放摄像机异常: ${bofangyuan.ip}`);
|
|
|
|
|
+ console.error("播放异常信息:", err);
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
|
|
+ // 停止播放所有窗口的视频
|
|
|
stopAllVideo() {
|
|
stopAllVideo() {
|
|
|
- this.$refs.hkbigCamara.clickStopAllRealPlay();
|
|
|
|
|
|
|
+ this.$refs.hkbigCamara.stopAllRealPlay();
|
|
|
},
|
|
},
|
|
|
- handleVideoPlay(code) {
|
|
|
|
|
- console.log("错误码:", code);
|
|
|
|
|
|
|
+ // 处理播放视频的返回结果
|
|
|
|
|
+ handleVideoPlay(event) {
|
|
|
|
|
+ console.log("错误码:", event);
|
|
|
|
|
+ // 统一事件结构
|
|
|
|
|
+ const { code, iWndIndex } = typeof event === 'object' ? event : { code: event, iWndIndex: this.selectWindow };
|
|
|
const targetData = this.bigcamaraData.data[this.selectCamaraRow];
|
|
const targetData = this.bigcamaraData.data[this.selectCamaraRow];
|
|
|
- const windowNum = this.selectWindow + 1;
|
|
|
|
|
|
|
|
|
|
- const playFailCodes = ["16", "1000", "3001"];
|
|
|
|
|
- const playSuccessCode = "bofangchenggong";
|
|
|
|
|
- const playFailCode = "bofangshibai";
|
|
|
|
|
|
|
+ switch(code) {
|
|
|
|
|
+ case "playSuccess":
|
|
|
|
|
+ this.$message.success(`窗口 ${iWndIndex + 1} 播放成功`);
|
|
|
|
|
+ if(!targetData.windowList.includes(iWndIndex)) {
|
|
|
|
|
+ targetData.windowList.push(iWndIndex);
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
- // 统一失败处理
|
|
|
|
|
- if (playFailCodes.includes(code)) {
|
|
|
|
|
- if (code === "3001") this.$refs.hkbigCamara.stopPlayVideo();
|
|
|
|
|
- this.$message(`窗口 ${windowNum} 播放失败`);
|
|
|
|
|
- console.log(`窗口 ${windowNum} 播放失败`);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ case "playFail":
|
|
|
|
|
+ this.$message.error(`窗口 ${iWndIndex + 1} 播放失败`);
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
- // 播放成功
|
|
|
|
|
- if (code === playSuccessCode) {
|
|
|
|
|
- this.$message(`窗口 ${windowNum} 播放成功`);
|
|
|
|
|
- console.log(`窗口 ${windowNum} 播放成功`);
|
|
|
|
|
|
|
+ case "stopSuccess":
|
|
|
|
|
+ this.$message.success(`窗口 ${iWndIndex + 1} 停止成功`);
|
|
|
|
|
+ targetData.windowList = targetData.windowList.filter(win => win != iWndIndex);
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
- // 添加到 windowList 并去重排序
|
|
|
|
|
- targetData.windowList.push(windowNum.toString());
|
|
|
|
|
- targetData.windowList = [...new Set(targetData.windowList)].sort(
|
|
|
|
|
- (a, b) => a - b,
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ case "stopFail":
|
|
|
|
|
+ this.$message.error(`窗口 ${iWndIndex + 1} 停止失败`);
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
- console.log("当前窗口列表:", targetData.windowList);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ case "stopAllSuccess":
|
|
|
|
|
+ this.$message.success("所有窗口停止成功");
|
|
|
|
|
+ targetData.windowList = [];
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
- // 播放失败
|
|
|
|
|
- if (code === playFailCode) {
|
|
|
|
|
- console.log("播放失败");
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ case "stopAllFail":
|
|
|
|
|
+ this.$message.error("所有窗口停止失败");
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 停止视频逻辑
|
|
|
|
|
- if (this.stopCamara) {
|
|
|
|
|
- const stopMessages = {
|
|
|
|
|
- stoponechenggong: "暂停一个视频成功",
|
|
|
|
|
- stoponeshibai: "暂停一个视频失败",
|
|
|
|
|
- stopmorechenggong: "暂停所有视频成功",
|
|
|
|
|
- stopmoreshibai: "暂停所有视频失败",
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- if (stopMessages[code]) {
|
|
|
|
|
- if (code.includes("chenggong"))
|
|
|
|
|
- this.$message(`窗口 ${windowNum} ${stopMessages[code]}`);
|
|
|
|
|
- console.log(`窗口 ${windowNum} ${stopMessages[code]}`);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- console.log("所有数据", this.bigcamaraData);
|
|
|
|
|
|
|
+ console.log("当前窗口列表:", targetData.windowList);
|
|
|
},
|
|
},
|
|
|
|
|
+ // 改变窗口
|
|
|
handleChangeWindow(value) {
|
|
handleChangeWindow(value) {
|
|
|
- console.log("父组件接收到 change-window 事件,值:", value);
|
|
|
|
|
this.selectWindow = value;
|
|
this.selectWindow = value;
|
|
|
console.log("当前选中的窗口this.selectWindow", this.selectWindow);
|
|
console.log("当前选中的窗口this.selectWindow", this.selectWindow);
|
|
|
},
|
|
},
|
|
|
// 停止指定窗口的视频播放
|
|
// 停止指定窗口的视频播放
|
|
|
- async stopone_bigcamaraData(a) {
|
|
|
|
|
- const selectedCamera = this.bigcamaraData.data[a.$index];
|
|
|
|
|
|
|
+ async stopone_bigcamaraData(camera) {
|
|
|
|
|
+ console.log("当前选中的摄像机", camera);
|
|
|
|
|
+ const selectedCamera = this.bigcamaraData.data[camera.$index];
|
|
|
try {
|
|
try {
|
|
|
- await this.$refs.hkbigCamara.stopPlayVideo(); // 停止播放
|
|
|
|
|
|
|
+ await this.$refs.hkbigCamara.stopOneWindowPlayVideo(this.selectWindow); // 停止播放
|
|
|
// 更新数据,移除已停止窗口
|
|
// 更新数据,移除已停止窗口
|
|
|
selectedCamera.windowList = selectedCamera.windowList.filter(
|
|
selectedCamera.windowList = selectedCamera.windowList.filter(
|
|
|
(element) => element !== this.selectWindow,
|
|
(element) => element !== this.selectWindow,
|
|
@@ -386,56 +524,72 @@ export default {
|
|
|
console.error("停止单个视频失败:", error);
|
|
console.error("停止单个视频失败:", error);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- // 停止指定摄像机所有窗口的视频播放
|
|
|
|
|
- async stopall_bigcamaraData(a) {
|
|
|
|
|
- const selectedCamera = this.bigcamaraData.data[a.$index];
|
|
|
|
|
- try {
|
|
|
|
|
- await this.$refs.hkbigCamara.stopallPlayVideo(
|
|
|
|
|
- selectedCamera.windowList,
|
|
|
|
|
- );
|
|
|
|
|
- // 清空窗口列表
|
|
|
|
|
- selectedCamera.windowList = [];
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error("停止所有视频失败:", error);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
// 播放摄像机视频
|
|
// 播放摄像机视频
|
|
|
async begin_bigcamaraData(camera) {
|
|
async begin_bigcamaraData(camera) {
|
|
|
console.log("当前选中的摄像机", camera);
|
|
console.log("当前选中的摄像机", camera);
|
|
|
- this.selectCamaraRow = camera.$index;
|
|
|
|
|
console.log("当前选中的窗口", this.selectWindow);
|
|
console.log("当前选中的窗口", this.selectWindow);
|
|
|
|
|
+ this.selectCamaraRow = camera.$index;
|
|
|
const selectedCamera = this.bigcamaraData.data[camera.$index];
|
|
const selectedCamera = this.bigcamaraData.data[camera.$index];
|
|
|
|
|
|
|
|
- // 限制同一摄像机同时播放窗口数
|
|
|
|
|
- if (selectedCamera.windowList.length < 6) {
|
|
|
|
|
- // 停止当前窗口可能正在播放的视频
|
|
|
|
|
- await this.checkWindow(this.selectWindow);
|
|
|
|
|
- console.log("camera", camera);
|
|
|
|
|
- // 更新播放源信息
|
|
|
|
|
- const bofangyuan = {
|
|
|
|
|
- Password: camera.row.password,
|
|
|
|
|
- Port: camera.row.port,
|
|
|
|
|
- Username: camera.row.userName,
|
|
|
|
|
- channelName: camera.row.channelName,
|
|
|
|
|
- ip: camera.row.ip,
|
|
|
|
|
- name: camera.row.name,
|
|
|
|
|
- window: this.selectWindow,
|
|
|
|
|
- windowList: camera.row.windowList,
|
|
|
|
|
- playUrl: camera.row.playUrl,
|
|
|
|
|
- url: camera.row.url,
|
|
|
|
|
- isbofang: 1,
|
|
|
|
|
- };
|
|
|
|
|
- this.issbofang = true;
|
|
|
|
|
- console.log("bofangyuan", bofangyuan);
|
|
|
|
|
- // 调用登录/播放
|
|
|
|
|
- const myArray = [bofangyuan];
|
|
|
|
|
- await this.$refs.hkbigCamara.login(myArray);
|
|
|
|
|
-
|
|
|
|
|
- // 将当前窗口加入摄像机的窗口列表
|
|
|
|
|
- selectedCamera.windowList.push(this.selectWindow);
|
|
|
|
|
- console.log("当前窗口列表:", selectedCamera.windowList);
|
|
|
|
|
- } else {
|
|
|
|
|
- console.log("当前摄像机已满");
|
|
|
|
|
|
|
+ // 限制单摄像机最多 6 个窗口
|
|
|
|
|
+ if (selectedCamera.windowList.length >= 6) {
|
|
|
|
|
+ return this.$message.warning("摄像机已满");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 停止当前窗口已有视频
|
|
|
|
|
+ await this.checkWindow(this.selectWindow);
|
|
|
|
|
+
|
|
|
|
|
+ // 当前选择视频源
|
|
|
|
|
+ const bofangyuan = {
|
|
|
|
|
+ name: camera.row.name,
|
|
|
|
|
+ channelName: camera.row.channelName,
|
|
|
|
|
+ ip: camera.row.ip,
|
|
|
|
|
+ port: camera.row.port,
|
|
|
|
|
+ username: camera.row.userName,
|
|
|
|
|
+ password: camera.row.password,
|
|
|
|
|
+ url: camera.row.url,
|
|
|
|
|
+ playUrl: camera.row.playUrl,
|
|
|
|
|
+ windowList: camera.row.windowList,
|
|
|
|
|
+ isbofang: 1,
|
|
|
|
|
+ };
|
|
|
|
|
+ console.log("bofangyuan", bofangyuan);
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ const result = await this.$refs.hkbigCamara.login([bofangyuan]);
|
|
|
|
|
+ // login 返回的是数组,每台设备有 success/errorCode
|
|
|
|
|
+ const deviceResult = result[0]; // 这里只有一台设备
|
|
|
|
|
+ if (deviceResult.success) {
|
|
|
|
|
+ // 登录成功,更新窗口列表
|
|
|
|
|
+ selectedCamera.windowList = [...new Set([...selectedCamera.windowList, this.selectWindow])].sort((a, b) => a - b);
|
|
|
|
|
+ this.isBofang = true;
|
|
|
|
|
+ console.log("当前窗口列表:", selectedCamera.windowList);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error(`登录摄像机失败: ${bofangyuan.ip}, 错误码: ${deviceResult.errorCode}`);
|
|
|
|
|
+ console.error("登录失败信息:", deviceResult);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ // 捕获意外错误
|
|
|
|
|
+ this.$message.error(`登录摄像机异常: ${bofangyuan.ip}`);
|
|
|
|
|
+ console.error("登录异常:", err);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 停止指定摄像机所有窗口的视频播放
|
|
|
|
|
+ async stopall_bigcamaraData(camera) {
|
|
|
|
|
+ console.log("当前选中的摄像机", camera);
|
|
|
|
|
+ const selectedCamera = this.bigcamaraData.data[camera.$index];
|
|
|
|
|
+ if (!selectedCamera.windowList.length) {
|
|
|
|
|
+ this.$message.info("该摄像机当前没有正在播放的视频");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const windows = [...selectedCamera.windowList]; // 防止引用问题
|
|
|
|
|
+ try {
|
|
|
|
|
+ await this.$refs.hkbigCamara.stopallPlayVideo(windows);
|
|
|
|
|
+ selectedCamera.windowList = [];
|
|
|
|
|
+ this.$message.success("停止该视频流在所有窗口上播放-操作成功");
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error("停止该视频流在所有窗口上播放-操作失败:", error);
|
|
|
|
|
+ this.$message.error("停止该视频流在所有窗口上播放-操作失败");
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// 检查指定窗口是否正在播放其他视频,如在播放则停止
|
|
// 检查指定窗口是否正在播放其他视频,如在播放则停止
|
|
@@ -445,18 +599,15 @@ export default {
|
|
|
const promises = [];
|
|
const promises = [];
|
|
|
console.log("this.bigcamaraData.data", this.bigcamaraData.data);
|
|
console.log("this.bigcamaraData.data", this.bigcamaraData.data);
|
|
|
this.bigcamaraData.data.forEach((camera) => {
|
|
this.bigcamaraData.data.forEach((camera) => {
|
|
|
- console.log("camera", camera);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // console.log("camera", camera);
|
|
|
if (camera.windowList.length > 0) {
|
|
if (camera.windowList.length > 0) {
|
|
|
camera.windowList.forEach((win, winIndex) => {
|
|
camera.windowList.forEach((win, winIndex) => {
|
|
|
if (parseInt(win) === selectWindow) {
|
|
if (parseInt(win) === selectWindow) {
|
|
|
console.log(`窗口 ${selectWindow} 已被占用,停止播放...`);
|
|
console.log(`窗口 ${selectWindow} 已被占用,停止播放...`);
|
|
|
this.stopCamara = true;
|
|
this.stopCamara = true;
|
|
|
this.stopCamaraRow = winIndex;
|
|
this.stopCamaraRow = winIndex;
|
|
|
-
|
|
|
|
|
// 停止播放并更新数据
|
|
// 停止播放并更新数据
|
|
|
- const stopPromise = this.$refs.hkbigCamara
|
|
|
|
|
- .stopPlayVideo()
|
|
|
|
|
|
|
+ const stopPromise = this.$refs.hkbigCamara.stopOneWindowPlayVideo(selectWindow)
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
camera.windowList = camera.windowList.filter(
|
|
camera.windowList = camera.windowList.filter(
|
|
|
(element) => element !== selectWindow,
|
|
(element) => element !== selectWindow,
|
|
@@ -466,13 +617,13 @@ export default {
|
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
|
console.error("停止视频失败:", error);
|
|
console.error("停止视频失败:", error);
|
|
|
});
|
|
});
|
|
|
- promises.push(stopPromise);
|
|
|
|
|
|
|
+ promises.push(stopPromise); // Promise 已经加入数组
|
|
|
} else {
|
|
} else {
|
|
|
console.log(`窗口 ${win} 未被占用`);
|
|
console.log(`窗口 ${win} 未被占用`);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- console.log("没有窗口正在播放");
|
|
|
|
|
|
|
+ // console.log("当前视频没有窗口正在播放:", camera.name);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -499,72 +650,15 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// 页码改变
|
|
// 页码改变
|
|
|
- onCurrentPageChange_bigcamaraData(page) {
|
|
|
|
|
|
|
+ handlePageChange(page) {
|
|
|
this.bigcamaraData.currentPage = page;
|
|
this.bigcamaraData.currentPage = page;
|
|
|
- this.loadBigCamaraList(); // 重新加载
|
|
|
|
|
|
|
+ this.getVideoInfo(); // 重新加载
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
// 每页条数改变
|
|
// 每页条数改变
|
|
|
- onPageSizeChange_bigcamaraData(size) {
|
|
|
|
|
- this.bigcamaraData.pageSize = size;
|
|
|
|
|
|
|
+ handleSizeChange(size) {
|
|
|
this.bigcamaraData.currentPage = 1;
|
|
this.bigcamaraData.currentPage = 1;
|
|
|
- this.loadBigCamaraList(); // 重新加载
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取表格数据
|
|
|
|
|
- * @param {Integer} pageNum 当前分页
|
|
|
|
|
- * @param {Integer} pageSize 每页数量
|
|
|
|
|
- * @param {Boolean} reload 是否重新获取数据
|
|
|
|
|
- */
|
|
|
|
|
- loadTableDataImpl_bigcamaraData(pageNum, pageSize, reload = false) {
|
|
|
|
|
- // 判断是否需要重新加载数据
|
|
|
|
|
- if (
|
|
|
|
|
- this.bigcamaraData.data.length == 0 ||
|
|
|
|
|
- this.bigcamaraData.length == 0
|
|
|
|
|
- ) {
|
|
|
|
|
- return Promise.resolve([]);
|
|
|
|
|
- }
|
|
|
|
|
- if (
|
|
|
|
|
- reload ||
|
|
|
|
|
- !this.bigcamaraData.data ||
|
|
|
|
|
- this.bigcamaraData.data.length === 0
|
|
|
|
|
- ) {
|
|
|
|
|
- // 调用后端接口或其他数据来源获取数据
|
|
|
|
|
- // 这里省略具体实现
|
|
|
|
|
- // 模拟一个返回结果的 Promise 对象
|
|
|
|
|
- const mockData = new Promise((resolve) => {
|
|
|
|
|
- const data = [];
|
|
|
|
|
- for (let i = 1; i <= pageSize; i++) {
|
|
|
|
|
- data.push({
|
|
|
|
|
- id: pageNum * pageSize + i,
|
|
|
|
|
- name: `任务${pageNum * pageSize + i}`,
|
|
|
|
|
- status: Math.floor(Math.random() * 4),
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- resolve(data);
|
|
|
|
|
- });
|
|
|
|
|
- // 返回 Promise 对象,以便分页组件可以在数据加载完成后进行下一步处理。
|
|
|
|
|
- return mockData.then((data) => {
|
|
|
|
|
- // 更新任务列表数据
|
|
|
|
|
- this.bigcamaraData.data = data;
|
|
|
|
|
- // 返回新的任务列表数据
|
|
|
|
|
- return this.bigcamaraData.data.slice(
|
|
|
|
|
- (pageNum - 1) * pageSize,
|
|
|
|
|
- pageNum * pageSize,
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- // 直接返回已有的任务列表数据
|
|
|
|
|
- return Promise.resolve(
|
|
|
|
|
- this.bigcamaraData.data.slice(
|
|
|
|
|
- (pageNum - 1) * pageSize,
|
|
|
|
|
- pageNum * pageSize,
|
|
|
|
|
- ),
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- HKbigCamaraInit() {
|
|
|
|
|
- this.HKbigCamaraShow = true;
|
|
|
|
|
|
|
+ this.bigcamaraData.pageSize = size;
|
|
|
|
|
+ this.getVideoInfo(); // 重新加载
|
|
|
},
|
|
},
|
|
|
// 窗口分割数
|
|
// 窗口分割数
|
|
|
changeWndNum(val) {
|
|
changeWndNum(val) {
|
|
@@ -573,6 +667,11 @@ export default {
|
|
|
this.selectedScreen = val; // 不需要转换为整数,直接使用原始值
|
|
this.selectedScreen = val; // 不需要转换为整数,直接使用原始值
|
|
|
console.log("当前选择的分屏数量", this.selectedScreen);
|
|
console.log("当前选择的分屏数量", this.selectedScreen);
|
|
|
},
|
|
},
|
|
|
|
|
+ // 播放大屏
|
|
|
|
|
+ HKbigCamaraInit() {
|
|
|
|
|
+ this.HKbigCamaraShow = true;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 全屏切换
|
|
|
showFull() {
|
|
showFull() {
|
|
|
console.log("showFull", this.isFullScreen);
|
|
console.log("showFull", this.isFullScreen);
|
|
|
this.isFullScreen = !this.isFullScreen;
|
|
this.isFullScreen = !this.isFullScreen;
|
|
@@ -750,4 +849,24 @@ export default {
|
|
|
width: 419px;
|
|
width: 419px;
|
|
|
height: 182px;
|
|
height: 182px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+/*分页样式*/
|
|
|
|
|
+/* 全局或 scoped 样式 */
|
|
|
|
|
+.custom-pagination {
|
|
|
|
|
+ color: #000; /* 分页文字颜色 */
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.custom-pagination .el-pager li {
|
|
|
|
|
+ color: #000;
|
|
|
|
|
+ border-color: #000;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.custom-pagination .el-pager li.active {
|
|
|
|
|
+ background-color: #000;
|
|
|
|
|
+ color: #da2121;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.custom-pagination .el-pager li:hover {
|
|
|
|
|
+ color: #000;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|