|
|
@@ -229,28 +229,11 @@ const fetchYieldChartData = () => {
|
|
|
values,
|
|
|
};
|
|
|
|
|
|
- // 找到最大和最小占比的项
|
|
|
- let maxValue = 0;
|
|
|
- let maxName = "";
|
|
|
- let minValue = Infinity;
|
|
|
- let minName = "";
|
|
|
- res.data.forEach((item) => {
|
|
|
- if (item.plantArea > maxValue) {
|
|
|
- maxValue = item.plantArea;
|
|
|
- maxName = item.name;
|
|
|
- }
|
|
|
- if (item.plantArea < minValue) {
|
|
|
- minValue = item.plantArea;
|
|
|
- minName = item.name;
|
|
|
- }
|
|
|
+ // 生成摘要文字,显示每一项的数据
|
|
|
+ const summaryItems = res.data.map((item) => {
|
|
|
+ return `${item.name}: ${item.plantArea.toFixed(1)}亩`;
|
|
|
});
|
|
|
-
|
|
|
- // 更新摘要文字
|
|
|
- if (maxName) {
|
|
|
- yieldSummaryText.value = `当前${maxName}的面积占有${maxValue.toFixed(1)}亩`;
|
|
|
- } else {
|
|
|
- yieldSummaryText.value = "暂无数据";
|
|
|
- }
|
|
|
+ yieldSummaryText.value = summaryItems.join(", ");
|
|
|
} else {
|
|
|
// 接口返回空数据时,清空图表数据
|
|
|
yieldChartData.value = {
|