隐患详情重新设计,检查计划重新设计成做题排查式
This commit is contained in:
@@ -1,177 +1,111 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const request_api = require("../../request/api.js");
|
||||
require("../../request/request.js");
|
||||
const utils_upload = require("../../utils/upload.js");
|
||||
const request_three_one_api_area = require("../../request/three_one_api/area.js");
|
||||
const utils_draftCache = require("../../utils/draftCache.js");
|
||||
const utils_useDraftCache = require("../../utils/useDraftCache.js");
|
||||
const components_hazard_hazardForm = require("../../components/hazard/hazardForm.js");
|
||||
if (!Array) {
|
||||
const _easycom_u_radio2 = common_vendor.resolveComponent("u-radio");
|
||||
const _easycom_u_radio_group2 = common_vendor.resolveComponent("u-radio-group");
|
||||
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
|
||||
const _easycom_up_choose2 = common_vendor.resolveComponent("up-choose");
|
||||
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
|
||||
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
||||
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
|
||||
(_easycom_u_radio2 + _easycom_u_radio_group2 + _easycom_up_textarea2 + _easycom_up_choose2 + _easycom_up_upload2 + _easycom_up_input2 + _easycom_u_popup2)();
|
||||
(_easycom_u_radio2 + _easycom_u_radio_group2 + _easycom_up_textarea2)();
|
||||
}
|
||||
const _easycom_u_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
|
||||
const _easycom_u_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
|
||||
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
|
||||
const _easycom_up_choose = () => "../../uni_modules/uview-plus/components/u-choose/u-choose.js";
|
||||
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
|
||||
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
||||
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_u_radio + _easycom_u_radio_group + _easycom_up_textarea + _easycom_up_choose + _easycom_up_upload + _easycom_up_input + _easycom_u_popup)();
|
||||
(_easycom_u_radio + _easycom_u_radio_group + _easycom_up_textarea + HazardFormPopup)();
|
||||
}
|
||||
const HazardFormPopup = () => "../../components/hazard/HazardFormPopup.js";
|
||||
const _sfc_main = {
|
||||
__name: "Inspectionresult",
|
||||
setup(__props) {
|
||||
const oneTableId = common_vendor.ref("");
|
||||
const canvasWidth = common_vendor.ref(300);
|
||||
const canvasHeight = common_vendor.ref(300);
|
||||
const checkData = common_vendor.ref(null);
|
||||
const hazardFormRef = common_vendor.ref(null);
|
||||
const showHazardPopup = common_vendor.ref(false);
|
||||
const hazardPayload = common_vendor.ref(components_hazard_hazardForm.createEmptyHazardPayload());
|
||||
const radiolist1 = common_vendor.reactive([
|
||||
{
|
||||
name: "正常",
|
||||
value: 1,
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: "异常",
|
||||
value: 2,
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: "不涉及",
|
||||
value: 3,
|
||||
disabled: false
|
||||
}
|
||||
{ name: "正常", value: 1, disabled: false },
|
||||
{ name: "异常", value: 2, disabled: false },
|
||||
{ name: "不涉及", value: 3, disabled: false }
|
||||
]);
|
||||
const radiovalue1 = common_vendor.ref("");
|
||||
const value1 = common_vendor.ref("");
|
||||
const normalizeInspectionDraft = (data) => {
|
||||
if (!data)
|
||||
return { radiovalue1: "", value1: "", hazardPayload: components_hazard_hazardForm.createEmptyHazardPayload() };
|
||||
if (!data.hazardPayload && data.hazardFormData) {
|
||||
data.hazardPayload = {
|
||||
formData: data.hazardFormData,
|
||||
address: data.hazardAddress || "",
|
||||
lng: data.hazardLng || 0,
|
||||
lat: data.hazardLat || 0,
|
||||
areaId: "",
|
||||
areaName: "",
|
||||
fileList: data.hazardFileList || []
|
||||
};
|
||||
}
|
||||
return {
|
||||
radiovalue1: data.radiovalue1 || "",
|
||||
value1: data.value1 || "",
|
||||
hazardPayload: data.hazardPayload || components_hazard_hazardForm.createEmptyHazardPayload()
|
||||
};
|
||||
};
|
||||
const inspectionDraftHasContent = (data) => {
|
||||
var _a, _b;
|
||||
const normalized = normalizeInspectionDraft(data);
|
||||
const payload = normalized.hazardPayload;
|
||||
return !!(normalized.radiovalue1 || normalized.value1 || ((_a = payload.formData) == null ? void 0 : _a.title) || ((_b = payload.formData) == null ? void 0 : _b.description) || payload.fileList && payload.fileList.length > 0);
|
||||
};
|
||||
const {
|
||||
showRestoreBanner,
|
||||
clear: clearDraft,
|
||||
restore: restoreDraft,
|
||||
bindAutoSave
|
||||
} = utils_useDraftCache.useDraftCache({
|
||||
getKey: () => {
|
||||
var _a;
|
||||
return utils_draftCache.buildDraftKey(
|
||||
utils_draftCache.DRAFT_NS.INSPECTION_RESULT,
|
||||
oneTableId.value,
|
||||
(_a = checkData.value) == null ? void 0 : _a.currentIndex
|
||||
);
|
||||
},
|
||||
getPayload: () => ({
|
||||
radiovalue1: radiovalue1.value,
|
||||
value1: value1.value,
|
||||
hazardPayload: JSON.parse(JSON.stringify(hazardPayload.value))
|
||||
}),
|
||||
hasContent: inspectionDraftHasContent,
|
||||
applyPayload: (data) => {
|
||||
const normalized = normalizeInspectionDraft(data);
|
||||
radiovalue1.value = normalized.radiovalue1;
|
||||
value1.value = normalized.value1;
|
||||
hazardPayload.value = normalized.hazardPayload;
|
||||
common_vendor.nextTick$1(() => {
|
||||
var _a;
|
||||
(_a = hazardFormRef.value) == null ? void 0 : _a.applyPayload(normalized.hazardPayload);
|
||||
});
|
||||
},
|
||||
clearForm: () => {
|
||||
radiovalue1.value = "";
|
||||
value1.value = "";
|
||||
clearHazard();
|
||||
},
|
||||
canSave: () => !!oneTableId.value,
|
||||
requireInitialized: true
|
||||
});
|
||||
bindAutoSave(() => [radiovalue1.value, value1.value, hazardPayload.value]);
|
||||
const groupChange = (n) => {
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:312", "groupChange", n);
|
||||
if (n !== "异常") {
|
||||
clearHazard();
|
||||
}
|
||||
};
|
||||
const radioChange = (n) => {
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:320", "radioChange", n);
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:207", "radioChange", n);
|
||||
};
|
||||
const value1 = common_vendor.ref("");
|
||||
const showHazardPopup = common_vendor.ref(false);
|
||||
const hazardFormData = common_vendor.reactive({
|
||||
title: "",
|
||||
level: 0,
|
||||
source: 0,
|
||||
description: "",
|
||||
tagIndex: 0,
|
||||
regulationId: null,
|
||||
// 法律依据ID
|
||||
regulationName: ""
|
||||
// 法律依据名称(显示用)
|
||||
});
|
||||
const hazardAddress = common_vendor.ref("");
|
||||
const hazardLng = common_vendor.ref(0);
|
||||
const hazardLat = common_vendor.ref(0);
|
||||
const showAreaPicker = common_vendor.ref(false);
|
||||
const areaList = common_vendor.ref([]);
|
||||
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/Inspectionresult/Inspectionresult.vue:399", "获取法规列表失败:", 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) {
|
||||
hazardFormData.regulationId = selectedLawId.value;
|
||||
hazardFormData.regulationName = selectedLawName.value;
|
||||
}
|
||||
showLawPopup.value = false;
|
||||
};
|
||||
const fetchAreaList = async () => {
|
||||
try {
|
||||
const res = await request_three_one_api_area.getAreaList();
|
||||
if (res.code === 0 && res.data && res.data.records) {
|
||||
areaList.value = res.data.records;
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:443", "获取区域列表失败:", error);
|
||||
}
|
||||
};
|
||||
const confirmAreaSelect = () => {
|
||||
if (tempAreaId.value) {
|
||||
selectedAreaId.value = tempAreaId.value;
|
||||
const selected = areaList.value.find((item) => item.id === tempAreaId.value);
|
||||
selectedAreaName.value = selected ? selected.name : "";
|
||||
}
|
||||
showAreaPicker.value = false;
|
||||
};
|
||||
const hazardFileList = common_vendor.ref([]);
|
||||
const levelChooseRef = common_vendor.ref(null);
|
||||
const aiAnalyzing = common_vendor.ref(false);
|
||||
const hasHazardData = common_vendor.computed(() => {
|
||||
return hazardFormData.title && hazardFileList.value.length > 0;
|
||||
});
|
||||
const hasHazardData = common_vendor.computed(() => components_hazard_hazardForm.hasValidHazardPayload(hazardPayload.value));
|
||||
const progressPercent = common_vendor.computed(() => {
|
||||
if (!checkData.value)
|
||||
return 0;
|
||||
@@ -179,149 +113,24 @@ const _sfc_main = {
|
||||
const total = checkData.value.totalCount || 1;
|
||||
return Math.round(current / total * 100);
|
||||
});
|
||||
const levelOptions = common_vendor.ref([
|
||||
// { id: 1, title: '轻微隐患' },
|
||||
{ id: 2, title: "一般隐患" },
|
||||
{ id: 3, title: "重大隐患" }
|
||||
]);
|
||||
const sourceOptions = common_vendor.ref([
|
||||
{ id: 1, title: "部门检查" },
|
||||
{ id: 2, title: "都导检查" },
|
||||
{ id: 3, title: "企业自查" },
|
||||
{ id: 4, title: "行业互查" }
|
||||
]);
|
||||
const tagOptions = common_vendor.ref([]);
|
||||
const fetchTagOptions = async () => {
|
||||
try {
|
||||
const res = await request_api.getHiddenDangerLabelList();
|
||||
if (res.code === 0) {
|
||||
tagOptions.value = res.data.map((item) => ({
|
||||
id: item.id,
|
||||
title: item.name
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:508", "获取标签列表失败:", error);
|
||||
}
|
||||
};
|
||||
const openHazardPopup = () => {
|
||||
showHazardPopup.value = true;
|
||||
};
|
||||
const editHazard = () => {
|
||||
showHazardPopup.value = true;
|
||||
};
|
||||
const onHazardConfirm = (payload) => {
|
||||
if (payload) {
|
||||
hazardPayload.value = JSON.parse(JSON.stringify(payload));
|
||||
}
|
||||
};
|
||||
const clearHazard = () => {
|
||||
hazardFormData.regulationId = null;
|
||||
hazardFormData.regulationName = "";
|
||||
selectedLawId.value = null;
|
||||
selectedLawName.value = "";
|
||||
hazardFormData.title = "";
|
||||
hazardFormData.level = 0;
|
||||
hazardFormData.source = 0;
|
||||
hazardFormData.description = "";
|
||||
hazardFormData.tagIndex = 0;
|
||||
hazardAddress.value = "";
|
||||
hazardLng.value = 0;
|
||||
hazardLat.value = 0;
|
||||
hazardFileList.value = [];
|
||||
selectedAreaId.value = "";
|
||||
selectedAreaName.value = "";
|
||||
};
|
||||
const confirmHazard = () => {
|
||||
if (hazardFileList.value.length === 0) {
|
||||
common_vendor.index.showToast({ title: "请上传隐患图片", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (!hazardFormData.title) {
|
||||
common_vendor.index.showToast({ title: "请输入隐患标题", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (!hazardAddress.value) {
|
||||
common_vendor.index.showToast({ title: "请输入隐患位置", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (!hazardFormData.description) {
|
||||
common_vendor.index.showToast({ title: "请输入隐患描述", icon: "none" });
|
||||
return;
|
||||
}
|
||||
showHazardPopup.value = false;
|
||||
common_vendor.index.showToast({ title: "隐患信息已暂存", icon: "success" });
|
||||
};
|
||||
const chooseLocation = () => {
|
||||
showHazardPopup.value = false;
|
||||
setTimeout(() => {
|
||||
common_vendor.index.chooseLocation({
|
||||
success: (res) => {
|
||||
hazardAddress.value = res.address + (res.name ? `(${res.name})` : "");
|
||||
hazardLng.value = res.longitude;
|
||||
hazardLat.value = res.latitude;
|
||||
showHazardPopup.value = true;
|
||||
},
|
||||
fail: (err) => {
|
||||
showHazardPopup.value = true;
|
||||
if (err.errMsg && err.errMsg.indexOf("cancel") === -1) {
|
||||
common_vendor.index.showToast({ title: "选择位置失败", icon: "none" });
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
};
|
||||
const inspectionUploadInstance = common_vendor.getCurrentInstance();
|
||||
const { afterRead, deletePic } = utils_upload.createUploadListHandlers(hazardFileList, {
|
||||
watermark: {
|
||||
canvasId: "watermarkCanvas",
|
||||
canvasWidthRef: canvasWidth,
|
||||
canvasHeightRef: canvasHeight,
|
||||
instance: inspectionUploadInstance
|
||||
}
|
||||
});
|
||||
const handleAiAnalyze = async () => {
|
||||
const imageFiles = hazardFileList.value.filter((f) => {
|
||||
return f.status === "success" && f.url.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/);
|
||||
});
|
||||
if (imageFiles.length === 0) {
|
||||
common_vendor.index.showToast({ title: "请先上传隐患图片", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const fullImageUrl = imageFiles[0].url;
|
||||
aiAnalyzing.value = true;
|
||||
try {
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:612", "开始调用AI分析接口,图片地址:", fullImageUrl);
|
||||
const analyzeRes = await request_api.analyzeHazardImage({
|
||||
imageUrl: fullImageUrl
|
||||
});
|
||||
if (analyzeRes.code === 0 && analyzeRes.data) {
|
||||
const aiData = analyzeRes.data;
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:619", "AI分析结果:", aiData);
|
||||
if (aiData.title)
|
||||
hazardFormData.title = aiData.title;
|
||||
if (aiData.description)
|
||||
hazardFormData.description = aiData.description;
|
||||
if (aiData.level) {
|
||||
const levelMap = { "轻微": 0, "轻微隐患": 0, "一般": 1, "一般隐患": 1, "重大": 2, "重大隐患": 2 };
|
||||
const levelIndex = levelMap[aiData.level];
|
||||
if (levelIndex !== void 0) {
|
||||
hazardFormData.level = levelIndex;
|
||||
common_vendor.nextTick$1(() => {
|
||||
if (levelChooseRef.value && levelChooseRef.value.$data) {
|
||||
levelChooseRef.value.$data.currentIndex = levelIndex;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
common_vendor.index.showToast({ title: "AI分析完成,已自动填充", icon: "success", duration: 2e3 });
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: analyzeRes.msg || "AI分析失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:642", "AI分析接口调用失败:", error);
|
||||
common_vendor.index.showToast({ title: "AI分析失败,请重试", icon: "none" });
|
||||
} finally {
|
||||
aiAnalyzing.value = false;
|
||||
}
|
||||
var _a;
|
||||
hazardPayload.value = components_hazard_hazardForm.createEmptyHazardPayload();
|
||||
(_a = hazardFormRef.value) == null ? void 0 : _a.resetForm();
|
||||
};
|
||||
const handleSubmit = async () => {
|
||||
var _a, _b, _c, _d, _e;
|
||||
var _a, _b, _c, _d;
|
||||
if (!radiovalue1.value) {
|
||||
common_vendor.index.showToast({ title: "请选择检查结果", icon: "none" });
|
||||
return;
|
||||
@@ -339,40 +148,23 @@ const _sfc_main = {
|
||||
try {
|
||||
common_vendor.index.showLoading({ title: "提交中..." });
|
||||
if (radiovalue1.value === "异常" && hasHazardData.value) {
|
||||
const attachments = hazardFileList.value.filter((f) => f.status === "success").map((file) => utils_upload.buildAttachmentItem(file));
|
||||
const selectedTag = tagOptions.value[hazardFormData.tagIndex];
|
||||
const tagId = selectedTag ? selectedTag.id : null;
|
||||
const hazardParams = {
|
||||
taskId: (_a = checkData.value) == null ? void 0 : _a.taskId,
|
||||
checkPointId: (_b = checkData.value) == null ? void 0 : _b.checkPointId,
|
||||
title: hazardFormData.title,
|
||||
level: ((_c = levelOptions.value[hazardFormData.level]) == null ? void 0 : _c.id) || 2,
|
||||
lng: hazardLng.value || 0,
|
||||
lat: hazardLat.value || 0,
|
||||
address: hazardAddress.value || "",
|
||||
areaId: selectedAreaId.value || null,
|
||||
// 隐患区域ID
|
||||
description: hazardFormData.description || "",
|
||||
source: ((_d = sourceOptions.value[hazardFormData.source]) == null ? void 0 : _d.title) || "",
|
||||
tagId,
|
||||
attachments,
|
||||
regulationId: hazardFormData.regulationId || null
|
||||
};
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:705", "隐患参数:", hazardParams);
|
||||
const payload = ((_a = hazardFormRef.value) == null ? void 0 : _a.getPayload()) || hazardPayload.value;
|
||||
const hazardParams = components_hazard_hazardForm.buildHiddenDangerParams(payload, {
|
||||
taskId: (_b = checkData.value) == null ? void 0 : _b.taskId,
|
||||
checkPointId: (_c = checkData.value) == null ? void 0 : _c.checkPointId
|
||||
});
|
||||
const hazardRes = await request_api.addHiddenDanger(hazardParams);
|
||||
if (hazardRes.code !== 0) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.showToast({ title: hazardRes.msg || "新增隐患失败", icon: "none" });
|
||||
return;
|
||||
}
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:714", "新增隐患成功");
|
||||
}
|
||||
const submitParams = {
|
||||
taskId: (_e = checkData.value) == null ? void 0 : _e.taskId,
|
||||
taskId: (_d = checkData.value) == null ? void 0 : _d.taskId,
|
||||
result: resultValue,
|
||||
remark: value1.value
|
||||
};
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:723", "提交参数:", submitParams);
|
||||
const res = await request_api.submitCheckResult(submitParams);
|
||||
common_vendor.index.hideLoading();
|
||||
if (res.code === 0) {
|
||||
@@ -397,7 +189,7 @@ const _sfc_main = {
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:758", "提交失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:306", "提交失败:", error);
|
||||
common_vendor.index.showToast({ title: "提交失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
@@ -409,164 +201,19 @@ const _sfc_main = {
|
||||
const getCheckData = async () => {
|
||||
try {
|
||||
const res = await request_api.enterCheckPlan(oneTableId.value);
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:777", "检查项数据:", res);
|
||||
if (res.code === 0) {
|
||||
checkData.value = res.data;
|
||||
restoreDraft();
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:784", error);
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:325", error);
|
||||
}
|
||||
};
|
||||
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 getDraftKey = () => {
|
||||
var _a;
|
||||
return `draft_inspection_result_${oneTableId.value || ""}_${((_a = checkData.value) == null ? void 0 : _a.currentIndex) || ""}`;
|
||||
};
|
||||
const saveDraft = () => {
|
||||
if (isRestoring.value || !isInitialized.value) {
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:799", "【草稿Debug - 巡检】saveDraft 被跳过:", { isRestoring: isRestoring.value, isInitialized: isInitialized.value });
|
||||
return;
|
||||
}
|
||||
const key = getDraftKey();
|
||||
const hasContent = radiovalue1.value || value1.value || hazardFormData.title || hazardFormData.description || hazardFileList.value.length > 0;
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:809", "【草稿Debug - 巡检】尝试自动保存草稿. Key:", key, "是否有实质内容:", !!hasContent, "当前数据:", {
|
||||
radiovalue1: radiovalue1.value,
|
||||
value1: value1.value,
|
||||
title: hazardFormData.title,
|
||||
description: hazardFormData.description,
|
||||
fileCount: hazardFileList.value.length
|
||||
});
|
||||
if (!hasContent) {
|
||||
common_vendor.index.removeStorageSync(key);
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:819", "【草稿Debug - 巡检】当前表单为空,自动删除本地缓存 Key:", key);
|
||||
hasDraft.value = false;
|
||||
return;
|
||||
}
|
||||
const data = {
|
||||
radiovalue1: radiovalue1.value,
|
||||
value1: value1.value,
|
||||
hazardFormData: {
|
||||
title: hazardFormData.title,
|
||||
level: hazardFormData.level,
|
||||
source: hazardFormData.source,
|
||||
description: hazardFormData.description,
|
||||
tagIndex: hazardFormData.tagIndex
|
||||
},
|
||||
hazardFileList: hazardFileList.value,
|
||||
hazardAddress: hazardAddress.value,
|
||||
hazardLng: hazardLng.value,
|
||||
hazardLat: hazardLat.value
|
||||
};
|
||||
common_vendor.index.setStorageSync(key, JSON.stringify(data));
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:840", "【草稿Debug - 巡检】成功保存草稿到 LocalStorage, Key:", key);
|
||||
hasDraft.value = true;
|
||||
};
|
||||
const clearDraft = (showToast = true) => {
|
||||
const key = getDraftKey();
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:847", "【草稿Debug - 巡检】手动清空草稿, Key:", key);
|
||||
common_vendor.index.removeStorageSync(key);
|
||||
hasDraft.value = false;
|
||||
showRestoreBanner.value = false;
|
||||
isRestoring.value = true;
|
||||
radiovalue1.value = "";
|
||||
value1.value = "";
|
||||
hazardFormData.title = "";
|
||||
hazardFormData.level = 0;
|
||||
hazardFormData.source = 0;
|
||||
hazardFormData.description = "";
|
||||
hazardFormData.tagIndex = 0;
|
||||
hazardFileList.value = [];
|
||||
hazardAddress.value = "";
|
||||
hazardLng.value = 0;
|
||||
hazardLat.value = 0;
|
||||
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);
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:877", "【草稿Debug - 巡检】尝试恢复草稿, Key:", key, "获取本地缓存结果:", !!cached);
|
||||
if (cached) {
|
||||
try {
|
||||
const data = JSON.parse(cached);
|
||||
const hasContent = data.radiovalue1 || data.value1 || data.hazardFormData.title || data.hazardFormData.description || data.hazardFileList && data.hazardFileList.length > 0;
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:887", "【草稿Debug - 巡检】解析本地缓存成功, 是否有实质内容:", !!hasContent, "缓存数据:", data);
|
||||
if (!hasContent) {
|
||||
isInitialized.value = true;
|
||||
return;
|
||||
}
|
||||
isRestoring.value = true;
|
||||
radiovalue1.value = data.radiovalue1 || "";
|
||||
value1.value = data.value1 || "";
|
||||
hazardFormData.title = data.hazardFormData.title || "";
|
||||
hazardFormData.level = data.hazardFormData.level || 0;
|
||||
hazardFormData.source = data.hazardFormData.source || 0;
|
||||
hazardFormData.description = data.hazardFormData.description || "";
|
||||
hazardFormData.tagIndex = data.hazardFormData.tagIndex || 0;
|
||||
hazardFileList.value = data.hazardFileList || [];
|
||||
hazardAddress.value = data.hazardAddress || "";
|
||||
hazardLng.value = data.hazardLng || 0;
|
||||
hazardLat.value = data.hazardLat || 0;
|
||||
hasDraft.value = true;
|
||||
showRestoreBanner.value = true;
|
||||
common_vendor.nextTick$1(() => {
|
||||
isRestoring.value = false;
|
||||
isInitialized.value = true;
|
||||
if (levelChooseRef.value && levelChooseRef.value.$data) {
|
||||
levelChooseRef.value.$data.currentIndex = hazardFormData.level;
|
||||
}
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:914", "【草稿Debug - 巡检】UI与多选组件状态同步重绘完毕!");
|
||||
});
|
||||
common_vendor.index.showToast({
|
||||
title: "已自动恢复您上次未提交的内容",
|
||||
icon: "none",
|
||||
duration: 2500
|
||||
});
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/Inspectionresult.vue:923", "【草稿Debug - 巡检】解析草稿异常:", e);
|
||||
isRestoring.value = false;
|
||||
isInitialized.value = true;
|
||||
}
|
||||
} else {
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:928", "【草稿Debug - 巡检】本地无任何缓存, 页面已安全标记为 initialized");
|
||||
isInitialized.value = true;
|
||||
}
|
||||
};
|
||||
common_vendor.watch(
|
||||
() => [
|
||||
radiovalue1.value,
|
||||
value1.value,
|
||||
hazardFormData.title,
|
||||
hazardFormData.level,
|
||||
hazardFormData.source,
|
||||
hazardFormData.description,
|
||||
hazardFormData.tagIndex,
|
||||
hazardAddress.value,
|
||||
hazardFileList.value
|
||||
],
|
||||
() => {
|
||||
if (oneTableId.value) {
|
||||
saveDraft();
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
common_vendor.onLoad((options) => {
|
||||
common_vendor.index.__f__("log", "at pages/Inspectionresult/Inspectionresult.vue:955", "接收到的参数:", options);
|
||||
if (options.id) {
|
||||
oneTableId.value = options.id;
|
||||
getCheckData();
|
||||
}
|
||||
fetchTagOptions();
|
||||
fetchAreaList();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
var _a, _b, _c, _d;
|
||||
@@ -605,17 +252,17 @@ const _sfc_main = {
|
||||
}, !hasHazardData.value ? {
|
||||
m: common_vendor.o(openHazardPopup)
|
||||
} : common_vendor.e({
|
||||
n: common_vendor.t(hazardFormData.title),
|
||||
o: common_vendor.t((_c = levelOptions.value[hazardFormData.level]) == null ? void 0 : _c.title),
|
||||
p: hazardFormData.level === 0 ? 1 : "",
|
||||
q: hazardFormData.level === 1 ? 1 : "",
|
||||
r: hazardFormData.level === 2 ? 1 : "",
|
||||
s: common_vendor.t(((_d = sourceOptions.value[hazardFormData.source]) == null ? void 0 : _d.title) || "-"),
|
||||
t: common_vendor.t(hazardAddress.value || "-"),
|
||||
v: common_vendor.t(hazardFormData.description || "-"),
|
||||
w: hazardFileList.value.length > 0
|
||||
}, hazardFileList.value.length > 0 ? {
|
||||
x: common_vendor.t(hazardFileList.value.length)
|
||||
n: common_vendor.t(hazardPayload.value.formData.title),
|
||||
o: common_vendor.t((_c = common_vendor.unref(components_hazard_hazardForm.LEVEL_OPTIONS)[hazardPayload.value.formData.level]) == null ? void 0 : _c.title),
|
||||
p: hazardPayload.value.formData.level === 0 ? 1 : "",
|
||||
q: hazardPayload.value.formData.level === 1 ? 1 : "",
|
||||
r: hazardPayload.value.formData.level === 2 ? 1 : "",
|
||||
s: common_vendor.t(((_d = common_vendor.unref(components_hazard_hazardForm.SOURCE_OPTIONS)[hazardPayload.value.formData.source]) == null ? void 0 : _d.title) || "-"),
|
||||
t: common_vendor.t(hazardPayload.value.address || "-"),
|
||||
v: common_vendor.t(hazardPayload.value.formData.description || "-"),
|
||||
w: hazardPayload.value.fileList.length > 0
|
||||
}, hazardPayload.value.fileList.length > 0 ? {
|
||||
x: common_vendor.t(hazardPayload.value.fileList.length)
|
||||
} : {}, {
|
||||
y: common_vendor.o(editHazard),
|
||||
z: common_vendor.o(clearHazard)
|
||||
@@ -626,138 +273,22 @@ const _sfc_main = {
|
||||
modelValue: value1.value
|
||||
}),
|
||||
C: common_vendor.o(handleSubmit),
|
||||
D: common_vendor.o(($event) => showHazardPopup.value = false),
|
||||
E: showRestoreBanner.value
|
||||
}, showRestoreBanner.value ? {
|
||||
F: common_vendor.o(($event) => clearDraft(true))
|
||||
} : {}, {
|
||||
G: common_vendor.o(($event) => hazardFormData.source = $event),
|
||||
H: common_vendor.p({
|
||||
options: sourceOptions.value,
|
||||
wrap: false,
|
||||
["item-width"]: "152rpx",
|
||||
["item-height"]: "64rpx",
|
||||
modelValue: hazardFormData.source
|
||||
D: common_vendor.sr(hazardFormRef, "643afff0-3", {
|
||||
"k": "hazardFormRef"
|
||||
}),
|
||||
I: common_vendor.o(common_vendor.unref(afterRead)),
|
||||
J: common_vendor.o(common_vendor.unref(deletePic)),
|
||||
K: common_vendor.p({
|
||||
fileList: hazardFileList.value,
|
||||
name: "1",
|
||||
multiple: true,
|
||||
imageMode: "aspectFill",
|
||||
maxCount: 10
|
||||
}),
|
||||
L: canvasWidth.value,
|
||||
M: canvasHeight.value,
|
||||
N: canvasWidth.value + "px",
|
||||
O: canvasHeight.value + "px",
|
||||
P: !aiAnalyzing.value
|
||||
}, !aiAnalyzing.value ? {} : {}, {
|
||||
Q: common_vendor.t(aiAnalyzing.value ? "AI识别中..." : "AI 识别隐患"),
|
||||
R: aiAnalyzing.value,
|
||||
S: aiAnalyzing.value,
|
||||
T: common_vendor.o(handleAiAnalyze),
|
||||
U: common_vendor.o(($event) => hazardFormData.title = $event),
|
||||
V: common_vendor.p({
|
||||
placeholder: "请输入内容",
|
||||
border: "surround",
|
||||
modelValue: hazardFormData.title
|
||||
}),
|
||||
W: common_vendor.sr(levelChooseRef, "643afff0-7,643afff0-3", {
|
||||
"k": "levelChooseRef"
|
||||
}),
|
||||
X: common_vendor.o(($event) => hazardFormData.level = $event),
|
||||
Y: common_vendor.p({
|
||||
options: levelOptions.value,
|
||||
wrap: false,
|
||||
["item-width"]: "183rpx",
|
||||
["item-height"]: "72rpx",
|
||||
modelValue: hazardFormData.level
|
||||
}),
|
||||
Z: common_vendor.o(($event) => hazardAddress.value = $event),
|
||||
aa: common_vendor.p({
|
||||
placeholder: "请输入地址",
|
||||
border: "surround",
|
||||
modelValue: hazardAddress.value
|
||||
}),
|
||||
ab: common_vendor.o(chooseLocation),
|
||||
ac: common_vendor.t(hazardFormData.regulationName || "请选择法律依据"),
|
||||
ad: !hazardFormData.regulationName ? 1 : "",
|
||||
ae: common_vendor.o(openLawPopup),
|
||||
af: common_vendor.t(selectedAreaName.value || "请选择隐患区域"),
|
||||
ag: !selectedAreaName.value ? 1 : "",
|
||||
ah: common_vendor.o(($event) => showAreaPicker.value = true),
|
||||
ai: common_vendor.o(($event) => hazardFormData.description = $event),
|
||||
aj: common_vendor.p({
|
||||
placeholder: "请输入内容",
|
||||
modelValue: hazardFormData.description
|
||||
}),
|
||||
ak: common_vendor.o(($event) => hazardFormData.tagIndex = $event),
|
||||
al: common_vendor.p({
|
||||
options: tagOptions.value,
|
||||
modelValue: hazardFormData.tagIndex
|
||||
}),
|
||||
am: common_vendor.o(($event) => showHazardPopup.value = false),
|
||||
an: common_vendor.o(confirmHazard),
|
||||
ao: common_vendor.o(($event) => showHazardPopup.value = false),
|
||||
ap: common_vendor.p({
|
||||
E: common_vendor.o(onHazardConfirm),
|
||||
F: common_vendor.o(($event) => common_vendor.unref(clearDraft)(true)),
|
||||
G: common_vendor.o(($event) => showHazardPopup.value = $event),
|
||||
H: common_vendor.o(($event) => hazardPayload.value = $event),
|
||||
I: common_vendor.p({
|
||||
title: "填写隐患信息",
|
||||
mode: "collect",
|
||||
["body-height"]: "60vh",
|
||||
["show-draft-banner"]: common_vendor.unref(showRestoreBanner),
|
||||
show: showHazardPopup.value,
|
||||
mode: "center",
|
||||
round: "20",
|
||||
safeAreaInsetBottom: false
|
||||
modelValue: hazardPayload.value
|
||||
}),
|
||||
aq: common_vendor.o(($event) => showLawPopup.value = false),
|
||||
ar: common_vendor.o(searchRegulation),
|
||||
as: lawKeyword.value,
|
||||
at: common_vendor.o(($event) => lawKeyword.value = $event.detail.value),
|
||||
av: common_vendor.o(searchRegulation),
|
||||
aw: lawLoading.value && lawList.value.length === 0
|
||||
}, lawLoading.value && lawList.value.length === 0 ? {} : !lawLoading.value && lawList.value.length === 0 ? {} : common_vendor.e({
|
||||
ay: 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)
|
||||
};
|
||||
}),
|
||||
az: lawLoading.value
|
||||
}, lawLoading.value ? {} : {}), {
|
||||
ax: !lawLoading.value && lawList.value.length === 0,
|
||||
aA: common_vendor.o(loadMoreLaw),
|
||||
aB: common_vendor.o(($event) => showLawPopup.value = false),
|
||||
aC: common_vendor.o(confirmLaw),
|
||||
aD: common_vendor.o(($event) => showLawPopup.value = false),
|
||||
aE: common_vendor.p({
|
||||
show: showLawPopup.value,
|
||||
mode: "center",
|
||||
round: "20",
|
||||
safeAreaInsetBottom: false
|
||||
}),
|
||||
aF: common_vendor.o(($event) => showAreaPicker.value = false),
|
||||
aG: common_vendor.o(confirmAreaSelect),
|
||||
aH: common_vendor.f(areaList.value, (item, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
a: item.color,
|
||||
b: common_vendor.t(item.name),
|
||||
c: tempAreaId.value === item.id
|
||||
}, tempAreaId.value === item.id ? {} : {}, {
|
||||
d: item.id,
|
||||
e: tempAreaId.value === item.id ? 1 : "",
|
||||
f: common_vendor.o(($event) => tempAreaId.value = item.id, item.id)
|
||||
});
|
||||
}),
|
||||
aI: areaList.value.length === 0
|
||||
}, areaList.value.length === 0 ? {} : {}, {
|
||||
aJ: common_vendor.o(($event) => showAreaPicker.value = false),
|
||||
aK: common_vendor.p({
|
||||
show: showAreaPicker.value,
|
||||
mode: "bottom",
|
||||
round: "20"
|
||||
}),
|
||||
aL: common_vendor.gei(_ctx, "")
|
||||
J: common_vendor.gei(_ctx, "")
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
"u-radio": "../../uni_modules/uview-plus/components/u-radio/u-radio",
|
||||
"u-radio-group": "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group",
|
||||
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
|
||||
"up-choose": "../../uni_modules/uview-plus/components/u-choose/u-choose",
|
||||
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload",
|
||||
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input",
|
||||
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup"
|
||||
"hazard-form-popup": "../../components/hazard/HazardFormPopup"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -170,278 +170,4 @@
|
||||
background: #FFF1F0;
|
||||
border: 2rpx solid #FFA39E;
|
||||
color: #F5222D;
|
||||
}
|
||||
.popup-content.data-v-643afff0 {
|
||||
width: 600rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.popup-header.data-v-643afff0 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
.popup-header .popup-title.data-v-643afff0 {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
.popup-header .popup-close.data-v-643afff0 {
|
||||
font-size: 40rpx;
|
||||
color: #999;
|
||||
line-height: 1;
|
||||
}
|
||||
.popup-body.data-v-643afff0 {
|
||||
padding: 30rpx;
|
||||
}
|
||||
.source-choose-scroll.data-v-643afff0 {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.source-choose-scroll.data-v-643afff0 .up-choose {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.source-choose-scroll.data-v-643afff0 .u-tag-wrapper {
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.source-choose-scroll.data-v-643afff0 .u-tag {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
box-sizing: border-box;
|
||||
padding: 0 8rpx !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
.source-choose-scroll.data-v-643afff0 .u-tag__content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
}
|
||||
.source-choose-scroll.data-v-643afff0 .u-tag__text {
|
||||
font-size: 24rpx !important;
|
||||
line-height: 1.3 !important;
|
||||
text-align: center;
|
||||
}
|
||||
.ai-btn-wrapper.data-v-643afff0 {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.ai-analyze-btn.data-v-643afff0 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 72rpx;
|
||||
padding: 0 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #4facfe 0%, #2668EA 100%);
|
||||
border-radius: 36rpx;
|
||||
border: none;
|
||||
}
|
||||
.ai-analyze-btn.data-v-643afff0::after {
|
||||
border: none;
|
||||
}
|
||||
.ai-analyze-btn .ai-btn-icon.data-v-643afff0 {
|
||||
margin-right: 8rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.ai-analyze-btn[disabled].data-v-643afff0 {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.popup-footer.data-v-643afff0 {
|
||||
display: flex;
|
||||
border-top: 1rpx solid #eee;
|
||||
}
|
||||
.popup-footer button.data-v-643afff0 {
|
||||
flex: 1;
|
||||
height: 90rpx;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
line-height: 90rpx;
|
||||
border-radius: 0;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.popup-footer button.data-v-643afff0::after {
|
||||
border: none;
|
||||
}
|
||||
.popup-footer .btn-cancel.data-v-643afff0 {
|
||||
background: #fff;
|
||||
color: #666;
|
||||
}
|
||||
.popup-footer .btn-confirm.data-v-643afff0 {
|
||||
color: #fff;
|
||||
}
|
||||
.address-box.data-v-643afff0 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.address-box .address-input-wrapper.data-v-643afff0 {
|
||||
flex: 1;
|
||||
}
|
||||
.address-box .btn-address.data-v-643afff0 {
|
||||
flex-shrink: 0;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
padding: 0 30rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 8rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.address-box .btn-address.data-v-643afff0::after {
|
||||
border: none;
|
||||
}
|
||||
.select-trigger.data-v-643afff0 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #fff;
|
||||
border: 1rpx solid #dcdfe6;
|
||||
border-radius: 8rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
}
|
||||
.select-trigger .select-value.data-v-643afff0 {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
.select-trigger .select-value.placeholder.data-v-643afff0 {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
.picker-popup.data-v-643afff0 {
|
||||
background: #fff;
|
||||
}
|
||||
.picker-popup .picker-header.data-v-643afff0 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
.picker-popup .picker-header .picker-cancel.data-v-643afff0 {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
.picker-popup .picker-header .picker-title.data-v-643afff0 {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
.picker-popup .picker-header .picker-confirm.data-v-643afff0 {
|
||||
font-size: 28rpx;
|
||||
color: #2667E9;
|
||||
}
|
||||
.picker-popup .picker-body.data-v-643afff0 {
|
||||
max-height: 600rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
.picker-popup .picker-item.data-v-643afff0 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 30rpx 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
.picker-popup .picker-item.data-v-643afff0:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.picker-popup .picker-item.picker-item-active.data-v-643afff0 {
|
||||
color: #2667E9;
|
||||
}
|
||||
.law-popup.data-v-643afff0 {
|
||||
width: 600rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
max-height: 80vh;
|
||||
}
|
||||
.law-popup .popup-header.data-v-643afff0 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
.law-popup .popup-header .popup-title.data-v-643afff0 {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
.law-popup .popup-header .popup-close.data-v-643afff0 {
|
||||
font-size: 40rpx;
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
}
|
||||
.search-box.data-v-643afff0 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #F5F5F5;
|
||||
border-radius: 40rpx;
|
||||
padding: 16rpx 24rpx;
|
||||
margin: 20rpx 30rpx;
|
||||
}
|
||||
.search-box .search-icon.data-v-643afff0 {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.search-box .search-input.data-v-643afff0 {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
.search-box .search-btn.data-v-643afff0 {
|
||||
color: #2667E9;
|
||||
font-size: 26rpx;
|
||||
margin-left: 16rpx;
|
||||
cursor: pointer;
|
||||
}
|
||||
.loading-tip.data-v-643afff0, .empty-tip.data-v-643afff0 {
|
||||
text-align: center;
|
||||
padding: 40rpx;
|
||||
color: #999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.law-list.data-v-643afff0 {
|
||||
max-height: 500rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
.law-item.data-v-643afff0 {
|
||||
padding: 24rpx;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 16rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
text-align: left;
|
||||
}
|
||||
.law-item .law-title.data-v-643afff0 {
|
||||
line-height: 1.5;
|
||||
margin-bottom: 8rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.law-item .law-basis.data-v-643afff0 {
|
||||
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-643afff0 {
|
||||
border-color: #2667E9;
|
||||
background: #F0F6FF;
|
||||
}
|
||||
.area-color-dot.data-v-643afff0 {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
645
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/detail.js
vendored
Normal file
645
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/detail.js
vendored
Normal file
@@ -0,0 +1,645 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const request_api = require("../../request/api.js");
|
||||
const utils_draftCache = require("../../utils/draftCache.js");
|
||||
const utils_useDraftCache = require("../../utils/useDraftCache.js");
|
||||
const components_hazard_hazardForm = require("../../components/hazard/hazardForm.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
||||
const _easycom_u_radio2 = common_vendor.resolveComponent("u-radio");
|
||||
const _easycom_u_radio_group2 = common_vendor.resolveComponent("u-radio-group");
|
||||
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
|
||||
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
|
||||
(_easycom_up_icon2 + _easycom_u_radio2 + _easycom_u_radio_group2 + _easycom_up_textarea2 + _easycom_u_popup2)();
|
||||
}
|
||||
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
||||
const _easycom_u_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
|
||||
const _easycom_u_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
|
||||
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
|
||||
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_icon + _easycom_u_radio + _easycom_u_radio_group + _easycom_up_textarea + HazardFormPopup + _easycom_u_popup)();
|
||||
}
|
||||
const HazardFormPopup = () => "../../components/hazard/HazardFormPopup.js";
|
||||
const TASK_STATUS_SUBMITTED = 2;
|
||||
const _sfc_main = {
|
||||
__name: "detail",
|
||||
setup(__props) {
|
||||
const oneTableId = common_vendor.ref("");
|
||||
const tableId = common_vendor.ref("");
|
||||
const taskDate = common_vendor.ref("");
|
||||
const planName = common_vendor.ref("");
|
||||
const loading = common_vendor.ref(true);
|
||||
const checkItemList = common_vendor.ref([]);
|
||||
const answerList = common_vendor.ref([]);
|
||||
const sessionSubmittedTaskIds = common_vendor.ref(/* @__PURE__ */ new Set());
|
||||
const showHazardPopup = common_vendor.ref(false);
|
||||
const showCheckSheet = common_vendor.ref(false);
|
||||
const activeHazardIndex = common_vendor.ref(-1);
|
||||
const hazardFormRef = common_vendor.ref(null);
|
||||
const editingHazardPayload = common_vendor.ref(components_hazard_hazardForm.createEmptyHazardPayload());
|
||||
const resultOptions = [
|
||||
{ name: "正常", value: 1 },
|
||||
{ name: "异常", value: 2 },
|
||||
{ name: "不涉及", value: 3 }
|
||||
];
|
||||
const syncSubmittedTaskIds = (list) => {
|
||||
const next = new Set(sessionSubmittedTaskIds.value);
|
||||
(list || []).forEach((item) => {
|
||||
if ((item == null ? void 0 : item.status) === TASK_STATUS_SUBMITTED && item.taskId != null) {
|
||||
next.add(item.taskId);
|
||||
}
|
||||
});
|
||||
sessionSubmittedTaskIds.value = next;
|
||||
};
|
||||
const isItemSubmitted = (item) => {
|
||||
if (!item)
|
||||
return false;
|
||||
if (item.status === TASK_STATUS_SUBMITTED)
|
||||
return true;
|
||||
if (item.taskId != null && sessionSubmittedTaskIds.value.has(item.taskId))
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
const getResultLabel = (result) => {
|
||||
const opt = resultOptions.find((o) => o.value === result);
|
||||
return (opt == null ? void 0 : opt.name) || "-";
|
||||
};
|
||||
const getResultTagClass = (result) => {
|
||||
if (result === 1)
|
||||
return "result-tag--normal";
|
||||
if (result === 2)
|
||||
return "result-tag--abnormal";
|
||||
if (result === 3)
|
||||
return "result-tag--na";
|
||||
return "";
|
||||
};
|
||||
const viewHazardDetail = (item) => {
|
||||
if (!(item == null ? void 0 : item.hazardId)) {
|
||||
common_vendor.index.showToast({ title: "暂无隐患信息", icon: "none" });
|
||||
return;
|
||||
}
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/hiddendanger/view?hazardId=${item.hazardId}`
|
||||
});
|
||||
};
|
||||
common_vendor.computed(() => {
|
||||
var _a;
|
||||
return planName.value || ((_a = checkItemList.value[0]) == null ? void 0 : _a.itemName) || "检查表";
|
||||
});
|
||||
common_vendor.computed(() => {
|
||||
var _a;
|
||||
return ((_a = checkItemList.value[0]) == null ? void 0 : _a.industryName) || "";
|
||||
});
|
||||
const createEmptyAnswer = () => ({
|
||||
resultLabel: "",
|
||||
result: null,
|
||||
remark: "",
|
||||
hazardPayload: components_hazard_hazardForm.createEmptyHazardPayload()
|
||||
});
|
||||
const normalizeSheetAnswer = (answer) => {
|
||||
if (!answer)
|
||||
return createEmptyAnswer();
|
||||
const hazardPayload = answer.hazardPayload || components_hazard_hazardForm.createEmptyHazardPayload();
|
||||
const empty = components_hazard_hazardForm.createEmptyHazardPayload();
|
||||
return {
|
||||
resultLabel: answer.resultLabel || "",
|
||||
result: answer.result ?? null,
|
||||
remark: answer.remark || "",
|
||||
hazardPayload: {
|
||||
formData: {
|
||||
...empty.formData,
|
||||
...hazardPayload.formData || {}
|
||||
},
|
||||
address: hazardPayload.address || "",
|
||||
lng: hazardPayload.lng || 0,
|
||||
lat: hazardPayload.lat || 0,
|
||||
areaId: hazardPayload.areaId || "",
|
||||
areaName: hazardPayload.areaName || "",
|
||||
fileList: Array.isArray(hazardPayload.fileList) ? [...hazardPayload.fileList] : [],
|
||||
tagOptions: Array.isArray(hazardPayload.tagOptions) ? [...hazardPayload.tagOptions] : []
|
||||
}
|
||||
};
|
||||
};
|
||||
const syncAnswerFields = (answer) => {
|
||||
const normalized = normalizeSheetAnswer(answer);
|
||||
if (!normalized.resultLabel && normalized.result != null) {
|
||||
const opt = resultOptions.find((o) => o.value === normalized.result);
|
||||
if (opt)
|
||||
normalized.resultLabel = opt.name;
|
||||
} else if (normalized.resultLabel && normalized.result == null) {
|
||||
const opt = resultOptions.find((o) => o.name === normalized.resultLabel);
|
||||
if (opt)
|
||||
normalized.result = opt.value;
|
||||
}
|
||||
return normalized;
|
||||
};
|
||||
const buildAnswerFromTask = (item) => {
|
||||
const answer = createEmptyAnswer();
|
||||
if (!isItemSubmitted(item)) {
|
||||
return answer;
|
||||
}
|
||||
answer.result = item.result;
|
||||
answer.remark = item.remark || "";
|
||||
const opt = resultOptions.find((o) => o.value === item.result);
|
||||
if (opt) {
|
||||
answer.resultLabel = opt.name;
|
||||
}
|
||||
if (item.result === 2 && item.hazardName) {
|
||||
const sourceIndex = components_hazard_hazardForm.SOURCE_OPTIONS.findIndex((o) => o.title === item.source);
|
||||
answer.hazardPayload = {
|
||||
...components_hazard_hazardForm.createEmptyHazardPayload(),
|
||||
formData: {
|
||||
...components_hazard_hazardForm.createEmptyHazardPayload().formData,
|
||||
title: item.hazardName || "",
|
||||
description: item.hazardDesc || "",
|
||||
source: sourceIndex >= 0 ? sourceIndex : 0
|
||||
},
|
||||
address: item.hazardAddress || ""
|
||||
};
|
||||
}
|
||||
return syncAnswerFields(answer);
|
||||
};
|
||||
const isAnswerFilled = (answer) => {
|
||||
if (!answer)
|
||||
return false;
|
||||
return !!(answer.resultLabel || answer.result != null);
|
||||
};
|
||||
const hasAnswerDraftContent = (answer) => {
|
||||
var _a, _b;
|
||||
if (!answer)
|
||||
return false;
|
||||
const normalized = normalizeSheetAnswer(answer);
|
||||
const hazard = normalized.hazardPayload;
|
||||
return !!(normalized.resultLabel || normalized.result != null || normalized.remark || ((_a = hazard.formData) == null ? void 0 : _a.title) || ((_b = hazard.formData) == null ? void 0 : _b.description) || hazard.fileList && hazard.fileList.length > 0);
|
||||
};
|
||||
const buildDraftAnswers = () => {
|
||||
return checkItemList.value.map((item, index) => {
|
||||
if (isItemSubmitted(item))
|
||||
return null;
|
||||
const answer = answerList.value[index] || createEmptyAnswer();
|
||||
if (!hasAnswerDraftContent(answer))
|
||||
return null;
|
||||
return {
|
||||
taskId: item.taskId,
|
||||
...JSON.parse(JSON.stringify(answer))
|
||||
};
|
||||
}).filter(Boolean);
|
||||
};
|
||||
const pruneDraftSubmitted = (taskIds = []) => {
|
||||
var _a;
|
||||
const key = utils_draftCache.buildDraftKey(utils_draftCache.DRAFT_NS.INSPECTION_SHEET, oneTableId.value, taskDate.value);
|
||||
const { data } = utils_draftCache.loadDraftWithFallback(key);
|
||||
if (!((_a = data == null ? void 0 : data.answers) == null ? void 0 : _a.length))
|
||||
return;
|
||||
const submittedSet = new Set(taskIds);
|
||||
const remainingAnswers = data.answers.filter(
|
||||
(answer) => (answer == null ? void 0 : answer.taskId) == null || !submittedSet.has(answer.taskId)
|
||||
);
|
||||
if (!remainingAnswers.length) {
|
||||
utils_draftCache.removeDraft(key);
|
||||
return;
|
||||
}
|
||||
utils_draftCache.saveDraftToStorage(key, {
|
||||
...data,
|
||||
answers: remainingAnswers
|
||||
});
|
||||
};
|
||||
const isItemPendingSubmit = (index) => {
|
||||
const item = checkItemList.value[index];
|
||||
return !isItemSubmitted(item) && isAnswerFilled(answerList.value[index]);
|
||||
};
|
||||
const submittedCount = common_vendor.computed(() => {
|
||||
return checkItemList.value.filter(isItemSubmitted).length;
|
||||
});
|
||||
const pendingSubmitCount = common_vendor.computed(() => {
|
||||
return checkItemList.value.filter((item, index) => isItemPendingSubmit(index)).length;
|
||||
});
|
||||
const uncheckedCount = common_vendor.computed(() => {
|
||||
return Math.max(checkItemList.value.length - submittedCount.value - pendingSubmitCount.value, 0);
|
||||
});
|
||||
const getSheetCellClass = (index) => {
|
||||
const item = checkItemList.value[index];
|
||||
if (isItemSubmitted(item))
|
||||
return "check-sheet-cell--submitted";
|
||||
if (isItemPendingSubmit(index))
|
||||
return "check-sheet-cell--pending";
|
||||
return "";
|
||||
};
|
||||
const progressPercent = common_vendor.computed(() => {
|
||||
if (!checkItemList.value.length)
|
||||
return 0;
|
||||
return Math.round(submittedCount.value / checkItemList.value.length * 100);
|
||||
});
|
||||
const sheetDraftHasContent = (data) => {
|
||||
var _a;
|
||||
if (!((_a = data == null ? void 0 : data.answers) == null ? void 0 : _a.length))
|
||||
return false;
|
||||
return data.answers.some((answer) => hasAnswerDraftContent(answer));
|
||||
};
|
||||
const {
|
||||
showRestoreBanner,
|
||||
clear: clearDraft,
|
||||
restore: restoreDraft,
|
||||
bindAutoSave
|
||||
} = utils_useDraftCache.useDraftCache({
|
||||
getKey: () => utils_draftCache.buildDraftKey(utils_draftCache.DRAFT_NS.INSPECTION_SHEET, oneTableId.value, taskDate.value),
|
||||
getPayload: () => ({
|
||||
oneTableId: oneTableId.value,
|
||||
taskDate: taskDate.value,
|
||||
planName: planName.value,
|
||||
answers: buildDraftAnswers()
|
||||
}),
|
||||
hasContent: sheetDraftHasContent,
|
||||
applyPayload: (data) => {
|
||||
var _a;
|
||||
if (!((_a = data == null ? void 0 : data.answers) == null ? void 0 : _a.length) || !checkItemList.value.length)
|
||||
return;
|
||||
answerList.value = checkItemList.value.map((item, index) => {
|
||||
if (isItemSubmitted(item)) {
|
||||
return buildAnswerFromTask(item);
|
||||
}
|
||||
const savedByIndex = data.answers[index];
|
||||
if (savedByIndex && sheetDraftHasContent({ answers: [savedByIndex] })) {
|
||||
return syncAnswerFields(savedByIndex);
|
||||
}
|
||||
if (item.taskId != null && item.taskId !== "") {
|
||||
const savedByTaskId = data.answers.find((a) => a.taskId === item.taskId);
|
||||
if (savedByTaskId) {
|
||||
return syncAnswerFields(savedByTaskId);
|
||||
}
|
||||
}
|
||||
return createEmptyAnswer();
|
||||
});
|
||||
if (data.planName && !planName.value) {
|
||||
planName.value = data.planName;
|
||||
}
|
||||
},
|
||||
clearForm: () => {
|
||||
answerList.value = checkItemList.value.map((item) => isItemSubmitted(item) ? buildAnswerFromTask(item) : createEmptyAnswer());
|
||||
},
|
||||
canSave: () => !!oneTableId.value && !!taskDate.value && checkItemList.value.length > 0,
|
||||
requireInitialized: true
|
||||
});
|
||||
bindAutoSave(() => answerList.value);
|
||||
const onResultChange = (index, label) => {
|
||||
const answer = answerList.value[index];
|
||||
if (!answer)
|
||||
return;
|
||||
answer.resultLabel = label;
|
||||
const selected = resultOptions.find((opt) => opt.name === label);
|
||||
answer.result = selected ? selected.value : null;
|
||||
if (label !== "异常") {
|
||||
answer.hazardPayload = components_hazard_hazardForm.createEmptyHazardPayload();
|
||||
}
|
||||
};
|
||||
const hazardFormExtraParams = common_vendor.computed(() => {
|
||||
var _a;
|
||||
const index = activeHazardIndex.value;
|
||||
const taskId = index >= 0 ? (_a = checkItemList.value[index]) == null ? void 0 : _a.taskId : "";
|
||||
return {
|
||||
locationDraftKey: `hazard_location_${oneTableId.value}_${taskDate.value}_${taskId || index}`
|
||||
};
|
||||
});
|
||||
const hasHazardData = (index) => {
|
||||
var _a;
|
||||
return components_hazard_hazardForm.hasValidHazardPayload((_a = answerList.value[index]) == null ? void 0 : _a.hazardPayload);
|
||||
};
|
||||
const openHazardPopup = (index) => {
|
||||
var _a;
|
||||
activeHazardIndex.value = index;
|
||||
editingHazardPayload.value = JSON.parse(JSON.stringify(
|
||||
((_a = answerList.value[index]) == null ? void 0 : _a.hazardPayload) ?? components_hazard_hazardForm.createEmptyHazardPayload()
|
||||
));
|
||||
showHazardPopup.value = true;
|
||||
};
|
||||
const closeHazardPopup = () => {
|
||||
showHazardPopup.value = false;
|
||||
activeHazardIndex.value = -1;
|
||||
editingHazardPayload.value = components_hazard_hazardForm.createEmptyHazardPayload();
|
||||
};
|
||||
const onHazardConfirm = (payload) => {
|
||||
const index = activeHazardIndex.value;
|
||||
const data = payload || editingHazardPayload.value;
|
||||
if (index >= 0 && data && answerList.value[index]) {
|
||||
answerList.value[index].hazardPayload = JSON.parse(JSON.stringify(data));
|
||||
}
|
||||
closeHazardPopup();
|
||||
};
|
||||
const clearHazard = (index) => {
|
||||
if (answerList.value[index]) {
|
||||
answerList.value[index].hazardPayload = components_hazard_hazardForm.createEmptyHazardPayload();
|
||||
}
|
||||
};
|
||||
const openCheckSheet = () => {
|
||||
showCheckSheet.value = true;
|
||||
};
|
||||
const closeCheckSheet = () => {
|
||||
showCheckSheet.value = false;
|
||||
};
|
||||
const handleSheetSubmit = () => {
|
||||
closeCheckSheet();
|
||||
handleSubmitAll();
|
||||
};
|
||||
const scrollToItem = (index) => {
|
||||
closeCheckSheet();
|
||||
common_vendor.nextTick$1(() => {
|
||||
common_vendor.index.pageScrollTo({
|
||||
selector: `#check-item-${index}`,
|
||||
duration: 300,
|
||||
offsetTop: -80
|
||||
});
|
||||
});
|
||||
};
|
||||
const getFilledAnswerIndices = () => {
|
||||
const indices = [];
|
||||
for (let i = 0; i < checkItemList.value.length; i++) {
|
||||
if (!isItemSubmitted(checkItemList.value[i]) && isAnswerFilled(answerList.value[i])) {
|
||||
indices.push(i);
|
||||
}
|
||||
}
|
||||
return indices;
|
||||
};
|
||||
const validateFilledAnswers = () => {
|
||||
const indices = getFilledAnswerIndices();
|
||||
if (!indices.length) {
|
||||
common_vendor.index.showToast({ title: "请先填写待提交的检查项", icon: "none" });
|
||||
return null;
|
||||
}
|
||||
for (const index of indices) {
|
||||
const answer = answerList.value[index];
|
||||
if (answer.resultLabel === "异常" && !components_hazard_hazardForm.hasValidHazardPayload(answer.hazardPayload)) {
|
||||
common_vendor.index.showToast({ title: `第 ${index + 1} 项为异常,请填写隐患信息`, icon: "none" });
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return indices;
|
||||
};
|
||||
const buildSubmitPayload = (filledIndices) => {
|
||||
return filledIndices.filter((index) => !isItemSubmitted(checkItemList.value[index])).map((index) => {
|
||||
const item = checkItemList.value[index];
|
||||
const answer = syncAnswerFields(answerList.value[index]);
|
||||
const payload = {
|
||||
taskId: item.taskId,
|
||||
result: answer.result,
|
||||
remark: answer.remark || ""
|
||||
};
|
||||
if (answer.resultLabel === "异常" && components_hazard_hazardForm.hasValidHazardPayload(answer.hazardPayload)) {
|
||||
payload.hazard = components_hazard_hazardForm.buildHiddenDangerParams(answer.hazardPayload, {
|
||||
taskId: item.taskId,
|
||||
checkPointId: item.checkPointId
|
||||
});
|
||||
}
|
||||
return payload;
|
||||
});
|
||||
};
|
||||
const goToListPage = () => {
|
||||
common_vendor.index.navigateBack();
|
||||
};
|
||||
const handleSubmitAll = async () => {
|
||||
const filledIndices = validateFilledAnswers();
|
||||
if (!filledIndices)
|
||||
return;
|
||||
const submitList = buildSubmitPayload(filledIndices);
|
||||
if (!submitList.length) {
|
||||
common_vendor.index.showToast({ title: "没有可提交的新检查项", icon: "none" });
|
||||
return;
|
||||
}
|
||||
try {
|
||||
common_vendor.index.showLoading({ title: "提交中..." });
|
||||
const res = await request_api.submitAllTask(submitList);
|
||||
common_vendor.index.hideLoading();
|
||||
if (res.code === 0) {
|
||||
const nextSubmitted = new Set(sessionSubmittedTaskIds.value);
|
||||
submitList.forEach((item) => {
|
||||
if (item.taskId != null) {
|
||||
nextSubmitted.add(item.taskId);
|
||||
}
|
||||
});
|
||||
sessionSubmittedTaskIds.value = nextSubmitted;
|
||||
pruneDraftSubmitted(submitList.map((item) => item.taskId));
|
||||
common_vendor.index.showToast({
|
||||
title: `已成功提交 ${submitList.length} 项`,
|
||||
icon: "success"
|
||||
});
|
||||
setTimeout(() => {
|
||||
goToListPage();
|
||||
}, 1500);
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "提交失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/detail.vue:730", "提交失败:", error);
|
||||
common_vendor.index.showToast({ title: "提交失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
const fetchDetail = async () => {
|
||||
var _a;
|
||||
if (!oneTableId.value || !taskDate.value) {
|
||||
loading.value = false;
|
||||
common_vendor.index.showToast({ title: "缺少任务参数", icon: "none" });
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await request_api.getAllTask(oneTableId.value, taskDate.value);
|
||||
if (res.code === 0) {
|
||||
const list = Array.isArray(res.data) ? res.data : ((_a = res.data) == null ? void 0 : _a.records) || [];
|
||||
syncSubmittedTaskIds(list);
|
||||
checkItemList.value = list;
|
||||
answerList.value = list.map((item) => buildAnswerFromTask(item));
|
||||
restoreDraft();
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "获取检查项失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/detail.vue:754", "获取检查项失败:", error);
|
||||
common_vendor.index.showToast({ title: "获取检查项失败", icon: "none" });
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
common_vendor.onLoad((options) => {
|
||||
if (options.oneTableId) {
|
||||
oneTableId.value = options.oneTableId;
|
||||
} else if (options.id) {
|
||||
oneTableId.value = options.id;
|
||||
}
|
||||
if (options.taskDate) {
|
||||
taskDate.value = decodeURIComponent(options.taskDate).split(" ")[0];
|
||||
}
|
||||
if (options.name) {
|
||||
planName.value = decodeURIComponent(options.name);
|
||||
}
|
||||
if (options.tableId) {
|
||||
tableId.value = options.tableId;
|
||||
}
|
||||
fetchDetail();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: loading.value
|
||||
}, loading.value ? {} : !checkItemList.value.length ? {} : common_vendor.e({
|
||||
c: common_vendor.t(checkItemList.value.length),
|
||||
d: common_vendor.t(submittedCount.value),
|
||||
e: common_vendor.t(pendingSubmitCount.value),
|
||||
f: common_vendor.t(uncheckedCount.value),
|
||||
g: progressPercent.value + "%",
|
||||
h: common_vendor.p({
|
||||
name: "grid",
|
||||
size: "22",
|
||||
color: "#2667E9"
|
||||
}),
|
||||
i: common_vendor.o(openCheckSheet),
|
||||
j: common_vendor.unref(showRestoreBanner)
|
||||
}, common_vendor.unref(showRestoreBanner) ? {
|
||||
k: common_vendor.o(($event) => common_vendor.unref(clearDraft)(true))
|
||||
} : {}, {
|
||||
l: common_vendor.f(checkItemList.value, (item, index, i0) => {
|
||||
var _a, _b;
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(index + 1),
|
||||
b: isItemSubmitted(item)
|
||||
}, isItemSubmitted(item) ? {} : isItemPendingSubmit(index) ? {} : {}, {
|
||||
c: isItemPendingSubmit(index),
|
||||
d: common_vendor.t(item.name),
|
||||
e: item.point || "",
|
||||
f: isItemSubmitted(item)
|
||||
}, isItemSubmitted(item) ? common_vendor.e({
|
||||
g: common_vendor.t(getResultLabel(item.result)),
|
||||
h: common_vendor.n(getResultTagClass(item.result)),
|
||||
i: item.remark
|
||||
}, item.remark ? {
|
||||
j: common_vendor.t(item.remark)
|
||||
} : {}, {
|
||||
k: item.result === 2
|
||||
}, item.result === 2 ? common_vendor.e({
|
||||
l: item.hazardName
|
||||
}, item.hazardName ? {
|
||||
m: common_vendor.t(item.hazardName)
|
||||
} : {}, {
|
||||
n: item.source
|
||||
}, item.source ? {
|
||||
o: common_vendor.t(item.source)
|
||||
} : {}, {
|
||||
p: item.hazardAddress
|
||||
}, item.hazardAddress ? {
|
||||
q: common_vendor.t(item.hazardAddress)
|
||||
} : {}, {
|
||||
r: item.hazardDesc
|
||||
}, item.hazardDesc ? {
|
||||
s: common_vendor.t(item.hazardDesc)
|
||||
} : {}) : {}, {
|
||||
t: item.result === 2 && item.hazardId
|
||||
}, item.result === 2 && item.hazardId ? {
|
||||
v: common_vendor.o(($event) => viewHazardDetail(item), "check-item-" + index)
|
||||
} : {}) : common_vendor.e({
|
||||
w: common_vendor.f(resultOptions, (opt, optIndex, i1) => {
|
||||
return {
|
||||
a: optIndex,
|
||||
b: "1b3bf21b-2-" + i0 + "-" + i1 + "," + ("1b3bf21b-1-" + i0),
|
||||
c: common_vendor.p({
|
||||
customStyle: {
|
||||
marginBottom: "8px",
|
||||
marginRight: "24rpx"
|
||||
},
|
||||
label: opt.name,
|
||||
name: opt.name
|
||||
})
|
||||
};
|
||||
}),
|
||||
x: common_vendor.o((label) => onResultChange(index, label), "check-item-" + index),
|
||||
y: "1b3bf21b-1-" + i0,
|
||||
z: common_vendor.o(($event) => answerList.value[index].resultLabel = $event, "check-item-" + index),
|
||||
A: common_vendor.p({
|
||||
placement: "row",
|
||||
modelValue: answerList.value[index].resultLabel
|
||||
}),
|
||||
B: answerList.value[index].resultLabel === "异常"
|
||||
}, answerList.value[index].resultLabel === "异常" ? common_vendor.e({
|
||||
C: !hasHazardData(index)
|
||||
}, !hasHazardData(index) ? {
|
||||
D: common_vendor.o(($event) => openHazardPopup(index), "check-item-" + index)
|
||||
} : common_vendor.e({
|
||||
E: common_vendor.t(answerList.value[index].hazardPayload.formData.title),
|
||||
F: common_vendor.t((_a = common_vendor.unref(components_hazard_hazardForm.LEVEL_OPTIONS)[answerList.value[index].hazardPayload.formData.level]) == null ? void 0 : _a.title),
|
||||
G: answerList.value[index].hazardPayload.formData.level === 0 ? 1 : "",
|
||||
H: answerList.value[index].hazardPayload.formData.level === 1 ? 1 : "",
|
||||
I: answerList.value[index].hazardPayload.formData.level === 2 ? 1 : "",
|
||||
J: common_vendor.t(((_b = common_vendor.unref(components_hazard_hazardForm.SOURCE_OPTIONS)[answerList.value[index].hazardPayload.formData.source]) == null ? void 0 : _b.title) || "-"),
|
||||
K: common_vendor.t(answerList.value[index].hazardPayload.address || "-"),
|
||||
L: common_vendor.t(answerList.value[index].hazardPayload.formData.description || "-"),
|
||||
M: answerList.value[index].hazardPayload.fileList.length > 0
|
||||
}, answerList.value[index].hazardPayload.fileList.length > 0 ? {
|
||||
N: common_vendor.t(answerList.value[index].hazardPayload.fileList.length)
|
||||
} : {}, {
|
||||
O: common_vendor.o(($event) => openHazardPopup(index), "check-item-" + index),
|
||||
P: common_vendor.o(($event) => clearHazard(index), "check-item-" + index)
|
||||
})) : {}, {
|
||||
Q: "1b3bf21b-3-" + i0,
|
||||
R: common_vendor.o(($event) => answerList.value[index].remark = $event, "check-item-" + index),
|
||||
S: common_vendor.p({
|
||||
placeholder: "请输入备注信息",
|
||||
modelValue: answerList.value[index].remark
|
||||
})
|
||||
}), {
|
||||
T: "check-item-" + index,
|
||||
U: "check-item-" + index,
|
||||
V: isItemSubmitted(item) ? 1 : ""
|
||||
});
|
||||
}),
|
||||
m: pendingSubmitCount.value > 0
|
||||
}, pendingSubmitCount.value > 0 ? {
|
||||
n: common_vendor.t(pendingSubmitCount.value),
|
||||
o: common_vendor.o(handleSubmitAll)
|
||||
} : {}), {
|
||||
b: !checkItemList.value.length,
|
||||
p: activeHazardIndex.value >= 0
|
||||
}, activeHazardIndex.value >= 0 ? {
|
||||
q: common_vendor.sr(hazardFormRef, "1b3bf21b-4", {
|
||||
"k": "hazardFormRef"
|
||||
}),
|
||||
r: common_vendor.o(onHazardConfirm),
|
||||
s: common_vendor.o(($event) => showHazardPopup.value = $event),
|
||||
t: common_vendor.o(($event) => editingHazardPayload.value = $event),
|
||||
v: common_vendor.p({
|
||||
title: "填写隐患信息",
|
||||
mode: "collect",
|
||||
["body-height"]: "60vh",
|
||||
["extra-params"]: hazardFormExtraParams.value,
|
||||
show: showHazardPopup.value,
|
||||
modelValue: editingHazardPayload.value
|
||||
})
|
||||
} : {}, {
|
||||
w: common_vendor.t(checkItemList.value.length),
|
||||
x: common_vendor.f(checkItemList.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(index + 1),
|
||||
b: "sheet-nav-" + index,
|
||||
c: common_vendor.n(getSheetCellClass(index)),
|
||||
d: common_vendor.o(($event) => scrollToItem(index), "sheet-nav-" + index)
|
||||
};
|
||||
}),
|
||||
y: common_vendor.t(submittedCount.value),
|
||||
z: common_vendor.t(pendingSubmitCount.value),
|
||||
A: common_vendor.t(uncheckedCount.value),
|
||||
B: pendingSubmitCount.value > 0
|
||||
}, pendingSubmitCount.value > 0 ? {
|
||||
C: common_vendor.o(handleSheetSubmit)
|
||||
} : {}, {
|
||||
D: common_vendor.o(closeCheckSheet),
|
||||
E: common_vendor.p({
|
||||
show: showCheckSheet.value,
|
||||
mode: "bottom",
|
||||
round: "20",
|
||||
["safe-area-inset-bottom"]: true
|
||||
}),
|
||||
F: common_vendor.gei(_ctx, "")
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1b3bf21b"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Inspectionresult/detail.js.map
|
||||
11
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/detail.json
vendored
Normal file
11
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/detail.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"navigationBarTitleText": "排查详情",
|
||||
"usingComponents": {
|
||||
"up-icon": "../../uni_modules/uview-plus/components/u-icon/u-icon",
|
||||
"u-radio": "../../uni_modules/uview-plus/components/u-radio/u-radio",
|
||||
"u-radio-group": "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group",
|
||||
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
|
||||
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup",
|
||||
"hazard-form-popup": "../../components/hazard/HazardFormPopup"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/detail.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/detail.wxml
vendored
Normal file
File diff suppressed because one or more lines are too long
455
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/detail.wxss
vendored
Normal file
455
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/detail.wxss
vendored
Normal file
@@ -0,0 +1,455 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* uni.scss */
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.page.data-v-1b3bf21b {
|
||||
min-height: 100vh;
|
||||
background: #EBF2FC;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
.page-content.data-v-1b3bf21b {
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
.empty-tip.data-v-1b3bf21b {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.sheet-header.data-v-1b3bf21b {
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.float-nav.data-v-1b3bf21b {
|
||||
position: -webkit-sticky;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: #fff;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
padding: 20rpx 24rpx;
|
||||
}
|
||||
.float-nav-body.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.float-nav-main.data-v-1b3bf21b {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.sheet-nav-btn.data-v-1b3bf21b {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
background: #eef3ff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.question-card.data-v-1b3bf21b {
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.question-card--submitted.data-v-1b3bf21b {
|
||||
background: #f8faf8;
|
||||
border: 1rpx solid #e8f5e9;
|
||||
}
|
||||
.question-header-row.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.question-index.data-v-1b3bf21b {
|
||||
display: inline-block;
|
||||
padding: 4rpx 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: #2667E9;
|
||||
background: #EEF3FF;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.submitted-tag.data-v-1b3bf21b {
|
||||
padding: 4rpx 16rpx;
|
||||
font-size: 22rpx;
|
||||
color: #52c41a;
|
||||
background: #f6ffed;
|
||||
border: 1rpx solid #b7eb8f;
|
||||
border-radius: 8rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pending-tag.data-v-1b3bf21b {
|
||||
padding: 4rpx 16rpx;
|
||||
font-size: 22rpx;
|
||||
color: #2667e9;
|
||||
background: #eef3ff;
|
||||
border: 1rpx solid #adc6ff;
|
||||
border-radius: 8rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.readonly-block.data-v-1b3bf21b,
|
||||
.answer-panel.data-v-1b3bf21b {
|
||||
padding: 20rpx;
|
||||
background: #f7f8fa;
|
||||
border: 1rpx solid #e8e8e8;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.readonly-row.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 12rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.readonly-row.data-v-1b3bf21b:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.readonly-row--stack.data-v-1b3bf21b {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.hazard-summary.data-v-1b3bf21b {
|
||||
margin-top: 16rpx;
|
||||
padding-top: 16rpx;
|
||||
border-top: 1rpx dashed #e0e0e0;
|
||||
}
|
||||
.readonly-label.data-v-1b3bf21b {
|
||||
flex-shrink: 0;
|
||||
color: #999;
|
||||
min-width: 120rpx;
|
||||
}
|
||||
.readonly-value.data-v-1b3bf21b {
|
||||
flex: 1;
|
||||
color: #333;
|
||||
word-break: break-all;
|
||||
}
|
||||
.result-tag.data-v-1b3bf21b {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.result-tag--normal.data-v-1b3bf21b {
|
||||
background: #f6ffed;
|
||||
border: 1rpx solid #b7eb8f;
|
||||
color: #52c41a;
|
||||
}
|
||||
.result-tag--abnormal.data-v-1b3bf21b {
|
||||
background: #fff1f0;
|
||||
border: 1rpx solid #ffa39e;
|
||||
color: #f5222d;
|
||||
}
|
||||
.result-tag--na.data-v-1b3bf21b {
|
||||
background: #f5f5f5;
|
||||
border: 1rpx solid #d9d9d9;
|
||||
color: #8c8c8c;
|
||||
}
|
||||
.view-hazard-btn.data-v-1b3bf21b {
|
||||
margin-top: 20rpx;
|
||||
width: 100%;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
font-size: 28rpx;
|
||||
color: #2667e9;
|
||||
background: #fff;
|
||||
border: 1rpx solid #adc6ff;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.view-hazard-btn.data-v-1b3bf21b::after {
|
||||
border: none;
|
||||
}
|
||||
.progress-text.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.progress-text .current-index.data-v-1b3bf21b {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
color: #2667E9;
|
||||
}
|
||||
.progress-text .total-count.data-v-1b3bf21b {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.progress-line.data-v-1b3bf21b {
|
||||
height: 12rpx;
|
||||
background: #E5E5E5;
|
||||
border-radius: 6rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.progress-inner.data-v-1b3bf21b {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #2667E9, #5B9BFF);
|
||||
border-radius: 6rpx;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
.hazard-section.data-v-1b3bf21b {
|
||||
border-top: 1rpx solid #eee;
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
.hazard-tip.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 20rpx;
|
||||
background: #FFF7E6;
|
||||
border: 1rpx solid #FFE7BA;
|
||||
border-radius: 8rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.hazard-tip .text-orange.data-v-1b3bf21b {
|
||||
color: #FA8C16;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.hazard-btn.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 88rpx;
|
||||
border: 2rpx dashed #2667E9;
|
||||
border-radius: 12rpx;
|
||||
background: #F5F9FF;
|
||||
}
|
||||
.hazard-btn .text-blue.data-v-1b3bf21b {
|
||||
color: #2667E9;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.hazard-card.data-v-1b3bf21b {
|
||||
background: #F5F9FF;
|
||||
border: 1rpx solid #D6E4FF;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.hazard-card .card-header.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
border-bottom: 1rpx solid #E8E8E8;
|
||||
background: #fff;
|
||||
}
|
||||
.hazard-card .card-body.data-v-1b3bf21b {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.hazard-card .card-body .info-row.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
margin-bottom: 12rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.hazard-card .card-body .info-row.data-v-1b3bf21b:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.hazard-card .card-body .info-row .text-gray.data-v-1b3bf21b {
|
||||
flex-shrink: 0;
|
||||
color: #999;
|
||||
}
|
||||
.hazard-card .card-body .info-row .description-text.data-v-1b3bf21b {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.hazard-card .card-footer.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
border-top: 1rpx solid #E8E8E8;
|
||||
background: #fff;
|
||||
}
|
||||
.hazard-card .card-footer button.data-v-1b3bf21b {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 28rpx;
|
||||
border-radius: 0;
|
||||
}
|
||||
.hazard-card .card-footer button.data-v-1b3bf21b::after {
|
||||
border: none;
|
||||
}
|
||||
.hazard-card .card-footer .btn-edit.data-v-1b3bf21b {
|
||||
background: #fff;
|
||||
color: #2667E9;
|
||||
border-right: 1rpx solid #E8E8E8;
|
||||
}
|
||||
.hazard-card .card-footer .btn-clear.data-v-1b3bf21b {
|
||||
background: #fff;
|
||||
color: #F56C6C;
|
||||
}
|
||||
.level-tag.data-v-1b3bf21b {
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.level-minor.data-v-1b3bf21b {
|
||||
background: #F6FFED;
|
||||
border: 2rpx solid #B7EB8F;
|
||||
color: #52C41A;
|
||||
}
|
||||
.level-normal.data-v-1b3bf21b {
|
||||
background: #FFF7E6;
|
||||
border: 2rpx solid #FFD591;
|
||||
color: #FA8C16;
|
||||
}
|
||||
.level-major.data-v-1b3bf21b {
|
||||
background: #FFF1F0;
|
||||
border: 2rpx solid #FFA39E;
|
||||
color: #F5222D;
|
||||
}
|
||||
.submit-btn.data-v-1b3bf21b {
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.draft-banner.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 24rpx;
|
||||
font-size: 24rpx;
|
||||
color: #fa8c16;
|
||||
background: #fff7eb;
|
||||
border: 1rpx solid #ffe4cc;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.draft-banner-left.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.draft-banner-icon.data-v-1b3bf21b {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.draft-banner-action.data-v-1b3bf21b {
|
||||
flex-shrink: 0;
|
||||
margin-left: 16rpx;
|
||||
color: #2667e9;
|
||||
font-weight: bold;
|
||||
}
|
||||
.check-sheet-popup.data-v-1b3bf21b {
|
||||
padding: 32rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
background: #fff;
|
||||
}
|
||||
.check-sheet-header.data-v-1b3bf21b {
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
.check-sheet-title.data-v-1b3bf21b {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
.check-sheet-subtitle.data-v-1b3bf21b {
|
||||
margin-top: 8rpx;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
.check-sheet-grid-wrap.data-v-1b3bf21b {
|
||||
max-height: 52vh;
|
||||
}
|
||||
.check-sheet-grid.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
padding-bottom: 8rpx;
|
||||
}
|
||||
.check-sheet-cell.data-v-1b3bf21b {
|
||||
width: calc((100% - 80rpx) / 5);
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
background: #fff;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
border-radius: 12rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.check-sheet-cell--pending.data-v-1b3bf21b {
|
||||
color: #fff;
|
||||
background: #2667e9;
|
||||
border-color: #2667e9;
|
||||
}
|
||||
.check-sheet-cell--submitted.data-v-1b3bf21b {
|
||||
color: #52c41a;
|
||||
background: #f6ffed;
|
||||
border-color: #b7eb8f;
|
||||
}
|
||||
.check-sheet-footer.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24rpx;
|
||||
margin-top: 28rpx;
|
||||
padding-top: 24rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
.check-sheet-legend.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 32rpx;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
.check-sheet-submit-btn.data-v-1b3bf21b {
|
||||
flex-shrink: 0;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
padding: 0 36rpx;
|
||||
margin: 0;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #4facfe 0%, #2668ea 100%);
|
||||
border-radius: 36rpx;
|
||||
border: none;
|
||||
box-shadow: 0 4rpx 16rpx rgba(38, 104, 234, 0.3);
|
||||
}
|
||||
.check-sheet-submit-btn.data-v-1b3bf21b::after {
|
||||
border: none;
|
||||
}
|
||||
.legend-item.data-v-1b3bf21b {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.legend-dot.data-v-1b3bf21b {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
border-radius: 8rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.legend-dot--submitted.data-v-1b3bf21b {
|
||||
background: #f6ffed;
|
||||
border: 2rpx solid #b7eb8f;
|
||||
}
|
||||
.legend-dot--pending.data-v-1b3bf21b {
|
||||
background: #2667e9;
|
||||
border: 2rpx solid #2667e9;
|
||||
}
|
||||
.legend-dot--todo.data-v-1b3bf21b {
|
||||
background: #fff;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
}
|
||||
138
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/list.js
vendored
Normal file
138
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/list.js
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const request_api = require("../../request/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
|
||||
_easycom_u_navbar2();
|
||||
}
|
||||
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
|
||||
if (!Math) {
|
||||
_easycom_u_navbar();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "list",
|
||||
setup(__props) {
|
||||
const loading = common_vendor.ref(true);
|
||||
const checkPlanData = common_vendor.ref([]);
|
||||
const tableId = common_vendor.ref("");
|
||||
const planName = common_vendor.ref("");
|
||||
const listParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
name: ""
|
||||
};
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr)
|
||||
return "";
|
||||
return String(dateStr).split(" ")[0];
|
||||
};
|
||||
const formatProgress = (progress) => {
|
||||
const num = Number(progress);
|
||||
if (Number.isNaN(num))
|
||||
return 0;
|
||||
return Math.min(100, Math.max(0, num));
|
||||
};
|
||||
const fetchList = async () => {
|
||||
var _a;
|
||||
if (!tableId.value) {
|
||||
loading.value = false;
|
||||
checkPlanData.value = [];
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await request_api.getPlanTableDetail({
|
||||
...listParams,
|
||||
tableId: tableId.value
|
||||
});
|
||||
if (res.code === 0) {
|
||||
checkPlanData.value = ((_a = res.data) == null ? void 0 : _a.records) || [];
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "获取检查清单失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionresult/list.vue:138", "获取检查清单失败:", error);
|
||||
common_vendor.index.showToast({ title: "获取检查清单失败", icon: "none" });
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const startCheck = (item) => {
|
||||
const oneTableId = item.id;
|
||||
const taskDate = formatDate(item.taskDate);
|
||||
if (!oneTableId || !taskDate) {
|
||||
common_vendor.index.showToast({ title: "缺少任务参数", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const name = item.name || planName.value || "";
|
||||
const tableIdQuery = tableId.value ? `&tableId=${tableId.value}` : "";
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/Inspectionresult/detail?oneTableId=${oneTableId}&taskDate=${encodeURIComponent(taskDate)}&name=${encodeURIComponent(name)}${tableIdQuery}`
|
||||
});
|
||||
};
|
||||
common_vendor.onLoad((options) => {
|
||||
if (options.tableId) {
|
||||
tableId.value = options.tableId;
|
||||
}
|
||||
if (options.name) {
|
||||
planName.value = decodeURIComponent(options.name);
|
||||
}
|
||||
});
|
||||
common_vendor.onShow(() => {
|
||||
fetchList();
|
||||
});
|
||||
const goHome = () => {
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/index/index"
|
||||
});
|
||||
};
|
||||
common_vendor.onBackPress(() => {
|
||||
goHome();
|
||||
return true;
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.o(goHome),
|
||||
b: common_vendor.p({
|
||||
title: "检查列表",
|
||||
placeholder: true,
|
||||
safeAreaInsetTop: true,
|
||||
bgColor: "#3375e6",
|
||||
titleColor: "#ffffff",
|
||||
leftIconColor: "#ffffff",
|
||||
autoBack: false
|
||||
}),
|
||||
c: loading.value
|
||||
}, loading.value ? {} : !tableId.value ? {} : checkPlanData.value.length === 0 ? {} : {
|
||||
f: common_vendor.f(checkPlanData.value, (item, k0, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.name || planName.value || "检查任务"),
|
||||
b: common_vendor.t(item.runModeName),
|
||||
c: common_vendor.t(item.cycle),
|
||||
d: item.taskDate
|
||||
}, item.taskDate ? {
|
||||
e: common_vendor.t(formatDate(item.taskDate))
|
||||
} : {}, {
|
||||
f: common_vendor.t(formatDate(item.planStartTime)),
|
||||
g: common_vendor.t(formatDate(item.planEndTime)),
|
||||
h: formatProgress(item.progress) + "%",
|
||||
i: common_vendor.t(formatProgress(item.progress)),
|
||||
j: common_vendor.t(item.totalCount ?? 0),
|
||||
k: common_vendor.t(item.pendingCount ?? 0),
|
||||
l: common_vendor.t(item.unusualNum ?? 0),
|
||||
m: common_vendor.t(item.finishedCount ?? 0),
|
||||
n: common_vendor.o(($event) => startCheck(item), item.id || item.taskDate),
|
||||
o: item.id || item.taskDate
|
||||
});
|
||||
})
|
||||
}, {
|
||||
d: !tableId.value,
|
||||
e: checkPlanData.value.length === 0,
|
||||
g: common_vendor.gei(_ctx, "")
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-52eec896"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Inspectionresult/list.js.map
|
||||
7
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/list.json
vendored
Normal file
7
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/list.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "检查列表",
|
||||
"usingComponents": {
|
||||
"u-navbar": "../../uni_modules/uview-plus/components/u-navbar/u-navbar"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/list.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/list.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{['page', 'data-v-52eec896', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{g}}"><u-navbar wx:if="{{b}}" class="data-v-52eec896" virtualHostClass="data-v-52eec896" bindleftClick="{{a}}" u-i="52eec896-0" bind:__l="__l" u-p="{{b}}"/><view class="page-content padding data-v-52eec896"><view wx:if="{{c}}" class="empty-tip text-gray text-center padding data-v-52eec896">加载中...</view><view wx:elif="{{d}}" class="empty-tip text-gray text-center padding data-v-52eec896"> 请从首页检查计划进入 </view><view wx:elif="{{e}}" class="empty-tip text-gray text-center padding data-v-52eec896"> 暂无检查任务 </view><block wx:else><view wx:for="{{f}}" wx:for-item="item" wx:key="o" class="plan-card margin-bottom data-v-52eec896"><view class="plan-header data-v-52eec896"><text class="plan-header-title data-v-52eec896">{{item.a}}</text></view><view class="plan-body data-v-52eec896"><view class="flex data-v-52eec896"><view class="border-border margin-right-xs data-v-52eec896">{{item.b}}完成</view><view class="border-border data-v-52eec896">{{item.c}}</view></view><view wx:if="{{item.d}}" class="flex text-gray margin-top data-v-52eec896"><view class="data-v-52eec896">任务日期:</view><view class="data-v-52eec896" style="color:#333333">{{item.e}}</view></view><view class="flex text-gray margin-top data-v-52eec896"><view class="data-v-52eec896">计划时间:</view><view class="data-v-52eec896" style="color:#333333">{{item.f}}至{{item.g}}</view></view><view class="flex margin-top align-center data-v-52eec896"><view class="data-v-52eec896" style="color:#B5B5B5">完成进度:</view><view class="flex align-center margin-left-sm data-v-52eec896"><view class="cu-progress round data-v-52eec896"><view class="bg-green data-v-52eec896" style="{{'width:' + item.h}}"></view></view><text class="margin-left-sm data-v-52eec896">{{item.i}}%</text></view></view><view class="plan-stats margin-top data-v-52eec896"><view class="plan-stat-item data-v-52eec896"><view class="plan-stat-num text-orange data-v-52eec896">{{item.j}}</view><view class="plan-stat-label data-v-52eec896">总检项</view></view><view class="plan-stat-item data-v-52eec896"><view class="plan-stat-num text-yellow data-v-52eec896">{{item.k}}</view><view class="plan-stat-label data-v-52eec896">待排查</view></view><view class="plan-stat-item data-v-52eec896"><view class="plan-stat-num text-red data-v-52eec896">{{item.l}}</view><view class="plan-stat-label data-v-52eec896">异常数</view></view><view class="plan-stat-item data-v-52eec896"><view class="plan-stat-num text-blue data-v-52eec896">{{item.m}}</view><view class="plan-stat-label data-v-52eec896">已完成</view></view></view><view class="margin-top margin-bottom flex justify-end data-v-52eec896"><button class="cu-btn round lg bg-blue data-v-52eec896" catchtap="{{item.n}}"> 检查处置 </button></view></view></view></block></view></view>
|
||||
105
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/list.wxss
vendored
Normal file
105
unpackage/dist/dev/mp-weixin/pages/Inspectionresult/list.wxss
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* uni.scss */
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.page.data-v-52eec896 {
|
||||
min-height: 100vh;
|
||||
background: #EBF2FC;
|
||||
}
|
||||
.empty-tip.data-v-52eec896 {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.plan-card.data-v-52eec896 {
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0rpx 2rpx 6rpx 2rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.plan-header.data-v-52eec896 {
|
||||
background: linear-gradient(135deg, #4A90E2 0%, #2667E9 100%);
|
||||
padding: 24rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.plan-header .plan-header-title.data-v-52eec896 {
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.plan-body.data-v-52eec896 {
|
||||
padding: 24rpx 30rpx 10rpx 30rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.plan-stats.data-v-52eec896 {
|
||||
display: flex;
|
||||
background: #F5F7FA;
|
||||
border-radius: 12rpx;
|
||||
border: 1rpx solid #E8ECF0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.plan-stats .plan-stat-item.data-v-52eec896 {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
border-right: 1rpx solid #E8ECF0;
|
||||
}
|
||||
.plan-stats .plan-stat-item.data-v-52eec896:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
.plan-stats .plan-stat-num.data-v-52eec896 {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.plan-stats .plan-stat-label.data-v-52eec896 {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
.cu-progress.data-v-52eec896 {
|
||||
width: 300rpx;
|
||||
height: 20rpx;
|
||||
background: #ebeef5;
|
||||
border-radius: 100rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cu-progress view.data-v-52eec896 {
|
||||
height: 100%;
|
||||
border-radius: 100rpx;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
.bg-green.data-v-52eec896 {
|
||||
background: #2667E9;
|
||||
}
|
||||
.border-border.data-v-52eec896 {
|
||||
padding: 10rpx;
|
||||
background: #EEF3FF;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #AAC5FC;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
color: #2667E9;
|
||||
}
|
||||
Reference in New Issue
Block a user