|
|
|
|
@ -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;
|
|
|
|
|
|