到处格式,拆分时间

This commit is contained in:
weicw
2021-11-09 09:17:49 +08:00
parent 9b52b7abac
commit eda3eb3de1
11 changed files with 378 additions and 468 deletions

View File

@@ -67,7 +67,6 @@ 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",
@@ -258,120 +257,66 @@ export default {
exportFile() { exportFile() {
const columns = [ const columns = [
{ {title: "",dataIndex: "regionCode",customRender:()=>"450100",},
title: "行政代码", {title: "",dataIndex: "address"},
dataIndex: "regionCode", {title: "",dataIndex: "place", },
sorter: true, {title: "",dataIndex: "placeType",},
}, {title: "年",dataIndex: "monitorStartTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").year()},
{ {title: "月",dataIndex: "monitorStartTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").month()},
title: "市(县,区)", {title: "日",dataIndex: "monitorStartTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").days()},
dataIndex: "address", {title: "时",dataIndex: "monitorStartTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").hour()},
slots: {customRender: "Address"}, {title: "分",dataIndex: "monitorStartTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").minute()},
}, {title: "年",dataIndex: "monitorEndTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").year()},
{ {title: "月",dataIndex: "monitorEndTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").month()},
title: "采样点", {title: "日",dataIndex: "monitorEndTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").days()},
dataIndex: "place", {title: "时",dataIndex: "monitorEndTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").hour()},
sorter: true, {title: "分",dataIndex: "monitorEndTime", customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").minute()},
}, {title: "",dataIndex: "precipitationType", },
{ { title: "(mm)",dataIndex: "precipitation",sorter: true, },
title: "点位类型", {title: "",dataIndex: "ph", },
dataIndex: "placeType", {title: "(mS/m)",dataIndex: "conductivity", },
sorter: true, {title: "SO42-", dataIndex: "so42",},
}, {title: "NO3-",dataIndex: "no3",},
{ { title: "F-", dataIndex: "f",},
title: "采样开始时间", {title: "CL-", dataIndex: "cl",},
dataIndex: "monitorStartTime", {title: "NH4",dataIndex: "nh4", },
customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD HH:mm") { title: "Ca2", dataIndex: "ca",},
}, {title: "Mg2",dataIndex: "mg", },
{ {title: "Na",dataIndex: "na",},
title: "采样结束时间", {title: "K", dataIndex: "k"},
dataIndex: "monitorEndTime", {title: "",dataIndex: "systemCode",},
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 arr = [["酸雨监测结果报告表"]];
const th = columns.map((item) => item.title); const th1 = ["行政代码","市(县,区)","采样点","点位类型","采样开始时间","","","","","采样结束时间","","","","","降水类型","降水量","pH","电导率","离子组分mg/l)","","","","","","","","","系统编码"];
arr.push(th); const th2 = columns.map((item) => item.title);
arr.push(th1);
arr.push(th2);
const merges = []; // 合并
merges.push({s: {r: 0, c: 0}, e: {r: 0, c: 27}});
merges.push({s: {r: 1, c: 0}, e: {r: 2, c: 0}});
merges.push({s: {r: 1, c: 1}, e: {r: 2, c: 1}});
merges.push({s: {r: 1, c: 2}, e: {r: 2, c: 2}});
merges.push({s: {r: 1, c: 3}, e: {r: 2, c: 3}});
merges.push({s: {r: 1, c: 4}, e: {r: 1, c: 8}});
merges.push({s: {r: 1, c: 9}, e: {r: 1, c: 13}});
merges.push({s: {r: 1, c: 14}, e: {r: 2, c: 14}});
// merges.push({s: {r: 1, c: 16}, e: {r: 2, c: 16}});
merges.push({s: {r: 1, c: 16}, e: {r: 2, c: 16}});
merges.push({s: {r: 1, c: 18}, e: {r: 1, c: 26}});
merges.push({s: {r: 1, c: 27}, e: {r: 2, c: 27}});
this.data.forEach((d) => { this.data.forEach((d) => {
const td = columns.map((item) => { const td = columns.map((item) => {
if (item.dataIndex == "address") { if (item.dataIndex == "address") {
return d.area ? d.area : d.county ? d.county : d.city return d.area ? d.area : d.county ? d.county : d.city
}else if(item.customRender){
return item.customRender({text:d[item.dataIndex]});
} }
return d[item.dataIndex]; return d[item.dataIndex];
}); });
arr.push(td); arr.push(td);
}); });
let sheet = XLSX.utils.aoa_to_sheet(arr); 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, new Date().getTime().toString());
}, },
}, },

