这一版本优化了很多

This commit is contained in:
王利强
2026-06-03 10:16:37 +08:00
parent 8046316216
commit 2af9f1fd59
954 changed files with 58194 additions and 1609 deletions

View File

@@ -2,6 +2,7 @@
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");
if (!Array) {
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
@@ -23,6 +24,8 @@ const _sfc_main = {
__name: "Inspection",
setup(__props) {
const showAddPopup = common_vendor.ref(false);
const canvasWidth = common_vendor.ref(300);
const canvasHeight = common_vendor.ref(300);
const levelChooseRef = common_vendor.ref(null);
const userRole = common_vendor.ref("");
const canAcceptance = common_vendor.computed(() => {
@@ -34,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:224", "当前用户角色:", userRole.value);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:283", "当前用户角色:", userRole.value);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:227", "获取用户信息失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:286", "获取用户信息失败:", error);
}
};
getUserRole();
@@ -55,7 +58,7 @@ const _sfc_main = {
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:252", "获取任务信息失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:311", "获取任务信息失败:", error);
}
};
common_vendor.onLoad((options) => {
@@ -72,8 +75,12 @@ const _sfc_main = {
// 隐患描述
tagIndex: 0,
// 隐患标签索引
source: ""
source: 0,
// 隐患来源
regulationId: null,
// 法律依据ID
regulationName: ""
// 法律依据名称(显示用)
});
common_vendor.ref(0);
const lng = common_vendor.ref(0);
@@ -84,6 +91,75 @@ const _sfc_main = {
const selectedAreaId = common_vendor.ref("");
const selectedAreaName = common_vendor.ref("");
const tempAreaId = common_vendor.ref("");
const showLawPopup = common_vendor.ref(false);
const lawKeyword = common_vendor.ref("");
const selectedLawId = common_vendor.ref(null);
const selectedLawName = common_vendor.ref("");
const lawList = common_vendor.ref([]);
const lawLoading = common_vendor.ref(false);
const lawPageNum = common_vendor.ref(1);
const lawPageSize = common_vendor.ref(10);
const hasMoreLaw = common_vendor.ref(true);
const openLawPopup = () => {
showLawPopup.value = true;
if (lawList.value.length === 0) {
fetchRegulationList();
}
};
const fetchRegulationList = async (isLoadMore = false) => {
if (lawLoading.value)
return;
lawLoading.value = true;
try {
const params = {
pageNum: lawPageNum.value,
pageSize: lawPageSize.value,
status: 1
// 启用状态
};
if (lawKeyword.value && lawKeyword.value.trim()) {
params.keyword = lawKeyword.value.trim();
}
const res = await request_api.getRegulationList(params);
if (res.code === 0) {
const records = res.data.records || res.data || [];
if (isLoadMore) {
lawList.value = [...lawList.value, ...records];
} else {
lawList.value = records;
}
const total = res.data.total || 0;
hasMoreLaw.value = lawList.value.length < total;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:394", "获取法规列表失败:", error);
} finally {
lawLoading.value = false;
}
};
const searchRegulation = () => {
lawPageNum.value = 1;
lawList.value = [];
hasMoreLaw.value = true;
fetchRegulationList();
};
const loadMoreLaw = () => {
if (!hasMoreLaw.value || lawLoading.value)
return;
lawPageNum.value++;
fetchRegulationList(true);
};
const selectLaw = (item) => {
selectedLawId.value = item.id;
selectedLawName.value = item.depict || item.keyword || "";
};
const confirmLaw = () => {
if (selectedLawId.value) {
formData.regulationId = selectedLawId.value;
formData.regulationName = selectedLawName.value;
}
showLawPopup.value = false;
};
const fetchAreaList = async () => {
try {
const res = await request_three_one_api_area.getAreaList();
@@ -91,7 +167,7 @@ const _sfc_main = {
areaList.value = res.data.records;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:296", "获取区域列表失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:438", "获取区域列表失败:", error);
}
};
fetchAreaList();
@@ -104,26 +180,26 @@ const _sfc_main = {
showAreaPicker.value = false;
};
const chooseLocation = () => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:312", "chooseLocation called");
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:454", "chooseLocation called");
showAddPopup.value = false;
setTimeout(() => {
common_vendor.index.getLocation({
type: "gcj02",
// 使用国测局坐标系(腾讯地图使用)
success: (locationRes) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:321", "获取当前位置成功:", locationRes);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:463", "获取当前位置成功:", locationRes);
common_vendor.index.chooseLocation({
latitude: locationRes.latitude,
longitude: locationRes.longitude,
success: (res) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:327", "选择位置成功:", res);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:469", "选择位置成功:", 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:336", "选择位置失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:478", "选择位置失败:", err);
showAddPopup.value = true;
if (err.errMsg && err.errMsg.indexOf("cancel") === -1) {
common_vendor.index.showToast({
@@ -135,17 +211,17 @@ const _sfc_main = {
});
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:350", "获取当前位置失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:492", "获取当前位置失败:", err);
common_vendor.index.chooseLocation({
success: (res) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:354", "选择位置成功:", res);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:496", "选择位置成功:", 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:361", "选择位置失败:", chooseErr);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:503", "选择位置失败:", chooseErr);
showAddPopup.value = true;
if (chooseErr.errMsg && chooseErr.errMsg.indexOf("cancel") === -1) {
common_vendor.index.showToast({
@@ -160,7 +236,7 @@ const _sfc_main = {
}, 300);
};
const handleAdd = async () => {
var _a;
var _a, _b;
if (!formData.title) {
common_vendor.index.showToast({
title: "请输入隐患标题",
@@ -187,12 +263,12 @@ const _sfc_main = {
});
const selectedTag = tagOptions.value[formData.tagIndex];
const tagId = selectedTag ? selectedTag.id : null;
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:408", "innnn", sourceOptions);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:550", "innnn", sourceOptions);
const params = {
title: formData.title,
//标题
level: formData.level + 1,
// 1.轻微隐患 2.一般隐患 3.重大隐患
level: ((_a = levelOptions.value[formData.level]) == null ? void 0 : _a.id) || 2,
// 2.一般隐患 3.重大隐患
lng: lng.value || 0,
//经度
lat: lat.value || 0,
@@ -209,12 +285,14 @@ const _sfc_main = {
//关联任务ID
checkPointId: checkPointId.value,
//关联检查点ID
source: ((_a = sourceOptions.value[formData.source]) == null ? void 0 : _a.title) || "",
source: ((_b = sourceOptions.value[formData.source]) == null ? void 0 : _b.title) || "",
//隐患来源(随手拍、企业自查、行业互查、专家诊查)
attachments
attachments,
//附件列表(图片/视频)
regulationId: formData.regulationId || null
// 法律依据ID
};
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:426", "提交的参数:", params);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:569", "提交的参数:", params);
try {
const res = await request_api.addHiddenDanger(params);
if (res.code === 0) {
@@ -231,6 +309,10 @@ const _sfc_main = {
selectedAreaId.value = "";
selectedAreaName.value = "";
fileList1.value = [];
formData.regulationId = null;
formData.regulationName = "";
selectedLawId.value = null;
selectedLawName.value = "";
fetchHiddenDangerList();
} else {
common_vendor.index.showToast({
@@ -239,7 +321,7 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:454", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:602", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
@@ -259,7 +341,7 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:475", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:623", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
@@ -309,7 +391,20 @@ const _sfc_main = {
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url);
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, {
@@ -317,7 +412,7 @@ const _sfc_main = {
status: "success",
message: "",
// url: baseUrl + serverPath,
url: request_request.baseUrl.replace("/prod-api", "") + serverPath,
url: request_request.toImageUrl(serverPath),
serverPath
});
fileListLen++;
@@ -341,7 +436,7 @@ const _sfc_main = {
}
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:571", "上传失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:732", "上传失败:", err);
reject(err);
}
});
@@ -359,20 +454,20 @@ const _sfc_main = {
const fullImageUrl = imageFiles[0].url;
aiAnalyzing.value = true;
try {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:593", "开始调用AI分析接口图片地址:", fullImageUrl);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:754", "开始调用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:601", "AI分析结果:", aiData);
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:762", "AI分析结果:", aiData);
if (aiData.title)
formData.title = aiData.title;
if (aiData.description)
formData.description = aiData.description;
if (aiData.level) {
const levelMap = { "轻微": 0, "轻微隐患": 0, "一般": 1, "一般隐患": 1, "重大": 2, "重大隐患": 2 };
const levelMap = { "轻微": 0, "轻微隐患": 0, "一般": 0, "一般隐患": 0, "重大": 1, "重大隐患": 1 };
const levelIndex = levelMap[aiData.level];
if (levelIndex !== void 0) {
formData.level = levelIndex;
@@ -388,7 +483,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:624", "AI分析接口调用失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:785", "AI分析接口调用失败:", error);
common_vendor.index.showToast({ title: "AI分析失败请重试", icon: "none" });
} finally {
aiAnalyzing.value = false;
@@ -410,7 +505,7 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:647", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:808", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
@@ -419,10 +514,10 @@ const _sfc_main = {
};
fetchTagOptions();
const levelOptions = common_vendor.ref([
{
id: 1,
title: "轻微隐患"
},
// {
// id: 1,
// title: '轻微隐患'
// },
{
id: 2,
title: "一般隐患"
@@ -452,7 +547,7 @@ const _sfc_main = {
]);
common_vendor.watch(() => formData.source, (newVal) => {
const selected = sourceOptions.value[newVal];
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:693", "隐患来源选择结果:", {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:855", "隐患来源选择结果:", {
索引: newVal,
选中项: selected,
id: selected == null ? void 0 : selected.id,
@@ -460,19 +555,20 @@ const _sfc_main = {
});
});
const statusTabs = common_vendor.ref([
{ label: "全部状态", value: "" },
{ label: "待验收", value: "待验收" },
{ label: "待整改", value: "待整改" },
{ label: "待交办", value: "待交办" },
{ label: "验收通过", value: "验收通过" }
{ label: "全部", value: null },
{ label: "待交办", value: 1 },
{ label: "待整改", value: 2 },
{ label: "待验收", value: 3 },
{ label: "待销号", value: 4 },
{ label: "已完成", value: 5 }
]);
const activeTab = common_vendor.ref(0);
const filteredList = common_vendor.computed(() => {
const currentTab = statusTabs.value[activeTab.value];
if (!currentTab || !currentTab.value) {
if (!currentTab || currentTab.value === null) {
return hiddenDangerList.value;
}
return hiddenDangerList.value.filter((item) => item.statusName === currentTab.value);
return hiddenDangerList.value.filter((item) => item.status === currentTab.value);
});
return (_ctx, _cache) => {
return common_vendor.e({
@@ -530,70 +626,106 @@ const _sfc_main = {
fileList: fileList1.value,
name: "1",
multiple: true,
imageMode: "aspectFill",
maxCount: 10
}),
i: !aiAnalyzing.value
i: canvasWidth.value,
j: canvasHeight.value,
k: canvasWidth.value + "px",
l: canvasHeight.value + "px",
m: !aiAnalyzing.value
}, !aiAnalyzing.value ? {} : {}, {
j: common_vendor.t(aiAnalyzing.value ? "AI识别中..." : "AI 识别隐患"),
k: aiAnalyzing.value,
l: aiAnalyzing.value,
m: common_vendor.o(handleAiAnalyze),
n: common_vendor.o(($event) => formData.title = $event),
o: common_vendor.p({
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({
placeholder: "请输入内容",
border: "surround",
modelValue: formData.title
}),
p: common_vendor.sr(levelChooseRef, "b44c631d-3,b44c631d-0", {
t: common_vendor.sr(levelChooseRef, "b44c631d-3,b44c631d-0", {
"k": "levelChooseRef"
}),
q: common_vendor.o(($event) => formData.level = $event),
r: common_vendor.p({
v: common_vendor.o(($event) => formData.level = $event),
w: common_vendor.p({
options: levelOptions.value,
wrap: false,
["item-width"]: "183rpx",
["item-height"]: "72rpx",
modelValue: formData.level
}),
s: common_vendor.o(($event) => formData.source = $event),
t: common_vendor.p({
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
}),
v: common_vendor.o(($event) => selectedAddress.value = $event),
w: common_vendor.p({
z: common_vendor.o(($event) => selectedAddress.value = $event),
A: common_vendor.p({
placeholder: "请输入地址",
border: "surround",
modelValue: selectedAddress.value
}),
x: common_vendor.o(chooseLocation),
y: common_vendor.t(selectedAreaName.value || "请选择隐患区域"),
z: !selectedAreaName.value ? 1 : "",
A: common_vendor.o(($event) => showAreaPicker.value = true),
B: common_vendor.o(($event) => formData.description = $event),
C: common_vendor.p({
B: common_vendor.o(chooseLocation),
C: common_vendor.t(formData.regulationName || "请选择法律依据"),
D: !formData.regulationName ? 1 : "",
E: common_vendor.o(openLawPopup),
F: common_vendor.t(selectedAreaName.value || "请选择隐患区域"),
G: !selectedAreaName.value ? 1 : "",
H: common_vendor.o(($event) => showAreaPicker.value = true),
I: common_vendor.o(($event) => formData.description = $event),
J: common_vendor.p({
placeholder: "请输入内容",
modelValue: formData.description
}),
D: common_vendor.o(($event) => formData.tagIndex = $event),
E: common_vendor.p({
K: common_vendor.o(($event) => formData.tagIndex = $event),
L: common_vendor.p({
options: tagOptions.value,
modelValue: formData.tagIndex
}),
F: common_vendor.o(($event) => showAddPopup.value = false),
G: common_vendor.o(handleAdd),
H: common_vendor.o(($event) => showAddPopup.value = false),
I: common_vendor.p({
M: common_vendor.o(($event) => showAddPopup.value = false),
N: common_vendor.o(handleAdd),
O: common_vendor.o(($event) => showAddPopup.value = false),
P: common_vendor.p({
show: showAddPopup.value,
mode: "center",
round: "20"
}),
J: common_vendor.o(($event) => showAreaPicker.value = false),
K: common_vendor.o(confirmAreaSelect),
L: common_vendor.f(areaList.value, (item, k0, i0) => {
Q: common_vendor.o(($event) => showLawPopup.value = false),
R: common_vendor.o(searchRegulation),
S: lawKeyword.value,
T: common_vendor.o(($event) => lawKeyword.value = $event.detail.value),
U: common_vendor.o(searchRegulation),
V: lawLoading.value && lawList.value.length === 0
}, lawLoading.value && lawList.value.length === 0 ? {} : !lawLoading.value && lawList.value.length === 0 ? {} : common_vendor.e({
X: common_vendor.f(lawList.value, (item, k0, i0) => {
return {
a: common_vendor.t(item.depict),
b: common_vendor.t(item.legalBasis),
c: selectedLawId.value === item.id ? 1 : "",
d: item.id,
e: common_vendor.o(($event) => selectLaw(item), item.id)
};
}),
Y: lawLoading.value
}, lawLoading.value ? {} : {}), {
W: !lawLoading.value && lawList.value.length === 0,
Z: common_vendor.o(loadMoreLaw),
aa: common_vendor.o(($event) => showLawPopup.value = false),
ab: common_vendor.o(confirmLaw),
ac: common_vendor.o(($event) => showLawPopup.value = false),
ad: common_vendor.p({
show: showLawPopup.value,
mode: "center",
round: "20"
}),
ae: common_vendor.o(($event) => showAreaPicker.value = false),
af: common_vendor.o(confirmAreaSelect),
ag: common_vendor.f(areaList.value, (item, k0, i0) => {
return common_vendor.e({
a: item.color,
b: common_vendor.t(item.name),
@@ -604,15 +736,15 @@ const _sfc_main = {
f: common_vendor.o(($event) => tempAreaId.value = item.id, item.id)
});
}),
M: areaList.value.length === 0
ah: areaList.value.length === 0
}, areaList.value.length === 0 ? {} : {}, {
N: common_vendor.o(($event) => showAreaPicker.value = false),
O: common_vendor.p({
ai: common_vendor.o(($event) => showAreaPicker.value = false),
aj: common_vendor.p({
show: showAreaPicker.value,
mode: "bottom",
round: "20"
}),
P: common_vendor.gei(_ctx, "")
ak: common_vendor.gei(_ctx, "")
});
};
}

File diff suppressed because one or more lines are too long

View File

@@ -316,6 +316,114 @@
background: #2667E9;
border-radius: 3rpx;
}
.law-popup.data-v-b44c631d {
width: 600rpx;
background: #fff;
border-radius: 20rpx;
overflow: hidden;
max-height: 80vh;
}
.law-popup .popup-header.data-v-b44c631d {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.law-popup .popup-header .popup-title.data-v-b44c631d {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.law-popup .popup-header .popup-close.data-v-b44c631d {
font-size: 40rpx;
color: #999;
cursor: pointer;
}
.search-box.data-v-b44c631d {
display: flex;
align-items: center;
background: #F5F5F5;
border-radius: 40rpx;
padding: 16rpx 24rpx;
margin: 20rpx 30rpx;
}
.search-box .search-icon.data-v-b44c631d {
font-size: 28rpx;
color: #999;
margin-right: 12rpx;
}
.search-box .search-input.data-v-b44c631d {
flex: 1;
font-size: 28rpx;
background: transparent;
border: none;
}
.search-box .search-btn.data-v-b44c631d {
color: #2667E9;
font-size: 26rpx;
margin-left: 16rpx;
cursor: pointer;
}
.loading-tip.data-v-b44c631d, .empty-tip.data-v-b44c631d {
text-align: center;
padding: 40rpx;
color: #999;
font-size: 26rpx;
}
.law-list.data-v-b44c631d {
max-height: 400rpx;
padding: 0 30rpx;
}
.law-item.data-v-b44c631d {
padding: 24rpx;
border: 2rpx solid #E5E5E5;
border-radius: 12rpx;
margin-bottom: 16rpx;
font-size: 28rpx;
color: #333;
}
.law-item .law-title.data-v-b44c631d {
line-height: 1.5;
margin-bottom: 8rpx;
font-weight: bold;
}
.law-item .law-basis.data-v-b44c631d {
font-size: 24rpx;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.law-item-active.data-v-b44c631d {
border-color: #2667E9;
background: #F0F6FF;
}
.popup-footer.data-v-b44c631d {
display: flex;
padding: 30rpx;
border-top: 1rpx solid #eee;
gap: 20rpx;
}
.popup-footer button.data-v-b44c631d {
flex: 1;
height: 80rpx;
line-height: 80rpx;
font-size: 28rpx;
border-radius: 40rpx;
}
.popup-footer button.data-v-b44c631d::after {
border: none;
}
.popup-footer .btn-cancel.data-v-b44c631d {
background: #f5f5f5;
color: #666;
}
.popup-footer .btn-confirm.data-v-b44c631d {
background: #2667E9;
color: #fff;
}
/**
* 这里是uni-app内置的常用样式变量
*
@@ -343,6 +451,18 @@
/* 透明度 */
/* 文章场景相关 */
/* 全局样式覆盖 up-tag 文字居中 */
.card-actions {
margin-top: 20rpx;
}
.card-actions .cu-btn {
padding: 0 24rpx !important;
font-size: 28rpx !important;
height: 64rpx !important;
line-height: 64rpx !important;
white-space: nowrap !important;
flex-shrink: 0 !important;
width: auto !important;
}
.u-tag {
justify-content: center !important;
}

View File

@@ -2,15 +2,18 @@
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");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
(_easycom_up_textarea2 + _easycom_up_upload2)();
const _easycom_wd_signature2 = common_vendor.resolveComponent("wd-signature");
(_easycom_up_textarea2 + _easycom_up_upload2 + _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_wd_signature = () => "../../node-modules/wot-design-uni/components/wd-signature/wd-signature.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_upload)();
(_easycom_up_textarea + _easycom_up_upload + _easycom_wd_signature)();
}
const _sfc_main = {
__name: "acceptance",
@@ -30,6 +33,21 @@ const _sfc_main = {
// 验收备注
});
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 hasDraft = common_vendor.ref(false);
const showRestoreBanner = common_vendor.ref(false);
const isRestoring = common_vendor.ref(false);
const isInitialized = common_vendor.ref(false);
const signaturePaths = common_vendor.ref([]);
const getDraftKey = () => `draft_accept_${rectifyId.value || ""}`;
const getFullPath = (filePath) => {
if (!filePath)
return "";
@@ -59,15 +77,15 @@ const _sfc_main = {
if (assign.rectify.attachments) {
rectifyAttachments.value = assign.rectify.attachments;
}
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:108", "整改记录:", rectifyData);
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:109", "整改附件:", rectifyAttachments.value);
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:167", "整改记录:", rectifyData);
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:168", "整改附件:", rectifyAttachments.value);
}
}
} else {
common_vendor.index.showToast({ title: res.msg || "获取详情失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:116", "获取隐患详情失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:175", "获取隐患详情失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
@@ -81,7 +99,7 @@ const _sfc_main = {
if (options.assignId) {
assignId.value = options.assignId;
}
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:131", "验收页面参数:", { rectifyId: rectifyId.value, hazardId: hazardId.value, assignId: assignId.value });
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:190", "验收页面参数:", { rectifyId: rectifyId.value, hazardId: hazardId.value, assignId: assignId.value });
fetchDetail();
});
const handleCancel = () => {
@@ -95,6 +113,31 @@ const _sfc_main = {
});
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) {
common_vendor.index.showToast({
title: "请进行电子签名",
icon: "none"
});
return;
}
isSubmitting.value = true;
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
await executeSubmit();
}
};
const executeSubmit = async () => {
const attachments = fileList1.value.map((file) => {
let url = "";
if (typeof file.url === "string") {
@@ -102,6 +145,9 @@ const _sfc_main = {
} 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 || "",
@@ -114,12 +160,16 @@ const _sfc_main = {
rectifyId: Number(rectifyId.value),
result: formData.result,
verifyRemark: formData.verifyRemark || "",
attachments
attachments,
signPath: signatureServerPath.value || ""
// 电子签名路径
};
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:176", "提交验收参数:", params);
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:271", "提交验收参数:", 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"
@@ -134,16 +184,29 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:195", "验收失败:", error);
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:293", "验收失败:", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
});
} finally {
isSubmitting.value = false;
}
};
const deletePic = (event) => {
fileList1.value.splice(event.index, 1);
};
const addWatermark = (tempFilePath) => {
const instance = common_vendor.getCurrentInstance();
return utils_watermark.addTimestampWatermark({
tempFilePath,
canvasId: "watermarkCanvas",
canvasWidthRef: canvasWidth,
canvasHeightRef: canvasHeight,
instance
});
};
const afterRead = async (event) => {
let lists = [].concat(event.file);
let fileListLen = fileList1.value.length;
@@ -151,18 +214,29 @@ const _sfc_main = {
fileList1.value.push({
...item,
status: "uploading",
message: "上传中"
message: "处理中..."
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url);
let item = fileList1.value[fileListLen];
fileList1.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
url: result
});
try {
const watermarkedUrl = await addWatermark(lists[i].url);
const result = await uploadFilePromise(watermarkedUrl);
let item = fileList1.value[fileListLen];
fileList1.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
url: request_request.toImageUrl(result.url || result.filePath || result)
});
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:352", "加水印或上传失败:", e);
let item = fileList1.value[fileListLen];
fileList1.value.splice(fileListLen, 1, {
...item,
status: "failed",
message: "处理失败"
});
}
fileListLen++;
}
};
@@ -184,12 +258,173 @@ const _sfc_main = {
}
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:250", "上传失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:382", "上传失败:", err);
reject(err);
}
});
});
};
const saveDraft = () => {
if (isRestoring.value || !isInitialized.value)
return;
const key = getDraftKey();
const hasContent = formData.verifyRemark || fileList1.value.length > 0 || signatureServerPath.value || signaturePaths.value.length > 0;
if (!hasContent) {
common_vendor.index.removeStorageSync(key);
hasDraft.value = false;
return;
}
const data = {
formData: {
result: formData.result,
verifyRemark: formData.verifyRemark
},
fileList1: fileList1.value,
signatureServerPath: signatureServerPath.value,
signatureUrl: signatureUrl.value,
showCanvas: showCanvas.value,
signaturePaths: signaturePaths.value
};
common_vendor.index.setStorageSync(key, JSON.stringify(data));
hasDraft.value = true;
};
const clearDraft = (showToast = true) => {
const key = getDraftKey();
common_vendor.index.removeStorageSync(key);
hasDraft.value = false;
showRestoreBanner.value = false;
isRestoring.value = true;
formData.result = 1;
formData.verifyRemark = "";
fileList1.value = [];
signatureServerPath.value = "";
signatureUrl.value = "";
showCanvas.value = true;
signaturePaths.value = [];
if (signatureRef.value) {
signatureRef.value.clear();
}
common_vendor.nextTick$1(() => {
isRestoring.value = false;
});
if (showToast) {
common_vendor.index.showToast({ title: "草稿已清空", icon: "none" });
}
};
const restoreDraft = () => {
const key = getDraftKey();
const cached = common_vendor.index.getStorageSync(key);
if (cached) {
try {
const data = JSON.parse(cached);
const hasContent = data.formData.verifyRemark || data.fileList1 && data.fileList1.length > 0 || data.signatureServerPath || data.signaturePaths && data.signaturePaths.length > 0;
if (!hasContent) {
isInitialized.value = true;
return;
}
isRestoring.value = true;
formData.result = data.formData.result !== void 0 ? data.formData.result : 1;
formData.verifyRemark = data.formData.verifyRemark || "";
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 || [];
hasDraft.value = true;
showRestoreBanner.value = true;
if (signaturePaths.value.length > 0) {
setTimeout(() => {
if (signatureRef.value) {
isSignatureEmpty.value = false;
}
}, 450);
}
common_vendor.nextTick$1(() => {
isRestoring.value = false;
isInitialized.value = true;
});
common_vendor.index.showToast({
title: "已自动恢复您上次未提交的内容",
icon: "none",
duration: 2500
});
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:502", "解析草稿失败:", e);
isRestoring.value = false;
isInitialized.value = true;
}
} else {
isInitialized.value = true;
}
};
common_vendor.watch(
() => [
formData.result,
formData.verifyRemark,
fileList1.value,
signatureServerPath.value,
signaturePaths.value
],
() => {
if (rectifyId.value) {
saveDraft();
}
},
{ deep: true }
);
const clearSignature = () => {
isSignatureEmpty.value = true;
if (signatureRef.value) {
signatureRef.value.clear();
}
};
const reSign = () => {
isSignatureEmpty.value = true;
showCanvas.value = true;
signatureUrl.value = "";
signatureServerPath.value = "";
common_vendor.nextTick$1(() => {
if (signatureRef.value) {
signatureRef.value.clear();
}
});
};
const onSignatureConfirm = async (tempFilePath) => {
try {
const res = await uploadFilePromise(tempFilePath);
const path = res && typeof res === "object" ? res.url || res.filePath || "" : res || "";
signatureServerPath.value = path;
signatureUrl.value = path.startsWith("http") ? path : request_request.baseUrl.replace("/api", "") + path;
if (isSubmitting.value) {
await executeSubmit();
}
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:573", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
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:584", "获取系统信息失败:", e);
}
if (options.rectifyId) {
rectifyId.value = options.rectifyId;
}
if (options.hazardId) {
hazardId.value = options.hazardId;
}
if (options.assignId) {
assignId.value = options.assignId;
}
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:595", "验收页面参数:", { rectifyId: rectifyId.value, hazardId: hazardId.value, assignId: assignId.value });
fetchDetail();
restoreDraft();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t(rectifyData.rectifyPlan || "暂无"),
@@ -219,11 +454,44 @@ const _sfc_main = {
fileList: fileList1.value,
name: "1",
multiple: true,
imageMode: "aspectFill",
maxCount: 10
}),
n: common_vendor.o(handleCancel),
o: common_vendor.o(handleSubmit),
p: common_vendor.gei(_ctx, "")
n: canvasWidth.value,
o: canvasHeight.value,
p: canvasWidth.value + "px",
q: canvasHeight.value + "px",
r: showCanvas.value
}, showCanvas.value ? {
s: common_vendor.o(clearSignature)
} : {
t: common_vendor.o(reSign)
}, {
v: !showCanvas.value
}, !showCanvas.value ? {
w: signatureUrl.value
} : {}, {
x: showCanvas.value
}, showCanvas.value ? {
y: common_vendor.sr(signatureRef, "39f9b795-2", {
"k": "signatureRef"
}),
z: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
A: common_vendor.o(($event) => isSignatureEmpty.value = false),
B: common_vendor.o(($event) => isSignatureEmpty.value = false),
C: common_vendor.o(($event) => isSignatureEmpty.value = true),
D: common_vendor.p({
width: signatureWidth.value,
height: 160,
backgroundColor: "#f8f8f8",
penColor: "#000000",
lineWidth: 3,
enableHistory: false
})
} : {}, {
E: common_vendor.o(handleCancel),
F: common_vendor.o(handleSubmit),
G: common_vendor.gei(_ctx, "")
});
};
}

View File

@@ -2,6 +2,7 @@
"navigationBarTitleText": "隐患验收",
"usingComponents": {
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload"
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload",
"wd-signature": "../../node-modules/wot-design-uni/components/wd-signature/wd-signature"
}
}

View File

@@ -1 +1 @@
<view class="{{['page', 'padding', 'data-v-39f9b795', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{p}}"><view class="padding bg-white radius data-v-39f9b795"><view class="text-gray margin-bottom data-v-39f9b795">整改记录</view><view class="padding solid radius data-v-39f9b795"><view class="flex data-v-39f9b795"><view class="data-v-39f9b795">整改方案:</view><view class="data-v-39f9b795">{{a}}</view></view><view class="flex margin-top-sm data-v-39f9b795"><view class="data-v-39f9b795">完成情况:</view><view class="data-v-39f9b795">{{b}}</view></view><view class="margin-top-sm data-v-39f9b795"><view class="data-v-39f9b795">整改附件:</view><view wx:if="{{c}}" class="flex margin-top-xs data-v-39f9b795" style="flex-wrap:wrap;gap:10rpx"><image wx:for="{{d}}" wx:for-item="img" wx:key="a" class="data-v-39f9b795" src="{{img.b}}" style="width:136rpx;height:136rpx;border-radius:16rpx" mode="aspectFill" bindtap="{{img.c}}"></image></view><view wx:else class="text-gray text-sm margin-top-xs data-v-39f9b795">暂无附件</view></view></view><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收结果</view><view class="text-red data-v-39f9b795">*</view></view><view class="flex data-v-39f9b795" style="gap:20rpx"><button class="{{['data-v-39f9b795', 'result-btn', e]}}" bindtap="{{f}}">通过</button><button class="{{['data-v-39f9b795', 'result-btn', g]}}" bindtap="{{h}}">不通过</button></view><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收备注</view></view><up-textarea wx:if="{{j}}" class="data-v-39f9b795" virtualHostClass="data-v-39f9b795" u-i="39f9b795-0" bind:__l="__l" bindupdateModelValue="{{i}}" u-p="{{j}}"></up-textarea><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收图片/视频</view></view><up-upload wx:if="{{m}}" class="data-v-39f9b795" virtualHostClass="data-v-39f9b795" bindafterRead="{{k}}" binddelete="{{l}}" u-i="39f9b795-1" bind:__l="__l" u-p="{{m}}"></up-upload><view class="flex margin-top-xl data-v-39f9b795" style="gap:20rpx"><button class="round flex-sub data-v-39f9b795" bindtap="{{n}}">取消</button><button class="bg-blue round flex-sub data-v-39f9b795" bindtap="{{o}}">提交验收</button></view></view></view>
<view class="{{['page', 'padding', 'data-v-39f9b795', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{G}}"><view class="padding bg-white radius data-v-39f9b795"><view class="text-gray margin-bottom data-v-39f9b795">整改记录</view><view class="padding solid radius data-v-39f9b795"><view class="data-v-39f9b795"><view class="data-v-39f9b795" style="color:#999;margin-bottom:10rpx">整改方案:</view><view class="data-v-39f9b795" style="word-break:break-all;line-height:1.6;color:#333">{{a}}</view></view><view class="margin-top data-v-39f9b795"><view class="data-v-39f9b795" style="color:#999;margin-bottom:10rpx">完成情况:</view><view class="data-v-39f9b795" style="word-break:break-all;line-height:1.6;color:#333">{{b}}</view></view><view class="margin-top-sm data-v-39f9b795"><view class="data-v-39f9b795">整改附件:</view><view wx:if="{{c}}" class="flex margin-top-xs data-v-39f9b795" style="flex-wrap:wrap;gap:10rpx"><image wx:for="{{d}}" wx:for-item="img" wx:key="a" class="data-v-39f9b795" src="{{img.b}}" style="width:136rpx;height:136rpx;border-radius:16rpx" mode="aspectFill" bindtap="{{img.c}}"></image></view><view wx:else class="text-gray text-sm margin-top-xs data-v-39f9b795">暂无附件</view></view></view><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收结果</view><view class="text-red data-v-39f9b795">*</view></view><view class="flex data-v-39f9b795" style="gap:20rpx"><button class="{{['data-v-39f9b795', 'result-btn', e]}}" bindtap="{{f}}">通过</button><button class="{{['data-v-39f9b795', 'result-btn', g]}}" bindtap="{{h}}">不通过</button></view><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收备注</view></view><up-textarea wx:if="{{j}}" class="data-v-39f9b795" virtualHostClass="data-v-39f9b795" u-i="39f9b795-0" bind:__l="__l" bindupdateModelValue="{{i}}" u-p="{{j}}"></up-textarea><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收图片/视频</view></view><up-upload wx:if="{{m}}" class="data-v-39f9b795" virtualHostClass="data-v-39f9b795" bindafterRead="{{k}}" binddelete="{{l}}" u-i="39f9b795-1" bind:__l="__l" u-p="{{m}}"></up-upload><canvas class="data-v-39f9b795" canvas-id="watermarkCanvas" width="{{n}}" height="{{o}}" style="{{'width:' + p + ';' + ('height:' + q) + ';' + ('position:' + 'fixed') + ';' + ('left:' + '-9999px') + ';' + ('top:' + '-9999px')}}"></canvas><view class="flex justify-between margin-bottom margin-top-sm align-center data-v-39f9b795"><view class="text-gray flex align-center data-v-39f9b795"> 电子签名 <view class="text-red data-v-39f9b795">*</view></view><button wx:if="{{r}}" class="cu-btn sm round line-blue data-v-39f9b795" style="margin:0;padding:0 20rpx;height:50rpx;font-size:22rpx" bindtap="{{s}}">清除重写</button><button wx:else class="cu-btn sm round line-blue data-v-39f9b795" style="margin:0;padding:0 20rpx;height:50rpx;font-size:22rpx" bindtap="{{t}}">重新签名</button></view><view class="signature-box margin-bottom data-v-39f9b795"><view wx:if="{{v}}" class="signature-display flex align-center justify-center data-v-39f9b795" style="width:100%;height:160px;background-color:#f8f8f8;display:flex;align-items:center;justify-content:center"><image src="{{w}}" class="signature-img data-v-39f9b795" mode="aspectFit" style="width:100%;height:100%"></image></view><view wx:if="{{x}}" class="signature-pad-wrap data-v-39f9b795" style="border:1px dashed #dcdfe6;border-radius:8rpx;overflow:hidden;background-color:#f8f8f8"><wd-signature wx:if="{{D}}" class="r data-v-39f9b795" virtualHostClass="r data-v-39f9b795" u-s="{{['footer']}}" u-r="signatureRef" bindconfirm="{{z}}" bindstart="{{A}}" bindsigning="{{B}}" bindclear="{{C}}" u-i="39f9b795-2" bind:__l="__l" u-p="{{D}}"><view slot="footer"></view></wd-signature></view></view><view class="flex margin-top-xl data-v-39f9b795" style="gap:20rpx"><button class="round flex-sub data-v-39f9b795" bindtap="{{E}}">取消</button><button class="bg-blue round flex-sub data-v-39f9b795" bindtap="{{F}}">提交验收</button></view></view></view>

View File

@@ -43,4 +43,20 @@
.result-btn.active.data-v-39f9b795 {
background: #2667E9;
color: #fff;
}
.signature-box.data-v-39f9b795 {
width: 100%;
min-height: 240rpx;
background: #f8f8f8;
border: 1rpx dashed #dcdfe6;
border-radius: 8rpx;
margin-top: 16rpx;
}
.signature-box .signature-img.data-v-39f9b795 {
width: 100%;
height: 100%;
}
.signature-box .signature-placeholder.data-v-39f9b795 {
color: #909399;
font-size: 28rpx;
}

View File

@@ -41,14 +41,14 @@ const _sfc_main = {
});
userList.value = users;
userColumns.value = [users.map((u) => u.name)];
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:83", "整改人员列表:", users);
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:91", "整改人员列表:", users);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:86", "获取部门人员失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:94", "获取部门人员失败:", error);
}
};
const onUserConfirm = (e) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:92", "选择的人员:", e);
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:100", "选择的人员:", e);
if (e.value && e.value.length > 0) {
selectedUser.value = e.value[0];
const user = userList.value.find((u) => u.name === e.value[0]);
@@ -59,7 +59,7 @@ const _sfc_main = {
showUserPicker.value = false;
};
const onDateConfirm = (e) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:106", "选择的日期时间:", e);
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:114", "选择的日期时间:", e);
const date = new Date(e.value);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
@@ -92,10 +92,11 @@ const _sfc_main = {
assignRemark: ""
// 交办备注(可选)
};
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:142", "提交数据:", params);
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:150", "提交数据:", params);
try {
const res = await request_api.assignHiddenDanger(params);
if (res.code === 0) {
clearDraft(false);
common_vendor.index.showToast({ title: "交办成功", icon: "success" });
setTimeout(() => {
common_vendor.index.navigateBack();
@@ -104,45 +105,122 @@ const _sfc_main = {
common_vendor.index.showToast({ title: res.msg || "交办失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:155", "交办失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:164", "交办失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
const hasDraft = common_vendor.ref(false);
const showRestoreBanner = common_vendor.ref(false);
const isRestoring = common_vendor.ref(false);
const getDraftKey = () => `draft_assign_${hazardId.value || ""}`;
const saveDraft = () => {
if (isRestoring.value)
return;
const key = getDraftKey();
const hasContent = selectedDate.value;
if (!hasContent) {
common_vendor.index.removeStorageSync(key);
hasDraft.value = false;
return;
}
const data = {
selectedDate: selectedDate.value,
dateValue: dateValue.value
};
common_vendor.index.setStorageSync(key, JSON.stringify(data));
hasDraft.value = true;
};
const clearDraft = (showToast = true) => {
const key = getDraftKey();
common_vendor.index.removeStorageSync(key);
hasDraft.value = false;
showRestoreBanner.value = false;
isRestoring.value = true;
selectedDate.value = "";
dateValue.value = Date.now();
common_vendor.nextTick$1(() => {
isRestoring.value = false;
});
if (showToast) {
common_vendor.index.showToast({ title: "草稿已清空", icon: "none" });
}
};
const restoreDraft = () => {
const key = getDraftKey();
const cached = common_vendor.index.getStorageSync(key);
if (cached) {
try {
const data = JSON.parse(cached);
const hasContent = data.selectedDate;
if (!hasContent)
return;
isRestoring.value = true;
selectedDate.value = data.selectedDate || "";
dateValue.value = data.dateValue || Date.now();
hasDraft.value = true;
showRestoreBanner.value = true;
common_vendor.nextTick$1(() => {
isRestoring.value = false;
});
common_vendor.index.showToast({
title: "已自动恢复您上次未提交的内容",
icon: "none",
duration: 2500
});
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:239", "解析草稿失败:", e);
isRestoring.value = false;
}
}
};
common_vendor.watch(
() => [selectedDate.value],
() => {
if (hazardId.value) {
saveDraft();
}
}
);
common_vendor.onLoad((options) => {
if (options.hazardId)
hazardId.value = options.hazardId;
if (options.assignId)
assignId.value = options.assignId;
fetchDeptUsers();
restoreDraft();
});
return (_ctx, _cache) => {
return {
a: common_vendor.t(selectedUser.value || "请选择整改人员"),
b: common_vendor.n(selectedUser.value ? "" : "text-gray"),
c: common_vendor.o(($event) => showUserPicker.value = true),
d: common_vendor.o(onUserConfirm),
e: common_vendor.o(($event) => showUserPicker.value = false),
f: common_vendor.o(($event) => showUserPicker.value = false),
g: common_vendor.p({
return common_vendor.e({
a: showRestoreBanner.value
}, showRestoreBanner.value ? {
b: common_vendor.o(($event) => clearDraft(true))
} : {}, {
c: common_vendor.t(selectedUser.value || "请选择整改人员"),
d: common_vendor.n(selectedUser.value ? "" : "text-gray"),
e: common_vendor.o(($event) => showUserPicker.value = true),
f: common_vendor.o(onUserConfirm),
g: common_vendor.o(($event) => showUserPicker.value = false),
h: common_vendor.o(($event) => showUserPicker.value = false),
i: common_vendor.p({
show: showUserPicker.value,
columns: userColumns.value
}),
h: common_vendor.t(selectedDate.value || "请选择整改期限"),
i: common_vendor.n(selectedDate.value ? "" : "text-gray"),
j: common_vendor.o(($event) => showDatePicker.value = true),
k: common_vendor.o(onDateConfirm),
l: common_vendor.o(($event) => showDatePicker.value = false),
m: common_vendor.o(($event) => showDatePicker.value = false),
n: common_vendor.o(($event) => dateValue.value = $event),
o: common_vendor.p({
j: common_vendor.t(selectedDate.value || "请选择整改期限"),
k: common_vendor.n(selectedDate.value ? "" : "text-gray"),
l: common_vendor.o(($event) => showDatePicker.value = true),
m: common_vendor.o(onDateConfirm),
n: common_vendor.o(($event) => showDatePicker.value = false),
o: common_vendor.o(($event) => showDatePicker.value = false),
p: common_vendor.o(($event) => dateValue.value = $event),
q: common_vendor.p({
show: showDatePicker.value,
mode: "datetime",
modelValue: dateValue.value
}),
p: common_vendor.o(handleCancel),
q: common_vendor.o(handleSubmit),
r: common_vendor.gei(_ctx, "")
};
r: common_vendor.o(handleCancel),
s: common_vendor.o(handleSubmit),
t: common_vendor.gei(_ctx, "")
});
};
}
};

View File

@@ -1 +1 @@
<view class="{{['padding', 'page', 'data-v-6209e844', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{r}}"><view class="padding radius bg-white data-v-6209e844"><view class="flex margin-bottom data-v-6209e844"><view class="text-gray data-v-6209e844">整改人员</view><view class="text-red data-v-6209e844">*</view></view><view class="picker-input data-v-6209e844" bindtap="{{c}}"><text class="{{['data-v-6209e844', b]}}">{{a}}</text></view><up-picker wx:if="{{g}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" bindconfirm="{{d}}" bindcancel="{{e}}" bindclose="{{f}}" u-i="6209e844-0" bind:__l="__l" u-p="{{g}}"></up-picker><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">整改期限</view><view class="text-red data-v-6209e844">*</view></view><view class="picker-input data-v-6209e844" bindtap="{{j}}"><text class="{{['data-v-6209e844', i]}}">{{h}}</text></view><up-datetime-picker wx:if="{{o}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" bindconfirm="{{k}}" bindcancel="{{l}}" bindclose="{{m}}" u-i="6209e844-1" bind:__l="__l" bindupdateModelValue="{{n}}" u-p="{{o}}"></up-datetime-picker><view class="btn-group margin-top-xl data-v-6209e844"><button class="btn-cancel data-v-6209e844" bindtap="{{p}}">取消</button><button class="btn-confirm bg-blue data-v-6209e844" bindtap="{{q}}">确认</button></view></view></view>
<view class="{{['padding', 'page', 'data-v-6209e844', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{t}}"><view class="padding radius bg-white data-v-6209e844"><view wx:if="{{a}}" class="bg-orange-light text-orange padding-sm radius margin-bottom flex justify-between align-center data-v-6209e844" style="font-size:24rpx;background-color:#FFF7EB;border:1rpx solid #FFE4CC;width:100%;box-sizing:border-box;display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:20rpx"><view class="flex align-center data-v-6209e844" style="display:flex;flex-direction:row;align-items:center"><text class="cuIcon-info margin-right-xs data-v-6209e844" style="margin-right:10rpx"></text><text class="data-v-6209e844">已自动恢复您上次未提交的内容</text></view><text class="text-blue text-bold data-v-6209e844" style="cursor:pointer;padding:0 10rpx;color:#2667E9;font-weight:bold" bindtap="{{b}}">清空草稿</text></view><view class="flex margin-bottom data-v-6209e844"><view class="text-gray data-v-6209e844">整改人员</view><view class="text-red data-v-6209e844">*</view></view><view class="picker-input data-v-6209e844" bindtap="{{e}}"><text class="{{['data-v-6209e844', d]}}">{{c}}</text></view><up-picker wx:if="{{i}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" bindconfirm="{{f}}" bindcancel="{{g}}" bindclose="{{h}}" u-i="6209e844-0" bind:__l="__l" u-p="{{i}}"></up-picker><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">整改期限</view><view class="text-red data-v-6209e844">*</view></view><view class="picker-input data-v-6209e844" bindtap="{{l}}"><text class="{{['data-v-6209e844', k]}}">{{j}}</text></view><up-datetime-picker wx:if="{{q}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" bindconfirm="{{m}}" bindcancel="{{n}}" bindclose="{{o}}" u-i="6209e844-1" bind:__l="__l" bindupdateModelValue="{{p}}" u-p="{{q}}"></up-datetime-picker><view class="btn-group margin-top-xl data-v-6209e844"><button class="btn-cancel data-v-6209e844" bindtap="{{r}}">取消</button><button class="btn-confirm bg-blue data-v-6209e844" bindtap="{{s}}">确认</button></view></view></view>

View File

@@ -2,6 +2,7 @@
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");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
@@ -10,7 +11,8 @@ if (!Array) {
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");
(_easycom_up_textarea2 + _easycom_up_input2 + _easycom_up_datetime_picker2 + _easycom_up_checkbox2 + _easycom_up_checkbox_group2 + _easycom_u_popup2 + _easycom_up_upload2)();
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)();
}
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";
@@ -19,8 +21,9 @@ const _easycom_up_checkbox = () => "../../uni_modules/uview-plus/components/u-ch
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_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)();
}
const _sfc_main = {
__name: "rectification",
@@ -29,6 +32,32 @@ const _sfc_main = {
const assignId = common_vendor.ref("");
const rectifyId = common_vendor.ref("");
const isEdit = common_vendor.ref(false);
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 clearSignature = () => {
isSignatureEmpty.value = true;
if (signatureRef.value) {
signatureRef.value.clear();
}
};
const reSign = () => {
isSignatureEmpty.value = true;
showCanvas.value = true;
signatureUrl.value = "";
signatureServerPath.value = "";
common_vendor.nextTick$1(() => {
if (signatureRef.value) {
signatureRef.value.clear();
}
});
};
const formData = common_vendor.reactive({
rectifyPlan: "",
// 整改方案
@@ -55,15 +84,15 @@ const _sfc_main = {
return `${selectedUsers.value[0].name}${selectedUsers.value.length}`;
});
const onUserChange = (ids) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:125", "选中的ID:", ids);
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:211", "选中的ID:", ids);
};
const confirmUserSelect = () => {
selectedUsers.value = cateList.value.filter((item) => selectedUserIds.value.includes(item.id));
showUserPopup.value = false;
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:133", "选中的整改人员:", selectedUsers.value);
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:138", "当前hazardId:", hazardId.value);
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:224", "当前hazardId:", hazardId.value);
try {
const res = await request_api.getDeptUsersWithSubordinates({ hazardId: hazardId.value });
if (res.code === 0 && res.data) {
@@ -79,10 +108,10 @@ const _sfc_main = {
}
});
cateList.value = userList;
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:156", "整改人员列表:", cateList.value);
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:242", "整改人员列表:", cateList.value);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:159", "获取部门人员失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:245", "获取部门人员失败:", error);
}
};
const fileList1 = common_vendor.ref([]);
@@ -100,13 +129,28 @@ const _sfc_main = {
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url);
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: result
url: request_request.toImageUrl(serverPath),
serverPath
});
fileListLen++;
}
@@ -129,12 +173,84 @@ const _sfc_main = {
}
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:214", "上传失败:", 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 params = {
hazardId: hazardId.value,
assignId: assignId.value,
rectifyPlan: formData.rectifyPlan,
rectifyResult: formData.rectifyResult,
planCost: Number(formData.planCost) || 0,
actualCost: Number(formData.actualCost) || 0,
attachments,
// 整改人员ID数组
rectifyUserIds: selectedUserIds.value.map((id) => Number(id)),
signPath: signatureServerPath.value || ""
// 电子签名路径
};
if (rectifyId.value) {
params.rectifyId = rectifyId.value;
}
try {
const res = await request_api.submitRectification(params);
common_vendor.index.hideLoading();
if (res.code === 0) {
clearDraft(false);
common_vendor.index.showToast({
title: isEdit.value ? "保存成功" : "提交成功",
icon: "success"
});
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({
title: res.msg || (isEdit.value ? "保存失败" : "提交失败"),
icon: "none"
});
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:377", "提交整改失败:", error);
common_vendor.index.showToast({
title: "操作失败",
icon: "none"
});
} finally {
isSubmitting.value = false;
}
};
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);
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.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
const handleSubmit = async () => {
if (!formData.rectifyPlan) {
common_vendor.index.showToast({
@@ -157,57 +273,28 @@ const _sfc_main = {
});
return;
}
const attachments = fileList1.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 || "";
}
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 params = {
hazardId: hazardId.value,
assignId: assignId.value,
rectifyPlan: formData.rectifyPlan,
rectifyResult: formData.rectifyResult,
planCost: Number(formData.planCost) || 0,
actualCost: Number(formData.actualCost) || 0,
attachments,
// 整改人员ID数组
rectifyUserIds: selectedUserIds.value.map((id) => Number(id))
};
if (rectifyId.value) {
params.rectifyId = rectifyId.value;
}
try {
const res = await request_api.submitRectification(params);
if (res.code === 0) {
if (showCanvas.value) {
if (!signatureRef.value || isSignatureEmpty.value) {
common_vendor.index.showToast({
title: isEdit.value ? "保存成功" : "提交成功",
icon: "success"
});
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({
title: res.msg || (isEdit.value ? "保存失败" : "提交失败"),
title: "请进行电子签名",
icon: "none"
});
return;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:296", "提交整改失败:", error);
common_vendor.index.showToast({
title: "操作失败",
icon: "none"
});
isSubmitting.value = true;
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
signatureRef.value.confirm();
} else {
if (!signatureServerPath.value) {
common_vendor.index.showToast({
title: "请进行电子签名",
icon: "none"
});
return;
}
isSubmitting.value = true;
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
await executeSubmit();
}
};
const fetchRectifyDetail = async () => {
@@ -221,18 +308,26 @@ const _sfc_main = {
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;
}
hazardId.value = data.hazardId || "";
assignId.value = data.assignId || "";
await fetchDeptUsers();
if (data.attachments && data.attachments.length > 0) {
fileList1.value = data.attachments.map((att) => ({
url: att.filePath.startsWith("http") ? att.filePath : request_request.baseUrl.replace("/api", "") + att.filePath,
status: "success",
message: "",
name: att.fileName,
type: att.fileType,
filePath: att.filePath
// 保存原始路径用于提交
}));
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
};
});
}
if (data.memberIds) {
const memberIdArr = data.memberIds.split(",").map((id) => String(id.trim()));
@@ -250,7 +345,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:356", "获取整改详情失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:600", "获取整改详情失败:", error);
common_vendor.index.showToast({ title: "获取详情失败", icon: "none" });
}
};
@@ -281,70 +376,198 @@ 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:393", "AI生成整改方案失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:637", "AI生成整改方案失败:", error);
common_vendor.index.showToast({ title: "AI生成失败请重试", icon: "none" });
} finally {
aiGenerating.value = false;
}
};
const hasDraft = common_vendor.ref(false);
const showRestoreBanner = common_vendor.ref(false);
const isRestoring = common_vendor.ref(false);
const signaturePaths = common_vendor.ref([]);
const getDraftKey = () => `draft_rectify_${hazardId.value || ""}_${rectifyId.value || ""}`;
const saveDraft = () => {
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;
if (!hasContent) {
common_vendor.index.removeStorageSync(key);
hasDraft.value = false;
return;
}
const data = {
formData: {
rectifyPlan: formData.rectifyPlan,
rectifyResult: formData.rectifyResult,
planCost: formData.planCost,
actualCost: formData.actualCost
},
fileList1: fileList1.value,
signatureServerPath: signatureServerPath.value,
signatureUrl: signatureUrl.value,
showCanvas: showCanvas.value,
signaturePaths: signaturePaths.value
};
common_vendor.index.setStorageSync(key, JSON.stringify(data));
hasDraft.value = true;
};
const clearDraft = (showToast = true) => {
const key = getDraftKey();
common_vendor.index.removeStorageSync(key);
hasDraft.value = false;
showRestoreBanner.value = false;
isRestoring.value = true;
formData.rectifyPlan = "";
formData.rectifyResult = "";
formData.planCost = "";
formData.actualCost = "";
fileList1.value = [];
signatureServerPath.value = "";
signatureUrl.value = "";
showCanvas.value = true;
signaturePaths.value = [];
if (signatureRef.value) {
signatureRef.value.clear();
}
common_vendor.nextTick$1(() => {
isRestoring.value = false;
});
if (showToast) {
common_vendor.index.showToast({ title: "草稿已清空", icon: "none" });
}
};
const restoreDraft = () => {
const key = getDraftKey();
const cached = common_vendor.index.getStorageSync(key);
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;
if (!hasContent)
return;
isRestoring.value = true;
formData.rectifyPlan = data.formData.rectifyPlan || "";
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 || [];
hasDraft.value = true;
showRestoreBanner.value = true;
if (signaturePaths.value.length > 0) {
setTimeout(() => {
if (signatureRef.value) {
isSignatureEmpty.value = false;
}
}, 450);
}
common_vendor.nextTick$1(() => {
isRestoring.value = false;
});
common_vendor.index.showToast({
title: "已自动恢复您上次未提交的内容",
icon: "none",
duration: 2500
});
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:772", "解析草稿失败:", e);
isRestoring.value = false;
}
}
};
common_vendor.watch(
() => [
formData.rectifyPlan,
formData.rectifyResult,
formData.planCost,
formData.actualCost,
fileList1.value,
signatureServerPath.value,
signaturePaths.value
],
() => {
if (hazardId.value || rectifyId.value) {
saveDraft();
}
},
{ deep: true }
);
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/rectification.vue:803", "获取系统信息失败:", e);
}
if (options.hazardId) {
hazardId.value = options.hazardId;
}
if (options.assignId) {
assignId.value = options.assignId;
}
fetchDeptUsers();
if (!options.rectifyId)
fetchDeptUsers();
if (options.rectifyId) {
rectifyId.value = options.rectifyId;
isEdit.value = options.isEdit === "1";
fetchRectifyDetail();
} else {
restoreDraft();
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: !aiGenerating.value
a: showRestoreBanner.value
}, showRestoreBanner.value ? {
b: common_vendor.o(($event) => clearDraft(true))
} : {}, {
c: !aiGenerating.value
}, !aiGenerating.value ? {} : {}, {
b: common_vendor.t(aiGenerating.value ? "AI生成中..." : "AI生成整改方案"),
c: aiGenerating.value,
d: aiGenerating.value,
e: common_vendor.o(handleAiGenerate),
f: common_vendor.o(($event) => formData.rectifyPlan = $event),
g: common_vendor.p({
d: common_vendor.t(aiGenerating.value ? "AI生成中..." : "AI生成整改方案"),
e: aiGenerating.value,
f: aiGenerating.value,
g: common_vendor.o(handleAiGenerate),
h: common_vendor.o(($event) => formData.rectifyPlan = $event),
i: common_vendor.p({
placeholder: "请输入内容",
maxlength: -1,
autoHeight: true,
modelValue: formData.rectifyPlan
}),
h: common_vendor.o(($event) => formData.rectifyResult = $event),
i: common_vendor.p({
j: common_vendor.o(($event) => formData.rectifyResult = $event),
k: common_vendor.p({
placeholder: "请输入内容",
modelValue: formData.rectifyResult
}),
j: common_vendor.o(($event) => formData.planCost = $event),
k: common_vendor.p({
l: common_vendor.o(($event) => formData.planCost = $event),
m: common_vendor.p({
placeholder: "请输入内容",
type: "number",
modelValue: formData.planCost
}),
l: common_vendor.o(($event) => formData.actualCost = $event),
m: common_vendor.p({
n: common_vendor.o(($event) => formData.actualCost = $event),
o: common_vendor.p({
placeholder: "请输入内容",
type: "number",
modelValue: formData.actualCost
}),
n: common_vendor.o(($event) => value1.value = $event),
o: common_vendor.p({
p: common_vendor.o(($event) => value1.value = $event),
q: common_vendor.p({
hasInput: true,
show: show.value,
mode: "date",
modelValue: value1.value
}),
p: common_vendor.t(selectedUsers.value.length > 0 ? selectedUsersText.value : "请选择整改人员(可多选)"),
q: selectedUsers.value.length === 0 ? 1 : "",
r: common_vendor.o(($event) => showUserPopup.value = true),
s: common_vendor.o(($event) => showUserPopup.value = false),
t: common_vendor.f(cateList.value, (item, k0, i0) => {
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) => {
return {
a: "f18ba0ce-7-" + i0 + ",f18ba0ce-6",
b: common_vendor.p({
@@ -356,31 +579,64 @@ const _sfc_main = {
c: item.id
};
}),
v: common_vendor.o(onUserChange),
w: common_vendor.o(($event) => selectedUserIds.value = $event),
x: common_vendor.p({
x: common_vendor.o(onUserChange),
y: common_vendor.o(($event) => selectedUserIds.value = $event),
z: common_vendor.p({
placement: "column",
modelValue: selectedUserIds.value
}),
y: common_vendor.o(($event) => showUserPopup.value = false),
z: common_vendor.o(confirmUserSelect),
A: common_vendor.o(($event) => showUserPopup.value = false),
B: common_vendor.p({
B: common_vendor.o(confirmUserSelect),
C: common_vendor.o(($event) => showUserPopup.value = false),
D: common_vendor.p({
show: showUserPopup.value,
mode: "bottom",
round: "20"
}),
C: common_vendor.o(afterRead),
D: common_vendor.o(deletePic),
E: common_vendor.p({
E: common_vendor.o(afterRead),
F: common_vendor.o(deletePic),
G: common_vendor.p({
fileList: fileList1.value,
name: "1",
multiple: true,
imageMode: "aspectFill",
maxCount: 10
}),
F: common_vendor.t(isEdit.value ? "保存修改" : "提交整改"),
G: common_vendor.o(handleSubmit),
H: common_vendor.gei(_ctx, "")
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
} : {}, {
Q: showCanvas.value && !showUserPopup.value
}, showCanvas.value && !showUserPopup.value ? {
R: common_vendor.sr(signatureRef, "f18ba0ce-9", {
"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({
width: signatureWidth.value,
height: 160,
backgroundColor: "#f8f8f8",
penColor: "#000000",
lineWidth: 3,
enableHistory: false
})
} : {}, {
X: common_vendor.t(isEdit.value ? "保存修改" : "提交整改"),
Y: common_vendor.o(handleSubmit),
Z: common_vendor.gei(_ctx, "")
});
};
}

View File

@@ -7,6 +7,7 @@
"up-checkbox": "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox",
"up-checkbox-group": "../../uni_modules/uview-plus/components/u-checkbox-group/u-checkbox-group",
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup",
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload"
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload",
"wd-signature": "../../node-modules/wot-design-uni/components/wd-signature/wd-signature"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -127,6 +127,7 @@
.user-popup .popup-footer.data-v-f18ba0ce {
display: flex;
border-top: 1rpx solid #eee;
padding-bottom: env(safe-area-inset-bottom);
}
.user-popup .popup-footer button.data-v-f18ba0ce {
flex: 1;
@@ -144,4 +145,68 @@
}
.user-popup .popup-footer .btn-confirm.data-v-f18ba0ce {
color: #fff;
}
.signature-box.data-v-f18ba0ce {
width: 100%;
min-height: 240rpx;
background: #f8f8f8;
border: 1rpx dashed #dcdfe6;
border-radius: 8rpx;
margin-top: 16rpx;
}
.signature-box .signature-img.data-v-f18ba0ce {
width: 100%;
height: 100%;
}
.signature-box .signature-placeholder.data-v-f18ba0ce {
color: #909399;
font-size: 28rpx;
}
.signature-popup.data-v-f18ba0ce {
width: 650rpx;
background: #fff;
border-radius: 16rpx;
overflow: hidden;
}
.signature-popup .popup-header.data-v-f18ba0ce {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.signature-popup .popup-header .popup-title.data-v-f18ba0ce {
font-size: 32rpx;
color: #333;
}
.signature-popup .popup-header .popup-close.data-v-f18ba0ce {
font-size: 40rpx;
color: #999;
line-height: 1;
}
.signature-popup .popup-body.data-v-f18ba0ce {
padding: 40rpx 30rpx;
background: #fff;
}
.signature-popup .popup-footer.data-v-f18ba0ce {
display: flex;
padding: 0 30rpx 30rpx;
gap: 20rpx;
}
.signature-popup .popup-footer button.data-v-f18ba0ce {
flex: 1;
height: 80rpx;
line-height: 80rpx;
font-size: 28rpx;
border-radius: 40rpx;
}
.signature-popup .popup-footer button.data-v-f18ba0ce::after {
border: none;
}
.signature-popup .popup-footer .btn-cancel.data-v-f18ba0ce {
background: #f5f5f5;
color: #666;
}
.signature-popup .popup-footer .btn-confirm.data-v-f18ba0ce {
color: #fff;
}