1.18整合

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

View File

@@ -6,8 +6,10 @@
<view class="text-red">*</view>
</view>
<view class="margin-bottom">
<view class="flex" style="flex-wrap: wrap; gap: 10rpx;" v-if="detailData?.attachments && detailData.attachments.length > 0">
<image v-for="(img, idx) in detailData.attachments" :key="idx" :src="img.filePath" style="width: 136rpx;height: 136rpx;border-radius: 16rpx;" mode="aspectFill"></image>
<view v-if="rectifyAttachments.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>
</view>
</view>
<view v-else class="text-gray text-sm">暂无图片</view>
<view class="text-gray text-sm margin-top-xs">必填请上传现场照片或者视频作为隐患证据</view>
@@ -60,6 +62,7 @@
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getHiddenDangerDetail } from '@/request/api.js'
import { baseUrl } from '@/request/request.js'
// 详情数据
const detailData = reactive({
@@ -75,12 +78,53 @@
attachments: []
});
// 整改附件(单独存储)
const rectifyAttachments = ref([]);
// 获取完整图片路径
const getFullPath = (filePath) => {
if (!filePath) return '';
// 如果已经是完整路径则直接返回
if (filePath.startsWith('http://') || filePath.startsWith('https://')) {
return filePath;
}
// 拼接 baseUrl
return baseUrl + filePath;
};
// 图片预览 - 隐患图片
const previewImage = (attachments, index) => {
const urls = attachments.map(item => getFullPath(item.filePath));
uni.previewImage({
current: index,
urls: urls
});
};
// 图片预览 - 整改图片
const previewRectifyImage = (index) => {
const urls = rectifyAttachments.value.map(item => getFullPath(item.filePath));
uni.previewImage({
current: index,
urls: urls
});
};
// 获取隐患详情
const fetchDetail = async (hazardId, assignId) => {
try {
const res = await getHiddenDangerDetail({ hazardId, assignId });
if (res.code === 0 && res.data) {
Object.assign(detailData, res.data);
// 提取整改附件assigns[0].rectify.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;
console.log('整改附件:', rectifyAttachments.value);
}
}
} else {
uni.showToast({ title: res.msg || '获取详情失败', icon: 'none' });
}
@@ -128,4 +172,4 @@
font-size: 28rpx;
color: #fff;
}
</style>
</style>