v1.2.1版本,优化调整了很多,整改验收阶段新加字段

This commit is contained in:
王利强
2026-06-13 08:50:51 +08:00
parent 2af9f1fd59
commit 1fe87ec438
591 changed files with 5072 additions and 2706 deletions

View File

@@ -1,29 +1,26 @@
"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_watermark = require("../../utils/watermark.js");
const utils_upload = require("../../utils/upload.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_datetime_picker2 = common_vendor.resolveComponent("up-datetime-picker");
const _easycom_up_checkbox2 = common_vendor.resolveComponent("up-checkbox");
const _easycom_up_checkbox_group2 = common_vendor.resolveComponent("up-checkbox-group");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
const _easycom_wd_signature2 = common_vendor.resolveComponent("wd-signature");
(_easycom_up_textarea2 + _easycom_up_input2 + _easycom_up_datetime_picker2 + _easycom_up_checkbox2 + _easycom_up_checkbox_group2 + _easycom_u_popup2 + _easycom_up_upload2 + _easycom_wd_signature2)();
(_easycom_up_textarea2 + _easycom_up_input2 + _easycom_up_datetime_picker2 + _easycom_up_checkbox2 + _easycom_u_popup2 + _easycom_up_upload2 + _easycom_wd_signature2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_datetime_picker = () => "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
const _easycom_up_checkbox = () => "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox.js";
const _easycom_up_checkbox_group = () => "../../uni_modules/uview-plus/components/u-checkbox-group/u-checkbox-group.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
const _easycom_wd_signature = () => "../../node-modules/wot-design-uni/components/wd-signature/wd-signature.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_input + _easycom_up_datetime_picker + _easycom_up_checkbox + _easycom_up_checkbox_group + _easycom_u_popup + _easycom_up_upload + _easycom_wd_signature)();
(_easycom_up_textarea + _easycom_up_input + _easycom_up_datetime_picker + _easycom_up_checkbox + _easycom_u_popup + _easycom_up_upload + _easycom_wd_signature)();
}
const _sfc_main = {
__name: "rectification",
@@ -47,6 +44,29 @@ const _sfc_main = {
signatureRef.value.clear();
}
};
const resolveSignPathFromData = (data) => {
if (!data)
return "";
return data.signPath || data.signUrl || data.signature || data.signatureUrl || data.signaturePath || "";
};
const applySignatureFromServer = (signPath) => {
const url = signPath ? utils_upload.toSubmitFileUrl(signPath) : "";
if (!url) {
showCanvas.value = true;
signatureServerPath.value = "";
signatureUrl.value = "";
isSignatureEmpty.value = true;
return;
}
signatureServerPath.value = url;
signatureUrl.value = url;
showCanvas.value = false;
isSignatureEmpty.value = false;
};
const onSignatureImageError = () => {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:321", "签名图片加载失败:", signatureUrl.value);
common_vendor.index.showToast({ title: "签名图片加载失败", icon: "none" });
};
const reSign = () => {
isSignatureEmpty.value = true;
showCanvas.value = true;
@@ -61,6 +81,10 @@ const _sfc_main = {
const formData = common_vendor.reactive({
rectifyPlan: "",
// 整改方案
rectificationMeasures: "",
// 整改措施
controlMeasures: "",
// 管控措施
rectifyResult: "",
// 整改完成情况
planCost: "",
@@ -68,140 +92,309 @@ const _sfc_main = {
actualCost: ""
// 投资资金(实际)
});
const show = common_vendor.ref(false);
const value1 = common_vendor.ref(Date.now());
common_vendor.ref("");
const cateList = common_vendor.ref([]);
const selectedDeadlineDate = common_vendor.ref("");
const showRectifyTimePicker = common_vendor.ref(false);
const rectifyTimeValue = common_vendor.ref(Date.now());
const selectedRectifyTime = common_vendor.ref("");
const formatDateValue = (timestamp) => {
if (!timestamp)
return "";
const date = new Date(timestamp);
if (Number.isNaN(date.getTime()))
return "";
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
const parseDeadlineToTimestamp = (deadline) => {
if (!deadline)
return null;
const decoded = decodeURIComponent(String(deadline)).trim();
const normalized = decoded.replace("T", " ").replace(/-/g, "/");
const ts = new Date(normalized).getTime();
return Number.isNaN(ts) ? null : ts;
};
const applyDeadlineFromOptions = (deadline) => {
const ts = parseDeadlineToTimestamp(deadline);
if (ts) {
selectedDeadlineDate.value = formatDateValue(ts);
} else if (deadline) {
selectedDeadlineDate.value = String(deadline).trim().replace("T", " ");
}
};
const parseIdList = (raw) => {
if (raw === null || raw === void 0 || raw === "")
return [];
if (Array.isArray(raw)) {
return raw.map((id) => String(id)).filter(Boolean);
}
return String(raw).split(",").map((id) => String(id).trim()).filter(Boolean);
};
const resolveManagerIdsFromDetail = (data) => {
const ids = parseIdList(data.manageIds ?? data.managerIds);
if (ids.length > 0)
return ids;
if (Array.isArray(data.managers) && data.managers.length > 0) {
return data.managers.map((item) => String(item.userId)).filter(Boolean);
}
return [];
};
const buildUserItemFromDetail = (user) => ({
id: String(user.userId),
name: formatUserDisplayName(user),
deptName: user.deptName || ""
});
const getUsersByIdsFromTree = (ids, tree) => {
const userMap = /* @__PURE__ */ new Map();
(tree || []).forEach((dept) => {
(dept.users || []).forEach((user) => {
userMap.set(String(user.userId), buildUserItem(user, dept));
});
});
return ids.map((id) => userMap.get(String(id))).filter(Boolean);
};
const mergeUsersFromDetailPool = (ids, resolvedUsers) => {
const userMap = new Map(resolvedUsers.map((user) => [user.id, user]));
ids.forEach((id) => {
const key = String(id);
if (userMap.has(key))
return;
const found = detailPersonPool.value.find((user) => String(user.userId) === key);
if (found) {
userMap.set(key, buildUserItemFromDetail(found));
}
});
return ids.map((id) => userMap.get(String(id))).filter(Boolean);
};
const applyRectifyTimeValue = (timeStr) => {
const ts = parseDeadlineToTimestamp(timeStr);
if (ts) {
rectifyTimeValue.value = ts;
selectedRectifyTime.value = formatDateValue(ts);
} else if (timeStr) {
selectedRectifyTime.value = String(timeStr).trim().replace("T", " ");
}
};
const initRectifyTimeDefault = () => {
rectifyTimeValue.value = Date.now();
selectedRectifyTime.value = formatDateValue(rectifyTimeValue.value);
};
const onRectifyTimeConfirm = (e) => {
rectifyTimeValue.value = e.value;
selectedRectifyTime.value = formatDateValue(e.value);
showRectifyTimePicker.value = false;
};
const managerDeptList = common_vendor.ref([]);
const deptList = common_vendor.ref([]);
const detailPersonPool = common_vendor.ref([]);
const showManagerPopup = common_vendor.ref(false);
const selectedManagerIds = common_vendor.ref([]);
const selectedManagers = common_vendor.ref([]);
const activeManagerDeptIndex = common_vendor.ref(0);
const managerPickerSelectedIds = common_vendor.ref([]);
const showUserPopup = common_vendor.ref(false);
const selectedUserIds = common_vendor.ref([]);
const selectedUsers = common_vendor.ref([]);
const selectedUsersText = common_vendor.computed(() => {
if (selectedUsers.value.length === 0)
return "";
if (selectedUsers.value.length <= 2) {
return selectedUsers.value.map((u) => u.name).join("、");
const activeDeptIndex = common_vendor.ref(0);
const userPickerSelectedIds = common_vendor.ref([]);
const formatUserDisplayName = (user) => {
if (user.postName) {
return `${user.nickName}_${user.postName}`;
}
return `${selectedUsers.value[0].name}${selectedUsers.value.length}`;
return user.nickName || "";
};
const buildUserItem = (user, dept) => ({
id: String(user.userId),
name: formatUserDisplayName(user),
deptName: dept.deptName
});
const onUserChange = (ids) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:211", "选中的ID:", ids);
const buildSelectedPersonText = (users) => {
if (users.length === 0)
return "";
if (users.length <= 2) {
return users.map((u) => u.name).join("、");
}
return `${users[0].name}${users.length}`;
};
const selectedManagersText = common_vendor.computed(() => buildSelectedPersonText(selectedManagers.value));
const selectedUsersText = common_vendor.computed(() => buildSelectedPersonText(selectedUsers.value));
const currentManagerDeptUsers = common_vendor.computed(() => {
const dept = managerDeptList.value[activeManagerDeptIndex.value];
return (dept == null ? void 0 : dept.users) || [];
});
const managerPickerSelectedText = common_vendor.computed(() => {
const users = getManagerUsersByIds(managerPickerSelectedIds.value);
return buildSelectedPersonText(users);
});
const managerPickerSelectedSet = common_vendor.computed(() => {
return new Set(managerPickerSelectedIds.value.map((id) => String(id)));
});
const currentDeptUsers = common_vendor.computed(() => {
const dept = deptList.value[activeDeptIndex.value];
return (dept == null ? void 0 : dept.users) || [];
});
const userPickerSelectedText = common_vendor.computed(() => {
const users = getUsersByIds(userPickerSelectedIds.value);
return buildSelectedPersonText(users);
});
const userPickerSelectedSet = common_vendor.computed(() => {
return new Set(userPickerSelectedIds.value.map((id) => String(id)));
});
const getManagerUsersByIds = (ids) => {
let users = getUsersByIdsFromTree(ids, managerDeptList.value);
if (users.length < ids.length) {
const userDeptUsers = getUsersByIdsFromTree(ids, deptList.value);
const userMap = new Map(users.map((user) => [user.id, user]));
userDeptUsers.forEach((user) => {
if (!userMap.has(user.id))
userMap.set(user.id, user);
});
users = ids.map((id) => userMap.get(String(id))).filter(Boolean);
}
return mergeUsersFromDetailPool(ids, users);
};
const getUsersByIds = (ids) => {
let users = getUsersByIdsFromTree(ids, deptList.value);
return mergeUsersFromDetailPool(ids, users);
};
const syncSelectedManagersFromIds = (ids) => {
selectedManagers.value = getManagerUsersByIds(ids);
};
const syncSelectedUsersFromIds = (ids) => {
selectedUsers.value = getUsersByIds(ids);
};
const getManagerDeptSelectedCount = (dept) => {
var _a;
if (!((_a = dept.users) == null ? void 0 : _a.length))
return 0;
const selectedSet = new Set(managerPickerSelectedIds.value.map(String));
return dept.users.filter((user) => selectedSet.has(String(user.userId))).length;
};
const getDeptSelectedCount = (dept) => {
var _a;
if (!((_a = dept.users) == null ? void 0 : _a.length))
return 0;
const selectedSet = new Set(userPickerSelectedIds.value.map(String));
return dept.users.filter((user) => selectedSet.has(String(user.userId))).length;
};
function onManagerCheckChange(userId, checked) {
const id = String(userId);
if (checked) {
if (!managerPickerSelectedSet.value.has(id)) {
managerPickerSelectedIds.value = [...managerPickerSelectedIds.value, id];
}
return;
}
managerPickerSelectedIds.value = managerPickerSelectedIds.value.filter((item) => String(item) !== id);
}
function onUserCheckChange(userId, checked) {
const id = String(userId);
if (checked) {
if (!userPickerSelectedSet.value.has(id)) {
userPickerSelectedIds.value = [...userPickerSelectedIds.value, id];
}
return;
}
userPickerSelectedIds.value = userPickerSelectedIds.value.filter((item) => String(item) !== id);
}
const openManagerPopup = () => {
managerPickerSelectedIds.value = [...selectedManagerIds.value];
const firstDeptWithUsers = managerDeptList.value.findIndex((dept) => {
var _a;
return ((_a = dept.users) == null ? void 0 : _a.length) > 0;
});
activeManagerDeptIndex.value = firstDeptWithUsers >= 0 ? firstDeptWithUsers : 0;
showManagerPopup.value = true;
};
const cancelManagerSelect = () => {
showManagerPopup.value = false;
};
const openUserPopup = () => {
userPickerSelectedIds.value = [...selectedUserIds.value];
const firstDeptWithUsers = deptList.value.findIndex((dept) => {
var _a;
return ((_a = dept.users) == null ? void 0 : _a.length) > 0;
});
activeDeptIndex.value = firstDeptWithUsers >= 0 ? firstDeptWithUsers : 0;
showUserPopup.value = true;
};
const cancelUserSelect = () => {
showUserPopup.value = false;
};
const confirmManagerSelect = () => {
selectedManagerIds.value = managerPickerSelectedIds.value.map((id) => String(id));
syncSelectedManagersFromIds(selectedManagerIds.value);
showManagerPopup.value = false;
};
const confirmUserSelect = () => {
selectedUsers.value = cateList.value.filter((item) => selectedUserIds.value.includes(item.id));
selectedUserIds.value = userPickerSelectedIds.value.map((id) => String(id));
syncSelectedUsersFromIds(selectedUserIds.value);
showUserPopup.value = false;
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:219", "选中的整改人员:", selectedUsers.value);
};
const fetchDeptUsers = async () => {
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:224", "当前hazardId:", hazardId.value);
const fetchManagerDeptUsers = async () => {
try {
const res = await request_api.getDepartmentPersonUsers();
if (res.code === 0 && res.data) {
managerDeptList.value = res.data;
if (selectedManagerIds.value.length > 0) {
syncSelectedManagersFromIds(selectedManagerIds.value);
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:633", "获取安全管理人员列表失败:", error);
}
};
const fetchRectifyDeptUsers = async () => {
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:639", "当前hazardId:", hazardId.value);
try {
const res = await request_api.getDeptUsersWithSubordinates({ hazardId: hazardId.value });
if (res.code === 0 && res.data) {
const userList = [];
res.data.forEach((dept) => {
if (dept.users && dept.users.length > 0) {
dept.users.forEach((user) => {
userList.push({
id: String(user.userId),
name: `${user.nickName}${dept.deptName}`
});
});
}
});
cateList.value = userList;
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:242", "整改人员列表:", cateList.value);
deptList.value = res.data;
if (selectedUserIds.value.length > 0) {
syncSelectedUsersFromIds(selectedUserIds.value);
}
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:647", "整改责任人部门树:", deptList.value);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:245", "获取部门人员失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:650", "获取整改责任人列表失败:", error);
}
};
const fetchPersonnelLists = async () => {
await Promise.all([fetchManagerDeptUsers(), fetchRectifyDeptUsers()]);
if (selectedManagerIds.value.length > 0) {
syncSelectedManagersFromIds(selectedManagerIds.value);
}
};
const fileList1 = common_vendor.ref([]);
const deletePic = (event) => {
fileList1.value.splice(event.index, 1);
};
const afterRead = async (event) => {
let lists = [].concat(event.file);
let fileListLen = fileList1.value.length;
lists.map((item) => {
fileList1.value.push({
...item,
status: "uploading",
message: "上传中"
});
});
for (let i = 0; i < lists.length; i++) {
let watermarkedUrl = lists[i].url;
try {
const instance = common_vendor.getCurrentInstance();
watermarkedUrl = await utils_watermark.addTimestampWatermark({
tempFilePath: lists[i].url,
canvasId: "watermarkCanvas",
canvasWidthRef: canvasWidth,
canvasHeightRef: canvasHeight,
instance
});
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:281", "加水印失败,将使用原图上传:", e);
}
const result = await uploadFilePromise(watermarkedUrl);
let item = fileList1.value[fileListLen];
const serverPath = typeof result === "string" ? result : (result == null ? void 0 : result.url) || (result == null ? void 0 : result.filePath) || (result == null ? void 0 : result.path) || "";
fileList1.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
url: request_request.toImageUrl(serverPath),
serverPath
});
fileListLen++;
const rectifyUploadInstance = common_vendor.getCurrentInstance();
const { afterRead, deletePic } = utils_upload.createUploadListHandlers(fileList1, {
watermark: {
canvasId: "watermarkCanvas",
canvasWidthRef: canvasWidth,
canvasHeightRef: canvasHeight,
instance: rectifyUploadInstance
}
};
const uploadFilePromise = (filePath) => {
return new Promise((resolve, reject) => {
common_vendor.index.uploadFile({
url: request_request.baseUrl + "/frontend/attachment/upload",
filePath,
name: "file",
header: {
"Authorization": request_request.getToken()
},
success: (res) => {
const data = JSON.parse(res.data);
if (data.code === 0) {
resolve(data.data);
} else {
reject(data.msg || "上传失败");
}
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:317", "上传失败:", err);
reject(err);
}
});
});
};
});
const executeSubmit = async () => {
const attachments = fileList1.value.map((file) => {
const path = request_request.toRelativeFilePath(file.serverPath || file.filePath || file.url || "");
const fileName = path ? path.split("/").pop() : file.name || "";
return {
fileName: fileName || "",
filePath: path || "",
fileType: file.type || "image/png",
fileSize: file.size || 0
};
});
const attachments = fileList1.value.filter((f) => f.status === "success").map((file) => utils_upload.buildAttachmentItem(file));
const params = {
hazardId: hazardId.value,
assignId: assignId.value,
rectifyPlan: formData.rectifyPlan,
rectificationMeasures: formData.rectificationMeasures,
controlMeasures: formData.controlMeasures,
rectifyResult: formData.rectifyResult,
planCost: Number(formData.planCost) || 0,
actualCost: Number(formData.actualCost) || 0,
attachments,
// 整改人员ID数组
rectifyUserIds: selectedUserIds.value.map((id) => Number(id)),
manageIds: selectedManagerIds.value.map((id) => Number(id)),
memberIds: selectedUserIds.value.map((id) => Number(id)),
rectifyTime: selectedRectifyTime.value || formatDateValue(rectifyTimeValue.value),
signPath: signatureServerPath.value || ""
// 电子签名路径
};
if (rectifyId.value) {
params.rectifyId = rectifyId.value;
@@ -226,7 +419,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:377", "提交整改失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:721", "提交整改失败:", error);
common_vendor.index.showToast({
title: "操作失败",
icon: "none"
@@ -237,17 +430,15 @@ const _sfc_main = {
};
const onSignatureConfirm = async (tempFilePath) => {
try {
const res = await uploadFilePromise(tempFilePath);
const path = res && typeof res === "object" ? res.url || res.filePath || "" : res || "";
signatureServerPath.value = request_request.toRelativeFilePath(path);
signatureUrl.value = request_request.toImageUrl(signatureServerPath.value);
const { url } = await utils_upload.uploadToCloud(tempFilePath);
applySignatureFromServer(url);
if (isSubmitting.value) {
await executeSubmit();
}
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:402", "签名上传失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:743", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
@@ -259,6 +450,20 @@ const _sfc_main = {
});
return;
}
if (!formData.rectificationMeasures) {
common_vendor.index.showToast({
title: "请输入整改措施",
icon: "none"
});
return;
}
if (!formData.controlMeasures) {
common_vendor.index.showToast({
title: "请输入管控措施",
icon: "none"
});
return;
}
if (!formData.rectifyResult) {
common_vendor.index.showToast({
title: "请输入整改完成情况",
@@ -266,9 +471,23 @@ const _sfc_main = {
});
return;
}
if (!selectedRectifyTime.value) {
common_vendor.index.showToast({
title: "请选择实际整改时间",
icon: "none"
});
return;
}
if (selectedManagers.value.length === 0) {
common_vendor.index.showToast({
title: "请选择安全管理人员",
icon: "none"
});
return;
}
if (selectedUsers.value.length === 0) {
common_vendor.index.showToast({
title: "请选择整改人",
title: "请选择整改责任人",
icon: "none"
});
return;
@@ -305,47 +524,45 @@ const _sfc_main = {
if (res.code === 0 && res.data) {
const data = res.data;
formData.rectifyPlan = data.rectifyPlan || "";
formData.rectificationMeasures = data.rectificationMeasures || "";
formData.controlMeasures = data.controlMeasures || "";
formData.rectifyResult = data.rectifyResult || "";
formData.planCost = data.planCost ? String(data.planCost) : "";
formData.actualCost = data.actualCost ? String(data.actualCost) : "";
if (data.signPath) {
signatureServerPath.value = request_request.toRelativeFilePath(data.signPath);
signatureUrl.value = request_request.toImageUrl(signatureServerPath.value);
showCanvas.value = false;
if (data.deadline) {
applyDeadlineFromOptions(data.deadline);
}
if (data.rectifyTime) {
applyRectifyTimeValue(data.rectifyTime);
}
const signPath = resolveSignPathFromData(data);
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:926", "整改详情签名路径:", signPath);
applySignatureFromServer(signPath);
hazardId.value = data.hazardId || "";
assignId.value = data.assignId || "";
await fetchDeptUsers();
if (data.attachments && data.attachments.length > 0) {
fileList1.value = data.attachments.map((att) => {
const serverPath = request_request.toRelativeFilePath(att.filePath);
return {
url: request_request.toImageUrl(serverPath),
status: "success",
message: "",
name: att.fileName,
type: att.fileType,
serverPath
};
});
detailPersonPool.value = [
...Array.isArray(data.managers) ? data.managers : [],
...Array.isArray(data.members) ? data.members : []
];
const managerIdArr = resolveManagerIdsFromDetail(data);
const memberIdArr = parseIdList(data.memberIds);
if (managerIdArr.length > 0) {
selectedManagerIds.value = managerIdArr;
}
if (data.memberIds) {
const memberIdArr = data.memberIds.split(",").map((id) => String(id.trim()));
if (memberIdArr.length > 0) {
selectedUserIds.value = memberIdArr;
setTimeout(() => {
selectedUsers.value = cateList.value.filter((item) => memberIdArr.includes(item.id));
}, 500);
} else if (data.rectifierId) {
selectedUserIds.value = [String(data.rectifierId)];
setTimeout(() => {
selectedUsers.value = cateList.value.filter((item) => item.id === String(data.rectifierId));
}, 500);
}
await fetchPersonnelLists();
if (data.attachments && data.attachments.length > 0) {
fileList1.value = data.attachments.map((att) => utils_upload.mapServerFileToUploadItem(att));
}
common_vendor.index.setNavigationBarTitle({ title: "编辑整改信息" });
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:600", "获取整改详情失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:960", "获取整改详情失败:", error);
common_vendor.index.showToast({ title: "获取详情失败", icon: "none" });
}
};
@@ -376,7 +593,7 @@ const _sfc_main = {
common_vendor.index.showToast({ title: aiRes.msg || "AI生成失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:637", "AI生成整改方案失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:997", "AI生成整改方案失败:", error);
common_vendor.index.showToast({ title: "AI生成失败请重试", icon: "none" });
} finally {
aiGenerating.value = false;
@@ -391,7 +608,7 @@ const _sfc_main = {
if (isRestoring.value)
return;
const key = getDraftKey();
const hasContent = formData.rectifyPlan || formData.rectifyResult || formData.planCost || formData.actualCost || fileList1.value.length > 0 || signatureServerPath.value || signaturePaths.value.length > 0;
const hasContent = formData.rectifyPlan || formData.rectificationMeasures || formData.controlMeasures || formData.rectifyResult || formData.planCost || formData.actualCost || fileList1.value.length > 0 || signatureServerPath.value || signaturePaths.value.length > 0;
if (!hasContent) {
common_vendor.index.removeStorageSync(key);
hasDraft.value = false;
@@ -400,6 +617,8 @@ const _sfc_main = {
const data = {
formData: {
rectifyPlan: formData.rectifyPlan,
rectificationMeasures: formData.rectificationMeasures,
controlMeasures: formData.controlMeasures,
rectifyResult: formData.rectifyResult,
planCost: formData.planCost,
actualCost: formData.actualCost
@@ -420,6 +639,8 @@ const _sfc_main = {
showRestoreBanner.value = false;
isRestoring.value = true;
formData.rectifyPlan = "";
formData.rectificationMeasures = "";
formData.controlMeasures = "";
formData.rectifyResult = "";
formData.planCost = "";
formData.actualCost = "";
@@ -444,19 +665,23 @@ const _sfc_main = {
if (cached) {
try {
const data = JSON.parse(cached);
const hasContent = data.formData.rectifyPlan || data.formData.rectifyResult || data.formData.planCost || data.formData.actualCost || data.fileList1 && data.fileList1.length > 0 || data.signatureServerPath || data.signaturePaths && data.signaturePaths.length > 0;
const hasContent = data.formData.rectifyPlan || data.formData.rectificationMeasures || data.formData.controlMeasures || data.formData.rectifyResult || data.formData.planCost || data.formData.actualCost || data.fileList1 && data.fileList1.length > 0 || data.signatureServerPath || data.signaturePaths && data.signaturePaths.length > 0;
if (!hasContent)
return;
isRestoring.value = true;
formData.rectifyPlan = data.formData.rectifyPlan || "";
formData.rectificationMeasures = data.formData.rectificationMeasures || "";
formData.controlMeasures = data.formData.controlMeasures || "";
formData.rectifyResult = data.formData.rectifyResult || "";
formData.planCost = data.formData.planCost || "";
formData.actualCost = data.formData.actualCost || "";
fileList1.value = data.fileList1 || [];
signatureServerPath.value = data.signatureServerPath || "";
signatureUrl.value = data.signatureUrl || "";
showCanvas.value = data.showCanvas !== void 0 ? data.showCanvas : true;
signaturePaths.value = data.signaturePaths || [];
if (data.signatureServerPath || data.signatureUrl) {
applySignatureFromServer(data.signatureServerPath || data.signatureUrl);
} else if (data.showCanvas === false) {
showCanvas.value = false;
}
hasDraft.value = true;
showRestoreBanner.value = true;
if (signaturePaths.value.length > 0) {
@@ -475,7 +700,7 @@ const _sfc_main = {
duration: 2500
});
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:772", "解析草稿失败:", e);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1145", "解析草稿失败:", e);
isRestoring.value = false;
}
}
@@ -483,6 +708,8 @@ const _sfc_main = {
common_vendor.watch(
() => [
formData.rectifyPlan,
formData.rectificationMeasures,
formData.controlMeasures,
formData.rectifyResult,
formData.planCost,
formData.actualCost,
@@ -502,7 +729,7 @@ const _sfc_main = {
const sysInfo = common_vendor.index.getSystemInfoSync();
signatureWidth.value = sysInfo.windowWidth - 40;
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:803", "获取系统信息失败:", e);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1178", "获取系统信息失败:", e);
}
if (options.hazardId) {
hazardId.value = options.hazardId;
@@ -511,13 +738,17 @@ const _sfc_main = {
assignId.value = options.assignId;
}
if (!options.rectifyId)
fetchDeptUsers();
fetchPersonnelLists();
if (options.rectifyId) {
rectifyId.value = options.rectifyId;
isEdit.value = options.isEdit === "1";
fetchRectifyDetail();
} else {
restoreDraft();
initRectifyTimeDefault();
}
if (options.deadline) {
applyDeadlineFromOptions(options.deadline);
}
});
return (_ctx, _cache) => {
@@ -539,93 +770,184 @@ const _sfc_main = {
autoHeight: true,
modelValue: formData.rectifyPlan
}),
j: common_vendor.o(($event) => formData.rectifyResult = $event),
j: common_vendor.o(($event) => formData.rectificationMeasures = $event),
k: common_vendor.p({
placeholder: "请输入整改措施",
modelValue: formData.rectificationMeasures
}),
l: common_vendor.o(($event) => formData.controlMeasures = $event),
m: common_vendor.p({
placeholder: "请输入管控措施",
modelValue: formData.controlMeasures
}),
n: common_vendor.o(($event) => formData.rectifyResult = $event),
o: common_vendor.p({
placeholder: "请输入内容",
modelValue: formData.rectifyResult
}),
l: common_vendor.o(($event) => formData.planCost = $event),
m: common_vendor.p({
p: common_vendor.o(($event) => formData.planCost = $event),
q: common_vendor.p({
placeholder: "请输入内容",
type: "number",
modelValue: formData.planCost
}),
n: common_vendor.o(($event) => formData.actualCost = $event),
o: common_vendor.p({
r: common_vendor.o(($event) => formData.actualCost = $event),
s: common_vendor.p({
placeholder: "请输入内容",
type: "number",
modelValue: formData.actualCost
}),
p: common_vendor.o(($event) => value1.value = $event),
q: common_vendor.p({
hasInput: true,
show: show.value,
mode: "date",
modelValue: value1.value
t: common_vendor.t(selectedDeadlineDate.value || "暂无"),
v: !selectedDeadlineDate.value ? 1 : "",
w: common_vendor.t(selectedRectifyTime.value || "请选择实际整改时间"),
x: !selectedRectifyTime.value ? 1 : "",
y: common_vendor.o(($event) => showRectifyTimePicker.value = true),
z: common_vendor.o(onRectifyTimeConfirm),
A: common_vendor.o(($event) => showRectifyTimePicker.value = false),
B: common_vendor.o(($event) => showRectifyTimePicker.value = false),
C: common_vendor.o(($event) => rectifyTimeValue.value = $event),
D: common_vendor.p({
show: showRectifyTimePicker.value,
mode: "datetime",
modelValue: rectifyTimeValue.value
}),
r: common_vendor.t(selectedUsers.value.length > 0 ? selectedUsersText.value : "请选择整改人员(可多选)"),
s: selectedUsers.value.length === 0 ? 1 : "",
t: common_vendor.o(($event) => showUserPopup.value = true),
v: common_vendor.o(($event) => showUserPopup.value = false),
w: common_vendor.f(cateList.value, (item, k0, i0) => {
E: common_vendor.t(selectedManagers.value.length > 0 ? selectedManagersText.value : "请选择安全管理人员(可多选)"),
F: selectedManagers.value.length === 0 ? 1 : "",
G: common_vendor.o(openManagerPopup),
H: common_vendor.t(selectedUsers.value.length > 0 ? selectedUsersText.value : "请选择整改责任人(可多选)"),
I: selectedUsers.value.length === 0 ? 1 : "",
J: common_vendor.o(openUserPopup),
K: common_vendor.o(cancelManagerSelect),
L: managerPickerSelectedIds.value.length > 0
}, managerPickerSelectedIds.value.length > 0 ? {
M: common_vendor.t(managerPickerSelectedIds.value.length),
N: common_vendor.t(managerPickerSelectedText.value)
} : {}, {
O: common_vendor.f(managerDeptList.value, (dept, index, i0) => {
return common_vendor.e({
a: common_vendor.t(dept.deptName),
b: getManagerDeptSelectedCount(dept) > 0
}, getManagerDeptSelectedCount(dept) > 0 ? {
c: common_vendor.t(getManagerDeptSelectedCount(dept))
} : {}, {
d: "manager-dept-" + dept.deptId,
e: common_vendor.n({
active: activeManagerDeptIndex.value === index
}),
f: common_vendor.o(($event) => activeManagerDeptIndex.value = index, "manager-dept-" + dept.deptId)
});
}),
P: currentManagerDeptUsers.value.length === 0
}, currentManagerDeptUsers.value.length === 0 ? {} : {
Q: common_vendor.f(currentManagerDeptUsers.value, (user, k0, i0) => {
return {
a: "f18ba0ce-7-" + i0 + ",f18ba0ce-6",
b: common_vendor.p({
label: item.name,
name: item.id,
a: common_vendor.o((checked) => onManagerCheckChange(user.userId, checked), "manager-user-" + user.userId),
b: "f18ba0ce-8-" + i0 + ",f18ba0ce-7",
c: common_vendor.p({
usedAlone: true,
checked: managerPickerSelectedSet.value.has(String(user.userId)),
label: formatUserDisplayName(user),
activeColor: "#2667E9",
shape: "square"
}),
c: item.id
d: "manager-user-" + user.userId
};
})
}, {
R: "manager-dept-users-" + activeManagerDeptIndex.value,
S: common_vendor.o(cancelManagerSelect),
T: common_vendor.o(confirmManagerSelect),
U: common_vendor.o(cancelManagerSelect),
V: common_vendor.p({
show: showManagerPopup.value,
mode: "bottom",
round: "20"
}),
x: common_vendor.o(onUserChange),
y: common_vendor.o(($event) => selectedUserIds.value = $event),
z: common_vendor.p({
placement: "column",
modelValue: selectedUserIds.value
W: common_vendor.o(cancelUserSelect),
X: userPickerSelectedIds.value.length > 0
}, userPickerSelectedIds.value.length > 0 ? {
Y: common_vendor.t(userPickerSelectedIds.value.length),
Z: common_vendor.t(userPickerSelectedText.value)
} : {}, {
aa: common_vendor.f(deptList.value, (dept, index, i0) => {
return common_vendor.e({
a: common_vendor.t(dept.deptName),
b: getDeptSelectedCount(dept) > 0
}, getDeptSelectedCount(dept) > 0 ? {
c: common_vendor.t(getDeptSelectedCount(dept))
} : {}, {
d: dept.deptId,
e: common_vendor.n({
active: activeDeptIndex.value === index
}),
f: common_vendor.o(($event) => activeDeptIndex.value = index, dept.deptId)
});
}),
A: common_vendor.o(($event) => showUserPopup.value = false),
B: common_vendor.o(confirmUserSelect),
C: common_vendor.o(($event) => showUserPopup.value = false),
D: common_vendor.p({
ab: currentDeptUsers.value.length === 0
}, currentDeptUsers.value.length === 0 ? {} : {
ac: common_vendor.f(currentDeptUsers.value, (user, k0, i0) => {
return {
a: common_vendor.o((checked) => onUserCheckChange(user.userId, checked), "user-" + user.userId),
b: "f18ba0ce-10-" + i0 + ",f18ba0ce-9",
c: common_vendor.p({
usedAlone: true,
checked: userPickerSelectedSet.value.has(String(user.userId)),
label: formatUserDisplayName(user),
activeColor: "#2667E9",
shape: "square"
}),
d: "user-" + user.userId
};
})
}, {
ad: "dept-users-" + activeDeptIndex.value,
ae: common_vendor.o(cancelUserSelect),
af: common_vendor.o(confirmUserSelect),
ag: common_vendor.o(cancelUserSelect),
ah: common_vendor.p({
show: showUserPopup.value,
mode: "bottom",
round: "20"
}),
E: common_vendor.o(afterRead),
F: common_vendor.o(deletePic),
G: common_vendor.p({
ai: common_vendor.o(common_vendor.unref(afterRead)),
aj: common_vendor.o(common_vendor.unref(deletePic)),
ak: common_vendor.p({
fileList: fileList1.value,
name: "1",
multiple: true,
imageMode: "aspectFill",
maxCount: 10
}),
H: canvasWidth.value,
I: canvasHeight.value,
J: canvasWidth.value + "px",
K: canvasHeight.value + "px",
L: showCanvas.value
}, showCanvas.value ? {
M: common_vendor.o(clearSignature)
} : {
N: common_vendor.o(reSign)
}, {
O: !showCanvas.value
}, !showCanvas.value ? {
P: signatureUrl.value
al: !showUserPopup.value && !showManagerPopup.value && !showRectifyTimePicker.value
}, !showUserPopup.value && !showManagerPopup.value && !showRectifyTimePicker.value ? {
am: canvasWidth.value,
an: canvasHeight.value,
ao: canvasWidth.value + "px",
ap: canvasHeight.value + "px"
} : {}, {
Q: showCanvas.value && !showUserPopup.value
}, showCanvas.value && !showUserPopup.value ? {
R: common_vendor.sr(signatureRef, "f18ba0ce-9", {
aq: showCanvas.value
}, showCanvas.value ? {
ar: common_vendor.o(clearSignature)
} : {
as: common_vendor.o(reSign)
}, {
at: !showCanvas.value
}, !showCanvas.value ? common_vendor.e({
av: signatureUrl.value
}, signatureUrl.value ? {
aw: signatureUrl.value,
ax: common_vendor.o(onSignatureImageError)
} : {}) : {}, {
ay: showCanvas.value && !showUserPopup.value && !showManagerPopup.value && !showRectifyTimePicker.value
}, showCanvas.value && !showUserPopup.value && !showManagerPopup.value && !showRectifyTimePicker.value ? {
az: common_vendor.sr(signatureRef, "f18ba0ce-12", {
"k": "signatureRef"
}),
S: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
T: common_vendor.o(($event) => isSignatureEmpty.value = false),
U: common_vendor.o(($event) => isSignatureEmpty.value = false),
V: common_vendor.o(($event) => isSignatureEmpty.value = true),
W: common_vendor.p({
aA: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
aB: common_vendor.o(($event) => isSignatureEmpty.value = false),
aC: common_vendor.o(($event) => isSignatureEmpty.value = false),
aD: common_vendor.o(($event) => isSignatureEmpty.value = true),
aE: common_vendor.p({
width: signatureWidth.value,
height: 160,
backgroundColor: "#f8f8f8",
@@ -634,9 +956,9 @@ const _sfc_main = {
enableHistory: false
})
} : {}, {
X: common_vendor.t(isEdit.value ? "保存修改" : "提交整改"),
Y: common_vendor.o(handleSubmit),
Z: common_vendor.gei(_ctx, "")
aF: common_vendor.t(isEdit.value ? "保存修改" : "提交整改"),
aG: common_vendor.o(handleSubmit),
aH: common_vendor.gei(_ctx, "")
});
};
}