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,28 +1,28 @@
"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");
require("../../request/request.js");
const utils_upload = require("../../utils/upload.js");
const request_three_one_api_area = require("../../request/three_one_api/area.js");
if (!Array) {
const _easycom_u_radio2 = common_vendor.resolveComponent("u-radio");
const _easycom_u_radio_group2 = common_vendor.resolveComponent("u-radio-group");
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_choose2 = common_vendor.resolveComponent("up-choose");
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_choose2 = common_vendor.resolveComponent("up-choose");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
(_easycom_u_radio2 + _easycom_u_radio_group2 + _easycom_up_textarea2 + _easycom_up_upload2 + _easycom_up_input2 + _easycom_up_choose2 + _easycom_u_popup2)();
(_easycom_u_radio2 + _easycom_u_radio_group2 + _easycom_up_textarea2 + _easycom_up_choose2 + _easycom_up_upload2 + _easycom_up_input2 + _easycom_u_popup2)();
}
const _easycom_u_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
const _easycom_u_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_choose = () => "../../uni_modules/uview-plus/components/u-choose/u-choose.js";
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_choose = () => "../../uni_modules/uview-plus/components/u-choose/u-choose.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_u_radio + _easycom_u_radio_group + _easycom_up_textarea + _easycom_up_upload + _easycom_up_input + _easycom_up_choose + _easycom_u_popup)();
(_easycom_u_radio + _easycom_u_radio_group + _easycom_up_textarea + _easycom_up_choose + _easycom_up_upload + _easycom_up_input + _easycom_u_popup)();
}
const _sfc_main = {
__name: "Inspectionresult",
@@ -50,13 +50,13 @@ const _sfc_main = {
]);
const radiovalue1 = common_vendor.ref("");
const groupChange = (n) => {
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:305", "groupChange", n);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:312", "groupChange", n);
if (n !== "异常") {
clearHazard();
}
};
const radioChange = (n) => {
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:313", "radioChange", n);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:320", "radioChange", n);
};
const value1 = common_vendor.ref("");
const showHazardPopup = common_vendor.ref(false);
@@ -120,7 +120,7 @@ const _sfc_main = {
hasMoreLaw.value = lawList.value.length < total;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:392", "获取法规列表失败:", error);
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:399", "获取法规列表失败:", error);
} finally {
lawLoading.value = false;
}
@@ -155,7 +155,7 @@ const _sfc_main = {
areaList.value = res.data.records;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:436", "获取区域列表失败:", error);
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:443", "获取区域列表失败:", error);
}
};
const confirmAreaSelect = () => {
@@ -185,10 +185,10 @@ const _sfc_main = {
{ id: 3, title: "重大隐患" }
]);
const sourceOptions = common_vendor.ref([
{ id: 1, title: "随手拍" },
{ id: 2, title: "企业自查" },
{ id: 3, title: "行业互查" },
{ id: 4, title: "专家诊查" }
{ id: 1, title: "部门检查" },
{ id: 2, title: "都导检查" },
{ id: 3, title: "企业自查" },
{ id: 4, title: "行业互查" }
]);
const tagOptions = common_vendor.ref([]);
const fetchTagOptions = async () => {
@@ -201,7 +201,7 @@ const _sfc_main = {
}));
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:501", "获取标签列表失败:", error);
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:508", "获取标签列表失败:", error);
}
};
const openHazardPopup = () => {
@@ -266,70 +266,15 @@ const _sfc_main = {
});
}, 300);
};
const deletePic = (event) => {
hazardFileList.value.splice(event.index, 1);
};
const afterRead = async (event) => {
let lists = [].concat(event.file);
let fileListLen = hazardFileList.value.length;
lists.map((item) => {
hazardFileList.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/Inspectionresult/Inspectionresult.vue:609", "加水印失败,将使用原图上传:", e);
}
const result = await uploadFilePromise(watermarkedUrl);
let item = hazardFileList.value[fileListLen];
const serverPath = typeof result === "string" ? result : (result == null ? void 0 : result.url) || (result == null ? void 0 : result.path) || "";
hazardFileList.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
url: request_request.toImageUrl(serverPath),
serverPath
});
fileListLen++;
const inspectionUploadInstance = common_vendor.getCurrentInstance();
const { afterRead, deletePic } = utils_upload.createUploadListHandlers(hazardFileList, {
watermark: {
canvasId: "watermarkCanvas",
canvasWidthRef: canvasWidth,
canvasHeightRef: canvasHeight,
instance: inspectionUploadInstance
}
};
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/Inspectionresult/Inspectionresult.vue:644", "上传失败:", err);
reject(err);
}
});
});
};
});
const handleAiAnalyze = async () => {
const imageFiles = hazardFileList.value.filter((f) => {
return f.status === "success" && f.url.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/);
@@ -341,13 +286,13 @@ const _sfc_main = {
const fullImageUrl = imageFiles[0].url;
aiAnalyzing.value = true;
try {
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:665", "开始调用AI分析接口图片地址:", fullImageUrl);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:612", "开始调用AI分析接口图片地址:", fullImageUrl);
const analyzeRes = await request_api.analyzeHazardImage({
imageUrl: fullImageUrl
});
if (analyzeRes.code === 0 && analyzeRes.data) {
const aiData = analyzeRes.data;
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:672", "AI分析结果:", aiData);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:619", "AI分析结果:", aiData);
if (aiData.title)
hazardFormData.title = aiData.title;
if (aiData.description)
@@ -369,14 +314,14 @@ const _sfc_main = {
common_vendor.index.showToast({ title: analyzeRes.msg || "AI分析失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:695", "AI分析接口调用失败:", error);
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:642", "AI分析接口调用失败:", error);
common_vendor.index.showToast({ title: "AI分析失败请重试", icon: "none" });
} finally {
aiAnalyzing.value = false;
}
};
const handleSubmit = async () => {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e;
if (!radiovalue1.value) {
common_vendor.index.showToast({ title: "请选择检查结果", icon: "none" });
return;
@@ -394,57 +339,40 @@ const _sfc_main = {
try {
common_vendor.index.showLoading({ title: "提交中..." });
if (radiovalue1.value === "异常" && hasHazardData.value) {
const attachments = hazardFileList.value.map((file) => {
let url = "";
if (typeof file.url === "string") {
url = file.url;
} else if (file.url && typeof file.url === "object") {
url = file.url.url || file.url.path || "";
}
if (typeof url === "string" && url.startsWith("http")) {
url = url.replace(request_request.imageBaseUrl, "");
}
const fileName = typeof url === "string" && url ? url.split("/").pop() : file.name || "";
return {
fileName: fileName || "",
filePath: url || "",
fileType: file.type || "image/png",
fileSize: file.size || 0
};
});
const attachments = hazardFileList.value.filter((f) => f.status === "success").map((file) => utils_upload.buildAttachmentItem(file));
const selectedTag = tagOptions.value[hazardFormData.tagIndex];
const tagId = selectedTag ? selectedTag.id : null;
const hazardParams = {
taskId: (_a = checkData.value) == null ? void 0 : _a.taskId,
checkPointId: (_b = checkData.value) == null ? void 0 : _b.checkPointId,
title: hazardFormData.title,
level: hazardFormData.level + 1,
level: ((_c = levelOptions.value[hazardFormData.level]) == null ? void 0 : _c.id) || 2,
lng: hazardLng.value || 0,
lat: hazardLat.value || 0,
address: hazardAddress.value || "",
areaId: selectedAreaId.value || null,
// 隐患区域ID
description: hazardFormData.description || "",
source: ((_c = sourceOptions.value[hazardFormData.source]) == null ? void 0 : _c.title) || "",
source: ((_d = sourceOptions.value[hazardFormData.source]) == null ? void 0 : _d.title) || "",
tagId,
attachments,
regulationId: hazardFormData.regulationId || null
};
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:773", "隐患参数:", hazardParams);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:705", "隐患参数:", hazardParams);
const hazardRes = await request_api.addHiddenDanger(hazardParams);
if (hazardRes.code !== 0) {
common_vendor.index.hideLoading();
common_vendor.index.showToast({ title: hazardRes.msg || "新增隐患失败", icon: "none" });
return;
}
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:782", "新增隐患成功");
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:714", "新增隐患成功");
}
const submitParams = {
taskId: (_d = checkData.value) == null ? void 0 : _d.taskId,
taskId: (_e = checkData.value) == null ? void 0 : _e.taskId,
result: resultValue,
remark: value1.value
};
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:791", "提交参数:", submitParams);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:723", "提交参数:", submitParams);
const res = await request_api.submitCheckResult(submitParams);
common_vendor.index.hideLoading();
if (res.code === 0) {
@@ -469,7 +397,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:826", "提交失败:", error);
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:758", "提交失败:", error);
common_vendor.index.showToast({ title: "提交失败", icon: "none" });
}
};
@@ -481,13 +409,13 @@ const _sfc_main = {
const getCheckData = async () => {
try {
const res = await request_api.enterCheckPlan(oneTableId.value);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:845", "检查项数据:", res);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:777", "检查项数据:", res);
if (res.code === 0) {
checkData.value = res.data;
restoreDraft();
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:852", error);
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:784", error);
}
};
const hasDraft = common_vendor.ref(false);
@@ -500,12 +428,12 @@ const _sfc_main = {
};
const saveDraft = () => {
if (isRestoring.value || !isInitialized.value) {
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:867", "【草稿Debug - 巡检】saveDraft 被跳过:", { isRestoring: isRestoring.value, isInitialized: isInitialized.value });
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:799", "【草稿Debug - 巡检】saveDraft 被跳过:", { isRestoring: isRestoring.value, isInitialized: isInitialized.value });
return;
}
const key = getDraftKey();
const hasContent = radiovalue1.value || value1.value || hazardFormData.title || hazardFormData.description || hazardFileList.value.length > 0;
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:877", "【草稿Debug - 巡检】尝试自动保存草稿. Key:", key, "是否有实质内容:", !!hasContent, "当前数据:", {
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:809", "【草稿Debug - 巡检】尝试自动保存草稿. Key:", key, "是否有实质内容:", !!hasContent, "当前数据:", {
radiovalue1: radiovalue1.value,
value1: value1.value,
title: hazardFormData.title,
@@ -514,7 +442,7 @@ const _sfc_main = {
});
if (!hasContent) {
common_vendor.index.removeStorageSync(key);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:887", "【草稿Debug - 巡检】当前表单为空,自动删除本地缓存 Key:", key);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:819", "【草稿Debug - 巡检】当前表单为空,自动删除本地缓存 Key:", key);
hasDraft.value = false;
return;
}
@@ -534,12 +462,12 @@ const _sfc_main = {
hazardLat: hazardLat.value
};
common_vendor.index.setStorageSync(key, JSON.stringify(data));
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:908", "【草稿Debug - 巡检】成功保存草稿到 LocalStorage, Key:", key);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:840", "【草稿Debug - 巡检】成功保存草稿到 LocalStorage, Key:", key);
hasDraft.value = true;
};
const clearDraft = (showToast = true) => {
const key = getDraftKey();
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:915", "【草稿Debug - 巡检】手动清空草稿, Key:", key);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:847", "【草稿Debug - 巡检】手动清空草稿, Key:", key);
common_vendor.index.removeStorageSync(key);
hasDraft.value = false;
showRestoreBanner.value = false;
@@ -565,12 +493,12 @@ const _sfc_main = {
const restoreDraft = () => {
const key = getDraftKey();
const cached = common_vendor.index.getStorageSync(key);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:945", "【草稿Debug - 巡检】尝试恢复草稿, Key:", key, "获取本地缓存结果:", !!cached);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:877", "【草稿Debug - 巡检】尝试恢复草稿, Key:", key, "获取本地缓存结果:", !!cached);
if (cached) {
try {
const data = JSON.parse(cached);
const hasContent = data.radiovalue1 || data.value1 || data.hazardFormData.title || data.hazardFormData.description || data.hazardFileList && data.hazardFileList.length > 0;
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:955", "【草稿Debug - 巡检】解析本地缓存成功, 是否有实质内容:", !!hasContent, "缓存数据:", data);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:887", "【草稿Debug - 巡检】解析本地缓存成功, 是否有实质内容:", !!hasContent, "缓存数据:", data);
if (!hasContent) {
isInitialized.value = true;
return;
@@ -595,7 +523,7 @@ const _sfc_main = {
if (levelChooseRef.value && levelChooseRef.value.$data) {
levelChooseRef.value.$data.currentIndex = hazardFormData.level;
}
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:982", "【草稿Debug - 巡检】UI与多选组件状态同步重绘完毕");
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:914", "【草稿Debug - 巡检】UI与多选组件状态同步重绘完毕");
});
common_vendor.index.showToast({
title: "已自动恢复您上次未提交的内容",
@@ -603,12 +531,12 @@ const _sfc_main = {
duration: 2500
});
} catch (e) {
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:991", "【草稿Debug - 巡检】解析草稿异常:", e);
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:923", "【草稿Debug - 巡检】解析草稿异常:", e);
isRestoring.value = false;
isInitialized.value = true;
}
} else {
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:996", "【草稿Debug - 巡检】本地无任何缓存, 页面已安全标记为 initialized");
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:928", "【草稿Debug - 巡检】本地无任何缓存, 页面已安全标记为 initialized");
isInitialized.value = true;
}
};
@@ -632,7 +560,7 @@ const _sfc_main = {
{ deep: true }
);
common_vendor.onLoad((options) => {
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:1023", "接收到的参数:", options);
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:955", "接收到的参数:", options);
if (options.id) {
oneTableId.value = options.id;
getCheckData();
@@ -703,50 +631,50 @@ const _sfc_main = {
}, showRestoreBanner.value ? {
F: common_vendor.o(($event) => clearDraft(true))
} : {}, {
G: common_vendor.o(afterRead),
H: common_vendor.o(deletePic),
I: common_vendor.p({
G: common_vendor.o(($event) => hazardFormData.source = $event),
H: common_vendor.p({
options: sourceOptions.value,
wrap: false,
["item-width"]: "152rpx",
["item-height"]: "64rpx",
modelValue: hazardFormData.source
}),
I: common_vendor.o(common_vendor.unref(afterRead)),
J: common_vendor.o(common_vendor.unref(deletePic)),
K: common_vendor.p({
fileList: hazardFileList.value,
name: "1",
multiple: true,
imageMode: "aspectFill",
maxCount: 10
}),
J: canvasWidth.value,
K: canvasHeight.value,
L: canvasWidth.value + "px",
M: canvasHeight.value + "px",
N: !aiAnalyzing.value
L: canvasWidth.value,
M: canvasHeight.value,
N: canvasWidth.value + "px",
O: canvasHeight.value + "px",
P: !aiAnalyzing.value
}, !aiAnalyzing.value ? {} : {}, {
O: common_vendor.t(aiAnalyzing.value ? "AI识别中..." : "AI 识别隐患"),
P: aiAnalyzing.value,
Q: aiAnalyzing.value,
R: common_vendor.o(handleAiAnalyze),
S: common_vendor.o(($event) => hazardFormData.title = $event),
T: common_vendor.p({
Q: common_vendor.t(aiAnalyzing.value ? "AI识别中..." : "AI 识别隐患"),
R: aiAnalyzing.value,
S: aiAnalyzing.value,
T: common_vendor.o(handleAiAnalyze),
U: common_vendor.o(($event) => hazardFormData.title = $event),
V: common_vendor.p({
placeholder: "请输入内容",
border: "surround",
modelValue: hazardFormData.title
}),
U: common_vendor.sr(levelChooseRef, "643afff0-6,643afff0-3", {
W: common_vendor.sr(levelChooseRef, "643afff0-7,643afff0-3", {
"k": "levelChooseRef"
}),
V: common_vendor.o(($event) => hazardFormData.level = $event),
W: common_vendor.p({
X: common_vendor.o(($event) => hazardFormData.level = $event),
Y: common_vendor.p({
options: levelOptions.value,
wrap: false,
["item-width"]: "183rpx",
["item-height"]: "72rpx",
modelValue: hazardFormData.level
}),
X: common_vendor.o(($event) => hazardFormData.source = $event),
Y: common_vendor.p({
options: sourceOptions.value,
wrap: false,
["item-width"]: "183rpx",
["item-height"]: "72rpx",
modelValue: hazardFormData.source
}),
Z: common_vendor.o(($event) => hazardAddress.value = $event),
aa: common_vendor.p({
placeholder: "请输入地址",