1.18整合

This commit is contained in:
2026-01-18 16:06:37 +08:00
parent 10c3fbb0d7
commit a11d3cc2f8
138 changed files with 7241 additions and 856 deletions

View File

@@ -1,5 +1,7 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const request_request = require("../../request/request.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
@@ -13,7 +15,132 @@ if (!Math) {
const _sfc_main = {
__name: "acceptance",
setup(__props) {
const rectifyId = common_vendor.ref("");
const hazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const rectifyData = common_vendor.reactive({
rectifyPlan: "",
rectifyResult: ""
});
const rectifyAttachments = common_vendor.ref([]);
const formData = common_vendor.reactive({
result: 1,
// 验收结果 1.通过 2.不通过
verifyRemark: ""
// 验收备注
});
const fileList1 = common_vendor.ref([]);
const getFullPath = (filePath) => {
if (!filePath)
return "";
if (filePath.startsWith("http://") || filePath.startsWith("https://")) {
return filePath;
}
return request_request.baseUrl + filePath;
};
const previewImage = (index) => {
const urls = rectifyAttachments.value.map((item) => getFullPath(item.filePath));
common_vendor.index.previewImage({
current: index,
urls
});
};
const fetchDetail = async () => {
if (!hazardId.value || !assignId.value)
return;
try {
const res = await request_api.getHiddenDangerDetail({ hazardId: hazardId.value, assignId: assignId.value });
if (res.code === 0 && res.data) {
if (res.data.assigns && res.data.assigns.length > 0) {
const assign = res.data.assigns[0];
if (assign.rectify) {
rectifyData.rectifyPlan = assign.rectify.rectifyPlan || "";
rectifyData.rectifyResult = assign.rectify.rectifyResult || "";
if (assign.rectify.attachments) {
rectifyAttachments.value = assign.rectify.attachments;
}
console.log("整改记录:", rectifyData);
console.log("整改附件:", rectifyAttachments.value);
}
}
} else {
common_vendor.index.showToast({ title: res.msg || "获取详情失败", icon: "none" });
}
} catch (error) {
console.error("获取隐患详情失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
common_vendor.onLoad((options) => {
if (options.rectifyId) {
rectifyId.value = options.rectifyId;
}
if (options.hazardId) {
hazardId.value = options.hazardId;
}
if (options.assignId) {
assignId.value = options.assignId;
}
console.log("验收页面参数:", { rectifyId: rectifyId.value, hazardId: hazardId.value, assignId: assignId.value });
fetchDetail();
});
const handleCancel = () => {
common_vendor.index.navigateBack();
};
const handleSubmit = async () => {
if (!rectifyId.value) {
common_vendor.index.showToast({
title: "缺少整改ID",
icon: "none"
});
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 = {
rectifyId: Number(rectifyId.value),
result: formData.result,
verifyRemark: formData.verifyRemark || "",
attachments
};
console.log("提交验收参数:", params);
try {
const res = await request_api.acceptanceRectification(params);
if (res.code === 0) {
common_vendor.index.showToast({
title: "验收成功",
icon: "success"
});
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({
title: res.msg || "验收失败",
icon: "none"
});
}
} catch (error) {
console.error("验收失败:", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
});
}
};
const deletePic = (event) => {
fileList1.value.splice(event.index, 1);
};
@@ -39,45 +166,64 @@ const _sfc_main = {
fileListLen++;
}
};
const uploadFilePromise = (url) => {
const uploadFilePromise = (filePath) => {
return new Promise((resolve, reject) => {
common_vendor.index.uploadFile({
url: "http://192.168.2.21:7001/upload",
// 仅为示例,非真实的接口地址
filePath: url,
url: request_request.baseUrl + "/frontend/attachment/upload",
filePath,
name: "file",
formData: {
user: "test"
header: {
"Authorization": request_request.getToken()
},
success: (res) => {
setTimeout(() => {
resolve(res.data.data);
}, 1e3);
const data = JSON.parse(res.data);
if (data.code === 0) {
resolve(data.data);
} else {
reject(data.msg || "上传失败");
}
},
fail: (err) => {
console.error("上传失败:", err);
reject(err);
}
});
});
};
return (_ctx, _cache) => {
return {
a: common_vendor.o(($event) => _ctx.value1 = $event),
b: common_vendor.p({
placeholder: "请输入内容",
modelValue: _ctx.value1
return common_vendor.e({
a: common_vendor.t(rectifyData.rectifyPlan || "暂无"),
b: common_vendor.t(rectifyData.rectifyResult || "暂无"),
c: rectifyAttachments.value.length > 0
}, rectifyAttachments.value.length > 0 ? {
d: common_vendor.f(rectifyAttachments.value, (img, idx, i0) => {
return {
a: idx,
b: getFullPath(img.filePath),
c: common_vendor.o(($event) => previewImage(idx), idx)
};
})
} : {}, {
e: common_vendor.n(formData.result === 1 ? "active" : ""),
f: common_vendor.o(($event) => formData.result = 1),
g: common_vendor.n(formData.result === 2 ? "active" : ""),
h: common_vendor.o(($event) => formData.result = 2),
i: common_vendor.o(($event) => formData.verifyRemark = $event),
j: common_vendor.p({
placeholder: "请输入验收备注",
modelValue: formData.verifyRemark
}),
c: common_vendor.o(($event) => _ctx.value1 = $event),
d: common_vendor.p({
placeholder: "请输入内容",
modelValue: _ctx.value1
}),
e: common_vendor.o(afterRead),
f: common_vendor.o(deletePic),
g: common_vendor.p({
k: common_vendor.o(afterRead),
l: common_vendor.o(deletePic),
m: common_vendor.p({
fileList: fileList1.value,
name: "1",
multiple: true,
maxCount: 10
})
};
}),
n: common_vendor.o(handleCancel),
o: common_vendor.o(handleSubmit)
});
};
}
};