From 3ea367398d83cc5774fec08dee8279d137802cbd Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期五, 30 一月 2026 10:02:04 +0800
Subject: [PATCH] 修改
---
screen/.env.development | 2
screen/src/view/projectHome/index.vue | 86 +++++++++++++++++++---------
screen/src/view/hiddenDanger/index.vue | 6 +-
screen/src/view/planOfAudit/index.vue | 34 +++++++++--
screen/src/view/projectList/service.js | 2
5 files changed, 90 insertions(+), 40 deletions(-)
diff --git a/screen/.env.development b/screen/.env.development
index 38238ab..e3fa793 100644
--- a/screen/.env.development
+++ b/screen/.env.development
@@ -1,7 +1,7 @@
# 开发环境配置
# 主API地址
-VUE_APP_BASE_URL=http://192.168.110.64:9908
+VUE_APP_BASE_URL=http://221.182.45.100:8180
# 图片回显地址
VUE_APP_IMAGE_BASE_URL=http://221.182.45.100:8180
diff --git a/screen/src/view/hiddenDanger/index.vue b/screen/src/view/hiddenDanger/index.vue
index 9d6a08a..24adde6 100644
--- a/screen/src/view/hiddenDanger/index.vue
+++ b/screen/src/view/hiddenDanger/index.vue
@@ -863,7 +863,7 @@
return;
}
- const res = await getProjectList({ clientId: clientId, projectCategory: ["ongoing", "fixed"][localStorage.getItem('activeTab') - 1] });
+ const res = await getProjectList({ clientId: clientId, projectCategory: this.projectCategory });
if (res && res) {
this.projectList = res.map((item) => ({
label: item.name,
@@ -972,8 +972,8 @@
// 获取隐患等级文本
getLevelText(level) {
-
-
+
+
return this.levelOptions[level].label || '-'
},
diff --git a/screen/src/view/planOfAudit/index.vue b/screen/src/view/planOfAudit/index.vue
index bc71247..562c6ba 100644
--- a/screen/src/view/planOfAudit/index.vue
+++ b/screen/src/view/planOfAudit/index.vue
@@ -445,6 +445,9 @@
loading: false,
showPreview: false, // 是否显示预览
+ // 图片基础路径
+ VUE_APP_IMAGE_BASE_URL: process.env.VUE_APP_IMAGE_BASE_URL,
+
// 枚举映射
planTypeMap: planTypeMap, // 计划类型映射
riskLevelMap: {
@@ -585,7 +588,7 @@
// 打开检查资料列表弹窗
async openCheckMaterialDialog(row) {
this.currentRow = row;
- this.currentPlanId = row.id;
+ this.currentPlanId = row.planId;
this.projectVisible = true;
await this.getCheckMaterialList();
},
@@ -888,15 +891,32 @@
return "-";
},
- // 处理图片数组(字符串转数组)
+ // 处理图片数组(字符串转数组,并拼接完整URL)
parseImages(imgStr) {
if (!imgStr) return [];
- if (Array.isArray(imgStr)) return imgStr;
- try {
- return imgStr.split(",").filter((item) => item);
- } catch (error) {
- return [];
+ let imgArray = [];
+
+ // 如果已经是数组,直接使用
+ if (Array.isArray(imgStr)) {
+ imgArray = imgStr;
+ } else {
+ // 如果是字符串,按逗号分割
+ try {
+ imgArray = imgStr.split(",").filter((item) => item);
+ } catch (error) {
+ return [];
+ }
}
+
+ // 拼接完整的图片URL(参考header的方式)
+ return imgArray.map((img) => {
+ // 如果已经是完整URL(http或https开头),直接返回
+ if (img.startsWith('http://') || img.startsWith('https://')) {
+ return img;
+ }
+ // 否则拼接基础路径
+ return this.VUE_APP_IMAGE_BASE_URL + '/project/download/' + img;
+ });
},
// 预览图片
diff --git a/screen/src/view/projectHome/index.vue b/screen/src/view/projectHome/index.vue
index df36c58..93ed032 100644
--- a/screen/src/view/projectHome/index.vue
+++ b/screen/src/view/projectHome/index.vue
@@ -17,10 +17,10 @@
<template #content>
<div class="project-info">
<div class="info-item">
- <!-- <div class="flex2 flex">
- <div class="label">项目编号</div>
- <div class="value">{{ projectInfo.code || '-' }}</div>
- </div> -->
+ <div class="flex2 flex">
+ <div class="label">项目规模</div>
+ <div class="value">{{ `${projectInfo.scale}平方米` || '-' }}</div>
+ </div>
<div class="flex1 flex">
<div class="label">工程类型</div>
<div class="value">{{ ['房建工程','市政工程','固定资产'][projectInfo.type] }}</div>
@@ -399,6 +399,7 @@
return {
mapView: null,
mapPromise: null,
+ currentMarker: null, // 保存当前的 marker 实例
dateRange: [moment().subtract(5, 'months').startOf("month"), moment().endOf("month")], //默认近6个月
markers: [],
projectId: '',
@@ -520,7 +521,7 @@
this.projectId = this.$route.query.projectId || ''
// 添加错误处理,确保登录信息获取失败不影响其他模块
getLoginInfo({ id: this.projectId, type: 2 }).then(res => {
-
+
this.projectName = res.name
const permissions = res.permissionProject ? res.permissionProject.split(",") : []
this.permissionProject = permissions
@@ -544,9 +545,14 @@
mounted() {
this.setMapload()
setTimeout(() => {
-
this.initRiskChart()
}, 1000)
+ },
+ activated() {
+ // 当从其他页面返回时,重新设置地图 marker
+ if (this.mapView && this.projectInfo.type !== undefined) {
+ this.updateMapMarker()
+ }
},
beforeDestroy() { },
methods: {
@@ -663,7 +669,7 @@
});
const contentType = response.headers.get('Content-Type') || '';
-
+
// 判断是否为视频
if (contentType.startsWith('video/')) {
@@ -731,7 +737,12 @@
developmentCompanyInfo: developmentCompanyInfo,
supervisorCompanyInfo: supervisorCompanyInfo,
}
-
+
+ // 项目信息加载完成后,更新地图 marker
+ this.$nextTick(() => {
+ this.updateMapMarker()
+ })
+
}).catch(err => {
console.error('获取项目详情失败:', err)
// 设置默认值
@@ -768,7 +779,7 @@
// 隐患数量 - 添加错误处理
getDangerCount(this.projectId).then(res => {
this.dangerCount = res
-
+
}).catch(err => {
console.error('获取隐患数量失败:', err)
this.dangerCount = {
@@ -935,25 +946,44 @@
layers: [satellite],
});
- // 在地图中心添加marker
- const marker = new AMap.Marker({
- position: [104.065617, 30.65695], // 使用地图中心点坐标
- icon: new AMap.Icon({
- image:[require('../../assets/img/home/f4.png'),require('../../assets/img/home/s4.png'),require('../../assets/img/home/z4.png')][this.projectInfo.type] ,
- size: new AMap.Size(30, 30),
- imageSize: new AMap.Size(30, 30)
- }),
- offset: new AMap.Pixel(-15, -15) // 设置偏移量,使图标中心对准坐标点
- });
-
- // 将marker添加到地图
- this.mapView.add(marker);
-
+ // 初始化时不立即添加 marker,等待项目信息加载完成后再添加
// this.initCategoryMarkers(AMap);
})
.catch((e) => {
console.error(e); //加载错误提示
});
+ },
+ // 更新地图 marker
+ updateMapMarker() {
+ if (!this.mapView) return;
+
+ // 清除旧的 marker
+ if (this.currentMarker) {
+ this.mapView.remove(this.currentMarker);
+ }
+
+ // 根据项目类型选择图标
+ const iconImages = [
+ require('../../assets/img/home/f4.png'),
+ require('../../assets/img/home/s4.png'),
+ require('../../assets/img/home/z4.png')
+ ];
+
+ const iconImage = iconImages[this.projectInfo.type] || iconImages[0];
+
+ // 创建新的 marker
+ this.currentMarker = new AMap.Marker({
+ position: [104.065617, 30.65695],
+ icon: new AMap.Icon({
+ image: iconImage,
+ size: new AMap.Size(30, 30),
+ imageSize: new AMap.Size(30, 30)
+ }),
+ offset: new AMap.Pixel(-15, -15)
+ });
+
+ // 将 marker 添加到地图
+ this.mapView.add(this.currentMarker);
},
// 初始化 3D 环饼图(echarts-gl)
initPie3D() {
@@ -1323,7 +1353,7 @@
// 向每个 series-surface 传入不同的参数方程 series-surface.parametricEquation,也就是实现每一个扇形。
for (let i = 0; i < series.length; i++) {
endValue = startValue + series[i].pieData.value;
-
+
series[i].pieData.startRatio = startValue / sumValue;
series[i].pieData.endRatio = endValue / sumValue;
series[i].parametricEquation = this.getParametricEquation(
@@ -1407,7 +1437,7 @@
try {
const res = await getProjectDangerousTrend(params);
-
+
if (res && Array.isArray(res)) {
// 处理接口返回的数据
@@ -1415,7 +1445,7 @@
// 将A、B、C转换为数值 3、2、1
this.riskTrendData.seriesData = res.map(item => {
const value = this.levelToValue(item.level);
-
+
return value;
});
@@ -2298,13 +2328,13 @@
.progress-num {
font-weight: 800;
- font-size: 18px;
+ font-size: 14px;
color: #66ffff;
}
.progress-unit {
font-weight: 800;
- font-size: 12px;
+ font-size: 10px;
color: #66ffff;
margin-left: 2px;
}
diff --git a/screen/src/view/projectList/service.js b/screen/src/view/projectList/service.js
index f4258bc..2f3e500 100644
--- a/screen/src/view/projectList/service.js
+++ b/screen/src/view/projectList/service.js
@@ -40,7 +40,7 @@
// 抛出错误信息
return Promise.reject({
- message: errorData.message || errorData.msg || '操作失败',
+ message: errorData.errorMsg || errorData.msg || '操作失败',
data: errorData
})
} catch (e) {
--
Gitblit v1.7.1