fix:巡检任务增加地图,养护通知单修改

This commit is contained in:
SunTao 2025-01-02 16:36:30 +08:00
parent 172c2501cb
commit 6dd0ef6706
5 changed files with 298 additions and 12 deletions

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com
* @Date: 2024-10-14 10:04:12
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-05 15:34:41
* @LastEditTime: 2025-01-02 15:10:39
* @FilePath: \znxjxt-ui\src\api\xj\task.js
* @Description: 巡检任务管理接口
*/
@ -74,3 +74,12 @@ export function exportDefectData(params) {
params,
});
}
// 根据任务id查询病害点位
export function getDefectPoint(params) {
return request({
url: "/xj/xjtask/getMapInfoByTaskId",
method: "get",
params,
});
}

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com
* @Date: 2024-10-14 10:46:23
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2025-01-02 10:33:02
* @LastEditTime: 2025-01-02 16:17:20
* @FilePath: \znxjxt-ui\src\components\map\fssm-map.vue
* @Description: 公共地图
-->
@ -428,7 +428,9 @@ export default {
this.$emit("map-moveend", zoom);
});
//
this.selectSingClick = new Select();
this.selectSingClick = new Select({
style: null,
});
map.addInteraction(this.selectSingClick);
this.selectSingClick.on("select", (e) => {
this.$emit("feature-select", e);

View File

@ -180,6 +180,7 @@ export default {
handler(val) {
this.editForm = {
...val,
segmentId: val.segmentId === "未知路段" ? "" : val.segmentId,
id: null,
defectId: val.id,
createdTime: null,

View File

@ -0,0 +1,224 @@
<!--
* @Author: SunTao 328867980@qq.com
* @Date: 2025-01-02 11:56:20
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2025-01-02 15:54:11
* @FilePath: \znxjxt-ui\src\views\xj\inspection\task-management\components\task-map.vue
* @Description: 巡检任务-地图弹窗
-->
<template>
<div class="content">
<!-- 多选框切换坐标类型 -->
<div class="check-box">
<el-cascader
ref="screenCascader"
v-model="mapCareSelect"
placeholder="病害类型筛选"
:options="defectCascaderList"
collapse-tags
:props="{
multiple: true,
emitPath: false,
children: 'subTypes',
}"
@change="changeMapCareSelect"
clearable
></el-cascader>
</div>
<fssm-map ref="taskMap"></fssm-map>
</div>
</template>
<script>
//
import { getDefectPoint } from "@/api/xj/task";
import FssmMap from "@/components/map/fssm-map.vue";
import { Feature } from "ol";
import { Point } from "ol/geom";
import VectorSource from "ol/source/Vector";
import VectorLayer from "ol/layer/Vector";
import { Style, Icon } from "ol/style";
export default {
name: "TaskMap",
components: {
FssmMap,
},
props: {
//
dialogItem: {
type: Object,
default: () => {},
},
//
defectCascaderList: {
type: Array,
default: () => [],
},
},
data() {
return {
//
mapCareSelect: [],
//
markLayerPoints: null,
// ()
centerPiont: [],
//
drawPointList: [],
};
},
mounted() {
this.getMapPoint();
},
methods: {
/**
* @description: 病害类型筛选改变事件
* @return {void}
*/
changeMapCareSelect(value) {
if (value.length > 0) {
this.centerPiont = this.drawPointList.filter((item) => {
return value.includes(item.iconType);
});
} else {
this.centerPiont = this.drawPointList;
}
this.drawPoint();
},
/**
* @description: 获取地图点位的方法
* @return {void}
*/
getMapPoint() {
getDefectPoint({ id: this.dialogItem.extId }).then(({ code, data }) => {
if (code === 200) {
this.drawPointList = data.map((item) => {
if (item.geometry) {
return {
...item,
geometry: [item.geometry[0], item.geometry[1]],
};
}
return [];
});
this.centerPiont = data.map((item) => {
if (item.geometry) {
return {
...item,
geometry: [item.geometry[0], item.geometry[1]],
};
}
return [];
});
//
//
// if (!this.shouldLoadClusters) {
//
const pointArray = data.map((item) => {
if (item.geometry) {
return [item.geometry[0], item.geometry[1]];
}
return [];
});
this.fitMapToPoints(pointArray);
this.drawPoint();
// }
}
});
},
/**
* @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]),
];
});
this.$nextTick(() => {
//
const map = this.$refs.taskMap.instance.get("map");
// 使 fit
map.getView().fit(extent, {
duration: 500, //
padding: [10, 10, 10, 10], //
});
});
}
},
/**
* @description: 绘制地图点位
* @return {void}
*/
drawPoint() {
const features = [];
this.centerPiont.forEach((element) => {
//
const point = new Point(element.geometry);
const feature = new Feature({
geometry: point,
data: element,
//
type: "icon",
});
//
feature.setStyle([
new Style({
image: new Icon({
crossOrigin: "anonymous",
src: require(`@/assets/screen/index/${element.iconTypeName}.png`),
// size: [40, 40],
scale: 0.5, //
displacement: [0, 30],
}),
}),
]);
features.push(feature);
});
//
const pointSource = new VectorSource({
features,
});
if (!this.markLayerPoints) {
this.markLayerPoints = new VectorLayer({
source: pointSource,
properties: {
type: "point",
},
});
this.$nextTick(() => {
const map = this.$refs.taskMap.instance.get("map");
map.addLayer(this.markLayerPoints);
});
} else {
this.markLayerPoints.setSource(pointSource);
}
},
},
};
</script>
<style lang="scss" scoped>
.content {
width: 100%;
height: 45rem;
position: relative;
.check-box {
position: absolute;
z-index: 1;
}
}
</style>

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com
* @Date: 2024-10-14 09:48:43
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-27 14:03:45
* @LastEditTime: 2025-01-02 15:21:44
* @FilePath: \znxjxt-ui\src\views\xj\inspection\task-management\index.vue
* @Description: 巡检管理-巡检任务
-->
@ -95,7 +95,11 @@
</el-table-column>
<el-table-column label="发现病害数" align="center" prop="defectCount">
</el-table-column>
<el-table-column label="发现新增病害数" align="center" prop="newDefectCount">
<el-table-column
label="发现新增病害数"
align="center"
prop="newDefectCount"
>
</el-table-column>
<el-table-column label="任务id" align="center" prop="extId" />
<el-table-column
@ -110,7 +114,10 @@
<el-button size="mini" @click="wordExport(scope.row, false)"
>取消</el-button
>
<el-button type="primary" size="mini" @click="wordExport(scope.row,true)"
<el-button
type="primary"
size="mini"
@click="wordExport(scope.row, true)"
>确定</el-button
>
</div>
@ -130,6 +137,14 @@
@click="viewDefect(scope.row)"
>查看
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-help"
style="margin-left: 0.5rem"
@click="viewMap(scope.row)"
>地图
</el-button>
<!-- <el-button
size="mini"
type="text"
@ -177,6 +192,22 @@
></task-retrace> -->
</el-dialog>
<el-dialog
title="查看地图"
:visible.sync="mapView"
width="90%"
append-to-body
:close-on-click-modal="false"
destroy-on-close
@close="mapCancel"
>
<task-map
v-if="mapView"
:dialogItem="dialogItem"
:defectCascaderList="defectCascaderList"
></task-map>
</el-dialog>
<!-- 回顾巡检任务弹窗 -->
<el-dialog
title="回顾任务"
@ -202,6 +233,7 @@
import { Loading } from "element-ui";
import TaskRetrace from "./components/task-retrace.vue";
import TaskView from "./components/task-view.vue";
import taskMap from "./components/task-map.vue";
import {
getTaskTable,
getSegment,
@ -212,7 +244,7 @@ import {
} from "@/api/xj/task";
export default {
components: { TaskRetrace, TaskView },
components: { TaskRetrace, TaskView, taskMap },
data() {
return {
//
@ -251,11 +283,12 @@ export default {
dialogItem: {},
//
viewVisible: false,
//
mapView: false,
//
retraceVisible: false,
//
defectCascaderList: [],
};
},
created() {
@ -387,6 +420,16 @@ export default {
this.dialogItem = item;
},
/**
* @description: 点击地图病害事件
* @param {*} item
* @return {*}
*/
viewMap(item) {
this.mapView = true;
this.dialogItem = item;
},
/**
* @description: 点击回顾事件
* @param {*} item
@ -402,7 +445,7 @@ export default {
* @return {*}
*/
submitForm(item, type) {
console.log(item,'fdfdfd')
console.log(item, "fdfdfd");
this.wordExport(this.dialogItem, type);
},
@ -464,6 +507,14 @@ export default {
this.dialogItem = {};
},
/**
* @description: 关闭地图弹窗
* @return {*}
*/
mapCancel() {
this.mapView = false;
},
/**
* @description: 关闭回顾弹窗
* @return {*}
@ -472,7 +523,6 @@ export default {
this.retraceVisible = false;
this.dialogItem = {};
},
},
};
</script>