统计代码优化

This commit is contained in:
shixiaoman
2021-11-26 10:13:34 +08:00
parent 07f7cf6b66
commit 028aa411ce
9 changed files with 419 additions and 244 deletions

View File

@@ -36,7 +36,7 @@
</a-form> </a-form>
<!-- 表格 --> <!-- 表格 -->
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<ele-pro-table ref="table" :datasource="datasource" :columns="columns" :where="where" <ele-pro-table ref="table" :datasource="datasource" bordered :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)"> :scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
</ele-pro-table> </ele-pro-table>
</a-spin> </a-spin>
@@ -71,62 +71,197 @@
selection: [], selection: [],
// tableColumns, // tableColumns,
// 表格列配置 // 表格列配置
columns: [ columns: [{
{ title: ' ',
dataIndex: 'riverName',
key: 'riverName',
align:'center',
children: [{
title: '所在河流名称', title: '所在河流名称',
dataIndex: 'riverName', dataIndex: 'riverName',
key: 'riverName', key: 'riverName',
children: [{
title: '一',
dataIndex: 'riverName',
align: 'center',
}],
}]
}, },
{ {
title: ' ',
dataIndex: 'riverName',
key: 'riverName',
children: [{
title: '自动站名称', title: '自动站名称',
dataIndex: 'stationName', dataIndex: 'stationName',
align:'center',
key: 'stationName', key: 'stationName',
children: [{
title: '《地表水环境质量标准》一类水质标准',
children: [{
title: '《地表水环境质量标准》二类水质标准',
children: [{
title: '《地表水环境质量标准》三类水质标准',
children: [{
title: '《地表水环境质量标准》四类水质标准',
}],
}],
}],
}],
}]
}, },
{ // {
title: '水质考核目标', // title: ' ',
dataIndex: 'waterTarget', // dataIndex: 'riverName',
key: 'waterTarget', // key: 'riverName',
}, // children: [{
{ // title: '水质考核目标',
title: '水质类别', // dataIndex: 'waterTarget',
dataIndex: 'waterQualityType', // key: 'waterTarget',
key: 'waterQualityType', // }]
}, // },
{ // {
// title: ' ',
// dataIndex: 'riverName',
// key: 'riverName',
// children: [{
// title: '水质类别',
// dataIndex: 'waterQualityType',
// key: 'waterQualityType',
// }],
// }
, {
title: '主要水质指标月均值',
dataIndex: 'index',
key: 'index',
align:'center',
children: [{
title: '水温(℃)', title: '水温(℃)',
dataIndex: 'waterTemperature', dataIndex: 'waterTemperature',
key: 'waterTemperature', key: 'waterTemperature',
align:'center',
children: [{
title: '一',
dataIndex: 'riverName',
align: 'center',
}]
}, },
{ {
title: 'pH (无量纲)', title: 'pH (无量纲)',
dataIndex: 'ph', dataIndex: 'ph',
key: 'ph', key: 'ph',
align:'center',
children: [{
title: '6~9',
dataIndex: 'riverName',
align: 'center',
}]
}, },
{ {
title: '溶解氧(mg/L)', title: '溶解氧(mg/L)',
dataIndex: 'dissolvedOxygen', dataIndex: 'dissolvedOxygen',
key: 'dissolvedOxygen', key: 'dissolvedOxygen',
align:'center',
children: [{
title: '≥7.5',
align:'center',
children: [{
title: '≥6',
align:'center',
children: [{
title: '≥5',
align:'center',
children: [{
title: '≥3',
align:'center',
}],
}],
}],
}],
}, },
{ {
title: '高锰酸盐指数 (mg/L)', title: '高锰酸盐指数 (mg/L)',
dataIndex: 'permanganateIndex', dataIndex: 'permanganateIndex',
key: 'permanganateIndex', key: 'permanganateIndex',
children: [{
title: '≤2',
align:'center',
children: [{
title: '≤4',
align:'center',
children: [{
title: '≤6',
align:'center',
children: [{
title: '≤10',
align:'center',
}],
}],
}],
}],
}, },
{ {
title: '氨氮 (mg/L)', title: '氨氮 (mg/L)',
dataIndex: 'ammonia', dataIndex: 'ammonia',
key: 'ammonia', key: 'ammonia',
children: [{
title: '≤0.15',
align:'center',
children: [{
title: '≤0.5',
align:'center',
children: [{
title: '≤1.0',
align:'center',
children: [{
title: '≤1.5',
align:'center',
}],
}],
}],
}],
}, },
{ {
title: '总磷(mg/L)', title: '总磷(mg/L)',
dataIndex: 'totalPhosphorus', dataIndex: 'totalPhosphorus',
key: 'totalPhosphorus', key: 'totalPhosphorus',
children: [{
title: '≤0.02',
align:'center',
children: [{
title: '≤0.1',
align:'center',
children: [{
title: '≤0.2',
align:'center',
children: [{
title: '≤0.3',
align:'center',
}],
}],
}],
}],
}, },
{ {
title: '总氮(mg/L)', title: '总氮(mg/L)',
dataIndex: 'totalNitrogen', dataIndex: 'totalNitrogen',
key: 'totalNitrogen', key: 'totalNitrogen',
}, children: [{
title: '≤0.2',
children: [{
title: '≤0.5',
children: [{
title: '≤1.0',
children: [{
title: '≤1.5',
}],
}],
}],
}],
}
]
}
], ],
// 表格搜索条件 // 表格搜索条件
where: {}, where: {},
@@ -150,6 +285,7 @@
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
this.loading = true; this.loading = true;
this.datasource = {};
listWaterSiteMonthTotal(this.where).then((res) => { listWaterSiteMonthTotal(this.where).then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
this.$message.success(res.data.msg); this.$message.success(res.data.msg);

View File

@@ -120,6 +120,7 @@
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
this.loading=true; this.loading=true;
this.momData = [];
listMonthCompositeIndex(this.where).then((res) => { listMonthCompositeIndex(this.where).then((res) => {
console.log(res.data.data); console.log(res.data.data);
if (res.data.code == 0) { if (res.data.code == 0) {

View File

@@ -62,7 +62,6 @@
return { return {
data: [], data: [],
momData: [], momData: [],
yoyData: [],
datasource: {}, datasource: {},
columns: [{ columns: [{
title: '断面类型', title: '断面类型',
@@ -129,6 +128,7 @@
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
this.loading = true; this.loading = true;
this.momData = [];
listMonthWaterQualitySandard(this.where).then((res) => { listMonthWaterQualitySandard(this.where).then((res) => {
console.log(res.data.data); console.log(res.data.data);
if (res.data.code == 0) { if (res.data.code == 0) {

View File

@@ -59,7 +59,6 @@
return { return {
data: [], data: [],
momData: [], momData: [],
yoyData: [],
datasource: {}, datasource: {},
columns: [{ columns: [{
title: '断面名称', title: '断面名称',
@@ -124,6 +123,7 @@
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
this.loading = true; this.loading = true;
this.momData = [];
listMonthCompositeIndex(this.where).then((res) => { listMonthCompositeIndex(this.where).then((res) => {
console.log(res.data.data); console.log(res.data.data);
if (res.data.code == 0) { if (res.data.code == 0) {

View File

@@ -125,6 +125,7 @@
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
this.loading = true; this.loading = true;
this.momData = [];
listMonthWaterQualitySandard(this.where).then((res) => { listMonthWaterQualitySandard(this.where).then((res) => {
console.log(res.data.data); console.log(res.data.data);
if (res.data.code == 0) { if (res.data.code == 0) {

View File

@@ -78,7 +78,10 @@
}; };
}, },
mounted() { mounted() {
this.loading = true;
autonomyWaterFunctionTotal().then((res) => { autonomyWaterFunctionTotal().then((res) => {
if (res.data.code == 0) {
if (res.data.data != null) {
res.data.data.forEach((e) => { res.data.data.forEach((e) => {
e.wTemp = "-1"; e.wTemp = "-1";
e.ph = "-1"; e.ph = "-1";
@@ -113,6 +116,13 @@
e.lprlMajorOverStandardItemsMultiples = "-1"; e.lprlMajorOverStandardItemsMultiples = "-1";
}) })
this.datasource = res.data.data; this.datasource = res.data.data;
} else {
this.$message.success("未查询到数据");
}
} else {
this.$message.error(res.data.msg);
}
this.loading = false;
}); });
}, },
created() { created() {
@@ -131,6 +141,8 @@
reload() { reload() {
this.loading = true; this.loading = true;
autonomyWaterFunctionTotal().then((res) => { autonomyWaterFunctionTotal().then((res) => {
if (res.data.code == 0) {
if (res.data.data != null) {
res.data.data.forEach((e) => { res.data.data.forEach((e) => {
e.wTemp = "-1"; e.wTemp = "-1";
e.ph = "-1"; e.ph = "-1";
@@ -165,6 +177,12 @@
e.lprlMajorOverStandardItemsMultiples = "-1"; e.lprlMajorOverStandardItemsMultiples = "-1";
}) })
this.datasource = res.data.data; this.datasource = res.data.data;
} else {
this.$message.success("未查询到数据");
}
} else {
this.$message.error(res.data.msg);
}
this.loading = false; this.loading = false;
}); });
}, },

View File

@@ -111,6 +111,8 @@
mounted() { mounted() {
this.loading = true; this.loading = true;
nationalWaterFunctionTotal().then((res) => { nationalWaterFunctionTotal().then((res) => {
if (res.data.code == 0) {
if (res.data.data != null) {
res.data.data.forEach((e) => { res.data.data.forEach((e) => {
e.wTemp = "-1"; e.wTemp = "-1";
e.ph = "-1"; e.ph = "-1";
@@ -145,9 +147,16 @@
e.lprlMajorOverStandardItemsMultiples = "-1"; e.lprlMajorOverStandardItemsMultiples = "-1";
}) })
this.datasource = res.data.data; this.datasource = res.data.data;
} else {
this.$message.success("未查询到数据");
}
} else {
this.$message.error(res.data.msg);
}
this.loading = false; this.loading = false;
}); })
}, },
created() { created() {
listInfo().then((res) => { listInfo().then((res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
@@ -162,7 +171,10 @@
methods: { methods: {
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
nationalWaterFunctionTotal(this.where).then((res) => { this.loading = true;
nationalWaterFunctionTotal().then((res) => {
if (res.data.code == 0) {
if (res.data.data != null) {
res.data.data.forEach((e) => { res.data.data.forEach((e) => {
e.wTemp = "-1"; e.wTemp = "-1";
e.ph = "-1"; e.ph = "-1";
@@ -197,7 +209,14 @@
e.lprlMajorOverStandardItemsMultiples = "-1"; e.lprlMajorOverStandardItemsMultiples = "-1";
}) })
this.datasource = res.data.data; this.datasource = res.data.data;
}); } else {
this.$message.success("未查询到数据");
}
} else {
this.$message.error(res.data.msg);
}
this.loading = false;
})
}, },
/* 重置搜索 */ /* 重置搜索 */
reset() { reset() {