江河水统计数据代码提交

This commit is contained in:
shixiaoman
2021-11-22 22:22:25 +08:00
parent c969bb52b3
commit 1d73a0440a
21 changed files with 920 additions and 3975 deletions

View File

@@ -27,23 +27,6 @@
<DownOutlined />
</a-button>
</a-dropdown>
<!-- <a-modal v-model:visible="visibleWater" title="水站导入" :footer="null">
<a-select allowClear placeholder="请选择站名" @change="currentSel" style="width:150px">
<a-select-option
v-for="item in form"
:key="item.waterStationPointId"
:label="item.stationName" :value="item"
>{{item.stationName}}</a-select-option
>
</a-select>
<a-upload
:before-upload="importFileStation"
:showUploadList="false"
accept=".xls,.xlsx,.csv">
<a-button key="submit" type="primary" :loading="loading">导入</a-button>
</a-upload>
</a-modal> -->
<a-dropdown>
<template #overlay>
<a-menu @click="handleMenuClick">
@@ -147,15 +130,6 @@
if (res.data.code == 0) {
console.log(res.data.data)
this.visibleWater = true;
// this.form = res.data.data.map(item => {
// return {
// riverName: item.riverName,
// stationName: item.stationName,
// system:item.system,
// waterStationPointId:item.waterStationPointId,
// waterTarget:item.waterTarget
// }
// })
res.data.data.forEach(e => {
this.form.push(e);
});

View File

@@ -114,6 +114,7 @@ export default {
},
// 国家级水功能区上报数据
toNationalLevelDataObj(excelData) {
var dataTime;
return excelData.map(item => {
let date = new Date();
let year = date.getFullYear(); // 年
@@ -123,7 +124,9 @@ export default {
time = item[14].replace('月','-').replace('日','').trim();
samplingTime = year+"-"+time;
}
if(samplingTime != ''){
dataTime = samplingTime;
}
const row = {
waterSystem:item[1],
riverLakeLibrary:item[2],
@@ -138,7 +141,7 @@ export default {
waterQualityGoal:item[11],
dataSources:item[12],
sectionName:item[13],
samplingTime:samplingTime,
samplingTime:samplingTime==''?dataTime:samplingTime,
wTemp:item[15],
ph:item[16],
dissolvedOxygen:item[17],
@@ -192,7 +195,7 @@ export default {
watershed:item[2],
river:item[3],
sectionName:item[4],
monitorTime:item[5],
monitorTime:item[5]==null || item[5]==''?new Date():item[5],
place:item[6],
periodWaterQuality:item[7],
waterTemperature:item[8],

View File

@@ -306,6 +306,9 @@ export default {
loading: false,
rules: {
year: [{required: true, message: '请输入年份'}],
waterQualityGoal:[{
required:true,message: "请输入考核目标",
}]
},
yearOptions: [],
showNYear:false,

View File

@@ -308,6 +308,9 @@ export default {
loading: false,
rules: {
year: [{required: true, message: '请输入年份'}],
waterQualityGoal:[{
required:true,message: "请输入考核目标",
}]
},
yearOptions: [],
showNYear:false,

View File

@@ -1,300 +1,142 @@
<!-- 江河水查看数据页面-->
<template>
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
layout="inline"
>
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 23:59:59" v-model:value="where.timeEnd"></a-date-picker>
</a-form-item>
<a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" placeholder="选择区域等级" allowClear showSearch>
<a-select-option
v-for="(item) in regionLevelOptions"
:key="item.value"
>{{ item.label }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="监测点:">
<a-select v-model:value="where.place" placeholder="选择监测点" allowClear showSearch>
<a-select-option
v-for="(item) in placeOptions"
:key="item.value"
>{{ item.label }}
</a-select-option
>
</a-select>
</a-form-item>
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form :model="where" :label-col="{ md: { span: 8 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 16 }, sm: { span: 24 } }">
<a-row>
<a-form-item label="断面名称">
<a-select v-model:value="where.sectionName" allowClear showSearch>
<a-select-option v-for="item in sectionInfo" :key="item.sectionName">{{ item.sectionName }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.timeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 23:59:59" v-model:value="where.timeEnd"></a-date-picker>
</a-form-item>
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
<a-button @click="exportFile">导出Excel</a-button>
</a-space>
</a-form>
<!-- 表格 -->
<ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="ambientAirId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
:init-load="false"
>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }">
<a-space>
<a-button type="primary" @click="reload">查询</a-button>
<a-button @click="reset">重置</a-button>
<a-button @click="exportFile">导出Excel</a-button>
</a-space>
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 表格 -->
<ele-pro-table ref="table" row-key="surfaceWaterSectionId" :datasource="url" :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import {pageAirUrl, getColumnOptions, listAllAir} from "@/api/ecology/atmosphere/air";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";
export default {
name: "StatisticAirBase",
import {
getRiverBill,
pageRiverUrl
} from "@/api/ecology/river";
import {
listInfo
} from "@/api/ecology/water/river-plcae";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import {
tableColumns
} from ".././collect/colums";
import XLSX from "xlsx";
export default {
name: "RiverCollectWater",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: pageAirUrl,
selection: [],
// 表格列配置
columns: [
{
title: "监测日期",
dataIndex: "monitorTime",
sorter: true,
customRender: ({text}) => moment(text).format("YYYY-MM-DD")
},
{
title: "城市",
dataIndex: "city",
sorter: true,
},
{
title: "测点名称",
dataIndex: "place",
sorter: true,
},
{
title: "SO2/(μg/m3)",
dataIndex: "so2",
sorter: true,
},
{
title: "NO2/(μg/m3)",
dataIndex: "no2",
sorter: true,
},
{
title: "PM10/(μg/m3)",
dataIndex: "pm10",
sorter: true,
},
{
title: "CO/(mg/m3)",
dataIndex: "co",
sorter: true,
},
{
title: "臭氧O3最大8小时滑动平均浓度/(μg/m3)",
dataIndex: "o3",
sorter: true,
},
{
title: "PM2.5",
dataIndex: "pm25",
sorter: true,
},
{
title: "空气质量指数AQI",
dataIndex: "aqi",
sorter: true,
},
{
title: "首要污染物",
dataIndex: "primaryPollutant",
sorter: true,
},
{
title: "空气质量指数级别",
dataIndex: "aqiLevel",
sorter: true,
},
{
title: "空气质量状况",
dataIndex: "airQualityStatus",
sorter: true,
},
{
title: "备注",
dataIndex: "remark",
sorter: true,
},
{
title: "创建人",
dataIndex: "username",
sorter: true,
}
],
regionLevelOptions: [
{label: "市区", value: "city"},
{label: "城区", value: "area"},
{label: "县区", value: "county"},
{label: "站点", value: "place"},
],
placeOptions:[],
time:[],
// 表格搜索条件
where: {
checked: 1,
timeStart: moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd: moment().format("YYYY-MM-DD 23:59:59")
},
// 表格选中数据
selectionList: [],
};
const {
billId
} = this.$route.params;
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: pageRiverUrl,
selection: [],
tableColumns,
// 表格列配置
columns: [
...tableColumns,
],
// 表格搜索条件
surfaceWaterSectionBillId: billId,
where: {
surfaceWaterSectionBillId: billId,
},
sectionInfo: {},
loading: false,
rules: {},
};
},
mounted() {
this.loadOptionData();
this.reload();
const {
billId
} = this.$route.params;
console.log(billId, 'billId');
getRiverBill(billId).then((res) => {
this.bill = res.data.data;
this.columns.splice(this.columns.length - 1, 1);
});
this.loadOptionData();
},
created() {
listInfo().then((res) => {
if (res.data.code == 0) {
console.log(res.data.data)
this.visibleWater = true;
this.sectionInfo = res.data.data
} else {
this.$message.error(res.data.msg);
}
})
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("place").then((res) => {
this.placeOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.where = {
checked: 1,
};
this.reload();
},
exportFile() {
/**获取下来框数据 */
loadOptionData() {},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.where = {
surfaceWaterSectionId: this.surfaceWaterSectionId,
};
this.reload();
},
/* 导出 */
exportFile() {
const columns = this.columns.filter(item => item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
const columns = [
{
title: "监测日期",
dataIndex: "monitorTime",
sorter: true,
customRender: ({text}) => moment(text).format("YYYY-MM-DD HH:mm")
},
{
title: "城市",
dataIndex: "city",
sorter: true,
},
{
title: "测点名称",
dataIndex: "place",
sorter: true,
},
{
title: "SO2/(μg/m3)",
dataIndex: "so2",
sorter: true,
},
{
title: "NO2/(μg/m3)",
dataIndex: "no2",
sorter: true,
},
{
title: "PM10/(μg/m3)",
dataIndex: "pm10",
sorter: true,
},
{
title: "CO/(mg/m3)",
dataIndex: "co",
sorter: true,
},
{
title: "臭氧O3最大8小时滑动平均浓度/(μg/m3)",
dataIndex: "o3",
sorter: true,
},
{
title: "PM2.5",
dataIndex: "pm25",
sorter: true,
},
{
title: "空气质量指数AQI",
dataIndex: "aqi",
sorter: true,
},
{
title: "首要污染物",
dataIndex: "primaryPollutant",
sorter: true,
},
{
title: "空气质量指数级别",
dataIndex: "aqiLevel",
sorter: true,
},
{
title: "空气质量状况",
dataIndex: "airQualityStatus",
sorter: true,
},
{
title: "备注",
dataIndex: "remark",
sorter: true,
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
listAllAir(this.where).then(res => {
if (res.data.code == 0) {
res.data.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日") + "基础数据");
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
}
}
})
},
},
};
};
</script>
<style scoped lang="less">

View File

@@ -8,36 +8,36 @@
<base-statistic></base-statistic>
</a-tab-pane>
<a-tab-pane tab="当月水质达标" key="base1">
<function-bill ref="functionWater"></function-bill>
<function-bill ></function-bill>
</a-tab-pane>
<a-tab-pane tab="平均水质达标" key="base2">
<function-bill ref="functionWater"></function-bill>
<function-bill></function-bill>
</a-tab-pane>
<a-tab-pane tab="当月综合指数" key="base3">
<function-bill ref="functionWater"></function-bill>
<function-bill></function-bill>
</a-tab-pane>
<a-tab-pane tab="平均水质指数" key="base4">
<function-bill ref="functionWater"></function-bill>
<function-bill ></function-bill>
</a-tab-pane>
</a-tabs>
</a-tab-pane>
<a-tab-pane tab="水功能区" key="ccb">
<a-tabs v-model:activeWater="activeWater">
<a-tab-pane tab="自治区级水功能" key="water1">
<auto-statis ref="water"></auto-statis>
<auto-statis></auto-statis>
</a-tab-pane>
<a-tab-pane tab="国家级水功能" key="water2">
<national-statis ref="functionWater"></national-statis>
<national-statis></national-statis>
</a-tab-pane>
</a-tabs>
</a-tab-pane>
<a-tab-pane tab="水站" key="ccd">
<a-tabs v-model:activeSite="activeSite">
<a-tab-pane tab="水站数据统计" key="site1">
<site-statis ref="water"></site-statis>
<site-statis ></site-statis>
</a-tab-pane>
<a-tab-pane tab="水站日均值数据统计" key="site2">
<site-day-statis ref="functionWater"></site-day-statis>
<site-day-statis></site-day-statis>
</a-tab-pane>
</a-tabs>
</a-tab-pane>