Browse Source

fix: 补充弹框的水库类型图标

feature-v1.0.0
chenhaojie 1 month ago
parent
commit
81d3e82bf4
  1. 2
      src/hooks/web/useProject.tsx
  2. 13
      src/utils/mapUtils.ts
  3. 45
      src/views/Main/ProjectOperation/index.vue

2
src/hooks/web/useProject.tsx

@ -351,7 +351,7 @@ export function useLayer() {
// }, // },
// clustering: { // clustering: {
// enabled: clustering.enabled, // enabled: clustering.enabled,
// pixelRange: clustering.pixelRange, // pixelRange: clusstering.pixelRange,
// minimumClusterSize: clustering.minimumClusterSize, // minimumClusterSize: clustering.minimumClusterSize,
// clusterEvent: undefined, // clusterEvent: undefined,
// clusterColors: undefined, // 聚合点颜色 // clusterColors: undefined, // 聚合点颜色

13
src/utils/mapUtils.ts

@ -134,28 +134,24 @@ export const queryLayersByPos = (position: any, layerList = [], cb: any) => {
[200, 201].includes(result.status) && [200, 201].includes(result.status) &&
result?.data?.datasetInfos?.length > 0 result?.data?.datasetInfos?.length > 0
) { ) {
console.log("处理业务数据 >>>>>> ", result?.data);
const fieldInfos = result.data.datasetInfos?.[0]?.fieldInfos; const fieldInfos = result.data.datasetInfos?.[0]?.fieldInfos;
console.log("fieldInfos >>>>> ", fieldInfos);
const currentFeature = result.data.features?.[0]; const currentFeature = result.data.features?.[0];
console.log("currentFeature >>>>> ", currentFeature);
const nameIndex = fieldInfos.findIndex((f: any) => const nameIndex = fieldInfos.findIndex((f: any) =>
["res_name", "dike_name", "waga_name"].includes(f.name) ["res_name", "dike_name", "waga_name"].includes(f.name)
); );
const codeIndex = fieldInfos.findIndex((f: any) => const codeIndex = fieldInfos.findIndex((f: any) =>
["res_code", "dike_code", "waga_code"].includes(f.name) ["res_code", "dike_code", "waga_code"].includes(f.name)
); );
// if (layer?.fields?.length > 0) { const scaleIndex = fieldInfos.findIndex((f: any) =>
// const fieldIndex = fieldInfos.findIndex((f) => f.name === layer?.fields[0]?.field); ["eng_scal", "dike_scale", "waga_scale"].includes(f.name)
// code = currentFeature?.fieldValues[fieldIndex]; );
// }
resData = { resData = {
attributes: { attributes: {
showCode: "" + currentFeature?.fieldValues[codeIndex], showCode: "" + currentFeature?.fieldValues[codeIndex],
showName: "" + currentFeature?.fieldValues[nameIndex], showName: "" + currentFeature?.fieldValues[nameIndex],
scale: "" + currentFeature?.fieldValues[scaleIndex],
}, },
}; };
console.log("resData >>>>> ", resData);
} }
if (cb) cb(resData); if (cb) cb(resData);
break; break;
@ -229,7 +225,6 @@ export const getSelectedLayersLegend = (selectedLayersList: any) => {
`${layer.url}/legend.json?bbox=${bbox}` `${layer.url}/legend.json?bbox=${bbox}`
); );
} }
console.log(result);
if (result.status === 200 && result.data) { if (result.status === 200 && result.data) {
let currentLayer = []; let currentLayer = [];
// if (mapName) { // if (mapName) {

45
src/views/Main/ProjectOperation/index.vue

@ -1,7 +1,10 @@
<template> <template>
<div class="project-detail-wrapper"> <div class="project-detail-wrapper">
<div class="header"> <div class="header">
<div class="title">
<img :src="waterIcon" />
<span>{{ data.name }}</span> <span>{{ data.name }}</span>
</div>
<div class="btns"> <div class="btns">
<el-icon @click="handleClose"> <el-icon @click="handleClose">
<Close /> <Close />
@ -27,11 +30,15 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, defineOptions, defineEmits, defineProps, watch } from "vue"; import { ref, defineOptions, defineEmits, defineProps, watch, onMounted } from "vue";
import BaseInfo from "./components/BaseInfo.vue"; import BaseInfo from "./components/BaseInfo.vue";
import DataStatistics from "./components/DataStatistics.vue"; import DataStatistics from "./components/DataStatistics.vue";
import MonitorWarning from "./components/MonitorWarning.vue"; import MonitorWarning from "./components/MonitorWarning.vue";
import { Close } from "@element-plus/icons-vue"; import { Close } from "@element-plus/icons-vue";
import RB from "@/assets/map/reservoir_big.png";
import RN from "@/assets/map/reservoir_normal.png";
import RS from "@/assets/map/reservoir_small.png";
// import VideoAnalysis from "./components/VideoAnalysis.vue"; // import VideoAnalysis from "./components/VideoAnalysis.vue";
const props = defineProps({ const props = defineProps({
data: { data: {
@ -44,7 +51,27 @@ defineOptions({
name: "ProjectDetail", name: "ProjectDetail",
}); });
const emits = defineEmits(["getResInfo"]); const emits = defineEmits(["getResInfo"]);
const waterIcon = ref(RN);
const activeTab = ref("1"); const activeTab = ref("1");
function setWaterIcon() {
switch (props.data.scale) {
case "1.0":
case "2.0":
waterIcon.value = RB;
break;
case "3.0":
waterIcon.value = RN;
break;
case "4.0":
case "5.0":
waterIcon.value = RS;
break;
default:
waterIcon.value = RN;
break;
}
}
function handleGetResInfo(data: any) { function handleGetResInfo(data: any) {
emits("getResInfo", data); emits("getResInfo", data);
} }
@ -61,6 +88,10 @@ watch(
}, },
{ immediate: true }, { immediate: true },
); );
onMounted(() => {
setWaterIcon();
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.project-detail-wrapper { .project-detail-wrapper {
@ -84,6 +115,18 @@ watch(
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.title {
display: flex;
align-items: center;
img {
width: 16px;
height: 16px;
margin-right: 4px;
}
}
.btns {
cursor: pointer;
}
} }
.content { .content {
height: 748px; height: 748px;

Loading…
Cancel
Save