统计代码优化

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,10 +36,10 @@
</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>
</a-card> </a-card>
</div> </div>
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
@@ -71,62 +71,197 @@
selection: [], selection: [],
// tableColumns, // tableColumns,
// 表格列配置 // 表格列配置
columns: [ columns: [{
{ title: ' ',
title: '所在河流名称',
dataIndex: 'riverName', dataIndex: 'riverName',
key: 'riverName', key: 'riverName',
align:'center',
children: [{
title: '所在河流名称',
dataIndex: 'riverName',
key: 'riverName',
children: [{
title: '一',
dataIndex: 'riverName',
align: 'center',
}],
}]
}, },
{ {
title: '自动站名称', title: ' ',
dataIndex: 'stationName', dataIndex: 'riverName',
key: 'stationName', key: 'riverName',
children: [{
title: '自动站名称',
dataIndex: 'stationName',
align:'center',
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: '水温(℃)', // title: ' ',
dataIndex: 'waterTemperature', // dataIndex: 'riverName',
key: 'waterTemperature', // key: 'riverName',
}, // children: [{
{ // title: '水质类别',
title: 'pH (无量纲)', // dataIndex: 'waterQualityType',
dataIndex: 'ph', // key: 'waterQualityType',
key: 'ph', // }],
}, // }
{ , {
title: '溶解氧(mg/L)',
dataIndex: 'dissolvedOxygen', title: '主要水质指标月均值',
key: 'dissolvedOxygen', dataIndex: 'index',
}, key: 'index',
{ align:'center',
title: '高锰酸盐指数 (mg/L)', children: [{
dataIndex: 'permanganateIndex', title: '水温(℃)',
key: 'permanganateIndex', dataIndex: 'waterTemperature',
}, key: 'waterTemperature',
{ align:'center',
title: '氨氮 (mg/L)', children: [{
dataIndex: 'ammonia', title: '一',
key: 'ammonia', dataIndex: 'riverName',
}, align: 'center',
{ }]
title: '总磷(mg/L)', },
dataIndex: 'totalPhosphorus', {
key: 'totalPhosphorus', title: 'pH (无量纲)',
}, dataIndex: 'ph',
{ key: 'ph',
title: '总氮(mg/L)', align:'center',
dataIndex: 'totalNitrogen', children: [{
key: 'totalNitrogen', title: '6~9',
}, dataIndex: 'riverName',
align: 'center',
}]
},
{
title: '溶解氧(mg/L)',
dataIndex: '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)',
dataIndex: '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)',
dataIndex: '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)',
dataIndex: '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)',
dataIndex: 'totalNitrogen',
key: 'totalNitrogen',
children: [{
title: '≤0.2',
children: [{
title: '≤0.5',
children: [{
title: '≤1.0',
children: [{
title: '≤1.5',
}],
}],
}],
}],
}
]
}
], ],
// 表格搜索条件 // 表格搜索条件
where: {}, where: {},
@@ -149,7 +284,8 @@
methods: { methods: {
/* 刷新表格 */ /* 刷新表格 */
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

@@ -32,10 +32,10 @@
</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" :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>
</a-card> </a-card>
</div> </div>
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
@@ -78,41 +78,51 @@
}; };
}, },
mounted() { mounted() {
this.loading = true;
autonomyWaterFunctionTotal().then((res) => { autonomyWaterFunctionTotal().then((res) => {
res.data.data.forEach((e) => { if (res.data.code == 0) {
e.wTemp = "-1"; if (res.data.data != null) {
e.ph = "-1"; res.data.data.forEach((e) => {
e.dissolvedOxygen = "-1"; e.wTemp = "-1";
e.cod = "-1"; e.ph = "-1";
e.fiveDayBod = "-1"; e.dissolvedOxygen = "-1";
e.ammonia = "-1"; e.cod = "-1";
e.cu = "-1"; e.fiveDayBod = "-1";
e.zn = "-1"; e.ammonia = "-1";
e.f = "-1"; e.cu = "-1";
e.se = "-1"; e.zn = "-1";
e.as = "-1"; e.f = "-1";
e.hg = "-1"; e.se = "-1";
e.cd = "-1"; e.as = "-1";
e.cr6 = "-1"; e.hg = "-1";
e.pb = "-1"; e.cd = "-1";
e.cyanide = "-1"; e.cr6 = "-1";
e.vPhen = "-1"; e.pb = "-1";
e.oils = "-1"; e.cyanide = "-1";
e.anSaa = "-1"; e.vPhen = "-1";
e.s = "-1"; e.oils = "-1";
e.coloOrg = "-1"; e.anSaa = "-1";
e.so4 = "-1"; e.s = "-1";
e.cl = "-1"; e.coloOrg = "-1";
e.nitrateNitrogen = "-1"; e.so4 = "-1";
e.fe = "-1"; e.cl = "-1";
e.mn = "-1"; e.nitrateNitrogen = "-1";
e.nTotal = "-1"; e.fe = "-1";
e.transp = "-1"; e.mn = "-1";
e.chla = "-1"; e.nTotal = "-1";
e.ffeMajorOverStandardItemsMultiples = "-1"; e.transp = "-1";
e.lprlMajorOverStandardItemsMultiples = "-1"; e.chla = "-1";
}) e.ffeMajorOverStandardItemsMultiples = "-1";
this.datasource = res.data.data; e.lprlMajorOverStandardItemsMultiples = "-1";
})
this.datasource = res.data.data;
} else {
this.$message.success("未查询到数据");
}
} else {
this.$message.error(res.data.msg);
}
this.loading = false;
}); });
}, },
created() { created() {
@@ -130,43 +140,51 @@
/* 刷新表格 */ /* 刷新表格 */
reload() { reload() {
this.loading = true; this.loading = true;
autonomyWaterFunctionTotal().then((res) => { autonomyWaterFunctionTotal().then((res) => {
res.data.data.forEach((e) => { if (res.data.code == 0) {
e.wTemp = "-1"; if (res.data.data != null) {
e.ph = "-1"; res.data.data.forEach((e) => {
e.dissolvedOxygen = "-1"; e.wTemp = "-1";
e.cod = "-1"; e.ph = "-1";
e.fiveDayBod = "-1"; e.dissolvedOxygen = "-1";
e.ammonia = "-1"; e.cod = "-1";
e.cu = "-1"; e.fiveDayBod = "-1";
e.zn = "-1"; e.ammonia = "-1";
e.f = "-1"; e.cu = "-1";
e.se = "-1"; e.zn = "-1";
e.as = "-1"; e.f = "-1";
e.hg = "-1"; e.se = "-1";
e.cd = "-1"; e.as = "-1";
e.cr6 = "-1"; e.hg = "-1";
e.pb = "-1"; e.cd = "-1";
e.cyanide = "-1"; e.cr6 = "-1";
e.vPhen = "-1"; e.pb = "-1";
e.oils = "-1"; e.cyanide = "-1";
e.anSaa = "-1"; e.vPhen = "-1";
e.s = "-1"; e.oils = "-1";
e.coloOrg = "-1"; e.anSaa = "-1";
e.so4 = "-1"; e.s = "-1";
e.cl = "-1"; e.coloOrg = "-1";
e.nitrateNitrogen = "-1"; e.so4 = "-1";
e.fe = "-1"; e.cl = "-1";
e.mn = "-1"; e.nitrateNitrogen = "-1";
e.nTotal = "-1"; e.fe = "-1";
e.transp = "-1"; e.mn = "-1";
e.chla = "-1"; e.nTotal = "-1";
e.ffeMajorOverStandardItemsMultiples = "-1"; e.transp = "-1";
e.lprlMajorOverStandardItemsMultiples = "-1"; e.chla = "-1";
}) e.ffeMajorOverStandardItemsMultiples = "-1";
this.datasource = res.data.data; e.lprlMajorOverStandardItemsMultiples = "-1";
this.loading = false; })
}); this.datasource = res.data.data;
} else {
this.$message.success("未查询到数据");
}
} else {
this.$message.error(res.data.msg);
}
this.loading = false;
});
}, },
/* 重置搜索 */ /* 重置搜索 */
reset() { reset() {

View File

@@ -32,10 +32,10 @@
</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" :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>
</a-card> </a-card>
</div> </div>
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
@@ -111,116 +111,135 @@
mounted() { mounted() {
this.loading = true; this.loading = true;
nationalWaterFunctionTotal().then((res) => { nationalWaterFunctionTotal().then((res) => {
res.data.data.forEach((e) => { if (res.data.code == 0) {
e.wTemp = "-1"; if (res.data.data != null) {
e.ph = "-1"; res.data.data.forEach((e) => {
e.dissolvedOxygen = "-1"; e.wTemp = "-1";
e.cod = "-1"; e.ph = "-1";
e.fiveDayBod = "-1"; e.dissolvedOxygen = "-1";
e.ammonia = "-1"; e.cod = "-1";
e.cu = "-1"; e.fiveDayBod = "-1";
e.zn = "-1"; e.ammonia = "-1";
e.f = "-1"; e.cu = "-1";
e.se = "-1"; e.zn = "-1";
e.as = "-1"; e.f = "-1";
e.hg = "-1"; e.se = "-1";
e.cd = "-1"; e.as = "-1";
e.cr6 = "-1"; e.hg = "-1";
e.pb = "-1"; e.cd = "-1";
e.cyanide = "-1"; e.cr6 = "-1";
e.vPhen = "-1"; e.pb = "-1";
e.oils = "-1"; e.cyanide = "-1";
e.anSaa = "-1"; e.vPhen = "-1";
e.s = "-1"; e.oils = "-1";
e.coloOrg = "-1"; e.anSaa = "-1";
e.so4 = "-1"; e.s = "-1";
e.cl = "-1"; e.coloOrg = "-1";
e.nitrateNitrogen = "-1"; e.so4 = "-1";
e.fe = "-1"; e.cl = "-1";
e.mn = "-1"; e.nitrateNitrogen = "-1";
e.nTotal = "-1"; e.fe = "-1";
e.transp = "-1"; e.mn = "-1";
e.chla = "-1"; e.nTotal = "-1";
e.ffeMajorOverStandardItemsMultiples = "-1"; e.transp = "-1";
e.lprlMajorOverStandardItemsMultiples = "-1"; e.chla = "-1";
}) e.ffeMajorOverStandardItemsMultiples = "-1";
this.datasource = res.data.data; e.lprlMajorOverStandardItemsMultiples = "-1";
this.loading = false; })
}); this.datasource = res.data.data;
}, } else {
created() { this.$message.success("未查询到数据");
listInfo().then((res) => { }
if (res.data.code == 0) { } else {
console.log(res.data.data) this.$message.error(res.data.msg);
this.visibleWater = true; }
this.sectionInfo = res.data.data this.loading = false;
} else {
this.$message.error(res.data.msg);
}
})
},
methods: {
/* 刷新表格 */
reload() {
nationalWaterFunctionTotal(this.where).then((res) => {
res.data.data.forEach((e) => {
e.wTemp = "-1";
e.ph = "-1";
e.dissolvedOxygen = "-1";
e.cod = "-1";
e.fiveDayBod = "-1";
e.ammonia = "-1";
e.cu = "-1";
e.zn = "-1";
e.f = "-1";
e.se = "-1";
e.as = "-1";
e.hg = "-1";
e.cd = "-1";
e.cr6 = "-1";
e.pb = "-1";
e.cyanide = "-1";
e.vPhen = "-1";
e.oils = "-1";
e.anSaa = "-1";
e.s = "-1";
e.coloOrg = "-1";
e.so4 = "-1";
e.cl = "-1";
e.nitrateNitrogen = "-1";
e.fe = "-1";
e.mn = "-1";
e.nTotal = "-1";
e.transp = "-1";
e.chla = "-1";
e.ffeMajorOverStandardItemsMultiples = "-1";
e.lprlMajorOverStandardItemsMultiples = "-1";
}) })
this.datasource = res.data.data; },
});
},
/* 重置搜索 */
reset() {
this.where = {};
this.reload();
},
/* 导出 */
exportFile() {
const columns = this.columns.filter(item => item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = columns.map((item) => d[item.dataIndex]);
arr.push(td);
});
let sheet = XLSX.utils.aoa_to_sheet(arr); created() {
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString()); listInfo().then((res) => {
} if (res.data.code == 0) {
console.log(res.data.data)
this.visibleWater = true;
this.sectionInfo = res.data.data
} else {
this.$message.error(res.data.msg);
}
})
},
methods: {
/* 刷新表格 */
reload() {
this.loading = true;
nationalWaterFunctionTotal().then((res) => {
if (res.data.code == 0) {
if (res.data.data != null) {
res.data.data.forEach((e) => {
e.wTemp = "-1";
e.ph = "-1";
e.dissolvedOxygen = "-1";
e.cod = "-1";
e.fiveDayBod = "-1";
e.ammonia = "-1";
e.cu = "-1";
e.zn = "-1";
e.f = "-1";
e.se = "-1";
e.as = "-1";
e.hg = "-1";
e.cd = "-1";
e.cr6 = "-1";
e.pb = "-1";
e.cyanide = "-1";
e.vPhen = "-1";
e.oils = "-1";
e.anSaa = "-1";
e.s = "-1";
e.coloOrg = "-1";
e.so4 = "-1";
e.cl = "-1";
e.nitrateNitrogen = "-1";
e.fe = "-1";
e.mn = "-1";
e.nTotal = "-1";
e.transp = "-1";
e.chla = "-1";
e.ffeMajorOverStandardItemsMultiples = "-1";
e.lprlMajorOverStandardItemsMultiples = "-1";
})
this.datasource = res.data.data;
} else {
this.$message.success("未查询到数据");
}
} else {
this.$message.error(res.data.msg);
}
this.loading = false;
})
},
/* 重置搜索 */
reset() {
this.where = {};
this.reload();
},
/* 导出 */
exportFile() {
const columns = this.columns.filter(item => item.dataIndex);
const arr = [];
const th = columns.map((item) => item.title);
arr.push(th);
this.data.forEach((d) => {
const td = 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> </script>