基本功能都已完成

This commit is contained in:
王利强
2026-02-08 09:30:43 +08:00
parent 1ad538f351
commit 721ef0ad54
494 changed files with 6837 additions and 42302 deletions

View File

@@ -25,18 +25,27 @@
<view class="flex justify-end" style="gap: 10rpx;">
<!-- 所有状态都显示查看详情 -->
<button class="round cu-btn lg light bg-blue" @click="details(item)">查看详情</button>
<!-- 待整改待验收显示立即整改 -->
<button v-if="item.statusName === '待整改' || item.statusName === '待验收'"
class="round cu-btn lg light bg-blue" @click="Rectification(item)">立即整改</button>
<!-- 待验收显示立即验收 -->
<button v-if="item.statusName === '待验收'"
<!-- 待整改状态canEdit为true时显示隐患交办和立即整改为false时不显示 -->
<button v-if="item.statusName === '待整改' && item.canEdit"
class="round cu-btn lg light bg-blue" @click="assignHazard(item)">隐患交办</button>
<button v-if="item.statusName === '待整改' && item.canEdit"
class="round cu-btn lg bg-blue" @click="Rectification(item)">立即整改</button>
<!-- 待验收显示编辑整改信息和立即验收 -->
<button v-if="item.statusName === '待验收' && item.canEdit"
class="round cu-btn lg light bg-blue" @click="editRectification(item)">编辑整改信息</button>
<button v-if="item.statusName === '待验收' && canAcceptance"
class="round cu-btn lg bg-blue" @click="acceptance(item)">立即验收</button>
<!-- 待交办显示隐患交办 -->
<button v-if="item.statusName === '待交办'"
class="round cu-btn lg bg-blue" @click="assignHazard(item)">隐患交办</button>
</view>
</view>
<button class="cuIcon-add round bg-blue margin-top-xl" @click="showAddPopup = true">新增</button>
<!-- 固定在底部的悬浮新增按钮 -->
<view class="fixed-add-btn" @click="showAddPopup = true">
<text class="cuIcon-add"></text>
<text>新增</text>
</view>
<!-- 新增弹窗 -->
<u-popup :show="showAddPopup" mode="center" round="20" @close="showAddPopup = false">
@@ -45,7 +54,7 @@
<view class="popup-title text-bold">新增隐患排查</view>
<view class="popup-close" @click="showAddPopup = false">×</view>
</view>
<view class="popup-body">
<scroll-view class="popup-body" scroll-y>
<view class="flex margin-bottom">
<view class="text-gray">隐患图片/视频</view>
<view class="text-red">*</view>
@@ -77,12 +86,22 @@
</view>
<view class="address-box">
<view class="address-input" @tap.stop="chooseLocation">
<text :class="selectedAddress ? '' : 'text-gray'">{{ selectedAddress || '请选择地址' }}</text>
</view>
<up-input class="address-input-wrapper" v-model="selectedAddress" placeholder="请输入地址" border="surround"></up-input>
<button class="btn-address bg-blue" @tap.stop="chooseLocation">选择地址</button>
</view>
<view class="text-gray text-sm margin-top-xs">办公楼3层东侧消防通道生产车间A区设备旁等或点击"选择地址"按钮在地图上选择</view>
<!-- 隐患区域选择 -->
<view class="flex margin-bottom margin-top">
<view class="text-gray">隐患区域</view>
</view>
<view class="select-trigger" @click="showAreaPicker = true">
<view class="select-value" :class="{ 'placeholder': !selectedAreaName }">
{{ selectedAreaName || '请选择隐患区域' }}
</view>
<text class="cuIcon-unfold"></text>
</view>
<view class="flex margin-bottom margin-top">
<view class="text-gray">隐患描述</view>
<view class="text-red">*</view>
@@ -92,13 +111,42 @@
<view class="text-gray margin-bottom margin-top">隐患标签</view>
<up-choose v-model="formData.tagIndex" :options="tagOptions"></up-choose>
<view class="text-gray text-sm">可选择多个相关标签对隐患进行分类</view>
</view>
</scroll-view>
<view class="popup-footer">
<button class="btn-cancel" @click="showAddPopup = false">取消</button>
<button class="btn-confirm bg-blue" @click="handleAdd">确定</button>
</view>
</view>
</u-popup>
<!-- 区域选择弹窗 -->
<u-popup :show="showAreaPicker" mode="bottom" round="20" @close="showAreaPicker = false">
<view class="picker-popup">
<view class="picker-header">
<view class="picker-cancel" @click="showAreaPicker = false">取消</view>
<view class="picker-title">选择隐患区域</view>
<view class="picker-confirm" @click="confirmAreaSelect">确定</view>
</view>
<scroll-view class="picker-body" scroll-y>
<view
v-for="item in areaList"
:key="item.id"
class="picker-item"
:class="{ 'picker-item-active': tempAreaId === item.id }"
@click="tempAreaId = item.id"
>
<view class="flex align-center">
<view class="area-color-dot" :style="{ backgroundColor: item.color }"></view>
<text>{{ item.name }}</text>
</view>
<text v-if="tempAreaId === item.id" class="cuIcon-check text-blue"></text>
</view>
<view v-if="areaList.length === 0" class="text-gray text-center padding">
暂无区域数据
</view>
</scroll-view>
</view>
</u-popup>
</view>
</template>
@@ -120,6 +168,7 @@
getMyHiddenDangerList,
getHiddenDangerLabelList
} from '@/request/api.js'
import { getAreaList } from '@/request/three_one_api/area.js'
import {
baseUrl,
getToken
@@ -127,6 +176,27 @@
// 弹窗控制
const showAddPopup = ref(false);
// 获取用户角色判断是否有验收权限admin或manage才能验收
const userRole = ref('');
const canAcceptance = computed(() => {
return userRole.value === 'admin' || userRole.value === 'manage';
});
// 从storage获取用户信息
const getUserRole = () => {
try {
const userInfoStr = uni.getStorageSync('userInfo');
if (userInfoStr) {
const userInfo = JSON.parse(userInfoStr);
userRole.value = userInfo.role || '';
console.log('当前用户角色:', userRole.value);
}
} catch (error) {
console.error('获取用户信息失败:', error);
}
};
getUserRole();
// 任务相关ID从接口获取
const taskId = ref('');
@@ -173,6 +243,36 @@
// 地址选择 - 调用腾讯地图
const selectedAddress = ref('');
// 区域选择相关
const showAreaPicker = ref(false);
const areaList = ref([]);
const selectedAreaId = ref('');
const selectedAreaName = ref('');
const tempAreaId = ref('');
// 获取区域列表
const fetchAreaList = async () => {
try {
const res = await getAreaList();
if (res.code === 0 && res.data && res.data.records) {
areaList.value = res.data.records;
}
} catch (error) {
console.error('获取区域列表失败:', 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 = () => {
console.log('chooseLocation called');
@@ -180,27 +280,60 @@
showAddPopup.value = false;
setTimeout(() => {
uni.chooseLocation({
success: (res) => {
console.log('选择位置成功:', res);
// 获取选择的位置信息
selectedAddress.value = res.address + (res.name ? `(${res.name})` : '');
lng.value = res.longitude;
lat.value = res.latitude;
// 重新打开弹窗
showAddPopup.value = true;
// 先获取当前位置,再打开地图选择
uni.getLocation({
type: 'gcj02', // 使用国测局坐标系(腾讯地图使用)
success: (locationRes) => {
console.log('获取当前位置成功:', locationRes);
// 使用当前位置作为地图初始中心点
uni.chooseLocation({
latitude: locationRes.latitude,
longitude: locationRes.longitude,
success: (res) => {
console.log('选择位置成功:', res);
// 获取选择的位置信息
selectedAddress.value = res.address + (res.name ? `(${res.name})` : '');
lng.value = res.longitude;
lat.value = res.latitude;
// 重新打开弹窗
showAddPopup.value = true;
},
fail: (err) => {
console.error('选择位置失败:', err);
// 重新打开弹窗
showAddPopup.value = true;
// 用户取消选择不提示
if (err.errMsg && err.errMsg.indexOf('cancel') === -1) {
uni.showToast({
title: '选择位置失败',
icon: 'none'
});
}
}
});
},
fail: (err) => {
console.error('选择位置失败:', err);
// 重新打开弹窗
showAddPopup.value = true;
// 用户取消选择不提示
if (err.errMsg && err.errMsg.indexOf('cancel') === -1) {
uni.showToast({
title: '选择位置失败',
icon: 'none'
});
}
console.error('获取当前位置失败:', err);
// 即使获取位置失败,也打开地图选择(不带初始位置)
uni.chooseLocation({
success: (res) => {
console.log('选择位置成功:', res);
selectedAddress.value = res.address + (res.name ? `(${res.name})` : '');
lng.value = res.longitude;
lat.value = res.latitude;
showAddPopup.value = true;
},
fail: (chooseErr) => {
console.error('选择位置失败:', chooseErr);
showAddPopup.value = true;
if (chooseErr.errMsg && chooseErr.errMsg.indexOf('cancel') === -1) {
uni.showToast({
title: '选择位置失败',
icon: 'none'
});
}
}
});
}
});
}, 300);
@@ -250,19 +383,21 @@
// 构建请求参数
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: tagId, //隐患标签ID
taskId: taskId.value, //关联任务ID
checkPointId: checkPointId.value, //关联检查点ID
source: sourceOptions.value[formData.source]?.title || '', //隐患来源(随手拍、企业自查、行业互查、专家诊查)
attachments: attachments, //附件列表(图片/视频)
};
console.log('提交的参数:', params);
//
try {
const res = await addHiddenDanger(params);
@@ -278,6 +413,8 @@
formData.description = '';
formData.tagIndex = 0;
selectedAddress.value = '';
selectedAreaId.value = '';
selectedAreaName.value = '';
fileList1.value = [];
// 刷新隐患列表
fetchHiddenDangerList();
@@ -320,6 +457,7 @@
// 页面显示时刷新列表(从交办、验收页面返回时自动刷新)
onShow(() => {
fetchHiddenDangerList();
});
const details = (item) => {
@@ -332,6 +470,14 @@
url: `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`
})
}
// 编辑整改信息(待验收状态)
const editRectification = (item) => {
uni.navigateTo({
url: `/pages/hiddendanger/rectification?rectifyId=${item.rectifyId}&isEdit=1`
})
}
const acceptance = (item) => {
uni.navigateTo({
url: `/pages/hiddendanger/acceptance?hazardId=${item.hazardId}&assignId=${item.assignId}&rectifyId=${item.rectifyId}`
@@ -476,6 +622,31 @@
.page {
min-height: 100vh;
background: #EBF2FC;
padding-bottom: 120rpx; // 给底部按钮留出空间
}
// 固定在底部的悬浮新增按钮
.fixed-add-btn {
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;
.cuIcon-add {
margin-right: 10rpx;
font-size: 36rpx;
}
}
.list-list {
@@ -576,18 +747,8 @@
align-items: center;
gap: 20rpx;
.address-input {
.address-input-wrapper {
flex: 1;
background: #fff;
border: 1rpx solid #F6F6F6;
;
border-radius: 8rpx;
padding: 20rpx;
font-size: 26rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.btn-address {
@@ -605,6 +766,87 @@
}
}
// 选择器触发器样式
.select-trigger {
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
.select-value {
flex: 1;
font-size: 28rpx;
color: #333;
&.placeholder {
color: #c0c4cc;
}
}
}
// 选择弹窗样式
.picker-popup {
background: #fff;
.picker-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
.picker-cancel {
font-size: 28rpx;
color: #999;
}
.picker-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.picker-confirm {
font-size: 28rpx;
color: #2667E9;
}
}
.picker-body {
max-height: 600rpx;
padding: 0 30rpx;
}
.picker-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx 0;
border-bottom: 1rpx solid #f5f5f5;
font-size: 30rpx;
color: #333;
&:last-child {
border-bottom: none;
}
&.picker-item-active {
color: #2667E9;
}
}
}
// 区域颜色圆点
.area-color-dot {
width: 24rpx;
height: 24rpx;
border-radius: 50%;
margin-right: 16rpx;
}
.address-popup {
width: 600rpx;
background: #fff;

View File

@@ -1,58 +1,91 @@
<template>
<view class="page padding">
<view class="padding bg-white radius">
<view class="flex margin-bottom">
<view class="form-label margin-bottom">
<view class="text-gray">整改方案</view>
<view class="text-red">*</view>
</view>
<up-textarea v-model="formData.rectifyPlan" placeholder="请输入内容"></up-textarea>
<view class="flex margin-bottom margin-top">
<view class="form-label margin-bottom margin-top">
<view class="text-gray">整改完成情况</view>
<view class="text-red">*</view>
</view>
<up-textarea v-model="formData.rectifyResult" placeholder="请输入内容"></up-textarea>
<view class="flex margin-bottom">
<view class="text-gray margin-top">投资资金(计划)</view>
<view class="form-label margin-bottom margin-top">
<view class="text-gray">投资资金(计划)</view>
<view class="text-red">*</view>
</view>
<up-input v-model="formData.planCost" placeholder="请输入内容" type="number"></up-input>
<view class="flex margin-bottom">
<view class="text-gray margin-top">投资资金(实际)</view>
<view class="form-label margin-bottom margin-top">
<view class="text-gray">投资资金(实际)</view>
<view class="text-red">*</view>
</view>
<up-input v-model="formData.actualCost" placeholder="请输入内容" type="number"></up-input>
<view class="flex margin-bottom">
<view class="text-gray margin-top">限定整改时间</view>
<view class="form-label margin-bottom margin-top">
<view class="text-gray">限定整改时间</view>
<view class="text-red">*</view>
</view>
<up-datetime-picker hasInput :show="show" v-model="value1" mode="date"></up-datetime-picker>
<view class="flex margin-bottom margin-top">
<view class="form-label margin-bottom margin-top">
<view class="text-gray">整改人员</view>
<view class="text-red">*</view>
<view class="margin-left-sm text-black" v-if="selectedUserName">{{ selectedUserName }}</view>
</view>
<up-select v-model:current="cateId" :options="cateList" @select="selectItem"></up-select>
<!-- 点击打开人员选择弹窗 -->
<view class="select-trigger" @click="showUserPopup = true">
<view class="select-content" :class="{ 'text-gray': selectedUsers.length === 0 }">
{{ selectedUsers.length > 0 ? selectedUsersText : '请选择整改人员(可多选)' }}
</view>
<text class="cuIcon-unfold"></text>
</view>
<view class="flex margin-bottom">
<!-- 人员多选弹窗 -->
<u-popup :show="showUserPopup" mode="bottom" round="20" @close="showUserPopup = false">
<view class="user-popup">
<view class="popup-header">
<view class="popup-title text-bold">选择整改人员</view>
<view class="popup-close" @click="showUserPopup = false">×</view>
</view>
<view class="popup-body">
<up-checkbox-group v-model="selectedUserIds" placement="column" @change="onUserChange">
<view class="user-item" v-for="item in cateList" :key="item.id">
<up-checkbox
:label="item.name"
:name="item.id"
activeColor="#2667E9"
shape="square"
></up-checkbox>
</view>
</up-checkbox-group>
</view>
<view class="popup-footer">
<button class="btn-cancel" @click="showUserPopup = false">取消</button>
<button class="btn-confirm bg-blue" @click="confirmUserSelect">确定</button>
</view>
</view>
</u-popup>
<view class="form-label margin-bottom margin-top">
<view class="text-gray">整改图片/视频</view>
<view class="text-red">*</view>
</view>
<up-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="10"></up-upload>
<button class="bg-blue round margin-top-xl" @click="handleSubmit">提交整改</button>
<button class="bg-blue round margin-top-xl" @click="handleSubmit">{{ isEdit ? '保存修改' : '提交整改' }}</button>
</view>
</view>
</template>
<script setup>
import {ref,reactive,onMounted} from 'vue'
import {ref,reactive,computed} from 'vue'
import {onLoad} from '@dcloudio/uni-app'
import {submitRectification,getDepartmentPersonUsers} from '@/request/api.js'
import {submitRectification,getDepartmentPersonUsers,getRectifyDetail,getDeptUsersWithSubordinates} from '@/request/api.js'
import {baseUrl,getToken} from '@/request/request.js'
// 从页面参数获取的ID
const hazardId = ref('');
const assignId = ref('');
const rectifyId = ref(''); // 整改ID编辑模式时使用
const isEdit = ref(false); // 是否为编辑模式
// 表单数据
const formData = reactive({
@@ -66,17 +99,42 @@
const value1 = ref(Date.now());
const radiovalue1 = ref('');
// 整改人员
const cateId = ref('')
// 整改人员(多选)
const cateList = ref([])
const selectedUserName = ref('') // 选中的人员名称
const showUserPopup = ref(false) // 人员选择弹窗
const selectedUserIds = ref([]) // 选中的用户ID数组
const selectedUsers = ref([]) // 选中的用户对象数组
// 选中人员的显示文本
const selectedUsersText = 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}`;
});
// checkbox变化事件
const onUserChange = (ids) => {
console.log('选中的ID:', ids);
};
// 确认选择人员
const confirmUserSelect = () => {
// 根据选中的ID获取用户对象
selectedUsers.value = cateList.value.filter(item => selectedUserIds.value.includes(item.id));
showUserPopup.value = false;
console.log('选中的整改人员:', selectedUsers.value);
};
// 获取部门人员列表
const fetchDeptUsers = async () => {
console.log('当前hazardId:', hazardId.value);
try {
const res = await getDepartmentPersonUsers();
const res = await getDeptUsersWithSubordinates({hazardId:hazardId.value});
if (res.code === 0 && res.data) {
// 将部门下的用户数据扁平化为 up-select 需要的格式
// 将部门下的用户数据扁平化
const userList = [];
res.data.forEach(dept => {
if (dept.users && dept.users.length > 0) {
@@ -95,9 +153,6 @@
console.error('获取部门人员失败:', error);
}
};
// 页面加载时获取人员列表
fetchDeptUsers();
// 上传图片
const fileList1 = ref([]);
@@ -173,6 +228,13 @@
});
return;
}
if (selectedUsers.value.length === 0) {
uni.showToast({
title: '请选择整改人员',
icon: 'none'
});
return;
}
// 构建附件列表
const attachments = fileList1.value.map(file => {
@@ -198,14 +260,21 @@
rectifyResult: formData.rectifyResult,
planCost: Number(formData.planCost) || 0,
actualCost: Number(formData.actualCost) || 0,
attachments: attachments
attachments: attachments,
// 整改人员ID数组
rectifyUserIds: selectedUserIds.value.map(id => Number(id))
};
// 编辑模式需要传递rectifyId
if (rectifyId.value) {
params.rectifyId = rectifyId.value;
}
try {
const res = await submitRectification(params);
if (res.code === 0) {
uni.showToast({
title: '提交成功',
title: isEdit.value ? '保存成功' : '提交成功',
icon: 'success'
});
setTimeout(() => {
@@ -213,19 +282,76 @@
}, 1500);
} else {
uni.showToast({
title: res.msg || '提交失败',
title: res.msg || (isEdit.value ? '保存失败' : '提交失败'),
icon: 'none'
});
}
} catch (error) {
console.error('提交整改失败:', error);
uni.showToast({
title: '您不是整改人员',
title: '操作失败',
icon: 'none'
});
}
};
// 获取整改详情(编辑模式)
const fetchRectifyDetail = async () => {
try {
uni.showLoading({ title: '加载中...' });
const res = await getRectifyDetail({ rectifyId: rectifyId.value });
uni.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和assignId
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 : (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) {
// 如果没有memberIds使用rectifierId
selectedUserIds.value = [String(data.rectifierId)];
setTimeout(() => {
selectedUsers.value = cateList.value.filter(item => item.id === String(data.rectifierId));
}, 500);
}
// 设置页面标题
uni.setNavigationBarTitle({ title: '编辑整改信息' });
}
} catch (error) {
uni.hideLoading();
console.error('获取整改详情失败:', error);
uni.showToast({ title: '获取详情失败', icon: 'none' });
}
};
onLoad((options) => {
if (options.hazardId) {
hazardId.value = options.hazardId;
@@ -233,13 +359,18 @@
if (options.assignId) {
assignId.value = options.assignId;
}
// 在hazardId赋值后调用确保有值
fetchDeptUsers();
// 编辑模式
if (options.rectifyId) {
rectifyId.value = options.rectifyId;
isEdit.value = options.isEdit === '1';
// 获取整改详情
fetchRectifyDetail();
}
});
// 选择整改人员
const selectItem = (item) => {
console.log('选择的整改人员:', item);
cateId.value = item.id;
selectedUserName.value = item.name; // 显示选中的人员名称
};
</script>
<style lang="scss" scoped>
@@ -247,6 +378,17 @@
min-height: 100vh;
background: #EBF2FC;
}
// 表单标签样式 - 让*号和文字对齐
.form-label {
display: flex;
align-items: center;
.text-red {
margin-left: 4rpx;
line-height: 1;
}
}
.date-input {
background: #fff;
@@ -260,4 +402,87 @@
color: #333;
}
}
// 选择触发器样式
.select-trigger {
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-content {
flex: 1;
font-size: 28rpx;
color: #333;
}
}
// 人员选择弹窗
.user-popup {
background: #fff;
.popup-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
.popup-title {
font-size: 32rpx;
color: #333;
}
.popup-close {
font-size: 40rpx;
color: #999;
line-height: 1;
}
}
.popup-body {
padding: 20rpx 30rpx;
max-height: 600rpx;
overflow-y: auto;
}
.user-item {
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
}
.popup-footer {
display: flex;
border-top: 1rpx solid #eee;
button {
flex: 1;
height: 90rpx;
line-height: 90rpx;
border-radius: 0;
font-size: 30rpx;
&::after {
border: none;
}
}
.btn-cancel {
background: #fff;
color: #666;
}
.btn-confirm {
color: #fff;
}
}
}
</style>

View File

@@ -6,9 +6,9 @@
<view class="text-red">*</view>
</view>
<view class="margin-bottom">
<view v-if="rectifyAttachments.length > 0" class="margin-top">
<view v-if="detailData.attachments && detailData.attachments.length > 0" class="margin-top">
<view class="flex" style="flex-wrap: wrap; gap: 10rpx;">
<image v-for="(img, idx) in rectifyAttachments" :key="idx" :src="getFullPath(img.filePath)" style="width: 136rpx;height: 136rpx;border-radius: 16rpx;" mode="aspectFill" @click="previewRectifyImage(idx)"></image>
<image v-for="(img, idx) in detailData.attachments" :key="idx" :src="getFullPath(img.filePath)" style="width: 136rpx;height: 136rpx;border-radius: 16rpx;" mode="aspectFill" @click="previewHazardImage(idx)"></image>
</view>
</view>
<view v-else class="text-gray text-sm">暂无图片</view>
@@ -44,7 +44,12 @@
<button class="address-btn bg-blue">选择地址</button>
</view>
<view class="text-gray text-sm">办公楼3层东侧消防通道生产车间A区设备旁等或点击"选择地址"按钮在地图上选择</view>
<view class="flex margin-bottom ">
<!-- 隐患区域 -->
<view class="text-gray margin-top margin-bottom">隐患区域</view>
<view class="bg-gray padding radius">{{ detailData.areaName || '暂无' }}</view>
<view class="flex margin-bottom margin-top">
<view class="text-gray">隐患描述</view>
<view class="text-red">*</view>
</view>
@@ -74,6 +79,7 @@
source: '',
description: '',
address: '',
areaName: '', // 隐患区域名称
createdAt: '',
attachments: []
});
@@ -93,8 +99,9 @@
};
// 图片预览 - 隐患图片
const previewImage = (attachments, index) => {
const urls = attachments.map(item => getFullPath(item.filePath));
const previewHazardImage = (index) => {
if (!detailData.attachments || detailData.attachments.length === 0) return;
const urls = detailData.attachments.map(item => getFullPath(item.filePath));
uni.previewImage({
current: index,
urls: urls
@@ -116,6 +123,8 @@
const res = await getHiddenDangerDetail({ hazardId, assignId });
if (res.code === 0 && res.data) {
Object.assign(detailData, res.data);
console.log('隐患详情数据:', res.data);
console.log('隐患附件:', res.data.attachments);
// 提取整改附件assigns[0].rectify.attachments
if (res.data.assigns && res.data.assigns.length > 0) {