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

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