This commit is contained in:
weicw
2021-10-06 06:07:11 +08:00
parent dffbbb2763
commit 2a59762ef5
12 changed files with 1357 additions and 642 deletions

View File

@@ -23,7 +23,7 @@
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="时间范围:">
<a-range-picker v-model:value="time"/>
<a-range-picker format="YYYY-MM" :mode="mode" @panelChange="handlePanelChange" @change="handleChange" v-model:value="time"/>
</a-form-item>
</a-col>
</a-row>
@@ -50,6 +50,7 @@
:init-load="false"
@done="(d) => (data = d.data)"
method="POST"
:parseData="parseData"
>
</ele-pro-table>
@@ -86,7 +87,14 @@ export default {
],
// 表格列配置
columns: [
{title: "xx", dataIndex: "place",align:"center"},
{title: "县城", dataIndex: "place", align: "center"},
{title: "项目", dataIndex: "periodType", align: "center"},
{title: "降水样品(个)", dataIndex: "precipitationSampleAcount", align: "center"},
{title: "酸雨样品(个)", dataIndex: "acidRainSampleAcount", align: "center"},
{title: "最小pH值", dataIndex: "minPh", align: "center"},
{title: "最大pH值", dataIndex: "maxPh", align: "center"},
{title: "酸雨频率(%", dataIndex: "acidRainFrequency", align: "center"},
{title: "降水pH值无量纲", dataIndex: "precipitationPh", align: "center"},
],
regionLevelOptions: [],
time: undefined,
@@ -113,6 +121,29 @@ export default {
});
});
},
parseData(res) {
if (res.code == 0) {
const list = [];
console.log(res.data[0])
res.data.forEach(item => {
const key = Object.keys(item)[0]
list.push(...item[key])
})
res.data = list;
return res;
}
},
handleChange(val){
this.time = val;
},
handlePanelChange(val,mode){
this.time = val;
this.mode = [
mode[0] === 'date' ? 'month' : mode[0],
mode[1] === 'date' ? 'month' : mode[1],
]
},
/* 刷新表格 */
reload() {
const where = _.cloneDeep(this.where);
@@ -128,8 +159,8 @@ export default {
})
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");
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