9 Commits babe906f25 ... da6d84444c

Author SHA1 Message Date
  Lita-Tako da6d84444c Merge branch 'refs/heads/dev-2.19.0' into dev 4 months ago
  Lita-Tako 998e26f124 视频相关 4 months ago
  Lita-Tako 74863ce733 Merge branch 'refs/heads/dev-2.19.0' into dev 4 months ago
  Lita-Tako f777f1662a 视频相关 4 months ago
  Lita-Tako 4fc17380d1 Merge branch 'refs/heads/dev-2.19.0' into dev 4 months ago
  Lita-Tako 66791d2985 视频相关 4 months ago
  Lita-Tako 1999768544 视频相关 4 months ago
  Lita-Tako a73f3dcf1e Merge branch 'refs/heads/dev-2.19.0' into dev 4 months ago
  Lita-Tako b64881dd18 视频相关 4 months ago
3 changed files with 46 additions and 7 deletions
  1. 4 0
      src/api/previewPlayback/index.js
  2. 30 5
      src/components/video/Live.vue
  3. 12 2
      src/utils/systemUtils.js

+ 4 - 0
src/api/previewPlayback/index.js

@@ -13,3 +13,7 @@ export const controlling = (data) => {
13 13
 export const getPlayback = (data) => {
14 14
 	return request('/getPlayback', data, 'post')
15 15
 }
16
+
17
+export const manualCapture = (data) => {
18
+	return request('/manualCapture', data, 'get')
19
+}

+ 30 - 5
src/components/video/Live.vue

@@ -1,11 +1,12 @@
1 1
 <!-- 实时视频监控 -->
2 2
 <script setup>
3
-	import { getPreview, controlling } from '@/api/previewPlayback'
3
+	import { getPreview, controlling, manualCapture } from '@/api/previewPlayback'
4 4
 	import { useRoute } from 'vue-router'
5 5
 	import commonSelect from '@/components/CommonSelector/index.vue'
6 6
 	import api from '@/api/orgInfo/info'
7 7
 	import cameraApi from '@/api/camera/index'
8 8
 	import { message } from 'ant-design-vue'
9
+	import { downloadLink } from '@/utils/systemUtils'
9 10
 
10 11
 	const activeKey = ref('1')
11 12
 	const route = useRoute()
@@ -217,9 +218,9 @@
217 218
 
218 219
 	const circle = () => {
219 220
 		if (isActive.value) {
220
-			doControl('LEFT', 0)
221
-		} else {
222 221
 			doControl('LEFT', 1)
222
+		} else {
223
+			doControl('LEFT', 0)
223 224
 		}
224 225
 		isActive.value = !isActive.value
225 226
 	}
@@ -240,6 +241,30 @@
240 241
 		doControl('STOP_TRACK', 1)
241 242
 	}
242 243
 
244
+	const captureOne = (i = null) => {
245
+		console.log('ready capture one')
246
+		if (i == null) {
247
+			i = currentWindowIndex
248
+		}
249
+		if (videoMap[i]) {
250
+			const data = videoMap[i]
251
+			const cameraIndexCode = data.cameraIndexCode
252
+			manualCapture({ cameraIndexCode }).then((url) => {
253
+				console.log('capture url', url)
254
+				downloadLink(url)
255
+			})
256
+		} else {
257
+			return message.warning('请选择播放中的窗口')
258
+		}
259
+	}
260
+
261
+	const captureAll = () => {
262
+		let i = 0
263
+		for (const _ of Object.values(videoMap)) {
264
+			captureOne(i++)
265
+		}
266
+	}
267
+
243 268
 	const orgSelect = (orgId, event) => {
244 269
 		const org = event.node
245 270
 		cameraListData.value = []
@@ -355,11 +380,11 @@
355 380
 						<a-button type="primary" class="btn">中止轮巡</a-button>
356 381
 					</div>
357 382
 					<div class="row">
358
-						<a-button type="primary" class="mr-5 btn">窗口抓图</a-button>
383
+						<a-button type="primary" class="mr-5 btn" @click="captureOne(null)">窗口抓图</a-button>
359 384
 						<a-button type="primary" class="btn" @click="stopPlay">窗口关闭</a-button>
360 385
 					</div>
361 386
 					<div class="row">
362
-						<a-button type="primary" class="mr-5 btn">全部抓图</a-button>
387
+						<a-button type="primary" class="mr-5 btn" @click="captureAll()">全部抓图</a-button>
363 388
 						<a-button type="primary" class="btn" @click="stopAllPlay">全部关闭</a-button>
364 389
 					</div>
365 390
 					<div v-if="hasPerm(['controlCloud'])" class="flex flex-col">

+ 12 - 2
src/utils/systemUtils.js

@@ -155,9 +155,9 @@ export const getALlOrgData = () => {
155 155
 export const getShiZhou = () => {
156 156
 	const dicList = JSON.parse(localStorage.getItem('DICT_TYPE_TREE_DATA')) || []
157 157
 	let cityList = []
158
-	const d = dicList.find(d => d.dictValue === 'xzqh')
158
+	const d = dicList.find((d) => d.dictValue === 'xzqh')
159 159
 	const children = d.children
160
-	for(const el of children) {
160
+	for (const el of children) {
161 161
 		if (el.name == '青海省') {
162 162
 			cityList = el.children
163 163
 			break
@@ -184,3 +184,13 @@ export const getQueryParams = (name) => {
184 184
 	}
185 185
 	return null
186 186
 }
187
+
188
+export const downloadLink = (url) => {
189
+	const a = document.createElement('a')
190
+	a.href = url
191
+	a.download = 'download'
192
+	a.target = '_blank'
193
+	document.body.appendChild(a)
194
+	a.click()
195
+	document.body.removeChild(a)
196
+}