|
@@ -43,16 +43,26 @@
|
|
|
</chart-box>
|
|
</chart-box>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="chart-item">
|
|
<div class="chart-item">
|
|
|
- <chart-box :name="`三门坡镇非农化非粮化面积统计`">
|
|
|
|
|
|
|
+ <chart-box :name="`三门坡镇农事调度规划`">
|
|
|
|
|
+ <template #title-right>
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="selectedPieItem"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 100px"
|
|
|
|
|
+ @change="handleSpeciesChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </template>
|
|
|
<div class="box-content">
|
|
<div class="box-content">
|
|
|
- <div class="chart-dom">
|
|
|
|
|
- <bar-chart
|
|
|
|
|
- :key="`yield-${activeBaseTab}`"
|
|
|
|
|
- :chartData="yieldChartData"
|
|
|
|
|
- :yAxisFormatter="yAxisFormatter"
|
|
|
|
|
- ></bar-chart>
|
|
|
|
|
|
|
+ <div class="farm-work-list">
|
|
|
|
|
+ <div v-if="farmWorkList.length === 0" class="farm-work-empty">暂无数据</div>
|
|
|
|
|
+ <div v-else class="farm-work-item" v-for="item in farmWorkList" :key="item.farmWorkId">
|
|
|
|
|
+ <div class="farm-work-title">{{ item.title || "-" }}</div>
|
|
|
|
|
+ <div class="farm-work-desc">{{ item.description || "-" }}</div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="box-bg">{{ yieldSummaryText }}</div>
|
|
|
|
|
|
|
+ <div class="box-bg">{{ farmWorkSummaryText }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
</chart-box>
|
|
</chart-box>
|
|
|
</div>
|
|
</div>
|
|
@@ -119,23 +129,13 @@ const regionChartData = ref({
|
|
|
// 区域占比摘要文字
|
|
// 区域占比摘要文字
|
|
|
const regionSummaryText = ref("暂无数据");
|
|
const regionSummaryText = ref("暂无数据");
|
|
|
|
|
|
|
|
-// 用地面积统计图表数据
|
|
|
|
|
-const yieldChartData = ref({
|
|
|
|
|
- categories: [], // 类别名称数组
|
|
|
|
|
- values: [], // 占比百分比数组
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-// 用地面积统计摘要文字
|
|
|
|
|
-const yieldSummaryText = ref("暂无数据");
|
|
|
|
|
-
|
|
|
|
|
-// y 轴格式化器(不显示百分比)
|
|
|
|
|
-const yAxisFormatter = "{value}";
|
|
|
|
|
|
|
+// 农事调度文本列表
|
|
|
|
|
+const farmWorkList = ref([]);
|
|
|
|
|
+const farmWorkSummaryText = ref("暂无数据");
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
// 监听图例组件的变化事件
|
|
// 监听图例组件的变化事件
|
|
|
eventBus.on("landUseLegend:change", handleLandUseLegendChange);
|
|
eventBus.on("landUseLegend:change", handleLandUseLegendChange);
|
|
|
- // 初始化时请求用地面积统计数据(statType=1)
|
|
|
|
|
- fetchYieldChartData();
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
@@ -156,7 +156,7 @@ const handleLandUseLegendChange = (data) => {
|
|
|
};
|
|
};
|
|
|
// 使用新的 nonGrain 重新获取饼图数据
|
|
// 使用新的 nonGrain 重新获取饼图数据
|
|
|
fetchStatRegionAreaRatio(data.nonGrain);
|
|
fetchStatRegionAreaRatio(data.nonGrain);
|
|
|
- fetchStatPhenologyAreaRatioForGrain();
|
|
|
|
|
|
|
+ handleSpeciesChange();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const options = ref([]);
|
|
const options = ref([]);
|
|
@@ -209,48 +209,28 @@ const fetchStatRegionAreaRatio = (nonGrain = null) => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 获取用地面积统计图表数据(statType=1)
|
|
|
|
|
-const fetchYieldChartData = () => {
|
|
|
|
|
- const params = { statType: 1 }; // 固定为 1
|
|
|
|
|
|
|
+const fetchFarmWorkDesc = () => {
|
|
|
|
|
+ if (!selectedPieItem.value) {
|
|
|
|
|
+ farmWorkList.value = [];
|
|
|
|
|
+ farmWorkSummaryText.value = "暂无数据";
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
VE_API.warning
|
|
VE_API.warning
|
|
|
- .fetchStatAreaRatioByType(params)
|
|
|
|
|
|
|
+ .fetchFarmWorkDesc({ speciesId: selectedPieItem.value })
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
if (res.code === 0 && res.data && res.data.length > 0) {
|
|
if (res.code === 0 && res.data && res.data.length > 0) {
|
|
|
- // 计算总种植面积
|
|
|
|
|
- const total = res.data.reduce((sum, item) => sum + (item.plantArea || 0), 0);
|
|
|
|
|
-
|
|
|
|
|
- // 转换接口数据为柱状图格式
|
|
|
|
|
- const categories = res.data.map((item) => item.name);
|
|
|
|
|
- const values = res.data.map((item) => parseFloat(item.plantArea.toFixed(1)));
|
|
|
|
|
-
|
|
|
|
|
- // 更新图表数据
|
|
|
|
|
- yieldChartData.value = {
|
|
|
|
|
- categories,
|
|
|
|
|
- values,
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- // 生成摘要文字,显示每一项的数据
|
|
|
|
|
- const summaryItems = res.data.map((item) => {
|
|
|
|
|
- return `${item.name}: ${item.plantArea.toFixed(1)}亩`;
|
|
|
|
|
- });
|
|
|
|
|
- yieldSummaryText.value = summaryItems.join(", ");
|
|
|
|
|
|
|
+ farmWorkList.value = res.data;
|
|
|
|
|
+ farmWorkSummaryText.value = `共${res.data.length}条农事调度`;
|
|
|
} else {
|
|
} else {
|
|
|
- // 接口返回空数据时,清空图表数据
|
|
|
|
|
- yieldChartData.value = {
|
|
|
|
|
- categories: [],
|
|
|
|
|
- values: [],
|
|
|
|
|
- };
|
|
|
|
|
- yieldSummaryText.value = "暂无数据";
|
|
|
|
|
|
|
+ farmWorkList.value = [];
|
|
|
|
|
+ farmWorkSummaryText.value = "暂无数据";
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
|
- console.error("获取用地面积统计数据失败:", error);
|
|
|
|
|
- // 错误时清空数据
|
|
|
|
|
- yieldChartData.value = {
|
|
|
|
|
- categories: [],
|
|
|
|
|
- values: [],
|
|
|
|
|
- };
|
|
|
|
|
- yieldSummaryText.value = "暂无数据";
|
|
|
|
|
|
|
+ console.error("获取农事调度描述失败:", error);
|
|
|
|
|
+ farmWorkList.value = [];
|
|
|
|
|
+ farmWorkSummaryText.value = "暂无数据";
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -307,6 +287,11 @@ const fetchStatPhenologyAreaRatioForGrain = () => {
|
|
|
regionSummaryText.value = "暂无数据";
|
|
regionSummaryText.value = "暂无数据";
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+const handleSpeciesChange = () => {
|
|
|
|
|
+ fetchStatPhenologyAreaRatioForGrain();
|
|
|
|
|
+ fetchFarmWorkDesc();
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@@ -329,6 +314,41 @@ const fetchStatPhenologyAreaRatioForGrain = () => {
|
|
|
height: calc(100% - 61px);
|
|
height: calc(100% - 61px);
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
}
|
|
}
|
|
|
|
|
+ .farm-work-list {
|
|
|
|
|
+ height: calc(100% - 61px);
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ overflow-y: auto;
|
|
|
|
|
+ padding: 8px;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ line-height: 1.5;
|
|
|
|
|
+
|
|
|
|
|
+ .farm-work-empty {
|
|
|
|
|
+ color: rgba(255, 255, 255, 0.6);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .farm-work-item {
|
|
|
|
|
+ padding-bottom: 8px;
|
|
|
|
|
+ margin-bottom: 8px;
|
|
|
|
|
+ border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
|
|
|
|
|
+
|
|
|
|
|
+ &:last-child {
|
|
|
|
|
+ margin-bottom: 0;
|
|
|
|
|
+ border-bottom: none;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .farm-work-title {
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ margin-bottom: 2px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .farm-work-desc {
|
|
|
|
|
+ color: rgba(255, 255, 255, 0.8);
|
|
|
|
|
+ white-space: pre-wrap;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
.box-bg {
|
|
.box-bg {
|
|
|
border-radius: 2px 2px 0 0;
|
|
border-radius: 2px 2px 0 0;
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|