fix:修改地图展示1

This commit is contained in:
SunTao 2025-04-10 16:59:38 +08:00
parent 22d329922a
commit 815a510667
10 changed files with 483 additions and 61 deletions

View File

@ -47,6 +47,7 @@
"diagram-js": "^11.4.1", "diagram-js": "^11.4.1",
"echarts": "^5.4.0", "echarts": "^5.4.0",
"echarts-gl": "^2.0.9", "echarts-gl": "^2.0.9",
"element-resize-detector": "^1.2.4",
"element-ui": "2.15.14", "element-ui": "2.15.14",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"flv.js": "^1.6.2", "flv.js": "^1.6.2",

18
src/api/xj/diseaseLine.js Normal file
View File

@ -0,0 +1,18 @@
/*
* @Author: SunTao 328867980@qq.com
* @Date: 2025-04-08 13:47:06
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2025-04-08 13:49:28
* @FilePath: \znxjxt-ui\src\api\xj\diseaseLine.js
* @Description: 巡检信息-护拦板高度
*/
import request from "@/utils/request";
// 获取护拦板高度列表
export function getBarrierBoardList(query) {
return request({
url: "/barrierBoard/list",
method: "get",
params: query,
});
}

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-08 09:26:24 * @Date: 2024-10-08 09:26:24
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-05 13:40:07 * @LastEditTime: 2025-04-08 13:42:28
* @FilePath: \znxjxt-ui\src\api\xj\mapDisease.js * @FilePath: \znxjxt-ui\src\api\xj\mapDisease.js
* @Description: 巡检信息-病害管理接口 * @Description: 巡检信息-病害管理接口
*/ */
@ -16,3 +16,12 @@ export function getSegment() {
method: "post", method: "post",
}); });
} }
// 查询轮廓标缺失列表
export function getDelineatorList(params) {
return request({
url: "/delineator/list",
method: "get",
params,
});
}

