880 lines
33 KiB
JavaScript
880 lines
33 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const request_api = require("../../request/api.js");
|
|
const request_request = require("../../request/request.js");
|
|
const utils_draftCache = require("../../utils/draftCache.js");
|
|
const utils_useDraftCache = require("../../utils/useDraftCache.js");
|
|
const utils_upload = require("../../utils/upload.js");
|
|
if (!Array) {
|
|
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
|
|
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
|
|
const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
|
|
const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
|
|
const _easycom_wd_signature2 = common_vendor.resolveComponent("wd-signature");
|
|
(_easycom_up_textarea2 + _easycom_up_upload2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_wd_signature2)();
|
|
}
|
|
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
|
|
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
|
|
const _easycom_up_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
|
|
const _easycom_up_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
|
|
const _easycom_wd_signature = () => "../../node-modules/wot-design-uni/components/wd-signature/wd-signature.js";
|
|
if (!Math) {
|
|
(_easycom_up_textarea + _easycom_up_upload + _easycom_up_radio + _easycom_up_radio_group + FlowAssigneePickerPopup + _easycom_wd_signature)();
|
|
}
|
|
const FlowAssigneePickerPopup = () => "../../components/flow/FlowAssigneePickerPopup.js";
|
|
const _sfc_main = {
|
|
__name: "acceptance",
|
|
setup(__props) {
|
|
const rectifyId = common_vendor.ref("");
|
|
const hazardId = common_vendor.ref("");
|
|
const assignId = common_vendor.ref("");
|
|
const taskId = common_vendor.ref("");
|
|
const nextStepName = common_vendor.ref("");
|
|
const nextStepLoading = common_vendor.ref(false);
|
|
const nextStepDisplay = common_vendor.computed(() => {
|
|
if (nextStepLoading.value)
|
|
return "加载中...";
|
|
return nextStepName.value || "暂无下一步流程";
|
|
});
|
|
const resolveTaskIdFromAssign = (assign) => {
|
|
if (!assign)
|
|
return "";
|
|
if (assign.taskId)
|
|
return String(assign.taskId);
|
|
if (assign.flowTaskId)
|
|
return String(assign.flowTaskId);
|
|
if (assign.currentTaskId)
|
|
return String(assign.currentTaskId);
|
|
return "";
|
|
};
|
|
const resolveAssignWithRectify = (assigns) => {
|
|
if (!(assigns == null ? void 0 : assigns.length))
|
|
return null;
|
|
if (rectifyId.value) {
|
|
const byRectifyId = assigns.find(
|
|
(item) => item.rectify && String(item.rectify.rectifyId) === String(rectifyId.value)
|
|
);
|
|
if (byRectifyId)
|
|
return byRectifyId;
|
|
}
|
|
if (assignId.value) {
|
|
const byAssignId = assigns.find(
|
|
(item) => String(item.assignId) === String(assignId.value) && item.rectify
|
|
);
|
|
if (byAssignId)
|
|
return byAssignId;
|
|
}
|
|
return assigns.find((item) => item.rectify) || null;
|
|
};
|
|
const resolveTaskIdFromDetail = (data) => {
|
|
if (!data)
|
|
return "";
|
|
if (data.taskId)
|
|
return String(data.taskId);
|
|
if (data.flowTaskId)
|
|
return String(data.flowTaskId);
|
|
if (data.currentTaskId)
|
|
return String(data.currentTaskId);
|
|
const assigns = data.assigns || [];
|
|
const matchedAssign = resolveAssignWithRectify(assigns);
|
|
const fromMatched = resolveTaskIdFromAssign(matchedAssign);
|
|
if (fromMatched)
|
|
return fromMatched;
|
|
for (const assign of assigns) {
|
|
const id = resolveTaskIdFromAssign(assign);
|
|
if (id)
|
|
return id;
|
|
}
|
|
return "";
|
|
};
|
|
const resolveNextTaskName = (data) => {
|
|
var _a;
|
|
if (!data)
|
|
return "";
|
|
const branches = data.branches || [];
|
|
const matchedBranch = branches.find((item) => item.matched) || branches[0];
|
|
return ((_a = matchedBranch == null ? void 0 : matchedBranch.nextNode) == null ? void 0 : _a.taskName) || "";
|
|
};
|
|
const buildPreviewVariables = () => {
|
|
if (formData.result === 2) {
|
|
return { pass: false };
|
|
}
|
|
if (hazardEndRadio.value === "yes") {
|
|
return { pass: true, hazardEnd: true };
|
|
}
|
|
return {
|
|
pass: true,
|
|
quickApprove: quickApproveRadio.value === "yes"
|
|
};
|
|
};
|
|
const rectifierDisplayName = common_vendor.computed(() => {
|
|
var _a;
|
|
return ((_a = rectifyData.rectifierName) == null ? void 0 : _a.trim()) || "暂无";
|
|
});
|
|
const showAssigneeSection = common_vendor.computed(() => {
|
|
if (formData.result === 1 && hazardEndRadio.value === "yes")
|
|
return false;
|
|
if (formData.result === 2)
|
|
return true;
|
|
if (formData.result === 1 && quickApproveRadio.value === "no")
|
|
return true;
|
|
return false;
|
|
});
|
|
const selectedAssigneeIdentityId = common_vendor.ref("");
|
|
const selectedAssigneeName = common_vendor.ref("");
|
|
const pickerAssigneeIdentityId = common_vendor.ref("");
|
|
const pickerAssigneeName = common_vendor.ref("");
|
|
const showAssigneePopup = common_vendor.ref(false);
|
|
const openAssigneePopup = () => {
|
|
if (!taskId.value) {
|
|
common_vendor.index.showToast({ title: "缺少任务ID", icon: "none" });
|
|
return;
|
|
}
|
|
pickerAssigneeIdentityId.value = selectedAssigneeIdentityId.value;
|
|
pickerAssigneeName.value = selectedAssigneeName.value;
|
|
showAssigneePopup.value = true;
|
|
};
|
|
const confirmAssigneeSelect = ({ identityId, name }) => {
|
|
selectedAssigneeIdentityId.value = identityId;
|
|
selectedAssigneeName.value = name;
|
|
showAssigneePopup.value = false;
|
|
};
|
|
const cancelAssigneeSelect = () => {
|
|
showAssigneePopup.value = false;
|
|
};
|
|
const onResultChange = (result) => {
|
|
formData.result = result;
|
|
if (result === 2) {
|
|
hazardEndRadio.value = "no";
|
|
selectedAssigneeIdentityId.value = "";
|
|
selectedAssigneeName.value = "";
|
|
} else if (!quickApproveRadio.value) {
|
|
quickApproveRadio.value = "yes";
|
|
}
|
|
fetchNextStep();
|
|
};
|
|
const onHazardEndChange = (value) => {
|
|
if (value === "yes") {
|
|
quickApproveRadio.value = "yes";
|
|
selectedAssigneeIdentityId.value = "";
|
|
selectedAssigneeName.value = "";
|
|
} else {
|
|
fetchNextStep();
|
|
}
|
|
};
|
|
const onQuickApproveChange = () => {
|
|
selectedAssigneeIdentityId.value = "";
|
|
selectedAssigneeName.value = "";
|
|
fetchNextStep();
|
|
};
|
|
const fetchNextStep = async () => {
|
|
if (formData.result === 1 && hazardEndRadio.value === "yes") {
|
|
nextStepName.value = "";
|
|
return;
|
|
}
|
|
nextStepLoading.value = true;
|
|
try {
|
|
const currentTaskId = taskId.value;
|
|
if (!currentTaskId) {
|
|
nextStepName.value = "";
|
|
return;
|
|
}
|
|
const res = await request_api.getFlowNextNodes({
|
|
taskId: currentTaskId,
|
|
previewVariables: buildPreviewVariables(),
|
|
includeSubProcess: true
|
|
});
|
|
if (res.code === 0) {
|
|
const payload = res.data && typeof res.data === "object" ? res.data : res;
|
|
nextStepName.value = resolveNextTaskName(payload);
|
|
} else {
|
|
nextStepName.value = "";
|
|
}
|
|
} catch (error) {
|
|
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:376", "获取下一步流程失败:", error);
|
|
nextStepName.value = "";
|
|
} finally {
|
|
nextStepLoading.value = false;
|
|
}
|
|
};
|
|
const rectifyData = common_vendor.reactive({
|
|
rectifyPlan: "",
|
|
rectificationMeasures: "",
|
|
controlMeasures: "",
|
|
rectifyResult: "",
|
|
planCost: null,
|
|
actualCost: null,
|
|
managerNames: [],
|
|
memberNames: [],
|
|
rectifierName: "",
|
|
rectifyStatusName: ""
|
|
});
|
|
const formatPersonNames = (names) => {
|
|
if (!names)
|
|
return "暂无";
|
|
if (Array.isArray(names)) {
|
|
const text = names.filter(Boolean).join("、");
|
|
return text || "暂无";
|
|
}
|
|
if (typeof names === "string") {
|
|
return names.trim() || "暂无";
|
|
}
|
|
return "暂无";
|
|
};
|
|
const formatMoney = (value) => {
|
|
if (value === null || value === void 0 || value === "") {
|
|
return "暂无";
|
|
}
|
|
const num = Number(value);
|
|
if (Number.isNaN(num)) {
|
|
return "暂无";
|
|
}
|
|
return `${num.toFixed(2)} 元`;
|
|
};
|
|
const rectifyAttachments = common_vendor.ref([]);
|
|
const hazardEndRadio = common_vendor.ref("no");
|
|
common_vendor.computed(() => hazardEndRadio.value === "yes");
|
|
const normalizeHazardEndRadio = (value) => value === "yes" ? "yes" : "no";
|
|
const quickApproveRadio = common_vendor.ref("yes");
|
|
const normalizeQuickApproveRadio = (value) => value === "no" ? "no" : "yes";
|
|
const formData = common_vendor.reactive({
|
|
result: 1,
|
|
// 验收结果 1.通过 2.不通过
|
|
verifyRemark: ""
|
|
// 验收备注
|
|
});
|
|
const fileList1 = common_vendor.ref([]);
|
|
const canvasWidth = common_vendor.ref(300);
|
|
const canvasHeight = common_vendor.ref(300);
|
|
const showCanvas = common_vendor.ref(true);
|
|
const signatureUrl = common_vendor.ref("");
|
|
const signatureServerPath = common_vendor.ref("");
|
|
const signatureWidth = common_vendor.ref(340);
|
|
const signatureRef = common_vendor.ref(null);
|
|
const isSignatureEmpty = common_vendor.ref(true);
|
|
const isSubmitting = common_vendor.ref(false);
|
|
const signaturePaths = common_vendor.ref([]);
|
|
const signatureLocalPath = common_vendor.ref("");
|
|
const isDraftExporting = common_vendor.ref(false);
|
|
let signatureExportTimer = null;
|
|
const applySignatureFromServer = (signPath) => {
|
|
const url = signPath ? utils_upload.toSubmitFileUrl(signPath) : "";
|
|
if (!url) {
|
|
showCanvas.value = true;
|
|
signatureServerPath.value = "";
|
|
signatureUrl.value = "";
|
|
signatureLocalPath.value = "";
|
|
isSignatureEmpty.value = true;
|
|
return;
|
|
}
|
|
signatureServerPath.value = url;
|
|
signatureUrl.value = url;
|
|
signatureLocalPath.value = "";
|
|
showCanvas.value = false;
|
|
isSignatureEmpty.value = false;
|
|
};
|
|
const applySignatureFromLocal = (localPath) => {
|
|
if (!localPath)
|
|
return;
|
|
signatureLocalPath.value = localPath;
|
|
signatureUrl.value = localPath;
|
|
signatureServerPath.value = "";
|
|
showCanvas.value = false;
|
|
isSignatureEmpty.value = false;
|
|
};
|
|
const acceptDraftHasContent = (data) => {
|
|
const form = data.formData || {};
|
|
return !!(form.verifyRemark || data.fileList1 && data.fileList1.length > 0 || data.signatureServerPath || data.signatureLocalPath || data.signaturePaths && data.signaturePaths.length > 0);
|
|
};
|
|
const {
|
|
showRestoreBanner,
|
|
clear: clearDraft,
|
|
restore: restoreDraft,
|
|
save: saveDraft,
|
|
bindAutoSave
|
|
} = utils_useDraftCache.useDraftCache({
|
|
getKey: () => utils_draftCache.buildDraftKey(utils_draftCache.DRAFT_NS.ACCEPT, rectifyId.value),
|
|
getFallbackKeys: () => {
|
|
const primary = utils_draftCache.buildDraftKey(utils_draftCache.DRAFT_NS.ACCEPT, rectifyId.value);
|
|
const compact = utils_draftCache.buildDraftKeyCompact(utils_draftCache.DRAFT_NS.ACCEPT, rectifyId.value);
|
|
return compact !== primary ? [compact] : [];
|
|
},
|
|
getPayload: () => ({
|
|
formData: {
|
|
result: formData.result,
|
|
verifyRemark: formData.verifyRemark,
|
|
hazardEndRadio: hazardEndRadio.value,
|
|
quickApproveRadio: quickApproveRadio.value
|
|
},
|
|
selectedAssigneeIdentityId: selectedAssigneeIdentityId.value,
|
|
selectedAssigneeName: selectedAssigneeName.value,
|
|
fileList1: fileList1.value,
|
|
signatureServerPath: signatureServerPath.value,
|
|
signatureUrl: signatureUrl.value,
|
|
signatureLocalPath: signatureLocalPath.value,
|
|
showCanvas: showCanvas.value,
|
|
signaturePaths: signaturePaths.value
|
|
// sendMsgFlagRadio: sendMsgFlagRadio.value
|
|
}),
|
|
hasContent: acceptDraftHasContent,
|
|
applyPayload: (data) => {
|
|
const form = data.formData || {};
|
|
formData.result = form.result !== void 0 ? form.result : 1;
|
|
formData.verifyRemark = form.verifyRemark || "";
|
|
hazardEndRadio.value = normalizeHazardEndRadio(form.hazardEndRadio ?? (form.hazardEnd === true ? "yes" : "no"));
|
|
quickApproveRadio.value = normalizeQuickApproveRadio(form.quickApproveRadio);
|
|
selectedAssigneeIdentityId.value = data.selectedAssigneeIdentityId || "";
|
|
selectedAssigneeName.value = data.selectedAssigneeName || "";
|
|
fileList1.value = data.fileList1 || [];
|
|
signaturePaths.value = data.signaturePaths || [];
|
|
if (data.signatureServerPath || data.signatureUrl) {
|
|
applySignatureFromServer(data.signatureServerPath || data.signatureUrl);
|
|
} else if (data.signatureLocalPath) {
|
|
applySignatureFromLocal(data.signatureLocalPath);
|
|
} else {
|
|
showCanvas.value = data.showCanvas !== void 0 ? data.showCanvas : true;
|
|
signatureServerPath.value = "";
|
|
signatureUrl.value = "";
|
|
signatureLocalPath.value = "";
|
|
isSignatureEmpty.value = true;
|
|
}
|
|
},
|
|
clearForm: () => {
|
|
formData.result = 1;
|
|
formData.verifyRemark = "";
|
|
hazardEndRadio.value = "no";
|
|
quickApproveRadio.value = "yes";
|
|
selectedAssigneeIdentityId.value = "";
|
|
selectedAssigneeName.value = "";
|
|
fileList1.value = [];
|
|
signatureServerPath.value = "";
|
|
signatureUrl.value = "";
|
|
signatureLocalPath.value = "";
|
|
showCanvas.value = true;
|
|
signaturePaths.value = [];
|
|
if (signatureRef.value) {
|
|
signatureRef.value.clear();
|
|
}
|
|
},
|
|
canSave: () => !!rectifyId.value,
|
|
requireInitialized: true,
|
|
onAfterRestore: (data) => {
|
|
var _a;
|
|
fetchNextStep();
|
|
if (data.signatureServerPath || data.signatureUrl || data.signatureLocalPath) {
|
|
return;
|
|
}
|
|
if (((_a = data.signaturePaths) == null ? void 0 : _a.length) > 0) {
|
|
setTimeout(() => {
|
|
if (signatureRef.value) {
|
|
isSignatureEmpty.value = false;
|
|
}
|
|
}, 450);
|
|
}
|
|
}
|
|
});
|
|
bindAutoSave(() => [
|
|
formData.result,
|
|
formData.verifyRemark,
|
|
hazardEndRadio.value,
|
|
quickApproveRadio.value,
|
|
selectedAssigneeIdentityId.value,
|
|
selectedAssigneeName.value,
|
|
fileList1.value,
|
|
signatureServerPath.value,
|
|
signatureUrl.value,
|
|
signatureLocalPath.value,
|
|
showCanvas.value,
|
|
signaturePaths.value
|
|
// sendMsgFlagRadio.value
|
|
]);
|
|
const getFullPath = (filePath) => {
|
|
if (!filePath)
|
|
return "";
|
|
if (filePath.startsWith("http://") || filePath.startsWith("https://")) {
|
|
return request_request.toImageUrl(filePath);
|
|
}
|
|
return request_request.toImageUrl(filePath);
|
|
};
|
|
const previewImage = (index) => {
|
|
const urls = rectifyAttachments.value.map((item) => getFullPath(item.filePath));
|
|
common_vendor.index.previewImage({
|
|
current: index,
|
|
urls
|
|
});
|
|
};
|
|
const mapPersonListToNickNames = (people) => {
|
|
if (!Array.isArray(people) || people.length === 0)
|
|
return [];
|
|
const names = people.map((person) => person.nickName || person.userName || person.name || "").filter(Boolean);
|
|
return [...new Set(names)];
|
|
};
|
|
const resolveManagerNames = (rectify) => {
|
|
if (Array.isArray(rectify.managers) && rectify.managers.length > 0) {
|
|
return mapPersonListToNickNames(rectify.managers);
|
|
}
|
|
return rectify.managerNames || [];
|
|
};
|
|
const resolveMemberNames = (rectify) => {
|
|
if (Array.isArray(rectify.members) && rectify.members.length > 0) {
|
|
return mapPersonListToNickNames(rectify.members);
|
|
}
|
|
return rectify.memberNames || [];
|
|
};
|
|
const applyRectifyData = (rectify) => {
|
|
if (!rectify)
|
|
return;
|
|
rectifyData.rectifyPlan = rectify.rectifyPlan || "";
|
|
rectifyData.rectificationMeasures = rectify.rectificationMeasures || "";
|
|
rectifyData.controlMeasures = rectify.controlMeasures || "";
|
|
rectifyData.rectifyResult = rectify.rectifyResult || "";
|
|
rectifyData.planCost = rectify.planCost ?? null;
|
|
rectifyData.actualCost = rectify.actualCost ?? null;
|
|
rectifyData.managerNames = resolveManagerNames(rectify);
|
|
rectifyData.memberNames = resolveMemberNames(rectify);
|
|
rectifyData.rectifierName = rectify.rectifierName || "";
|
|
rectifyData.rectifyStatusName = rectify.rectifyStatusName || rectify.statusName || "";
|
|
rectifyAttachments.value = rectify.attachments || [];
|
|
};
|
|
const fetchRectifyDetail = async () => {
|
|
if (!rectifyId.value)
|
|
return;
|
|
try {
|
|
const res = await request_api.getRectifyDetail({ rectifyId: rectifyId.value });
|
|
if (res.code === 0 && res.data) {
|
|
applyRectifyData(res.data);
|
|
if (!hazardId.value && res.data.hazardId) {
|
|
hazardId.value = String(res.data.hazardId);
|
|
}
|
|
if (!assignId.value && res.data.assignId) {
|
|
assignId.value = String(res.data.assignId);
|
|
}
|
|
const resolvedTaskId = resolveTaskIdFromDetail(res.data);
|
|
if (resolvedTaskId) {
|
|
taskId.value = resolvedTaskId;
|
|
}
|
|
} else {
|
|
common_vendor.index.showToast({ title: res.msg || "获取整改详情失败", icon: "none" });
|
|
}
|
|
} catch (error) {
|
|
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:682", "获取整改详情失败:", error);
|
|
common_vendor.index.showToast({ title: "获取整改详情失败", icon: "none" });
|
|
}
|
|
};
|
|
const fetchDetail = async () => {
|
|
if (!hazardId.value)
|
|
return;
|
|
try {
|
|
const res = await request_api.getHiddenDangerDetail({
|
|
hazardId: hazardId.value,
|
|
assignId: assignId.value
|
|
});
|
|
if (res.code === 0 && res.data) {
|
|
const assign = resolveAssignWithRectify(res.data.assigns);
|
|
if (assign == null ? void 0 : assign.rectify) {
|
|
applyRectifyData(assign.rectify);
|
|
if (!rectifyId.value && assign.rectify.rectifyId) {
|
|
rectifyId.value = String(assign.rectify.rectifyId);
|
|
}
|
|
} else {
|
|
common_vendor.index.showToast({ title: "该隐患暂无整改记录", icon: "none" });
|
|
}
|
|
const resolvedTaskId = resolveTaskIdFromAssign(assign) || resolveTaskIdFromDetail(res.data);
|
|
if (resolvedTaskId) {
|
|
taskId.value = resolvedTaskId;
|
|
}
|
|
} else {
|
|
common_vendor.index.showToast({ title: res.msg || "获取详情失败", icon: "none" });
|
|
}
|
|
} catch (error) {
|
|
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:714", "获取隐患详情失败:", error);
|
|
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
|
|
}
|
|
};
|
|
const loadPageData = async () => {
|
|
if (rectifyId.value) {
|
|
await fetchRectifyDetail();
|
|
} else if (hazardId.value) {
|
|
await fetchDetail();
|
|
}
|
|
await fetchNextStep();
|
|
};
|
|
const validateFormBeforeSubmit = () => {
|
|
if (formData.result === 1 && hazardEndRadio.value === "yes") {
|
|
return true;
|
|
}
|
|
if (formData.result === 1 && !quickApproveRadio.value) {
|
|
common_vendor.index.showToast({ title: "请选择是否快速审批", icon: "none" });
|
|
return false;
|
|
}
|
|
if (formData.result === 1 && quickApproveRadio.value === "no" && !selectedAssigneeIdentityId.value) {
|
|
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
const handleCancel = () => {
|
|
common_vendor.index.navigateBack();
|
|
};
|
|
const handleSubmit = async () => {
|
|
if (!rectifyId.value) {
|
|
common_vendor.index.showToast({
|
|
title: "缺少整改ID",
|
|
icon: "none"
|
|
});
|
|
return;
|
|
}
|
|
if (!validateFormBeforeSubmit()) {
|
|
return;
|
|
}
|
|
if (showCanvas.value) {
|
|
if (!signatureRef.value || isSignatureEmpty.value) {
|
|
common_vendor.index.showToast({
|
|
title: "请进行电子签名",
|
|
icon: "none"
|
|
});
|
|
return;
|
|
}
|
|
isSubmitting.value = true;
|
|
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
|
|
signatureRef.value.confirm();
|
|
} else {
|
|
if (!signatureServerPath.value && !signatureLocalPath.value) {
|
|
common_vendor.index.showToast({
|
|
title: "请进行电子签名",
|
|
icon: "none"
|
|
});
|
|
return;
|
|
}
|
|
isSubmitting.value = true;
|
|
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
|
|
try {
|
|
if (!signatureServerPath.value && signatureLocalPath.value) {
|
|
const { url } = await utils_upload.uploadToCloud(signatureLocalPath.value);
|
|
applySignatureFromServer(url);
|
|
}
|
|
await executeSubmit();
|
|
} catch (err) {
|
|
isSubmitting.value = false;
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:796", "签名上传失败:", err);
|
|
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
|
|
}
|
|
}
|
|
};
|
|
const executeSubmit = async () => {
|
|
const attachments = fileList1.value.filter((f) => f.status === "success").map((file) => utils_upload.buildAttachmentItem(file));
|
|
const params = {
|
|
rectifyId: Number(rectifyId.value),
|
|
result: formData.result,
|
|
verifyRemark: formData.verifyRemark || "",
|
|
attachments,
|
|
signPath: signatureServerPath.value || "",
|
|
// 电子签名路径
|
|
hazardEnd: formData.result === 1 && hazardEndRadio.value === "yes"
|
|
// sendMsgFlag: sendMsgFlag.value
|
|
};
|
|
if (formData.result === 1) {
|
|
if (hazardEndRadio.value === "yes") {
|
|
params.quickApprove = null;
|
|
} else {
|
|
params.quickApprove = quickApproveRadio.value === "yes";
|
|
if (quickApproveRadio.value === "no") {
|
|
params.assigneeIdentityId = selectedAssigneeIdentityId.value;
|
|
}
|
|
}
|
|
}
|
|
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:830", "提交验收参数:", params);
|
|
try {
|
|
const res = await request_api.acceptanceRectification(params);
|
|
common_vendor.index.hideLoading();
|
|
if (res.code === 0) {
|
|
clearDraft(false);
|
|
common_vendor.index.showToast({
|
|
title: "验收成功",
|
|
icon: "success"
|
|
});
|
|
setTimeout(() => {
|
|
common_vendor.index.navigateBack();
|
|
}, 1500);
|
|
} else {
|
|
common_vendor.index.showToast({
|
|
title: res.msg || "验收失败",
|
|
icon: "none"
|
|
});
|
|
}
|
|
} catch (error) {
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:852", "验收失败:", error);
|
|
common_vendor.index.showToast({
|
|
title: "请求失败",
|
|
icon: "none"
|
|
});
|
|
} finally {
|
|
isSubmitting.value = false;
|
|
}
|
|
};
|
|
const acceptUploadInstance = common_vendor.getCurrentInstance();
|
|
const { afterRead, deletePic } = utils_upload.createUploadListHandlers(fileList1, {
|
|
watermark: {
|
|
canvasId: "watermarkCanvas",
|
|
canvasWidthRef: canvasWidth,
|
|
canvasHeightRef: canvasHeight,
|
|
instance: acceptUploadInstance
|
|
}
|
|
});
|
|
const onSignatureStart = () => {
|
|
isSignatureEmpty.value = false;
|
|
};
|
|
const onSignatureSigning = () => {
|
|
isSignatureEmpty.value = false;
|
|
};
|
|
const onSignatureClear = () => {
|
|
isSignatureEmpty.value = true;
|
|
signatureLocalPath.value = "";
|
|
};
|
|
const scheduleSignatureDraftExport = () => {
|
|
clearTimeout(signatureExportTimer);
|
|
signatureExportTimer = setTimeout(() => {
|
|
if (!showCanvas.value || isSignatureEmpty.value || !signatureRef.value || isSubmitting.value || isDraftExporting.value) {
|
|
return;
|
|
}
|
|
isDraftExporting.value = true;
|
|
signatureRef.value.confirm();
|
|
}, 600);
|
|
};
|
|
const onSignatureEnd = () => {
|
|
isSignatureEmpty.value = false;
|
|
scheduleSignatureDraftExport();
|
|
};
|
|
const clearSignature = () => {
|
|
clearTimeout(signatureExportTimer);
|
|
isSignatureEmpty.value = true;
|
|
signatureLocalPath.value = "";
|
|
if (signatureRef.value) {
|
|
signatureRef.value.clear();
|
|
}
|
|
};
|
|
const reSign = () => {
|
|
clearTimeout(signatureExportTimer);
|
|
isSignatureEmpty.value = true;
|
|
showCanvas.value = true;
|
|
signatureUrl.value = "";
|
|
signatureServerPath.value = "";
|
|
signatureLocalPath.value = "";
|
|
common_vendor.nextTick$1(() => {
|
|
if (signatureRef.value) {
|
|
signatureRef.value.clear();
|
|
}
|
|
});
|
|
};
|
|
const onSignatureConfirm = async (tempFilePath) => {
|
|
if (isDraftExporting.value) {
|
|
isDraftExporting.value = false;
|
|
applySignatureFromLocal(tempFilePath);
|
|
saveDraft();
|
|
return;
|
|
}
|
|
try {
|
|
const { url } = await utils_upload.uploadToCloud(tempFilePath);
|
|
applySignatureFromServer(url);
|
|
saveDraft();
|
|
if (isSubmitting.value) {
|
|
await executeSubmit();
|
|
}
|
|
} catch (err) {
|
|
isSubmitting.value = false;
|
|
common_vendor.index.hideLoading();
|
|
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:961", "签名上传失败:", err);
|
|
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
|
|
}
|
|
};
|
|
common_vendor.onHide(() => {
|
|
if (showCanvas.value && !isSignatureEmpty.value && signatureRef.value && !isDraftExporting.value) {
|
|
isDraftExporting.value = true;
|
|
signatureRef.value.confirm();
|
|
}
|
|
saveDraft();
|
|
});
|
|
common_vendor.onLoad((options) => {
|
|
try {
|
|
const sysInfo = common_vendor.index.getSystemInfoSync();
|
|
signatureWidth.value = sysInfo.windowWidth - 40;
|
|
} catch (e) {
|
|
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:980", "获取系统信息失败:", e);
|
|
}
|
|
if (options.rectifyId) {
|
|
rectifyId.value = options.rectifyId;
|
|
}
|
|
if (options.hazardId) {
|
|
hazardId.value = options.hazardId;
|
|
}
|
|
if (options.assignId) {
|
|
assignId.value = options.assignId;
|
|
}
|
|
if (options.taskId) {
|
|
taskId.value = options.taskId;
|
|
}
|
|
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:994", "验收页面参数:", { rectifyId: rectifyId.value, hazardId: hazardId.value, assignId: assignId.value, taskId: taskId.value });
|
|
loadPageData();
|
|
restoreDraft();
|
|
common_vendor.nextTick$1(() => {
|
|
hazardEndRadio.value = normalizeHazardEndRadio(hazardEndRadio.value);
|
|
quickApproveRadio.value = normalizeQuickApproveRadio(quickApproveRadio.value);
|
|
});
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(rectifyData.rectifyPlan || "暂无"),
|
|
b: common_vendor.t(rectifyData.rectificationMeasures || "暂无"),
|
|
c: common_vendor.t(rectifyData.controlMeasures || "暂无"),
|
|
d: common_vendor.t(rectifyData.rectifyResult || "暂无"),
|
|
e: common_vendor.t(formatMoney(rectifyData.planCost)),
|
|
f: common_vendor.t(formatMoney(rectifyData.actualCost)),
|
|
g: common_vendor.t(formatPersonNames(rectifyData.managerNames)),
|
|
h: common_vendor.t(formatPersonNames(rectifyData.memberNames)),
|
|
i: common_vendor.t(rectifyData.rectifyStatusName || "暂无"),
|
|
j: rectifyAttachments.value.length > 0
|
|
}, rectifyAttachments.value.length > 0 ? {
|
|
k: common_vendor.f(rectifyAttachments.value, (img, idx, i0) => {
|
|
return {
|
|
a: idx,
|
|
b: getFullPath(img.filePath),
|
|
c: common_vendor.o(($event) => previewImage(idx), idx)
|
|
};
|
|
})
|
|
} : {}, {
|
|
l: common_vendor.n(formData.result === 1 ? "active" : ""),
|
|
m: common_vendor.o(($event) => onResultChange(1)),
|
|
n: common_vendor.n(formData.result === 2 ? "active" : ""),
|
|
o: common_vendor.o(($event) => onResultChange(2)),
|
|
p: common_vendor.o(($event) => formData.verifyRemark = $event),
|
|
q: common_vendor.p({
|
|
placeholder: "请输入验收备注",
|
|
modelValue: formData.verifyRemark
|
|
}),
|
|
r: common_vendor.o(common_vendor.unref(afterRead)),
|
|
s: common_vendor.o(common_vendor.unref(deletePic)),
|
|
t: common_vendor.p({
|
|
fileList: fileList1.value,
|
|
name: "1",
|
|
multiple: true,
|
|
imageMode: "aspectFill",
|
|
maxCount: 10
|
|
}),
|
|
v: formData.result === 1
|
|
}, formData.result === 1 ? {
|
|
w: common_vendor.p({
|
|
label: "否",
|
|
name: "no",
|
|
customStyle: {
|
|
marginRight: "48rpx"
|
|
}
|
|
}),
|
|
x: common_vendor.p({
|
|
label: "是",
|
|
name: "yes"
|
|
}),
|
|
y: "hazard-end-" + hazardEndRadio.value,
|
|
z: common_vendor.o(onHazardEndChange),
|
|
A: common_vendor.o(($event) => hazardEndRadio.value = $event),
|
|
B: common_vendor.p({
|
|
placement: "row",
|
|
activeColor: "#2667e9",
|
|
modelValue: hazardEndRadio.value
|
|
})
|
|
} : {}, {
|
|
C: formData.result === 1 && hazardEndRadio.value !== "yes"
|
|
}, formData.result === 1 && hazardEndRadio.value !== "yes" ? {
|
|
D: common_vendor.p({
|
|
label: "是",
|
|
name: "yes",
|
|
customStyle: {
|
|
marginRight: "48rpx"
|
|
}
|
|
}),
|
|
E: common_vendor.p({
|
|
label: "否",
|
|
name: "no"
|
|
}),
|
|
F: "quick-approve-" + quickApproveRadio.value,
|
|
G: common_vendor.o(onQuickApproveChange),
|
|
H: common_vendor.o(($event) => quickApproveRadio.value = $event),
|
|
I: common_vendor.p({
|
|
placement: "row",
|
|
activeColor: "#2667e9",
|
|
modelValue: quickApproveRadio.value
|
|
})
|
|
} : {}, {
|
|
J: canvasWidth.value,
|
|
K: canvasHeight.value,
|
|
L: canvasWidth.value + "px",
|
|
M: canvasHeight.value + "px",
|
|
N: !(formData.result === 1 && hazardEndRadio.value === "yes")
|
|
}, !(formData.result === 1 && hazardEndRadio.value === "yes") ? {} : {}, {
|
|
O: !(formData.result === 1 && hazardEndRadio.value === "yes")
|
|
}, !(formData.result === 1 && hazardEndRadio.value === "yes") ? {
|
|
P: common_vendor.t(nextStepDisplay.value)
|
|
} : {}, {
|
|
Q: showAssigneeSection.value
|
|
}, showAssigneeSection.value ? common_vendor.e({
|
|
R: formData.result === 2
|
|
}, formData.result === 2 ? {
|
|
S: common_vendor.t(rectifierDisplayName.value)
|
|
} : {
|
|
T: common_vendor.t(selectedAssigneeName.value || "请选择下一步处理人"),
|
|
U: !selectedAssigneeName.value ? 1 : "",
|
|
V: common_vendor.o(openAssigneePopup)
|
|
}) : {}, {
|
|
W: common_vendor.o(cancelAssigneeSelect),
|
|
X: common_vendor.o(confirmAssigneeSelect),
|
|
Y: common_vendor.o(($event) => pickerAssigneeIdentityId.value = $event),
|
|
Z: common_vendor.o(($event) => pickerAssigneeName.value = $event),
|
|
aa: common_vendor.p({
|
|
show: showAssigneePopup.value,
|
|
["task-id"]: taskId.value,
|
|
["picker-identity-id"]: pickerAssigneeIdentityId.value,
|
|
["picker-name"]: pickerAssigneeName.value
|
|
}),
|
|
ab: showCanvas.value
|
|
}, showCanvas.value ? {
|
|
ac: common_vendor.o(clearSignature)
|
|
} : {
|
|
ad: common_vendor.o(reSign)
|
|
}, {
|
|
ae: !showCanvas.value
|
|
}, !showCanvas.value ? common_vendor.e({
|
|
af: signatureUrl.value
|
|
}, signatureUrl.value ? {
|
|
ag: signatureUrl.value
|
|
} : {}) : {}, {
|
|
ah: showCanvas.value && !showAssigneePopup.value
|
|
}, showCanvas.value && !showAssigneePopup.value ? {
|
|
ai: common_vendor.sr(signatureRef, "39f9b795-9", {
|
|
"k": "signatureRef"
|
|
}),
|
|
aj: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
|
|
ak: common_vendor.o(onSignatureStart),
|
|
al: common_vendor.o(onSignatureSigning),
|
|
am: common_vendor.o(onSignatureEnd),
|
|
an: common_vendor.o(onSignatureClear),
|
|
ao: common_vendor.p({
|
|
width: signatureWidth.value,
|
|
height: 160,
|
|
backgroundColor: "#f8f8f8",
|
|
penColor: "#000000",
|
|
lineWidth: 3,
|
|
enableHistory: false
|
|
})
|
|
} : {}, {
|
|
ap: common_vendor.o(handleCancel),
|
|
aq: common_vendor.o(handleSubmit),
|
|
ar: common_vendor.gei(_ctx, "")
|
|
});
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-39f9b795"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/hiddendanger/acceptance.js.map
|