导入跳转

This commit is contained in:
weicw
2021-10-24 17:00:41 +08:00
parent 2a59762ef5
commit e3b8cafdac
45 changed files with 2856 additions and 2972 deletions

View File

@@ -11,7 +11,7 @@ const tableColumns = [
{title: "钠离子",dataIndex: "na",sorter: true,},
{title: "铵根离子",dataIndex: "ammoniumRadical",sorter: true,},
{title: "钾离子",dataIndex: "k",sorter: true,},
{title: "镁离子",dataIndex: "ng",sorter: true,},
{title: "镁离子",dataIndex: "mg",sorter: true,},
{title: "钙离子",dataIndex: "ca",sorter: true,},
{title: "备注",dataIndex: "remark",sorter: true,},
];

View File

@@ -16,6 +16,7 @@ export default {
const row = {
city: "南宁市",
place: dict.find(p=>p.placeCode = item[0].split("~")[0]).place,
placeType:dict.find(p=>p.placeCode = item[0].split("~")[0]).attribute,
code: item[0],
precipitationType:item[10],
precipitation:item[11],

View File

@@ -1,388 +1,391 @@
<template>
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear showSearch>
<a-select-option
v-for="(item) in regionLevelOptions"
:key="item.value"
>{{ item.label }}</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="测点名称:">
<a-select v-model:value="where.place" allowClear showSearch>
<a-select-option
v-for="(item) in palceOptions"
:key="item.value"
>{{ item.label }}</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="城区">
<a-select v-model:value="where.area" allowClear showSearch>
<a-select-option
v-for="(item) in areaOptions"
:key="item.value"
>{{ item.label }}</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<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
v-model:selection="selectionList"
ref="table"
row-key="acidRainId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #Address="{ record }">
{{record.area?record.area:record.county?record.county:record.city}}
</template>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear showSearch>
<a-select-option
v-for="(item) in regionLevelOptions"
:key="item.value"
>{{ item.label }}
</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="测点名称:">
<a-select v-model:value="where.place" allowClear showSearch>
<a-select-option
v-for="(item) in palceOptions"
:key="item.value"
>{{ item.label }}
</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="城区">
<a-select v-model:value="where.area" allowClear showSearch>
<a-select-option
v-for="(item) in areaOptions"
:key="item.value"
>{{ item.label }}
</a-select-option
>
</a-select>
</a-form-item>
</a-col>
<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
v-model:selection="selectionList"
ref="table"
row-key="acidRainId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #Address="{ record }">
{{ record.area ? record.area : record.county ? record.county : record.city }}
</template>
</ele-pro-table>
</a-card>
</div>
<!-- 编辑弹窗 -->
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import { pageAcidRainUrl, getColumnOptions } from "@/api/ecology/acid";
import {pageAcidRainUrl, getColumnOptions} from "@/api/ecology/acid";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
// import utils from "./utils";
export default {
name: "StatisticSoundZoneBase",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: pageAcidRainUrl,
selection: [],
// 表格列配置
columns: [
{
title: "采样开始时间",
dataIndex: "monitorStartTime",
sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "采样结束时间",
dataIndex: "monitorEndTime",
sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "行政代码",
dataIndex: "regionCode",
sorter: true,
},
{
title: "市(县,区)",
slots: {customRender: "Address"},
},
{
title: "采样点",
dataIndex: "place",
sorter: true,
},
{
title: "点位类型",
dataIndex: "placeType",
sorter: true,
},
{
title: "降水类型",
dataIndex: "precipitationType",
sorter: true,
},
{
title: "降水量",
dataIndex: "precipitation",
sorter: true,
},
{
title: "pH",
dataIndex: "ph",
sorter: true,
},
{
title: "电导率",
dataIndex: "conductivity",
sorter: true,
},
{
title: "SO42",
dataIndex: "so42",
sorter: true,
},
{
title: "NO3",
dataIndex: "no3",
sorter: true,
},
{
title: "F",
dataIndex: "f",
sorter: true,
},
{
title: "CL",
dataIndex: "cl",
sorter: true,
},
{
title: "NH4",
dataIndex: "nh4",
sorter: true,
},
{
title: "Ca2",
dataIndex: "ca2",
sorter: true,
},
{
title: "Mg2",
dataIndex: "mg2",
sorter: true,
},
{
title: "Na",
dataIndex: "na",
sorter: true,
},
{
title: "K",
dataIndex: "k",
sorter: true,
},
{
title: "系统编码",
dataIndex: "systemCode",
sorter: true,
},
name: "StatisticSoundZoneBase",
components: {},
data() {
return {
data: [],
locale,
bill: {},
// 表格数据接口
url: pageAcidRainUrl,
selection: [],
// 表格列配置
columns: [
{
title: "采样开始时间",
dataIndex: "monitorStartTime",
sorter: true,
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "采样结束时间",
dataIndex: "monitorEndTime",
sorter: true,
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "行政代码",
dataIndex: "regionCode",
sorter: true,
customRender: () => "450100"
},
{
title: "市(县,区)",
slots: {customRender: "Address"},
},
{
title: "采样点",
dataIndex: "place",
sorter: true,
},
{
title: "点位类型",
dataIndex: "placeType",
sorter: true,
},
{
title: "降水类型",
dataIndex: "precipitationType",
sorter: true,
},
{
title: "降水量",
dataIndex: "precipitation",
sorter: true,
},
{
title: "pH",
dataIndex: "ph",
sorter: true,
},
{
title: "电导率",
dataIndex: "conductivity",
sorter: true,
},
{
title: "SO42",
dataIndex: "sulfateRadical",
sorter: true,
},
{
title: "NO3",
dataIndex: "nitrate",
sorter: true,
},
{
title: "F",
dataIndex: "fluorine",
sorter: true,
},
{
title: "CL",
dataIndex: "chlorine",
sorter: true,
},
{
title: "NH4",
dataIndex: "ammoniumRadical",
sorter: true,
},
{
title: "Ca2",
dataIndex: "ca",
sorter: true,
},
{
title: "Mg2",
dataIndex: "mg",
sorter: true,
},
{
title: "Na",
dataIndex: "na",
sorter: true,
},
{
title: "K",
dataIndex: "k",
sorter: true,
},
{
title: "系统编码",
dataIndex: "systemCode",
sorter: true,
},
{
title: "备注",
dataIndex: "remark",
sorter: true,
},
{
title: "创建人",
dataIndex: "username",
sorter: true,
}
],
palceOptions: [],
areaOptions: [],
regionLevelOptions: [],
// 表格搜索条件
where: {
checked: 1,
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("place").then((res) => {
this.palceOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("area").then((res) => {
this.areaOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
{
title: "备注",
dataIndex: "remark",
sorter: true,
},
{
title: "创建人",
dataIndex: "username",
sorter: true,
}
],
palceOptions: [],
areaOptions: [],
regionLevelOptions: [],
// 表格搜索条件
where: {
checked: 1,
},
// 表格选中数据
selectionList: [],
};
},
/* 刷新表格 */
reload() {
mounted() {
this.loadOptionData();
},
methods: {
/**获取下来框数据 */
loadOptionData() {
getColumnOptions("place").then((res) => {
this.palceOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("area").then((res) => {
this.areaOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
},
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.where = {
checked: 1,
};
this.reload();
},
exportFile() {
const columns = [
{
title: "行政代码",
dataIndex: "regionCode",
sorter: true,
},
{
title: "市(县,区)",
dataIndex: "address",
slots: {customRender: "Address"},
},
{
title: "采样点",
dataIndex: "place",
sorter: true,
},
{
title: "点位类型",
dataIndex: "placeType",
sorter: true,
},
{
title: "采样开始时间",
dataIndex: "monitorStartTime",
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "采样结束时间",
dataIndex: "monitorEndTime",
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "降水类型",
dataIndex: "precipitationType",
sorter: true,
},
{
title: "降水量",
dataIndex: "precipitation",
sorter: true,
},
{
title: "pH",
dataIndex: "ph",
sorter: true,
},
{
title: "电导率",
dataIndex: "conductivity",
sorter: true,
},
{
title: "SO42",
dataIndex: "sulfateRadical",
sorter: true,
},
{
title: "NO3",
dataIndex: "nitrate",
sorter: true,
},
{
title: "F",
dataIndex: "fluorine",
sorter: true,
},
{
title: "CL",
dataIndex: "chlorine",
sorter: true,
},
{
title: "NH4",
dataIndex: "ammoniumRadical",
sorter: true,
},
{
title: "Ca2",
dataIndex: "ca",
sorter: true,
},
{
title: "Mg2",
dataIndex: "mg",
sorter: true,
},
{
title: "Na",
dataIndex: "na",
sorter: true,
},
{
title: "K",
dataIndex: "k",
sorter: true,
},
{
title: "系统编码",
dataIndex: "systemCode",
sorter: true,
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => {
if (item.dataIndex == "address") {
return d.area ? d.area : d.county ? d.county : d.city
}
return d[item.dataIndex];
});
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
/* 重置搜索 */
reset() {
this.where = {
checked: 1,
};
this.reload();
},
exportFile() {
const columns = [
{
title: "采样开始时间",
dataIndex: "monitorStartTime",
sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "采样结束时间",
dataIndex: "monitorEndTime",
sorter: true,
customRender: ({text})=> moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
{
title: "行政代码",
dataIndex: "regionCode",
sorter: true,
},
{
title: "市(县,区)",
dataIndex: "address",
slots: {customRender: "Address"},
},
{
title: "采样点",
dataIndex: "place",
sorter: true,
},
{
title: "点位类型",
dataIndex: "placeType",
sorter: true,
},
{
title: "降水类型",
dataIndex: "precipitationType",
sorter: true,
},
{
title: "降水量",
dataIndex: "precipitation",
sorter: true,
},
{
title: "pH",
dataIndex: "ph",
sorter: true,
},
{
title: "电导率",
dataIndex: "conductivity",
sorter: true,
},
{
title: "SO42",
dataIndex: "so42",
sorter: true,
},
{
title: "NO3",
dataIndex: "no3",
sorter: true,
},
{
title: "F",
dataIndex: "f",
sorter: true,
},
{
title: "CL",
dataIndex: "cl",
sorter: true,
},
{
title: "NH4",
dataIndex: "nh4",
sorter: true,
},
{
title: "Ca2",
dataIndex: "ca2",
sorter: true,
},
{
title: "Mg2",
dataIndex: "mg2",
sorter: true,
},
{
title: "Na",
dataIndex: "na",
sorter: true,
},
{
title: "K",
dataIndex: "k",
sorter: true,
},
{
title: "系统编码",
dataIndex: "systemCode",
sorter: true,
},
];
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => {
if(item.dataIndex == "address"){
return d.area?d.area:d.county?d.county:d.city
}
return d[item.dataIndex];
});
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
};
</script>

View File

@@ -2,40 +2,18 @@
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
layout="vertical"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">-->
<!-- <a-form-item label="区域等级:">-->
<!-- <a-select v-model:value="where.regionLevel">-->
<!-- <a-select-option-->
<!-- v-for="(item) in modelOptions"-->
<!-- :key="item.value"-->
<!-- >{{ item.label }}-->
<!-- </a-select-option>-->
<!-- </a-select>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<a-range-picker format="YYYY-MM" :mode="mode" @panelChange="handlePanelChange" @change="handleChange" v-model:value="time"/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :lg="24" :md="24" :sm="24" :xs="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-col>
</a-row>
<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 00:00:00" 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
@@ -63,7 +41,6 @@
import _ from "lodash";
import XLSX from "xlsx";
import {statisticCity, getColumnOptions} from "@/api/ecology/acid";
import {Modal} from "ant-design-vue";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
@@ -72,9 +49,10 @@ export default {
name: "StatisticAcidCity",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
mode:['month', 'month'],
mode: ['month', 'month'],
locale,
bill: {},
// 表格数据接口
@@ -97,14 +75,20 @@ export default {
{title: "降水pH值无量纲", dataIndex: "precipitationPh", align: "center"},
],
regionLevelOptions: [],
time: undefined,
time: [],
// 表格搜索条件
where: {},
where: {
timeStart: moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd: moment().format("YYYY-MM-DD 00:00:00")
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
const year = new Date().getFullYear();
this.time[0] = moment(`${year}-01-01 00:00:00`);
this.time[1] = moment(Date.now())
this.loadOptionData();
this.reload();
},
@@ -122,10 +106,10 @@ export default {
}
},
handleChange(val){
handleChange(val) {
this.time = val;
},
handlePanelChange(val,mode){
handlePanelChange(val, mode) {
this.time = val;
this.mode = [
mode[0] === 'date' ? 'month' : mode[0],
@@ -146,20 +130,8 @@ export default {
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
const year = new Date().getFullYear();
if (!this.time) {
where.timeStart = `${year}-01-01 00:00:00`;
where.timeEnd = moment(Date.now()).format("YYYY-MM-DD 00:00:00")
} else {
if (this.time[0].year() != this.time[1].year()) {
Modal.error({
title: "查询失败",
content: "开始时间与结束时间年份不一致",
})
return;
}
where.timeStart = this.time[0].format("YYYY-MM-01 00:00:00");
where.timeEnd = this.time[1].format("YYYY-MM-01 00:00:00");
if(!where.timeStart || !where.timeEnd){
return;
}
this.$refs.table.reload({
where
@@ -199,7 +171,7 @@ export default {
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日"));
},
},

View File

@@ -0,0 +1,18 @@
const tableColumns = [
{title: "编号",dataIndex: "code",sorter: true,},
{title: "降水类型",dataIndex: "precipitationType",sorter: true,},
{title: "降雨量(mm)",dataIndex: "precipitation",sorter: true,},
{title: "pH值无量纲",dataIndex: "ph",sorter: true,},
{title: "电导率(mS/m)",dataIndex: "conductivity",sorter: true,},
{title: "氟离子",dataIndex: "fluorine",sorter: true,},
{title: "氯离子",dataIndex: "chlorine",sorter: true,},
{title: "硫酸根离子",dataIndex: "sulfateRadical",sorter: true,},
{title: "硝酸根离子",dataIndex: "nitrate",sorter: true,},
{title: "钠离子",dataIndex: "na",sorter: true,},
{title: "铵根离子",dataIndex: "ammoniumRadical",sorter: true,},
{title: "钾离子",dataIndex: "k",sorter: true,},
{title: "镁离子",dataIndex: "mg",sorter: true,},
{title: "钙离子",dataIndex: "ca",sorter: true,},
{title: "备注",dataIndex: "remark",sorter: true,},
];
export {tableColumns}

View File

@@ -2,40 +2,18 @@
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
layout="vertical"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">-->
<!-- <a-form-item label="区域等级:">-->
<!-- <a-select v-model:value="where.regionLevel">-->
<!-- <a-select-option-->
<!-- v-for="(item) in modelOptions"-->
<!-- :key="item.value"-->
<!-- >{{ item.label }}-->
<!-- </a-select-option>-->
<!-- </a-select>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<a-range-picker format="YYYY-MM" :mode="mode" @panelChange="handlePanelChange" @change="handleChange" v-model:value="time"/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :lg="24" :md="24" :sm="24" :xs="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-col>
</a-row>
<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 00:00:00" 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
@@ -63,7 +41,6 @@
import _ from "lodash";
import XLSX from "xlsx";
import {statisticCounty, getColumnOptions} from "@/api/ecology/acid";
import { Modal } from "ant-design-vue";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
@@ -72,6 +49,7 @@ export default {
name: "StatisticAcidCounty",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
locale,
@@ -97,15 +75,20 @@ export default {
{title: "降水pH值无量纲", dataIndex: "precipitationPh", align: "center"},
],
regionLevelOptions: [],
time: undefined,
time: [],
// 表格搜索条件
where: {
timeStart: moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd: moment().format("YYYY-MM-DD 00:00:00")
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
const year = new Date().getFullYear();
this.time[0] = moment(`${year}-01-01 00:00:00`);
this.time[1] = moment(Date.now())
this.loadOptionData();
this.reload();
},
@@ -147,21 +130,7 @@ export default {
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
const year = new Date().getFullYear();
if (!this.time) {
where.timeStart = `${year}-01-01 00:00:00`;
where.timeEnd = moment(Date.now()).format("YYYY-MM-DD 00:00:00")
} else {
if(this.time[0].year() != this.time[1].year()){
Modal.error({
title: "查询失败",
content: "开始时间与结束时间年份不一致",
})
return;
}
where.timeStart = this.time[0].format("YYYY-MM-01 00:00:00");
where.timeEnd = this.time[1].format("YYYY-MM-01 00:00:00");
}
this.$refs.table.reload({
where
});
@@ -201,7 +170,7 @@ export default {
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日"));
},
},

View File

@@ -2,40 +2,18 @@
<div class="ele-body">
<a-card :bordered="false">
<!-- 搜索表单 -->
<a-form
:model="where"
layout="vertical"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }"
>
<a-row>
<!-- <a-col :lg="6" :md="12" :sm="24" :xs="24">-->
<!-- <a-form-item label="区域等级:">-->
<!-- <a-select v-model:value="where.regionLevel">-->
<!-- <a-select-option-->
<!-- v-for="(item) in modelOptions"-->
<!-- :key="item.value"-->
<!-- >{{ item.label }}-->
<!-- </a-select-option>-->
<!-- </a-select>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<a-range-picker v-model:value="time"/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :lg="24" :md="24" :sm="24" :xs="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-col>
</a-row>
<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 00:00:00" 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
@@ -62,7 +40,6 @@
import _ from "lodash";
import XLSX from "xlsx";
import {statisticIon, getColumnOptions} from "@/api/ecology/acid";
import { Modal } from "ant-design-vue";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment";
@@ -71,6 +48,7 @@ export default {
name: "StatisticAcidion",
components: {},
data() {
const year = new Date().getFullYear();
return {
data: [],
locale,
@@ -101,15 +79,20 @@ export default {
{title: "阴阳离子比例", dataIndex: "anionCationRatio",align:"center"},
],
regionLevelOptions: [],
time: undefined,
time: [],
// 表格搜索条件
where: {
timeStart: moment(`${year}-01-01 00:00:00`).format("YYYY-MM-DD 00:00:00"),
timeEnd: moment().format("YYYY-MM-DD 00:00:00")
},
// 表格选中数据
selectionList: [],
};
},
mounted() {
const year = new Date().getFullYear();
this.time[0] = moment(`${year}-01-01 00:00:00`);
this.time[1] = moment(Date.now())
this.loadOptionData();
this.reload();
},
@@ -128,21 +111,7 @@ export default {
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
const year = new Date().getFullYear();
if (!this.time) {
where.timeStart = `${year}-01-01 00:00:00`;
where.timeEnd = moment(Date.now()).format("YYYY-MM-DD 00:00:00")
} else {
if(this.time[0].year() != this.time[1].year()){
Modal.error({
title: "查询失败",
content: "开始时间与结束时间年份不一致",
})
return;
}
where.timeStart = this.time[0].format("YYYY-MM-DD 00:00:00");
where.timeEnd = this.time[1].format("YYYY-MM-DD 00:00:00");
}
this.$refs.table.reload({
where
});
@@ -182,7 +151,7 @@ export default {
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日"));
},
},