BIN
src/assets/index/green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
src/assets/index/nomal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-14 10:46:23 * @Date: 2024-10-14 10:46:23
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2025-03-28 13:51:38 * @LastEditTime: 2025-03-31 13:02:21
* @FilePath: \znxjxt-ui\src\components\map\fssm-map.vue * @FilePath: \znxjxt-ui\src\components\map\fssm-map.vue
* @Description: 公共地图 * @Description: 公共地图
--> -->
@ -130,6 +130,11 @@ export default {
type: String, type: String,
default: "cva_c", default: "cva_c",
}, },
//
popupType: {
type: String,
default: "mapLine",
},
}, },
data() { data() {
return { return {
@ -459,10 +464,14 @@ export default {
// //
const popupData = feature.get("data"); const popupData = feature.get("data");
// //
if (this.popupType === "mapLine") {
this.$refs.popupContent.innerHTML = `<span>路段名称:</span><span>${popupData.name}</span><br/> this.$refs.popupContent.innerHTML = `<span>路段名称:</span><span>${popupData.name}</span><br/>
<span>病害数</span><span>${popupData.count}</span><br/> <span>病害数</span><span>${popupData.count}</span><br/>
<span>起始桩号</span><span>${popupData.stakeStart}</span><br/> <span>起始桩号</span><span>${popupData.stakeStart}</span><br/>
<span>终止桩号</span><span>${popupData.stakeEnd}</span>`; <span>终止桩号</span><span>${popupData.stakeEnd}</span>`;
} else if (this.popupType === "dieaseLine") {
this.$refs.popupContent.innerHTML = `<span>护拦板高度:</span><span>${popupData.value}</span>`;
}
dislogLay.setPosition(coordinate); dislogLay.setPosition(coordinate);
} else { } else {
dislogLay.setPosition(undefined); dislogLay.setPosition(undefined);

View File

@ -719,7 +719,7 @@ export default {
if (code === 200) { if (code === 200) {
this.messageList = rows; this.messageList = rows;
this.noticeNum = total; this.noticeNum = total;
if(total > 99){ if (total > 99) {
clearInterval(this.messageTimer); clearInterval(this.messageTimer);
} }
} }

View File

@ -0,0 +1,74 @@
<!--
* @Author: SunTao 328867980@qq.com
* @Date: 2025-03-25 11:10:16
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2025-04-08 13:56:59
* @FilePath: \znxjxt-ui\src\views\xj\inspection\diease-line\index.vue
* @Description: 地图展示病害-首页
-->
<template>
<div class="diease-line-content">
<fssm-map class="map-diease-map" :popupType="'dieaseLine'"></fssm-map>
</div>
</template>
<script>
import { getBarrierBoardList } from "@/api/xj/diseaseLine";
import FssmMap from "@/components/map/fssm-map.vue";
export default {
name: "DieaseLine",
components: {
FssmMap,
},
data() {
return {
pointList: [],
lineList: [],
};
},
created() {
this.getMapPoint();
},
methods: {
/**
* @description: 获取地图点位数据
* @param {*}
* @return {*}
*/
getMapPoint() {
getBarrierBoardList({ page: 0, size: 100000 }).then(({ code, data }) => {
if (code === 200) {
console.log(data, "dfdfdf");
}
});
},
/**
* @description: 绘制地图点位
* @param {*}
* @return {*}
*/
drawMapPoint() {},
/**
* @description: 绘制地图线段
* @param {*}
* @return {*}
*/
drawMap() {},
},
};
</script>
<style lang="scss" scoped>
.diease-line-content {
width: 100%;
height: calc(100vh - 5.3rem);
padding: 0.5rem;
.map-diease-map {
width: 100%;
height: 100%;
}
}
</style>

View File

@ -0,0 +1,40 @@
<!--
* @Author: SunTao 328867980@qq.com
* @Date: 2025-04-10 16:44:08
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2025-04-10 16:50:40
* @FilePath: \znxjxt-ui\src\views\xj\inspection\map-diease\components\diease-view.vue
* @Description: 巡检信息-地图展示1
-->
<template>
<div class="view-diease">
<el-carousel arrow="always" :autoplay="false">
<el-carousel-item
v-for="(item, index) in dislogItem"
:key="`carousel-${index}`"
>
<image :src="item.img" mode="scaleToFill" />
</el-carousel-item>
</el-carousel>
</div>
</template>
<script>
export default {
name: "DieaseView",
props: {
dislogItem: {
type: Array,
default: () => [],
},
},
data() {
return {};
},
created() {},
methods: {},
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -2,12 +2,13 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2025-03-25 11:10:16 * @Date: 2025-03-25 11:10:16
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2025-03-28 14:14:07 * @LastEditTime: 2025-04-10 16:51:45
* @FilePath: \znxjxt-ui\src\views\xj\inspection\map-diease\index.vue * @FilePath: \znxjxt-ui\src\views\xj\inspection\map-diease\index.vue
* @Description: 地图展示病害-首页 * @Description: 地图展示筛选病害-首页
--> -->
<template> <template>
<div class="map-diease-content"> <div class="map-diease-content">
<div class="diease-left">
<div class="diease-form"> <div class="diease-form">
<el-form <el-form
:model="queryParams" :model="queryParams"
@ -43,15 +44,89 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<fssm-map class="map-diease-map" :maxZoom="22"></fssm-map> <!-- 列表 -->
<el-table
ref="roadTable"
v-loading="loading"
:data="tableList"
style="width: 100%"
@row-dblclick="handleCurrentChange"
>
<el-table-column label="路段名称" align="center" prop="segmentName">
</el-table-column>
<el-table-column label="类型" align="center" prop="defectTypeName" />
<el-table-column label="开始桩号" align="center" prop="stakeStart" />
<el-table-column label="结束桩号" align="center" prop="stakeEnd" />
<el-table-column
label="创建时间"
align="center"
prop="createdTimeLocal"
>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="viewMapPicture(scope.row)"
>查看
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<div class="pagination-part">
<el-pagination
background
:current-page.sync="pagination.page"
@current-change="handleCurrentChange"
:page-sizes="[10, 20, 30, 40]"
:page-size.sync="pagination.size"
@size-change="handleSizeChange"
layout="total, sizes, prev, pager, next, jumper"
:total="tableTotal"
>
</el-pagination>
</div>
</div>
<fssm-map
ref="mapDieaseMap"
class="map-diease-map"
:maxZoom="24"
@feature-select="featureSelect"
></fssm-map>
<!-- 查看弹窗 -->
<el-dialog
title="查看"
:visible.sync="viewVisible"
width="80rem"
append-to-body
:close-on-click-modal="false"
destroy-on-close
@close="viewCancel"
>
<diease-view v-if="viewVisible" :dislogItem="dislogItem"></diease-view>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getSegment } from "@/api/xj/mapDisease"; import { Feature } from "ol";
import { Point } from "ol/geom";
import { Style, Icon, Fill, Stroke, Circle, Text } from "ol/style";
import Cluster from "ol/source/Cluster";
import VectorSource from "ol/source/Vector";
import VectorLayer from "ol/layer/Vector";
import { getSegment, getDelineatorList } from "@/api/xj/mapDisease";
import fssmMap from "@/components/map/fssm-map.vue"; import fssmMap from "@/components/map/fssm-map.vue";
import DieaseView from "./components/diease-view.vue";
export default { export default {
components: { fssmMap }, components: { fssmMap, DieaseView },
name: "MapDiease", name: "MapDiease",
data() { data() {
return { return {
@ -59,9 +134,9 @@ export default {
queryParams: { queryParams: {
// //
segmentId: "", segmentId: "",
//
maxLength: "",
}, },
//
searchForm: {},
// //
rules: { rules: {
maxLength: [ maxLength: [
@ -74,10 +149,28 @@ export default {
}, },
// //
segmentList: [], segmentList: [],
//
loading: false,
//
tableList: [],
//
centerPiont: [],
// -
tableTotal: 0,
// -
pagination: {
page: 1,
size: 10,
},
//
viewVisible: false,
//
dislogItem: [],
}; };
}, },
created() { created() {
this.getSegmentList(); this.getSegmentList();
this.getTableList();
}, },
methods: { methods: {
/** /**
@ -93,25 +186,185 @@ export default {
}); });
}, },
/**
* @description: 获取表格数据
* @param {*}
* @return {*}
*/
getTableList() {
getDelineatorList({ ...this.searchForm, ...this.pagination }).then(
({ code, rows, total }) => {
if (code === 200) {
this.tableList = rows;
this.tableTotal = total;
}
}
);
},
/** /**
* @description: 筛选事件 * @description: 筛选事件
* @param {*} * @param {*}
* @return {*} * @return {*}
*/ */
handleQuery() { handleQuery() {
this.$refs.queryForm.validate((valid) => { this.searchForm = JSON.parse(JSON.stringify(this.queryParams));
if (valid) { this.pagination.page = 1;
this.drawMapPoint(); this.getTableList();
},
/**
* @description: 切换分页
* @param {*} arg
* @return {*}
*/
handleCurrentChange(arg) {
this.pagination.page = arg;
this.getTableList();
},
/**
* @description: 切换每条/
* @param {*} arg
* @return {*}
*/
handleSizeChange(arg) {
this.pagination.size = arg;
this.getTableList();
},
/**
* @description: 点击选中行
* @param {*} e
* @return {*}
*/
handleCurrentChange(e) {
if (this.clusters) {
const map = this.$refs.mapDieaseMap.instance.get("map");
map.removeLayer(this.clusters);
this.clusters = null;
} }
this.centerPiont = [];
this.centerPiont = [
...e.defectLocation.map((item) => {
return {
geometry: item,
flag: "nomal",
};
}),
...e.endCoordinates?.map((item) => {
return {
geometry: item,
flag: "green",
};
}),
...e.startCoordinates?.map((item) => {
return {
geometry: item,
flag: "green",
};
}),
].filter((item) => {
return item.geometry;
});
this.fitMapToPoints(e.defectLocation);
this.drawPoint();
},
/**
* @description: 点击查看绘制点位
* @param {*}
* @return {*}
*/
viewMapPicture(item) {
this.viewVisible = true;
this.dislogItem = item.media;
},
/**
* @description: 根据点位计算地图中心点
* @return {void}
*/
fitMapToPoints(points) {
if (points.length > 0) {
// extent
let extent = [Infinity, Infinity, -Infinity, -Infinity];
// extent
points.forEach((point) => {
extent = [
Math.min(extent[0], point[0]),
Math.min(extent[1], point[1]),
Math.max(extent[2], point[0]),
Math.max(extent[3], point[1]),
];
});
//
const map = this.$refs.mapDieaseMap.instance.get("map");
// 使 fit
map.getView().fit(extent, {
duration: 500, //
padding: [100, 100, 100, 100], //
});
}
},
/**
* @description: 绘制地图点位
* @return {void}
*/
drawPoint() {
const features = [];
this.centerPiont.forEach((element) => {
//
const point = new Point(element.geometry);
const feature = new Feature({
geometry: point,
data: element.flag,
//
type: "icon",
});
feature.setStyle([
new Style({
image: new Icon({
crossOrigin: "anonymous",
src: require(`@/assets/index/${element.flag}.png`),
// size: [40, 40],
scale: 0.5, //
}),
}),
]);
features.push(feature);
});
this.clusters = new VectorLayer({
source: new VectorSource({
features,
}),
properties: {
type: "point",
},
});
this.$nextTick(() => {
const map = this.$refs.mapDieaseMap.instance.get("map");
map.addLayer(this.clusters);
}); });
}, },
/** /**
* @description: 绘制点位 * @description: 点击地图点位
* @param {*} * @return {void}
* @return {*}
*/ */
drawMapPoint() {}, featureSelect(e) {},
/**
* @description: 关闭查看图片弹窗
* @return {void}
*/
viewCancel() {
this.viewVisible = false;
this.dislogItem = [];
},
}, },
}; };
</script> </script>
@ -122,15 +375,33 @@ export default {
height: calc(100vh - 5.3rem); height: calc(100vh - 5.3rem);
padding: 0.5rem; padding: 0.5rem;
box-sizing: border-box; box-sizing: border-box;
display: flex;
.diease-left {
width: 50%;
height: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
padding: 0 1rem;
.diease-form { .diease-form {
width: 100%; width: 100%;
height: 6%; height: 6%;
} }
}
.map-diease-map { .map-diease-map {
width: 100%; width: 50%;
height: 94%; height: 100%;
} }
} }
/* 分页样式 */
.pagination-part {
width: 100%;
display: flex;
padding-top: 1rem;
justify-content: flex-end;
}
</style> </style>