Files
threeonecheck_web/unpackage/dist/dev/mp-weixin/components/hazardDetail/HazardDetailPanel.js
2026-06-30 09:47:10 +08:00

245 lines
12 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const request_request = require("../../request/request.js");
const components_hazardDetail_hazardDetail = require("./hazardDetail.js");
const components_hazardDetail_useHazardDetailScroll = require("./useHazardDetailScroll.js");
const _sfc_main = {
__name: "HazardDetailPanel",
props: {
detail: {
type: Object,
default: () => ({})
},
loading: {
type: Boolean,
default: false
}
},
setup(__props) {
const props = __props;
const { detail, loading } = common_vendor.toRefs(props);
const {
historyList,
activeIndex,
contentScrollIntoView,
stepScrollIntoView,
scrollWithAnimation,
onContentScroll,
onScrollToLower,
scrollToNode,
scheduleMeasureLayout
} = components_hazardDetail_useHazardDetailScroll.useHazardDetailScroll(detail, loading);
const statusClass = common_vendor.computed(() => {
var _a, _b;
return components_hazardDetail_hazardDetail.getStatusClass((_a = props.detail) == null ? void 0 : _a.status, (_b = props.detail) == null ? void 0 : _b.statusName);
});
const LEVEL_CLASS_MAP = {
2: "level-normal",
3: "level-major"
};
const LEVEL_NAME_CLASS_MAP = {
一般: "level-normal",
一般隐患: "level-normal",
重大: "level-major",
重大隐患: "level-major"
};
const getLevelTagClass = (content) => {
const level = content == null ? void 0 : content.level;
const levelName = content == null ? void 0 : content.levelName;
if (level != null && LEVEL_CLASS_MAP[level]) {
return LEVEL_CLASS_MAP[level];
}
if (levelName && LEVEL_NAME_CLASS_MAP[levelName]) {
return LEVEL_NAME_CLASS_MAP[levelName];
}
return "";
};
const resolveFileUrl = (path) => request_request.toImageUrl(path);
const formatCost = (cost) => {
if (cost == null || cost === "")
return "-";
const num = Number(cost);
return Number.isNaN(num) ? "-" : `${num}`;
};
const previewSingle = (path) => {
const url = resolveFileUrl(path);
if (!url)
return;
common_vendor.index.previewImage({ current: url, urls: [url] });
};
const previewImages = (attachments, index) => {
const urls = (attachments || []).filter((f) => f.fileType === "image" || !f.fileType).map((f) => resolveFileUrl(f.filePath)).filter(Boolean);
if (!urls.length)
return;
common_vendor.index.previewImage({ current: urls[index] || urls[0], urls });
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t(common_vendor.unref(detail).title || "-"),
b: common_vendor.t(common_vendor.unref(detail).statusName || "-"),
c: common_vendor.n(statusClass.value),
d: common_vendor.t(common_vendor.unref(detail).createdAt || "-"),
e: common_vendor.unref(loading)
}, common_vendor.unref(loading) ? {} : common_vendor.unref(historyList).length === 0 ? {} : {
g: common_vendor.f(common_vendor.unref(historyList), (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.nodeName),
b: common_vendor.unref(activeIndex) === index ? 1 : "",
c: index < common_vendor.unref(historyList).length - 1
}, index < common_vendor.unref(historyList).length - 1 ? {} : {}, {
d: "step-" + index,
e: "hazard-step-" + index,
f: common_vendor.unref(activeIndex) === index ? 1 : "",
g: common_vendor.o(($event) => common_vendor.unref(scrollToNode)(index), "step-" + index)
});
}),
h: common_vendor.unref(stepScrollIntoView),
i: common_vendor.f(common_vendor.unref(historyList), (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.titlePrefix),
b: common_vendor.t(item.operator),
c: common_vendor.t(item.time),
d: item.type === "submit"
}, item.type === "submit" ? common_vendor.e({
e: common_vendor.t(item.content.code),
f: common_vendor.t(item.content.title),
g: common_vendor.t(item.content.source),
h: common_vendor.t(item.content.hazardSourceName),
i: item.content.areaColor
}, item.content.areaColor ? {
j: item.content.areaColor
} : {}, {
k: common_vendor.t(item.content.areaName),
l: common_vendor.t(item.content.address),
m: common_vendor.t(item.content.levelName || "-"),
n: common_vendor.n(getLevelTagClass(item.content)),
o: common_vendor.t(item.content.tagName),
p: common_vendor.t(item.content.description),
q: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
r: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return {
a: idx,
b: resolveFileUrl(file.filePath),
c: common_vendor.o(($event) => previewImages(item.content.attachments, idx), idx),
d: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), idx)
};
})
} : {}, {
s: common_vendor.t(item.content.legalBasis)
}) : item.type === "assign" ? {
v: common_vendor.t(item.content.assigneeName),
w: common_vendor.t(item.content.deadline)
} : item.type === "rectify" ? common_vendor.e({
y: common_vendor.t(item.content.rectifyStatusName),
z: common_vendor.t(item.content.rectifyPlan),
A: common_vendor.t(item.content.rectifyResult),
B: common_vendor.t(item.content.rectificationMeasures),
C: common_vendor.t(item.content.controlMeasures),
D: common_vendor.t(item.content.deadline),
E: common_vendor.t(item.content.rectifierNames),
F: common_vendor.t(item.content.managerNames),
G: common_vendor.t(formatCost(item.content.planCost)),
H: common_vendor.t(formatCost(item.content.actualCost)),
I: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
J: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return common_vendor.e({
a: file.fileType === "image"
}, file.fileType === "image" ? {
b: resolveFileUrl(file.filePath),
c: common_vendor.o(($event) => previewImages(item.content.attachments, idx), idx),
d: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), idx)
} : {
e: common_vendor.t(file.fileName || "附件")
}, {
f: idx
});
})
} : {}, {
K: item.content.signPath
}, item.content.signPath ? {
L: resolveFileUrl(item.content.signPath),
M: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
N: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : item.type === "verify" ? common_vendor.e({
P: common_vendor.t(item.content.resultName),
Q: common_vendor.n(item.content.resultName === "通过" ? "result-tag--pass" : "result-tag--fail"),
R: item.content.remark
}, item.content.remark ? {
S: common_vendor.t(item.content.remark)
} : {}, {
T: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
U: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return common_vendor.e({
a: file.fileType === "image"
}, file.fileType === "image" ? {
b: resolveFileUrl(file.filePath),
c: common_vendor.o(($event) => previewImages(item.content.attachments, idx), idx),
d: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), idx)
} : {
e: common_vendor.t(file.fileName || "附件")
}, {
f: idx
});
})
} : {}, {
V: item.content.signPath
}, item.content.signPath ? {
W: resolveFileUrl(item.content.signPath),
X: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
Y: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : item.type === "writeoff" ? common_vendor.e({
aa: common_vendor.t(item.content.resultName),
ab: common_vendor.n(item.content.resultName === "通过" ? "result-tag--pass" : "result-tag--fail"),
ac: item.content.remark
}, item.content.remark ? {
ad: common_vendor.t(item.content.remark)
} : {}, {
ae: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
af: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return common_vendor.e({
a: file.fileType === "image"
}, file.fileType === "image" ? {
b: resolveFileUrl(file.filePath),
c: common_vendor.o(($event) => previewImages(item.content.attachments, idx), idx),
d: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), idx)
} : {
e: common_vendor.t(file.fileName || "附件")
}, {
f: idx
});
})
} : {}, {
ag: item.content.signPath
}, item.content.signPath ? {
ah: resolveFileUrl(item.content.signPath),
ai: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
aj: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : {}, {
t: item.type === "assign",
x: item.type === "rectify",
O: item.type === "verify",
Z: item.type === "writeoff",
ak: "node-" + index,
al: "hazard-node-" + index,
am: index === common_vendor.unref(historyList).length - 1 ? 1 : ""
});
}),
j: common_vendor.unref(contentScrollIntoView),
k: common_vendor.unref(scrollWithAnimation),
l: common_vendor.o((...args) => common_vendor.unref(onContentScroll) && common_vendor.unref(onContentScroll)(...args)),
m: common_vendor.o((...args) => common_vendor.unref(onScrollToLower) && common_vendor.unref(onScrollToLower)(...args))
}, {
f: common_vendor.unref(historyList).length === 0,
n: common_vendor.gei(_ctx, "")
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f38c3cb4"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/hazardDetail/HazardDetailPanel.js.map