"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: item.completed }, item.completed ? { b: common_vendor.t(item.titlePrefix), c: common_vendor.t(common_vendor.unref(labels).personnelSuffix), d: common_vendor.t(fieldText(item, item.operator)), e: common_vendor.t(fieldText(item, item.time)) } : { f: common_vendor.t(common_vendor.unref(labels).nextHandlerLabel), g: common_vendor.t(fieldText(item, item.currentHandlerName)), h: common_vendor.t(common_vendor.unref(labels).statusSuffix), i: common_vendor.t(common_vendor.unref(components_hazardDetail_processChain.PENDING_LABEL)) }, { j: item.completed && item.type === "add" && item.content.levelName }, item.completed && item.type === "add" && item.content.levelName ? { k: common_vendor.t(item.content.levelName), l: common_vendor.n(getLevelTagClass(item.content)) } : {}, { m: item.completed }, item.completed ? {} : {}, { n: item.completed }, item.completed ? common_vendor.e({ o: item.type === "add" }, item.type === "add" ? common_vendor.e({ p: common_vendor.t(common_vendor.unref(labels).hazardCode), q: common_vendor.t(fieldText(item, item.content.code)), r: common_vendor.t(common_vendor.unref(labels).hazardTitle), s: common_vendor.t(fieldText(item, item.content.title)), t: common_vendor.t(common_vendor.unref(labels).checkSource), v: common_vendor.t(fieldText(item, item.content.source)), w: common_vendor.t(common_vendor.unref(labels).hazardSource), x: common_vendor.t(fieldText(item, item.content.hazardSourceName)), y: common_vendor.t(common_vendor.unref(labels).hazardArea), z: common_vendor.t(fieldText(item, item.content.areaName)), A: common_vendor.t(common_vendor.unref(labels).address), B: common_vendor.t(fieldText(item, item.content.address)), C: common_vendor.t(common_vendor.unref(labels).hazardLevel), D: common_vendor.t(fieldText(item, item.content.levelName)), E: common_vendor.n(getLevelTagClass(item.content)), F: common_vendor.t(common_vendor.unref(labels).hazardTag), G: common_vendor.t(fieldText(item, item.content.tagName)), H: common_vendor.t(common_vendor.unref(labels).description), I: common_vendor.t(fieldText(item, item.content.description)), J: item.content.attachments && item.content.attachments.length || !item.completed }, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({ K: common_vendor.t(common_vendor.unref(labels).hazardAttachments), 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 { 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) }; }) } : { N: common_vendor.t(fieldText(item, "")) }) : {}, { O: common_vendor.t(common_vendor.unref(labels).legalBasis), P: common_vendor.t(fieldText(item, item.content.legalBasis)) }) : item.type === "assign" ? { R: common_vendor.t(common_vendor.unref(labels).assigneeName), S: common_vendor.t(fieldText(item, item.content.assigneeName)), T: common_vendor.t(common_vendor.unref(labels).assignDeadline), U: common_vendor.t(fieldText(item, item.content.deadline)), V: common_vendor.t(common_vendor.unref(labels).assignStatus), W: common_vendor.t(fieldText(item, item.content.assignStatusName)) } : item.type === "rectify" ? common_vendor.e({ Y: common_vendor.t(common_vendor.unref(labels).rectifyStatus), Z: common_vendor.t(fieldText(item, item.content.rectifyStatusName)), aa: common_vendor.t(common_vendor.unref(labels).rectifyPlan), ab: common_vendor.t(fieldText(item, item.content.rectifyPlan)), ac: common_vendor.t(common_vendor.unref(labels).rectifyResult), ad: common_vendor.t(fieldText(item, item.content.rectifyResult)), ae: common_vendor.t(common_vendor.unref(labels).rectifyMeasures), af: common_vendor.t(fieldText(item, item.content.rectificationMeasures)), ag: common_vendor.t(common_vendor.unref(labels).controlMeasures), ah: common_vendor.t(fieldText(item, item.content.controlMeasures)), ai: common_vendor.t(common_vendor.unref(labels).rectifierName), aj: common_vendor.t(fieldText(item, item.content.rectifierName)), ak: common_vendor.t(common_vendor.unref(labels).managerNames), al: common_vendor.t(fieldText(item, item.content.managerNames)), am: common_vendor.t(common_vendor.unref(labels).memberNames), an: common_vendor.t(fieldText(item, item.content.memberNames)), ao: common_vendor.t(common_vendor.unref(labels).planCost), ap: common_vendor.t(formatCost(item.content.planCost, item.completed)), aq: common_vendor.t(common_vendor.unref(labels).actualCost), ar: common_vendor.t(formatCost(item.content.actualCost, item.completed)), as: item.content.attachments && item.content.attachments.length || !item.completed }, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({ at: common_vendor.t(common_vendor.unref(labels).rectifyAttachments), av: item.content.attachments && item.content.attachments.length }, item.content.attachments && item.content.attachments.length ? { aw: 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 }); }) } : { ax: common_vendor.t(fieldText(item, "")) }) : {}, { ay: item.content.signPath || !item.completed }, item.content.signPath || !item.completed ? common_vendor.e({ az: common_vendor.t(common_vendor.unref(labels).rectifySign), aA: item.content.signPath }, item.content.signPath ? { aB: resolveFileUrl(item.content.signPath), aC: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index), aD: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index) } : { aE: common_vendor.t(fieldText(item, "")) }) : {}) : item.type === "verify" || item.type === "writeoff_approve" ? common_vendor.e({ aG: common_vendor.t(common_vendor.unref(labels).verifyResult), aH: item.completed && item.content.resultName }, item.completed && item.content.resultName ? { aI: common_vendor.t(item.content.resultName), aJ: common_vendor.n(item.content.resultName === common_vendor.unref(labels).pass ? "result-tag--pass" : "result-tag--fail") } : { aK: common_vendor.t(fieldText(item, item.content.resultName)) }, { aL: item.content.remark || !item.completed }, item.content.remark || !item.completed ? { aM: common_vendor.t(common_vendor.unref(labels).verifyRemark), aN: common_vendor.t(fieldText(item, item.content.remark)) } : {}, { aO: item.content.attachments && item.content.attachments.length || !item.completed }, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({ aP: common_vendor.t(common_vendor.unref(labels).verifyAttachments), aQ: item.content.attachments && item.content.attachments.length }, item.content.attachments && item.content.attachments.length ? { aR: 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 }); }) } : { aS: common_vendor.t(fieldText(item, "")) }) : {}, { aT: item.content.signPath || !item.completed }, item.content.signPath || !item.completed ? common_vendor.e({ aU: common_vendor.t(common_vendor.unref(labels).verifySign), aV: item.content.signPath }, item.content.signPath ? { aW: resolveFileUrl(item.content.signPath), aX: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index), aY: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index) } : { aZ: common_vendor.t(fieldText(item, "")) }) : {}) : item.type === "writeoff_apply" ? common_vendor.e({ bb: common_vendor.t(common_vendor.unref(labels).writeoffDeadline), bc: common_vendor.t(fieldText(item, item.content.rectifyDeadline)), bd: common_vendor.t(common_vendor.unref(labels).responsibleDept), be: common_vendor.t(fieldText(item, item.content.responsibleDeptName)), bf: common_vendor.t(common_vendor.unref(labels).responsiblePerson), bg: common_vendor.t(fieldText(item, item.content.responsiblePerson)), bh: common_vendor.t(common_vendor.unref(labels).mainTreatment), bi: common_vendor.t(fieldText(item, item.content.mainTreatmentContent)), bj: common_vendor.t(common_vendor.unref(labels).treatmentResult), bk: common_vendor.t(fieldText(item, item.content.treatmentResult)), bl: common_vendor.t(common_vendor.unref(labels).selfVerify), bm: common_vendor.t(fieldText(item, item.content.selfVerifyContent)), bn: item.content.signPath || !item.completed }, item.content.signPath || !item.completed ? common_vendor.e({ bo: common_vendor.t(common_vendor.unref(labels).applySign), bp: item.content.signPath }, item.content.signPath ? { bq: resolveFileUrl(item.content.signPath), br: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index), bs: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index) } : { bt: common_vendor.t(fieldText(item, "")) }) : {}) : item.type === "approval" ? common_vendor.e({ bw: common_vendor.t(common_vendor.unref(labels).approvalOpinion), bx: item.completed && item.content.approveTypeName }, item.completed && item.content.approveTypeName ? { by: common_vendor.t(item.content.approveTypeName), bz: common_vendor.n(item.content.pass ? "result-tag--pass" : "result-tag--fail") } : { bA: common_vendor.t(fieldText(item, item.content.approveTypeName)) }, { bB: common_vendor.t(common_vendor.unref(labels).approvalComment), bC: common_vendor.t(fieldText(item, item.content.comment)), bD: isPendingText(item, item.content.comment) ? 1 : "", bE: common_vendor.t(common_vendor.unref(labels).smsReminder), bF: item.content.sendMsgFlag != null }, item.content.sendMsgFlag != null ? { bG: common_vendor.t(item.content.sendMsgFlag ? common_vendor.unref(labels).yes : common_vendor.unref(labels).no) } : { bH: common_vendor.t(fieldText(item, "")) }, { bI: item.content.signPath || !item.completed }, item.content.signPath || !item.completed ? common_vendor.e({ bJ: common_vendor.t(common_vendor.unref(labels).approvalSign), bK: item.content.signPath }, item.content.signPath ? { bL: resolveFileUrl(item.content.signPath), bM: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index), bN: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index) } : { bO: common_vendor.t(fieldText(item, "")) }) : {}) : {}, { Q: item.type === "assign", X: item.type === "rectify", aF: item.type === "verify" || item.type === "writeoff_approve", ba: item.type === "writeoff_apply", bv: item.type === "approval" }) : {}, { bP: common_vendor.unref(activeIndex) === index ? 1 : "", bQ: "node-" + index, bR: "process-node-" + index, bS: index === common_vendor.unref(historyList).length - 1 ? 1 : "" }); }), i: common_vendor.s(scrollAreaStyle.value), 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)), n: common_vendor.s(detailBodyStyle.value) }, { c: common_vendor.unref(historyList).length === 0, o: 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