✨ feat: 年度数据显示顺序,名称,单位
(1)港口按顺序排序(青岛港、日照港、烟台港、渤海湾港) (2)设备编号字段改成 设备名称(name) (3)单位
This commit is contained in:
parent
73f15098f0
commit
54602a8a8d
|
@ -48,13 +48,16 @@
|
||||||
<select id="selectThDeviceReportYearList" parameterType="map" resultType="map">
|
<select id="selectThDeviceReportYearList" parameterType="map" resultType="map">
|
||||||
select
|
select
|
||||||
m.sn,
|
m.sn,
|
||||||
|
td.name,
|
||||||
m.year,
|
m.year,
|
||||||
round(AVG(TO_NUMBER(m.avg_value)), 8) AS avg_value,
|
round(AVG(TO_NUMBER(m.avg_value)), 8) AS avg_value,
|
||||||
p.dept_name,
|
p.dept_name,
|
||||||
p.dept_name as "p",
|
p.dept_name as "p",
|
||||||
pp.dept_name as "pp",
|
pp.dept_name as "pp",
|
||||||
ppp.dept_name as "ppp"
|
ppp.dept_name as "ppp",
|
||||||
|
ppp.dept_id as "ppp_id"
|
||||||
from th_device_report_month1 m
|
from th_device_report_month1 m
|
||||||
|
LEFT JOIN th_device td ON m.sn = td.sn
|
||||||
left join sys_dept p on m.dept_id = p.dept_id
|
left join sys_dept p on m.dept_id = p.dept_id
|
||||||
left join sys_dept pp on p.parent_id = pp.dept_id
|
left join sys_dept pp on p.parent_id = pp.dept_id
|
||||||
left join sys_dept ppp on pp.parent_id = ppp.dept_id
|
left join sys_dept ppp on pp.parent_id = ppp.dept_id
|
||||||
|
@ -66,8 +69,8 @@
|
||||||
<if test="year != null and year != ''">
|
<if test="year != null and year != ''">
|
||||||
AND m.year = #{year}
|
AND m.year = #{year}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY m.sn, m.year, p.dept_name, pp.dept_name, ppp.dept_name
|
GROUP BY m.sn, td.name, m.year, p.dept_name, pp.dept_name, ppp.dept_name, ppp.dept_id
|
||||||
ORDER BY ppp.dept_name, pp.dept_name, p.dept_name
|
ORDER BY ppp.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update
|
<update
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<div style="display: flex; gap: 10px">
|
<div style="display: flex; gap: 10px">
|
||||||
<el-tag>港区数: {{ getChildCount(row, "ppp", "pp") }}</el-tag>
|
<el-tag>港区数: {{ getChildCount(row, "ppp", "pp") }}</el-tag>
|
||||||
<el-tag type="warning"
|
<el-tag type="warning"
|
||||||
>平均值: {{ calculateChildAvg(row, "ppp") }}</el-tag
|
>平均值: {{ calculateChildAvg(row, "ppp") }} mg/m³</el-tag
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<div style="display: flex; gap: 10px">
|
<div style="display: flex; gap: 10px">
|
||||||
<el-tag>企业数: {{ getChildCount(row, "pp", "p") }}</el-tag>
|
<el-tag>企业数: {{ getChildCount(row, "pp", "p") }}</el-tag>
|
||||||
<el-tag type="warning"
|
<el-tag type="warning"
|
||||||
>平均值: {{ calculateChildAvg(row, "pp") }}</el-tag
|
>平均值: {{ calculateChildAvg(row, "pp") }} mg/m³</el-tag
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -63,32 +63,17 @@
|
||||||
<div style="display: flex; gap: 10px">
|
<div style="display: flex; gap: 10px">
|
||||||
<el-tag>设备数: {{ getChildCount(row, "p", "sn") }}</el-tag>
|
<el-tag>设备数: {{ getChildCount(row, "p", "sn") }}</el-tag>
|
||||||
<el-tag type="warning"
|
<el-tag type="warning"
|
||||||
>平均值: {{ calculateChildAvg(row, "p") }}</el-tag
|
>平均值: {{ calculateChildAvg(row, "p") }} mg/m³</el-tag
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="sn" label="设备编码" />
|
<el-table-column prop="name" label="设备名称" />
|
||||||
<!-- <el-table-column prop="year" label="年份" /> -->
|
<!-- <el-table-column prop="year" label="年份" /> -->
|
||||||
<el-table-column prop="avgValue" label="平均值">
|
<el-table-column prop="avgValue" label="平均值">
|
||||||
<!-- <template slot-scope="scope">
|
<template slot-scope="{ row }">
|
||||||
<div @dblclick="changeAvgValue(scope.$index, scope.row)">
|
<div>{{ row.avgValue }} mg/m³</div>
|
||||||
<span v-show="!scope.row.enable_edit">{{
|
</template>
|
||||||
scope.row.avgValue
|
|
||||||
}}</span>
|
|
||||||
|
|
||||||
<el-input
|
|
||||||
:ref="'changeAvgValue' + scope.$index"
|
|
||||||
@blur="changeAvgValueBlur(scope.$index, scope.row)"
|
|
||||||
@keyup.enter.native="$event.target.blur"
|
|
||||||
clearable
|
|
||||||
v-show="scope.row.enable_edit"
|
|
||||||
size="mini"
|
|
||||||
v-model="scope.row.avgValue"
|
|
||||||
placeholder="请输入内容"
|
|
||||||
></el-input>
|
|
||||||
</div>
|
|
||||||
</template> -->
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- <div class="page-ele">
|
<!-- <div class="page-ele">
|
||||||
|
@ -114,8 +99,7 @@ import {
|
||||||
getDeviceReportYearListAll,
|
getDeviceReportYearListAll,
|
||||||
} from "@/api/statistics/yearData.js";
|
} from "@/api/statistics/yearData.js";
|
||||||
import { dataToExcel } from "@/utils/excel.js";
|
import { dataToExcel } from "@/utils/excel.js";
|
||||||
import to from '@/utils/await-to.js';
|
import to from "@/utils/await-to.js";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -145,10 +129,18 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
tableRowClassName({ row, rowIndex }) {
|
tableRowClassName({ row, rowIndex }) {
|
||||||
const classNames = ["default-row", "success-row", "error-row", "warning-row", "info-row"];
|
const classNames = [
|
||||||
|
"default-row",
|
||||||
|
"success-row",
|
||||||
|
"error-row",
|
||||||
|
"warning-row",
|
||||||
|
"info-row",
|
||||||
|
];
|
||||||
const index = this.pppList.findIndex((item) => item === row.ppp);
|
const index = this.pppList.findIndex((item) => item === row.ppp);
|
||||||
if (index === -1) return "info-row";
|
if (index === -1) return "info-row";
|
||||||
return index > classNames.length - 1 ? classNames[index % classNames.length] : classNames[index];
|
return index > classNames.length - 1
|
||||||
|
? classNames[index % classNames.length]
|
||||||
|
: classNames[index];
|
||||||
},
|
},
|
||||||
getChildCount(row, key, childKey) {
|
getChildCount(row, key, childKey) {
|
||||||
const childSet = new Set();
|
const childSet = new Set();
|
||||||
|
@ -235,7 +227,12 @@ export default {
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.tableData = res.data;
|
this.tableData = res.data.map((item) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
avgValue: parseFloat(item.avgValue.toFixed(2)),
|
||||||
|
};
|
||||||
|
});
|
||||||
// this.total = res.total;
|
// this.total = res.total;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -245,16 +242,18 @@ export default {
|
||||||
},
|
},
|
||||||
async handleExport() {
|
async handleExport() {
|
||||||
const fileName = `${this.dept.deptName} ${this.year}年数据统计`;
|
const fileName = `${this.dept.deptName} ${this.year}年数据统计`;
|
||||||
const [err, response] = await to(getDeviceReportYearListAll({
|
const [err, response] = await to(
|
||||||
|
getDeviceReportYearListAll({
|
||||||
deptId: this.dept.deptId,
|
deptId: this.dept.deptId,
|
||||||
year: this.year,
|
year: this.year,
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.$message.error("导出失败");
|
this.$message.error("导出失败");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const {data} = response;
|
const { data } = response;
|
||||||
dataToExcel({
|
dataToExcel({
|
||||||
data: [
|
data: [
|
||||||
[fileName],
|
[fileName],
|
||||||
|
|
Loading…
Reference in New Issue