113 lines
4.6 KiB
JavaScript
113 lines
4.6 KiB
JavaScript
"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_input2 = common_vendor.resolveComponent("up-input");
|
|
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
|
|
(_easycom_up_input2 + _easycom_up_textarea2)();
|
|
}
|
|
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
|
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
|
|
if (!Math) {
|
|
(_easycom_up_input + _easycom_up_textarea)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "view",
|
|
setup(__props) {
|
|
const detailData = common_vendor.reactive({
|
|
hazardId: "",
|
|
assignId: "",
|
|
title: "",
|
|
level: 0,
|
|
levelName: "",
|
|
source: "",
|
|
description: "",
|
|
address: "",
|
|
areaName: "",
|
|
// 隐患区域名称
|
|
createdAt: "",
|
|
attachments: []
|
|
});
|
|
const rectifyAttachments = common_vendor.ref([]);
|
|
const getFullPath = (filePath) => {
|
|
return request_request.toImageUrl(filePath);
|
|
};
|
|
const previewHazardImage = (index) => {
|
|
if (!detailData.attachments || detailData.attachments.length === 0)
|
|
return;
|
|
const urls = detailData.attachments.map((item) => getFullPath(item.filePath));
|
|
common_vendor.index.previewImage({
|
|
current: index,
|
|
urls
|
|
});
|
|
};
|
|
const fetchDetail = async (hazardId, assignId) => {
|
|
try {
|
|
const res = await request_api.getHiddenDangerDetail({ hazardId, assignId });
|
|
if (res.code === 0 && res.data) {
|
|
Object.assign(detailData, res.data);
|
|
common_vendor.index.__f__("log", "at pages/hiddendanger/view.vue:120", "隐患详情数据:", res.data);
|
|
common_vendor.index.__f__("log", "at pages/hiddendanger/view.vue:121", "隐患附件:", res.data.attachments);
|
|
if (res.data.assigns && res.data.assigns.length > 0) {
|
|
const assign = res.data.assigns[0];
|
|
if (assign.rectify && assign.rectify.attachments) {
|
|
rectifyAttachments.value = assign.rectify.attachments;
|
|
common_vendor.index.__f__("log", "at pages/hiddendanger/view.vue:128", "整改附件:", rectifyAttachments.value);
|
|
}
|
|
}
|
|
} else {
|
|
common_vendor.index.showToast({ title: res.msg || "获取详情失败", icon: "none" });
|
|
}
|
|
} catch (error) {
|
|
common_vendor.index.__f__("error", "at pages/hiddendanger/view.vue:135", "获取隐患详情失败:", error);
|
|
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
|
|
}
|
|
};
|
|
common_vendor.onLoad((options) => {
|
|
if (options.hazardId && options.assignId) {
|
|
fetchDetail(options.hazardId, options.assignId);
|
|
}
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: detailData.attachments && detailData.attachments.length > 0
|
|
}, detailData.attachments && detailData.attachments.length > 0 ? {
|
|
b: common_vendor.f(detailData.attachments, (img, idx, i0) => {
|
|
return {
|
|
a: idx,
|
|
b: getFullPath(img.filePath),
|
|
c: common_vendor.o(($event) => previewHazardImage(idx), idx)
|
|
};
|
|
})
|
|
} : {}, {
|
|
c: common_vendor.o(($event) => detailData.title = $event),
|
|
d: common_vendor.p({
|
|
disabled: "true",
|
|
disabledColor: "#F6F6F6",
|
|
border: "surround",
|
|
modelValue: detailData.title
|
|
}),
|
|
e: common_vendor.n(detailData.level === 1 ? "bg-blue light" : "bg-gray"),
|
|
f: common_vendor.n(detailData.level === 2 ? "bg-blue light" : "bg-gray"),
|
|
g: common_vendor.n(detailData.level === 3 ? "bg-blue light" : "bg-gray"),
|
|
h: detailData.address,
|
|
i: common_vendor.o(($event) => detailData.address = $event.detail.value),
|
|
j: common_vendor.t(detailData.areaName || "暂无"),
|
|
k: common_vendor.o(($event) => detailData.description = $event),
|
|
l: common_vendor.p({
|
|
placeholder: "暂无描述",
|
|
disabled: true,
|
|
modelValue: detailData.description
|
|
}),
|
|
m: common_vendor.t(detailData.source || "暂无"),
|
|
n: common_vendor.t(detailData.createdAt || "暂无"),
|
|
o: common_vendor.gei(_ctx, "")
|
|
});
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4d631e68"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/hiddendanger/view.js.map
|