|
|
@@ -606,9 +606,10 @@
|
|
|
v-model="showMapDialog"
|
|
|
:title="'请选择坐标位置'"
|
|
|
:init-center="initCenter"
|
|
|
- :init-zoom="13"
|
|
|
+ :init-zoom="6"
|
|
|
@select="handleCoordinateSelect"
|
|
|
@update:modelValue="handleDialogVisibleChange"
|
|
|
+ @confirm="handleCoordinateConfirm"
|
|
|
/>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -861,16 +862,34 @@ const mqttSubscribe = (device) => {
|
|
|
const getPlayerData = (data) => {
|
|
|
activeName.value = data.tabName
|
|
|
channelId.value = data.channelId
|
|
|
- console.log('***********************', channelId.value, deviceLiveStreamRef.value)
|
|
|
- nextTick(() => {
|
|
|
- if (channelId.value && deviceLiveStreamRef.value) {
|
|
|
- console.log('1111111111111111111')
|
|
|
- deviceLiveStreamRef.value.channelId = channelId.value
|
|
|
- deviceLiveStreamRef.value.changeChannel()
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+if (deviceLiveStreamRef.value) {
|
|
|
+ nextTick(() => {
|
|
|
+ if (channelId.value && deviceLiveStreamRef.value) {
|
|
|
+ deviceLiveStreamRef.value.channelId = channelId.value
|
|
|
+ deviceLiveStreamRef.value.changeChannel()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+// 监听 deviceLiveStreamRef 的变化,当它变为可用时尝试播放视频
|
|
|
+watch(
|
|
|
+ () => deviceLiveStreamRef.value,
|
|
|
+ (newVal, oldVal) => {
|
|
|
+ // 当 deviceLiveStreamRef 变为可用且有待播放的 channelId 时,触发播放
|
|
|
+ if (newVal && channelId.value) {
|
|
|
+ nextTick(() => {
|
|
|
+ newVal.channelId = channelId.value
|
|
|
+ newVal.changeChannel()
|
|
|
+ // 清空 channelId,避免重复触发
|
|
|
+ channelId.value = null
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { flush: 'post' } // 在 DOM 更新后执行
|
|
|
+)
|
|
|
+
|
|
|
const tabChange = (panel) => {
|
|
|
nextTick(() => {
|
|
|
if (form.deviceType == 3 && panel.name != 'deviceReturn') {
|
|
|
@@ -878,14 +897,13 @@ const tabChange = (panel) => {
|
|
|
// if (this.$refs.deviceVideo && this.$refs.deviceVideo.destroy) {
|
|
|
// this.$refs.deviceVideo.destroy()
|
|
|
// }
|
|
|
- if (channelId.value) {
|
|
|
- if (deviceLiveStreamRef.value && deviceLiveStreamRef.value.channelId !== undefined) {
|
|
|
+ if (deviceLiveStreamRef.value) {
|
|
|
+ if (channelId.value) {
|
|
|
deviceLiveStreamRef.value.channelId = channelId.value
|
|
|
+ deviceLiveStreamRef.value.changeChannel()
|
|
|
+ } else if (deviceLiveStreamRef.value.channelId) {
|
|
|
+ deviceLiveStreamRef.value.changeChannel()
|
|
|
}
|
|
|
- deviceLiveStreamRef.value.changeChannel()
|
|
|
- }
|
|
|
- if (deviceLiveStreamRef.value.channelId) {
|
|
|
- deviceLiveStreamRef.value.changeChannel()
|
|
|
}
|
|
|
} else if (panel.name === 'sipVideo') {
|
|
|
if (deviceLiveStreamRef.value && deviceLiveStreamRef.value.destroy) {
|
|
|
@@ -1027,10 +1045,9 @@ const showMapDialog = ref(false)
|
|
|
// 选择的坐标信息
|
|
|
const selectedCoordinate = ref(null)
|
|
|
|
|
|
-// 初始化中心点(可以根据需要设置默认值)
|
|
|
const initCenter = ref({
|
|
|
- lng: 121.4737, // 上海
|
|
|
- lat: 31.2304
|
|
|
+ lng: 108.7427,
|
|
|
+ lat: 34.2157
|
|
|
})
|
|
|
|
|
|
// 打开地图选择器
|
|
|
@@ -1041,7 +1058,13 @@ const showMapPicker = () => {
|
|
|
|
|
|
// 处理坐标选择(每次选择都会触发)
|
|
|
const handleCoordinateSelect = (coordinate) => {
|
|
|
- console.log('选择变更:', coordinate)
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+const handleCoordinateConfirm = (val) => {
|
|
|
+
|
|
|
+ form.longitude = val.lng;
|
|
|
+ form.latitude = val.lat
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1311,11 +1334,11 @@ onMounted(async () => {
|
|
|
|
|
|
if (form.deviceId != 0) {
|
|
|
getDevice(form.deviceId).then((response) => {
|
|
|
+
|
|
|
Object.assign(form, response)
|
|
|
+ handleDeptChange(form.deptId)
|
|
|
})
|
|
|
-
|
|
|
- console.log('dddddddddddddddddddddd', form)
|
|
|
- handleDeptChange(form.deptId)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|