增加获取图片,图片进行拼接地址。

This commit is contained in:
fanjia 2026-04-29 18:27:03 +08:00
parent fce1c6817e
commit 3b23b530d9
10 changed files with 595 additions and 1289 deletions

View File

@ -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,
}

View File

@ -52,6 +52,15 @@
</div>
</div>
</div>
<!-- 照片 - 路段数据展示 -->
<div v-if="isRoadData && hazardData.photos" class="info-block display">
<div class="block-title mr_10">照片</div>
<div class="photo-list">
<img v-for="(photo, index) in hazardData.photos" :key="index" :src="photo" class="photo-item" @click="previewPhoto(photo)" />
</div>
</div>
<!-- 风险描述 -->
<div class="info-block">
<div class="block-title">风险描述</div>
@ -188,14 +197,6 @@
<div class="block-title">备注</div>
<!-- <div class="block-content">{{ hazardData.remark }}</div> -->
</div>
<!-- 照片 - 路段数据展示 -->
<div v-if="isRoadData && hazardData.photos" class="info-block display jc_sb">
<div class="block-title">照片</div>
<div class="photo-list">
<img v-for="(photo, index) in hazardData.photos" :key="index" :src="photo" class="photo-item" @click="previewPhoto(photo)" />
</div>
</div>
</div>
</template>
</base-dialog>
@ -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 || [],
}
}
},

View File

@ -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 || '-',
},
}
}

View File