View File

@@ -237,7 +237,7 @@ export default {
let sheet = XLSX.utils.aoa_to_sheet(arr); let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges; sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日")); this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日") + "城区浓度统计");
}, },
}, },

View File

@@ -287,7 +287,13 @@ export default {
}) })
arr.push(th1,th2); arr.push(th1,th2);
this.data.forEach((d) => { this.data.forEach((d) => {
const td = columnsTemp.map((item) => d[item.dataIndex]); const td = columnsTemp.map((item) => {
if(item.customRender){
return item.customRender({text:d[item.dataIndex]});
}
return d[item.dataIndex];
});
arr.push(td); arr.push(td);
}); });
let sheet = XLSX.utils.aoa_to_sheet(arr); let sheet = XLSX.utils.aoa_to_sheet(arr);

View File

@@ -276,11 +276,6 @@ export default {
dataIndex: "remark", dataIndex: "remark",
sorter: true, sorter: true,
}, },
{
title: "创建人",
dataIndex: "username",
sorter: true,
},
]; ];
const arr = []; const arr = [];
const th = columns.map((item) => item.title); const th = columns.map((item) => item.title);
@@ -292,7 +287,8 @@ export default {
arr.push(td); arr.push(td);
}); });
let sheet = XLSX.utils.aoa_to_sheet(arr); let sheet = XLSX.utils.aoa_to_sheet(arr);
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

@@ -275,7 +275,7 @@ export default {
}); });
let sheet = XLSX.utils.aoa_to_sheet(arr); let sheet = XLSX.utils.aoa_to_sheet(arr);
sheet['!merges'] = merges; sheet['!merges'] = merges;
this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日")); this.$util.exportSheet(XLSX, sheet, moment(this.where.timeStart).format("YYYY年MM月DD日") + "至" + moment(this.where.timeEnd).format("YYYY年MM月DD日")+ "统计数据");
}, },
}, },

View File

@@ -7,7 +7,12 @@
<!-- 搜索表单 --> <!-- 搜索表单 -->
<a-form layout="inline" :model="where" :labelCol="{ offset: 1}"> <a-form layout="inline" :model="where" :labelCol="{ offset: 1}">
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.reportTimeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 23:59:59" v-model:value="where.reportTimeEnd"></a-date-picker>
</a-form-item>
<a-form-item label="区域等级:"> <a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear placeholder="未选择"> <a-select v-model:value="where.regionLevel" allowClear placeholder="未选择">
<a-select-option :value="'市级'">市级</a-select-option> <a-select-option :value="'市级'">市级</a-select-option>
@@ -25,9 +30,7 @@
<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-range-picker separator="~" v-model:value="reportTimeScope" />
</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}">
<a-space> <a-space>
@@ -228,12 +231,6 @@
/* 刷新表格 */ /* 刷新表格 */
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

@@ -7,6 +7,12 @@
<!-- 搜索表单 --> <!-- 搜索表单 -->
<a-form layout="inline" :model="where" :labelCol="{ offset: 1}"> <a-form layout="inline" :model="where" :labelCol="{ offset: 1}">
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.reportTimeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 23:59:59" v-model:value="where.reportTimeEnd"></a-date-picker>
</a-form-item>
<a-form-item label="区域等级:"> <a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear placeholder="未选择"> <a-select v-model:value="where.regionLevel" allowClear placeholder="未选择">
<a-select-option :value="'市级'">市级</a-select-option> <a-select-option :value="'市级'">市级</a-select-option>
@@ -24,9 +30,6 @@
<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-range-picker separator="~" v-model:value="reportTimeScope" />
</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}">
<a-space> <a-space>
@@ -227,12 +230,7 @@
/* 刷新表格 */ /* 刷新表格 */
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

