优化后,再次提交

This commit is contained in:
王利强
2026-05-03 09:08:56 +08:00
parent 721ef0ad54
commit 805747d1d9
1243 changed files with 46213 additions and 221 deletions

View File

@@ -0,0 +1,595 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const request_three_one_api_area = require("../../request/three_one_api/area.js");
const request_request = require("../../request/request.js");
if (!Array) {
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_choose2 = common_vendor.resolveComponent("up-choose");
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
(_easycom_up_upload2 + _easycom_up_input2 + _easycom_up_choose2 + _easycom_up_textarea2 + _easycom_u_popup2)();
}
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_choose = () => "../../uni_modules/uview-plus/components/u-choose/u-choose.js";
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_up_upload + _easycom_up_input + _easycom_up_choose + _easycom_up_textarea + _easycom_u_popup)();
}
const _sfc_main = {
__name: "Inspection",
setup(__props) {
const showAddPopup = common_vendor.ref(false);
const levelChooseRef = common_vendor.ref(null);
const userRole = common_vendor.ref("");
const canAcceptance = common_vendor.computed(() => {
return userRole.value === "admin" || userRole.value === "manage";
});
const getUserRole = () => {
try {
const userInfoStr = common_vendor.index.getStorageSync("userInfo");
if (userInfoStr) {
const userInfo = JSON.parse(userInfoStr);
userRole.value = userInfo.role || "";
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:211", "当前用户角色:", userRole.value);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:214", "获取用户信息失败:", error);
}
};
getUserRole();
const taskId = common_vendor.ref("");
const checkPointId = common_vendor.ref("");
const fetchTaskInfo = async (oneTableId) => {
try {
const startRes = await request_api.enterCheckPlan(oneTableId);
if (startRes.code === 0 && startRes.data) {
const tid = startRes.data.taskId;
const detailRes = await request_api.getCheckTaskDetail(tid);
if (detailRes.code === 0 && detailRes.data) {
taskId.value = detailRes.data.taskId;
checkPointId.value = detailRes.data.checkPointId;
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:239", "获取任务信息失败:", error);
}
};
common_vendor.onLoad((options) => {
if (options.id) {
fetchTaskInfo(options.id);
}
});
const formData = common_vendor.reactive({
title: "",
// 隐患标题
level: 0,
// 隐患等级索引
description: "",
// 隐患描述
tagIndex: 0,
// 隐患标签索引
source: ""
// 隐患来源
});
common_vendor.ref(0);
const lng = common_vendor.ref(0);
const lat = common_vendor.ref(0);
const selectedAddress = common_vendor.ref("");
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 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/hiddendanger/Inspection.vue:283", "获取区域列表失败:", error);
}
};
fetchAreaList();
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 chooseLocation = () => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:299", "chooseLocation called");
showAddPopup.value = false;
setTimeout(() => {
common_vendor.index.getLocation({
type: "gcj02",
// 使用国测局坐标系(腾讯地图使用)
success: (locationRes) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:308", "获取当前位置成功:", locationRes);
common_vendor.index.chooseLocation({
latitude: locationRes.latitude,
longitude: locationRes.longitude,
success: (res) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:314", "选择位置成功:", res);
selectedAddress.value = res.address + (res.name ? `(${res.name})` : "");
lng.value = res.longitude;
lat.value = res.latitude;
showAddPopup.value = true;
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:323", "选择位置失败:", err);
showAddPopup.value = true;
if (err.errMsg && err.errMsg.indexOf("cancel") === -1) {
common_vendor.index.showToast({
title: "选择位置失败",
icon: "none"
});
}
}
});
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:337", "获取当前位置失败:", err);
common_vendor.index.chooseLocation({
success: (res) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:341", "选择位置成功:", res);
selectedAddress.value = res.address + (res.name ? `(${res.name})` : "");
lng.value = res.longitude;
lat.value = res.latitude;
showAddPopup.value = true;
},
fail: (chooseErr) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:348", "选择位置失败:", chooseErr);
showAddPopup.value = true;
if (chooseErr.errMsg && chooseErr.errMsg.indexOf("cancel") === -1) {
common_vendor.index.showToast({
title: "选择位置失败",
icon: "none"
});
}
}
});
}
});
}, 300);
};
const handleAdd = async () => {
var _a;
if (!formData.title) {
common_vendor.index.showToast({
title: "请输入隐患标题",
icon: "none"
});
return;
}
if (fileList1.value.length === 0) {
common_vendor.index.showToast({
title: "请上传隐患图片/视频",
icon: "none"
});
return;
}
const attachments = fileList1.value.map((file) => {
const path = file.serverPath || "";
const fileName = path ? path.split("/").pop() : file.name || "";
return {
fileName: fileName || "",
filePath: path,
fileType: file.type || "image/png",
fileSize: file.size || 0
};
});
const selectedTag = tagOptions.value[formData.tagIndex];
const tagId = selectedTag ? selectedTag.id : null;
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:395", "innnn", sourceOptions);
const params = {
title: formData.title,
//标题
level: formData.level + 1,
// 1.轻微隐患 2.一般隐患 3.重大隐患
lng: lng.value || 0,
//经度
lat: lat.value || 0,
//纬度
address: selectedAddress.value || "",
//详细地址
areaId: selectedAreaId.value || null,
//隐患区域ID
description: formData.description || "",
//隐患描述
tagId,
//隐患标签ID
taskId: taskId.value,
//关联任务ID
checkPointId: checkPointId.value,
//关联检查点ID
source: ((_a = sourceOptions.value[formData.source]) == null ? void 0 : _a.title) || "",
//隐患来源(随手拍、企业自查、行业互查、专家诊查)
attachments
//附件列表(图片/视频)
};
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:413", "提交的参数:", params);
try {
const res = await request_api.addHiddenDanger(params);
if (res.code === 0) {
common_vendor.index.showToast({
title: "新增成功",
icon: "success"
});
showAddPopup.value = false;
formData.title = "";
formData.level = 0;
formData.description = "";
formData.tagIndex = 0;
selectedAddress.value = "";
selectedAreaId.value = "";
selectedAreaName.value = "";
fileList1.value = [];
fetchHiddenDangerList();
} else {
common_vendor.index.showToast({
title: res.msg || "新增失败",
icon: "none"
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:441", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
});
}
};
const hiddenDangerList = common_vendor.ref([]);
const fetchHiddenDangerList = async () => {
try {
const res = await request_api.getMyHiddenDangerList();
if (res.code === 0) {
hiddenDangerList.value = res.data.records;
} else {
common_vendor.index.showToast({
title: res.msg || "获取隐患列表失败",
icon: "none"
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:462", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
});
}
};
common_vendor.onShow(() => {
fetchHiddenDangerList();
});
const details = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/view?hazardId=${item.hazardId}&assignId=${item.assignId}`
});
};
const Rectification = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`
});
};
const editRectification = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/rectification?rectifyId=${item.rectifyId}&isEdit=1`
});
};
const acceptance = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/acceptance?hazardId=${item.hazardId}&assignId=${item.assignId}&rectifyId=${item.rectifyId}`
});
};
const assignHazard = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/assignment?hazardId=${item.hazardId}&assignId=${item.assignId}`
});
};
const fileList1 = common_vendor.ref([]);
const deletePic = (event) => {
fileList1.value.splice(event.index, 1);
};
const afterRead = async (event) => {
let lists = [].concat(event.file);
let fileListLen = fileList1.value.length;
lists.map((item) => {
fileList1.value.push({
...item,
status: "uploading",
message: "上传中"
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url);
let item = fileList1.value[fileListLen];
const serverPath = typeof result === "string" ? result : (result == null ? void 0 : result.url) || (result == null ? void 0 : result.path) || "";
fileList1.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
// url: baseUrl + serverPath,
url: request_request.baseUrl.replace("/prod-api", "") + serverPath,
serverPath
});
fileListLen++;
}
};
const uploadFilePromise = (filePath) => {
return new Promise((resolve, reject) => {
common_vendor.index.uploadFile({
url: request_request.baseUrl + "/frontend/attachment/upload",
filePath,
name: "file",
header: {
"Authorization": request_request.getToken()
},
success: (res) => {
const data = JSON.parse(res.data);
if (data.code === 0) {
resolve(data.data);
} else {
reject(data.msg || "上传失败");
}
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:558", "上传失败:", err);
reject(err);
}
});
});
};
const aiAnalyzing = common_vendor.ref(false);
const handleAiAnalyze = async () => {
const imageFiles = fileList1.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/hiddendanger/Inspection.vue:580", "开始调用AI分析接口图片地址:", fullImageUrl);
const analyzeRes = await request_api.analyzeHazardImage({
// imageUrl: 'https://yx.zhihuixiangxi.com:58880/1.png' ,
imageUrl: fullImageUrl
});
if (analyzeRes.code === 0 && analyzeRes.data) {
const aiData = analyzeRes.data;
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:588", "AI分析结果:", aiData);
if (aiData.title)
formData.title = aiData.title;
if (aiData.description)
formData.description = aiData.description;
if (aiData.level) {
const levelMap = { "轻微": 0, "轻微隐患": 0, "一般": 1, "一般隐患": 1, "重大": 2, "重大隐患": 2 };
const levelIndex = levelMap[aiData.level];
if (levelIndex !== void 0) {
formData.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/hiddendanger/Inspection.vue:611", "AI分析接口调用失败:", error);
common_vendor.index.showToast({ title: "AI分析失败请重试", icon: "none" });
} finally {
aiAnalyzing.value = false;
}
};
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
}));
} else {
common_vendor.index.showToast({
title: res.msg || "获取标签列表失败",
icon: "none"
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:634", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
});
}
};
fetchTagOptions();
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: "专家诊查"
}
]);
common_vendor.watch(() => formData.source, (newVal) => {
const selected = sourceOptions.value[newVal];
common_vendor.index.__f__("log", "at pages/hiddendanger/Inspection.vue:680", "隐患来源选择结果:", {
索引: newVal,
选中项: selected,
id: selected == null ? void 0 : selected.id,
title: selected == null ? void 0 : selected.title
});
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.f(hiddenDangerList.value, (item, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(item.title),
b: common_vendor.t(item.statusName),
c: common_vendor.t(item.levelName),
d: item.levelName === "轻微隐患" ? 1 : "",
e: item.levelName === "一般隐患" ? 1 : "",
f: item.levelName === "重大隐患" ? 1 : "",
g: common_vendor.t(item.address),
h: common_vendor.t(item.createdAt),
i: common_vendor.o(($event) => details(item), item.hazardId),
j: item.statusName === "待整改" && item.canEdit
}, item.statusName === "待整改" && item.canEdit ? {
k: common_vendor.o(($event) => assignHazard(item), item.hazardId)
} : {}, {
l: item.statusName === "待整改" && item.canEdit
}, item.statusName === "待整改" && item.canEdit ? {
m: common_vendor.o(($event) => Rectification(item), item.hazardId)
} : {}, {
n: item.statusName === "待验收" && item.canEdit
}, item.statusName === "待验收" && item.canEdit ? {
o: common_vendor.o(($event) => editRectification(item), item.hazardId)
} : {}, {
p: item.statusName === "待验收" && canAcceptance.value
}, item.statusName === "待验收" && canAcceptance.value ? {
q: common_vendor.o(($event) => acceptance(item), item.hazardId)
} : {}, {
r: item.statusName === "待交办"
}, item.statusName === "待交办" ? {
s: common_vendor.o(($event) => assignHazard(item), item.hazardId)
} : {}, {
t: item.hazardId
});
}),
b: common_vendor.o(($event) => showAddPopup.value = true),
c: common_vendor.o(($event) => showAddPopup.value = false),
d: common_vendor.o(afterRead),
e: common_vendor.o(deletePic),
f: common_vendor.p({
fileList: fileList1.value,
name: "1",
multiple: true,
maxCount: 10
}),
g: !aiAnalyzing.value
}, !aiAnalyzing.value ? {} : {}, {
h: common_vendor.t(aiAnalyzing.value ? "AI识别中..." : "AI 识别隐患"),
i: aiAnalyzing.value,
j: aiAnalyzing.value,
k: common_vendor.o(handleAiAnalyze),
l: common_vendor.o(($event) => formData.title = $event),
m: common_vendor.p({
placeholder: "请输入内容",
border: "surround",
modelValue: formData.title
}),
n: common_vendor.sr(levelChooseRef, "b44c631d-3,b44c631d-0", {
"k": "levelChooseRef"
}),
o: common_vendor.o(($event) => formData.level = $event),
p: common_vendor.p({
options: levelOptions.value,
wrap: false,
["item-width"]: "183rpx",
["item-height"]: "72rpx",
modelValue: formData.level
}),
q: common_vendor.o(($event) => formData.source = $event),
r: common_vendor.p({
options: sourceOptions.value,
wrap: false,
["item-width"]: "183rpx",
["item-height"]: "72rpx",
modelValue: formData.source
}),
s: common_vendor.o(($event) => selectedAddress.value = $event),
t: common_vendor.p({
placeholder: "请输入地址",
border: "surround",
modelValue: selectedAddress.value
}),
v: common_vendor.o(chooseLocation),
w: common_vendor.t(selectedAreaName.value || "请选择隐患区域"),
x: !selectedAreaName.value ? 1 : "",
y: common_vendor.o(($event) => showAreaPicker.value = true),
z: common_vendor.o(($event) => formData.description = $event),
A: common_vendor.p({
placeholder: "请输入内容",
modelValue: formData.description
}),
B: common_vendor.o(($event) => formData.tagIndex = $event),
C: common_vendor.p({
options: tagOptions.value,
modelValue: formData.tagIndex
}),
D: common_vendor.o(($event) => showAddPopup.value = false),
E: common_vendor.o(handleAdd),
F: common_vendor.o(($event) => showAddPopup.value = false),
G: common_vendor.p({
show: showAddPopup.value,
mode: "center",
round: "20"
}),
H: common_vendor.o(($event) => showAreaPicker.value = false),
I: common_vendor.o(confirmAreaSelect),
J: 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)
});
}),
K: areaList.value.length === 0
}, areaList.value.length === 0 ? {} : {}, {
L: common_vendor.o(($event) => showAreaPicker.value = false),
M: common_vendor.p({
show: showAreaPicker.value,
mode: "bottom",
round: "20"
}),
N: common_vendor.gei(_ctx, "")
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b44c631d"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/hiddendanger/Inspection.js.map

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "隐患排查",
"usingComponents": {
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload",
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input",
"up-choose": "../../uni_modules/uview-plus/components/u-choose/u-choose",
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,304 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-b44c631d {
min-height: 100vh;
background: #EBF2FC;
padding-bottom: 120rpx;
}
.fixed-add-btn.data-v-b44c631d {
position: fixed;
bottom: 40rpx;
left: 30rpx;
right: 30rpx;
height: 88rpx;
background: linear-gradient(135deg, #667eea 0%, #2668EA 100%);
border-radius: 44rpx;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 32rpx;
font-weight: 500;
box-shadow: 0 8rpx 24rpx rgba(38, 104, 234, 0.4);
z-index: 100;
}
.fixed-add-btn .cuIcon-add.data-v-b44c631d {
margin-right: 10rpx;
font-size: 36rpx;
}
.list-list.data-v-b44c631d {
background: #FFFFFF;
box-shadow: 0rpx 2rpx 6rpx 2rpx rgba(0, 0, 0, 0.08);
border-left: 5px solid #2667E9;
border-radius: 20rpx;
padding: 20rpx;
}
.level-tag.data-v-b44c631d {
padding: 4rpx 16rpx;
border-radius: 8rpx;
}
.level-minor.data-v-b44c631d {
background: #F6FFED;
border: 2rpx solid #B7EB8F;
color: #52C41A;
}
.level-normal.data-v-b44c631d {
background: #FFF7E6;
border: 2rpx solid #FFD591;
color: #FA8C16;
}
.level-major.data-v-b44c631d {
background: #FFF1F0;
border: 2rpx solid #FFA39E;
color: #F5222D;
}
.ai-btn-wrapper.data-v-b44c631d {
display: flex;
justify-content: flex-end;
}
.ai-analyze-btn.data-v-b44c631d {
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-b44c631d::after {
border: none;
}
.ai-analyze-btn .ai-btn-icon.data-v-b44c631d {
margin-right: 8rpx;
font-size: 30rpx;
}
.ai-analyze-btn[disabled].data-v-b44c631d {
opacity: 0.7;
}
.popup-content.data-v-b44c631d {
width: 600rpx;
background: #fff;
border-radius: 20rpx;
overflow: hidden;
}
.popup-header.data-v-b44c631d {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.popup-header .popup-title.data-v-b44c631d {
font-size: 32rpx;
color: #333;
}
.popup-header .popup-close.data-v-b44c631d {
font-size: 40rpx;
color: #999;
line-height: 1;
}
.popup-body.data-v-b44c631d {
padding: 30rpx;
max-height: 900rpx;
overflow-y: auto;
}
.popup-footer.data-v-b44c631d {
display: flex;
border-top: 1rpx solid #eee;
}
.popup-footer button.data-v-b44c631d {
flex: 1;
height: 90rpx;
line-height: 90rpx;
border-radius: 0;
font-size: 30rpx;
}
.popup-footer button.data-v-b44c631d::after {
border: none;
}
.popup-footer .btn-cancel.data-v-b44c631d {
background: #fff;
color: #666;
}
.popup-footer .btn-confirm.data-v-b44c631d {
color: #fff;
}
.address-box.data-v-b44c631d {
display: flex;
align-items: center;
gap: 20rpx;
}
.address-box .address-input-wrapper.data-v-b44c631d {
flex: 1;
}
.address-box .btn-address.data-v-b44c631d {
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-b44c631d::after {
border: none;
}
.select-trigger.data-v-b44c631d {
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-b44c631d {
flex: 1;
font-size: 28rpx;
color: #333;
}
.select-trigger .select-value.placeholder.data-v-b44c631d {
color: #c0c4cc;
}
.picker-popup.data-v-b44c631d {
background: #fff;
}
.picker-popup .picker-header.data-v-b44c631d {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.picker-popup .picker-header .picker-cancel.data-v-b44c631d {
font-size: 28rpx;
color: #999;
}
.picker-popup .picker-header .picker-title.data-v-b44c631d {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.picker-popup .picker-header .picker-confirm.data-v-b44c631d {
font-size: 28rpx;
color: #2667E9;
}
.picker-popup .picker-body.data-v-b44c631d {
max-height: 600rpx;
padding: 0 30rpx;
}
.picker-popup .picker-item.data-v-b44c631d {
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-b44c631d:last-child {
border-bottom: none;
}
.picker-popup .picker-item.picker-item-active.data-v-b44c631d {
color: #2667E9;
}
.area-color-dot.data-v-b44c631d {
width: 24rpx;
height: 24rpx;
border-radius: 50%;
margin-right: 16rpx;
}
.address-popup.data-v-b44c631d {
width: 600rpx;
background: #fff;
border-radius: 20rpx;
overflow: hidden;
}
.address-popup-body.data-v-b44c631d {
padding: 30rpx;
max-height: 500rpx;
}
.address-popup-body .search-box.data-v-b44c631d {
margin-bottom: 20rpx;
}
.address-popup-body .search-box .search-input.data-v-b44c631d {
width: 100%;
background: #f5f5f5;
border-radius: 8rpx;
padding: 16rpx 20rpx;
font-size: 28rpx;
}
.address-popup-body .address-list.data-v-b44c631d {
max-height: 350rpx;
overflow-y: auto;
}
.address-popup-body .address-item.data-v-b44c631d {
padding: 24rpx 20rpx;
border-bottom: 1rpx solid #eee;
font-size: 26rpx;
color: #333;
}
.address-popup-body .address-item.data-v-b44c631d:last-child {
border-bottom: none;
}
.address-popup-body .address-item.address-item-active.data-v-b44c631d {
background: #EBF2FC;
color: #2667E9;
}
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
/* 全局样式覆盖 up-tag 文字居中 */
.u-tag {
justify-content: center !important;
}

View File

@@ -0,0 +1,233 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const request_request = require("../../request/request.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
(_easycom_up_textarea2 + _easycom_up_upload2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_upload)();
}
const _sfc_main = {
__name: "acceptance",
setup(__props) {
const rectifyId = common_vendor.ref("");
const hazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const rectifyData = common_vendor.reactive({
rectifyPlan: "",
rectifyResult: ""
});
const rectifyAttachments = common_vendor.ref([]);
const formData = common_vendor.reactive({
result: 1,
// 验收结果 1.通过 2.不通过
verifyRemark: ""
// 验收备注
});
const fileList1 = common_vendor.ref([]);
const getFullPath = (filePath) => {
if (!filePath)
return "";
if (filePath.startsWith("http://") || filePath.startsWith("https://")) {
return request_request.toImageUrl(filePath);
}
return request_request.toImageUrl(filePath);
};
const previewImage = (index) => {
const urls = rectifyAttachments.value.map((item) => getFullPath(item.filePath));
common_vendor.index.previewImage({
current: index,
urls
});
};
const fetchDetail = async () => {
if (!hazardId.value || !assignId.value)
return;
try {
const res = await request_api.getHiddenDangerDetail({ hazardId: hazardId.value, assignId: assignId.value });
if (res.code === 0 && res.data) {
if (res.data.assigns && res.data.assigns.length > 0) {
const assign = res.data.assigns[0];
if (assign.rectify) {
rectifyData.rectifyPlan = assign.rectify.rectifyPlan || "";
rectifyData.rectifyResult = assign.rectify.rectifyResult || "";
if (assign.rectify.attachments) {
rectifyAttachments.value = assign.rectify.attachments;
}
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:108", "整改记录:", rectifyData);
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:109", "整改附件:", rectifyAttachments.value);
}
}
} else {
common_vendor.index.showToast({ title: res.msg || "获取详情失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:116", "获取隐患详情失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
common_vendor.onLoad((options) => {
if (options.rectifyId) {
rectifyId.value = options.rectifyId;
}
if (options.hazardId) {
hazardId.value = options.hazardId;
}
if (options.assignId) {
assignId.value = options.assignId;
}
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:131", "验收页面参数:", { rectifyId: rectifyId.value, hazardId: hazardId.value, assignId: assignId.value });
fetchDetail();
});
const handleCancel = () => {
common_vendor.index.navigateBack();
};
const handleSubmit = async () => {
if (!rectifyId.value) {
common_vendor.index.showToast({
title: "缺少整改ID",
icon: "none"
});
return;
}
const attachments = fileList1.value.map((file) => {
let url = "";
if (typeof file.url === "string") {
url = file.url;
} else if (file.url && typeof file.url === "object") {
url = file.url.url || file.url.path || "";
}
const fileName = typeof url === "string" && url ? url.split("/").pop() : file.name || "";
return {
fileName: fileName || "",
filePath: url || "",
fileType: file.type || "image/png",
fileSize: file.size || 0
};
});
const params = {
rectifyId: Number(rectifyId.value),
result: formData.result,
verifyRemark: formData.verifyRemark || "",
attachments
};
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:176", "提交验收参数:", params);
try {
const res = await request_api.acceptanceRectification(params);
if (res.code === 0) {
common_vendor.index.showToast({
title: "验收成功",
icon: "success"
});
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({
title: res.msg || "验收失败",
icon: "none"
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:195", "验收失败:", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
});
}
};
const deletePic = (event) => {
fileList1.value.splice(event.index, 1);
};
const afterRead = async (event) => {
let lists = [].concat(event.file);
let fileListLen = fileList1.value.length;
lists.map((item) => {
fileList1.value.push({
...item,
status: "uploading",
message: "上传中"
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url);
let item = fileList1.value[fileListLen];
fileList1.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
url: result
});
fileListLen++;
}
};
const uploadFilePromise = (filePath) => {
return new Promise((resolve, reject) => {
common_vendor.index.uploadFile({
url: request_request.baseUrl + "/frontend/attachment/upload",
filePath,
name: "file",
header: {
"Authorization": request_request.getToken()
},
success: (res) => {
const data = JSON.parse(res.data);
if (data.code === 0) {
resolve(data.data);
} else {
reject(data.msg || "上传失败");
}
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:250", "上传失败:", err);
reject(err);
}
});
});
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t(rectifyData.rectifyPlan || "暂无"),
b: common_vendor.t(rectifyData.rectifyResult || "暂无"),
c: rectifyAttachments.value.length > 0
}, rectifyAttachments.value.length > 0 ? {
d: common_vendor.f(rectifyAttachments.value, (img, idx, i0) => {
return {
a: idx,
b: getFullPath(img.filePath),
c: common_vendor.o(($event) => previewImage(idx), idx)
};
})
} : {}, {
e: common_vendor.n(formData.result === 1 ? "active" : ""),
f: common_vendor.o(($event) => formData.result = 1),
g: common_vendor.n(formData.result === 2 ? "active" : ""),
h: common_vendor.o(($event) => formData.result = 2),
i: common_vendor.o(($event) => formData.verifyRemark = $event),
j: common_vendor.p({
placeholder: "请输入验收备注",
modelValue: formData.verifyRemark
}),
k: common_vendor.o(afterRead),
l: common_vendor.o(deletePic),
m: common_vendor.p({
fileList: fileList1.value,
name: "1",
multiple: true,
maxCount: 10
}),
n: common_vendor.o(handleCancel),
o: common_vendor.o(handleSubmit),
p: common_vendor.gei(_ctx, "")
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-39f9b795"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/hiddendanger/acceptance.js.map

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "隐患验收",
"usingComponents": {
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload"
}
}

View File

@@ -0,0 +1 @@
<view class="{{['page', 'padding', 'data-v-39f9b795', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{p}}"><view class="padding bg-white radius data-v-39f9b795"><view class="text-gray margin-bottom data-v-39f9b795">整改记录</view><view class="padding solid radius data-v-39f9b795"><view class="flex data-v-39f9b795"><view class="data-v-39f9b795">整改方案:</view><view class="data-v-39f9b795">{{a}}</view></view><view class="flex margin-top-sm data-v-39f9b795"><view class="data-v-39f9b795">完成情况:</view><view class="data-v-39f9b795">{{b}}</view></view><view class="margin-top-sm data-v-39f9b795"><view class="data-v-39f9b795">整改附件:</view><view wx:if="{{c}}" class="flex margin-top-xs data-v-39f9b795" style="flex-wrap:wrap;gap:10rpx"><image wx:for="{{d}}" wx:for-item="img" wx:key="a" class="data-v-39f9b795" src="{{img.b}}" style="width:136rpx;height:136rpx;border-radius:16rpx" mode="aspectFill" bindtap="{{img.c}}"></image></view><view wx:else class="text-gray text-sm margin-top-xs data-v-39f9b795">暂无附件</view></view></view><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收结果</view><view class="text-red data-v-39f9b795">*</view></view><view class="flex data-v-39f9b795" style="gap:20rpx"><button class="{{['data-v-39f9b795', 'result-btn', e]}}" bindtap="{{f}}">通过</button><button class="{{['data-v-39f9b795', 'result-btn', g]}}" bindtap="{{h}}">不通过</button></view><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收备注</view></view><up-textarea wx:if="{{j}}" class="data-v-39f9b795" virtualHostClass="data-v-39f9b795" u-i="39f9b795-0" bind:__l="__l" bindupdateModelValue="{{i}}" u-p="{{j}}"></up-textarea><view class="flex margin-bottom margin-top data-v-39f9b795"><view class="text-gray data-v-39f9b795">验收图片/视频</view></view><up-upload wx:if="{{m}}" class="data-v-39f9b795" virtualHostClass="data-v-39f9b795" bindafterRead="{{k}}" binddelete="{{l}}" u-i="39f9b795-1" bind:__l="__l" u-p="{{m}}"></up-upload><view class="flex margin-top-xl data-v-39f9b795" style="gap:20rpx"><button class="round flex-sub data-v-39f9b795" bindtap="{{n}}">取消</button><button class="bg-blue round flex-sub data-v-39f9b795" bindtap="{{o}}">提交验收</button></view></view></view>

View File

@@ -0,0 +1,46 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-39f9b795 {
min-height: 100vh;
background: #EBF2FC;
}
.result-btn.data-v-39f9b795 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
background: #f5f5f5;
color: #666;
font-size: 28rpx;
}
.result-btn.data-v-39f9b795::after {
border: none;
}
.result-btn.active.data-v-39f9b795 {
background: #2667E9;
color: #fff;
}

View File

@@ -0,0 +1,151 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
if (!Array) {
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
const _easycom_up_datetime_picker2 = common_vendor.resolveComponent("up-datetime-picker");
(_easycom_up_picker2 + _easycom_up_datetime_picker2)();
}
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
const _easycom_up_datetime_picker = () => "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
if (!Math) {
(_easycom_up_picker + _easycom_up_datetime_picker)();
}
const _sfc_main = {
__name: "assignment",
setup(__props) {
const hazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const showUserPicker = common_vendor.ref(false);
const selectedUser = common_vendor.ref("");
const selectedUserId = common_vendor.ref("");
const userColumns = common_vendor.ref([["暂无数据"]]);
const userList = common_vendor.ref([]);
const showDatePicker = common_vendor.ref(false);
const dateValue = common_vendor.ref(Date.now());
const selectedDate = common_vendor.ref("");
const fetchDeptUsers = async () => {
try {
const res = await request_api.getDepartmentPersonUsers();
if (res.code === 0 && res.data) {
const users = [];
res.data.forEach((dept) => {
if (dept.users && dept.users.length > 0) {
dept.users.forEach((user) => {
users.push({
id: String(user.userId),
name: `${user.nickName}${dept.deptName}`
});
});
}
});
userList.value = users;
userColumns.value = [users.map((u) => u.name)];
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:83", "整改人员列表:", users);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:86", "获取部门人员失败:", error);
}
};
const onUserConfirm = (e) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:92", "选择的人员:", e);
if (e.value && e.value.length > 0) {
selectedUser.value = e.value[0];
const user = userList.value.find((u) => u.name === e.value[0]);
if (user) {
selectedUserId.value = user.id;
}
}
showUserPicker.value = false;
};
const onDateConfirm = (e) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:106", "选择的日期时间:", e);
const date = new Date(e.value);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
selectedDate.value = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
showDatePicker.value = false;
};
const handleCancel = () => {
common_vendor.index.navigateBack();
};
const handleSubmit = async () => {
if (!selectedUserId.value) {
common_vendor.index.showToast({ title: "请选择整改人员", icon: "none" });
return;
}
if (!selectedDate.value) {
common_vendor.index.showToast({ title: "请选择整改期限", icon: "none" });
return;
}
const params = {
hazardId: Number(hazardId.value),
// 隐患ID
assigneeId: Number(selectedUserId.value),
// 被指派人ID
deadline: selectedDate.value,
// 处理期限
assignRemark: ""
// 交办备注(可选)
};
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:142", "提交数据:", params);
try {
const res = await request_api.assignHiddenDanger(params);
if (res.code === 0) {
common_vendor.index.showToast({ title: "交办成功", icon: "success" });
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({ title: res.msg || "交办失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:155", "交办失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
common_vendor.onLoad((options) => {
if (options.hazardId)
hazardId.value = options.hazardId;
if (options.assignId)
assignId.value = options.assignId;
fetchDeptUsers();
});
return (_ctx, _cache) => {
return {
a: common_vendor.t(selectedUser.value || "请选择整改人员"),
b: common_vendor.n(selectedUser.value ? "" : "text-gray"),
c: common_vendor.o(($event) => showUserPicker.value = true),
d: common_vendor.o(onUserConfirm),
e: common_vendor.o(($event) => showUserPicker.value = false),
f: common_vendor.o(($event) => showUserPicker.value = false),
g: common_vendor.p({
show: showUserPicker.value,
columns: userColumns.value
}),
h: common_vendor.t(selectedDate.value || "请选择整改期限"),
i: common_vendor.n(selectedDate.value ? "" : "text-gray"),
j: common_vendor.o(($event) => showDatePicker.value = true),
k: common_vendor.o(onDateConfirm),
l: common_vendor.o(($event) => showDatePicker.value = false),
m: common_vendor.o(($event) => showDatePicker.value = false),
n: common_vendor.o(($event) => dateValue.value = $event),
o: common_vendor.p({
show: showDatePicker.value,
mode: "datetime",
modelValue: dateValue.value
}),
p: common_vendor.o(handleCancel),
q: common_vendor.o(handleSubmit),
r: common_vendor.gei(_ctx, "")
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6209e844"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/hiddendanger/assignment.js.map

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "隐患交办",
"usingComponents": {
"up-picker": "../../uni_modules/uview-plus/components/u-picker/u-picker",
"up-datetime-picker": "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker"
}
}

View File

@@ -0,0 +1 @@
<view class="{{['padding', 'page', 'data-v-6209e844', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{r}}"><view class="padding radius bg-white data-v-6209e844"><view class="flex margin-bottom data-v-6209e844"><view class="text-gray data-v-6209e844">整改人员</view><view class="text-red data-v-6209e844">*</view></view><view class="picker-input data-v-6209e844" bindtap="{{c}}"><text class="{{['data-v-6209e844', b]}}">{{a}}</text></view><up-picker wx:if="{{g}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" bindconfirm="{{d}}" bindcancel="{{e}}" bindclose="{{f}}" u-i="6209e844-0" bind:__l="__l" u-p="{{g}}"></up-picker><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">整改期限</view><view class="text-red data-v-6209e844">*</view></view><view class="picker-input data-v-6209e844" bindtap="{{j}}"><text class="{{['data-v-6209e844', i]}}">{{h}}</text></view><up-datetime-picker wx:if="{{o}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" bindconfirm="{{k}}" bindcancel="{{l}}" bindclose="{{m}}" u-i="6209e844-1" bind:__l="__l" bindupdateModelValue="{{n}}" u-p="{{o}}"></up-datetime-picker><view class="btn-group margin-top-xl data-v-6209e844"><button class="btn-cancel data-v-6209e844" bindtap="{{p}}">取消</button><button class="btn-confirm bg-blue data-v-6209e844" bindtap="{{q}}">确认</button></view></view></view>

View File

@@ -0,0 +1,63 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-6209e844 {
min-height: 100vh;
background: #EBF2FC;
}
.picker-input.data-v-6209e844 {
background: #fff;
border-radius: 8rpx;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
border: 1rpx solid #F6F6F6;
}
.picker-input text.data-v-6209e844 {
font-size: 28rpx;
color: #333;
}
.btn-group.data-v-6209e844 {
display: flex;
gap: 30rpx;
}
.btn-cancel.data-v-6209e844 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border: 2rpx solid #2667E9;
border-radius: 40rpx;
background: #fff;
color: #2667E9;
font-size: 30rpx;
}
.btn-confirm.data-v-6209e844 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
color: #fff;
font-size: 30rpx;
}

View File

@@ -0,0 +1,390 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const request_request = require("../../request/request.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_datetime_picker2 = common_vendor.resolveComponent("up-datetime-picker");
const _easycom_up_checkbox2 = common_vendor.resolveComponent("up-checkbox");
const _easycom_up_checkbox_group2 = common_vendor.resolveComponent("up-checkbox-group");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
(_easycom_up_textarea2 + _easycom_up_input2 + _easycom_up_datetime_picker2 + _easycom_up_checkbox2 + _easycom_up_checkbox_group2 + _easycom_u_popup2 + _easycom_up_upload2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_datetime_picker = () => "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
const _easycom_up_checkbox = () => "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox.js";
const _easycom_up_checkbox_group = () => "../../uni_modules/uview-plus/components/u-checkbox-group/u-checkbox-group.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_input + _easycom_up_datetime_picker + _easycom_up_checkbox + _easycom_up_checkbox_group + _easycom_u_popup + _easycom_up_upload)();
}
const _sfc_main = {
__name: "rectification",
setup(__props) {
const hazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const rectifyId = common_vendor.ref("");
const isEdit = common_vendor.ref(false);
const formData = common_vendor.reactive({
rectifyPlan: "",
// 整改方案
rectifyResult: "",
// 整改完成情况
planCost: "",
// 投资资金(计划)
actualCost: ""
// 投资资金(实际)
});
const show = common_vendor.ref(false);
const value1 = common_vendor.ref(Date.now());
common_vendor.ref("");
const cateList = common_vendor.ref([]);
const showUserPopup = common_vendor.ref(false);
const selectedUserIds = common_vendor.ref([]);
const selectedUsers = common_vendor.ref([]);
const selectedUsersText = common_vendor.computed(() => {
if (selectedUsers.value.length === 0)
return "";
if (selectedUsers.value.length <= 2) {
return selectedUsers.value.map((u) => u.name).join("、");
}
return `${selectedUsers.value[0].name}${selectedUsers.value.length}`;
});
const onUserChange = (ids) => {
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:125", "选中的ID:", ids);
};
const confirmUserSelect = () => {
selectedUsers.value = cateList.value.filter((item) => selectedUserIds.value.includes(item.id));
showUserPopup.value = false;
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:133", "选中的整改人员:", selectedUsers.value);
};
const fetchDeptUsers = async () => {
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:138", "当前hazardId:", hazardId.value);
try {
const res = await request_api.getDeptUsersWithSubordinates({ hazardId: hazardId.value });
if (res.code === 0 && res.data) {
const userList = [];
res.data.forEach((dept) => {
if (dept.users && dept.users.length > 0) {
dept.users.forEach((user) => {
userList.push({
id: String(user.userId),
name: `${user.nickName}${dept.deptName}`
});
});
}
});
cateList.value = userList;
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:156", "整改人员列表:", cateList.value);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:159", "获取部门人员失败:", error);
}
};
const fileList1 = common_vendor.ref([]);
const deletePic = (event) => {
fileList1.value.splice(event.index, 1);
};
const afterRead = async (event) => {
let lists = [].concat(event.file);
let fileListLen = fileList1.value.length;
lists.map((item) => {
fileList1.value.push({
...item,
status: "uploading",
message: "上传中"
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url);
let item = fileList1.value[fileListLen];
fileList1.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
url: result
});
fileListLen++;
}
};
const uploadFilePromise = (filePath) => {
return new Promise((resolve, reject) => {
common_vendor.index.uploadFile({
url: request_request.baseUrl + "/frontend/attachment/upload",
filePath,
name: "file",
header: {
"Authorization": request_request.getToken()
},
success: (res) => {
const data = JSON.parse(res.data);
if (data.code === 0) {
resolve(data.data);
} else {
reject(data.msg || "上传失败");
}
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:214", "上传失败:", err);
reject(err);
}
});
});
};
const handleSubmit = async () => {
if (!formData.rectifyPlan) {
common_vendor.index.showToast({
title: "请输入整改方案",
icon: "none"
});
return;
}
if (!formData.rectifyResult) {
common_vendor.index.showToast({
title: "请输入整改完成情况",
icon: "none"
});
return;
}
if (selectedUsers.value.length === 0) {
common_vendor.index.showToast({
title: "请选择整改人员",
icon: "none"
});
return;
}
const attachments = fileList1.value.map((file) => {
let url = "";
if (typeof file.url === "string") {
url = file.url;
} else if (file.url && typeof file.url === "object") {
url = file.url.url || file.url.path || "";
}
const fileName = typeof url === "string" && url ? url.split("/").pop() : file.name || "";
return {
fileName: fileName || "",
filePath: url || "",
fileType: file.type || "image/png",
fileSize: file.size || 0
};
});
const params = {
hazardId: hazardId.value,
assignId: assignId.value,
rectifyPlan: formData.rectifyPlan,
rectifyResult: formData.rectifyResult,
planCost: Number(formData.planCost) || 0,
actualCost: Number(formData.actualCost) || 0,
attachments,
// 整改人员ID数组
rectifyUserIds: selectedUserIds.value.map((id) => Number(id))
};
if (rectifyId.value) {
params.rectifyId = rectifyId.value;
}
try {
const res = await request_api.submitRectification(params);
if (res.code === 0) {
common_vendor.index.showToast({
title: isEdit.value ? "保存成功" : "提交成功",
icon: "success"
});
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({
title: res.msg || (isEdit.value ? "保存失败" : "提交失败"),
icon: "none"
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:296", "提交整改失败:", error);
common_vendor.index.showToast({
title: "操作失败",
icon: "none"
});
}
};
const fetchRectifyDetail = async () => {
try {
common_vendor.index.showLoading({ title: "加载中..." });
const res = await request_api.getRectifyDetail({ rectifyId: rectifyId.value });
common_vendor.index.hideLoading();
if (res.code === 0 && res.data) {
const data = res.data;
formData.rectifyPlan = data.rectifyPlan || "";
formData.rectifyResult = data.rectifyResult || "";
formData.planCost = data.planCost ? String(data.planCost) : "";
formData.actualCost = data.actualCost ? String(data.actualCost) : "";
hazardId.value = data.hazardId || "";
assignId.value = data.assignId || "";
if (data.attachments && data.attachments.length > 0) {
fileList1.value = data.attachments.map((att) => ({
url: att.filePath.startsWith("http") ? att.filePath : request_request.baseUrl.replace("/api", "") + att.filePath,
status: "success",
message: "",
name: att.fileName,
type: att.fileType,
filePath: att.filePath
// 保存原始路径用于提交
}));
}
if (data.memberIds) {
const memberIdArr = data.memberIds.split(",").map((id) => String(id.trim()));
selectedUserIds.value = memberIdArr;
setTimeout(() => {
selectedUsers.value = cateList.value.filter((item) => memberIdArr.includes(item.id));
}, 500);
} else if (data.rectifierId) {
selectedUserIds.value = [String(data.rectifierId)];
setTimeout(() => {
selectedUsers.value = cateList.value.filter((item) => item.id === String(data.rectifierId));
}, 500);
}
common_vendor.index.setNavigationBarTitle({ title: "编辑整改信息" });
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:356", "获取整改详情失败:", error);
common_vendor.index.showToast({ title: "获取详情失败", icon: "none" });
}
};
const aiGenerating = common_vendor.ref(false);
const handleAiGenerate = async () => {
if (!hazardId.value) {
common_vendor.index.showToast({ title: "缺少隐患信息", icon: "none" });
return;
}
aiGenerating.value = true;
try {
const detailRes = await request_api.getHiddenDangerDetail({
hazardId: hazardId.value,
assignId: assignId.value
});
if (detailRes.code !== 0 || !detailRes.data) {
common_vendor.index.showToast({ title: "获取隐患详情失败", icon: "none" });
return;
}
const { title, description } = detailRes.data;
const aiRes = await request_api.generateRectifyPlan({ title, description });
if (aiRes.code === 0 && aiRes.data) {
if (aiRes.data.rawResponse) {
formData.rectifyPlan = aiRes.data.rawResponse;
}
common_vendor.index.showToast({ title: "AI生成完成", icon: "success", duration: 2e3 });
} else {
common_vendor.index.showToast({ title: aiRes.msg || "AI生成失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:393", "AI生成整改方案失败:", error);
common_vendor.index.showToast({ title: "AI生成失败请重试", icon: "none" });
} finally {
aiGenerating.value = false;
}
};
common_vendor.onLoad((options) => {
if (options.hazardId) {
hazardId.value = options.hazardId;
}
if (options.assignId) {
assignId.value = options.assignId;
}
fetchDeptUsers();
if (options.rectifyId) {
rectifyId.value = options.rectifyId;
isEdit.value = options.isEdit === "1";
fetchRectifyDetail();
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: !aiGenerating.value
}, !aiGenerating.value ? {} : {}, {
b: common_vendor.t(aiGenerating.value ? "AI生成中..." : "AI生成整改方案"),
c: aiGenerating.value,
d: aiGenerating.value,
e: common_vendor.o(handleAiGenerate),
f: common_vendor.o(($event) => formData.rectifyPlan = $event),
g: common_vendor.p({
placeholder: "请输入内容",
maxlength: -1,
autoHeight: true,
modelValue: formData.rectifyPlan
}),
h: common_vendor.o(($event) => formData.rectifyResult = $event),
i: common_vendor.p({
placeholder: "请输入内容",
modelValue: formData.rectifyResult
}),
j: common_vendor.o(($event) => formData.planCost = $event),
k: common_vendor.p({
placeholder: "请输入内容",
type: "number",
modelValue: formData.planCost
}),
l: common_vendor.o(($event) => formData.actualCost = $event),
m: common_vendor.p({
placeholder: "请输入内容",
type: "number",
modelValue: formData.actualCost
}),
n: common_vendor.o(($event) => value1.value = $event),
o: common_vendor.p({
hasInput: true,
show: show.value,
mode: "date",
modelValue: value1.value
}),
p: common_vendor.t(selectedUsers.value.length > 0 ? selectedUsersText.value : "请选择整改人员(可多选)"),
q: selectedUsers.value.length === 0 ? 1 : "",
r: common_vendor.o(($event) => showUserPopup.value = true),
s: common_vendor.o(($event) => showUserPopup.value = false),
t: common_vendor.f(cateList.value, (item, k0, i0) => {
return {
a: "f18ba0ce-7-" + i0 + ",f18ba0ce-6",
b: common_vendor.p({
label: item.name,
name: item.id,
activeColor: "#2667E9",
shape: "square"
}),
c: item.id
};
}),
v: common_vendor.o(onUserChange),
w: common_vendor.o(($event) => selectedUserIds.value = $event),
x: common_vendor.p({
placement: "column",
modelValue: selectedUserIds.value
}),
y: common_vendor.o(($event) => showUserPopup.value = false),
z: common_vendor.o(confirmUserSelect),
A: common_vendor.o(($event) => showUserPopup.value = false),
B: common_vendor.p({
show: showUserPopup.value,
mode: "bottom",
round: "20"
}),
C: common_vendor.o(afterRead),
D: common_vendor.o(deletePic),
E: common_vendor.p({
fileList: fileList1.value,
name: "1",
multiple: true,
maxCount: 10
}),
F: common_vendor.t(isEdit.value ? "保存修改" : "提交整改"),
G: common_vendor.o(handleSubmit),
H: common_vendor.gei(_ctx, "")
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f18ba0ce"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/hiddendanger/rectification.js.map

View File

@@ -0,0 +1,12 @@
{
"navigationBarTitleText": "隐患整改",
"usingComponents": {
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input",
"up-datetime-picker": "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker",
"up-checkbox": "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox",
"up-checkbox-group": "../../uni_modules/uview-plus/components/u-checkbox-group/u-checkbox-group",
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup",
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload"
}
}

View File

@@ -0,0 +1 @@
<view class="{{['page', 'padding', 'data-v-f18ba0ce', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{H}}"><view class="padding bg-white radius data-v-f18ba0ce"><view class="form-header margin-bottom data-v-f18ba0ce"><view class="form-label data-v-f18ba0ce"><view class="text-gray data-v-f18ba0ce">整改方案</view><view class="text-red data-v-f18ba0ce">*</view></view><button class="ai-rectify-btn data-v-f18ba0ce" loading="{{c}}" disabled="{{d}}" bindtap="{{e}}"><text wx:if="{{a}}" class="cuIcon-magic ai-btn-icon data-v-f18ba0ce"></text> {{b}}</button></view><up-textarea wx:if="{{g}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" u-i="f18ba0ce-0" bind:__l="__l" bindupdateModelValue="{{f}}" u-p="{{g}}"></up-textarea><view class="form-label margin-bottom margin-top data-v-f18ba0ce"><view class="text-gray data-v-f18ba0ce">整改完成情况</view><view class="text-red data-v-f18ba0ce">*</view></view><up-textarea wx:if="{{i}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" u-i="f18ba0ce-1" bind:__l="__l" bindupdateModelValue="{{h}}" u-p="{{i}}"></up-textarea><view class="form-label margin-bottom margin-top data-v-f18ba0ce"><view class="text-gray data-v-f18ba0ce">投资资金(计划)</view><view class="text-red data-v-f18ba0ce">*</view></view><up-input wx:if="{{k}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" u-i="f18ba0ce-2" bind:__l="__l" bindupdateModelValue="{{j}}" u-p="{{k}}"></up-input><view class="form-label margin-bottom margin-top data-v-f18ba0ce"><view class="text-gray data-v-f18ba0ce">投资资金(实际)</view><view class="text-red data-v-f18ba0ce">*</view></view><up-input wx:if="{{m}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" u-i="f18ba0ce-3" bind:__l="__l" bindupdateModelValue="{{l}}" u-p="{{m}}"></up-input><view class="form-label margin-bottom margin-top data-v-f18ba0ce"><view class="text-gray data-v-f18ba0ce">限定整改时间</view><view class="text-red data-v-f18ba0ce">*</view></view><up-datetime-picker wx:if="{{o}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" u-i="f18ba0ce-4" bind:__l="__l" bindupdateModelValue="{{n}}" u-p="{{o}}"></up-datetime-picker><view class="form-label margin-bottom margin-top data-v-f18ba0ce"><view class="text-gray data-v-f18ba0ce">整改人员</view><view class="text-red data-v-f18ba0ce">*</view></view><view class="select-trigger data-v-f18ba0ce" bindtap="{{r}}"><view class="{{['select-content', 'data-v-f18ba0ce', q && 'text-gray']}}">{{p}}</view><text class="cuIcon-unfold data-v-f18ba0ce"></text></view><u-popup wx:if="{{B}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" u-s="{{['d']}}" bindclose="{{A}}" u-i="f18ba0ce-5" bind:__l="__l" u-p="{{B}}"><view class="user-popup data-v-f18ba0ce"><view class="popup-header data-v-f18ba0ce"><view class="popup-title text-bold data-v-f18ba0ce">选择整改人员</view><view class="popup-close data-v-f18ba0ce" bindtap="{{s}}">×</view></view><view class="popup-body data-v-f18ba0ce"><up-checkbox-group wx:if="{{x}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" u-s="{{['d']}}" bindchange="{{v}}" u-i="f18ba0ce-6,f18ba0ce-5" bind:__l="__l" bindupdateModelValue="{{w}}" u-p="{{x}}"><view wx:for="{{t}}" wx:for-item="item" wx:key="c" class="user-item data-v-f18ba0ce"><up-checkbox wx:if="{{item.b}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-checkbox></view></up-checkbox-group></view><view class="popup-footer data-v-f18ba0ce"><button class="btn-cancel data-v-f18ba0ce" bindtap="{{y}}">取消</button><button class="btn-confirm bg-blue data-v-f18ba0ce" bindtap="{{z}}">确定</button></view></view></u-popup><view class="form-label margin-bottom margin-top data-v-f18ba0ce"><view class="text-gray data-v-f18ba0ce">整改图片/视频</view><view class="text-red data-v-f18ba0ce">*</view></view><up-upload wx:if="{{E}}" class="data-v-f18ba0ce" virtualHostClass="data-v-f18ba0ce" bindafterRead="{{C}}" binddelete="{{D}}" u-i="f18ba0ce-8" bind:__l="__l" u-p="{{E}}"></up-upload><button class="bg-blue round margin-top-xl data-v-f18ba0ce" bindtap="{{G}}">{{F}}</button></view></view>

View File

@@ -0,0 +1,147 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-f18ba0ce {
min-height: 100vh;
background: #EBF2FC;
}
.ai-rectify-btn.data-v-f18ba0ce {
display: flex;
align-items: center;
justify-content: center;
height: 60rpx;
padding: 0 24rpx;
margin: 0;
font-size: 24rpx;
color: #fff;
background: linear-gradient(135deg, #4facfe 0%, #2668EA 100%);
border-radius: 30rpx;
border: none;
white-space: nowrap;
flex-shrink: 0;
}
.ai-rectify-btn.data-v-f18ba0ce::after {
border: none;
}
.ai-rectify-btn .ai-btn-icon.data-v-f18ba0ce {
margin-right: 6rpx;
font-size: 26rpx;
}
.ai-rectify-btn[disabled].data-v-f18ba0ce {
opacity: 0.7;
}
.form-header.data-v-f18ba0ce {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.form-label.data-v-f18ba0ce {
display: flex;
align-items: center;
}
.form-label .text-red.data-v-f18ba0ce {
margin-left: 4rpx;
line-height: 1;
}
.date-input.data-v-f18ba0ce {
background: #fff;
border-radius: 8rpx;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
border: 1rpx solid #F6F6F6;
}
.date-input text.data-v-f18ba0ce {
font-size: 28rpx;
color: #333;
}
.select-trigger.data-v-f18ba0ce {
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
}
.select-trigger .select-content.data-v-f18ba0ce {
flex: 1;
font-size: 28rpx;
color: #333;
}
.user-popup.data-v-f18ba0ce {
background: #fff;
}
.user-popup .popup-header.data-v-f18ba0ce {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.user-popup .popup-header .popup-title.data-v-f18ba0ce {
font-size: 32rpx;
color: #333;
}
.user-popup .popup-header .popup-close.data-v-f18ba0ce {
font-size: 40rpx;
color: #999;
line-height: 1;
}
.user-popup .popup-body.data-v-f18ba0ce {
padding: 20rpx 30rpx;
max-height: 600rpx;
overflow-y: auto;
}
.user-popup .user-item.data-v-f18ba0ce {
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.user-popup .user-item.data-v-f18ba0ce:last-child {
border-bottom: none;
}
.user-popup .popup-footer.data-v-f18ba0ce {
display: flex;
border-top: 1rpx solid #eee;
}
.user-popup .popup-footer button.data-v-f18ba0ce {
flex: 1;
height: 90rpx;
line-height: 90rpx;
border-radius: 0;
font-size: 30rpx;
}
.user-popup .popup-footer button.data-v-f18ba0ce::after {
border: none;
}
.user-popup .popup-footer .btn-cancel.data-v-f18ba0ce {
background: #fff;
color: #666;
}
.user-popup .popup-footer .btn-confirm.data-v-f18ba0ce {
color: #fff;
}

View File

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

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "查看隐患",
"usingComponents": {
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input",
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea"
}
}

View File

@@ -0,0 +1 @@
<view class="{{['padding', 'page', 'data-v-4d631e68', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{o}}"><view class="padding bg-white radius data-v-4d631e68"><view class="flex data-v-4d631e68"><view class="text-gray data-v-4d631e68">隐患图片/视频</view><view class="text-red data-v-4d631e68">*</view></view><view class="margin-bottom data-v-4d631e68"><view wx:if="{{a}}" class="margin-top data-v-4d631e68"><view class="flex data-v-4d631e68" style="flex-wrap:wrap;gap:10rpx"><image wx:for="{{b}}" wx:for-item="img" wx:key="a" class="data-v-4d631e68" src="{{img.b}}" style="width:136rpx;height:136rpx;border-radius:16rpx" mode="aspectFill" bindtap="{{img.c}}"></image></view></view><view wx:else class="text-gray text-sm data-v-4d631e68">暂无图片</view><view class="text-gray text-sm margin-top-xs data-v-4d631e68">必填:请上传现场照片或者视频作为隐患证据</view></view><view class="flex margin-bottom data-v-4d631e68"><view class="text-gray data-v-4d631e68">隐患标题</view><view class="text-red data-v-4d631e68">*</view></view><up-input wx:if="{{d}}" class="data-v-4d631e68" virtualHostClass="data-v-4d631e68" u-i="4d631e68-0" bind:__l="__l" bindupdateModelValue="{{c}}" u-p="{{d}}"/><view class="margin-bottom text-gray text-sm margin-top-xs data-v-4d631e68">请用简洁的语言概括隐患要点</view><view class="flex margin-bottom data-v-4d631e68"><view class="text-gray data-v-4d631e68">隐患等级</view><view class="text-red data-v-4d631e68">*</view></view><view class="flex col-3 data-v-4d631e68" style="gap:10rpx"><view class="{{['data-v-4d631e68', e]}}" style="padding:16rpx 40rpx">轻微隐患</view><view class="{{['data-v-4d631e68', f]}}" style="padding:16rpx 40rpx">一般隐患</view><view class="{{['data-v-4d631e68', g]}}" style="padding:16rpx 40rpx">重大隐患</view></view><view class="text-gray text-sm margin-top-xs margin-bottom data-v-4d631e68">请用隐患可能造成的危害程度选择等级</view><view class="flex data-v-4d631e68"><view class="text-gray data-v-4d631e68">隐患位置</view><view class="text-red data-v-4d631e68">*</view></view><view class="address-box margin-top-sm margin-bottom-sm data-v-4d631e68"><input class="address-input data-v-4d631e68" placeholder="暂无地址" disabled value="{{h}}" bindinput="{{i}}"/><button class="address-btn bg-blue data-v-4d631e68">选择地址</button></view><view class="text-gray text-sm data-v-4d631e68">如办公楼3层东侧消防通道生产车间A区设备旁等或点击"选择地址"按钮在地图上选择</view><view class="text-gray margin-top margin-bottom data-v-4d631e68">隐患区域</view><view class="bg-gray padding radius data-v-4d631e68">{{j}}</view><view class="flex margin-bottom margin-top data-v-4d631e68"><view class="text-gray data-v-4d631e68">隐患描述</view><view class="text-red data-v-4d631e68">*</view></view><up-textarea wx:if="{{l}}" class="data-v-4d631e68" virtualHostClass="data-v-4d631e68" u-i="4d631e68-1" bind:__l="__l" bindupdateModelValue="{{k}}" u-p="{{l}}"></up-textarea><view class="text-gray text-sm margin-top-xs margin-bottom data-v-4d631e68">请详细说明隐患现状、潜在风险及影响范围</view><view class="text-gray margin-bottom data-v-4d631e68">隐患来源</view><view class="bg-gray padding radius data-v-4d631e68">{{m}}</view><view class="text-gray margin-top margin-bottom data-v-4d631e68">创建时间</view><view class="bg-gray padding radius data-v-4d631e68">{{n}}</view></view></view>

View File

@@ -0,0 +1,53 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-4d631e68 {
min-height: 100vh;
background: #EBF2FC;
}
.address-box.data-v-4d631e68 {
display: flex;
align-items: center;
gap: 20rpx;
}
.address-input.data-v-4d631e68 {
flex: 1;
height: 80rpx;
background: #F6F6F6;
border-radius: 12rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: #333;
}
.address-btn.data-v-4d631e68 {
flex-shrink: 0;
height: 80rpx;
line-height: 80rpx;
padding: 0 32rpx;
border-radius: 12rpx;
font-size: 28rpx;
color: #fff;
}