|
|
@@ -73,14 +73,14 @@
|
|
|
</template>
|
|
|
</el-tree>
|
|
|
</div>
|
|
|
- <div v-if="panelType === 0" class="warning-r right chart-wrap yes-events">
|
|
|
+ <div v-show="panelType === 0" class="warning-r right chart-wrap yes-events">
|
|
|
<chart-list :activeBaseTab="activeBaseTab" :areaCode="selectedAreaCode" :areaName="selectedAreaName"></chart-list>
|
|
|
<!-- <farmInfoGroup></farmInfoGroup> -->
|
|
|
</div>
|
|
|
- <div v-if="panelType === 1" class="warning-r right yes-events">
|
|
|
+ <div v-show="panelType === 1" class="warning-r right yes-events">
|
|
|
<farmInfoGroup></farmInfoGroup>
|
|
|
</div>
|
|
|
- <div v-if="panelType === 2" class="warning-r right yes-events">
|
|
|
+ <div v-show="panelType === 2" class="warning-r right yes-events">
|
|
|
<service-list></service-list>
|
|
|
</div>
|
|
|
<!-- 地图图例 -->
|
|
|
@@ -396,7 +396,6 @@ const getCommonMapData = async (firstCategory) => {
|
|
|
const promises = lastLevelIds.map((id) => getDistributionData(id));
|
|
|
const results = await Promise.all(promises);
|
|
|
const finalMapData = results.flat();
|
|
|
-
|
|
|
distributionLayer.initData(finalMapData);
|
|
|
}
|
|
|
}
|
|
|
@@ -505,52 +504,25 @@ const handleTabClick = (item) => {
|
|
|
break;
|
|
|
case "农场分布":
|
|
|
panelType.value = 1;
|
|
|
- const cropData = [
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- label: "荔枝-物候期",
|
|
|
- color: "#2199F8",
|
|
|
- farmName: "荔博园",
|
|
|
- imgUrl: "https://birdseye-img.sysuimars.com/temp/pz/%E8%8D%94%E6%9E%9D.png",
|
|
|
- imgName: lz,
|
|
|
- wktArr: [
|
|
|
- "POINT(113.33722309500006 23.204074978290652)",
|
|
|
- "POINT(113.53593237057355 23.188789823486065)",
|
|
|
- "POINT(113.36970447853234 23.064596505297875)",
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- id: 55,
|
|
|
- label: "荔枝-秋梢期",
|
|
|
- color: "#FF8E1C",
|
|
|
- farmName: "荔博园",
|
|
|
- imgUrl: "https://birdseye-img.sysuimars.com/temp/pz/%E7%99%BD%E7%B3%96.png",
|
|
|
- imgName: lz,
|
|
|
- wktArr: [
|
|
|
- "POINT(113.29900983080294 22.949956545068478)",
|
|
|
- "POINT(113.22640444442656 22.90983245840535)",
|
|
|
- ],
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- // 设施图层测试数据
|
|
|
- const facilityData = [
|
|
|
- {
|
|
|
- id: 201,
|
|
|
- label: "冷链冷库",
|
|
|
- imgName: coldChainIcon,
|
|
|
- wktArr: ["POINT(113.35 23.10)"],
|
|
|
- },
|
|
|
- {
|
|
|
- id: 202,
|
|
|
- label: "加工厂",
|
|
|
- imgName: factoryIcon,
|
|
|
- wktArr: ["POINT(113.25 23.02)"],
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- distributionLayer.initData(cropData);
|
|
|
- distributionLayer.initFacilityData(facilityData);
|
|
|
+ fetchFarmList();
|
|
|
+
|
|
|
+ // // 设施图层测试数据
|
|
|
+ // const facilityData = [
|
|
|
+ // {
|
|
|
+ // id: 201,
|
|
|
+ // label: "冷链冷库",
|
|
|
+ // imgName: coldChainIcon,
|
|
|
+ // wktArr: ["POINT(113.35 23.10)"],
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // id: 202,
|
|
|
+ // label: "加工厂",
|
|
|
+ // imgName: factoryIcon,
|
|
|
+ // wktArr: ["POINT(113.25 23.02)"],
|
|
|
+ // },
|
|
|
+ // ];
|
|
|
+
|
|
|
+ // distributionLayer.initFacilityData(facilityData);
|
|
|
break;
|
|
|
case "农服管理":
|
|
|
panelType.value = 2;
|
|
|
@@ -665,6 +637,36 @@ const props1 = {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+const fetchFarmList = () => {
|
|
|
+ VE_API.warning.fetchFarmList().then(res => {
|
|
|
+ if (res.code === 0 && res.data && res.data.length > 0) {
|
|
|
+ // 将接口数据转换为地图需要的格式
|
|
|
+ const cropData = res.data.map((item) => {
|
|
|
+ // 组合作物名称和物候期名称作为 label
|
|
|
+ const label = item.phenologyName
|
|
|
+ ? `${item.speciesName}-${item.phenologyName}`
|
|
|
+ : item.speciesName;
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ label: label,
|
|
|
+ color: item.speciesColor || "#2199F8",
|
|
|
+ centerPoint: item.point, // 使用 point 作为 centerPoint
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ // 渲染作物数据到地图
|
|
|
+ distributionLayer.initData(cropData, 'label');
|
|
|
+ } else {
|
|
|
+ // 接口返回空数据时,清空地图
|
|
|
+ distributionLayer.initData([]);
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+ // 错误时也清空地图
|
|
|
+ distributionLayer.initData([]);
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const selectedAreaCode = ref(null);
|
|
|
const selectedAreaName = ref(null);
|
|
|
const cascaderRef = ref(null);
|