diff --git a/src/views/deviceManagement/videoDeviceMgmt/monitoringAndDebug.vue b/src/views/deviceManagement/videoDeviceMgmt/monitoringAndDebug.vue index 5e46123d..183f4b51 100644 --- a/src/views/deviceManagement/videoDeviceMgmt/monitoringAndDebug.vue +++ b/src/views/deviceManagement/videoDeviceMgmt/monitoringAndDebug.vue @@ -23,47 +23,43 @@
- - +
- - + - - +
- - +
- + - +
聚焦
- + - +
缩放
- + - +
光圈
@@ -99,8 +95,8 @@
- 关闭云台 - 开启云台 + 关闭云台 + 开启云台
@@ -129,7 +125,7 @@ {{item.label}} @@ -156,39 +152,27 @@ export default { line1: '', line2: '' }, - keyMap: { - 'w': 'up', - 's': 'down', - 'a': 'left', - 'd': 'right', - 'q': 'zoomIn', - 'e': 'zoomOut', - 'r': 'focusIn', - 't': 'focusOut', - 'f': 'capture', - 'g': 'record' - }, - // 快捷键设置数据结构 + // 合并后的快捷键设置数据结构 shortcutSettings: [ [ - { label: '上', key: 'W' }, - { label: '放大', key: 'Q' } + { label: '上', key: 'W', action: 'up' }, + { label: '放大', key: 'Q', action: 'zoomIn' } ], [ - { label: '下', key: 'S' }, - { label: '缩小', key: 'E' } + { label: '下', key: 'S', action: 'down' }, + { label: '缩小', key: 'E', action: 'zoomOut' } ], [ - { label: '左', key: 'A' }, - { label: '远焦', key: 'R' } + { label: '左', key: 'A', action: 'left' }, + { label: '远焦', key: 'R', action: 'focusIn' } ], [ - { label: '右', key: 'D' }, - { label: '近焦', key: 'T' } + { label: '右', key: 'D', action: 'right' }, + { label: '近焦', key: 'T', action: 'focusOut' } ], [ - { label: '抓拍', key: 'F' }, - { label: '录像', key: 'G' } + { label: '抓拍', key: 'F', action: 'capture' }, + { label: '录像', key: 'G', action: 'record' } ] ] } @@ -210,15 +194,40 @@ export default { const key = event.key.toUpperCase(); // 只允许字母键 if (/^[A-Z]$/.test(key)) { + // 检查是否已经存在相同的键位 + const isDuplicate = this.shortcutSettings.some(row => + row.some(item => item.key === key && !(item.key === this.shortcutSettings[rowIndex][colIndex].key)) + ); + + if (isDuplicate) { + this.$message.error('该键位已被使用,请选择其他键位'); + return; + } + + // 获取当前的键位 + const oldKey = this.shortcutSettings[rowIndex][colIndex].key; + + // 更新快捷键设置 this.shortcutSettings[rowIndex][colIndex].key = key; } } }, + computed: { + keyMap() { + return this.shortcutSettings.reduce((map, row) => { + row.forEach(item => { + map[item.key] = item.action; + }); + return map; + }, {}); + } + }, mounted() { // 键盘事件监听 window.addEventListener('keydown', (e) => { - if (this.keyMap[e.key]) { - this.control(this.keyMap[e.key]) + const key = e.key.toUpperCase(); + if (this.keyMap[key]) { + this.control(this.keyMap[key]) } }) } @@ -290,7 +299,7 @@ export default { .horizontal-buttons { display: flex; - gap: 5px; + gap: 32px; } .zoom-controls { @@ -312,6 +321,7 @@ export default { .cloud-buttons { display: flex; gap: 10px; + justify-content: space-evenly; } .view-controls { @@ -336,6 +346,7 @@ export default { } .watermark-title{ + cursor: pointer; font-size: 13px; display: flex; flex-direction: row-reverse; @@ -379,6 +390,7 @@ export default { background: #f5f7fa; color: rgb(25, 190, 107); font-weight: bold; + text-align: center; } .control-title { @@ -390,10 +402,16 @@ export default { } .el-button { - padding: 8px 15px; + padding: 8px 9px; } .el-button [class^="el-icon-"] { margin: 0; } + +.column-label{ + display: flex; + flex-direction: column; + justify-content: center; +}