@ -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([

View File

@ -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,
}

View File

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

View File

@ -5,12 +5,7 @@
<template #left>
<div class="filter-header">
<span class="title">智能研判</span>
<img
class="filter-icon-ai"
src="../../assets/RiskWarning_img/AI1@2x.png"
alt=""
@click="handleAIClick"
/>
<img class="filter-icon-ai" src="../../assets/RiskWarning_img/AI1@2x.png" alt="" @click="handleAIClick" />
</div>
</template>
</SectionHeader>
@ -19,13 +14,7 @@
<div class="weather-warning-section">
<div class="section-title">气象预警</div>
<div class="warning-cards">
<div
v-for="(item, index) in weatherWarningData"
:key="index"
class="warning-card"
:class="item.class"
@click="handleWarningCardClick(item)"
>
<div v-for="(item, index) in weatherWarningData" :key="index" class="warning-card" :class="item.class" @click="handleWarningCardClick(item)">
<img class="card-icon" src="../../assets/RiskWarning_img/气象预警图标@2x.png" alt="" />
<div class="card-info">
<div class="card-num mt_5">{{ item.value }}</div>
@ -130,12 +119,7 @@
<!-- 3个调度清单卡片 -->
<div class="dispatch-cards">
<div
v-for="(item, index) in dispatchList"
:key="index"
class="dispatch-card clickable"
@click="handleDispatchCardClick(item)"
>
<div v-for="(item, index) in dispatchList" :key="index" class="dispatch-card clickable" @click="handleDispatchCardClick(item)">
<div class="card-num">
{{ item.value }}
<span class="unit"></span>
@ -148,48 +132,48 @@
</template>
<script setup>
import { ref, computed, onMounted, watch, inject } from 'vue';
import { request } from '@/utils/request';
import SectionHeader from './component/sectionHeader.vue';
import { ref, computed, onMounted, watch, inject } from 'vue'
import { request } from '@/utils/request'
import SectionHeader from './component/sectionHeader.vue'
//
import imgCall from '../../assets/RiskWarning_img/回应icon@2x.png';
import imgReply from '../../assets/RiskWarning_img/已回应icon@2x.png';
import imgRate from '../../assets/RiskWarning_img/回应率icon@2x.png';
import imgDistrict from '../../assets/RiskWarning_img/区县icon@2x.png';
import imgHelp from '../../assets/RiskWarning_img/响应图标5@2x.png';
import imgCheck from '../../assets/RiskWarning_img/抽查人数icon@2x.png';
import imgCall from '../../assets/RiskWarning_img/回应icon@2x.png'
import imgReply from '../../assets/RiskWarning_img/已回应icon@2x.png'
import imgRate from '../../assets/RiskWarning_img/回应率icon@2x.png'
import imgDistrict from '../../assets/RiskWarning_img/区县icon@2x.png'
import imgHelp from '../../assets/RiskWarning_img/响应图标5@2x.png'
import imgCheck from '../../assets/RiskWarning_img/抽查人数icon@2x.png'
//
const setRefreshLeftData = inject('setRefreshLeftData');
const setRefreshLeftData = inject('setRefreshLeftData')
//
const getdateRange = inject('getdateRange', ref([]));
const getdateRange = inject('getdateRange', ref([]))
//
watch(
() => getdateRange.value,
newVal => {
console.log('left.vue 日期范围变化:', newVal);
// init();
(newVal) => {
console.log('left.vue 日期范围变化:', newVal)
init()
},
{ deep: true }
);
{ deep: true },
)
onMounted(() => {
init();
init()
//
if (setRefreshLeftData) {
setRefreshLeftData(init);
setRefreshLeftData(init)
}
});
})
const init = () => {
roadTypeLoad();
districtLoadLoad();
dispatchLoadLoad();
scheduleStatisticsByCountyLoad();
loadData();
loadBarChartData();
};
roadTypeLoad() //
districtLoadLoad() //
dispatchLoadLoad() //
scheduleStatisticsByCountyLoad() //
loadData() //
loadBarChartData() //
}
const emit = defineEmits([
'openWarningInfo',
@ -204,61 +188,61 @@ const emit = defineEmits([
'openOfflineHelp',
'openImageInspection',
'closeImpactItem',
]);
])
//
const handleStatClick = item => {
const handleStatClick = (item) => {
if (item.label === '叫应总数') {
emit('openWarningInfo');
emit('dispatchDateRange', dateRange.value);
emit('openWarningInfo')
emit('dispatchDateRange', dateRange.value)
} else if (item.label === '已回应数') {
emit('openResponseStatus');
emit('dispatchDateRange', dateRange.value);
emit('openResponseStatus')
emit('dispatchDateRange', dateRange.value)
} else if (item.label === '调度区县数') {
emit('openDispatchDistrict');
emit('openDispatchDistrict')
} else if (item.label === '线下帮扶数') {
emit('openOfflineHelp');
emit('openOfflineHelp')
} else if (item.label === '抽查人次') {
emit('openImageInspection');
emit('openImageInspection')
}
};
}
//
const handleWarningCardClick = item => {
console.log('item:', item);
emit('openWarningSituation', item);
const handleWarningCardClick = (item) => {
console.log('item:', item)
emit('openWarningSituation', item)
//
emit('warningClick', item);
};
emit('warningClick', item)
}
//
const handleImpactDetailClick = () => {
emit('openImpactDetail');
emit('closeImpactItem', {});
};
emit('openImpactDetail')
emit('closeImpactItem', {})
}
//
const handleDispatchCardClick = item => {
const handleDispatchCardClick = (item) => {
if (item.label === dispatchList.value[0].label) {
emit('showCenterCard', {
type: 'second',
value: item.value,
data: nationalarr.value,
});
})
} else if (item.label === dispatchList.value[1].label) {
emit('showCenterCard', {
type: 'third',
value: item.value,
data: ruralarr.value,
});
})
} else if (item.label === dispatchList.value[2].label) {
emit('showCenterCard', {
type: 'first',
value: item.value,
data: projectarr.value,
});
})
}
};
}
//
const weatherWarningData = ref([
@ -266,7 +250,7 @@ const weatherWarningData = ref([
{ label: '橙色预警', value: '0', class: 'orange' },
{ label: '黄色预警', value: '0', class: 'yellow' },
{ label: '蓝色预警', value: '0', class: 'blue' },
]);
])
//
const impactData = ref([
@ -275,24 +259,24 @@ const impactData = ref([
{ name: '隧道', count: 0 },
{ name: '边坡', count: 0 },
{ name: '项目', count: 0 },
]);
])
const dateRange = ref([]);
const dateRange = ref([])
//
const handleDateRangeClick = val => {
dateRange.value = val;
dispatchLoadLoad();
};
const handleDateRangeClick = (val) => {
dateRange.value = val
dispatchLoadLoad()
}
//
const dispatchLoadLoad = async () => {
try {
// 00:00:0023:59:59
let start = '';
let end = '';
let start = ''
let end = ''
if (dateRange.value && dateRange.value.length === 2) {
start = formatDateTime(dateRange.value[0]);
end = formatDateTime(dateRange.value[1]);
start = formatDateTime(dateRange.value[0])
end = formatDateTime(dateRange.value[1])
}
const res = await request({
@ -302,173 +286,163 @@ const dispatchLoadLoad = async () => {
start: start,
end: end,
},
});
console.log(res);
})
console.log(res)
if (res.code == '00000') {
const data = res.data;
const data = res.data
if (data) {
responseStats.value.forEach(item => {
responseStats.value.forEach((item) => {
if (item.label == '叫应总数') {
item.value = data['noticeCount'] || 0;
item.value = data['noticeCount'] || 0
} else if (item.label == '已回应数') {
item.value = data['replyCount'] || 0;
item.value = data['replyCount'] || 0
} else if (item.label == '回应率') {
item.value = data['replyPrecent'] >= 0 ? data['replyPrecent'] + '%' : 0;
item.value = data['replyPrecent'] >= 0 ? data['replyPrecent'] + '%' : 0
} else if (item.label == '调度区县数') {
item.value = data['countyCount'] || 0;
item.value = data['countyCount'] || 0
} else if (item.label == '线下帮扶数') {
item.value = data['supportCount'] || 0;
item.value = data['supportCount'] || 0
} else if (item.label == '抽查人次') {
item.value = data['inspectionCount'] || 0;
item.value = data['inspectionCount'] || 0
}
});
dispatchList.value.forEach(item => {
})
dispatchList.value.forEach((item) => {
if (item.label == '国省道调度') {
item.value = data['nationalRoadCount'] || 0;
item.value = data['nationalRoadCount'] || 0
} else if (item.label == '农村公路调度') {
item.value = data['ruralRoadCount'] || 0;
item.value = data['ruralRoadCount'] || 0
} else if (item.label == '建设工程调度') {
item.value = data['projectCount'] || 0;
item.value = data['projectCount'] || 0
}
});
})
// responseStats.value = data;
// dispatchList.value = data;
} else {
responseStats.value.forEach(item => {
item.value = 0;
});
dispatchList.value.forEach(item => {
item.value = 0;
});
responseStats.value.forEach((item) => {
item.value = 0
})
dispatchList.value.forEach((item) => {
item.value = 0
})
}
}
} catch (error) {
console.error('加载数据失败:', error);
console.error('加载数据失败:', error)
}
};
}
watch(
() => dateRange.value,
newVal => {
console.log('left.vue 调度响应变化:', newVal);
dispatchLoadLoad();
(newVal) => {
console.log('left.vue 调度响应变化:', newVal)
dispatchLoadLoad()
},
{ deep: true }
);
{ deep: true },
)
//
const formatDateTime = date => {
if (!date) return '';
const d = new Date(date);
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, '0');
const day = String(d.getDate()).padStart(2, '0');
const hours = String(d.getHours()).padStart(2, '0');
const minutes = String(d.getMinutes()).padStart(2, '0');
const seconds = String(d.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
const formatDateTime = (date) => {
if (!date) return ''
const d = new Date(date)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
const hours = String(d.getHours()).padStart(2, '0')
const minutes = String(d.getMinutes()).padStart(2, '0')
const seconds = String(d.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
const getdateRangeTime = () => {
// 00:00:0023:59:59
let start = '';
let end = '';
let start = ''
let end = ''
if (getdateRange.value && getdateRange.value.length === 2) {
start = formatDateTime(getdateRange.value[0]);
end = formatDateTime(getdateRange.value[1]);
start = formatDateTime(getdateRange.value[0])
end = formatDateTime(getdateRange.value[1])
}
return {
start: start,
end: end,
};
};
}
}
//
const districtLoadLoad = async () => {
console.log('区县数据:', getdateRangeTime());
console.log('区县数据:', getdateRangeTime())
try {
const res = await request({
url: '/snow-ops-platform/weather-warning/affected-count/_by_county',
method: 'GET',
params: getdateRangeTime(),
});
console.log(res);
})
console.log(res)
if (res.code == '00000') {
const data = res.data;
const data = res.data
if (data) {
//
const simplifyDistrictName = name => {
if (!name) return name;
const simplifyDistrictName = (name) => {
if (!name) return name
return name
.replace('彭水苗族土家族自治县', '彭水县')
.replace('石柱土家族自治县', '石柱县')
.replace('秀山土家族苗族自治县', '秀山县')
.replace('酉阳土家族苗族自治县', '酉阳县');
};
.replace('酉阳土家族苗族自治县', '酉阳县')
}
//
const processedData = data.map(item => ({
const processedData = data.map((item) => ({
...item,
name: simplifyDistrictName(item.name),
}));
}))
//
const sortedData = processedData.sort((a, b) => {
const totalA =
(a.roadSectionCount || 0) +
(a.bridgeCount || 0) +
(a.tunnelCount || 0) +
(a.slopeCount || 0) +
(a.projectCount || 0);
const totalB =
(b.roadSectionCount || 0) +
(b.bridgeCount || 0) +
(b.tunnelCount || 0) +
(b.slopeCount || 0) +
(b.projectCount || 0);
return totalB - totalA; //
});
districtData.value = sortedData;
const totalA = (a.roadSectionCount || 0) + (a.bridgeCount || 0) + (a.tunnelCount || 0) + (a.slopeCount || 0) + (a.projectCount || 0)
const totalB = (b.roadSectionCount || 0) + (b.bridgeCount || 0) + (b.tunnelCount || 0) + (b.slopeCount || 0) + (b.projectCount || 0)
return totalB - totalA //
})
districtData.value = sortedData
} else {
districtData.value = [];
districtData.value = []
}
}
} catch (error) {
console.error('加载数据失败:', error);
console.error('加载数据失败:', error)
}
};
const roadTypeData = ref([]);
}
const roadTypeData = ref([])
//
const projectarr = ref([]);
const nationalarr = ref([]);
const ruralarr = ref([]);
const projectarr = ref([])
const nationalarr = ref([])
const ruralarr = ref([])
const scheduleStatisticsByCountyLoad = async () => {
try {
const res = await request({
url: '/snow-ops-platform/weather-warning/schedule-statistics/_by_county',
method: 'GET',
params: getdateRangeTime(),
});
console.log('调度统计区县数据:', res);
})
console.log('调度统计区县数据:', res)
if (res.code == '00000') {
const data = res.data;
const data = res.data
if (data) {
data.forEach(item => {
data.forEach((item) => {
if (item.countyName != '测试区县') {
if (item.type == 'project') {
projectarr.value.push(item);
projectarr.value.push(item)
} else if (item.roadType == 'national') {
nationalarr.value.push(item);
nationalarr.value.push(item)
} else if (item.roadType == 'rural') {
ruralarr.value.push(item);
ruralarr.value.push(item)
}
}
});
console.log(projectarr.value);
console.log(nationalarr.value);
console.log(ruralarr.value);
})
console.log(projectarr.value)
console.log(nationalarr.value)
console.log(ruralarr.value)
//
const mergeLiangjiangNewArea = arr => {
const yubeiItems = arr.filter(item => item.countyName === '渝北区');
const jiangbeiItems = arr.filter(item => item.countyName === '江北区');
const mergeLiangjiangNewArea = (arr) => {
const yubeiItems = arr.filter((item) => item.countyName === '渝北区')
const jiangbeiItems = arr.filter((item) => item.countyName === '江北区')
if (yubeiItems.length > 0 || jiangbeiItems.length > 0) {
//
@ -482,39 +456,37 @@ const scheduleStatisticsByCountyLoad = async () => {
replyCount: 0,
population: 0,
entityCount: 0,
};
}
//
yubeiItems.forEach(item => {
mergedItem.noticeCount += item.noticeCount || 0;
mergedItem.replyCount += item.replyCount || 0;
mergedItem.population += item.population || 0;
mergedItem.entityCount += item.entityCount || 0;
});
yubeiItems.forEach((item) => {
mergedItem.noticeCount += item.noticeCount || 0
mergedItem.replyCount += item.replyCount || 0
mergedItem.population += item.population || 0
mergedItem.entityCount += item.entityCount || 0
})
//
jiangbeiItems.forEach(item => {
mergedItem.noticeCount += item.noticeCount || 0;
mergedItem.replyCount += item.replyCount || 0;
mergedItem.population += item.population || 0;
mergedItem.entityCount += item.entityCount || 0;
});
jiangbeiItems.forEach((item) => {
mergedItem.noticeCount += item.noticeCount || 0
mergedItem.replyCount += item.replyCount || 0
mergedItem.population += item.population || 0
mergedItem.entityCount += item.entityCount || 0
})
//
const filteredArr = arr.filter(
item => item.countyName !== '渝北区' && item.countyName !== '江北区'
);
filteredArr.push(mergedItem);
return filteredArr;
const filteredArr = arr.filter((item) => item.countyName !== '渝北区' && item.countyName !== '江北区')
filteredArr.push(mergedItem)
return filteredArr
}
return arr;
};
return arr
}
//
projectarr.value = mergeLiangjiangNewArea(projectarr.value);
nationalarr.value = mergeLiangjiangNewArea(nationalarr.value);
ruralarr.value = mergeLiangjiangNewArea(ruralarr.value);
projectarr.value = mergeLiangjiangNewArea(projectarr.value)
nationalarr.value = mergeLiangjiangNewArea(nationalarr.value)
ruralarr.value = mergeLiangjiangNewArea(ruralarr.value)
// 15105
// projectarr.value = projectarr.value.filter((item, index) => index < 15);
@ -523,15 +495,15 @@ const scheduleStatisticsByCountyLoad = async () => {
// );
// ruralarr.value = ruralarr.value.filter((item, index) => index < 5);
} else {
projectarr.value = [];
nationalarr.value = [];
ruralarr.value = [];
projectarr.value = []
nationalarr.value = []
ruralarr.value = []
}
}
} catch (error) {
console.error('加载调度统计区县数据失败:', error);
console.error('加载调度统计区县数据失败:', error)
}
};
}
//
const roadTypeLoad = async () => {
@ -540,22 +512,22 @@ const roadTypeLoad = async () => {
url: '/snow-ops-platform/weather-warning/affected-count/_by_road',
method: 'GET',
params: getdateRangeTime(),
});
console.log(res);
})
console.log(res)
if (res.code == '00000') {
const data = res.data;
const data = res.data
if (data) {
roadTypeData.value = data.reverse();
roadTypeData.value = data.reverse()
} else {
roadTypeData.value.forEach(item => {
item.count = 0;
});
roadTypeData.value.forEach((item) => {
item.count = 0
})
}
}
} catch (error) {
console.error('加载数据失败:', error);
console.error('加载数据失败:', error)
}
};
}
//
const loadData = async () => {
try {
@ -563,45 +535,45 @@ const loadData = async () => {
url: '/snow-ops-platform/weather-warning/warning-count',
method: 'GET',
params: getdateRangeTime(),
});
})
if (res.code == '00000') {
const data = res.data;
const data = res.data
if (data) {
let obj = {};
data.forEach(item => {
obj[item.name] = item.count || 0;
});
console.log(obj);
weatherWarningData.value.forEach(item => {
let obj = {}
data.forEach((item) => {
obj[item.name] = item.count || 0
})
console.log(obj)
weatherWarningData.value.forEach((item) => {
if (item.label == '红色预警') {
item.value = obj['warning-red-count'] + '/' + obj['warning-red-total'] || '0/0';
item.value = obj['warning-red-count'] + '/' + obj['warning-red-total'] || '0/0'
} else if (item.label == '橙色预警') {
item.value = obj['warning-orange-count'] + '/' + obj['warning-orange-total'] || '0/0';
item.value = obj['warning-orange-count'] + '/' + obj['warning-orange-total'] || '0/0'
} else if (item.label == '黄色预警') {
item.value = obj['warning-yellow-count'] + '/' + obj['warning-yellow-total'] || '0/0';
item.value = obj['warning-yellow-count'] + '/' + obj['warning-yellow-total'] || '0/0'
} else if (item.label == '蓝色预警') {
item.value = obj['warning-blue-count'] + '/' + obj['warning-blue-total'] || '0/0';
item.value = obj['warning-blue-count'] + '/' + obj['warning-blue-total'] || '0/0'
}
});
})
} else {
weatherWarningData.value.forEach(item => {
weatherWarningData.value.forEach((item) => {
if (item.label == '红色预警') {
item.value = '0/0';
item.value = '0/0'
} else if (item.label == '橙色预警') {
item.value = '0/0';
item.value = '0/0'
} else if (item.label == '黄色预警') {
item.value = '0/0';
item.value = '0/0'
} else if (item.label == '蓝色预警') {
item.value = '0/0';
item.value = '0/0'
}
});
})
}
}
} catch (error) {
console.error('加载数据失败:', error);
console.error('加载数据失败:', error)
}
};
}
//
const loadBarChartData = async () => {
@ -610,10 +582,10 @@ const loadBarChartData = async () => {
url: '/snow-ops-platform/weather-warning/affected-count',
method: 'GET',
params: getdateRangeTime(),
});
})
if (res.code == '00000') {
const data = res.data;
const data = res.data
if (data.length > 0) {
//
const nameMap = {
@ -627,26 +599,26 @@ const loadBarChartData = async () => {
Tunnel: '隧道',
Slope: '边坡',
Project: '项目',
};
}
// name
const convertedData = data.map(item => {
const name = nameMap[item.name] || item.name;
return { ...item, name };
});
convertedData.forEach(item => {
const convertedData = data.map((item) => {
const name = nameMap[item.name] || item.name
return { ...item, name }
})
convertedData.forEach((item) => {
if (item.name == '路段') {
impactData.value[0].count = item.count || 0;
impactData.value[0].count = item.count || 0
} else if (item.name == '桥梁') {
impactData.value[1].count = item.count || 0;
impactData.value[1].count = item.count || 0
} else if (item.name == '隧道') {
impactData.value[2].count = item.count || 0;
impactData.value[2].count = item.count || 0
} else if (item.name == '边坡') {
impactData.value[3].count = item.count || 0;
impactData.value[3].count = item.count || 0
} else if (item.name == '项目') {
impactData.value[4].count = item.count || 0;
impactData.value[4].count = item.count || 0
}
});
})
} else {
//
@ -657,52 +629,52 @@ const loadBarChartData = async () => {
{ name: '隧道', count: 0 },
{ name: '边坡', count: 0 },
{ name: '项目', count: 0 },
])
);
]),
)
}
}
} catch (error) {
console.error('加载柱状图数据失败:', error);
console.error('加载柱状图数据失败:', error)
}
};
}
//
//
const totalValue = computed(() => {
let total = 0;
impactData.value.forEach(item => {
total += item.count || 0;
});
return total;
});
let total = 0
impactData.value.forEach((item) => {
total += item.count || 0
})
return total
})
//
const getBarHeight = value => {
const actualValue = value.count || value.value;
if (!actualValue || actualValue == 0) return '0';
const getBarHeight = (value) => {
const actualValue = value.count || value.value
if (!actualValue || actualValue == 0) return '0'
// 10%100%
const height = (actualValue / totalValue.value) * 300;
const height = (actualValue / totalValue.value) * 300
// 3%
// 100% 3%
console.log(height);
return Math.min(100, Math.max(3, Math.round(height)));
};
console.log(height)
return Math.min(100, Math.max(3, Math.round(height)))
}
const handleAIClick = () => {
emit('openAIResult');
};
emit('openAIResult')
}
// 1920px稿
const vw = px => {
return Math.round((px / 1920) * window.innerWidth);
};
const vw = (px) => {
return Math.round((px / 1920) * window.innerWidth)
}
//
const tableHeight = computed(() => {
return vw(100);
});
return vw(100)
})
//
const districtData = ref([]);
const districtData = ref([])
//
const responseStats = ref([
@ -742,14 +714,14 @@ const responseStats = ref([
iconClass: 'icon-check',
img: imgCheck,
},
]);
])
//
const dispatchList = ref([
{ label: '国省道调度', value: '341' },
{ label: '农村公路调度', value: '210' },
{ label: '建设工程调度', value: '120' },
]);
])
const headerCellStyle = () => ({
background: 'rgba(64, 169, 255, 0.1)',
@ -760,7 +732,7 @@ const headerCellStyle = () => ({
fontSize: '14px',
textAlign: 'center',
lineHeight: '1.2',
});
})
const cellStyle = () => ({
background: 'transparent',
@ -770,7 +742,7 @@ const cellStyle = () => ({
padding: ' 2px',
textAlign: 'center',
lineHeight: '1.2',
});
})
</script>
<style lang="scss" scoped>
@ -991,8 +963,7 @@ const cellStyle = () => ({
right: 0;
bottom: 0;
background-image:
linear-gradient(to right, transparent 0%, transparent 100%),
linear-gradient(to bottom, rgba(64, 169, 255, 0.1) 1px, transparent 1px);
linear-gradient(to right, transparent 0%, transparent 100%), linear-gradient(to bottom, rgba(64, 169, 255, 0.1) 1px, transparent 1px);
background-size: 100% 25%;
pointer-events: none;
}

View File

@ -8,12 +8,7 @@
<div class="prevention-section">
<!-- 第一行队伍人员装备物资 -->
<div class="resource-grid">
<div
v-for="(item, index) in resourceData"
:key="index"
class="resource-item"
@click="handleResourceClick(item)"
>
<div v-for="(item, index) in resourceData" :key="index" class="resource-item" @click="handleResourceClick(item)">
<!-- <div class="resource-icon" :class="item.iconClass"></div> -->
<img class="resource-icon" :src="item.img" alt="" />
<div class="resource-info">
@ -167,12 +162,7 @@
<div class="damage-section">
<div class="damage-title">灾害情况</div>
<div class="damage-grid">
<div
v-for="(item, index) in damageData"
:key="index"
class="damage-item"
:class="item.class"
>
<div v-for="(item, index) in damageData" :key="index" class="damage-item" :class="item.class">
<div class="damage-value">
{{ item.value }}
<span class="unit">{{ item.unit }}</span>
@ -192,29 +182,29 @@
</template>
<script setup>
import { ref, computed, onMounted, inject, watch } from 'vue';
import { request } from '@/utils/request';
import { ref, computed, onMounted, inject, watch } from 'vue'
import { request } from '@/utils/request'
import SectionHeader from './component/sectionHeader.vue';
import { Calendar } from '@element-plus/icons-vue';
import SectionHeader from './component/sectionHeader.vue'
import { Calendar } from '@element-plus/icons-vue'
import icon1 from '../../assets/RiskWarning_img/icon1@2x.png';
import icon2 from '../../assets/RiskWarning_img/icon2@2x.png';
import icon3 from '../../assets/RiskWarning_img/icon3@2x.png';
import icon4 from '../../assets/RiskWarning_img/icon4@2x.png';
import icon1 from '../../assets/RiskWarning_img/icon1@2x.png'
import icon2 from '../../assets/RiskWarning_img/icon2@2x.png'
import icon3 from '../../assets/RiskWarning_img/icon3@2x.png'
import icon4 from '../../assets/RiskWarning_img/icon4@2x.png'
import icon11 from '../../assets/RiskWarning_img/icon-1@2x.png';
import icon12 from '../../assets/RiskWarning_img/icon-2@2x.png';
import icon13 from '../../assets/RiskWarning_img/icon-3@2x.png';
import icon11 from '../../assets/RiskWarning_img/icon-1@2x.png'
import icon12 from '../../assets/RiskWarning_img/icon-2@2x.png'
import icon13 from '../../assets/RiskWarning_img/icon-3@2x.png'
import icon51 from '../../assets/RiskWarning_img/编组5@2x.png';
import icon52 from '../../assets/RiskWarning_img/编组22@2x.png';
import icon55 from '../../assets/RiskWarning_img/路径55@2x.png';
import icon51 from '../../assets/RiskWarning_img/编组5@2x.png'
import icon52 from '../../assets/RiskWarning_img/编组22@2x.png'
import icon55 from '../../assets/RiskWarning_img/路径55@2x.png'
import icon62 from '../../assets/RiskWarning_img/路径62@2x.png';
import icon621 from '../../assets/RiskWarning_img/路径62@2x (1).png';
import icon622 from '../../assets/RiskWarning_img/路径62@2x (2).png';
import { formatDateTime } from './component/index.js';
import icon62 from '../../assets/RiskWarning_img/路径62@2x.png'
import icon621 from '../../assets/RiskWarning_img/路径62@2x (1).png'
import icon622 from '../../assets/RiskWarning_img/路径62@2x (2).png'
import { formatDateTime } from './component/index.js'
const emit = defineEmits([
'openClearanceSituation',
@ -224,24 +214,24 @@ const emit = defineEmits([
'openPatrolMileage',
'openPatrolSituation',
'update:filterForm',
]);
])
//
const setRefreshRightData = inject('setRefreshRightData');
const getdateRange = inject('getdateRange', ref([]));
const setRefreshRightData = inject('setRefreshRightData')
const getdateRange = inject('getdateRange', ref([]))
const props = defineProps({});
const props = defineProps({})
//
const handleDateChange = val => {
dateRange.value = val;
getDisasterStats();
};
const handleDateChange = (val) => {
dateRange.value = val
getDisasterStats()
}
//
const handleDateRangeClick = val => {
dateRange.value = [];
getDisasterStats();
};
const handleDateRangeClick = (val) => {
dateRange.value = []
getDisasterStats()
}
//
const getYhYjllList = async () => {
@ -254,41 +244,41 @@ const getYhYjllList = async () => {
// latitude: 22.624722,
// maxDistance: 10 // 1000km
},
});
console.log(res);
})
console.log(res)
if (res.code == '00000') {
let gl1Rysls = 0; //
let gl1Yjllmcs = 0; //
res.data.forEach(item => {
let gl1Rysls = 0 //
let gl1Yjllmcs = 0 //
res.data.forEach((item) => {
if (item.gl1Lx == 1 || item.gl1Lx == 2) {
gl1Yjllmcs = gl1Yjllmcs + 1;
gl1Yjllmcs = gl1Yjllmcs + 1
}
gl1Rysls = Number(item.gl1Rysl) + gl1Rysls;
});
gl1Rysls = Number(item.gl1Rysl) + gl1Rysls
})
if (gl1Rysls > 10000) {
gl1Rysls = (gl1Rysls / 10000).toFixed(2);
resourceData.value[1].unit = '万人';
gl1Rysls = (gl1Rysls / 10000).toFixed(2)
resourceData.value[1].unit = '万人'
} else {
resourceData.value[1].value = gl1Rysls;
resourceData.value[1].unit = '人';
resourceData.value[1].value = gl1Rysls
resourceData.value[1].unit = '人'
}
resourceData.value[0].value = gl1Yjllmcs;
resourceData.value[0].value = gl1Yjllmcs
}
} catch (error) {
console.error('获取应急力量列表失败:', error);
console.error('获取应急力量列表失败:', error)
}
};
}
//
const getIconByType = type => {
const getIconByType = (type) => {
const iconMap = {
1: icon1, //
2: icon2, //
3: icon3, //
4: icon4, //
};
return iconMap[type] || icon1;
};
}
return iconMap[type] || icon1
}
//
const getYhYjllListMaterials = async () => {
@ -297,35 +287,35 @@ const getYhYjllListMaterials = async () => {
url: '/snow-ops-platform/yhYjll/listMaterials',
method: 'GET',
params: {},
});
console.log('物资列表:', res);
})
console.log('物资列表:', res)
if (res.code == '00000' && res.data) {
let equipment = 0; //
let materials = 0; //
let equipment = 0 //
let materials = 0 //
res.data.forEach(item => {
res.data.forEach((item) => {
if (item.gl1Wzlx == 1) {
equipment = equipment + extractAndSumNumbers(item.gl1Wzsl);
equipment = equipment + extractAndSumNumbers(item.gl1Wzsl)
} else if (item.gl1Wzlx == 2) {
materials = materials + extractAndSumNumbers(item.gl1Wzsl);
materials = materials + extractAndSumNumbers(item.gl1Wzsl)
}
});
})
if (materials > 10000) {
resourceData.value[3].value = (materials / 10000).toFixed(2);
resourceData.value[3].unit = '万件';
resourceData.value[3].value = (materials / 10000).toFixed(2)
resourceData.value[3].unit = '万件'
} else {
resourceData.value[3].value = materials;
resourceData.value[3].unit = '件';
resourceData.value[3].value = materials
resourceData.value[3].unit = '件'
}
console.log(equipment, materials);
console.log(equipment, materials)
//
resourceData.value[2].value = equipment || '0';
resourceData.value[2].value = equipment || '0'
}
} catch (error) {
console.error('获取物资列表失败:', error);
console.error('获取物资列表失败:', error)
}
};
}
//
const getControlStats = async () => {
@ -333,36 +323,36 @@ const getControlStats = async () => {
let params = {
start: '',
end: '',
};
}
if (getdateRange.value && getdateRange.value.length === 2) {
params.start = formatDateTime(getdateRange.value[0]);
params.end = formatDateTime(getdateRange.value[1]);
params.start = formatDateTime(getdateRange.value[0])
params.end = formatDateTime(getdateRange.value[1])
}
const res = await request({
url: '/snow-ops-platform/sm-event/dashboard/control-stats',
method: 'GET',
params: params,
});
console.log('管控统计数据:', res);
})
console.log('管控统计数据:', res)
if (res.code == '00000' && res.data) {
const data = res.data;
const data = res.data
// controlData1value
controlData1.value.forEach(item => {
controlData1.value.forEach((item) => {
if (item.label === '封闭管控数') {
item.value = data.fullClosureCount || '0';
item.value = data.fullClosureCount || '0'
} else if (item.label === '半幅通行数') {
item.value = data.halfClosureCount || '0';
item.value = data.halfClosureCount || '0'
} else if (item.label === '限速(限车型)数') {
item.value = data.speedLimitCount || '0';
item.value = data.speedLimitCount || '0'
} else if (item.label === '告警阻拦处数') {
item.value = data.warningBlockCount || '0';
item.value = data.warningBlockCount || '0'
}
});
})
}
} catch (error) {
console.error('获取管控统计数据失败:', error);
console.error('获取管控统计数据失败:', error)
}
};
}
//
const getRescueInputStats = async () => {
@ -370,50 +360,50 @@ const getRescueInputStats = async () => {
let params = {
start: '',
end: '',
};
}
if (getdateRange.value && getdateRange.value.length === 2) {
params.start = formatDateTime(getdateRange.value[0]);
params.end = formatDateTime(getdateRange.value[1]);
params.start = formatDateTime(getdateRange.value[0])
params.end = formatDateTime(getdateRange.value[1])
}
const res = await request({
url: '/snow-ops-platform/sm-event/dashboard/rescue-input-stats',
method: 'GET',
params: params,
});
console.log('抢险投入统计数据:', res);
})
console.log('抢险投入统计数据:', res)
if (res.code == '00000' && res.data) {
const data = res.data;
const data = res.data
// rescueDatavalue
rescueData.value.forEach(item => {
rescueData.value.forEach((item) => {
if (item.label === '本轮出动人次') {
item.value = data.investedManpower || '0';
item.unit = '人';
item.value = data.investedManpower || '0'
item.unit = '人'
if (item.value > 10000) {
item.value = (item.value / 10000).toFixed(2);
item.unit = '万人';
item.value = (item.value / 10000).toFixed(2)
item.unit = '万人'
}
} else if (item.label === '本轮出动设备') {
item.value = data.investedMachinery || '0';
item.unit = '台';
item.value = data.investedMachinery || '0'
item.unit = '台'
if (item.value > 10000) {
item.value = (item.value / 10000).toFixed(2);
item.unit = '万台';
item.value = (item.value / 10000).toFixed(2)
item.unit = '万台'
}
} else if (item.label === '清理塌方') {
//
item.value = data.clearedLandslide.toFixed(2) || 0;
item.unit = '立方米';
item.value = data.clearedLandslide.toFixed(2) || 0
item.unit = '立方米'
if (item.value > 10000) {
item.value = (item.value / 10000).toFixed(2);
item.unit = '万立方米';
item.value = (item.value / 10000).toFixed(2)
item.unit = '万立方米'
}
}
});
})
}
} catch (error) {
console.error('获取抢险投入统计数据失败:', error);
console.error('获取抢险投入统计数据失败:', error)
}
};
}
//
const getDisasterStats = async () => {
@ -421,146 +411,141 @@ const getDisasterStats = async () => {
let params = {
start: '',
end: '',
};
}
if (dateRange.value && dateRange.value.length === 2) {
params.start = formatDateTime(dateRange.value[0]);
params.end = formatDateTime(dateRange.value[1]);
params.start = formatDateTime(dateRange.value[0])
params.end = formatDateTime(dateRange.value[1])
}
const res = await request({
url: '/snow-ops-platform/sm-event/dashboard/disaster-stats',
method: 'GET',
params: params,
});
console.log('灾害统计数据:', res);
})
console.log('灾害统计数据:', res)
if (res.code == '00000' && res.data) {
const data = res.data;
const data = res.data
// blockDatavalue
blockData.value.forEach(item => {
blockData.value.forEach((item) => {
if (item.label === '今日新增阻断数') {
item.current = data.todayNormalCount || '0';
item.total = data.todayTotalCount || '0';
item.current = data.todayNormalCount || '0'
item.total = data.todayTotalCount || '0'
} else if (item.label === '本轮累计阻断数') {
item.current = data.roundNormalCount || '0';
item.total = data.roundTotalCount || '0';
item.current = data.roundNormalCount || '0'
item.total = data.roundTotalCount || '0'
}
});
})
// deathDatavalue
deathData.value.value = data.roundDeadCount || '0';
deathData.value.value = data.roundDeadCount || '0'
// damageDatavalue
damageData.value.forEach(item => {
damageData.value.forEach((item) => {
if (item.label === '本轮塌方量') {
data.roundLandslideVolume = data.roundLandslideVolume.toFixed(2);
data.roundLandslideVolume = data.roundLandslideVolume.toFixed(2)
if (data.roundLandslideVolume > 10000) {
item.value = (data.roundLandslideVolume / 10000).toFixed(2) || '0';
item.unit = '万立方米';
item.value = (data.roundLandslideVolume / 10000).toFixed(2) || '0'
item.unit = '万立方米'
} else {
item.value = data.roundLandslideVolume || '0';
item.unit = '立方米';
item.value = data.roundLandslideVolume || '0'
item.unit = '立方米'
}
} else if (item.label === '汛期塌方量') {
data.floodSeasonLandslideVolume = data.floodSeasonLandslideVolume.toFixed(2);
data.floodSeasonLandslideVolume = data.floodSeasonLandslideVolume.toFixed(2)
if (data.floodSeasonLandslideVolume > 10000) {
item.value = (data.floodSeasonLandslideVolume / 10000).toFixed(2) || '0';
item.unit = '万立方米';
item.value = (data.floodSeasonLandslideVolume / 10000).toFixed(2) || '0'
item.unit = '万立方米'
} else {
item.value = data.floodSeasonLandslideVolume || '0';
item.unit = '立方米';
item.value = data.floodSeasonLandslideVolume || '0'
item.unit = '立方米'
}
} else if (item.label === '当年塌方量') {
data.yearLandslideVolume = data.yearLandslideVolume.toFixed(2);
data.yearLandslideVolume = data.yearLandslideVolume.toFixed(2)
if (data.yearLandslideVolume > 10000) {
item.value = (data.yearLandslideVolume / 10000).toFixed(2) || '0';
item.unit = '万立方米';
item.value = (data.yearLandslideVolume / 10000).toFixed(2) || '0'
item.unit = '万立方米'
} else {
item.value = data.yearLandslideVolume || '0';
item.unit = '立方米';
item.value = data.yearLandslideVolume || '0'
item.unit = '立方米'
}
} else if (item.label === '本轮已损失') {
data.roundTotalLossAmount = data.roundTotalLossAmount.toFixed(2);
data.roundTotalLossAmount = data.roundTotalLossAmount.toFixed(2)
if (data.roundTotalLossAmount > 10000) {
item.value = (data.roundTotalLossAmount / 10000).toFixed(2) || '0';
item.unit = '亿元';
item.value = (data.roundTotalLossAmount / 10000).toFixed(2) || '0'
item.unit = '亿元'
} else {
item.value = data.roundTotalLossAmount || '0';
item.unit = '万元';
item.value = data.roundTotalLossAmount || '0'
item.unit = '万元'
}
} else if (item.label === '汛期已损失') {
data.floodSeasonTotalLossAmount = data.floodSeasonTotalLossAmount.toFixed(2);
data.floodSeasonTotalLossAmount = data.floodSeasonTotalLossAmount.toFixed(2)
if (data.floodSeasonTotalLossAmount > 10000) {
item.value = (data.floodSeasonTotalLossAmount / 10000).toFixed(2) || '0';
item.unit = '亿元';
item.value = (data.floodSeasonTotalLossAmount / 10000).toFixed(2) || '0'
item.unit = '亿元'
} else {
item.value = data.floodSeasonTotalLossAmount || '0';
item.unit = '万元';
item.value = data.floodSeasonTotalLossAmount || '0'
item.unit = '万元'
}
} else if (item.label === '当年已损失') {
data.yearTotalLossAmount = data.yearTotalLossAmount.toFixed(2);
data.yearTotalLossAmount = data.yearTotalLossAmount.toFixed(2)
if (data.yearTotalLossAmount > 10000) {
item.value = (data.yearTotalLossAmount / 10000).toFixed(2) || '0';
item.unit = '亿元';
item.value = (data.yearTotalLossAmount / 10000).toFixed(2) || '0'
item.unit = '亿元'
} else {
item.value = data.yearTotalLossAmount || '0';
item.unit = '万元';
item.value = data.yearTotalLossAmount || '0'
item.unit = '万元'
}
}
});
})
}
} catch (error) {
console.error('获取灾害统计数据失败:', error);
console.error('获取灾害统计数据失败:', error)
}
};
}
//
const extractAndSumNumbers = value => {
const extractAndSumNumbers = (value) => {
//
if (typeof value === 'number') {
return value;
return value
}
// 0
if (!value || typeof value !== 'string') return 0;
if (!value || typeof value !== 'string') return 0
//
const numbers = value.match(/\d+\.?\d*/g);
if (!numbers) return 0;
const numbers = value.match(/\d+\.?\d*/g)
if (!numbers) return 0
//
return numbers.reduce((sum, num) => sum + Number(num), 0);
};
return numbers.reduce((sum, num) => sum + Number(num), 0)
}
//
const handleControlClick = item => {
if (
item.label === '封闭管控数' ||
item.label === '半幅通行数' ||
item.label === '限速(限车型)数' ||
item.label === '告警阻拦处数'
) {
emit('openClearanceSituation');
emit('update:dateRange', getdateRange.value || []);
emit('update:filterForm', item || {});
const handleControlClick = (item) => {
if (item.label === '封闭管控数' || item.label === '半幅通行数' || item.label === '限速(限车型)数' || item.label === '告警阻拦处数') {
emit('openClearanceSituation')
emit('update:dateRange', getdateRange.value || [])
emit('update:filterForm', item || {})
} else if (item.label === '停工项目数' || item.label === '关闭驻地数') {
emit('openControlSituation');
emit('openControlSituation')
}
};
}
//
const handleBlockClick = () => {
emit('openClearanceSituation');
emit('update:filterForm', {});
};
emit('openClearanceSituation')
emit('update:filterForm', {})
}
//
const handlePatrolClick = () => {
emit('openPatrolMileage');
};
emit('openPatrolMileage')
}
//
const handlePatrolSituationClick = () => {
emit('openPatrolSituation');
};
emit('openPatrolSituation')
}
//
const dateRange = ref([]);
const dateRange = ref([])
//
const resourceData = ref([
@ -592,12 +577,12 @@ const resourceData = ref([
iconClass: 'icon-material',
img: icon4,
},
]);
])
//
const handleResourceClick = item => {
emit('openResourceDetail', item);
};
const handleResourceClick = (item) => {
emit('openResourceDetail', item)
}
//
const controlData1 = ref([
@ -605,12 +590,12 @@ const controlData1 = ref([
{ label: '半幅通行数', value: '40' },
{ label: '限速(限车型)数', value: '24' },
{ label: '告警阻拦处数', value: '32' },
]);
])
const controlData2 = ref([
{ label: '停工项目数', value: '0', key: 'stoped_project_count' },
{ label: '关闭驻地数', value: '0', key: 'closed_site_count' },
{ label: '转移撤离人员数', value: '0', key: 'displaced_population' },
]);
])
//
const getAffectedCountByProject = async () => {
@ -618,31 +603,31 @@ const getAffectedCountByProject = async () => {
let params = {
start: '',
end: '',
};
}
if (getdateRange.value && getdateRange.value.length === 2) {
params.start = formatDateTime(getdateRange.value[0]);
params.end = formatDateTime(getdateRange.value[1]);
params.start = formatDateTime(getdateRange.value[0])
params.end = formatDateTime(getdateRange.value[1])
}
const res = await request({
url: '/snow-ops-platform/weather-warning/affected-count/_by_project',
method: 'GET',
params: params,
});
console.log('气象预警受影响统计:', res);
})
console.log('气象预警受影响统计:', res)
if (res.code === '00000' && res.data) {
const data = res.data;
const data = res.data
// controlData2
controlData2.value.forEach(item => {
const matchedData = data.find(d => d.name === item.key);
controlData2.value.forEach((item) => {
const matchedData = data.find((d) => d.name === item.key)
if (matchedData) {
item.value = String(matchedData.count);
item.value = String(matchedData.count)
}
});
})
}
} catch (error) {
console.error('获取气象预警受影响统计失败:', error);
console.error('获取气象预警受影响统计失败:', error)
}
};
}
//
const patrolData = ref([
@ -651,10 +636,10 @@ const patrolData = ref([
{ label: '巡查边坡数', value: '0', key: 'slopeInspectionCount' },
{ label: '巡查隧道数', value: '0', key: 'tunnelInspectionCount' },
{ label: '发现隐患数', value: '0', key: 'hiddenDangerCount' },
]);
])
//
const roadInspectionMileage = ref('0');
const roadInspectionMileage = ref('0')
//
const getInspectionStats = async () => {
@ -662,40 +647,40 @@ const getInspectionStats = async () => {
let params = {
start: '',
end: '',
};
}
if (getdateRange.value && getdateRange.value.length === 2) {
params.start = formatDateTime(getdateRange.value[0]);
params.end = formatDateTime(getdateRange.value[1]);
params.start = formatDateTime(getdateRange.value[0])
params.end = formatDateTime(getdateRange.value[1])
}
const res = await request({
url: '/snow-ops-platform/yhWgxc/weather-warning/inspection-stats',
method: 'GET',
params: params,
});
console.log('巡查统计数据:', res);
})
console.log('巡查统计数据:', res)
if (res.code == '00000' && res.data) {
const data = res.data;
const data = res.data
//
roadInspectionMileage.value = data.roadInspectionMileage || '0';
roadInspectionMileage.value = data.roadInspectionMileage || '0'
// patrolDatavalue
patrolData.value.forEach(item => {
patrolData.value.forEach((item) => {
if (item.key === 'roadSectionInspectionCount') {
item.value = data.roadSectionInspectionCount || '0';
item.value = data.roadSectionInspectionCount || '0'
} else if (item.key === 'bridgeInspectionCount') {
item.value = data.bridgeInspectionCount || '0';
item.value = data.bridgeInspectionCount || '0'
} else if (item.key === 'slopeInspectionCount') {
item.value = data.slopeInspectionCount || '0';
item.value = data.slopeInspectionCount || '0'
} else if (item.key === 'tunnelInspectionCount') {
item.value = data.tunnelInspectionCount || '0';
item.value = data.tunnelInspectionCount || '0'
} else if (item.key === 'hiddenDangerCount') {
item.value = data.hiddenDangerCount || '0';
item.value = data.hiddenDangerCount || '0'
}
});
})
}
} catch (error) {
console.error('获取巡查统计数据失败:', error);
console.error('获取巡查统计数据失败:', error)
}
};
}
//
const rescueData = ref([
@ -720,16 +705,16 @@ const rescueData = ref([
iconClass: 'icon-rescue-clear',
img: icon13,
},
]);
])
// -
const blockData = ref([
{ label: '今日新增阻断数', current: '19', total: '23' },
{ label: '本轮累计阻断数', current: '10', total: '23' },
]);
])
//
const deathData = ref({ label: '本轮因灾伤亡人数', value: '5' });
const deathData = ref({ label: '本轮因灾伤亡人数', value: '5' })
//
const damageData = ref([
@ -739,44 +724,42 @@ const damageData = ref([
{ label: '本轮已损失', value: '80', unit: '万元', class: 'red' },
{ label: '汛期已损失', value: '18', unit: '万元', class: 'red' },
{ label: '当年已损失', value: '350', unit: '万元', class: 'red' },
]);
])
//
const majorEvent = '0';
const majorEvent = '0'
// watch
const init = () => {
console.log('right.vue 刷新数据');
getYhYjllList(); //
getYhYjllListMaterials(); //
console.log('right.vue 刷新数据')
getYhYjllList() //
getYhYjllListMaterials() //
getControlStats(); //
getAffectedCountByProject(); //
getRescueInputStats(); //
getControlStats() //
getAffectedCountByProject() //
getRescueInputStats() //
getDisasterStats(); //
getInspectionStats(); //
};
getDisasterStats() //
getInspectionStats() //
}
//
onMounted(() => {
init();
init()
//
if (setRefreshRightData) {
setRefreshRightData(init);
setRefreshRightData(init)
}
});
})
watch(
() => getdateRange.value,
newVal => {
console.log('right.vue 日期范围变化:', newVal);
if (newVal && newVal.length === 2) {
init();
}
(newVal) => {
console.log('right.vue 日期范围变化:', newVal)
init()
},
{ deep: true, immediate: true }
);
{ deep: true, immediate: true },
)
</script>
<style lang="scss" scoped>

View File

@ -6,6 +6,7 @@ import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import cesium from 'vite-plugin-cesium'
import { PROXY_TARGET } from './api.config.js'
const DEFAULT_BUILD_BASE = '/bxztpc/'
@ -93,9 +94,7 @@ export default defineConfig(({ command, mode }) => {
cors: true,
proxy: {
'/snow-ops-platform': {
// target: 'http://192.168.110.16:8661/',
target: 'http://8.137.54.85:8661/', //测试环境
// target: 'http://192.168.110.36:8661/', //张启生本地环境
target: PROXY_TARGET,
changeOrigin: true,
},
}

754
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff