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

@@ -2,23 +2,23 @@
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const request_three_one_api_area = require("../../request/three_one_api/area.js");
const utils_watermark = require("../../utils/watermark.js");
const request_request = require("../../request/request.js");
require("../../request/request.js");
const utils_upload = require("../../utils/upload.js");
if (!Array) {
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_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
(_easycom_up_upload2 + _easycom_up_input2 + _easycom_up_choose2 + _easycom_up_textarea2 + _easycom_u_popup2)();
(_easycom_up_choose2 + _easycom_up_upload2 + _easycom_up_input2 + _easycom_up_textarea2 + _easycom_u_popup2)();
}
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_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_up_upload + _easycom_up_input + _easycom_up_choose + _easycom_up_textarea + _easycom_u_popup)();
(_easycom_up_choose + _easycom_up_upload + _easycom_up_input + _easycom_up_textarea + _easycom_u_popup)();
}
const _sfc_main = {
__name: "Inspection",
@@ -37,10 +37,10 @@ const _sfc_main = {
if (userInfoStr) {
const userInfo = JSON.parse(userInfoStr);
userRole.value = userInfo.role || "";
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:283", "当前用户角色:", userRole.value);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:286", "当前用户角色:", userRole.value);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:286", "获取用户信息失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:289", "获取用户信息失败:", error);
}
};
getUserRole();
@@ -58,7 +58,7 @@ const _sfc_main = {
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:311", "获取任务信息失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:314", "获取任务信息失败:", error);
}
};
common_vendor.onLoad((options) => {
@@ -132,7 +132,7 @@ const _sfc_main = {
hasMoreLaw.value = lawList.value.length < total;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:394", "获取法规列表失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:397", "获取法规列表失败:", error);
} finally {
lawLoading.value = false;
}
@@ -167,7 +167,7 @@ const _sfc_main = {
areaList.value = res.data.records;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:438", "获取区域列表失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:441", "获取区域列表失败:", error);
}
};
fetchAreaList();
@@ -180,26 +180,26 @@ const _sfc_main = {
showAreaPicker.value = false;
};
const chooseLocation = () => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:454", "chooseLocation called");
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:457", "chooseLocation called");
showAddPopup.value = false;
setTimeout(() => {
common_vendor.index.getLocation({
type: "gcj02",
// 使用国测局坐标系(腾讯地图使用)
success: (locationRes) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:463", "获取当前位置成功:", locationRes);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:466", "获取当前位置成功:", locationRes);
common_vendor.index.chooseLocation({
latitude: locationRes.latitude,
longitude: locationRes.longitude,
success: (res) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:469", "选择位置成功:", res);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:472", "选择位置成功:", res);
selectedAddress.value = res.address + (res.name ? `(${res.name})` : "");
lng.value = res.longitude;
lat.value = res.latitude;
showAddPopup.value = true;
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:478", "选择位置失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:481", "选择位置失败:", err);
showAddPopup.value = true;
if (err.errMsg && err.errMsg.indexOf("cancel") === -1) {
common_vendor.index.showToast({
@@ -211,17 +211,17 @@ const _sfc_main = {
});
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:492", "获取当前位置失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:495", "获取当前位置失败:", err);
common_vendor.index.chooseLocation({
success: (res) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:496", "选择位置成功:", res);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:499", "选择位置成功:", res);
selectedAddress.value = res.address + (res.name ? `(${res.name})` : "");
lng.value = res.longitude;
lat.value = res.latitude;
showAddPopup.value = true;
},
fail: (chooseErr) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:503", "选择位置失败:", chooseErr);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:506", "选择位置失败:", chooseErr);
showAddPopup.value = true;
if (chooseErr.errMsg && chooseErr.errMsg.indexOf("cancel") === -1) {
common_vendor.index.showToast({
@@ -251,19 +251,10 @@ const _sfc_main = {
});
return;
}
const attachments = fileList1.value.map((file) => {
const path = file.serverPath || "";
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 selectedTag = tagOptions.value[formData.tagIndex];
const tagId = selectedTag ? selectedTag.id : null;
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:550", "innnn", sourceOptions);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:546", "innnn", sourceOptions);
const params = {
title: formData.title,
//标题
@@ -292,7 +283,7 @@ const _sfc_main = {
regulationId: formData.regulationId || null
// 法律依据ID
};
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:569", "提交的参数:", params);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:565", "提交的参数:", params);
try {
const res = await request_api.addHiddenDanger(params);
if (res.code === 0) {
@@ -321,7 +312,7 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:602", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:598", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
@@ -341,7 +332,7 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:623", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:619", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
@@ -357,9 +348,11 @@ const _sfc_main = {
});
};
const Rectification = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`
});
let url = `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`;
if (item.deadline) {
url += `&deadline=${encodeURIComponent(item.deadline)}`;
}
common_vendor.index.navigateTo({ url });
};
const editRectification = (item) => {
common_vendor.index.navigateTo({
@@ -377,71 +370,15 @@ const _sfc_main = {
});
};
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/Inspection.vue:697", "加水印失败,将使用原图上传:", 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.path) || "";
fileList1.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
// url: baseUrl + serverPath,
url: request_request.toImageUrl(serverPath),
serverPath
});
fileListLen++;
const uploadInstance = common_vendor.getCurrentInstance();
const { afterRead, deletePic } = utils_upload.createUploadListHandlers(fileList1, {
watermark: {
canvasId: "watermarkCanvas",
canvasWidthRef: canvasWidth,
canvasHeightRef: canvasHeight,
instance: uploadInstance
}
};
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/Inspection.vue:732", "上传失败:", err);
reject(err);
}
});
});
};
});
const aiAnalyzing = common_vendor.ref(false);
const handleAiAnalyze = async () => {
const imageFiles = fileList1.value.filter((f) => {
@@ -454,14 +391,14 @@ const _sfc_main = {
const fullImageUrl = imageFiles[0].url;
aiAnalyzing.value = true;
try {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:754", "开始调用AI分析接口图片地址:", fullImageUrl);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:690", "开始调用AI分析接口图片地址:", fullImageUrl);
const analyzeRes = await request_api.analyzeHazardImage({
// imageUrl: 'https://yx.zhihuixiangxi.com:58880/1.png' ,
imageUrl: fullImageUrl
});
if (analyzeRes.code === 0 && analyzeRes.data) {
const aiData = analyzeRes.data;
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:762", "AI分析结果:", aiData);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:698", "AI分析结果:", aiData);
if (aiData.title)
formData.title = aiData.title;
if (aiData.description)
@@ -483,7 +420,7 @@ const _sfc_main = {
common_vendor.index.showToast({ title: analyzeRes.msg || "AI分析失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:785", "AI分析接口调用失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:721", "AI分析接口调用失败:", error);
common_vendor.index.showToast({ title: "AI分析失败请重试", icon: "none" });
} finally {
aiAnalyzing.value = false;
@@ -505,7 +442,7 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:808", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:744", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
@@ -530,24 +467,24 @@ const _sfc_main = {
const sourceOptions = common_vendor.ref([
{
id: 1,
title: "随手拍"
title: "部门检查"
},
{
id: 2,
title: "企业自查"
title: "都导检查"
},
{
id: 3,
title: "行业互查"
title: "企业自查"
},
{
id: 4,
title: "专家诊查"
title: "行业互查"
}
]);
common_vendor.watch(() => formData.source, (newVal) => {
const selected = sourceOptions.value[newVal];
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:855", "隐患来源选择结果:", {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:791", "隐患来源选择结果:", {
索引: newVal,
选中项: selected,
id: selected == null ? void 0 : selected.id,
@@ -620,50 +557,50 @@ const _sfc_main = {
}),
d: common_vendor.o(($event) => showAddPopup.value = true),
e: common_vendor.o(($event) => showAddPopup.value = false),
f: common_vendor.o(afterRead),
g: common_vendor.o(deletePic),
h: common_vendor.p({
f: common_vendor.o(($event) => formData.source = $event),
g: common_vendor.p({
options: sourceOptions.value,
wrap: false,
["item-width"]: "152rpx",
["item-height"]: "64rpx",
modelValue: formData.source
}),
h: common_vendor.o(common_vendor.unref(afterRead)),
i: common_vendor.o(common_vendor.unref(deletePic)),
j: common_vendor.p({
fileList: fileList1.value,
name: "1",
multiple: true,
imageMode: "aspectFill",
maxCount: 10
}),
i: canvasWidth.value,
j: canvasHeight.value,
k: canvasWidth.value + "px",
l: canvasHeight.value + "px",
m: !aiAnalyzing.value
k: canvasWidth.value,
l: canvasHeight.value,
m: canvasWidth.value + "px",
n: canvasHeight.value + "px",
o: !aiAnalyzing.value
}, !aiAnalyzing.value ? {} : {}, {
n: common_vendor.t(aiAnalyzing.value ? "AI识别中..." : "AI 识别隐患"),
o: aiAnalyzing.value,
p: aiAnalyzing.value,
q: common_vendor.o(handleAiAnalyze),
r: common_vendor.o(($event) => formData.title = $event),
s: common_vendor.p({
p: common_vendor.t(aiAnalyzing.value ? "AI识别中..." : "AI 识别隐患"),
q: aiAnalyzing.value,
r: aiAnalyzing.value,
s: common_vendor.o(handleAiAnalyze),
t: common_vendor.o(($event) => formData.title = $event),
v: common_vendor.p({
placeholder: "请输入内容",
border: "surround",
modelValue: formData.title
}),
t: common_vendor.sr(levelChooseRef, "b44c631d-3,b44c631d-0", {
w: common_vendor.sr(levelChooseRef, "b44c631d-4,b44c631d-0", {
"k": "levelChooseRef"
}),
v: common_vendor.o(($event) => formData.level = $event),
w: common_vendor.p({
x: common_vendor.o(($event) => formData.level = $event),
y: common_vendor.p({
options: levelOptions.value,
wrap: false,
["item-width"]: "183rpx",
["item-height"]: "72rpx",
modelValue: formData.level
}),
x: common_vendor.o(($event) => formData.source = $event),
y: common_vendor.p({
options: sourceOptions.value,
wrap: false,
["item-width"]: "183rpx",
["item-height"]: "72rpx",
modelValue: formData.source
}),
z: common_vendor.o(($event) => selectedAddress.value = $event),
A: common_vendor.p({
placeholder: "请输入地址",
@@ -693,7 +630,8 @@ const _sfc_main = {
P: common_vendor.p({
show: showAddPopup.value,
mode: "center",
round: "20"
round: "20",
["safe-area-inset-bottom"]: false
}),
Q: common_vendor.o(($event) => showLawPopup.value = false),
R: common_vendor.o(searchRegulation),
@@ -721,7 +659,8 @@ const _sfc_main = {
ad: common_vendor.p({
show: showLawPopup.value,
mode: "center",
round: "20"
round: "20",
["safe-area-inset-bottom"]: false
}),
ae: common_vendor.o(($event) => showAreaPicker.value = false),
af: common_vendor.o(confirmAreaSelect),