This commit is contained in:
2023-07-09 20:38:38 +08:00
parent 744d3920a8
commit d0eea9c22a
340 changed files with 9947 additions and 4147 deletions

View File

@ -169,7 +169,11 @@
</el-collapse-item>
</el-collapse>
<div class="bottom_center">
<TimeLine />
<TimeLine
v-if="dataSource.length > 0"
:dataSource="dataSource"
@dataHandle="handleData"
/>
</div>
<div class="tool">
<span><img src="@/assets/images/LAYER.png" alt="" /></span>
@ -181,33 +185,26 @@
</div>
<div id="pop"></div>
<div id="popup" class="ol-popup">
<div class="pophead" style="width: 100%; height: 20px">
<div class="pophead" style="width: 100%">
<div
id="popup-title"
style="
font: bold 15px sans-serif;
align: left;
position: absolute;
/* top: 5px; */
left: 17px;
color: #fff;
font-size: 20px;
font-weight: 400;
letter-spacing: 1px;
color: rgba(246, 255, 255, 1);
line-height: 42px;
padding-left: 45px;
"
></div>
<a
href="#"
id="popup-closer"
class="ol-popup-closer"
style="color: #8e908c"
></a>
<a href="#" id="popup-closer" class="ol-popup-closer"></a>
</div>
<div id="popup-content" style="padding: 10px">
<div v-for="(item, index) in alterArr" :key="index">
<p>
<span>{{ item.name }}</span>
:
<span>{{ item.area }}()</span>
</p>
</div>
<div id="popup-content" style="padding: 30px">
<p v-for="(item, index) in alterArr" :key="index">
<img src="@/assets/images/icon.png" />
<span class="label">{{ item.name }}</span>
<span>{{ item.area }}</span>
</p>
</div>
<div id="popup-pagination"></div>
</div>
@ -374,6 +371,7 @@ import * as xlsx from 'xlsx'; // Vue3 版本
import { ElMessage } from 'element-plus';
import townJson from './town.json';
import { useRouter } from 'vue-router';
import moment from 'Moment';
// import {}
const router = useRouter();
@ -401,14 +399,16 @@ let SwitchFlag = ref(true);
let regionName = ref('');
let layers = ref(null); //村
let alterArr = ref([]);
let dataSource = ref([]);
let oldDatas = ref('');
let highStandard = [
'高标准农田1',
'高标准农田2',
'高标准农田3',
'高标准农田4',
'高标准农田5',
'高标准农田6',
'高标准农田7',
'高标准农田1.0',
'高标准农田2.0',
'高标准农田3.0',
'高标准农田4.0',
'高标准农田5.0',
'高标准农田6.0',
'高标准农田7.0',
];
let highStandarditem = {
小麦: [],
@ -441,6 +441,18 @@ watch(
}
}
);
watch(
() => oldDatas.value,
(val, oldVal) => {
console.log(oldDatas);
value.value = '370211';
getcroppers(value.value, oldDatas.value.name); //作物分类面积请求
getcropTypeStatisticss(value.value, oldDatas.value.name); //作物类型统计百分比
getvillages(value.value, oldDatas.value.name);
getTownships(value.value, oldDatas.value.name);
gethighStandards(oldDatas.value.name); //高标准农田
}
);
const onSubmit = () => {
if (!formInline.value.yearMonth) {
@ -1090,19 +1102,16 @@ onMounted(() => {
});
// 初始化
function initonMounted() {
getcroppers('370211'); //作物分类面积请求
getcropTypeStatisticss('370211'); //作物类型统计百分比
theTimes(); //
getaArea(); //面积
getTownships('370211');
//地图
initmap();
showDaChangArea();
areachar(); //图表
typesof(); //图表
farmland(); //图表
ASdivision(); //图表
// getFarmland();
gethighStandards(); //高标准农田
theTimes(); //年
alter();
for (const key in dic) {
if (dic[key].disabled !== true) {
@ -1176,36 +1185,22 @@ function initmap() {
var lat = coodinate[1];
var view = map.getView();
var zoom = map.getView().getZoom();
console.log(lon, lat);
view.animate({
center: [lon, lat],
duration: 1000,
});
console.log(zoom, 'zoom========================');
// if (zoom >= 15) {
// checkList.value.forEach(item => {
// if (layersDic[item]) {
// QueryData(
// e,
// `${layersDic[item].name}@${layersDic[item].setOf}`,
// `http://36.134.44.75:8090/iserver/services/map-${layersDic[item].setOf}/rest/maps/${layersDic[item].name}@${layersDic[item].setOf}`,
// item
// );
// }
// });
// }
if (zoom >= 13) {
QueryData(
e,
'huangdaoqu_village@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/huangdaoqu_village@huangdaoqu_bianjie',
'CJQY3702112019WGS84@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/CJQY3702112019WGS84%40huangdaoqu_bianjie',
'村'
);
} else {
QueryData(
e,
'huangdaoqu_town@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/huangdaoqu_town@huangdaoqu_bianjie',
'XJQY3702112019WGS84@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/XJQY3702112019WGS84%40huangdaoqu_bianjie',
'镇'
);
}
@ -1228,6 +1223,14 @@ function initmap() {
// 开始监听父元素大小变化
resizeObserver.observe(parentElement);
}
//创建蒙层,凸显黄岛区域
function showDaChangArea() {
axios.get('/json/huangdao.json').then(({ data }) => {
const fts = new ol.format.GeoJSON().readFeatures(data);
const ft = fts[0];
addConver(ft.getGeometry().getCoordinates());
});
}
//添加遮罩
function addConver(data) {
let source = new ol.source.Vector();
@ -1264,7 +1267,7 @@ function erase(data) {
const cun = () => {
layers = new ol.layer.Tile({
source: new ol.source.TileSuperMapRest({
url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/huangdaoqu_village@huangdaoqu_bianjie',
url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/CJQY3702112019WGS84%40huangdaoqu_bianjie',
//rasterfunction: new SuperMap.NDVIParameter({ redIndex: 0, nirIndex: 2 }),
cacheEnabled: false,
}),
@ -1277,7 +1280,7 @@ const cun = () => {
const zhen = () => {
var layer = new ol.layer.Tile({
source: new ol.source.TileSuperMapRest({
url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/huangdaoqu_town@huangdaoqu_bianjie',
url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/XJQY3702112019WGS84%40huangdaoqu_bianjie',
//rasterfunction: new SuperMap.NDVIParameter({ redIndex: 0, nirIndex: 2 }),
cacheEnabled: false,
}),
@ -1325,14 +1328,16 @@ function QueryData(e, name, url, item) {
value.value = code;
getTownships();
let arr = [];
Township.brr.forEach(item => {
if (item.tomeCode == code) {
name = item.tomeName;
arr.push(item);
}
getTownship('370211').then(res => {
res.data.forEach(item => {
if (item.tomeCode == code) {
name = item.tomeName;
arr.push(item);
}
});
alterArr.value = arr;
alter();
});
alter();
} else if (
item == '村' &&
data.result.recordsets[0].features.features[0].properties.CJQYDM
@ -1585,9 +1590,14 @@ function rightFoldClick() {
}
}
const handleData = oldData => {
oldDatas.value = oldData;
};
//接口
//镇
const getTownships = city => {
const getTownships = (city, time) => {
console.log(time);
dd = {
小麦: [],
玉米: [],
@ -1600,7 +1610,7 @@ const getTownships = city => {
白菜和萝卜: [],
其他: [],
};
getTownship({ divisions: city }).then(res => {
getTownship({ divisions: city, yearMonth: time }).then(res => {
res.data.forEach((item, i) => {
for (let index = 0; index < Object.values(item).length; index++) {
if (Object.values(item)[index] == '0.0') {
@ -1732,13 +1742,10 @@ const getaArea = () => {
};
//作物分类面积统计
const getcroppers = city => {
console.log(111);
classData = ref([]);
namedata = ref([]);
console.log(classData);
getcropper({ divisions: city }).then(res => {
console.log(res.data);
const getcroppers = (city, time) => {
getcropper({ divisions: city, yearMonth: time }).then(res => {
classData = ref([]);
namedata = ref([]);
res.data.forEach(item => {
classData.value.unshift(item.area);
namedata.value.unshift(item.name);
@ -1747,9 +1754,9 @@ const getcroppers = city => {
});
};
//作物类型统计
const getcropTypeStatisticss = city => {
Pie3D.arr = [];
getcropTypeStatistics({ divisions: city }).then(res => {
const getcropTypeStatisticss = (city, time) => {
getcropTypeStatistics({ divisions: city, yearMonth: time }).then(res => {
Pie3D.arr = [];
let arr = [];
res.data.forEach(item => {
for (let index = 0; index < dictionaryArr.length; index++) {
@ -1779,8 +1786,8 @@ const getcropTypeStatisticss = city => {
};
//高标准农田//highStandarditem
let highStandardArr = ref([]);
const gethighStandards = () => {
gethighStandard().then(res => {
const gethighStandards = time => {
gethighStandard({ yearMonth: time }).then(res => {
highStandardArr.value = res.data;
console.log(res.data);
highStandard.forEach((item, indexs) => {
@ -1792,7 +1799,7 @@ const gethighStandards = () => {
Object.keys(dd).forEach(it => {
const index = town.findIndex(a => a && a.name === it && Number(a.area) > 0);
if (index > -1) {
highStandarditem[it].push(100);
highStandarditem[it].push(70);
} else {
highStandarditem[it].push(null);
}
@ -1804,22 +1811,30 @@ const gethighStandards = () => {
const selectTab = () => {
if (value.value == '370211') {
getTownships('370211');
getcroppers('370211'); //作物分类面积请求
getcropTypeStatisticss('370211'); //作物类型统计百分比
getTownships('370211', oldDatas.value.name);
getcroppers('370211', oldDatas.value.name); //作物分类面积请求
getcropTypeStatisticss('370211', oldDatas.value.name); //作物类型统计百分比
return;
} else {
getcroppers(value.value); //作物分类面积请求
getcropTypeStatisticss(value.value); //作物类型统计百分比
getvillages(value.value);
console.log(oldDatas);
getcroppers(value.value, oldDatas.value.name); //作物分类面积请求
getcropTypeStatisticss(value.value, oldDatas.value.name); //作物类型统计百分比
getvillages(value.value, oldDatas.value.name);
}
};
//列表模式-年
const theTimes = () => {
gettheTime().then(res => {
oldDatas.value = { name: res.data[0] };
timeArr.value = res.data;
formInline.value.yearMonth = res.data[0];
getlistModes(res.data[0]);
res.data.forEach(item => {
dataSource.value.push({ name: item });
});
console.log(dataSource.value);
console.log('1111');
});
};
//列表模式-默认展示
@ -2510,6 +2525,72 @@ function farmland() {
},
},
},
{
name: '蓝莓',
type: 'bar',
barWidth: 12,
stack: 'stack',
data: highStandarditem.蓝莓,
itemStyle: {
normal: {
barBorderRadius: 0,
color: new echarts.graphic.LinearGradient(0, 0, 0.9, 0, [
{
offset: 1,
color: 'rgba(0, 153, 255, 1)',
},
{
offset: 0,
color: 'rgba(0, 153, 255, 1)',
},
]),
},
},
},
{
name: '地瓜',
type: 'bar',
barWidth: 12,
stack: 'stack',
data: highStandarditem.地瓜,
itemStyle: {
normal: {
barBorderRadius: 0,
color: new echarts.graphic.LinearGradient(0, 0, 0.9, 0, [
{
offset: 1,
color: 'rgba(255, 18, 18, 1)',
},
{
offset: 0,
color: 'rgba(255, 18, 18, 1)',
},
]),
},
},
},
{
name: '其他',
type: 'bar',
barWidth: 12,
stack: 'stack',
data: highStandarditem.其他,
itemStyle: {
normal: {
barBorderRadius: 0,
color: new echarts.graphic.LinearGradient(0, 0, 0.9, 0, [
{
offset: 1,
color: 'rgba(166, 224, 255, 1)',
},
{
offset: 0,
color: 'rgba(166, 224, 255, 1)',
},
]),
},
},
},
],
};
@ -3711,12 +3792,12 @@ $height: calc(100vh - 100px);
/*设置弹出框样式*/
.ol-popup {
position: absolute;
background-color: #eeeeee;
// background-color: #eeeeee;
-webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
padding: 15px;
// padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
// border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
@ -3746,22 +3827,56 @@ $height: calc(100vh - 100px);
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
top: 11px;
right: 8px;
color: rgba(47, 214, 214, 1) !important;
}
.ol-popup-closer:after {
content: '✖';
}
#popup {
border-radius: 5px;
background: rgba(2, 31, 26, 1);
// display: none;
// justify-content: flex-start;
// align-items: flex-end;
padding: 30px 8px 20px 8px;
color: #fff;
box-shadow: inset 0px 0px 15px 6px rgba(41, 255, 255, 0.5);
border: rgba(41, 255, 255, 1);
.pophead {
background-image: url('@/assets/images/top.png') !important;
background-repeat: no-repeat;
height: 42px;
opacity: 1;
background: linear-gradient(270deg, rgba(19, 92, 98, 0.4) 0%, rgba(19, 92, 98, 1) 100%);
}
#popup-content {
background-image: url('@/assets/images/bottom.png') !important;
background-repeat: no-repeat;
background-size: 100% !important;
width: 522px;
height: 365px;
opacity: 1;
background: rgba(2, 31, 26, 0.7);
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
p {
width: 223px;
height: 28px;
line-height: 28px;
font-size: 14px;
background: linear-gradient(
270deg,
rgba(19, 92, 98, 0) 0%,
rgba(33, 169, 169, 0.36) 100%
);
padding-left: 18px;
display: flex;
background-image: url('@/assets/images/duande.png') !important;
background-repeat: no-repeat;
background-size: 100% !important;
.label {
color: rgba(47, 214, 214, 1);
}
span {
color: #fff;
}
}
}
}
.back_button {

View File

@ -112,7 +112,11 @@
</div>
<div class="bottom_center">
<TimeLine />
<TimeLine
v-if="dataSource.length > 0"
:dataSource="dataSource"
@dataHandle="handleData"
/>
</div>
<div class="tool">
<span><img src="@/assets/images/LAYER.png" alt="" /></span>
@ -375,10 +379,9 @@ let tableItemAll = ref([]);
const num = ref(1);
let operate = ref(true);
const chartModeDiv = ref(null);
let cunVar = ref(null);
let zhenVar = ref(null);
let regionName = ref('');
let flags = ref(false);
let dataSource = ref([]);
let oldDatas = ref('');
let amount = ref([
{
wheatUnitOutputValue: 0,
@ -392,23 +395,8 @@ let formInline = ref({
droughtRating: '小麦',
area: num.value,
});
//行政区划数据
var data = {
title: [],
};
let dd = {
小麦: [],
玉米: [],
大豆: [],
地瓜: [],
花生: [],
蓝莓: [],
茶叶: [],
马铃薯: [],
白菜和萝卜: [],
其他: [],
};
let areatext = '8383894';
let layers = ref(null); //村
// 组件挂载完成后执行
onMounted(() => {
@ -416,16 +404,11 @@ onMounted(() => {
});
function initonMounted() {
getwheatTotalYearValues(); //作物产量预估
getwheatHeightStandardFarmlands(); //高标准农田
getwheatGetAllTownss(); //镇级
getparameterEstimationYears(); //年
//地图
initMap();
initmap();
farmland();
// ProgressBar();
ASdivision();
getFarmland();
}
onUpdated(() => {
if (localStorage.getItem(router.currentRoute.value.path) == 'false') {
@ -434,597 +417,147 @@ onUpdated(() => {
document.querySelector('.mode').innerText = '列表模式';
}
});
watch(
() => oldDatas.value,
(val, oldVal) => {
value.value = '370211';
getwheatTotalYearValues(value.value,oldDatas.value.name); //作物产量预估
getwheatHeightStandardFarmlands(value.value,oldDatas.value.name); //高标准农田
getwheatGetAllTownss(value.value,oldDatas.value.name); //镇级
}
);
/*-------------地图------------------------*/
const mapOption = {
url:
'http://{s}.tianditu.gov.cn/img_c/wmts?service=wmts&request=GetTile&version=1.0.0' +
'&LAYER=img&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}' +
'&style=default&format=tiles&tk=31091965e263284a501a723b8909f405',
layer: 'tdtCva',
style: 'default',
format: 'tiles',
tileMatrixSetID: 'c',
subdomains: ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7'],
tilingScheme: new Cesium.GeographicTilingScheme(),
tileMatrixLabels: [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
'18',
'19',
],
maximumLevel: 18,
};
Cesium.Ion.defaultAccessToken =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiYzcwZmJmNi02MzQ5LTQ1MGEtODgzMy0yZTZiZGExY2MzMGMiLCJpZCI6MTAxOTgsInNjb3BlcyI6WyJhc2wiLCJhc3IiLCJnYyJdLCJpYXQiOjE1ODEzMDgxNTR9.NeJU4yfUi-SnLrNDOBYsQgmiSh3B4axCTi1m84Qw99c';
function initMap() {
viewer = new Cesium.Viewer('cesiumContainer', {
baseLayerPicker: false,
shouldAnimate: true, //自动播放
infoBox: false, //信息框
animation: false, //“动画”窗口小部件提供用于播放暂停和倒退的按钮以及当前时间和日期并由“飞梭环”包围用于控制动画的速度。cesium示例地图左下角那个
timeline: false, //时间轴是用于显示和控制当前场景时间的小部件。
geocoder: false, //查找,用于查找地址和地标,以及将照相机悬挂到它们。使用铯离子进行地址解析。,cesium示例地图右上角的放大镜
homeButton: false, //主页按钮
navigationHelpButton: false, //导航帮助按钮
selectionIndicator: false, //原生选择绿框
fullscreenButton: false, //右下角的全屏按钮
// terrainProvider:new Cesium.createWorldTerrain(),
terrainProvider: new Cesium.EllipsoidTerrainProvider({}),
sceneModePicker: false, //是否显示投影方式控件
contextOptions: {
webgl: {
alpha: true,
},
},
imageryProvider: new Cesium.WebMapTileServiceImageryProvider({
...mapOption,
let map = ref(null);
let container = ref(null);
let content = ref(null);
let popupCloser = ref(null);
let overlay = ref(null);
function initmap() {
// 获取父元素和地图容器
var parentElement = document.querySelector('.center');
var mapContainer = document.getElementById('cesiumContainer');
map = new ol.Map({
target: 'cesiumContainer',
controls: [],
view: new ol.View({
center: [119.86763411957472, 35.88435182141938],
zoom: 11,
projection: 'EPSG:4326',
}),
layers: [
new ol.layer.Tile({
source: new ol.source.Tianditu({
layerType: 'img',
key: '1d109683f4d84198e37a38c442d68311',
}),
}),
//注记
// new ol.layer.Tile({
// source: new ol.source.Tianditu({
// layerType: 'img',
// isLabel: true,
// key: '1d109683f4d84198e37a38c442d68311',
// }),
// }),
],
});
// 去除logo
viewer.cesiumWidget.creditContainer.style.display = 'none';
//加载地图服务
viewer.camera.flyTo({
destination: Cesium.Rectangle.fromDegrees(119.5091, 35.5671, 120.3285, 36.1455),
duration: 2,
});
// 图层点击事件
// layerClick();
// 蒙版
mbHandle();
getAreaFenlei();
viewer.scene.screenSpaceCameraController.minimumZoomDistance = 450; //相机的高度的最小值
viewer.scene.screenSpaceCameraController.maximumZoomDistance = 720000; //相机高度的最大值
viewer.scene.screenSpaceCameraController._minimumZoomRate = 30000; // 设置相机缩小时的速率
viewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000; //设置相机放大时的速率
cun(); //添加村
zhen(); //添加镇
addWheelEvent(); //鼠标滚动控制村级矢量显示隐藏
addEvent(); //点击事件
}
//鼠标滑轮事件
const addWheelEvent = () => {
const handler = viewer.scene.preRender.addEventListener(() => {
{
//从Cesium中获取当前地图瓦片等级
if (viewer.camera.positionCartographic.height <= 13000) {
cunVar.show = true;
} else {
cunVar.show = false;
zhenVar.show = true;
}
cun();
zhen();
//滚轮控制村级矢量
map.on('moveend', function (e) {
var zoom = map.getView().getZoom(); //获取当前地图的缩放级别
if (zoom >= 13) {
layers.setVisible(true); //显示图层
} else {
layers.setVisible(false);
}
});
};
map.on('singleclick', function (e) {
var coodinate = e.coordinate;
var lon = coodinate[0];
var lat = coodinate[1];
var view = map.getView();
var zoom = map.getView().getZoom();
console.log(lon, lat);
view.animate({
center: [lon, lat],
duration: 1000,
});
if (zoom >= 13) {
QueryData(
e,
'CJQY3702112019WGS84@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/CJQY3702112019WGS84%40huangdaoqu_bianjie',
'村'
);
} else {
QueryData(
e,
'XJQY3702112019WGS84@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/XJQY3702112019WGS84%40huangdaoqu_bianjie',
'镇'
);
}
});
// 监听父元素大小变化
var resizeObserver = new ResizeObserver(function (entries) {
entries.forEach(function (entry) {
// 获取父元素的新大小
var newWidth = entry.contentRect.width;
var newHeight = entry.contentRect.height;
// 调整地图容器的大小
mapContainer.style.width = newWidth + 'px';
mapContainer.style.height = newHeight + 'px';
// 重新渲染地图
map.updateSize();
});
});
// 开始监听父元素大小变化
resizeObserver.observe(parentElement);
}
const cun = () => {
var shp = new Cesium.WebMapServiceImageryProvider({
url: serverAPI.geoserverUrl + `/map-huangdaoqu_village/wms111/`,
layers: 'huangdaoqu_village@huangdaoqu_village',
tileWidth: '256', //图片宽高
tileHeight: '256', //图片宽高
//STYLES: 'landmarks',
//SLD_BODY: yanshi,
enablePickFeatures: true, //是否允许点击
parameters: {
service: 'WMS',
format: 'image/png',
srs: 'EPSG:4326',
VERSION: '1.1.1',
transparent: true, //是否透明
exceptions: 'application/vnd.ogc.se_inimage',
},
layers = new ol.layer.Tile({
source: new ol.source.TileSuperMapRest({
url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/CJQY3702112019WGS84%40huangdaoqu_bianjie',
//rasterfunction: new SuperMap.NDVIParameter({ redIndex: 0, nirIndex: 2 }),
cacheEnabled: false,
}),
name: 'huangdaoqu_village',
projection: 'EPSG:4326', //3857
zIndex: 9999,
});
cunVar = viewer.imageryLayers.addImageryProvider(shp);
cunVar.show = false;
map.addLayer(layers);
};
const zhen = () => {
var shp = new Cesium.WebMapServiceImageryProvider({
url: serverAPI.geoserverUrl + '/map-huangdaoqu_town/wms111/',
layers: 'huangdaoqu_town@huangdaoqu_town',
tileWidth: '256', //图片宽高
tileHeight: '256', //图片宽高
//STYLES: 'landmarks',
//SLD_BODY: yanshi,
enablePickFeatures: true, //是否允许点击
parameters: {
service: 'WMS',
format: 'image/png',
srs: 'EPSG:4326',
VERSION: '1.1.1',
transparent: true, //是否透明
exceptions: 'application/vnd.ogc.se_inimage',
},
var layer = new ol.layer.Tile({
source: new ol.source.TileSuperMapRest({
url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/XJQY3702112019WGS84%40huangdaoqu_bianjie',
//rasterfunction: new SuperMap.NDVIParameter({ redIndex: 0, nirIndex: 2 }),
cacheEnabled: false,
}),
projection: 'EPSG:4326', //3857
zIndex: 9999,
});
zhenVar = viewer.imageryLayers.addImageryProvider(shp);
map.addLayer(layer);
};
const addEvent = () => {
let handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(event => {
// event.position 是鼠标获取的屏幕坐标也就是2D笛卡尔点Cartesian2
// 屏幕坐标转为世界坐标
let cartesian = viewer.scene.globe.pick(
viewer.camera.getPickRay(event.position),
viewer.scene
);
// 世界坐标转换为弧度
let ellipsoid = viewer.scene.globe.ellipsoid;
let cartographic = ellipsoid.cartesianToCartographic(cartesian);
// 弧度转换为经纬度
let lon = Cesium.Math.toDegrees(cartographic.longitude); // 经度
let lat = Cesium.Math.toDegrees(cartographic.latitude); // 纬度
// console.log(lon ,lat)
//选择feature
viewer.selectedEntity = undefined;
var pickRay = viewer.camera.getPickRay(event.position);
var featuresPromise = viewer.imageryLayers.pickImageryLayerFeatures(pickRay, viewer.scene);
// 用 async 函数包装事件处理逻辑
(async () => {
if (!Cesium.defined(featuresPromise)) {
console.log('No features picked.');
} else {
try {
// 使用 await 处理异步结果
const features = await featuresPromise;
if (!features[features.length - 1].properties.XZQDM) {
value.value = features[features.length - 1].properties.XZDM;
regionName.value = features[features.length - 1].properties.XZMC;
getwheatGetAllTowns({ divisions: value.value }).then(res => {
let arr = [];
res.data.forEach(item => {
if (item.subName == features[features.length - 1].properties.XZMC) {
arr.push(item);
}
});
clickInfoMap.value = {
info: arr,
lon: lon,
lat: lat,
};
});
selectTab();
} else {
// value.value = features[features.length - 1].properties.XZDM;
// regionName.value = features[features.length - 1].properties.XZQMC;
// getvillage({
// divisions: features[features.length - 1].properties.XZDM,
// }).then(res => {
// let arr = [];
// res.data.forEach(item => {
// if (
// item.tomeName == features[features.length - 1].properties.XZQMC
// ) {
// arr.push(item);
// }
// });
// clickInfoMap.value = {
// info: arr,
// lon: lon,
// lat: lat,
// };
// });
}
showOverlayChart(event.position); // 添加地图移动监听:使地图移动弹窗跟着移动
viewer.scene.postRender.addEventListener(infoWindowPostRender);
// This function is called asynchronously when the list of picked features is available.
} catch (error) {
console.error('Error occurred:', error);
}
}
})();
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
const addwms = name => {
let layer = new ol.layer.Tile({
source: new ol.source.TileSuperMapRest({
// url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_village/rest/maps/huangdaoqu_village@huangdaoqu_village',
url: serverAPI.geoserverUrl + `/map-${name.setOf}/rest/maps/${name.name}@${name.setOf}`,
//rasterfunction: new SuperMap.NDVIParameter({ redIndex: 0, nirIndex: 2 }),
cacheEnabled: false,
}),
name: name.name,
projection: 'EPSG:4326', //3857
});
map.addLayer(layer);
};
// data数据数组
// name实体名称方便以后删除
// color实体颜色
function addBoundaryHandle(data, name, color) {
data.forEach(item => {
let arr = [];
item[0].forEach(mem => {
arr.push(mem[0]);
arr.push(mem[1]);
});
viewer.entities.add({
name: name,
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray(arr),
width: 6,
// material: new Cesium.PolylineDashMaterialProperty({//虚线
material: new Cesium.PolylineGlowMaterialProperty({
//光晕
glowPower: 0.2,
color: color
? Cesium.Color.fromCssColorString(color)
: Cesium.Color.fromBytes(250, 128, 114), //#FA8072
}),
// followSurface: false, //是否贴着地表
clampToGround: true, //贴地
},
});
});
}
function getLevel(height) {
if (height > 48000000) {
return 0;
} else if (height > 24000000) {
return 1;
} else if (height > 12000000) {
return 2;
} else if (height > 6000000) {
return 3;
} else if (height > 3000000) {
return 4;
} else if (height > 1500000) {
return 5;
} else if (height > 750000) {
return 6;
} else if (height > 375000) {
return 7;
} else if (height > 187500) {
return 8;
} else if (height > 93750) {
return 9;
} else if (height > 46875) {
return 10;
} else if (height > 23437.5) {
return 11;
} else if (height > 11718.75) {
return 12;
} else if (height > 5859.38) {
return 13;
} else if (height > 2929.69) {
return 14;
} else if (height > 1464.84) {
return 15;
} else if (height > 732.42) {
return 16;
} else if (height > 366.21) {
return 17;
} else {
return 18;
}
}
function getFarmland() {
axios({
url:
serverAPI.geoserverUrl +
'/shuzisannong/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shuzisannong%3Afarmland&maxFeatures=50&outputFormat=application%2Fjson',
method: 'get',
})
.then(res => {
console.log('农田:', res);
formLandRef.value = res.data.features;
})
.catch(err => {});
}
let townZuowu = ref({ label: [] }); //镇的作物
let XZDM = '';
let cartesians = ref([]);
// 图层点击事件
function layerClick() {
var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
handler.setInputAction(function (movement) {
var ray = viewer.camera.getPickRay(movement.position);
var ellipsoid = viewer.scene.globe.ellipsoid; // 将屏幕坐标转为地理坐标
var cartesian = viewer.scene.globe.pick(ray, viewer.scene);
cartesians = cartesian;
if (cartesian) {
let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
if (cartographic) {
let xy = new Cesium.Cartesian2();
let alti = viewer.camera.positionCartographic.height;
let level = getLevel(alti);
const layers = viewer.imageryLayers._layers;
const index = layers.findIndex(
item =>
item._imageryProvider._layers &&
item._imageryProvider._layers === 'shuzisannong:huangdaoqu_town'
);
if (index > -1) {
const providerPoint = layers[index];
// 拿取最后一个图层
let provider = providerPoint._imageryProvider;
if (
provider &&
provider.ready &&
provider._layers &&
providerPoint.show === true
) {
xy = provider.tilingScheme.positionToTileXY(cartographic, level, xy);
let promise = provider.pickFeatures(
xy.x,
xy.y,
level,
cartographic.longitude,
cartographic.latitude
);
if (promise) {
promise.then(data => {
if (data.length > 0) {
let newData = data['0'];
if (newData.properties && newData.properties.XZDM) {
if (XZDM !== newData.properties.XZDM) {
//防止
XZDM = newData.properties.XZDM;
value.value = XZDM; //
let item = newData.data;
// 定位
viewer.camera.flyTo({
destination: Cesium.Rectangle.fromDegrees(
item.bbox[0],
item.bbox[1],
item.bbox[2],
item.bbox[3]
),
duration: 2,
});
// 移除高亮
deleteEntityByName('townLine');
// 高亮边界
addBoundaryHandle(
item.geometry && item.geometry.coordinates,
'townLine',
'yellow'
);
// 移除以前的
removeWms(['village_CQL']);
// 添加新的
// addvillage(
// `XZDM=${newData.properties.XZDM}`,
// 'village_CQL'
// );
let entitys = viewer.entities._entities._array;
insectarr.value.forEach(item => {
for (var na = entitys.length - 1; na >= 0; na--) {
if (newData.properties.XZDM == item.subregion) {
clickInfoMap.value = item;
let info = entitys[na]._info;
if (cartesian) {
let cartographic =
ellipsoid.cartesianToCartographic(
cartesian
);
let longitudeString =
Cesium.Math.toDegrees(
cartographic.longitude
).toFixed(6);
let latitudeString =
Cesium.Math.toDegrees(
cartographic.latitude
).toFixed(6);
townZuowu.value = {
lon: longitudeString,
lat: latitudeString,
};
}
showOverlayChart(movement.position); // 添加地图移动监听:使地图移动弹窗跟着移动
viewer.scene.postRender.addEventListener(
infoWindowPostRender
);
} else {
// if (entitys[na].label) {
// entitys[na].label.show = false
// }
}
}
});
// 显示该镇的种植结构
for (var na = entitys.length - 1; na >= 0; na--) {
if (
entitys[na]._name &&
entitys[na]._name ===
'point' + newData.properties.XZDM
) {
let info = entitys[na]._info;
// entitys[na].label.show = true
townZuowu.value = info; //保存数据
showOverlayChart(movement.position); // 添加地图移动监听:使地图移动弹窗跟着移动
viewer.scene.postRender.addEventListener(
infoWindowPostRender
);
} else {
// if (entitys[na].label) {
// entitys[na].label.show = false
// }
}
}
// 移除村高亮
// deleteEntityByName('villageLine');
XZQDM = '';
} else {
// // 已经有镇了,监听村点击
// villageClick(layers, xy, level, cartographic);
}
} else {
removeWms(['village_CQL']);
// 移除框框
hiddenOverlayChart(); // 清除监听事件
}
}
});
}
}
}
}
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
}
let XZQDM = '';
// 村点击高亮
function villageClick(layers, xy, level, cartographic) {
const index = layers.findIndex(
item =>
item._imageryProvider._layers &&
item._imageryProvider._layers === 'shuzisannong:huangdaoqu_village'
);
if (index > -1) {
const providerPoint = layers[index];
// 拿取最后一个图层
let provider = providerPoint._imageryProvider;
if (provider && provider.ready && provider._layers && providerPoint.show === true) {
xy = provider.tilingScheme.positionToTileXY(cartographic, level, xy);
let promise = provider.pickFeatures(
xy.x,
xy.y,
level,
cartographic.longitude,
cartographic.latitude
);
if (promise) {
promise.then(data => {
if (data.length > 0) {
let newData = data['0'];
if (newData.properties && newData.properties.XZQDM) {
if (XZQDM !== newData.properties.XZQDM) {
//防止
XZQDM = newData.properties.XZQDM;
let item = newData.data;
// 移除高亮
deleteEntityByName('villageLine');
// 高亮边界
addBoundaryHandle(
item.geometry && item.geometry.coordinates,
'villageLine',
'yellow'
);
// townZuowu.value = info//保存数据
// 后插和村
if (newData.properties.XZQDM === '370211104217') {
// console.log('后河岔村委会')
const rectangle = Cesium.Rectangle.fromDegrees(
item.bbox[0],
item.bbox[1],
item.bbox[2],
item.bbox[3]
);
const center = Cesium.Rectangle.center(rectangle); //获取视角范围中心点(得到的结果为弧度Cartographic)
let longitude = Cesium.Math.toDegrees(center.longitude); //将弧度转为度
let latitude = Cesium.Math.toDegrees(center.latitude);
let info = {
lon: longitude,
lat: latitude,
...item.properties,
// XZQMC
label: [
{ crop: '茶叶', Shape_Area: 2820 },
{ crop: '大豆', Shape_Area: 2767 },
{ crop: '花生', Shape_Area: 62356 },
{ crop: '蓝莓', Shape_Area: 5443 },
{ crop: '地瓜', Shape_Area: 897 },
{ crop: '小麦', Shape_Area: 20111 },
],
};
townZuowu.value = info; //保存数据
}
}
}
}
});
}
}
}
}
// 添加村
// CQL_FILTER:筛选的语句
// customName地图服务自定义属性名
function addvillage(CQL_FILTER, customName) {
let map2 = new Cesium.WebMapServiceImageryProvider({
url: `${serverAPI.geoserverUrl}/shuzisannong/wms`,
layers: 'shuzisannong:huangdaoqu_village', //图层名
parameters: {
service: 'WMS',
format: 'image/png',
transparent: true, //是否透明
// CQL_FILTER: `XZDM=${value.value}`,
CQL_FILTER: CQL_FILTER,
},
});
map2.customName = customName;
viewer.imageryLayers.addImageryProvider(map2);
}
// 移除wms
// nameArry 属性名数组customName
// isMohu :是否模糊查询
function removeWms(nameArry, isMohu) {
if (viewer) {
// 倒叙遍历customName是自定义的属性
const layers = viewer.imageryLayers._layers;
for (let f = layers.length - 1; f >= 0; f--) {
nameArry.forEach(item => {
if (layers[f]._imageryProvider && layers[f]._imageryProvider.customName) {
if (isMohu) {
if (layers[f]._imageryProvider.customName.indexOf(item) > -1) {
viewer.imageryLayers.remove(layers[f]);
}
} else {
if (layers[f]._imageryProvider.customName === item) {
viewer.imageryLayers.remove(layers[f]);
}
}
}
});
}
}
}
// 根据实体名字删除实体(模糊删除)
function deleteEntityByName(name) {
if (viewer) {
let entitys = viewer.entities._entities._array;
for (var na = entitys.length - 1; na >= 0; na--) {
if (entitys[na]._name && entitys[na]._name === name) {
viewer.entities.remove(entitys[na]);
}
}
}
}
//折叠
function leftFoldClick() {
@ -1069,7 +602,10 @@ const SwitchMode = () => {
//列表模式年
const getparameterEstimationYears = () => {
getparameterEstimationYear().then(res => {
console.log(res.data);
oldDatas.value = { name: res.data[0] };
res.data.forEach(item => {
dataSource.value.push({ name: item });
});
formInline.value.time = res.data[res.data.length - 1];
timeArr.value = res.data;
onSubmit();
@ -1077,22 +613,22 @@ const getparameterEstimationYears = () => {
};
//产量预估
const getwheatTotalYearValues = city => {
getwheatTotalYearValue({ divisions: city }).then(res => {
const getwheatTotalYearValues = (city,time) => {
getwheatTotalYearValue({ divisions: city , yearMonth:time}).then(res => {
estimate.value = res.data;
areachar();
});
};
//高标准农田
const getwheatHeightStandardFarmlands = city => {
getwheatHeightStandardFarmland({ divisions: city }).then(res => {
const getwheatHeightStandardFarmlands = (city ,time)=> {
getwheatHeightStandardFarmland({ divisions: city , yearMonth:time}).then(res => {
standardArr.value = res.data;
farmland();
});
};
//镇
const getwheatGetAllTownss = () => {
getwheatGetAllTowns().then(res => {
const getwheatGetAllTownss = (city ,time) => {
getwheatGetAllTowns({ divisions: city , yearMonth:time}).then(res => {
administration.value = res.data;
Township.brr = JSON.parse(JSON.stringify(res.data));
Township.arr = Township.brr.sort((a, b) => {
@ -1243,7 +779,7 @@ const onSubmit = () => {
}
}
const statInfo = chartModeDiv.value; // 获取图表元素
statInfo.style.width = document.querySelector('.app-main').offsetWidth-50 + 'px'; //初始化echarts图表宽度
statInfo.style.width = document.querySelector('.app-main').offsetWidth - 50 + 'px'; //初始化echarts图表宽度
statInfo.style.height = document.querySelector('.app-main').offsetHeight + 'px';
const myChart = echarts.init(statInfo);
// 设置宽度自适应
@ -1317,6 +853,9 @@ const Nindex = index => {
return index + 1 + (page - 1) * pagesize;
};
const handleData = oldData => {
oldDatas.value = oldData;
};
/*-------------echarts--------------*/
function areachar() {

View File

@ -31,7 +31,7 @@
</div>
<div ref="typesofDiv" class="typesofDiv"></div>
<div class="tableDiv">
<el-table :data="tableData" style="width: 100%">
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="date" label="类型" />
<el-table-column prop="name" label="面积(亩)" />
<el-table-column prop="address" label="占比" />
@ -145,7 +145,11 @@
</div>
<div class="bottom_center">
<TimeLine />
<TimeLine
v-if="dataSource.length > 0"
:dataSource="dataSource"
@dataHandle="handleData"
/>
</div>
<div class="tool">
<span><img src="@/assets/images/LAYER.png" alt="" /></span>
@ -156,27 +160,54 @@
<span><img src="@/assets/images/position.png" alt="" /></span>
</div>
<div id="popup" class="ol-popup">
<div class="pophead" style="width: 100%; height: 20px">
<div class="pophead" style="width: 100%">
<div
id="popup-title"
style="
font: bold 15px sans-serif;
align: left;
position: absolute;
/* top: 5px; */
left: 17px;
color: #fff;
font-size: 20px;
font-weight: 400;
letter-spacing: 1px;
color: rgba(246, 255, 255, 1);
line-height: 42px;
padding-left: 45px;
"
></div>
<a
href="#"
id="popup-closer"
class="ol-popup-closer"
style="color: #8e908c"
></a>
<a href="#" id="popup-closer" class="ol-popup-closer"></a>
</div>
<div id="popup-content" style="padding: 10px">
<div>
<div class="perform">
<div class="perform_children">
<img src="@/assets/images/icon.png" />
<span class="label"></span>
<span>{{ alterArr.good }}</span>
</div>
<div class="perform_children">
<img src="@/assets/images/icon.png" />
<span class="label">较好</span>
<span>{{ alterArr.better }}</span>
</div>
</div>
<div class="perform">
<div class="perform_children">
<img src="@/assets/images/icon.png" />
<span class="label">适中</span>
<span>{{ alterArr.moderate }}</span>
</div>
<div class="perform_children">
<img src="@/assets/images/icon.png" />
<span class="label">较差</span>
<span>{{ alterArr.poor }}</span>
</div>
</div>
<div class="perform">
<div class="perform_children">
<img src="@/assets/images/icon.png" />
<span class="label"></span>
<span>{{ alterArr.difference }}</span>
</div>
</div>
<!-- <div>
<p>
<span></span>
:
@ -202,7 +233,7 @@
:
<span>{{ alterArr.difference }}()</span>
</p>
</div>
</div> -->
</div>
<div id="popup-pagination"></div>
</div>
@ -369,7 +400,6 @@ import {
gethighStandards,
getgradeStatistics,
getadministrativeDivisions,
getgarrison,
getgrowthTime,
getgrowthList,
getAdministrativeDivisionsChun,
@ -416,6 +446,8 @@ let cunVar = ref(null);
let zhenVar = ref(null);
let regionName = ref('');
let alterArr = ref([]);
let dataSource = ref([]);
let oldDatas = ref('');
let amount = ref([
{
: 0,
@ -489,6 +521,16 @@ watch(
selectTab();
}
);
watch(
() => oldDatas.value,
(val, oldVal) => {
value.value='370211'
getfarmlands(value.value, oldDatas.value.name); //作物长势等级面积统计
getstatisticss(value.value, oldDatas.value.name); //作物长势等级面积占比
getTownships(value.value, oldDatas.value.name);
gethighStandardss(oldDatas.value.name); //高标准农田
}
);
// 农作物
watch(
() => checkList.value,
@ -565,15 +607,10 @@ onMounted(() => {
});
function initonMounted() {
getfarmlands('370211'); //作物长势等级面积统计
getstatisticss('370211'); //作物长势等级面积占比
gethighStandardss(); //高标准农田
getTownships('370211'); //镇
getgrowthTimes(); //年
//地图
initmap();
getFarmland();
showDaChangArea();
alter();
for (const key in dic) {
if (dic[key].disabled !== true) {
@ -606,13 +643,7 @@ function initmap() {
var mapContainer = document.getElementById('cesiumContainer');
map = new ol.Map({
target: 'cesiumContainer',
controls: ol.control
.defaults({
attributionOptions: {
collapsed: true,
},
})
.extend([new ol.supermap.control.Logo(), new ol.control.ScaleLine()]),
controls: [],
view: new ol.View({
center: [119.86763411957472, 35.88435182141938],
zoom: 11,
@ -671,15 +702,15 @@ function initmap() {
if (zoom >= 13) {
QueryData(
e,
'huangdaoqu_village@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/huangdaoqu_village@huangdaoqu_bianjie',
'CJQY3702112019WGS84@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/CJQY3702112019WGS84%40huangdaoqu_bianjie',
'村'
);
} else {
QueryData(
e,
'huangdaoqu_town@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/huangdaoqu_town@huangdaoqu_bianjie',
'XJQY3702112019WGS84@huangdaoqu_bianjie',
'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/XJQY3702112019WGS84%40huangdaoqu_bianjie',
'镇'
);
}
@ -703,6 +734,15 @@ function initmap() {
resizeObserver.observe(parentElement);
}
//创建蒙层,凸显黄岛区域
function showDaChangArea() {
axios.get('/json/huangdao.json').then(({ data }) => {
const fts = new ol.format.GeoJSON().readFeatures(data);
const ft = fts[0];
addConver(ft.getGeometry().getCoordinates());
});
}
function QueryData(e, name, url, item) {
var point = new ol.geom.Point(e.coordinate);
var param = new ol.supermap.QueryByGeometryParameters({
@ -717,7 +757,7 @@ function QueryData(e, name, url, item) {
let layerzhezhao = ref(null);
new ol.supermap.QueryService(url).queryByGeometry(param, function (data) {
let name = '';
layerzhezhao= map
layerzhezhao = map
.getLayers()
.getArray()
.find(layer => layer.get('id') === 'zhezhao');
@ -725,17 +765,17 @@ function QueryData(e, name, url, item) {
if (item == '镇') {
let code = data.result.recordsets[0].features.features[0].properties.XJQYDM;
value.value = code;
getTownships();
let arr = [];
Township.brr.forEach(item => {
if (item.subregion == code) {
name = item.subregionName;
arr.push(item);
alterArr.value = item;
}
console.log(arr);
getgradeStatistics({ divisions: '370211', yearMonth: '2023-05' }).then(res => {
res.data.forEach(item => {
if (item.subregion == code) {
name = item.subregionName;
arr.push(item);
alterArr.value = item;
}
});
alter();
});
alter();
} else if (item == '村') {
let code = data.result.recordsets[0].features.features[0].properties.CJQYDM;
let arr = [];
@ -871,7 +911,7 @@ const cun = () => {
const zhen = () => {
var layer = new ol.layer.Tile({
source: new ol.source.TileSuperMapRest({
url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/huangdaoqu_town@huangdaoqu_bianjie',
url: 'http://36.134.44.75:8090/iserver/services/map-huangdaoqu_bianjie/rest/maps/XJQY3702112019WGS84%40huangdaoqu_bianjie',
//rasterfunction: new SuperMap.NDVIParameter({ redIndex: 0, nirIndex: 2 }),
cacheEnabled: false,
}),
@ -894,19 +934,6 @@ const addwms = name => {
});
map.addLayer(layer);
};
function getFarmland() {
axios({
url:
serverAPI.geoserverUrl +
'/shuzisannong/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=shuzisannong%3Afarmland&maxFeatures=50&outputFormat=application%2Fjson',
method: 'get',
})
.then(res => {
console.log('农田:', res);
formLandRef.value = res.data.features;
})
.catch(err => {});
}
let townZuowu = ref({ label: [] }); //镇的作物
@ -1005,7 +1032,7 @@ const onSubmit = () => {
);
console.log(tableNewData.value);
dowArr = ref([]);
tableNewData.value.forEach(item => {
res.data.forEach(item => {
dowArr.value.push({
区域名称: item.subName,
: item.good,
@ -1015,6 +1042,7 @@ const onSubmit = () => {
: item.difference,
});
});
console.log(dowArr.value)
amount.value[0]['好'] = 0;
amount.value[0]['较好'] = 0;
@ -1073,22 +1101,29 @@ const Nindex = index => {
const pagesize = pageSize.value; // 每页条数
return index + 1 + (page - 1) * pagesize;
};
const handleData = oldData => {
oldDatas.value = oldData;
};
/*------------------接口--------------------*/
//获取年
const getgrowthTimes = () => {
getgrowthTime().then(res => {
oldDatas.value = {name:res.data[0]};
res.data.forEach(item => {
dataSource.value.push({ name: item });
});
timeArr.value = res.data;
formInline.value.time = res.data[0];
onSubmit();
});
};
//作物长势等级面积统计
const getfarmlands = city => {
const getfarmlands = (city, time) => {
areacharLable = ref([]);
areacharPrice = ref([]);
getfarmland({ divisions: city }).then(res => {
getfarmland({ divisions: city, yearMonth: time }).then(res => {
for (const key in res.data[0]) {
if (res.data[0][key]) {
areacharLable.value.push(key);
@ -1099,32 +1134,30 @@ const getfarmlands = city => {
});
};
//作物长势等级面积占比
const getstatisticss = city => {
typesofData = ref([]);
tableData.value = [];
totalArea = ref(0);
getstatistics({ divisions: city }).then(res => {
console.log(res.data);
const getstatisticss = (city, time) => {
getstatistics({ divisions: city, yearMonth: time }).then(res => {
typesofData = ref([]);
let brr=ref([]);
totalArea = ref(0);
res.data.forEach(item => {
totalArea.value = Number(item.sum);
console.log(item);
for (const key in item) {
if (key !== 'sum' && Number.isFinite(item[key])) {
typesofData.value.push({
name: key,
value: item[key],
});
tableData.value.push({
brr.value.push({
date: key,
name: item[key],
});
}
tableData.value.forEach(it => {
brr.value.forEach(it => {
if (item[`${it.date}Zb`] !== undefined) {
it['address'] = (item[`${it.date}Zb`] * 100).toFixed(2) + '%';
}
});
let arr = JSON.parse(JSON.stringify(tableData.value));
let arr = JSON.parse(JSON.stringify(brr.value));
arr.forEach(it => {
switch (it.date) {
case 'good':
@ -1148,6 +1181,8 @@ const getstatisticss = city => {
}
});
tableData.value = arr;
console.log(tableData.value)
}
});
typesof();
@ -1155,9 +1190,9 @@ const getstatisticss = city => {
};
//高标准农田统计
const gethighStandardss = () => {
const gethighStandardss = (time) => {
farmlandData = ref([]);
gethighStandards().then(res => {
gethighStandards({yearMonth: time}).then(res => {
highStandard.forEach((item, index) => {
let town = res.data.map(i => {
if (item === i.region) {
@ -1174,13 +1209,13 @@ const gethighStandardss = () => {
};
//镇
const getTownships = city => {
const getTownships = (city, time) => {
dd.value['better'] = [];
dd.value['difference'] = [];
dd.value['good'] = [];
dd.value['moderate'] = [];
dd.value['poor'] = [];
getgradeStatistics({ divisions: city, yearMonth: '2023-05' }).then(res => {
getgradeStatistics({ divisions: city, yearMonth: time }).then(res => {
console.log(res.data);
Township.brr = res.data;
Township.arr = res.data.sort((a, b) => {
@ -1216,7 +1251,7 @@ const getTownships = city => {
});
};
//村
const getvillages = city => {
const getvillages = (city,time) => {
let newdd = {
good: [],
better: [],
@ -1224,7 +1259,7 @@ const getvillages = city => {
moderate: [],
poor: [],
};
getadministrativeDivisions({ divisions: city }).then(res => {
getadministrativeDivisions({ divisions: city , yearMonth: time}).then(res => {
console.log(res.data);
Township.brr = res.data;
let arr = [...res.data];
@ -1254,15 +1289,15 @@ const getvillages = city => {
const selectTab = () => {
if (value.value !== '370211') {
getvillages(value.value); //村
getfarmlands(value.value); //作物长势等级面积统计
getstatisticss(value.value); //作物长势等级面积占比
getvillages(value.value,oldDatas.value.name); //村
getfarmlands(value.value,oldDatas.value.name); //作物长势等级面积统计
getstatisticss(value.value,oldDatas.value.name); //作物长势等级面积占比
}
if (value.value == '370211') {
getTownships('370211');
getfarmlands('370211'); //作物长势等级面积统计
getstatisticss('370211'); //作物长势等级面积占比
getTownships('370211',oldDatas.value.name);
getfarmlands('370211',oldDatas.value.name); //作物长势等级面积统计
getstatisticss('370211',oldDatas.value.name); //作物长势等级面积占比
}
};
@ -1605,7 +1640,7 @@ function typesof() {
}
});
var data = typesofData.value;
console.log(data);
let option = {
color: [
'rgba(49, 235, 7, 1)',
@ -2408,7 +2443,7 @@ function chartModes() {
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(255, 141, 26, 1)',
color: 'rgba(49, 235, 7, 1)',
},
data: ,
},
@ -2418,7 +2453,7 @@ function chartModes() {
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(255, 255, 26, 1)',
color: 'rgba(84, 170, 255, 1)',
},
data: 较好,
},
@ -2428,7 +2463,7 @@ function chartModes() {
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(255, 201, 148, 1)',
color: 'rgba(255, 251, 0, 1)',
},
data: 适中,
},
@ -2438,7 +2473,7 @@ function chartModes() {
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(255, 84, 84, 1)',
color: 'rgba(255, 168, 8, 1)',
},
data: 较差,
},
@ -2448,7 +2483,7 @@ function chartModes() {
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(255, 140, 255, 1)',
color: 'rgba(255, 0, 255, 1)',
},
data: ,
},
@ -2964,7 +2999,7 @@ $height: calc(100vh - 100px);
}
:deep(.el-checkbox__label) {
color: rgba(255, 255, 255, 1);
color: black;
}
}
@ -3000,12 +3035,12 @@ $height: calc(100vh - 100px);
/*设置弹出框样式*/
.ol-popup {
position: absolute;
background-color: #eeeeee;
// background-color: #eeeeee;
-webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
padding: 15px;
// padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
// border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
@ -3035,23 +3070,60 @@ $height: calc(100vh - 100px);
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
top: 11px;
right: 8px;
color: rgba(47, 214, 214, 1) !important;
}
.ol-popup-closer:after {
content: '✖';
}
#popup {
border-radius: 5px;
background: rgba(2, 31, 26, 1);
// display: none;
// justify-content: flex-start;
// align-items: flex-end;
padding: 30px 8px 20px 8px;
color: #fff;
box-shadow: inset 0px 0px 15px 6px rgba(41, 255, 255, 0.5);
border: rgba(41, 255, 255, 1);
.pophead {
background-image: url('@/assets/images/top.png') !important;
background-repeat: no-repeat;
height: 42px;
opacity: 1;
background: linear-gradient(270deg, rgba(19, 92, 98, 0.4) 0%, rgba(19, 92, 98, 1) 100%);
}
#popup-content {
background: url('@/assets/images/bottom.png') no-repeat !important;
background-size: 100% 100% !important;
width: 410px;
height: 175px;
opacity: 1;
background: rgba(2, 31, 26, 0.7);
// display: flex;
// flex-wrap: wrap;
// align-items: center;
// justify-content: space-between;
.perform {
width: 100%;
margin: 20px 0;
display: flex;
}
.perform_children {
width: 195px;
height: 28px;
line-height: 28px;
font-size: 14px;
background: linear-gradient(
270deg,
rgba(19, 92, 98, 0) 0%,
rgba(33, 169, 169, 0.36) 100%
);
padding-left: 18px;
display: flex;
background-image: url('@/assets/images/duande.png') !important;
background-repeat: no-repeat;
background-size: 100% !important;
.label {
color: rgba(47, 214, 214, 1);
}
span {
color: #fff;
}
}
}
}
#pop {
border-radius: 5px;