|
@@ -1287,7 +1287,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
...basic,
|
|
...basic,
|
|
|
xAxis: { type: "category", data: mo.value.months || [] },
|
|
xAxis: { type: "category", data: mo.value.months || [] },
|
|
|
series: [{ type: "bar", data: perDay.value.map((v) => v == null ? null : Math.round(v * 100) / 100), itemStyle: { color: "#0b5fa5" } }],
|
|
series: [{ type: "bar", data: perDay.value.map((v) => v == null ? null : Math.round(v * 100) / 100), itemStyle: { color: "#0b5fa5" } }],
|
|
|
- __data__: perDay.value.filter((v) => v != null).map((v) => Math.round(v * 100) / 100)
|
|
|
|
|
|
|
+ __data__: perDay.value.filter((v) => v != null)
|
|
|
}));
|
|
}));
|
|
|
function pareto(items) {
|
|
function pareto(items) {
|
|
|
const it = (items || []).filter((x) => x && x.v > 0);
|
|
const it = (items || []).filter((x) => x && x.v > 0);
|
|
@@ -1298,6 +1298,29 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
__data__: it.map((x) => x.v)
|
|
__data__: it.map((x) => x.v)
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
+ const shortK = (k) => {
|
|
|
|
|
+ const m = String(k).match(/^([0-9]+)/);
|
|
|
|
|
+ return m ? m[1] : String(k).slice(0, 4);
|
|
|
|
|
+ };
|
|
|
|
|
+ const esc = (s) => String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
|
|
|
+ function paretoSummaryHtml(items, unit, note) {
|
|
|
|
|
+ const it = (items || []).filter((x) => x && x.v > 0);
|
|
|
|
|
+ if (!it.length) return esc(t("ch.pareto.none"));
|
|
|
|
|
+ const tot = it.reduce((a, x) => a + x.v, 0);
|
|
|
|
|
+ let cum = 0;
|
|
|
|
|
+ let k80 = null;
|
|
|
|
|
+ for (let i = 0; i < it.length; i++) {
|
|
|
|
|
+ cum += it[i].v;
|
|
|
|
|
+ if (k80 === null && tot && cum / tot >= 0.8) k80 = i + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ const top3 = it.slice(0, 3).map((x) => `<b>${esc(shortK(x.k))}</b> ${esc(String(x.k).replace(/^[0-9]+ */, "").slice(0, 18))}`).join(" · ");
|
|
|
|
|
+ const total = t("ch.pareto.total", { n: it.length, tot: fmt(Math.round(tot)), unit });
|
|
|
|
|
+ const head = k80 ? `<b>${esc(t("ch.pareto.key", { k: k80 }))}</b> (${esc(total)})` : esc(total);
|
|
|
|
|
+ return head + "<br>" + esc(t("ch.pareto.top3")) + top3 + (note ? "<br>" + esc(note) : "");
|
|
|
|
|
+ }
|
|
|
|
|
+ const paretoNSummary = computed(() => paretoSummaryHtml(F.value.pareto_n || [], t("unit.n"), t("flt.pareto_n_note")));
|
|
|
|
|
+ const paretoDSummary = computed(() => paretoSummaryHtml(F.value.pareto_d || [], " h", t("flt.pareto_d_note")));
|
|
|
|
|
+ const stopParetoSummary = computed(() => paretoSummaryHtml(stopPareto.value, " h", t("flt.stop_pareto_note")));
|
|
|
const paretoNOption = computed(() => pareto(F.value.pareto_n || []));
|
|
const paretoNOption = computed(() => pareto(F.value.pareto_n || []));
|
|
|
const paretoDOption = computed(() => pareto(F.value.pareto_d || []));
|
|
const paretoDOption = computed(() => pareto(F.value.pareto_d || []));
|
|
|
function k80Of(items) {
|
|
function k80Of(items) {
|
|
@@ -1311,8 +1334,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
}
|
|
}
|
|
|
return { k: String(it[it.length - 1].k), n: it.length, tot };
|
|
return { k: String(it[it.length - 1].k), n: it.length, tot };
|
|
|
}
|
|
}
|
|
|
- const k80N = computed(() => k80Of(F.value.pareto_n || []));
|
|
|
|
|
- const k80D = computed(() => k80Of(F.value.pareto_d || []));
|
|
|
|
|
|
|
+ computed(() => k80Of(F.value.pareto_n || []));
|
|
|
|
|
+ computed(() => k80Of(F.value.pareto_d || []));
|
|
|
const quadOption = computed(() => {
|
|
const quadOption = computed(() => {
|
|
|
const it = (F.value.quad || []).filter((x) => x && x.n > 0 && x.med > 0);
|
|
const it = (F.value.quad || []).filter((x) => x && x.n > 0 && x.med > 0);
|
|
|
return {
|
|
return {
|
|
@@ -1325,7 +1348,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
symbolSize: (v) => Math.min(28, 6 + Math.sqrt(Math.max(v[0] || 1, 1))),
|
|
symbolSize: (v) => Math.min(28, 6 + Math.sqrt(Math.max(v[0] || 1, 1))),
|
|
|
itemStyle: { color: "#b42318", opacity: 0.6 }
|
|
itemStyle: { color: "#b42318", opacity: 0.6 }
|
|
|
}],
|
|
}],
|
|
|
- __data__: it.flatMap((x) => [x.mtbf ?? x.n, x.med].map((v) => Math.round(v)))
|
|
|
|
|
|
|
+ __data__: it.flatMap((x) => [x.mtbf ?? x.n, x.med])
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
const pt = computed(() => F.value.per_t || []);
|
|
const pt = computed(() => F.value.per_t || []);
|
|
@@ -1339,30 +1362,41 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
xAxis: { type: "category", data: months },
|
|
xAxis: { type: "category", data: months },
|
|
|
legend: { top: 0, textStyle: { fontSize: 10 } },
|
|
legend: { top: 0, textStyle: { fontSize: 10 } },
|
|
|
series: s.map((x) => ({ name: String(x.name).slice(0, 16), type: "line", data: x.vals, connectNulls: false })),
|
|
series: s.map((x) => ({ name: String(x.name).slice(0, 16), type: "line", data: x.vals, connectNulls: false })),
|
|
|
- __data__: s.flatMap((x) => (x.vals || []).filter((v) => v != null).map((v) => Math.round(v)))
|
|
|
|
|
|
|
+ __data__: s.flatMap((x) => (x.vals || []).filter((v) => v != null))
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
const RT = computed(() => props.d?.rel && !props.d.rel.err ? props.d.rel : null);
|
|
const RT = computed(() => props.d?.rel && !props.d.rel.err ? props.d.rel : null);
|
|
|
const ramOption = computed(() => {
|
|
const ramOption = computed(() => {
|
|
|
const rows = RT.value?.表 || [];
|
|
const rows = RT.value?.表 || [];
|
|
|
return {
|
|
return {
|
|
|
- grid: { left: 90, right: 24, top: 24, bottom: 40 },
|
|
|
|
|
- xAxis: { type: "value", name: "h" },
|
|
|
|
|
- yAxis: { type: "category", data: rows.map((r) => partName(r.部件)) },
|
|
|
|
|
- series: [{ type: "bar", data: rows.map((r) => r.停机时长h), itemStyle: { color: "#2f7dbf" } }],
|
|
|
|
|
- __data__: rows.map((r) => Math.round(r.停机时长h))
|
|
|
|
|
|
|
+ grid: { left: 60, right: 24, top: 24, bottom: 40 },
|
|
|
|
|
+ xAxis: { type: "value", name: "MTBF(h)" },
|
|
|
|
|
+ yAxis: { type: "value", name: "MDT(h)" },
|
|
|
|
|
+ series: [{
|
|
|
|
|
+ type: "scatter",
|
|
|
|
|
+ data: rows.filter((r) => !r.外部 && r.MTBF_h).map((r) => [r.MTBF_h, r.MDT_h]),
|
|
|
|
|
+ symbolSize: 8,
|
|
|
|
|
+ itemStyle: { color: "#2f7dbf", opacity: 0.5 }
|
|
|
|
|
+ }],
|
|
|
|
|
+ // 旧 ramChart 是 MTBF×MDT 散点(坐标即数据)⇒ 给这两列的原值
|
|
|
|
|
+ __data__: rows.filter((r) => !r.外部 && r.MTBF_h).flatMap((r) => [r.MTBF_h, r.MDT_h])
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
- const attribOption = computed(() => {
|
|
|
|
|
|
|
+ const attribGroups = computed(() => {
|
|
|
const rows = RT.value?.表 || [];
|
|
const rows = RT.value?.表 || [];
|
|
|
- const dev = rows.filter((r) => !r.外部 && r.部件 !== "无记录停机").reduce((a, r) => a + r.停机时长h, 0);
|
|
|
|
|
- const ext = rows.filter((r) => r.外部).reduce((a, r) => a + r.停机时长h, 0);
|
|
|
|
|
- const nore = rows.filter((r) => r.部件 === "无记录停机").reduce((a, r) => a + r.停机时长h, 0);
|
|
|
|
|
|
|
+ const unk = (rows.find((r) => r.部件 === "无记录停机") || {}).停机时长h || 0;
|
|
|
|
|
+ const un2 = rows.filter((r) => r.部件 === "未归类").reduce((a, r) => a + r.停机时长h, 0);
|
|
|
|
|
+ const tot = RT.value?.总停机h || 0;
|
|
|
|
|
+ const ok = tot - unk - un2;
|
|
|
|
|
+ return { ok, unk, un2 };
|
|
|
|
|
+ });
|
|
|
|
|
+ const attribOption = computed(() => {
|
|
|
|
|
+ const g = attribGroups.value;
|
|
|
return {
|
|
return {
|
|
|
xAxis: { type: "value" },
|
|
xAxis: { type: "value" },
|
|
|
- yAxis: { type: "category", data: [t("flt.attr_dev"), t("flt.attr_ext"), t("flt.attr_nore")] },
|
|
|
|
|
- series: [{ type: "bar", data: [Math.round(dev), Math.round(ext), Math.round(nore)], itemStyle: { color: "#0b5fa5" } }],
|
|
|
|
|
- __data__: [Math.round(dev), Math.round(ext), Math.round(nore)]
|
|
|
|
|
|
|
+ yAxis: { type: "category", data: [t("ch.attrib.ok", { h: Math.round(g.ok), p: "" }), t("ch.attrib.none", { h: Math.round(g.unk), p: "" }), t("ch.attrib.uncls", { h: Math.round(g.un2) })] },
|
|
|
|
|
+ series: [{ type: "bar", data: [Math.round(g.ok), Math.round(g.unk), Math.round(g.un2)], itemStyle: { color: "#0b5fa5" } }],
|
|
|
|
|
+ __data__: [Math.round(g.ok), Math.round(g.unk), Math.round(g.un2)]
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
const stopPareto = computed(() => (props.d?.m8?.stop_pareto || []).map((x) => ({
|
|
const stopPareto = computed(() => (props.d?.m8?.stop_pareto || []).map((x) => ({
|
|
@@ -1389,22 +1423,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
option: paretoNOption.value,
|
|
option: paretoNOption.value,
|
|
|
height: "240px"
|
|
height: "240px"
|
|
|
}, null, _parent));
|
|
}, null, _parent));
|
|
|
- if (k80N.value) {
|
|
|
|
|
- _push(`<p class="small muted" style="${ssrRenderStyle({ "margin-top": "5px", "line-height": "1.6" })}"><b>${ssrInterpolate(unref(t)("ch.pareto.key", { k: k80N.value.k }))}</b> (${ssrInterpolate(unref(t)("ch.pareto.total", { n: k80N.value.n, tot: unref(fmt)(Math.round(k80N.value.tot)), unit: unref(t)("unit.n") }))})</p>`);
|
|
|
|
|
- } else {
|
|
|
|
|
- _push(`<!---->`);
|
|
|
|
|
- }
|
|
|
|
|
- _push(`</div><div class="panel"><h3>${ssrInterpolate(unref(t)("flt.pareto_d"))}</h3>`);
|
|
|
|
|
|
|
+ _push(`<p class="small muted" style="${ssrRenderStyle({ "margin-top": "5px", "line-height": "1.6" })}">${paretoNSummary.value ?? ""}</p></div><div class="panel"><h3>${ssrInterpolate(unref(t)("flt.pareto_d"))}</h3>`);
|
|
|
_push(ssrRenderComponent(EChart, {
|
|
_push(ssrRenderComponent(EChart, {
|
|
|
option: paretoDOption.value,
|
|
option: paretoDOption.value,
|
|
|
height: "240px"
|
|
height: "240px"
|
|
|
}, null, _parent));
|
|
}, null, _parent));
|
|
|
- if (k80D.value) {
|
|
|
|
|
- _push(`<p class="small muted" style="${ssrRenderStyle({ "margin-top": "5px", "line-height": "1.6" })}"><b>${ssrInterpolate(unref(t)("ch.pareto.key", { k: k80D.value.k }))}</b> (${ssrInterpolate(unref(t)("ch.pareto.total", { n: k80D.value.n, tot: unref(fmt)(Math.round(k80D.value.tot)), unit: " h" }))})</p>`);
|
|
|
|
|
- } else {
|
|
|
|
|
- _push(`<!---->`);
|
|
|
|
|
- }
|
|
|
|
|
- _push(`</div><div class="panel span2"><h3>${ssrInterpolate(unref(t)("flt.quad"))}</h3>`);
|
|
|
|
|
|
|
+ _push(`<p class="small muted" style="${ssrRenderStyle({ "margin-top": "5px", "line-height": "1.6" })}">${paretoDSummary.value ?? ""}</p></div><div class="panel span2"><h3>${ssrInterpolate(unref(t)("flt.quad"))}</h3>`);
|
|
|
_push(ssrRenderComponent(EChart, {
|
|
_push(ssrRenderComponent(EChart, {
|
|
|
option: quadOption.value,
|
|
option: quadOption.value,
|
|
|
height: "300px"
|
|
height: "300px"
|
|
@@ -1457,7 +1481,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
option: stopParetoOption.value,
|
|
option: stopParetoOption.value,
|
|
|
height: "240px"
|
|
height: "240px"
|
|
|
}, null, _parent));
|
|
}, null, _parent));
|
|
|
- _push(`<p class="small muted" style="${ssrRenderStyle({ "margin-top": "4px" })}">${ssrInterpolate(M.value.口径)}</p></div><div class="panel"><h3>${ssrInterpolate(unref(t)("flt.stop_units", { n: top.value.length }))}</h3><div class="tblwrap"><table><tr><th style="${ssrRenderStyle({ "width": "64px" })}">${ssrInterpolate(unref(t)("ui.unit"))}</th><th>${ssrInterpolate(unref(t)("flt.stop_h"))}</th><th class="r" style="${ssrRenderStyle({ "width": "56px" })}">${ssrInterpolate(unref(t)("flt.stop_n"))}</th></tr><!--[-->`);
|
|
|
|
|
|
|
+ _push(`<p class="small muted" style="${ssrRenderStyle({ "margin-top": "5px", "line-height": "1.6" })}">${stopParetoSummary.value ?? ""}</p><p class="small muted" style="${ssrRenderStyle({ "margin-top": "4px" })}">${ssrInterpolate(M.value.口径)}</p></div><div class="panel"><h3>${ssrInterpolate(unref(t)("flt.stop_units", { n: top.value.length }))}</h3><div class="tblwrap"><table><tr><th style="${ssrRenderStyle({ "width": "64px" })}">${ssrInterpolate(unref(t)("ui.unit"))}</th><th>${ssrInterpolate(unref(t)("flt.stop_h"))}</th><th class="r" style="${ssrRenderStyle({ "width": "56px" })}">${ssrInterpolate(unref(t)("flt.stop_n"))}</th></tr><!--[-->`);
|
|
|
ssrRenderList(top.value, (x) => {
|
|
ssrRenderList(top.value, (x) => {
|
|
|
_push(`<tr><td><b>${ssrInterpolate(unref(unitNo)(x.t))}</b></td><td><i class="bar" style="${ssrRenderStyle(`width:${Math.round(x.时长h / mxTop.value * 90)}px;background:${x.时长h / mxTop.value > 0.6 ? "var(--critical)" : "var(--accent)"}`)}"></i><span class="num small">${ssrInterpolate(unref(fmt)(x.时长h))}</span>h</td><td class="r small">${ssrInterpolate(x.次)}</td></tr>`);
|
|
_push(`<tr><td><b>${ssrInterpolate(unref(unitNo)(x.t))}</b></td><td><i class="bar" style="${ssrRenderStyle(`width:${Math.round(x.时长h / mxTop.value * 90)}px;background:${x.时长h / mxTop.value > 0.6 ? "var(--critical)" : "var(--accent)"}`)}"></i><span class="num small">${ssrInterpolate(unref(fmt)(x.时长h))}</span>h</td><td class="r small">${ssrInterpolate(x.次)}</td></tr>`);
|
|
|
});
|
|
});
|