统计代码优化

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-spin :spinning="loading">
<ele-pro-table ref="table" :datasource="datasource" :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
</ele-pro-table>
</a-spin>
<ele-pro-table ref="table" :datasource="datasource" bordered :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
</ele-pro-table>
</a-spin>
</a-card>
</div>
<!-- 编辑弹窗 -->
@@ -71,62 +71,197 @@
selection: [],
// tableColumns,
// 表格列配置
columns: [
{
title: '所在河流名称',
columns: [{
title: ' ',
dataIndex: 'riverName',
key: 'riverName',
align:'center',
children: [{
title: '所在河流名称',
dataIndex: 'riverName',
key: 'riverName',
children: [{
title: '一',
dataIndex: 'riverName',
align: 'center',
}],
}]
},
{
title: '自动站名称',
dataIndex: 'stationName',
key: 'stationName',
},
{
title: '水质考核目标',
dataIndex: 'waterTarget',
key: 'waterTarget',
},
{
title: '水质类别',
dataIndex: 'waterQualityType',
key: 'waterQualityType',
},
{
title: '水温(℃)',
dataIndex: 'waterTemperature',
key: 'waterTemperature',
},
{
title: 'pH (无量纲)',
dataIndex: 'ph',
key: 'ph',
},
{
title: '溶解氧(mg/L)',
dataIndex: 'dissolvedOxygen',
key: 'dissolvedOxygen',
},
{
title: '高锰酸盐指数 (mg/L)',
dataIndex: 'permanganateIndex',
key: 'permanganateIndex',
},
{
title: '氨氮 (mg/L)',
dataIndex: 'ammonia',
key: 'ammonia',
},
{
title: '总磷(mg/L)',
dataIndex: 'totalPhosphorus',
key: 'totalPhosphorus',
},
{
title: '总氮(mg/L)',
dataIndex: 'totalNitrogen',
key: 'totalNitrogen',
title: ' ',
dataIndex: 'riverName',
key: 'riverName',
children: [{
title: '自动站名称',
dataIndex: 'stationName',
align:'center',
key: 'stationName',
children: [{
title: '《地表水环境质量标准》一类水质标准',
children: [{
title: '《地表水环境质量标准》二类水质标准',
children: [{
title: '《地表水环境质量标准》三类水质标准',
children: [{
title: '《地表水环境质量标准》四类水质标准',
}],
}],
}],
}],
}]
},
// {
// title: ' ',
// dataIndex: 'riverName',
// key: 'riverName',
// children: [{
// title: '水质考核目标',
// dataIndex: 'waterTarget',
// key: 'waterTarget',
// }]
// },
// {
// title: ' ',
// dataIndex: 'riverName',
// key: 'riverName',
// children: [{
// title: '水质类别',
// dataIndex: 'waterQualityType',
// key: 'waterQualityType',
// }],
// }
, {
title: '主要水质指标月均值',
dataIndex: 'index',
key: 'index',
align:'center',
children: [{
title: '水温(℃)',
dataIndex: 'waterTemperature',
key: 'waterTemperature',
align:'center',
children: [{
title: '一',
dataIndex: 'riverName',
align: 'center',
}]
},
{
title: 'pH (无量纲)',
dataIndex: 'ph',
key: 'ph',
align:'center',
children: [{
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: {},
@@ -149,7 +284,8 @@
methods: {
/* 刷新表格 */
reload() {
this.loading = true;
this.loading = true;
this.datasource = {};
listWaterSiteMonthTotal(this.where).then((res) => {
if (res.data.code == 0) {
this.$message.success(res.data.msg);

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,10 +32,10 @@
</a-form>
<!-- 表格 -->
<a-spin :spinning="loading">
<ele-pro-table ref="table" :datasource="datasource" :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
</ele-pro-table>
</a-spin>
<ele-pro-table ref="table" :datasource="datasource" :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
</ele-pro-table>
</a-spin>
</a-card>
</div>
<!-- 编辑弹窗 -->
@@ -78,41 +78,51 @@
};
},
mounted() {
this.loading = true;
autonomyWaterFunctionTotal().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;
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;
});
},
created() {
@@ -130,43 +140,51 @@
/* 刷新表格 */
reload() {
this.loading = true;
autonomyWaterFunctionTotal().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;
this.loading = false;
});
autonomyWaterFunctionTotal().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() {

View File

@@ -32,10 +32,10 @@
</a-form>
<!-- 表格 -->
<a-spin :spinning="loading">
<ele-pro-table ref="table" :datasource="datasource" :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
</ele-pro-table>
</a-spin>
<ele-pro-table ref="table" :datasource="datasource" :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
</ele-pro-table>
</a-spin>
</a-card>
</div>
<!-- 编辑弹窗 -->
@@ -111,116 +111,135 @@
mounted() {
this.loading = true;
nationalWaterFunctionTotal().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;
this.loading = false;
});
},
created() {
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() {
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";
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;
})
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);
this.$util.exportSheet(XLSX, sheet, new Date().getTime().toString());
}
created() {
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>