This commit is contained in:
weicw
2021-11-04 22:58:12 +08:00
parent 18f4bd8a4d
commit 9b52b7abac
4 changed files with 386 additions and 403 deletions

View File

@@ -24,8 +24,11 @@
<a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear /> <a-input v-model:value.trim="where.billName" placeholder="请输入" allow-clear />
</a-form-item> </a-form-item>
<a-form-item label="上报时间:"> <a-form-item label="起始日期:">
<a-range-picker separator="~" v-model:value="reportTimeScope" /> <a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.createTimeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 23:59:59" v-model:value="where.createTimeEnd"></a-date-picker>
</a-form-item> </a-form-item>
<a-form-item class="ele-text-right" :wrapper-col="{span: 24}"> <a-form-item class="ele-text-right" :wrapper-col="{span: 24}">
@@ -213,8 +216,9 @@
} }
], ],
// 表格搜索条件 // 表格搜索条件
where: {}, where: {
reportTimeScope: [],
},
// 表格选中数据 // 表格选中数据
selectionList: [], selectionList: [],
editableData: {}, editableData: {},
@@ -223,16 +227,9 @@
}; };
}, },
methods: { methods: {
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
this.where.reportTimeStart = null;
this.where.reportTimeEnd = null;
if (this.reportTimeScope && this.reportTimeScope.length == 2) {
this.where.reportTimeStart = this.reportTimeScope[0].format("Y-M-D H:m:s")
this.where.reportTimeEnd = this.reportTimeScope[1].format("Y-M-D H:m:s")
}
this.$refs.table.reload({ this.$refs.table.reload({
where: this.where where: this.where
}); });

View File

@@ -1,79 +1,64 @@
<template> <template>
<div class="ele-body"> <div class="ele-body">
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 搜索表单 --> <!-- 搜索表单 -->
<a-form <a-form
:model="where" :model="where"
:label-col="{ md: { span: 6 }, sm: { span: 24 } }" layout="inline"
:wrapper-col="{ md: { span: 18 }, sm: { span: 24 } }" >
<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" allowClear showSearch placeholder="选择区域等级">
<a-select-option
v-for="(item) in regionLevelOptions"
:key="item.value"
>{{ item.label }}
</a-select-option
> >
<a-row> </a-select>
<a-col :lg="6" :md="12" :sm="24" :xs="24"> </a-form-item>
<a-form-item label="区域等级:"> <a-form-item label="测点名称:">
<a-select v-model:value="where.regionLevel" allowClear showSearch> <a-select v-model:value="where.place" allowClear showSearch placeholder="选择监测点">
<a-select-option <a-select-option
v-for="(item) in regionLevelOptions" v-for="(item) in palceOptions"
:key="item.value" :key="item.value"
>{{ item.label }} >{{ item.label }}
</a-select-option </a-select-option
> >
</a-select> </a-select>
</a-form-item> </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 class="ele-text-right" :wrapper-col="{ span: 24 }">
<a-form-item label="城区"> <a-space>
<a-select v-model:value="where.area" allowClear showSearch> <a-button type="primary" @click="reload">查询</a-button>
<a-select-option <a-button @click="reset">重置</a-button>
v-for="(item) in areaOptions" <a-button @click="exportFile">导出Excel</a-button>
:key="item.value" </a-space>
>{{ item.label }} </a-form-item>
</a-select-option </a-form>
> <!-- 表格 -->
</a-select> <ele-pro-table
</a-form-item> v-model:selection="selectionList"
</a-col> ref="table"
<a-col :lg="6" :md="12" :sm="24" :xs="24"> row-key="acidRainId"
<a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }"> :datasource="url"
<a-space> :columns="columns"
<a-button type="primary" @click="reload">查询</a-button> :where="where"
<a-button @click="reset">重置</a-button> :scroll="{ x: 'max-content' }"
<a-button @click="exportFile">导出Excel</a-button> @done="(d) => (data = d.data)"
</a-space> >
</a-form-item> <template #Address="{ record }">
</a-col> {{ record.area ? record.area : record.county ? record.county : record.city }}
</a-row> </template>
</a-form> </ele-pro-table>
<!-- 表格 --> </a-card>
<ele-pro-table </div>
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> </template>
<script> <script>
@@ -82,310 +67,314 @@ import XLSX from "xlsx";
import {pageAcidRainUrl, getColumnOptions} from "@/api/ecology/atmosphere/acid"; import {pageAcidRainUrl, getColumnOptions} from "@/api/ecology/atmosphere/acid";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN"; import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import moment from "moment"; import moment from "moment";
import { tableColumns } from "./colums";
// import utils from "./utils"; // import utils from "./utils";
export default { export default {
name: "StatisticSoundZoneBase", name: "StatisticSoundZoneBase",
components: {}, components: {},
data() { data() {
return { const year = new Date().getFullYear();
data: [], return {
locale, data: [],
bill: {}, locale,
// 表格数据接口 bill: {},
url: pageAcidRainUrl, // 表格数据接口
selection: [], url: pageAcidRainUrl,
// 表格列配置 selection: [],
columns: [ // 表格列配置
{ columns: [
title: "采样开始时间", {
dataIndex: "monitorStartTime", title: "采样开始时间",
sorter: true, dataIndex: "monitorStartTime",
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm") sorter: true,
}, customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
{ },
title: "采样结束时间", {
dataIndex: "monitorEndTime", title: "采样结束时间",
sorter: true, dataIndex: "monitorEndTime",
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm") sorter: true,
}, customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
{ },
title: "行政代码", {
dataIndex: "regionCode", title: "行政代码",
sorter: true, dataIndex: "regionCode",
customRender: () => "450100" sorter: true,
}, customRender: () => "450100"
{ },
title: "市(县,区)", {
slots: {customRender: "Address"}, title: "市(县,区)",
}, slots: {customRender: "Address"},
{ },
title: "采样点", {
dataIndex: "place", title: "采样点",
sorter: true, dataIndex: "place",
}, sorter: true,
{ },
title: "点位类型", {
dataIndex: "placeType", title: "点位类型",
sorter: true, dataIndex: "placeType",
}, sorter: true,
{ },
title: "降水类型", {
dataIndex: "precipitationType", title: "降水类型",
sorter: true, dataIndex: "precipitationType",
}, sorter: true,
{ },
title: "降水量", {
dataIndex: "precipitation", title: "降水量",
sorter: true, dataIndex: "precipitation",
}, sorter: true,
{ },
title: "pH", {
dataIndex: "ph", title: "pH",
sorter: true, dataIndex: "ph",
}, sorter: true,
{ },
title: "电导率", {
dataIndex: "conductivity", title: "电导率",
sorter: true, dataIndex: "conductivity",
}, sorter: true,
{ },
title: "SO42", {
dataIndex: "sulfateRadical", title: "SO42",
sorter: true, dataIndex: "so42",
}, sorter: true,
{ },
title: "NO3", {
dataIndex: "nitrate", title: "NO3",
sorter: true, dataIndex: "no3",
}, sorter: true,
{ },
title: "F", {
dataIndex: "fluorine", title: "F",
sorter: true, dataIndex: "f",
}, sorter: true,
{ },
title: "CL", {
dataIndex: "chlorine", title: "CL",
sorter: true, dataIndex: "cl",
}, sorter: true,
{ },
title: "NH4", {
dataIndex: "ammoniumRadical", title: "NH4",
sorter: true, dataIndex: "nh4",
}, sorter: true,
{ },
title: "Ca2", {
dataIndex: "ca", title: "Ca2",
sorter: true, dataIndex: "ca",
}, sorter: true,
{ },
title: "Mg2", {
dataIndex: "mg", title: "Mg2",
sorter: true, dataIndex: "mg",
}, sorter: true,
{ },
title: "Na", {
dataIndex: "na", title: "Na",
sorter: true, dataIndex: "na",
}, sorter: true,
{ },
title: "K", {
dataIndex: "k", title: "K",
sorter: true, dataIndex: "k",
}, sorter: true,
{ },
title: "系统编码", {
dataIndex: "systemCode", title: "系统编码",
sorter: true, dataIndex: "systemCode",
}, sorter: true,
},
{ {
title: "备注", title: "备注",
dataIndex: "remark", dataIndex: "remark",
sorter: true, 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,
};
});
});
}, },
/* 刷新表格 */ {
reload() { title: "创建人",
dataIndex: "username",
sorter: true,
}
],
palceOptions: [],
areaOptions: [],
regionLevelOptions: [],
// 表格搜索条件
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: [],
};
},
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({ this.$refs.table.reload({
where: this.where, 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: "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: "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: "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());
},
},
}; };
</script> </script>

View File

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

View File

@@ -11,9 +11,6 @@
</a-form-item> </a-form-item>
<a-form-item label="结束日期:"> <a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 23:59:59" v-model:value="where.timeEnd"></a-date-picker> <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-form-item> </a-form-item>
<a-form-item label="区域等级:"> <a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" placeholder="选择区域等级" allowClear showSearch> <a-select v-model:value="where.regionLevel" placeholder="选择区域等级" allowClear showSearch>