diff --git a/packages/screen/api.config.js b/packages/screen/api.config.js new file mode 100644 index 0000000..96717dc --- /dev/null +++ b/packages/screen/api.config.js @@ -0,0 +1,24 @@ +// API 基础地址配置 +// 此文件用于共享 API 地址配置,供 vite.config.js 和前端代码共同使用 + +// 当前使用的 API 地址 +export const API_BASE_URL = 'http://8.137.54.85:8661/' + +// 代理目标地址(用于 vite.config.js) +export const PROXY_TARGET = API_BASE_URL + +// 其他环境配置(备用) +export const API_URLS = { + // 测试环境 + test: 'http://8.137.54.85:8661/', + // 张启生本地环境 + zhangqisheng: 'http://192.168.110.36:8661/', + // 其他本地环境 + local: 'http://192.168.110.16:8661/', +} + +export default { + API_BASE_URL, + PROXY_TARGET, + API_URLS, +} diff --git a/packages/screen/src/views/RiskWarning/Dialog/hazardPointSituationDialog.vue b/packages/screen/src/views/RiskWarning/Dialog/hazardPointSituationDialog.vue index a0a65a9..1c3c1cc 100644 --- a/packages/screen/src/views/RiskWarning/Dialog/hazardPointSituationDialog.vue +++ b/packages/screen/src/views/RiskWarning/Dialog/hazardPointSituationDialog.vue @@ -52,6 +52,15 @@ + + +
+
照片
+
+ +
+
+
风险描述
@@ -188,14 +197,6 @@
备注
- - -
-
照片
-
- -
-
@@ -205,7 +206,7 @@ import { ref, watch, computed } from 'vue' import { Location, VideoCamera, Microphone, Phone } from '@element-plus/icons-vue' import baseDialog from '../component/baseDialog.vue' -import { openVideoConference } from '../component/index.js' +import { openVideoConference, openVoiceConference, opencallConference, getImageUrlList } from '../component/index.js' const props = defineProps({ visible: { @@ -322,19 +323,29 @@ const previewPhoto = (photo) => { // 视频通话 const handleVideo = (item) => { console.log('视频通话:', item) - emit('video', { + let videoParams = { ...item, id: hazardData.value.id, - }) + } + openVideoConference(videoParams) + // emit('video', { + // ...item, + // id: hazardData.value.id, + // }) } // 语音通话 const handleVoice = (item) => { console.log('语音通话:', item) - emit('voice', { + let voiceParams = { ...item, id: hazardData.value.id, - }) + } + openVoiceConference(voiceParams) + // emit('voice', { + // ...item, + // id: hazardData.value.id, + // }) } // 拨打电话 @@ -410,8 +421,8 @@ watch( longitude: data.GL1_LON || data.longitude || '', latitude: data.GL1_LAT || data.latitude || '', - // 照片信息(路段数据) - photos: data.photos || [], + // 照片信息(优先使用 GL1_TP 生成图片地址) + photos: data.GL1_TP ? getImageUrlList(data.GL1_TP) : data.photos || [], } } }, diff --git a/packages/screen/src/views/RiskWarning/Dialog/impactPointDialog.vue b/packages/screen/src/views/RiskWarning/Dialog/impactPointDialog.vue index 31dd7c0..8ac457a 100644 --- a/packages/screen/src/views/RiskWarning/Dialog/impactPointDialog.vue +++ b/packages/screen/src/views/RiskWarning/Dialog/impactPointDialog.vue @@ -685,8 +685,8 @@ const processUnifiedData = (item, type) => { }, // 一般人员(路长履职) generalStaff: { - name: item.ROAD_SECTION_CHIEF_NAME || '-', - phone: item.ROAD_SECTION_CHIEF_PHONE || '-', + name: item.ROAD_CAPTAIN_NAME || '-', + phone: item.ROAD_CAPTAIN_PHONE || '-', }, } } diff --git a/packages/screen/src/views/RiskWarning/component/ChongqingMap.vue b/packages/screen/src/views/RiskWarning/component/ChongqingMap.vue index 082ad6c..07a1762 100644 --- a/packages/screen/src/views/RiskWarning/component/ChongqingMap.vue +++ b/packages/screen/src/views/RiskWarning/component/ChongqingMap.vue @@ -90,9 +90,10 @@ const props = defineProps({ watch( () => props.roadItem, async (newVal, oldVal) => { + console.log('newVal', newVal) getAffectedRoadSectionData(false); }, - { immediate: false } + { immediate: true } ); // 定义 emits const emit = defineEmits([ diff --git a/packages/screen/src/views/RiskWarning/component/index.js b/packages/screen/src/views/RiskWarning/component/index.js index 9cf8606..725f76e 100644 --- a/packages/screen/src/views/RiskWarning/component/index.js +++ b/packages/screen/src/views/RiskWarning/component/index.js @@ -2,6 +2,7 @@ import { ref } from 'vue' import { request } from '@/utils/request' import { ElMessage } from 'element-plus' +import { PROXY_TARGET } from '../../../../api.config.js' // 公路类型选项 export const roadTypeOptions = ref([ { label: '全部', value: '' }, @@ -418,6 +419,56 @@ export const opencallConference = async (item) => { logUserOperation('phone-based-confirmation', JSON.stringify(jsobj)) } +// 基础 API 地址配置(根据当前网址动态判断)存在bxztpc时,外网地址,否则内网地址 +const BASE_API_URL = window.location.href.includes('bxztpc') + ? 'http://58.144.223.132:30008/' + : PROXY_TARGET + +// 从本地存储获取 token +const getTokenFromStorage = () => { + try { + // 尝试从 localStorage 获取 + const token = localStorage.getItem('token') + if (token) return token + + // 尝试从 sessionStorage 获取 + const sessionToken = sessionStorage.getItem('token') + if (sessionToken) return sessionToken + + return '' + } catch (error) { + console.error('获取 token 失败:', error) + return '' + } +} + +// 获取图片地址数组 +export const getImageUrlList = (fileIdStr) => { + if (!fileIdStr || typeof fileIdStr !== 'string') { + console.warn('fileIdStr 为空或不是字符串') + return [] + } + + // 按逗号分割字符串 + const fileIdList = fileIdStr.split(',').map(id => id.trim()).filter(id => id) + + if (fileIdList.length === 0) { + console.warn('fileIdStr 分割后为空') + return [] + } + + // 获取 token + const token = getTokenFromStorage() + + // 构建图片地址数组 + const imageUrlList = fileIdList.map(fileId => { + return `${BASE_API_URL}apis/file-api/private/preview?fileId=${fileId}&token=${token}` + }) + + console.log('生成的图片地址数组:', imageUrlList) + return imageUrlList +} + // 默认导出所有选项 export default { regionOptions, @@ -437,4 +488,5 @@ export default { openVideoConference, openVoiceConference, opencallConference, + getImageUrlList, } diff --git a/packages/screen/src/views/RiskWarning/index.vue b/packages/screen/src/views/RiskWarning/index.vue index 74cd302..e060a74 100644 --- a/packages/screen/src/views/RiskWarning/index.vue +++ b/packages/screen/src/views/RiskWarning/index.vue @@ -231,8 +231,6 @@ :data="hazardPointData" :title="hazardPointDialogTitle" @close="closeDialog('hazardPointSituation')" - @voice="openVoiceConference" - @video="openVideoConference" @call="handleCallClick" /> @@ -375,8 +373,7 @@ const roadItem = ref({}) const showRoadStats = ref(false) const roadItemClick = (item) => { console.log('点击路段:', item) - roadItem.value = {} - roadItem.value = item + roadItem.value = {...item} showRoadStats.value = true } diff --git a/packages/screen/src/views/RiskWarning/left.vue b/packages/screen/src/views/RiskWarning/left.vue index 0a5f7b3..7ef9c8b 100644 --- a/packages/screen/src/views/RiskWarning/left.vue +++ b/packages/screen/src/views/RiskWarning/left.vue @@ -5,12 +5,7 @@ @@ -19,13 +14,7 @@
气象预警
-
+
{{ item.value }}
@@ -130,12 +119,7 @@
-
+
{{ item.value }} @@ -148,48 +132,48 @@