yanghao 5 日 前
コミット
93f20adb14

+ 1 - 1
.env.local

@@ -4,7 +4,7 @@ NODE_ENV=development
 VITE_DEV=true
 
 # 请求路径
-VITE_BASE_URL='http://172.21.10.222:8080' # 192.168.188.149:48080 https://iot.deepoil.cc
+VITE_BASE_URL='http://172.21.10.222:8080' # 192.168.188.149:48080 172.21.10.222:8080
 
 # MQTT服务地址
 VITE_MQTT_SERVER_URL = 'ws://localhost:8083/mqtt'

+ 13 - 6
src/views/pms/video_center/device/baiduMapPicker.vue

@@ -1,9 +1,10 @@
 <template>
   <el-dialog
+   draggable
     v-model="dialogVisible"
     :title="title"
     :width="dialogWidth"
-    :fullscreen="isFullscreen"
+    
     :close-on-click-modal="false"
     @closed="handleDialogClosed"
     class="map-picker-dialog"
@@ -42,10 +43,7 @@
       >
         <el-descriptions-item label="坐标" v-if="selectedPoint">
           {{ selectedPoint.lng }}, {{ selectedPoint.lat }}
-          <el-button type="text" size="small" @click="copyCoordinates" class="copy-btn">
-            <el-icon><CopyDocument /></el-icon>
-            复制
-          </el-button>
+          
         </el-descriptions-item>
 
         <el-descriptions-item label="地址" v-if="selectedPoint">
@@ -57,6 +55,15 @@
         </el-descriptions-item>
       </el-descriptions>
     </div>
+
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button @click="handleCancel">取消</el-button>
+        <el-button type="primary" @click="handleConfirm" :disabled="!selectedPoint">
+          确认选择
+        </el-button>
+      </span>
+    </template>
   </el-dialog>
 </template>
 
@@ -423,7 +430,7 @@ defineExpose({
 
 .map-container {
   flex: 1;
-  min-height: 400px;
+  min-height: 65vh;
   background: #f5f5f5;
 }
 

+ 45 - 22
src/views/pms/video_center/device/device-edit.vue

@@ -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)
+    
   }