fix(dms): 设备效率报表修复问题

- 新设备效率报表汇总增汇总输出数量计算逻辑
- 新增总工时汇总计算功能
- 添加平均运行率计算方法
- 添加整体
-效率平均值计算 使用computed属性优化数据计算性能- 增强数据处理的容错能力
master
zangch@mesnac.com 2 months ago
parent 5fdc7ac73e
commit 10852ebfb9

@ -252,6 +252,7 @@
<script setup name="DmsReportDeviceEfficiency" lang="ts">
import { listDmsReportDeviceEfficiency, getDmsReportDeviceEfficiency, delDmsReportDeviceEfficiency, addDmsReportDeviceEfficiency, updateDmsReportDeviceEfficiency } from '@/api/dms/dmsReportDeviceEfficiency';
import { DmsReportDeviceEfficiencyVO, DmsReportDeviceEfficiencyQuery, DmsReportDeviceEfficiencyForm } from '@/api/dms/dmsReportDeviceEfficiency/types';
import { computed } from 'vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -411,6 +412,53 @@ const data = reactive<PageData<DmsReportDeviceEfficiencyForm, DmsReportDeviceEff
const { queryParams, form, rules } = toRefs(data);
// KPI
const sumOutputQty = computed(() => {
try {
return dmsReportDeviceEfficiencyList.value.reduce((sum, r) => sum + Number(r?.outputQty ?? 0), 0);
} catch {
return 0;
}
});
const sumTotalHours = computed(() => {
try {
return dmsReportDeviceEfficiencyList.value.reduce((sum, r) => sum + Number(r?.totalHours ?? 0), 0);
} catch {
return 0;
}
});
const avgUptimeRate = computed(() => {
const rows = dmsReportDeviceEfficiencyList.value;
if (!rows.length) return 0;
let total = 0;
let count = 0;
for (const r of rows) {
const v = Number(r?.uptimeRate ?? 0);
if (!Number.isNaN(v)) {
total += v;
count += 1;
}
}
return count ? total / count : 0;
});
const avgOverallEfficiency = computed(() => {
const rows = dmsReportDeviceEfficiencyList.value;
if (!rows.length) return 0;
let total = 0;
let count = 0;
for (const r of rows) {
const v = Number(r?.overallEfficiency ?? 0);
if (!Number.isNaN(v)) {
total += v;
count += 1;
}
}
return count ? total / count : 0;
});
/** 查询设备效率报列表 */
const getList = async () => {
loading.value = true;

@ -60,10 +60,10 @@
v-hasPermi="['dms:dmsBaseMachineInfo:remove']">
删除设备
</el-button>
<el-button type="warning" icon="Download" @click="handleExport"
v-hasPermi="['dms:dmsBaseMachineInfo:export']">
导出数据
</el-button>
<!-- <el-button type="warning" icon="Download" @click="handleExport"-->
<!-- v-hasPermi="['dms:dmsBaseMachineInfo:export']">-->
<!-- 导出数据-->
<!-- </el-button>-->
<el-button text @click="showSearch = !showSearch">
<el-icon><Filter /></el-icon>
{{ showSearch ? '隐藏' : '显示' }}筛选

Loading…
Cancel
Save