|
|
@@ -188,9 +188,13 @@ const treeActionData = ref([]);
|
|
|
// 保存原始数据,用于恢复
|
|
|
const originalTreeData = ref([]);
|
|
|
|
|
|
-// 物候期分布下,当前激活的“二级”节点(只允许一个)
|
|
|
+// 物候期分布下,当前激活的"二级"节点(只允许一个)
|
|
|
const activePhenologySecondId = ref(null);
|
|
|
|
|
|
+// 当前选中的年份和季度
|
|
|
+const currentYear = ref(2025);
|
|
|
+const currentQuarter = ref(1);
|
|
|
+
|
|
|
// 树的默认展开与默认选中(展开/选中第一个“果类”及其子节点)
|
|
|
const defaultExpandedKeys = ref();
|
|
|
const defaultCheckedKeys = ref();
|
|
|
@@ -254,18 +258,31 @@ onMounted(async () => {
|
|
|
// ai与地图交互
|
|
|
eventBus.off("chat:showMapLayer", handleMapLayer);
|
|
|
eventBus.on("chat:showMapLayer", handleMapLayer);
|
|
|
-
|
|
|
- // 时间轴
|
|
|
- eventBus.on("weatherTime:changeTime", ({index}) => {
|
|
|
- handleTimeChange(index)
|
|
|
- })
|
|
|
|
|
|
// 初始化区域选择器的默认值
|
|
|
initAreaDefaultValue();
|
|
|
});
|
|
|
|
|
|
-const handleTimeChange = (index) => {
|
|
|
- console.log('index', index);
|
|
|
+// 时间轴
|
|
|
+eventBus.on("weatherTime:changeTime", ({index, year, quarter}) => {
|
|
|
+ handleTimeChange(index, year, quarter)
|
|
|
+})
|
|
|
+
|
|
|
+const handleTimeChange = (index, year, quarter) => {
|
|
|
+ // 更新当前选中的年份和季度
|
|
|
+ currentYear.value = year;
|
|
|
+ currentQuarter.value = quarter;
|
|
|
+
|
|
|
+ // 如果当前在作物分布或物候期分布tab,需要重新加载地图数据
|
|
|
+ if (activeBaseTab.value === "作物分布" || activeBaseTab.value === "物候期分布") {
|
|
|
+ // 重新获取当前选中的节点数据
|
|
|
+ if (treeRef.value) {
|
|
|
+ const checkedNodes = treeRef.value.getCheckedNodes(false, true);
|
|
|
+ if (checkedNodes && checkedNodes.length > 0) {
|
|
|
+ getTreeChecks(checkedNodes[0], { checkedNodes });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const getRegionCropAreaYield = async () => {
|
|
|
@@ -308,6 +325,8 @@ sessionStorage.removeItem("farmId");
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
eventBus.off("alarmList:changeMapLayer");
|
|
|
+ // 时间轴
|
|
|
+ eventBus.off("weatherTime:changeTime");
|
|
|
});
|
|
|
|
|
|
// 作物分布默认选中并展开第一个节点,在地图上显示对应分布图层
|
|
|
@@ -569,8 +588,8 @@ const getSpeciesListData = async () => {
|
|
|
|
|
|
const getDistributionData = async (speciesId, phenologyIds) => {
|
|
|
const {data} = await VE_API.agri_land_crop.queryDistribution({
|
|
|
- year: 2025,
|
|
|
- quarter: 1,
|
|
|
+ year: currentYear.value,
|
|
|
+ quarter: currentQuarter.value,
|
|
|
speciesId,
|
|
|
phenologyIds: phenologyIds || []
|
|
|
});
|