@@ -12,9 +12,13 @@
> >
<template #toolbar> <template #toolbar>
<!-- 搜索表单 --> <!-- 搜索表单 -->
<a-form :model="where" layout="inline" :labelCol="{ offset: 1 }"> <a-form :model="where" layout="inline" >
<a-row> <a-form-item label="起始日期:">
<a-col :lg="6" :md="12" :sm="24" :xs="24"> <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-form-item label="昼夜:">
<a-select <a-select
:options="timeSlotOptions" :options="timeSlotOptions"
@@ -23,15 +27,8 @@
> >
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col>
<a-col :lg="8" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<!-- <a-month-picker v-model:value="timeScope" placeholder="起始" /> -->
<a-range-picker v-model:value="timeScope" format="YYYY-MM-DD" />
</a-form-item>
</a-col>
<a-col :lg="4" :md="12" :sm="24" :xs="24">
<a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }"> <a-form-item class="ele-text-right" :wrapper-col="{ span: 24 }">
<a-space> <a-space>
<a-button type="primary" @click="reload">查询</a-button> <a-button type="primary" @click="reload">查询</a-button>
@@ -39,8 +36,6 @@
<a-button @click="exportFile">导出excel</a-button> <a-button @click="exportFile">导出excel</a-button>
</a-space> </a-space>
</a-form-item> </a-form-item>
</a-col>
</a-row>
</a-form> </a-form>
<!-- <a-space> <!-- <a-space>
@@ -53,7 +48,8 @@
(where.timeSlot == '夜' && text <= 58) (where.timeSlot == '夜' && text <= 58)
" "
color="green" color="green"
>{{ text }}</a-tag >{{ text }}
</a-tag
> >
<a-tag <a-tag
v-else-if=" v-else-if="
@@ -61,7 +57,8 @@
(record.timeSlot == '夜' && text > 58 && text <= 60) (record.timeSlot == '夜' && text > 58 && text <= 60)
" "
color="blue" color="blue"
>{{ text }}</a-tag >{{ text }}
</a-tag
> >
<a-tag <a-tag
v-else-if=" v-else-if="
@@ -69,7 +66,8 @@
(record.timeSlot == '夜' && text > 60 && text <= 62) (record.timeSlot == '夜' && text > 60 && text <= 62)
" "
color="red" color="red"
>{{ text }}</a-tag >{{ text }}
</a-tag
> >
<a-tag <a-tag
v-else-if=" v-else-if="
@@ -77,7 +75,8 @@
(record.timeSlot == '夜' && text > 62 && text <= 64) (record.timeSlot == '夜' && text > 62 && text <= 64)
" "
color="red" color="red"
>{{ text }}</a-tag >{{ text }}
</a-tag
> >
<a-tag <a-tag
v-else-if=" v-else-if="
@@ -85,7 +84,8 @@
(record.timeSlot == '夜' && text > 64) (record.timeSlot == '夜' && text > 64)
" "
color="red" color="red"
>{{ text }}</a-tag >{{ text }}
</a-tag
> >
<template v-else color="#FFF">{{ text }}</template> <template v-else color="#FFF">{{ text }}</template>
</template> </template>
@@ -96,7 +96,8 @@
<script> <script>
import _ from "lodash"; import _ from "lodash";
import XLSX from "xlsx"; import XLSX from "xlsx";
import { pageRoadNoiseStatisticUrl } from "@/api/ecology/noise/road-sound"; import {pageRoadNoiseStatisticUrl} from "@/api/ecology/noise/road-sound";
const columns = [ const columns = [
{ {
title: "城区", title: "城区",
@@ -118,25 +119,25 @@ const columns = [
{ {
title: "LeqdB(A)", title: "LeqdB(A)",
dataIndex: "avgLeq", dataIndex: "avgLeq",
slots: { customRender: "Leq" }, slots: {customRender: "Leq"},
sorter: true, sorter: true,
}, },
{ // {
title: "SDdB(A)", // title: "SDdB(A)",
dataIndex: "avgSD", // dataIndex: "avgSD",
}, // },
{ // {
title: "L10dB(A)", // title: "L10dB(A)",
dataIndex: "avgL10", // dataIndex: "avgL10",
}, // },
{ // {
title: "L50dB(A)", // title: "L50dB(A)",
dataIndex: "avgL50", // dataIndex: "avgL50",
}, // },
{ // {
title: "L90dB(A)", // title: "L90dB(A)",
dataIndex: "avgL90", // dataIndex: "avgL90",
}, // },
]; ];
export default { export default {
name: "StatisticSoundRoadAverage", name: "StatisticSoundRoadAverage",
@@ -185,18 +186,7 @@ export default {
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
this.$refs.table.reload({ this.$refs.table.reload({
where: { where: this.where
model: this.where.model,
timeStart:
this.timeScope.length == 2
? this.timeScope[0].format("Y-M-D")
: null,
timeEnd:
this.timeScope.length == 2
? this.timeScope[1].format("Y-M-D")
: null,
timeSlot: this.where.timeSlot,
},
}); });
let cloneColumns = _.cloneDeep(columns); let cloneColumns = _.cloneDeep(columns);
if (this.where.model == "area") { if (this.where.model == "area") {

View File

@@ -121,6 +121,7 @@
import XLSX from "xlsx"; import XLSX from "xlsx";
import { pageRoadNoiseUrl, getColumnOptions,listAll } from "@/api/ecology/noise/road-sound"; import { pageRoadNoiseUrl, getColumnOptions,listAll } from "@/api/ecology/noise/road-sound";
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 moment from "moment";
// import utils from "./utils"; // import utils from "./utils";
export default { export default {
@@ -141,6 +142,7 @@ export default {
title: "监测日期", title: "监测日期",
dataIndex: "monitorTime", dataIndex: "monitorTime",
sorter: true, sorter: true,
customRender:({text})=>moment(text).format("YYYY-MM-DD HH:mm")
}, },
{ {
title: "测点名称", title: "测点名称",

View File

@@ -1,22 +1,16 @@
<template> <template>
<div class=""> <div class="">
<a-form labelAlign="left" <a-form labelAlign="left"
layout="vertical" :model="where" :rules="whereRules" layout="inline" :model="where" :rules="whereRules"
: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-form-item name="timeRange" label="时间范围:"> <a-input-number id="inputNumber" v-model:value="where.startYear" :min="1970" :max="2050" />
<a-range-picker </a-form-item>
@panelChange="timeRangePanelChange" <a-form-item label="结束日期:">
v-model:value="timeRange" <a-input-number id="inputNumber" v-model:value="where.endYear" :min="1970" :max="2050" />
format="YYYY"
:mode="['year', 'year']"
/>
</a-form-item> </a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="昼夜:"> <a-form-item label="昼夜:">
<a-select <a-select
:options="timeSlotOptions" :options="timeSlotOptions"
@@ -25,9 +19,7 @@
> >
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col>
<a-col :lg="24" :md="24" :sm="24" :xs="24">
<a-form-item class="ele-text-left" :wrapper-col="{ span: 24 }"> <a-form-item class="ele-text-left" :wrapper-col="{ span: 24 }">
<a-space> <a-space>
<a-button type="primary" @click="reload">查询</a-button> <a-button type="primary" @click="reload">查询</a-button>
@@ -35,8 +27,6 @@
<a-button @click="exportFile">导出Excel</a-button> <a-button @click="exportFile">导出Excel</a-button>
</a-space> </a-space>
</a-form-item> </a-form-item>
</a-col>
</a-row>
</a-form> </a-form>
<ele-pro-table <ele-pro-table
v-if="hisYears.length > 0" v-if="hisYears.length > 0"
@@ -132,15 +122,6 @@ export default {
return; return;
} }
// 结束时间必须大于开始时间
if (this.where.timeRange && this.where.timeRange.length == 2) {
if (this.where.timeRange[0] > this.where.timeRange[1]) {
this.$message.error("结束时间必须大于起始时间");
return;
}
this.where.startYear = this.where.timeRange[0];
this.where.endYear = this.where.timeRange[1];
}
this.stableDone(); this.stableDone();
this.$refs.table.reload({ this.$refs.table.reload({
where: this.where, where: this.where,
@@ -193,26 +174,26 @@ export default {
this.hisYears.forEach((item) => { this.hisYears.forEach((item) => {
if ( if (
(!this.where.timeRange[0] || this.where.timeRange[0] <= item) && (!this.where.startYear || this.where.startYear <= item) &&
(!this.where.timeRange[1] || this.where.timeRange[1] >= item) (!this.where.endYear || !this.where.endYear >= item)
) { ) {
if (this.where.valueType.includes("index_Leq")) { if (this.where.valueType.includes("index_Leq")) {
columns.push({ columns.push({
title: item + "年", title: item + "年",
align:"center", align: "center",
children: [ children: [
{ {
title:"Leq", title: "Leq",
dataIndex: item + "Leq", dataIndex: item + "Leq",
align:"center", align: "center",
customRender: ({text}) => { customRender: ({text}) => {
const val = text ? Number(text).toFixed(1) : ""; const val = text ? Number(text).toFixed(1) : "";
return val; return val;
}, },
}, },
{ {
title:"等级", title: "等级",
align:"center", align: "center",
dataIndex: item + "LeqLevel", dataIndex: item + "LeqLevel",
} }
] ]
@@ -230,22 +211,22 @@ export default {
const th2 = []; const th2 = [];
const merges = []; // 合并 const merges = []; // 合并
const columnsTemp = []; // 树形结构整理成list const columnsTemp = []; // 树形结构整理成list
this.columns.forEach((item,index)=>{ this.columns.forEach((item, index) => {
if(item.children){ if (item.children) {
item.children.forEach(citem=>{ item.children.forEach(citem => {
th1.push(item.title) th1.push(item.title)
th2.push(citem.title) th2.push(citem.title)
columnsTemp.push(citem) columnsTemp.push(citem)
}) })
merges.push({s: {r: 0, c: th1.length-2}, e: {r: 0, c: th1.length-1}}) merges.push({s: {r: 0, c: th1.length - 2}, e: {r: 0, c: th1.length - 1}})
}else{ } else {
th1.push(item.title) th1.push(item.title)
th2.push("") th2.push("")
columnsTemp.push(item) columnsTemp.push(item)
merges.push({s: {r: 0, c: index}, e: {r: 1, c: index}}) merges.push({s: {r: 0, c: index}, e: {r: 1, c: index}})
} }
}) })
arr.push(th1,th2); arr.push(th1, th2);
this.data.forEach((d) => { this.data.forEach((d) => {
const td = columnsTemp.map((item) => { const td = columnsTemp.map((item) => {
if (typeof d[item.dataIndex] == "number") { if (typeof d[item.dataIndex] == "number") {

View File

@@ -7,6 +7,12 @@
<!-- 搜索表单 --> <!-- 搜索表单 -->
<a-form layout="inline" :model="where" :labelCol="{ offset: 1}"> <a-form layout="inline" :model="where" :labelCol="{ offset: 1}">
<a-form-item label="起始日期:">
<a-date-picker valueFormat="YYYY-MM-DD 00:00:00" v-model:value="where.reportTimeStart"></a-date-picker>
</a-form-item>
<a-form-item label="结束日期:">
<a-date-picker valueFormat="YYYY-MM-DD 23:59:59" v-model:value="where.reportTimeEnd"></a-date-picker>
</a-form-item>
<a-form-item label="区域等级:"> <a-form-item label="区域等级:">
<a-select v-model:value="where.regionLevel" allowClear placeholder="未选择"> <a-select v-model:value="where.regionLevel" allowClear placeholder="未选择">
<a-select-option :value="'市级'">市级</a-select-option> <a-select-option :value="'市级'">市级</a-select-option>
@@ -24,9 +30,6 @@
<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-range-picker separator="~" v-model:value="reportTimeScope" />
</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}">
<a-space> <a-space>
@@ -223,16 +226,8 @@
}; };
}, },
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
}); });