Files
Agriculture-front-end/src/views/meteorological/remoteSense/drought/Drought.vue
2023-07-11 08:43:34 +08:00

3262 lines
108 KiB
Vue
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="fatherDiv">
<div class="centerBox">
<div style="width: 100%; height: 100%" id="cesiumContainer"></div>
<div class="leftWra">
<div class="leftTop">
<div class="title">
<span>各干旱等级面积统计</span>
<p @click="Deta()">
下载 &nbsp;
<img
src="@/assets/icons/svg/downloads.svg"
style="width: 14px; height: 14px; cursor: pointer"
/>
</p>
</div>
<div ref="areaDiv" class="areaDiv"></div>
<div ref="leftProgressBarDiv" class="ProgressBar"></div>
</div>
<div class="leftbottom">
<div class="title">
<span>各干旱等级面积占比</span>
<p @click="Deta2()">
下载 &nbsp;
<img
src="@/assets/icons/svg/downloads.svg"
style="width: 14px; height: 14px; cursor: pointer"
/>
</p>
</div>
<div ref="typesofDiv" class="typesofDiv"></div>
<div class="tableDiv">
<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="占比" />
</el-table>
</div>
</div>
<div class="leftFoldDiv" @click="leftFoldClick()">
<el-tooltip
class="box-item"
:show-arrow="false"
:disabled="leftWraFlag"
hide-after="0"
show-after="200"
effect="dark"
content="展开"
placement="top"
>
<img v-if="!leftWraFlag" src="@/assets/images/close1.png" alt="" />
</el-tooltip>
<el-tooltip
:disabled="!leftWraFlag"
:show-arrow="false"
class="box-item"
show-after="200"
hide-after="0"
effect="dark"
content="收起"
placement="top"
>
<img
class="imgrotate"
v-if="leftWraFlag"
src="@/assets/images/close1.png"
alt=""
/>
</el-tooltip>
</div>
</div>
<div class="rightWra">
<div class="rightTop">
<div class="title">
<span>各干旱等级面积统计-高标准农田</span>
<p @click="Deta3()">
下载 &nbsp;
<img
src="@/assets/icons/svg/downloads.svg"
style="width: 14px; height: 14px; cursor: pointer"
/>
</p>
</div>
<div ref="farmlandDiv" class="farmlandDiv"></div>
<!-- <div ref="ProgressBarDiv" class="ProgressBar"></div> -->
</div>
<div class="rightbottom">
<div class="title">
<span>各干旱等级面积统计-行政区划</span>
<p @click="Deta4()">
下载 &nbsp;
<img
src="@/assets/icons/svg/downloads.svg"
style="width: 14px; height: 14px; cursor: pointer"
/>
</p>
</div>
<el-select popper-class="select_city" v-model="value" placeholder="全部">
<el-option
v-for="item in Township.arr"
:key="item.streetCode"
:label="item.streetName"
:value="item.streetCode"
/>
</el-select>
<div ref="ASdivisionDiv" class="ASdivision"></div>
</div>
<div class="rightFoldDiv" @click="rightFoldClick()">
<el-tooltip
:disabled="!rightWraFlag"
:show-arrow="false"
hide-after="0"
show-after="200"
class="box-item"
effect="dark"
content="收起"
placement="top"
>
<img v-if="rightWraFlag" src="@/assets/images/close1.png" alt="" />
</el-tooltip>
<el-tooltip
:disabled="rightWraFlag"
:show-arrow="false"
hide-after="0"
show-after="200"
class="box-item"
effect="dark"
content="展开"
placement="top"
>
<img
class="imgrotate"
v-if="!rightWraFlag"
src="@/assets/images/close1.png"
alt=""
/>
</el-tooltip>
</div>
</div>
<div class="bottom_center">
<TimeLine
v-if="dataSource.length > 0"
:dataSource="dataSource"
@dataHandle="handleData"
/>
</div>
<div class="tool">
<span><img src="@/assets/images/LAYER.png" alt="" /></span>
<span><img src="@/assets/images/amplify.png" alt="" /></span>
<span><img src="@/assets/images/reduce.png" alt="" /></span>
<span><img src="@/assets/images/measure.png" alt="" /></span>
<span><img src="@/assets/images/face.png" alt="" /></span>
<span><img src="@/assets/images/position.png" alt="" /></span>
</div>
<el-collapse class="legend" accordion>
<el-collapse-item name="1">
<template #title>图例</template>
<div class="mt-4">
<el-checkbox-group v-model="checkList" @change="change">
<el-checkbox
v-for="(value, item, key) in dic"
:key="key"
:style="{
backgroundColor: value.color,
border: `1px solid value.color`,
width: `100%`,
}"
:v-model="value.disabled"
:disabled="value.disabled"
:label="item"
/>
</el-checkbox-group>
</div>
</el-collapse-item>
</el-collapse>
<div id="popup" class="ol-popup">
<div class="pophead" style="width: 100%">
<div
id="popup-title"
style="
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"></a>
</div>
<div id="popup-content" style="padding: 10px">
<div class="perform" v-for="(item, index) in alterArr" :key="index">
<div class="perform_children">
<img src="@/assets/images/icon.png" />
<span>{{ item.type }}</span>
:
<span>{{ Number(item.area).toFixed(2) }}()</span>
</div>
</div>
</div>
<div id="popup-pagination"></div>
</div>
<el-button v-if="flag" class="back_button" @click="back()">返回</el-button>
</div>
<div class="tabulation">
<div class="searchDiv">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="时间:">
<el-select
popper-class="selectCity"
v-model="formInline.time"
placeholder="请选择"
>
<el-option
v-for="(item, index) in timeArr"
:key="index"
:label="Zitem"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item label="统计方式:">
<el-select
popper-class="selectCity"
v-model="formInline.statistical"
placeholder="请选择"
>
<el-option label="镇级" value="镇" />
<el-option label="村级" value="村" />
<el-option label="高标准农田" value="高标准农田" />
</el-select>
</el-form-item>
<el-form-item label="干旱等级">
<el-select
v-model="formInline.droughtRating"
popper-class="selectCity"
placeholder="请选择"
>
<el-option label="全部" value="" />
<el-option label="湿润" value="湿润" />
<el-option label="适宜" value="适宜" />
<el-option label="轻度干旱" value="轻度干旱" />
<el-option label="中度干旱" value="中度干旱" />
<el-option label="重度干旱" value="重度干旱" />
</el-select>
</el-form-item>
<el-form-item label="面积(亩)>">
<el-input-number v-model="num" :min="1" @change="handleChange" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
<el-button plain @click="resetForm" :disabled="!SwitchFlag ? true : false">
重置
</el-button>
<el-button v-if="!operate" type="primary" text @click="dowcity">
<img src="@/assets/images/dow.png" alt="" />
下载
</el-button>
</el-form-item>
</el-form>
<div class="modeDiv" @click="SwitchMode">
<div :class="SwitchFlag ? 'Selected' : ''">表格模式</div>
<div :class="SwitchFlag ? '' : 'Selecteds'">图表模式</div>
</div>
</div>
<div v-show="SwitchFlag" class="tableBox">
<div class="tableBorder">
<el-table
:data="amount"
:header-cell-style="{ 'text-align': 'center' }"
style="width: 100%"
highlight-current-row
header-row-class-name="tabth"
v-if="!operate"
>
<el-table-column align="center" prop="合计" width="80" />
<el-table-column
v-for="(item, index) in tableItem"
:key="index"
:prop="item.value"
:label="index == 0 ? item.lable : item.lable + '(亩)'"
align="center"
>
<template #default="scope">
<span
style="color: rgba(255, 168, 8, 0.4); font-weight: 600"
v-if="item.value == '轻度干旱'"
>
{{ scope.row[item.value] }}
</span>
<span
style="color: rgba(255, 168, 8, 1); font-weight: 700"
v-else-if="item.value == '中度干旱'"
>
{{ scope.row[item.value] }}
</span>
<span
style="color: red; font-weight: 800"
v-else-if="item.value == '重度干旱'"
>
{{ scope.row[item.value] }}
</span>
<span v-else>
{{ scope.row[item.value] }}
</span>
</template>
</el-table-column>
</el-table>
</div>
<el-table
:data="tableNewData"
:header-cell-style="{ 'text-align': 'center' }"
height="80%"
highlight-current-row
header-row-class-name="tabth"
>
<el-table-column
type="index"
width="80"
align="center"
label="序号"
:index="Nindex"
/>
<el-table-column
v-for="(item, index) in tableItem"
:key="index"
:prop="item.value"
:label="index == 0 ? item.lable : item.lable + '(亩)'"
align="center"
>
<template #default="scope">
<span
style="color: rgba(255, 168, 8, 0.4); font-weight: 600"
v-if="item.value == '轻度干旱'"
>
{{ scope.row[item.value] }}
</span>
<span
style="color: rgba(255, 168, 8, 1); font-weight: 700"
v-else-if="item.value == '中度干旱'"
>
{{ scope.row[item.value] }}
</span>
<span
style="color: red; font-weight: 800"
v-else-if="item.value == '重度干旱'"
>
{{ scope.row[item.value] }}
</span>
<span v-else>
{{ scope.row[item.value] }}
</span>
</template>
</el-table-column>
</el-table>
<div class="example-pagination-block">
{{ insectarr.length }}
<el-pagination
background
layout="prev, pager, next"
:total="insectarr.length"
:current-page="currentPage"
:page-size="pageSize"
@current-change="handleCurrentChange"
/>
</div>
</div>
<div v-show="!SwitchFlag" class="chartMode">
<div ref="chartModeDiv" class="chartModeDiv"></div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, inject, reactive, watch } from 'vue';
import * as echarts from 'echarts';
import TimeLine from '@/components/TimeLine/TimeLine.vue';
// import * as turf from '@turf/turf';
import { useEcharts } from '@/hooks/useEcharts';
import {
getareaStatisticsDrought,
getproportionOfArea,
geteachFreezingGradeArea,
getTownship,
getadministrative,
getgarrison,
getlistDroughtsYear,
getlistDroughts,
getAdministrativeAreaChun,
} from '@/api/meteorological/remoteSense/drought.js';
import axios from 'axios';
import 'echarts-gl';
import { downLoadFile } from '@/utils/download.js';
import * as xlsx from 'xlsx'; // Vue3 版本
import { useRouter } from 'vue-router';
const router = useRouter();
let viewer = ref(null);
const areaDiv = ref(null);
const typesofDiv = ref(null);
const farmlandDiv = ref(null);
const ProgressBarDiv = ref(null);
const ASdivisionDiv = ref(null);
const value = ref('370211');
const leftProgressBarDiv = ref(null);
let Township = reactive({ arr: [], brr: [], crr: [] }); //街道
const clickInfoMap = ref({});
const formLandRef = ref([]);
const flag = ref(false);
let leftWraFlag = ref(false);
let rightWraFlag = ref(false);
const checkList = ref(['false']);
let areacharLable = ref([]); //面积占比
let areacharPrice = ref([]);
let typesofData = ref([]); //面积统计
let totalArea = ref(0); //总面积
let checkListdata = ref([]);
let SwitchFlag = ref(true);
let timeArr = ref([]); //年数组
const num = ref(1);
let dataSource = ref([]);
let oldDatas = ref('');
let alterArr = ref([]);
let regionName = ref('');
let amount = ref([
{
湿润: 0,
适宜: 0,
轻度干旱: 0,
中度干旱: 0,
重度干旱: 0,
},
]);
let tableNewData = ref([]);
let currentPage = ref(1); //当前页
let pageSize = ref(12); //每页条数
const chartModeDiv = ref(null);
let tableItem = ref([]);
let operate = ref(true);
//搜索
let formInline = ref({
time: '',
statistical: '镇',
droughtRating: '',
area: num.value,
});
const insectarr = ref([]);
let highStandard = [
'高标准农田1.0',
'高标准农田2.0',
'高标准农田3.0',
'高标准农田4.0',
'高标准农田5.0',
'高标准农田6.0',
'高标准农田7.0',
];
let highStandarditem = {
轻度干旱: [],
中度干旱: [],
重度干旱: [],
适宜: [],
湿润: [],
};
let dic = {
湿润: { color: 'rgba(0, 132, 255, 1)', disabled: false },
适宜: { color: 'rgba(32, 242, 255, 1)', disabled: false },
轻度干旱: { color: 'rgba(255, 255, 0, 1)', disabled: false },
中度干旱: { color: 'rgba(255, 168, 8, 1)', disabled: false },
重度干旱: { color: 'rgba(224, 13, 15, 1)', disabled: false },
};
//行政区划数据
var data = {
title: [],
};
let dd = {
适宜: [],
湿润: [],
轻度干旱: [],
中度干旱: [],
重度干旱: [],
};
//表格数据
let tableData = ref([]);
// 图层字典
let layersDic = {
湿润: {
setOf: `2022-12-20-ganhan`,
name: 'T2022_12_20_shirun',
},
适宜: {
setOf: '2022-12-20-ganhan',
name: 'T2022_12_20_shiyi',
},
轻度干旱: {
setOf: '2022-12-20-ganhan',
name: 'T2022_12_20_qingduganhan',
},
中度干旱: {
setOf: '2022-12-20-ganhan',
name: 'T2022_12_20_medium_ganhan',
},
重度干旱: {
setOf: '2022-12-20-ganhan',
name: 'T2022_12_20_serious_ganhan',
},
};
// 组件挂载完成后执行
onMounted(() => {
initonMounted();
});
function initonMounted() {
theTimes(); //年
//地图
initmap();
showDaChangArea();
typesof();
farmland();
// ProgressBar();
ASdivision();
alter();
for (const key in dic) {
if (dic[key].disabled !== true) {
console.log(key);
checkListdata.value.push(key);
}
}
checkList.value = checkListdata.value;
let leftWra = document.querySelector('.leftWra');
leftWra ? (leftWra.style.transform = 'translate(-107%,0)') : '';
let rightWra = document.querySelector('.rightWra');
rightWra.style.transform = 'translate(107%,0)';
localStorage.setItem(router.currentRoute.value.path, true);
}
onUpdated(() => {
if (localStorage.getItem(router.currentRoute.value.path) == 'false') {
document.querySelector('.mode').style.display = 'block';
document.querySelector('.mode').innerText = '地图模式';
window.document.querySelector('#screenfull').style.display = 'none';
} else {
document.querySelector('.mode').style.display = 'block';
document.querySelector('.mode').innerText = '列表模式';
window.document.querySelector('#screenfull').style.display = 'block';
}
});
/*-------------地图------------------------*/
let layers = ref(null); //村
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('.centerBox');
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',
// }),
// }),
],
});
//滚轮控制村级矢量
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);
}
function QueryData(e, name, url, item) {
var point = new ol.geom.Point(e.coordinate);
var param = new ol.supermap.QueryByGeometryParameters({
queryParams: {
name: name,
},
geometry: point,
});
let newDataZh = [];
let titleDiv = document.querySelector('#popup-title');
let layergaoliang = ref(null);
let layerzhezhao = ref(null);
new ol.supermap.QueryService(url).queryByGeometry(param, function (data) {
let name = '';
layerzhezhao = map
.getLayers()
.getArray()
.find(layer => layer.get('id') === 'zhezhao');
map.removeLayer(layerzhezhao);
if (item == '镇' && data.result.recordsets[0].features.features[0].properties.XJQYDM) {
let code = data.result.recordsets[0].features.features[0].properties.XJQYDM;
value.value = code;
let arr = [];
getTownship({ divisions: '370211', yearMonth: oldDatas.value.name }).then(res => {
res.data.forEach(item => {
if (item.streetCode == code) {
name = item.streetName;
arr.push(item);
}
alterArr.value = arr;
});
alter();
});
} else if (
item == '村' &&
data.result.recordsets[0].features.features[0].properties.CJQYDM
) {
let code = data.result.recordsets[0].features.features[0].properties.CJQYDM;
let arr = [];
getAdministrativeAreaChun({ divisions: code, yearMonth: oldDatas.value.name }).then(
res => {
res.data.forEach(item => {
console.log(item);
name = item.streetName;
arr.push(item);
});
name = res.data[0].streetName;
alterArr.value = arr;
alter();
}
);
}
function alter() {
if (data.result.currentCount > 0) {
console.log(data.result.recordsets[0].features);
if (data.result.recordsets[0].features) {
overlay.setPosition(point.flatCoordinates);
console.log(name);
titleDiv.innerHTML = name;
}
layergaoliang = map
.getLayers()
.getArray()
.find(layer => layer.get('id') === 'dianjigaoliang');
map.removeLayer(layergaoliang);
var llll = new ol.format.GeoJSON().readFeatures(data.result.recordsets[0].features);
newDataZh = data.result.recordsets[0].features.features[0].geometry.coordinates;
addConver(data.result.recordsets[0].features.features[0].geometry.coordinates);
var selectFeatureSource = new ol.source.Vector();
selectFeatureSource.addFeatures(llll);
const style = new ol.style.Style({
// fill: new ol.style.Fill({
// color: 'rgba(255, 219, 113, 0.3)',
// }),
stroke: new ol.style.Stroke({
color: 'rgba(255, 219, 113, 1.0)',
// lineDash: [10, 10],
width: 5,
}),
});
var vectorQuery = new ol.layer.Vector({
id: 'dianjigaoliang',
source: selectFeatureSource,
zIndex: 9999,
});
vectorQuery.setStyle(style);
map.addLayer(vectorQuery);
}
}
});
popupCloser.addEventListener('click', function () {
layerzhezhao = map
.getLayers()
.getArray()
.find(layer => layer.get('id') === 'zhezhao');
map.removeLayer(layerzhezhao);
erase(newDataZh);
value.value = '370211';
layergaoliang = map
.getLayers()
.getArray()
.find(layer => layer.get('id') === 'dianjigaoliang');
map.removeLayer(layergaoliang);
overlay.setPosition(undefined);
});
}
//创建蒙层,凸显黄岛区域
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(), 'huandao');
});
}
//添加遮罩
function addConver(data, name) {
let source = new ol.source.Vector();
var converLayer = new ol.layer.Vector({
id: name ? name : 'zhezhao',
source: source,
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba( 105, 105, 105, 0.9)',
}),
}),
});
const converGeom = erase(data);
const convertFt = new ol.Feature({
geometry: converGeom,
});
converLayer.getSource().addFeature(convertFt);
map.addLayer(converLayer);
}
//擦除操作,生产遮罩范围
function erase(data) {
console.log(data);
const extent = [-180, -90, 180, 90];
const polygonRing = ol.geom.Polygon.fromExtent(extent);
const coords = data;
console.log(coords);
coords.forEach(coord => {
const linearRing = new ol.geom.LinearRing(coord[0]);
polygonRing.appendLinearRing(linearRing);
});
return polygonRing;
}
const alter = () => {
container = document.getElementById('popup');
//拿到弹出框内容元素
content = document.getElementById('popup-content');
//拿到弹出框关闭元素
popupCloser = document.getElementById('popup-closer');
//创建弹出框容器
overlay = new ol.Overlay({
element: document.getElementById('popup'), // 弹框容器的id
positioning: 'bottom-center',
stopEvent: true,
offset: [0, -10],
});
map.addOverlay(overlay);
};
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/CJQY3702112019WGS84%40huangdaoqu_bianjie',
//rasterfunction: new SuperMap.NDVIParameter({ redIndex: 0, nirIndex: 2 }),
cacheEnabled: false,
}),
name: 'huangdaoqu_village',
projection: 'EPSG:4326', //3857
zIndex: 9999,
});
map.addLayer(layers);
// var layersArray = map.getLayers();
// layersArray.insertAt(999, layers);
};
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/XJQY3702112019WGS84%40huangdaoqu_bianjie',
//rasterfunction: new SuperMap.NDVIParameter({ redIndex: 0, nirIndex: 2 }),
cacheEnabled: false,
}),
projection: 'EPSG:4326', //3857
zIndex: 9999,
});
map.addLayer(layer);
};
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);
};
let townZuowu = ref({ label: [] }); //镇的作物
//表头数据切换 ----------前端生成excel
const changeTableHead = (tableData, fieldName) => {
const list = tableData.map(item => {
const obj = {};
for (const k in item) {
if (fieldName[k] == '区域名称') {
obj[fieldName[k]] = item[k];
}
}
for (const k in item) {
if (fieldName[k] == '湿润 (亩)') {
obj[fieldName[k]] = item[k];
}
}
for (const k in item) {
if (fieldName[k] == '适宜(亩)') {
obj[fieldName[k]] = item[k];
}
}
for (const k in item) {
if (fieldName[k] == '轻度干旱(亩)') {
obj[fieldName[k]] = item[k];
}
}
for (const k in item) {
if (fieldName[k] == '中度干旱(亩)') {
obj[fieldName[k]] = item[k];
}
}
for (const k in item) {
if (fieldName[k] == '重度干旱(亩)') {
obj[fieldName[k]] = item[k];
}
}
return obj;
});
return list;
};
const exportExcel = (
tableData,
// tableData = [
// {
// region: '山东',
// 湿润: '张三',
// 适宜: 333,
// 轻度干旱: 22,
// 中度干旱: 22,
// 重度干旱: 33,
// area: 44,
// },
// { index: 1, username: '李四', password: 444, age: 23 },
// ],
fileName = '用户列表',
pageName = 'Sheet1'
) => {
let fieldNameObj = {
region: '区域名称',
湿润: '湿润 (亩)',
适宜: '适宜(亩)',
轻度干旱: '轻度干旱(亩)',
中度干旱: '中度干旱(亩)',
重度干旱: '重度干旱(亩)',
area: '面积(亩)',
};
const list = changeTableHead(tableData, fieldNameObj);
// 创建工作表
console.log(list);
const data = xlsx.utils.json_to_sheet(list);
// 创建工作簿
const wb = xlsx.utils.book_new();
// 将工作表放入工作簿中
console.log(data);
xlsx.utils.book_append_sheet(wb, data, pageName);
// 生成文件并下载
xlsx.writeFile(wb, `${fileName}.xlsx`);
};
//折叠
function leftFoldClick() {
leftWraFlag.value = !leftWraFlag.value;
if (leftWraFlag.value) {
let leftWra = document.querySelector('.leftWra');
leftWra ? (leftWra.style.transform = 'translate(0,0)') : '';
} else {
let leftWra = document.querySelector('.leftWra');
leftWra ? (leftWra.style.transform = 'translate(-107%,0)') : '';
}
}
function rightFoldClick() {
rightWraFlag.value = !rightWraFlag.value;
if (rightWraFlag.value) {
let rightWra = document.querySelector('.rightWra');
rightWra.style.transform = 'translate(0,0)';
} else {
let rightWra = document.querySelector('.rightWra');
rightWra.style.transform = 'translate(107%,0)';
}
}
watch(
() => value.value,
() => {
selectTab();
}
);
watch(
() => oldDatas.value,
(val, oldVal) => {
value.value = '370211';
getareaStatisticsDroughts(value.value, oldDatas.value.name); //干旱等级面积统计
getproportionOfAreas(value.value, oldDatas.value.name); //干旱等级面积占比
geteachFreezingGradeAreas(oldDatas.value.name); //高标准农田干旱等级面积占比
getTownships(value.value, oldDatas.value.name); //镇
// let str = oldDatas.value.name;
// let str1 = str.replace(/-/g, '_');
// console.log(str1,)
// layersDic = {
// 湿润: {
// setOf: `${oldDatas.value.name}-ganhan`,
// name: 'T2023_01_03_shirun',
// },
// 适宜: {
// setOf: `${oldDatas.value.name}-ganhan`,
// name: 'T2023_01_03_shiyi',
// },
// 轻度干旱: {
// setOf: '2022-12-20-ganhan',
// name: 'T2022_12_20_qingduganhan',
// },
// 中度干旱: {
// setOf: '2022-12-20-ganhan',
// name: 'T2022_12_20_medium_ganhan',
// },
// 重度干旱: {
// setOf: '2022-12-20-ganhan',
// name: 'T2022_12_20_serious_ganhan',
// },
// };
// for (const key in checkList.value) {
// console.log();
// addwms(layersDic[checkList.value[key]]);
// }
}
);
let nums = 0;
// 农作物
watch(
() => checkList.value,
(val, oldVal) => {
if (val.length > oldVal.length) {
// 挑选出增多的数据
const newData = val.filter(item => {
const index = oldVal.findIndex(it => it === item);
if (index < 0) {
return item;
}
});
newData.forEach(item => {
if (layersDic[item]) {
addwms(layersDic[item]);
}
});
// 添加镇级矢量
} else if (val.length < oldVal.length) {
// 挑选出减少的数据
const newData = oldVal.filter(item => {
const index = val.findIndex(it => it === item);
if (index < 0) {
return item;
}
});
newData.forEach(item => {
if (layersDic[item]) {
map.getLayers()
.getArray()
.forEach((ite, index) => {
if (ite.A.name) {
if (ite.A.name == layersDic[item].name) {
map.getLayers().removeAt(index);
}
}
});
}
});
}
nums++;
if (nums == 1) {
cun(); //添加村
zhen(); //添加镇
}
}
);
const onSubmit = () => {
let arr = [];
let brr = [];
currentPage.value = 1;
getlistDroughts({
yearMonth: formInline.value.time,
statistical: formInline.value.statistical,
droughtRating: formInline.value.droughtRating,
area: formInline.value.area,
}).then(res => {
tableItem.value = [
{
lable: '',
value: 'region',
},
{
lable: '适宜',
value: '适宜',
},
{
lable: '湿润',
value: '湿润',
},
{
lable: '轻度干旱',
value: '轻度干旱',
},
{
lable: '中度干旱',
value: '中度干旱',
},
{
lable: '重度干旱',
value: '重度干旱',
},
];
res.data.forEach(item => {
if (arr.indexOf(item.region) == -1) {
arr.push(item.region);
}
});
arr.forEach(item => {
brr.push(
Object.create(null, {
regio: {
value: item,
},
})
);
});
brr.forEach(item => {
res.data.map(i => {
if (item.regio === i.region) {
item['region'] = i.region;
item[i.level] = Number(i.area).toFixed(2);
}
});
});
operate.value = false;
insectarr.value = brr.sort((a, b) => {
return a.region.length - b.region.length;
});
tableNewData.value = brr.slice(
(currentPage.value - 1) * pageSize.value,
(currentPage.value - 1) * pageSize.value + pageSize.value
);
amount.value[0]['适宜'] = 0;
amount.value[0]['湿润'] = 0;
amount.value[0]['轻度干旱'] = 0;
amount.value[0]['中度干旱'] = 0;
amount.value[0]['重度干旱'] = 0;
amount.value[0]['region'] = '合计';
brr.forEach(item => {
item.适宜
? (amount.value[0]['适宜'] += Number(item.适宜) !== NaN ? Number(item.适宜) : 0)
: 0;
item.湿润
? (amount.value[0]['湿润'] += Number(item.湿润) !== NaN ? Number(item.湿润) : 0)
: 0;
item.轻度干旱
? (amount.value[0]['轻度干旱'] +=
Number(item.轻度干旱) !== NaN ? Number(item.轻度干旱) : 0)
: 0;
item.中度干旱
? (amount.value[0]['中度干旱'] +=
Number(item.中度干旱) !== NaN ? Number(item.中度干旱) : 0)
: 0;
item.重度干旱
? (amount.value[0]['重度干旱'] +=
Number(item.重度干旱) !== NaN ? Number(item.重度干旱) : 0)
: 0;
});
for (const key in amount.value[0]) {
console.log(amount.value[0][key]);
if (amount.value[0][key] !== '合计') {
amount.value[0][key] = amount.value[0][key].toFixed(2);
}
}
const statInfo = chartModeDiv.value; // 获取图表元素
statInfo.style.width = window.innerWidth - 100 + 'px'; //初始化echarts图表宽度
statInfo.style.height = window.innerHeight - 100 + 'px';
const myChart = echarts.init(statInfo);
// 设置宽度自适应
window.addEventListener('resize', () => {
statInfo.style.width = window.innerWidth - 200 + 'px';
statInfo.style.height = window.innerHeight - 200 + 'px';
myChart.resize();
});
chartModes();
});
};
const resetForm = () => {
(formInline.value.time = timeArr.value[0]),
(formInline.value.statistical = '镇'),
(formInline.value.droughtRating = ''),
(formInline.value.area = 1),
(operate.value = true);
onSubmit();
};
/*------------------接口--------------------*/
//列表模式-年
const theTimes = () => {
getlistDroughtsYear().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 getareaStatisticsDroughts = (city, time) => {
areacharLable = ref([]);
areacharPrice = ref([]);
getareaStatisticsDrought({ divisions: city, yearMonth: time }).then(res => {
res.data.forEach(item => {
areacharLable.value.push(item.level);
areacharPrice.value.push(item.area);
});
areachar();
});
};
//干旱等级面积占比
const getproportionOfAreas = (city, time) => {
let tableArr = ref([]);
getproportionOfArea({ divisions: city, yearMonth: time }).then(res => {
typesofData = ref([]);
totalArea = ref(0);
res.data.forEach(item => {
totalArea.value += Number(item.area);
typesofData.value.push({
name: item.level,
value: Number(item.area).toFixed(2),
});
tableArr.value.push({
date: item.level,
name: `${Number(item.area).toFixed(2)}`,
address: `${(item.percentage * 100).toFixed(2)}%`,
});
});
tableData.value = tableArr.value;
console.log(tableData);
typesof();
});
};
//高标准农田干旱等级面积占比
// { region: '山东', 湿润: '张三', 适宜: 333, 轻度干旱: 22 ,中度干旱:22,重度干旱:33,area:44},
let excel = ref([{}]);
const geteachFreezingGradeAreas = time => {
geteachFreezingGradeArea({ yearMonth: time }).then(res => {
highStandard.forEach((item, index) => {
let town = res.data.map(i => {
if (item === i.region) {
return i;
}
});
Object.keys(highStandarditem).forEach(it => {
let num = 0;
const index = town.findIndex(a => {
if (a && a.level === it) {
num = a.area;
}
return a && a.level === it;
});
if (index > -1) {
highStandarditem[it].push(num);
} else {
highStandarditem[it].push(0);
}
});
});
farmland();
});
};
//镇
const getTownships = (city, time) => {
getTownship({ divisions: city, yearMonth: time }).then(res => {
Township.brr = res.data;
Township.arr = res.data.sort((a, b) => {
return a.streetName.length - b.streetName.length;
});
Township.arr.unshift({
streetCode: '370211',
streetName: '全部',
});
let crr = [];
let drr = [];
Township.arr.forEach(item => {
if (crr.indexOf(item.streetName) == -1) {
crr.push(item.streetName);
drr.push({
streetName: item.streetName,
streetCode: item.streetCode,
area: item.area,
type: item.type,
});
}
});
Township.arr = drr;
let arr = [...res.data];
let brr = [];
arr.splice(0, 1);
arr.forEach(item => {
if (brr.indexOf(item.streetName) == -1) {
brr.push(item.streetName);
}
});
data.title = [...Object.values(brr)];
data.title.forEach((item, index) => {
let town = res.data.map(i => {
if (item === i.streetName) {
return i;
}
});
Object.keys(dd).forEach(it => {
const index = town.findIndex(a => a && a.type === it);
if (index > -1) {
dd[it].push(1);
} else {
dd[it].push(null);
}
});
});
ASdivision();
});
};
//村
const getadministratives = (city, time) => {
dd = {
适宜: [],
湿润: [],
轻度干旱: [],
中度干旱: [],
重度干旱: [],
};
getadministrative({ divisions: city, yearMonth: time }).then(res => {
Township.brr = res.data;
let arr = [...res.data];
let brr = [];
arr.forEach(item => {
if (brr.indexOf(item.streetName) == -1) {
brr.push(item.streetName);
}
});
data.title = [...Object.values(brr)];
data.title.forEach((item, index) => {
let town = res.data.map(i => {
if (item === i.streetName) {
return i;
}
});
Object.keys(dd).forEach(it => {
const index = town.findIndex(a => a && a.type === it && a.area > 0);
if (index > -1) {
dd[it].push(1);
} else {
dd[it].push(null);
}
});
});
ASdivision();
});
};
const selectTab = () => {
if (value.value == '370211') {
getTownships(value.value, oldDatas.value.name); //更新镇的数据
getareaStatisticsDroughts(value.value, oldDatas.value.name);
getproportionOfAreas(value.value, oldDatas.value.name);
} else {
getadministratives(value.value, oldDatas.value.name);
getareaStatisticsDroughts(value.value, oldDatas.value.name);
getproportionOfAreas(value.value, oldDatas.value.name);
}
};
//下载
/*---------------------------*/
const Deta = item => {
getareaStatisticsDrought({ divisions: value.value, whetherToDownload: true }).then(res => {
console.log(res);
downLoadFile(res.data[res.data.length - 1].downloadPath);
});
};
const Deta2 = item => {
getproportionOfArea({ divisions: value.value, whetherToDownload: true }).then(res => {
downLoadFile(res.data[res.data.length - 1].downloadPath);
});
};
const Deta3 = item => {
geteachFreezingGradeArea({ divisions: value.value, whetherToDownload: false }).then(res => {
let arr = [];
let brr = [];
res.data.forEach(item => {
if (arr.indexOf(item.region) == -1) {
arr.push(item.region);
}
});
arr.forEach(item => {
brr.push(
Object.create(null, {
regio: {
value: item,
},
})
);
});
brr.forEach(item => {
res.data.map(i => {
if (item.regio === i.region) {
item['region'] = i.region;
item[i.level] = Number(i.area).toFixed(2);
}
});
});
exportExcel(brr, '各干旱等级面积统计-高标准农田', 'Sheet1');
});
};
const Deta4 = item => {
if (value.value === '370211') {
let region = '';
Township.arr.forEach(item => {
if (item.subregion == value.value) {
region = item.subregionName == '全部' ? '黄岛区' : item.subregionName;
}
});
getTownship({ divisions: value.value }).then(res => {
let arr = [];
let brr = [];
res.data.forEach(item => {
if (arr.indexOf(item.streetName) == -1) {
arr.push(item.streetName);
}
});
arr.forEach(item => {
brr.push(
Object.create(null, {
regio: {
value: item,
},
})
);
});
brr.forEach(item => {
res.data.map(i => {
if (item.regio === i.streetName) {
item['region'] = i.streetName;
item[i.type] = Number(i.area).toFixed(2);
}
});
});
brr = brr.sort((a, b) => {
return a.region.length - b.region.length;
});
console.log(brr);
exportExcel(brr, `${region}干旱等级面积-行政区划`, 'Sheet1');
});
} else {
let region = '';
Township.arr.forEach(item => {
if (item.subregion == value.value) {
region = item.subregionName == '全部' ? '黄岛区' : item.subregionName;
}
});
getadministrative({ divisions: value.value, whetherToDownload: false }).then(res => {
let arr = [];
let brr = [];
res.data.forEach(item => {
if (arr.indexOf(item.streetName) == -1) {
arr.push(item.streetName);
}
});
arr.forEach(item => {
brr.push(
Object.create(null, {
regio: {
value: item,
},
})
);
});
brr.forEach(item => {
res.data.map(i => {
if (item.regio === i.streetName) {
item['region'] = i.streetName;
item[i.type] = Number(i.area).toFixed(2);
}
});
});
console.log(brr);
exportExcel(brr, `${region}作物干旱等级统计-行政区划`, 'Sheet1');
});
}
};
const dowcity = () => {
let arr = JSON.parse(JSON.stringify(amount.value[0]));
arr.region = '合计';
insectarr.value.push(arr);
exportExcel(insectarr.value, '干旱面积统计表', 'Sheet1');
};
const handleData = oldData => {
oldDatas.value = oldData;
};
/*-------------echarts--------------*/
function areachar() {
const areaDivIntance = echarts.init(areaDiv.value);
var option = {
textStyle: {
fontSize: 0,
},
grid: {
top: '15%',
left: '5%',
right: '5%',
bottom: '10%',
containLabel: true,
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
legend: {
show: true,
top: '5%',
data: ['面积'],
right: '5%',
icon: 'rect',
textStyle: {
fontSize: 14, //字体大小
color: 'rgba(255, 255, 255, 0.7)', //字体颜色
},
},
xAxis: {
nameTextStyle: {
color: '#c0c3cd',
padding: [0, 0, -10, 0],
fontSize: 14,
},
axisLabel: {
color: 'rgba(255, 255, 255, 0.7)',
fontWeight: 400,
fontFamily: 'SourceHanSansCN-Regular, SourceHanSansCN',
fontSize: 14,
},
axisTick: {
lineStyle: {
color: '#0B1535',
width: 1,
},
show: false,
},
splitLine: {
show: false,
},
axisLine: {
lineStyle: {
color: '#384267',
width: 1,
type: 'dashed',
},
show: true,
},
data: areacharLable.value,
type: 'category',
},
yAxis: {
name: '面积(亩)',
nameTextStyle: {
color: 'rgba(255, 255, 255, 0.8)',
fontSize: 14,
},
type: 'value',
axisLabel: {
color: 'rgba(255,255,255,0.7)',
},
splitLine: {
lineStyle: {
type: 'dashed',
},
},
minInterval: 1,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
},
series: [
{
data: areacharPrice.value,
name: '面积',
type: 'bar',
barMaxWidth: 'auto',
barWidth: 35,
itemStyle: {
color: {
x: 0,
y: 0,
x2: 0,
y2: 1,
type: 'linear',
global: false,
colorStops: [
{
offset: 0,
color: 'rgba(45, 204, 177, 1)',
},
{
offset: 1,
color: 'rgba(71, 179, 161, 0)',
},
],
},
},
label: {
normal: {
show: false,
fontSize: 14,
color: '#ffffff',
position: 'top',
},
},
},
],
};
option && areaDivIntance.setOption(option);
window.addEventListener('resize', function () {
areaDivIntance.resize();
});
}
function typesof() {
const typesofDivIntance = echarts.init(typesofDiv.value);
var data = typesofData.value;
let option = {
color: [
'rgba(0, 132, 255, 1)',
'rgba(32, 242, 255, 1)',
'rgba(255, 255, 0, 1)',
'rgba(255, 168, 8, 1)',
'rgba(224, 13, 15, 1)',
],
title: {
text: '总面积',
subtext: `${(totalArea.value / 10000).toFixed(2)}万亩`,
textStyle: {
color: '#f2f2f2',
fontSize: 14,
// align: 'center'
},
subtextStyle: {
fontSize: 14,
color: ['#ff9d19'],
},
x: 'center',
y: 'center',
},
grid: {
top: 0,
},
legend: {
orient: 'vertical',
top: 'middle',
right: '2%',
textStyle: {
color: '#f2f2f2',
fontSize: 14,
},
icon: 'roundRect',
data: data,
},
tooltip: {
//提示框组件
trigger: 'item', //item数据项图形触发主要在散点图饼图等无类目轴的图表中使用。
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
},
formatter: '{a} <br/>{b} : {c}亩 <br/>百分比 : {d}%', //{a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
},
series: [
// 主要展示层的
{
radius: ['50%', '71%'],
center: ['50%', '50%'],
type: 'pie',
label: {
normal: {
show: false,
},
},
labelLine: {
normal: {
show: false,
},
},
name: '各干旱等级面积占比',
data: data,
},
// 边框的设置
{
radius: ['50%', '54%'],
center: ['50%', '50%'],
type: 'pie',
label: {
normal: {
show: false,
},
emphasis: {
show: false,
},
},
labelLine: {
normal: {
show: false,
},
emphasis: {
show: false,
},
},
animation: false,
tooltip: {
show: false,
},
data: [
{
value: 1,
itemStyle: {
color: 'rgba(250,250,250,0.3)',
},
},
],
},
{
name: '外边框',
type: 'pie',
clockWise: false, //顺时加载
hoverAnimation: false, //鼠标移入变大
center: ['50%', '50%'],
radius: ['85%', '85%'],
tooltip: { show: false },
label: {
normal: {
show: false,
},
},
data: [
{
value: 9,
name: '',
itemStyle: {
normal: {
borderWidth: 2,
borderColor: '#0b5263',
},
},
},
],
},
],
};
useEcharts(typesofDivIntance, option);
}
function farmland() {
const farmlandDivIntance = echarts.init(farmlandDiv.value);
let option = {
title: {
text: '',
subtext: '',
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
// legend: {
// icon: 'circle',
// left: 'center',
// top: '5',
// show: true,
// },
grid: {
top: '15%',
left: '5%',
right: '5%',
bottom: '10%',
containLabel: true,
},
xAxis: {
type: 'category',
data: highStandard,
axisLine: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)',
width: 1,
type: 'solid',
},
axisLabel: {
color: 'rgba(255, 255, 255, 0.7)',
fontWeight: 400,
fontFamily: 'SourceHanSansCN-Regular, SourceHanSansCN',
fontSize: 14,
},
},
},
yAxis: {
name: '面积(亩)',
nameTextStyle: {
color: 'rgba(255, 255, 255, 0.8)',
fontSize: 14,
},
type: 'value',
axisLabel: {
color: 'rgba(255, 255, 255, 0.7)',
},
splitLine: {
lineStyle: {
type: 'solid',
color: 'rgba(255, 255, 255, 0.3)',
},
},
minInterval: 1,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
},
series: [
{
name: '湿润',
type: 'bar',
barWidth: 14,
stack: '数量',
data: highStandarditem.湿润,
itemStyle: {
normal: {
borderWidth: 1,
borderColor: 'rgba(0, 132, 255, 1)',
//颜色渐变
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(0, 132, 255, 1)',
},
{
offset: 1,
color: 'rgba(0, 132, 255, 1)',
},
]),
},
},
},
{
name: '适宜',
type: 'bar',
barWidth: 14,
stack: '数量',
data: highStandarditem.适宜,
itemStyle: {
normal: {
borderWidth: 1,
borderColor: 'rgba(32, 242, 255, 1)',
//颜色渐变
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(32, 242, 255, 1)',
},
{
offset: 1,
color: 'rgba(32, 242, 255, 1)',
},
]),
},
},
},
{
name: '轻度干旱',
type: 'bar',
barWidth: 14,
stack: '数量',
data: highStandarditem.轻度干旱,
itemStyle: {
normal: {
borderWidth: 1,
borderColor: 'rgba(234, 165, 93, 1)',
//颜色渐变
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(255, 255, 0, 1)',
},
{
offset: 1,
color: 'rgba(255, 255, 0, 1)',
},
]),
},
},
},
{
name: '中度干旱',
type: 'bar',
barWidth: 14,
stack: '数量',
data: highStandarditem.中度干旱,
itemStyle: {
normal: {
borderWidth: 1,
borderColor: 'rgba(205, 92, 92, 0.8)',
//颜色渐变
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(255, 168, 8, 1)',
},
{
offset: 1,
color: 'rgba(255, 168, 8, 1)',
},
]),
},
},
},
{
name: '重度干旱',
type: 'bar',
barWidth: 14,
stack: '数量',
data: highStandarditem.重度干旱,
itemStyle: {
normal: {
borderWidth: 1,
borderColor: 'rgba(224, 13, 15, 1)',
//颜色渐变
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(224, 13, 15, 1)',
},
{
offset: 1,
color: 'rgba(224, 13, 15, 1)',
},
]),
},
},
},
],
};
farmlandDivIntance.on('click', function (params) {
console.log(params.name);
});
// farmlandDivIntance.on('click', param => ChartClick(param));
option && farmlandDivIntance.setOption(option, { notMerge: true, grid: { bottom: 20 } });
useEcharts(farmlandDivIntance, option);
}
//每页条数
const handleCurrentChange = val => {
currentPage.value = val;
tableNewData.value = insectarr.value.slice(
(currentPage.value - 1) * pageSize.value,
(currentPage.value - 1) * pageSize.value + pageSize.value
);
};
const Nindex = index => {
// 当前页数 - 1 * 每页数据条数 + 1
const page = currentPage.value; // 当前页码
const pagesize = pageSize.value; // 每页条数
return index + 1 + (page - 1) * pagesize;
};
//返回
function back() {
deleteEntityByName('townLine');
delete townZuowu.value.XZQMC;
removeWms(['gbznt'], true);
removeWms(['aaa']);
value.value = '370211';
selectTab();
viewer.camera.flyTo({
destination: Cesium.Rectangle.fromDegrees(119.5091, 35.5671, 120.3285, 36.1455),
duration: 2,
});
flag.value = false;
hiddenOverlayChart();
}
function ASdivision() {
const ASdivisionDivIntance = echarts.init(ASdivisionDiv.value);
var option = {
// 设置图表的位置
grid: {
bottom: '8%',
left: '10%',
right: '6%',
top: '12%',
containLabel: true,
},
tooltip: {
formatter: function (params) {
// 自定义悬浮文字的格式params.value 为当前柱状图的数值
let a = 0;
Township.brr.forEach(item => {
if (item.type == params.seriesName && item.streetName == params.name) {
console.log(item.area);
a = Number(item.area).toFixed(2);
}
});
return (
params.seriesName +
'<span style="font-size: 14px; color: #f00;">' +
a +
'</span>' +
'亩'
);
},
},
dataZoom: [
{
type: 'slider',
show: false,
zoomLock: true, //禁止拉伸
width: 8,
yAxisIndex: [0],
bottom: 30,
top: 20,
right: 10,
startValue: 0,
endValue: 4,
handleIcon:
'M-292,322.2c-3.2,0-6.4-0.6-9.3-1.9c-2.9-1.2-5.4-2.9-7.6-5.1s-3.9-4.8-5.1-7.6c-1.3-3-1.9-6.1-1.9-9.3c0-3.2,0.6-6.4,1.9-9.3c1.2-2.9,2.9-5.4,5.1-7.6s4.8-3.9,7.6-5.1c3-1.3,6.1-1.9,9.3-1.9c3.2,0,6.4,0.6,9.3,1.9c2.9,1.2,5.4,2.9,7.6,5.1s3.9,4.8,5.1,7.6c1.3,3,1.9,6.1,1.9,9.3c0,3.2-0.6,6.4-1.9,9.3c-1.2,2.9-2.9,5.4-5.1,7.6s-4.8,3.9-7.6,5.1C-285.6,321.5-288.8,322.2-292,322.2z',
handleSize: '100%',
handleStyle: {
color: '#DBDBDB',
height: '100%',
},
backgroundColor: 'transparent',
fillerColor: '#DBDBDB',
textStyle: {
color: 'transparent',
},
dataBackground: {
lineStyle: {
color: 'transparent',
},
areaStyle: {
color: 'transparent',
},
},
borderColor: 'transparent',
},
{
type: 'inside',
id: 'insideY',
yAxisIndex: 0,
start: 0,
end: 50,
zoomOnMouseWheel: false,
moveOnMouseMove: true,
moveOnMouseWheel: true,
},
],
// X轴
xAxis: {
type: 'value', // 坐标轴类型, 'value' 数值轴,适用于连续数据
// 坐标轴刻度
axisTick: {
show: false, // 是否显示坐标轴刻度 默认显示
},
// 坐标轴轴线
axisLine: {
// 是否显示坐标轴轴线 默认显示
show: false, // 是否显示坐标轴轴线 默认显示
},
// 坐标轴在图表区域中的分隔线
splitLine: {
show: false, // 是否显示分隔线。默认数值轴显示
},
// 坐标轴刻度标签
axisLabel: {
show: false, // 是否显示刻度标签 默认显示
},
},
// Y轴
yAxis: [
// 左侧Y轴
{
// 坐标轴类型, 'category' 类目轴,适用于离散的类目数据
// 为该类型时必须通过 data 设置类目数据
type: 'category',
// 坐标轴刻度
axisTick: {
show: false, // 是否显示坐标轴刻度 默认显示
},
// 坐标轴轴线
axisLine: {
// 是否显示坐标轴轴线 默认显示
show: false, // 是否显示坐标轴轴线 默认显示
lineStyle: {
// 坐标轴线线的颜色
color: '#cdd3ee',
},
},
// 坐标轴在图表区域中的分隔线
splitLine: {
show: false, // 是否显示分隔线。默认数值轴显示
},
// 坐标轴刻度标签
axisLabel: {
show: true, // 是否显示刻度标签 默认显示
fontSize: 12, // 文字的字体大小
color: 'rgba(255, 255, 255, 1)', // 刻度标签文字的颜色
// 使用字符串模板,模板变量为刻度默认标签 {value}
formatter: '{value}',
},
// 类目数据在类目轴type: 'category')中有效
data: data.title,
inverse: true,
},
],
// 系列列表
series: [
{
type: 'bar', // 系列类型
name: '湿润', // 系列名称, 用于tooltip的显示, legend 的图例筛选
// 数据堆叠同个类目轴上系列配置相同的stack值后后一个系列的值会在前一个系列的值上相加
stack: '总量',
barMaxWidth: 30, // 柱条的最大宽度,不设时自适应
// 图形上的文本标签
label: {
show: false,
position: '湿润',
textStyle: {
fontSize: 12,
fontWeight: 'bolder',
color: 'rgba(255,255,255,1)',
},
},
// 图形样式
itemStyle: {
barBorderRadius: [0, 0, 0, 0],
barBorderRadius: [0, 0, 0, 0], //
// borderWidth: 1, // 设置边框宽度
// borderColor: 'rgba(4, 247, 227, 0.8)', // 设置边框颜色
color: {
colorStops: [
{
offset: 0,
color: 'rgba(0, 132, 255, 1)', // 0% 处的颜色
},
{
offset: 1,
color: 'rgba(0, 132, 255, 1)', // 100% 处的颜色
},
],
},
},
data: dd.湿润, // 系列中的数据内容数组
},
{
type: 'bar', // 系列类型
name: '适宜', // 系列名称, 用于tooltip的显示, legend 的图例筛选
// 数据堆叠同个类目轴上系列配置相同的stack值后后一个系列的值会在前一个系列的值上相加
stack: '总量',
barMaxWidth: 30, // 柱条的最大宽度,不设时自适应
// 图形上的文本标签
label: {
show: false,
position: 'inside',
formatter: '适宜',
textStyle: {
fontSize: 12,
fontWeight: 'bolder',
color: 'rgba(255,255,255,1)',
},
},
// 图形样式
itemStyle: {
barBorderRadius: [0, 0, 0, 0], //
// borderWidth: 1, // 设置边框宽度
// borderColor: 'rgba(143, 186, 243, 0.8)', // 设置边框颜色
color: {
colorStops: [
{
offset: 0,
color: 'rgba(32, 242, 255, 1)', // 0% 处的颜色
},
{
offset: 1,
color: 'rgba(32, 242, 255, 1)', // 100% 处的颜色
},
],
},
},
data: dd.适宜, // 系列中的数据内容数组
},
{
type: 'bar', // 系列类型
name: '轻度干旱', // 系列名称, 用于tooltip的显示, legend 的图例筛选
// 数据堆叠同个类目轴上系列配置相同的stack值后后一个系列的值会在前一个系列的值上相加
stack: '总量',
barMaxWidth: 30, // 柱条的最大宽度,不设时自适应
// 图形上的文本标签
label: {
show: false,
position: 'inside',
formatter: '轻度干旱',
textStyle: {
fontSize: 12,
fontWeight: 'bolder',
color: 'rgba(255,255,255,1)',
},
},
// 图形样式
itemStyle: {
barBorderRadius: [0, 0, 0, 0],
barBorderRadius: [0, 0, 0, 0], //
// borderWidth: 1, // 设置边框宽度
// borderColor: 'rgba(4, 247, 227, 0.9)', // 设置边框颜色
color: {
colorStops: [
{
offset: 0,
color: 'rgba(255, 255, 0, 1)', // 0% 处的颜色
},
{
offset: 1,
color: 'rgba(255, 255, 0, 1)', // 100% 处的颜色
},
],
},
},
data: dd.轻度干旱, // 系列中的数据内容数组
},
{
type: 'bar', // 系列类型
name: '中度干旱', // 系列名称, 用于tooltip的显示, legend 的图例筛选
// 数据堆叠同个类目轴上系列配置相同的stack值后后一个系列的值会在前一个系列的值上相加
stack: '总量',
barMaxWidth: 30, // 柱条的最大宽度,不设时自适应
// 图形上的文本标签
label: {
show: false,
position: 'inside',
formatter: '中度干旱',
textStyle: {
fontSize: 12,
fontWeight: 'bolder',
color: 'rgba(255,255,255,1)',
},
},
// 图形样式
itemStyle: {
barBorderRadius: [0, 0, 0, 0],
barBorderRadius: [0, 0, 0, 0], //
// borderWidth: 1, // 设置边框宽度
// borderColor: 'rgba(33, 187, 251, 0.8)', // 设置边框颜色
color: {
colorStops: [
{
offset: 0,
color: 'rgba(255, 168, 8, 1)', // 0% 处的颜色
},
{
offset: 1,
color: 'rgba(255, 168, 8, 1)', // 100% 处的颜色
},
],
},
},
data: dd.中度干旱, // 系列中的数据内容数组
},
{
type: 'bar', // 系列类型
name: '重度干旱', // 系列名称, 用于tooltip的显示, legend 的图例筛选
// 数据堆叠同个类目轴上系列配置相同的stack值后后一个系列的值会在前一个系列的值上相加
stack: '总量',
barMaxWidth: 30, // 柱条的最大宽度,不设时自适应
// 图形上的文本标签
label: {
show: false,
position: 'inside',
formatter: '重度干旱',
textStyle: {
fontSize: 12,
fontWeight: 'bolder',
color: 'rgba(255,255,255,1)',
},
},
// 图形样式
itemStyle: {
barBorderRadius: [0, 0, 0, 0],
barBorderRadius: [0, 0, 0, 0], //
// borderWidth: 1, // 设置边框宽度
// borderColor: 'rgba(14, 223, 255, 0.8)', // 设置边框颜色
color: {
colorStops: [
{
offset: 0,
color: 'rgba(224, 13, 15, 1)', // 0% 处的颜色
},
{
offset: 1,
color: 'rgba(224, 13, 15, 1)', // 100% 处的颜色
},
],
},
},
data: dd.重度干旱, // 系列中的数据内容数组
},
],
};
// option && ASdivisionDivIntance.setOption(option, true);
useEcharts(ASdivisionDivIntance, option);
}
/*--------------------------------------------------------------------------------------------*/
// 地图移动时弹窗跟随
function infoWindowPostRender() {
// let viewer = viewers.value;
if (clickInfoMap.value.lon && clickInfoMap.value.lat) {
//经纬度转为世界坐标
const gisPosition = Cesium.Cartesian3.fromDegrees(
Number(clickInfoMap.value.lon),
Number(clickInfoMap.value.lat),
0
); //转化为屏幕坐标
var windowPosition = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
viewer.scene,
gisPosition
);
if (Cesium.defined(windowPosition)) {
const pop = document.getElementById('popup');
if (pop) {
pop.style.top = windowPosition.y - 10 + 'px';
pop.style.left = windowPosition.x + 10 + 'px';
}
}
}
}
// function mapClick() {
// // let viewer = viewers.value;
// viewer.screenSpaceEventHandler.setInputAction(function (movement) {
// const earthPosition = viewer.camera.pickEllipsoid(
// movement.position,
// viewer.scene.globe.ellipsoid
// ); //当前世界坐标笛卡尔积
// if (Cesium.defined(earthPosition)) {
// let pick = viewer.scene.pick(movement.position); //返回最上层模型属性
// let picks = viewer.scene.drillPick(movement.position); //返回所有模型属性
// if (pick && pick.id && pick.id.info) {
// console.log('pick:', pick);
// const data = pick.id.info;
// console.log('data:', data);
// const coordinate = movement.position; //屏幕坐标 // 转为经纬度,保存,用于监听时转换坐标
// var ellipsoid = viewer.scene.globe.ellipsoid; // 将屏幕坐标转为地理坐标
// var cartesian = viewer.camera.pickEllipsoid(coordinate, ellipsoid);
// let newData = {
// ...data,
// };
// 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);
// console.log('longitudeString:', longitudeString);
// newData.lon = longitudeString;
// newData.lat = latitudeString; /*保存(弹窗)的数据*/
// console.log('data:', newData);
// clickInfoMap.value = newData;
// }
// showOverlayChart(coordinate); // 添加地图移动监听:使地图移动弹窗跟着移动
// viewer.scene.postRender.addEventListener(infoWindowPostRender);
// } else {
// hiddenOverlayChart(); // 清除监听事件 // viewer.scene.postRender.removeEventListener(infoWindowPostRender);
// }
// }
// }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
// }
// 隐藏弹窗
function hiddenOverlayChart() {
const pop = document.getElementById('popup');
if (pop) {
pop.style.display = 'none'; // 清除监听事件
}
viewer.scene.postRender.removeEventListener(infoWindowPostRender);
value.value = '370211';
deleteEntityByName('townLine');
getTownships(); //更新镇的数据
// getadministratives(value.value);
getproportionOfAreas(value.value);
getareaStatisticsDroughts(value.value);
ASdivision();
areachar();
typesof();
}
//显示弹窗
function showOverlayChart(position) {
const pop = document.getElementById('popup');
if (pop) {
pop.style.display = 'block';
pop.style.position = 'absolute';
pop.style.top = position.y - 10 + 'px';
pop.style.left = position.x + 10 + 'px';
pop.style.zIndex = 99;
}
}
//列表模式模式切换
const SwitchMode = () => {
SwitchFlag.value = !SwitchFlag.value;
const statInfo = chartModeDiv.value; // 获取图表元素
statInfo.style.width = window.innerWidth - 200 + 'px'; //初始化echarts图表宽度
statInfo.style.height = window.innerHeight - 200 + 'px';
const myChart = echarts.init(statInfo);
// 设置宽度自适应
window.addEventListener('resize', () => {
statInfo.style.width = window.innerWidth - 200 + 'px';
statInfo.style.height = window.innerHeight - 200 + 'px';
myChart.resize();
});
chartModes();
};
const handleChange = value => {
formInline.value.area = value;
};
function chartModes() {
const ASdivisionDivIntance = echarts.init(chartModeDiv.value);
let arr = [];
let 湿润 = [];
let 适宜 = [];
let 轻度干旱 = [];
let 中度干旱 = [];
let 重度干旱 = [];
insectarr.value.forEach(item => {
console.log(item.重度干旱);
arr.push(item.region);
item.湿润 !== undefined ? 湿润.push(item.湿润) : 湿润.push(0);
item.适宜 !== undefined ? 适宜.push(item.适宜) : 适宜.push(0);
item.轻度干旱 !== undefined ? 轻度干旱.push(item.轻度干旱) : 轻度干旱.push(0);
item.中度干旱 !== undefined ? 中度干旱.push(item.中度干旱) : 中度干旱.push(0);
item.重度干旱 !== undefined ? 重度干旱.push(item.重度干旱) : 重度干旱.push(0);
});
let ends = (10 / arr.length) * 100;
let option = {
tooltip: {
trigger: 'axis',
formatter: function (params) {
let tipStr = params[0].axisValueLabel + '</br>';
let totalNum = 0;
for (let i = 0; i < params.length; i++) {
totalNum += params[i].value;
if (params[i].seriesName !== '合计') {
tipStr += params[i].seriesName + '' + params[i].value + '</br>';
}
}
for (let i = 0; i < params.length; i++) {
totalNum += Number(params[i].value);
if (params[i].seriesName === '合计') {
tipStr += '合计:' + totalNum;
}
}
return tipStr;
},
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
},
},
legend: {
top: 5,
left: 10,
icon: 'rect',
itemWidth: 4, // 图例图表宽度
itemHeight: 12, // 图例图标高度
data: [],
},
dataZoom: [
{
type: 'slider',
width: '40%',
top: '90%',
zoomLock: true, //禁止拉伸
start: 0,
end: ends,
showDataShadow: false,
showDetail: false,
fillerColor: 'rgba(64, 158, 255)',
borderRadius: '50%',
moveHandleSize: 0,
moveHandleStyle: {},
left: '30%',
height: 12,
handleSize: '80%',
handleIcon: 'path://M512,512m-448,0a448,448,0,1,0,896,0a448,448,0,1,0,-896,0Z',
handleStyle: {
borderWidth: 0,
color: 'rgba(64, 158, 255)',
},
},
{
type: 'inside',
},
],
grid: {
left: '3%',
right: '10%',
bottom: '15%',
top: '5%',
containLabel: true,
},
xAxis: {
type: 'category',
name: '区域',
axisLabel: {
fontSize: 12,
interval: 0,
rotate: 0,
},
axisLine: {
lineStyle: {
// color: '#cbeaf6', // x坐标轴线颜色
},
},
data: arr,
},
yAxis: [
{
type: 'value',
name: '面积(亩)',
axisLabel: {
// color: '#cbeaf6', // 坐标轴label文字颜色
},
axisLine: {
lineStyle: {
// color: '#cbeaf6', // y坐标轴线颜色
},
},
splitLine: {
// 网格线
lineStyle: {
// type: 'dashed', // 设置网格线类型 dotted虚线 solid:实线
// color: '#395367',
},
show: true, // 隐藏或显示
},
},
],
series: [
{
name: '湿润',
type: 'bar',
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(0, 132, 255, 1)',
},
data: 湿润,
},
{
name: '适宜',
type: 'bar',
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(32, 242, 255, 1)',
},
data: 适宜,
},
{
name: '轻度干旱',
type: 'bar',
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(255, 255, 0, 1)',
},
data: 轻度干旱,
},
{
name: '中度干旱',
type: 'bar',
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(255, 168, 8, 1)',
},
data: 中度干旱,
},
{
name: '重度干旱',
type: 'bar',
barWidth: 13,
stack: '分类',
itemStyle: {
color: 'rgba(224, 13, 15, 1)',
},
data: 重度干旱,
},
],
};
var series = option.series;
var tooltip = option.tooltip;
// 提示框自定义内容包括总合及文字
function formatFun(params) {
// console.log('params====>', params)
let tipStr = params[0].axisValueLabel + '</br>'; // 初始化提示框文字默认当前轴名称并换行
let totalNum = 0; // 用于存储当前列总数
// params为当前柱状图数组数量 遍历求和并添加类目labelvalue
for (let i = 0; i < params.length; i++) {
if (params[i].seriesName !== '合计') {
const dotHtml = `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params[i].color}"></span>`;
totalNum += params[i].value;
tipStr += dotHtml + params[i].seriesName + '' + params[i].value + '</br>';
}
}
// 添加最后的合计行 数据为每列总合
for (let i = 0; i < params.length; i++) {
if (params[i].seriesName === '合计') {
tipStr += '合计:' + totalNum;
}
}
return tipStr;
}
tooltip.formatter = formatFun;
// 指定函数计算总合
function fun(params) {
var dataSum = 0;
for (var i = 0; i < series.length; i++) {
dataSum += series[i].data[params.dataIndex];
}
return dataSum;
}
// 加载页面时候替换最后一个series的formatter
// series[series.length - 1].label.normal.formatter = fun;
useEcharts(ASdivisionDivIntance, option);
}
/*-------------------------------------------------------------------------------------------*/
</script>
<style lang="scss" scoped>
$height: calc(100vh - 100px);
.fatherDiv,
.tabulation,
.centerBox {
width: 100%;
height: 100%;
.imgrotate {
transform: rotate(180deg);
}
.title {
width: 100%;
height: 45px;
background: url('@/assets/images/title.png');
background-repeat: no-repeat;
background-size: 110% 100%;
color: #fff;
font-size: 18px;
font-weight: 700;
line-height: 45px;
padding-left: 46px;
display: flex;
cursor: pointer;
align-items: center;
justify-content: space-between;
span {
width: 80%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
background: linear-gradient(
180deg,
rgba(255, 255, 255, 1) 33.33%,
rgba(41, 255, 219, 1) 100%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
p {
width: 79px;
height: 25px;
border-radius: 20px;
font-size: 14px;
background: linear-gradient(
180deg,
rgba(16, 111, 111, 1) 0%,
rgba(47, 214, 214, 1) 100%
);
border: 1.5px solid rgba(23, 194, 180, 1);
display: flex;
justify-content: center;
align-items: center;
}
}
}
.tabulation {
display: none;
padding: 20px;
.tableBox {
padding: 0 10px;
.tableBorder {
border-radius: 8px;
margin-bottom: 10px;
.el-table--fit {
border-radius: 8px;
border: 2px solid rgba(100, 195, 164, 0.8);
box-shadow: 0px 3px 9px 0px rgba(100, 195, 164, 0.25),
0px 1px 2px 0px rgba(100, 195, 164, 0.8);
}
}
:deep(
.el-table .el-table__header-wrapper th,
.el-table .el-table__fixed-header-wrapper th
) {
color: rgba(0, 0, 0, 1);
}
height: 84%;
:deep(.el-table__inner-wrapper) {
height: 96% !important;
}
.example-pagination-block {
display: flex;
align-items: center;
justify-content: flex-end;
}
:deep(.tabth) {
background-color: rgba(247, 247, 247, 1);
}
}
.chartMode {
width: 100%;
height: 85%;
.chartModeDiv {
width: 100%;
height: 100%;
padding: 10px;
}
}
.searchDiv {
display: flex;
.dow {
float: right;
margin-right: 10px;
}
:deep(.el-input__wrapper) {
width: 100px;
}
.modeDiv {
width: 234px;
height: 26px;
opacity: 1;
border-radius: 8px;
display: flex;
justify-content: flex-start;
align-items: center;
text-align: center;
font-size: 14px;
// font-weight: 400;
border: 1px solid #ccc;
cursor: pointer;
div {
flex: 1;
height: 100%;
border-radius: 8px;
line-height: 26px;
}
.Selected {
background: rgba(100, 195, 164, 1);
border-radius: 8px 0px 0px 8px;
color: rgba(255, 255, 255, 1);
}
.Selecteds {
background: rgba(100, 195, 164, 1);
border-radius: 0px 8px 8px 0px;
color: rgba(255, 255, 255, 1);
}
}
}
}
.leftWra {
position: absolute;
top: 10px;
left: 20px;
height: $height;
width: 23%;
background: rgba(2, 31, 26, 0.85);
box-shadow: inset 0px 0px 15px 6px rgba(41, 255, 255, 0.5);
transition: transform 1s;
.leftFoldDiv {
width: 30px;
height: 30px;
position: absolute;
right: -14%;
top: 50%;
transform: translate(-50%, -50%);
font-size: 30px;
color: #ccc;
}
.leftTop {
width: 100%;
display: flex;
flex-direction: column;
height: 40%;
.areaDiv {
width: 100%;
height: 327px;
opacity: 1;
display: flex;
padding: 1px;
justify-content: center;
}
.ProgressBar {
width: 100%;
height: 9px;
opacity: 1;
}
}
.leftbottom {
width: 100%;
height: 59%;
opacity: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
padding-top: 13px;
.typesofDiv {
width: 100%;
height: 45%;
opacity: 1;
display: flex;
padding: 1px;
justify-content: center;
}
.tableDiv {
// background: rgba(255, 255, 255, 0.05);
display: flex;
justify-content: center;
width: 85%;
flex-direction: column;
padding: 5px 10px 5px 10px;
color: rgba(255, 255, 255, 1);
height: 45%;
:deep(.el-table tr) {
background-color: transparent;
}
:deep(.el-table) {
--el-table-border-color: none;
color: rgba(255, 255, 255, 1);
}
:deep(.el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell) {
background-color: revert;
}
.Crops {
display: flex;
width: 100%;
margin-bottom: 10px;
font-size: 14px;
font-weight: 400;
height: 31px;
flex-direction: row;
align-items: center;
justify-content: space-around;
opacity: 1;
background: linear-gradient(
90deg,
rgba(21, 173, 148, 0.1) 0%,
rgba(21, 173, 148, 0) 100%
);
div {
display: flex;
align-items: center;
}
}
.el-checkbox-group {
display: flex;
flex-direction: column;
}
:deep(.ones) {
width: 100%;
height: 171;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
--el-table-tr-bg-color: null;
--el-table-border-color: null;
font-size: 14px;
font-weight: 400;
letter-spacing: 0px;
line-height: 0px;
color: rgba(255, 255, 255, 1);
}
}
}
}
.rightWra {
position: absolute;
top: 10px;
right: 20px;
width: 23%;
height: $height;
opacity: 1;
display: flex;
flex-direction: column;
align-items: center;
background: rgba(2, 31, 26, 0.85);
box-shadow: inset 0px 0px 15px 6px rgba(41, 255, 255, 0.5);
transition: transform 1s;
.rightFoldDiv {
width: 30px;
height: 30px;
position: absolute;
left: -8%;
top: 50%;
transform: translate(0, -50%);
font-size: 30px;
color: #ccc;
}
.rightTop {
width: 100%;
height: 40%;
opacity: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
.farmlandDiv {
width: 100%;
height: 340px;
opacity: 1;
display: flex;
justify-content: center;
}
.ProgressBar {
width: 100%;
height: 9px;
opacity: 1;
}
}
.rightbottom {
width: 100%;
height: 54%;
opacity: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
.el-select {
width: 80%;
font-size: 14px;
color: #333;
background: rgba(22, 94, 102, 1);
border: 1px solid rgba(4, 153, 153, 1) !important;
margin-top: 20px;
:deep(.el-input__wrapper) {
background-color: transparent;
box-shadow: none;
}
:deep(.el-input__inner) {
color: rgba(255, 255, 255, 0.7);
}
}
.ASdivision {
width: 100%;
height: 368px;
opacity: 1;
display: flex;
justify-content: center;
}
}
}
.legend {
position: absolute;
right: 25%;
bottom: 7%;
width: 129px;
border: 1px solid rgba(4, 153, 153, 1);
// height: 50px;
:deep(.el-collapse-item__header) {
background: rgba(2, 31, 26, 0.6);
color: rgba(255, 255, 255, 1);
text-align: center;
padding: 0 30px;
font-size: 14px;
}
--el-collapse-content-bg-color {
background: rgba(2, 31, 26, 0.6);
}
:deep(.el-collapse-item__content) {
background: rgba(2, 31, 26, 0.6);
padding: 0 10px;
padding-bottom: 10px;
}
--el-collapse-border-color: none;
--el-collapse-content-bg-color: none;
// opacity: 1;
// border-radius: 4px;
// background: rgba(2, 31, 26, 0.6);
// display: flex;
// flex-direction: column;
// justify-content: flex-start;
// align-items: center;
// padding: 10px 10px 10px 10px;
p {
margin: 10px;
font-size: 14px;
font-weight: 400;
letter-spacing: 0px;
line-height: 0px;
color: rgba(255, 255, 255, 1);
text-align: center;
}
.mt-4 {
.el-checkbox {
height: 30px;
width: 100%;
margin-bottom: 2px;
padding-left: 10px;
font-size: 14px;
font-weight: 400;
letter-spacing: 0px;
line-height: 0px;
color: rgba(255, 255, 255, 1);
text-align: left;
}
}
:deep(.el-checkbox__label) {
color: black;
}
}
.bottom_center {
position: absolute;
// left: calc(400px + 20px + 8vw);
left: -2%;
right: 0;
margin: auto;
width: calc(100% - (400px * 2) - (10vw * 2));
min-width: 380px;
bottom: 5%;
height: 75px;
opacity: 1;
border-radius: 5px;
background: rgba(2, 31, 26, 0.6);
border: 1px solid rgba(4, 153, 153, 1);
}
.tool {
position: absolute;
right: 30%;
top: 8%;
width: 30px;
height: 280px;
opacity: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
display: none;
}
/*设置弹出框样式*/
.ol-popup {
position: absolute;
// 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;
border-radius: 10px;
// border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
}
.ol-popup:after,
.ol-popup:before {
top: 100%;
border: solid transparent;
content: ' ';
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: #eeeeee;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 11px;
right: 8px;
color: rgba(47, 214, 214, 1) !important;
}
.ol-popup-closer:after {
content: '✖';
}
#popup {
.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: 522px;
height: 205px;
opacity: 1;
background: rgba(2, 31, 26, 0.7);
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
.perform {
width: 50%;
margin: 20px 0;
display: flex;
}
.perform_children {
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: url('@/assets/images/duande.png') no-repeat !important;
background-size: 100% 100% !important;
.label {
color: rgba(47, 214, 214, 1);
}
span {
color: #fff;
}
}
}
}
#pop {
border-radius: 5px;
background: rgba(2, 31, 26, 1);
display: none;
// justify-content: flex-start;
// align-items: flex-end;
padding: 30px 8px 20px 8px;
.cancel {
position: absolute;
right: 10px;
top: 5px;
color: rgba(255, 255, 255, 1);
cursor: pointer;
}
& > div {
display: flex;
margin-bottom: 10px;
& > div:nth-child(1) {
font-weight: 400;
letter-spacing: 0px;
color: rgba(255, 255, 255, 1);
// margin-top: 20px;
line-height: 24px;
margin-right: 10px;
}
& > div:nth-child(2) {
color: rgba(255, 255, 255, 1);
width: 129px;
height: 24px;
opacity: 1;
border-radius: 2px;
background: rgba(217, 231, 255, 0.2);
display: flex;
justify-content: center;
align-items: center;
padding: 2px 10px 2px 10px;
// margin-top: 20px;
}
}
}
.back_button {
position: absolute;
right: 30%;
top: 20px;
}
:deep(.el-select__popper.el-popper) {
}
</style>
<style lang="scss">
.select_city {
background: rgba(2, 31, 26, 0.85);
box-shadow: inset 0px 0px 15px 6px rgba(41, 255, 255, 0.5);
.el-select-dropdown__item.hover {
background: rgba(2, 31, 26, 0.95);
box-shadow: inset 0px 0px 15px 6px rgba(41, 255, 255, 0.7);
}
.el-select-dropdown__item {
color: #fff;
}
}
.el-select__popper {
border: none !important;
background: transparent !important;
}
.el-popper {
border: none !important;
background: transparent !important;
}
.el-popper__arrow::before {
display: none;
}
.selectCity {
background: #fff;
}
</style>