|
|
@@ -65,7 +65,7 @@
|
|
65
|
65
|
<el-table-column :label="vsT('colInstallLocation')" prop="installLocation" align="center" min-width="120" :show-overflow-tooltip="true" />
|
|
66
|
66
|
<el-table-column :label="vsCommon('colOp')" align="center" class-name="small-padding fixed-width" width="300" fixed="right">
|
|
67
|
67
|
<template slot-scope="scope">
|
|
68
|
|
- <el-button type="text" size="mini" @click="handleLiveView">{{ vsT("actionLiveView") }}</el-button>
|
|
|
68
|
+ <el-button type="text" size="mini" @click="handleLiveView(scope.row)">{{ vsT("actionLiveView") }}</el-button>
|
|
69
|
69
|
<el-button
|
|
70
|
70
|
v-hasPermi="['videoSurveillance:livestockMonitor:query']"
|
|
71
|
71
|
type="text"
|
|
|
@@ -177,10 +177,38 @@
|
|
177
|
177
|
<el-button @click="viewOpen = false">{{ vsCommon("close") }}</el-button>
|
|
178
|
178
|
</div>
|
|
179
|
179
|
</el-dialog>
|
|
|
180
|
+
|
|
|
181
|
+ <el-dialog
|
|
|
182
|
+ :title="liveDialogTitle"
|
|
|
183
|
+ :visible.sync="liveOpen"
|
|
|
184
|
+ width="960px"
|
|
|
185
|
+ append-to-body
|
|
|
186
|
+ destroy-on-close
|
|
|
187
|
+ @close="closeLiveView"
|
|
|
188
|
+ >
|
|
|
189
|
+ <div class="live-player-wrap">
|
|
|
190
|
+ <LivePlayer
|
|
|
191
|
+ :video-url="liveVideoUrl"
|
|
|
192
|
+ :video-title="liveVideoTitle"
|
|
|
193
|
+ :alt="vsT('msgLiveNoStream')"
|
|
|
194
|
+ live
|
|
|
195
|
+ fluent
|
|
|
196
|
+ :autoplay="!!liveVideoUrl"
|
|
|
197
|
+ stretch
|
|
|
198
|
+ aspect="16:9"
|
|
|
199
|
+ :controls="true"
|
|
|
200
|
+ :muted="true"
|
|
|
201
|
+ />
|
|
|
202
|
+ </div>
|
|
|
203
|
+ <div slot="footer" class="dialog-footer">
|
|
|
204
|
+ <el-button @click="closeLiveView">{{ vsCommon("close") }}</el-button>
|
|
|
205
|
+ </div>
|
|
|
206
|
+ </el-dialog>
|
|
180
|
207
|
</div>
|
|
181
|
208
|
</template>
|
|
182
|
209
|
|
|
183
|
210
|
<script>
|
|
|
211
|
+import LivePlayer from "@liveqing/liveplayer"
|
|
184
|
212
|
import videoSurveillanceLocaleMixin from "@/mixins/videoSurveillanceLocaleMixin"
|
|
185
|
213
|
import {
|
|
186
|
214
|
listLivestockMonitor,
|
|
|
@@ -205,6 +233,9 @@ function createEmptyForm() {
|
|
205
|
233
|
|
|
206
|
234
|
export default {
|
|
207
|
235
|
name: "VideoSurveillanceLivestockMonitor",
|
|
|
236
|
+ components: {
|
|
|
237
|
+ LivePlayer
|
|
|
238
|
+ },
|
|
208
|
239
|
mixins: [videoSurveillanceLocaleMixin],
|
|
209
|
240
|
data() {
|
|
210
|
241
|
return {
|
|
|
@@ -212,6 +243,10 @@ export default {
|
|
212
|
243
|
loading: false,
|
|
213
|
244
|
open: false,
|
|
214
|
245
|
viewOpen: false,
|
|
|
246
|
+ liveOpen: false,
|
|
|
247
|
+ liveRow: {},
|
|
|
248
|
+ liveVideoUrl: "",
|
|
|
249
|
+ liveVideoTitle: "",
|
|
215
|
250
|
viewRow: {},
|
|
216
|
251
|
dialogEdit: false,
|
|
217
|
252
|
formKey: 0,
|
|
|
@@ -238,6 +273,10 @@ export default {
|
|
238
|
273
|
dialogTitle() {
|
|
239
|
274
|
return this.dialogEdit ? this.vsT("dialogEdit") : this.vsT("dialogAdd")
|
|
240
|
275
|
},
|
|
|
276
|
+ liveDialogTitle() {
|
|
|
277
|
+ const name = this.liveRow.monitorName || this.liveVideoTitle
|
|
|
278
|
+ return name ? `${this.vsT("dialogLiveView")} - ${name}` : this.vsT("dialogLiveView")
|
|
|
279
|
+ },
|
|
241
|
280
|
formRules() {
|
|
242
|
281
|
return {
|
|
243
|
282
|
monitorName: [
|
|
|
@@ -471,8 +510,30 @@ export default {
|
|
471
|
510
|
this.viewOpen = true
|
|
472
|
511
|
})
|
|
473
|
512
|
},
|
|
474
|
|
- handleLiveView() {
|
|
475
|
|
- this.$modal.msgWarning(this.vsT("msgLiveNotOpen"))
|
|
|
513
|
+ handleLiveView(row) {
|
|
|
514
|
+ if (!row || row.id == null) {
|
|
|
515
|
+ return
|
|
|
516
|
+ }
|
|
|
517
|
+ getLivestockMonitor(row.id).then((res) => {
|
|
|
518
|
+ const data = res.data || row
|
|
|
519
|
+ this.liveRow = data
|
|
|
520
|
+ this.liveVideoTitle = data.monitorName || ""
|
|
|
521
|
+ this.liveVideoUrl = this.resolveLiveVideoUrl(data)
|
|
|
522
|
+ this.liveOpen = true
|
|
|
523
|
+ })
|
|
|
524
|
+ },
|
|
|
525
|
+ closeLiveView() {
|
|
|
526
|
+ this.liveVideoUrl = ""
|
|
|
527
|
+ this.liveVideoTitle = ""
|
|
|
528
|
+ this.liveRow = {}
|
|
|
529
|
+ this.liveOpen = false
|
|
|
530
|
+ },
|
|
|
531
|
+ resolveLiveVideoUrl(row) {
|
|
|
532
|
+ if (!row) {
|
|
|
533
|
+ return ""
|
|
|
534
|
+ }
|
|
|
535
|
+ const url = row.liveStreamUrl || row.streamUrl || row.videoUrl
|
|
|
536
|
+ return url ? String(url).trim() : ""
|
|
476
|
537
|
},
|
|
477
|
538
|
handleDelete(row) {
|
|
478
|
539
|
this.$modal
|
|
|
@@ -520,4 +581,11 @@ export default {
|
|
520
|
581
|
margin-right: 6px;
|
|
521
|
582
|
vertical-align: middle;
|
|
522
|
583
|
}
|
|
|
584
|
+
|
|
|
585
|
+.live-player-wrap {
|
|
|
586
|
+ position: relative;
|
|
|
587
|
+ width: 100%;
|
|
|
588
|
+ height: 540px;
|
|
|
589
|
+ background: #000;
|
|
|
590
|
+}
|
|
523
|
591
|
</style>
|