feat:土地统计分析接口

This commit is contained in:
wangzenghua 2025-03-14 04:34:00 +01:00
parent 19008742f7
commit 1c4794c5c1
2 changed files with 67 additions and 10 deletions

View File

@ -0,0 +1,17 @@
import request from '@/utils/axios';
// 作物种植结构
export function GetCropData(params = {}) {
return request('/land-resource/TotalAnalysis/cropPlan', {
method: 'GET',
params,
});
}
// 土地用途分析
export function GetLandData(params = {}) {
return request('/land-resource/TotalAnalysis/landAnalysis', {
method: 'GET',
params,
});
}

View File

@ -25,7 +25,10 @@
<script setup>
import { reactive } from 'vue';
import { useApp } from '@/hooks';
import { GetCropData, GetLandData } from '@/apis/statisticAnalysis';
const app = useApp();
const state = reactive({
landOption: {
color: ['#3685fe', '#41b879', '#ffd500'],
@ -36,7 +39,7 @@ const state = reactive({
},
},
legend: {
data: ['耕地', '林地', '建设用地'],
// data: ['', '', ''],
},
label: {
color: '#333',
@ -53,9 +56,9 @@ const state = reactive({
],
},
landData: [
{ value: 100, name: '耕地' },
{ value: 105, name: '林地' },
{ value: 217, name: '建设用地' },
// { value: 100, name: '' },
// { value: 105, name: '' },
// { value: 217, name: '' },
],
cropOption: {
title: {
@ -66,7 +69,7 @@ const state = reactive({
},
xAxis: {
type: 'category',
data: ['土豆', '西红柿', '玉米', '花生', '水稻'],
// data: ['', '西', '', '', ''],
},
yAxis: {
type: 'value',
@ -84,11 +87,11 @@ const state = reactive({
},
},
cropData: [
{ value: 230, name: '土豆' },
{ value: 165, name: '西红柿' },
{ value: 217, name: '玉米' },
{ value: 200, name: '花生' },
{ value: 305, name: '水稻' },
// { value: 230, name: '' },
// { value: 165, name: '西' },
// { value: 217, name: '' },
// { value: 200, name: '' },
// { value: 305, name: '' },
],
landTrendOption: {
color: ['#3685fe', '#41b879', '#ffd500'],
@ -173,6 +176,43 @@ const state = reactive({
},
],
});
//
const loadData = () => {
state.loading = true;
GetCropData()
.then((res) => {
if (res.code === 200) {
state.cropData = res.data.map((item) => {
return {
name: item.crop,
value: item.area,
};
});
}
})
.catch((err) => {
app.$message.error(err.msg);
});
GetLandData()
.then((res) => {
console.log(res);
if (res.code === 200) {
state.landData = res.data.map((item) => {
return {
name: item.landType,
value: item.area,
};
});
}
})
.catch((err) => {
app.$message.error(err.msg);
});
};
loadData();
</script>
<style lang="scss" scoped>
.analysis {