Files
threeonecheck_web/unpackage/dist/dev/mp-weixin/components/hazardDetail/HazardProcessChainPanel.js
2026-07-27 09:27:22 +08:00

351 lines
19 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const request_request = require("../../request/request.js");
const components_hazardDetail_processChain = require("./processChain.js");
const components_hazardDetail_processChainLabels = require("./processChainLabels.js");
const components_hazardDetail_useProcessChainScroll = require("./useProcessChainScroll.js");
const _sfc_main = {
__name: "HazardProcessChainPanel",
props: {
chainData: {
type: Object,
default: () => ({})
},
loading: {
type: Boolean,
default: false
},
bodyHeight: {
type: Number,
default: 0
}
},
setup(__props) {
const labels = components_hazardDetail_processChainLabels.CHAIN_LABELS;
const props = __props;
const { chainData, loading } = common_vendor.toRefs(props);
const {
historyList,
activeIndex,
contentScrollIntoView,
stepScrollIntoView,
scrollWithAnimation,
onContentScroll,
onScrollToLower,
scrollToNode,
scheduleMeasureLayout
} = components_hazardDetail_useProcessChainScroll.useProcessChainScroll(chainData, 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 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 && components_hazardDetail_processChainLabels.LEVEL_NAME_CLASS_MAP[levelName]) {
return components_hazardDetail_processChainLabels.LEVEL_NAME_CLASS_MAP[levelName];
}
return "";
};
const resolveFileUrl = (path) => request_request.toImageUrl(path);
const fieldText = (item, value) => components_hazardDetail_processChain.resolveFieldDisplay(value, item.completed);
const isPendingText = (item, value) => fieldText(item, value) === components_hazardDetail_processChain.PENDING_LABEL;
const formatCost = (cost, completed = true) => {
if (cost == null || cost === "")
return components_hazardDetail_processChain.resolveFieldDisplay("", completed);
const num = Number(cost);
if (Number.isNaN(num))
return components_hazardDetail_processChain.resolveFieldDisplay("", completed);
return `${num} ${labels.yuan}`;
};
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) ? {
b: common_vendor.t(common_vendor.unref(labels).loading)
} : common_vendor.unref(historyList).length === 0 ? {
d: common_vendor.t(common_vendor.unref(labels).empty)
} : {
e: common_vendor.f(common_vendor.unref(historyList), (item, index, i0) => {
return common_vendor.e({
a: common_vendor.unref(components_hazardDetail_processChain.getProcessStepIconPath)(item, 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: "process-step-" + index,
h: common_vendor.unref(activeIndex) === index ? 1 : "",
i: common_vendor.o(($event) => common_vendor.unref(scrollToNode)(index), "step-" + index)
});
}),
f: common_vendor.s(scrollAreaStyle.value),
g: common_vendor.unref(stepScrollIntoView),
h: common_vendor.f(common_vendor.unref(historyList), (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.titlePrefix),
b: common_vendor.t(fieldText(item, item.operator)),
c: common_vendor.t(fieldText(item, item.time)),
d: item.type === "add" && item.content.levelName
}, item.type === "add" && item.content.levelName ? {
e: common_vendor.t(item.content.levelName),
f: common_vendor.n(getLevelTagClass(item.content))
} : {}, {
g: item.type === "add"
}, item.type === "add" ? common_vendor.e({
h: common_vendor.t(common_vendor.unref(labels).hazardCode),
i: common_vendor.t(fieldText(item, item.content.code)),
j: common_vendor.t(common_vendor.unref(labels).hazardTitle),
k: common_vendor.t(fieldText(item, item.content.title)),
l: common_vendor.t(common_vendor.unref(labels).checkSource),
m: common_vendor.t(fieldText(item, item.content.source)),
n: common_vendor.t(common_vendor.unref(labels).hazardSource),
o: common_vendor.t(fieldText(item, item.content.hazardSourceName)),
p: common_vendor.t(common_vendor.unref(labels).hazardArea),
q: common_vendor.t(fieldText(item, item.content.areaName)),
r: common_vendor.t(common_vendor.unref(labels).address),
s: common_vendor.t(fieldText(item, item.content.address)),
t: common_vendor.t(common_vendor.unref(labels).hazardLevel),
v: common_vendor.t(fieldText(item, item.content.levelName)),
w: common_vendor.n(getLevelTagClass(item.content)),
x: common_vendor.t(common_vendor.unref(labels).hazardTag),
y: common_vendor.t(fieldText(item, item.content.tagName)),
z: common_vendor.t(common_vendor.unref(labels).description),
A: common_vendor.t(fieldText(item, item.content.description)),
B: item.content.attachments && item.content.attachments.length || !item.completed
}, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({
C: common_vendor.t(common_vendor.unref(labels).hazardAttachments),
D: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
E: 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)
};
})
} : {
F: common_vendor.t(fieldText(item, ""))
}) : {}, {
G: common_vendor.t(common_vendor.unref(labels).legalBasis),
H: common_vendor.t(fieldText(item, item.content.legalBasis))
}) : item.type === "assign" ? {
J: common_vendor.t(common_vendor.unref(labels).assigneeName),
K: common_vendor.t(fieldText(item, item.content.assigneeName)),
L: common_vendor.t(common_vendor.unref(labels).assignDeadline),
M: common_vendor.t(fieldText(item, item.content.deadline)),
N: common_vendor.t(common_vendor.unref(labels).assignStatus),
O: common_vendor.t(fieldText(item, item.content.assignStatusName))
} : item.type === "rectify" ? common_vendor.e({
Q: common_vendor.t(common_vendor.unref(labels).rectifyStatus),
R: common_vendor.t(fieldText(item, item.content.rectifyStatusName)),
S: common_vendor.t(common_vendor.unref(labels).rectifyPlan),
T: common_vendor.t(fieldText(item, item.content.rectifyPlan)),
U: common_vendor.t(common_vendor.unref(labels).rectifyResult),
V: common_vendor.t(fieldText(item, item.content.rectifyResult)),
W: common_vendor.t(common_vendor.unref(labels).rectifyMeasures),
X: common_vendor.t(fieldText(item, item.content.rectificationMeasures)),
Y: common_vendor.t(common_vendor.unref(labels).controlMeasures),
Z: common_vendor.t(fieldText(item, item.content.controlMeasures)),
aa: common_vendor.t(common_vendor.unref(labels).rectifierName),
ab: common_vendor.t(fieldText(item, item.content.rectifierName)),
ac: common_vendor.t(common_vendor.unref(labels).managerNames),
ad: common_vendor.t(fieldText(item, item.content.managerNames)),
ae: common_vendor.t(common_vendor.unref(labels).memberNames),
af: common_vendor.t(fieldText(item, item.content.memberNames)),
ag: common_vendor.t(common_vendor.unref(labels).planCost),
ah: common_vendor.t(formatCost(item.content.planCost, item.completed)),
ai: common_vendor.t(common_vendor.unref(labels).actualCost),
aj: common_vendor.t(formatCost(item.content.actualCost, item.completed)),
ak: item.content.attachments && item.content.attachments.length || !item.completed
}, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({
al: common_vendor.t(common_vendor.unref(labels).rectifyAttachments),
am: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
an: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return common_vendor.e({
a: file.fileType === "image" || !file.fileType
}, file.fileType === "image" || !file.fileType ? {
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 || common_vendor.unref(labels).attachmentFallback)
}, {
f: idx
});
})
} : {
ao: common_vendor.t(fieldText(item, ""))
}) : {}, {
ap: item.content.signPath || !item.completed
}, item.content.signPath || !item.completed ? common_vendor.e({
aq: common_vendor.t(common_vendor.unref(labels).rectifySign),
ar: item.content.signPath
}, item.content.signPath ? {
as: resolveFileUrl(item.content.signPath),
at: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
av: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {
aw: common_vendor.t(fieldText(item, ""))
}) : {}) : item.type === "verify" || item.type === "writeoff_approve" ? common_vendor.e({
ay: common_vendor.t(common_vendor.unref(labels).verifyResult),
az: item.completed && item.content.resultName
}, item.completed && item.content.resultName ? {
aA: common_vendor.t(item.content.resultName),
aB: common_vendor.n(item.content.resultName === common_vendor.unref(labels).pass ? "result-tag--pass" : "result-tag--fail")
} : {
aC: common_vendor.t(fieldText(item, item.content.resultName))
}, {
aD: item.content.remark || !item.completed
}, item.content.remark || !item.completed ? {
aE: common_vendor.t(common_vendor.unref(labels).verifyRemark),
aF: common_vendor.t(fieldText(item, item.content.remark))
} : {}, {
aG: item.content.attachments && item.content.attachments.length || !item.completed
}, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({
aH: common_vendor.t(common_vendor.unref(labels).verifyAttachments),
aI: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
aJ: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return common_vendor.e({
a: file.fileType === "image" || !file.fileType
}, file.fileType === "image" || !file.fileType ? {
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 || common_vendor.unref(labels).attachmentFallback)
}, {
f: idx
});
})
} : {
aK: common_vendor.t(fieldText(item, ""))
}) : {}, {
aL: item.content.signPath || !item.completed
}, item.content.signPath || !item.completed ? common_vendor.e({
aM: common_vendor.t(common_vendor.unref(labels).verifySign),
aN: item.content.signPath
}, item.content.signPath ? {
aO: resolveFileUrl(item.content.signPath),
aP: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
aQ: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {
aR: common_vendor.t(fieldText(item, ""))
}) : {}) : item.type === "writeoff_apply" ? common_vendor.e({
aT: common_vendor.t(common_vendor.unref(labels).writeoffDeadline),
aU: common_vendor.t(fieldText(item, item.content.rectifyDeadline)),
aV: common_vendor.t(common_vendor.unref(labels).responsibleDept),
aW: common_vendor.t(fieldText(item, item.content.responsibleDeptName)),
aX: common_vendor.t(common_vendor.unref(labels).responsiblePerson),
aY: common_vendor.t(fieldText(item, item.content.responsiblePerson)),
aZ: common_vendor.t(common_vendor.unref(labels).mainTreatment),
ba: common_vendor.t(fieldText(item, item.content.mainTreatmentContent)),
bb: common_vendor.t(common_vendor.unref(labels).treatmentResult),
bc: common_vendor.t(fieldText(item, item.content.treatmentResult)),
bd: common_vendor.t(common_vendor.unref(labels).selfVerify),
be: common_vendor.t(fieldText(item, item.content.selfVerifyContent)),
bf: item.content.signPath || !item.completed
}, item.content.signPath || !item.completed ? common_vendor.e({
bg: common_vendor.t(common_vendor.unref(labels).applySign),
bh: item.content.signPath
}, item.content.signPath ? {
bi: resolveFileUrl(item.content.signPath),
bj: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
bk: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {
bl: common_vendor.t(fieldText(item, ""))
}) : {}) : item.type === "approval" ? common_vendor.e({
bn: common_vendor.t(common_vendor.unref(labels).approvalOpinion),
bo: item.completed && item.content.approveTypeName
}, item.completed && item.content.approveTypeName ? {
bp: common_vendor.t(item.content.approveTypeName),
bq: common_vendor.n(item.content.pass ? "result-tag--pass" : "result-tag--fail")
} : {
br: common_vendor.t(fieldText(item, item.content.approveTypeName))
}, {
bs: common_vendor.t(common_vendor.unref(labels).approvalComment),
bt: common_vendor.t(fieldText(item, item.content.comment)),
bv: isPendingText(item, item.content.comment) ? 1 : "",
bw: common_vendor.t(common_vendor.unref(labels).smsReminder),
bx: item.content.sendMsgFlag != null
}, item.content.sendMsgFlag != null ? {
by: common_vendor.t(item.content.sendMsgFlag ? common_vendor.unref(labels).yes : common_vendor.unref(labels).no)
} : {
bz: common_vendor.t(fieldText(item, ""))
}, {
bA: item.content.signPath || !item.completed
}, item.content.signPath || !item.completed ? common_vendor.e({
bB: common_vendor.t(common_vendor.unref(labels).approvalSign),
bC: item.content.signPath
}, item.content.signPath ? {
bD: resolveFileUrl(item.content.signPath),
bE: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
bF: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {
bG: common_vendor.t(fieldText(item, ""))
}) : {}) : {}, {
I: item.type === "assign",
P: item.type === "rectify",
ax: item.type === "verify" || item.type === "writeoff_approve",
aS: item.type === "writeoff_apply",
bm: item.type === "approval",
bH: common_vendor.unref(activeIndex) === index ? 1 : "",
bI: "node-" + index,
bJ: "process-node-" + index,
bK: index === common_vendor.unref(historyList).length - 1 ? 1 : ""
});
}),
i: common_vendor.t(common_vendor.unref(labels).personnelSuffix),
j: common_vendor.s(scrollAreaStyle.value),
k: common_vendor.unref(contentScrollIntoView),
l: common_vendor.unref(scrollWithAnimation),
m: common_vendor.o((...args) => common_vendor.unref(onContentScroll) && common_vendor.unref(onContentScroll)(...args)),
n: common_vendor.o((...args) => common_vendor.unref(onScrollToLower) && common_vendor.unref(onScrollToLower)(...args)),
o: common_vendor.s(detailBodyStyle.value)
}, {
c: common_vendor.unref(historyList).length === 0,
p: common_vendor.gei(_ctx, "")
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-020654bc"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/hazardDetail/HazardProcessChainPanel.js.map