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

268 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: "HazardDetailPanelV2",
props: {
detail: {
type: Object,
default: () => ({})
},
loading: {
type: Boolean,
default: false
},
bodyHeight: {
type: Number,
default: 0
}
},
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 scrollAreaStyle = common_vendor.computed(() => {
const height = props.bodyHeight > 0 ? props.bodyHeight : 400;
return { height: `${height}px` };
});
const detailBodyStyle = common_vendor.computed(() => {
const height = props.bodyHeight > 0 ? props.bodyHeight : 400;
return { height: `${height}px` };
});
common_vendor.watch(
() => props.bodyHeight,
(height) => {
if (height > 0) {
scheduleMeasureLayout();
setTimeout(scheduleMeasureLayout, 100);
}
}
);
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.unref(loading)
}, common_vendor.unref(loading) ? {} : common_vendor.unref(historyList).length === 0 ? {} : {
c: common_vendor.f(common_vendor.unref(historyList), (item, index, i0) => {
return common_vendor.e({
a: common_vendor.unref(components_hazardDetail_hazardDetail.getStepIconPath)(item.type, common_vendor.unref(activeIndex) === index),
b: common_vendor.unref(activeIndex) === index ? 1 : "",
c: common_vendor.t(item.nodeName),
d: common_vendor.unref(activeIndex) === index ? 1 : "",
e: index < common_vendor.unref(historyList).length - 1
}, index < common_vendor.unref(historyList).length - 1 ? {} : {}, {
f: "step-" + index,
g: "hazard-step-" + index,
h: common_vendor.unref(activeIndex) === index ? 1 : "",
i: common_vendor.o(($event) => common_vendor.unref(scrollToNode)(index), "step-" + index)
});
}),
d: common_vendor.s(scrollAreaStyle.value),
e: common_vendor.unref(stepScrollIntoView),
f: 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.content.levelName
}, item.type === "submit" && item.content.levelName ? {
e: common_vendor.t(item.content.levelName),
f: common_vendor.n(getLevelTagClass(item.content))
} : {}, {
g: item.type === "submit"
}, item.type === "submit" ? common_vendor.e({
h: common_vendor.t(item.content.code),
i: common_vendor.t(item.content.title),
j: common_vendor.t(item.content.source),
k: common_vendor.t(item.content.hazardSourceName),
l: item.content.areaColor
}, item.content.areaColor ? {
m: item.content.areaColor
} : {}, {
n: common_vendor.t(item.content.areaName),
o: common_vendor.t(item.content.address),
p: common_vendor.t(item.content.levelName || "-"),
q: common_vendor.n(getLevelTagClass(item.content)),
r: common_vendor.t(item.content.tagName),
s: common_vendor.t(item.content.description),
t: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
v: 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)
};
})
} : {}, {
w: common_vendor.t(item.content.legalBasis)
}) : item.type === "assign" ? {
y: common_vendor.t(item.content.assigneeName),
z: common_vendor.t(item.content.deadline)
} : item.type === "rectify" ? common_vendor.e({
B: common_vendor.t(item.content.rectifyStatusName),
C: common_vendor.t(item.content.rectifyPlan),
D: common_vendor.t(item.content.rectifyResult),
E: common_vendor.t(item.content.rectificationMeasures),
F: common_vendor.t(item.content.controlMeasures),
G: common_vendor.t(item.content.deadline),
H: common_vendor.t(item.content.rectifierNames),
I: common_vendor.t(item.content.managerNames),
J: common_vendor.t(formatCost(item.content.planCost)),
K: common_vendor.t(formatCost(item.content.actualCost)),
L: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
M: 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
});
})
} : {}, {
N: item.content.signPath
}, item.content.signPath ? {
O: resolveFileUrl(item.content.signPath),
P: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
Q: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : item.type === "verify" ? common_vendor.e({
S: common_vendor.t(item.content.resultName),
T: common_vendor.n(item.content.resultName === "通过" ? "result-tag--pass" : "result-tag--fail"),
U: item.content.remark
}, item.content.remark ? {
V: common_vendor.t(item.content.remark)
} : {}, {
W: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
X: 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
});
})
} : {}, {
Y: item.content.signPath
}, item.content.signPath ? {
Z: resolveFileUrl(item.content.signPath),
aa: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
ab: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : item.type === "writeoff" ? common_vendor.e({
ad: common_vendor.t(item.content.resultName),
ae: common_vendor.n(item.content.resultName === "通过" ? "result-tag--pass" : "result-tag--fail"),
af: item.content.remark
}, item.content.remark ? {
ag: common_vendor.t(item.content.remark)
} : {}, {
ah: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
ai: 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
});
})
} : {}, {
aj: item.content.signPath
}, item.content.signPath ? {
ak: resolveFileUrl(item.content.signPath),
al: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
am: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : {}, {
x: item.type === "assign",
A: item.type === "rectify",
R: item.type === "verify",
ac: item.type === "writeoff",
an: "node-" + index,
ao: "hazard-node-" + index,
ap: index === common_vendor.unref(historyList).length - 1 ? 1 : ""
});
}),
g: common_vendor.s(scrollAreaStyle.value),
h: common_vendor.unref(contentScrollIntoView),
i: common_vendor.unref(scrollWithAnimation),
j: common_vendor.o((...args) => common_vendor.unref(onContentScroll) && common_vendor.unref(onContentScroll)(...args)),
k: common_vendor.o((...args) => common_vendor.unref(onScrollToLower) && common_vendor.unref(onScrollToLower)(...args)),
l: common_vendor.s(detailBodyStyle.value)
}, {
b: common_vendor.unref(historyList).length === 0,
m: common_vendor.gei(_ctx, "")
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-361ef447"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/hazardDetail/HazardDetailPanelV2.js.map