✨ 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
|
||||
m.sn,
|
||||
td.name,
|
||||
m.year,
|
||||
round(AVG(TO_NUMBER(m.avg_value)), 8) AS avg_value,
|
||||
p.dept_name,
|
||||
p.dept_name as "p",
|
||||
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
|
||||
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 pp on p.parent_id = pp.dept_id
|
||||
left join sys_dept ppp on pp.parent_id = ppp.dept_id
|
||||
|
@ -66,8 +69,8 @@
|
|||
<if test="year != null and year != ''">
|
||||
AND m.year = #{year}
|
||||
</if>
|
||||
GROUP BY m.sn, m.year, p.dept_name, pp.dept_name, ppp.dept_name
|
||||
ORDER BY ppp.dept_name, pp.dept_name, p.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_id
|
||||
</select>
|
||||
|
||||
<update
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<div style="display: flex; gap: 10px">
|
||||
<el-tag>港区数: {{ getChildCount(row, "ppp", "pp") }}</el-tag>
|
||||
<el-tag type="warning"
|
||||
>平均值: {{ calculateChildAvg(row, "ppp") }}</el-tag
|
||||
>平均值: {{ calculateChildAvg(row, "ppp") }} mg/m³</el-tag
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<div style="display: flex; gap: 10px">
|
||||
<el-tag>企业数: {{ getChildCount(row, "pp", "p") }}</el-tag>
|
||||
<el-tag type="warning"
|
||||
>平均值: {{ calculateChildAvg(row, "pp") }}</el-tag
|
||||
>平均值: {{ calculateChildAvg(row, "pp") }} mg/m³</el-tag
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -63,32 +63,17 @@
|
|||
<div style="display: flex; gap: 10px">
|
||||
<el-tag>设备数: {{ getChildCount(row, "p", "sn") }}</el-tag>
|
||||
<el-tag type="warning"
|
||||
>平均值: {{ calculateChildAvg(row, "p") }}</el-tag
|
||||
>平均值: {{ calculateChildAvg(row, "p") }} mg/m³</el-tag
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</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="avgValue" label="平均值">
|
||||
<!-- <template slot-scope="scope">
|
||||
<div @dblclick="changeAvgValue(scope.$index, scope.row)">
|
||||
<span v-show="!scope.row.enable_edit">{{
|
||||
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> -->
|
||||
<template slot-scope="{ row }">
|
||||
<div>{{ row.avgValue }} mg/m³</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <div class="page-ele">
|
||||
|
@ -114,8 +99,7 @@ import {
|
|||
getDeviceReportYearListAll,
|
||||
} from "@/api/statistics/yearData.js";
|
||||
import { dataToExcel } from "@/utils/excel.js";
|
||||
import to from '@/utils/await-to.js';
|
||||
|
||||
import to from "@/utils/await-to.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
@ -145,10 +129,18 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
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);
|
||||
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) {
|
||||
const childSet = new Set();
|
||||
|
@ -235,7 +227,12 @@ export default {
|
|||
})
|
||||
.then((res) => {
|
||||
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;
|
||||
}
|
||||
})
|
||||
|
@ -245,16 +242,18 @@ export default {
|
|||
},
|
||||
async handleExport() {
|
||||
const fileName = `${this.dept.deptName} ${this.year}年数据统计`;
|
||||
const [err, response] = await to(getDeviceReportYearListAll({
|
||||
deptId: this.dept.deptId,
|
||||
year: this.year,
|
||||
}));
|
||||
const [err, response] = await to(
|
||||
getDeviceReportYearListAll({
|
||||
deptId: this.dept.deptId,
|
||||
year: this.year,
|
||||
})
|
||||
);
|
||||
if (err) {
|
||||
console.error(err);
|
||||
this.$message.error("导出失败");
|
||||
return;
|
||||
}
|
||||
const {data} = response;
|
||||
const { data } = response;
|
||||
dataToExcel({
|
||||
data: [
|
||||
[fileName],
|
||||
|
|
Loading…
Reference in New Issue