feat:土地统计分析接口
This commit is contained in:
parent
19008742f7
commit
1c4794c5c1
17
sub-government-affairs-service/src/apis/statisticAnalysis.js
Normal file
17
sub-government-affairs-service/src/apis/statisticAnalysis.js
Normal 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,
|
||||
});
|
||||
}
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user