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. 47
      src/views/Main/ProjectOperation/index.vue

2
src/hooks/web/useProject.tsx

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

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

@ -1,7 +1,10 @@
<template>
<div class="project-detail-wrapper">
<div class="header">
<span>{{ data.name }}</span>
<div class="title">
<img :src="waterIcon" />
<span>{{ data.name }}</span>
</div>
<div class="btns">
<el-icon @click="handleClose">
<Close />
@ -27,11 +30,15 @@
</div>
</template>
<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 DataStatistics from "./components/DataStatistics.vue";
import MonitorWarning from "./components/MonitorWarning.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";
const props = defineProps({
data: {
@ -44,7 +51,27 @@ defineOptions({
name: "ProjectDetail",
});
const emits = defineEmits(["getResInfo"]);
const waterIcon = ref(RN);
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) {
emits("getResInfo", data);
}
@ -61,6 +88,10 @@ watch(
},
{ immediate: true },
);
onMounted(() => {
setWaterIcon();
});
</script>
<style scoped lang="scss">
.project-detail-wrapper {
@ -84,6 +115,18 @@ watch(
flex-direction: row;
align-items: center;
justify-content: space-between;
.title {
display: flex;
align-items: center;
img {
width: 16px;
height: 16px;
margin-right: 4px;
}
}
.btns {
cursor: pointer;
}
}
.content {
height: 748px;

Loading…
Cancel
Save