区域导入导出

This commit is contained in:
weicw
2021-08-25 23:31:05 +08:00
parent fd90065205
commit f68ca5f61d
20 changed files with 1734 additions and 2026 deletions

View File

@@ -47,7 +47,7 @@
</a-form>
<a-modal
v-model:visible="showEdit"
:title="form.functionNoiseId !== undefined ? '修改用户' : '添加用户'"
:title="form.functionNoiseId !== undefined ? '修改记录' : '添加记录'"
:confirm-loading="loading"
:width="1000"
:body-style="{ paddingBottom: '8px' }"

View File

@@ -41,7 +41,7 @@
</a-select>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :sm="24" :xs="24">
<!-- <a-col :lg="8" :md="12" :sm="24" :xs="24">
<a-form-item label="城区">
<a-select v-model:value="where.area" allowClear showSearch>
<a-select-option
@@ -51,7 +51,7 @@
>
</a-select>
</a-form-item>
</a-col>
</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>
@@ -93,7 +93,7 @@
import XLSX from "xlsx";
import { pageFunctionNoiseUrl, getColumnOptions } from "@/api/ecology/function-sound";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
// import moment from "moment";
import moment from "moment";
// import utils from "./utils";
export default {
name: "StatisticSoundFunctionBase",
@@ -111,6 +111,9 @@ export default {
{
title: "监测时间",
dataIndex: "monitorTime",
customRender:({text})=>{
return moment(text,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm")
},
sorter: true,
},
{

View File

@@ -0,0 +1,102 @@
<template>
<div class="">
<a-form :model="where" :rules="whereRules" :labelCol="{ offset: 1 }">
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="昼夜:">
<a-select
:options="timeSlotOptions"
v-model:value="where.timeSlot"
placeholder="昼夜"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="12" :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-if="hisYears.length > 0"
ref="table"
row-key="id"
:datasource="url"
:columns="columns"
:where="where"
:needPage="false"
:initLoad="false"
:scroll="{ x: 'max-content' }"
:method="'POST'"
@done="(d) => (data = d.data)"
>
<template #toolbar> </template>
</ele-pro-table>
</div>
</template>
<script>
// import _ from "lodash";
import XLSX from "xlsx";
import {
pageFunctionNoiseCompare,
getHistoryyears,
} from "@/api/ecology/function-sound";
export default {
name: "StatisticSoundFunctionCompare",
components: {},
data() {
const whereRules = {};
return {
url: pageFunctionNoiseCompare,
data: [],
where: {},
timeRange: [],
whereRules,
hisYears: [],
timeScope: [],
columns: [{ title: "年", dataIndex: "year" }],
};
},
mounted() {
getHistoryyears().then((res) => {
this.hisYears = res.data.data;
this.$nextTick(() => {
this.reload();
});
});
},
methods: {
/* 刷新表格 */
reload() {
this.$refs.table.reload({
where: this.where,
});
},
/* 重置搜索 */
reset() {
this.reload();
},
exportFile() {
const arr = [];
const th = this.columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = this.columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
},
},
};
</script>
<style scoped>
</style>