Files
threeonecheck_web/unpackage/dist/dev/mp-weixin/components/hazardDetail/HazardDetailPanel.js

243 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.title),
f: common_vendor.t(item.content.source),
g: item.content.areaColor
}, item.content.areaColor ? {
h: item.content.areaColor
} : {}, {
i: common_vendor.t(item.content.areaName),
j: common_vendor.t(item.content.address),
k: common_vendor.t(item.content.levelName || "-"),
l: common_vendor.n(getLevelTagClass(item.content)),
m: common_vendor.t(item.content.tagName),
n: common_vendor.t(item.content.description),
o: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
p: 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)
};
})
} : {}, {
q: common_vendor.t(item.content.legalBasis)
}) : item.type === "assign" ? {
s: common_vendor.t(item.content.assigneeName),
t: common_vendor.t(item.content.deadline)
} : item.type === "rectify" ? common_vendor.e({
w: common_vendor.t(item.content.rectifyStatusName),
x: common_vendor.t(item.content.rectifyPlan),
y: common_vendor.t(item.content.rectifyResult),
z: common_vendor.t(item.content.rectificationMeasures),
A: common_vendor.t(item.content.controlMeasures),
B: common_vendor.t(item.content.deadline),
C: common_vendor.t(item.content.rectifierNames),
D: common_vendor.t(item.content.managerNames),
E: common_vendor.t(formatCost(item.content.planCost)),
F: common_vendor.t(formatCost(item.content.actualCost)),
G: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
H: 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
});
})
} : {}, {
I: item.content.signPath
}, item.content.signPath ? {
J: resolveFileUrl(item.content.signPath),
K: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
L: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : item.type === "verify" ? common_vendor.e({
N: common_vendor.t(item.content.resultName),
O: common_vendor.n(item.content.resultName === "通过" ? "result-tag--pass" : "result-tag--fail"),
P: item.content.remark
}, item.content.remark ? {
Q: common_vendor.t(item.content.remark)
} : {}, {
R: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
S: 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
});
})
} : {}, {
T: item.content.signPath
}, item.content.signPath ? {
U: resolveFileUrl(item.content.signPath),
V: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
W: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : item.type === "writeoff" ? common_vendor.e({
Y: common_vendor.t(item.content.resultName),
Z: common_vendor.n(item.content.resultName === "通过" ? "result-tag--pass" : "result-tag--fail"),
aa: item.content.remark
}, item.content.remark ? {
ab: common_vendor.t(item.content.remark)
} : {}, {
ac: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
ad: 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
});
})
} : {}, {
ae: item.content.signPath
}, item.content.signPath ? {
af: resolveFileUrl(item.content.signPath),
ag: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
ah: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {}) : {}, {
r: item.type === "assign",
v: item.type === "rectify",
M: item.type === "verify",
X: item.type === "writeoff",
ai: "node-" + index,
aj: "hazard-node-" + index,
ak: 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