问题修改

This commit is contained in:
huangyaohui 2026-04-16 16:44:50 +08:00
parent 7359957302
commit 98e5c6b72c
2 changed files with 346 additions and 275 deletions

View File

@ -26,6 +26,21 @@
</view>
</view>
<view class="FormItemBox">
<view class="LabelBox">风险等级</view>
<view class="ValueBox">
<view class="SelectBox">
<u-select
:current="formData.riskLevel"
:options="riskLevelOptions"
placeholder="请选择风险等级"
showOptionsLabel
@update:current="handleRiskLevelChange"
></u-select>
</view>
</view>
</view>
<view class="FormItemBox">
<view class="LabelBox">问题描述</view>
<view class="ValueBox">
@ -65,6 +80,7 @@ import { safeNavigateBack } from '@/utils/navigation'
const formData = ref({
checkItemId: '',
riskLevel: '',
issueDesc: '',
fileUrl: ''
})
@ -80,6 +96,16 @@ const checkItemOptions = computed(() =>
}))
)
const riskLevelOptions = [
{ id: '高', name: '高' },
{ id: '中', name: '中' },
{ id: '低', name: '低' }
]
const handleRiskLevelChange = value => {
formData.value.riskLevel = value
}
const getSelectedCheckItem = templateItemId =>
dataList.value.find(item => item.templateItemId === templateItemId)
@ -156,6 +182,14 @@ const submitAddItem = async () => {
return
}
if (!formData.value.riskLevel) {
uni.showToast({
title: '请选择风险等级',
icon: 'none'
})
return
}
if (!formData.value.issueDesc.trim()) {
uni.showToast({
title: '请输入问题描述',
@ -186,7 +220,8 @@ const submitAddItem = async () => {
sourceType: '2',
checkItemId: formData.value.checkItemId,
detectionName: selectedCheckItem.itemDescription || '',
description: formData.value.issueDesc.trim(),
description: formData.value.riskLevel,
reason: formData.value.issueDesc.trim(),
problemPhotoUrl: formData.value.fileUrl.trim(),
status: '0'
}

View File

@ -1,178 +1,205 @@
<!-- AI识别项复核-页面 -->
<template>
<view class="PageBox">
<view class="TopBox FlexBox">
<view class="iconBox FlexBox">
<!-- 返回列表页 -->
<u-icon name="arrow-leftward" size="24" @click="goBack"></u-icon>
<!-- 返回首页 -->
<view class="PageBox">
<view class="TopBox FlexBox">
<view class="iconBox FlexBox">
<!-- 返回列表页 -->
<u-icon name="arrow-leftward" size="24" @click="goBack"></u-icon>
<!-- 返回首页 -->
<u-icon name="home" size="24" @click="goHome"></u-icon>
</view>
<view class="Title">AI识别项复核</view>
<view class="informBox">
<u-icon name="bell-fill" size="24"></u-icon>
<view class="MsgTxt"></view>
</view>
</view>
<view class="ContentBox">
<view class="FormItemBox">
<view class="LabelBox">检查项名称</view>
<view class="ValueBox">{{ formData.checkItemName || '-' }}</view>
</view>
<view class="FormItemBox">
<view class="LabelBox">识别照片</view>
<view class="imgBox">
<image v-if="formData.attachmentUrls" :src="formData.attachmentUrls" mode="aspectFill"
style="width: 200rpx; height: 200rpx;"></image>
<view v-else class="placeholder">暂无照片</view>
</view>
</view>
<!-- <view class="FormItemBox">
<view class="LabelBox">施工单位自查意见</view>
<view class="ValueBox">单位已安排人员监督后续加强安全培训</view>
</view> -->
<view class="FormItemBox">
<view class="LabelBox">复核结果</view>
<view class="ValueBox">
<view class="reviewStatusTag"
v-if="formData.reviewStatusRaw !== null && formData.reviewStatusRaw !== undefined">
<u-tag v-if="formData.reviewStatusRaw === 0 || formData.reviewStatusRaw === '0'" text="待复核"
type="warning" plain></u-tag>
<u-tag v-else-if="formData.reviewStatusRaw === 1 || formData.reviewStatusRaw === '1'" text="合格"
type="success" plain></u-tag>
<u-tag v-else-if="formData.reviewStatusRaw === 2 || formData.reviewStatusRaw === '2'" text="不合格"
type="error" plain></u-tag>
</view>
<view class="radioBox">
<u-radio-group v-model="formData.reviewStatus">
<u-radio name="1" label="合格"></u-radio>
<u-radio name="2" label="不合格"></u-radio>
</u-radio-group>
</view>
</view>
</view>
<view class="FormItemBox">
<view class="LabelBox">附件上传</view>
<view class="uploadBox">
<u-upload :fileList="fileList" :auto-upload="false" :multiple="false" @afterRead="afterRead"
@delete="handleRemove">
</u-upload>
</view>
</view>
</view>
<view class="FootBox">
<u-button plain type="primary" @click="goBack">取消</u-button>
<u-button type="primary" @click="submitReview">提交复核结果</u-button>
</view>
</view>
<view class="Title">AI识别项复核</view>
<view class="informBox">
<u-icon name="bell-fill" size="24"></u-icon>
<view class="MsgTxt"></view>
</view>
</view>
<view class="ContentBox">
<view class="FormItemBox">
<view class="LabelBox">检查项名称</view>
<view class="ValueBox">{{ formData.checkItemName || '-' }}</view>
</view>
<view class="FormItemBox">
<view class="LabelBox">风险等级</view>
<view class="ValueBox">
<view class="SelectBox">
<u-select
:current="formData.riskLevel"
:options="riskLevelOptions"
placeholder="请选择风险等级"
showOptionsLabel
@update:current="handleRiskLevelChange"
></u-select>
</view>
</view>
</view>
<view class="FormItemBox">
<view class="LabelBox">识别照片</view>
<view class="imgBox">
<image v-if="formData.attachmentUrls" :src="formData.attachmentUrls" mode="aspectFill"
style="width: 200rpx; height: 200rpx;"></image>
<view v-else class="placeholder">暂无照片</view>
</view>
</view>
<!-- <view class="FormItemBox">
<view class="LabelBox">施工单位自查意见</view>
<view class="ValueBox">单位已安排人员监督后续加强安全培训</view>
</view> -->
<view class="FormItemBox">
<view class="LabelBox">复核结果</view>
<view class="ValueBox">
<view class="reviewStatusTag"
v-if="formData.reviewStatusRaw !== null && formData.reviewStatusRaw !== undefined">
<u-tag v-if="formData.reviewStatusRaw === 0 || formData.reviewStatusRaw === '0'" text="待复核"
type="warning" plain></u-tag>
<u-tag v-else-if="formData.reviewStatusRaw === 1 || formData.reviewStatusRaw === '1'" text="合格"
type="success" plain></u-tag>
<u-tag v-else-if="formData.reviewStatusRaw === 2 || formData.reviewStatusRaw === '2'" text="不合格"
type="error" plain></u-tag>
</view>
<view class="radioBox">
<u-radio-group v-model="formData.reviewStatus">
<u-radio name="1" label="合格"></u-radio>
<u-radio name="2" label="不合格"></u-radio>
</u-radio-group>
</view>
</view>
</view>
<view class="FormItemBox">
<view class="LabelBox">附件上传</view>
<view class="uploadBox">
<u-upload :fileList="fileList" :auto-upload="false" :multiple="false" @afterRead="afterRead"
@delete="handleRemove">
</u-upload>
</view>
</view>
</view>
<view class="FootBox">
<u-button plain type="primary" @click="goBack">取消</u-button>
<u-button type="primary" @click="submitReview">提交复核结果</u-button>
</view>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import {ref, onMounted} from 'vue'
import IntelligentizeApi from '@/api/modules/Intelligentize'
import { uploadReformFile } from '@/api/modules/reformFeedback'
import { safeNavigateBack } from '@/utils/navigation'
import {uploadReformFile} from '@/api/modules/reformFeedback'
import {safeNavigateBack} from '@/utils/navigation'
const formData = ref({
id: '',
checkItemName: '', //
attachmentUrls: '', //
reviewStatusRaw: null, // 0 1 2 Tag
reviewStatus: '', // u-radio '' | '1' | '2'
attachment: '' // URL
id: '',
checkItemName: '', //
riskLevel: '', //
attachmentUrls: '', //
reviewStatusRaw: null, // 0 1 2 Tag
reviewStatus: '', // u-radio '' | '1' | '2'
attachment: '' // URL
})
const fileList = ref([])
const uploadedFileUrls = ref([])
const uploadUrl = ref('')
const riskLevelOptions = [
{ id: '高', name: '高' },
{ id: '中', name: '中' },
{ id: '低', name: '低' }
]
const handleRiskLevelChange = value => {
formData.value.riskLevel = value
}
// 0 1 2
const loadFromPrev = () => {
const item = uni.getStorageSync('intelligentizeItem')
if (item) {
formData.value.id = item.id
formData.value.checkItemName = item.name || item.checkItemName || ''
formData.value.attachmentUrls = item.attachmentUrls || ''
const status = item.reviewStatus != null ? String(item.reviewStatus) : ''
formData.value.reviewStatusRaw = item.reviewStatus
// (0) u-radio (1)/(2)
if (status === '1' || status === '2') {
formData.value.reviewStatus = status
} else {
formData.value.reviewStatus = '' //
}
uni.removeStorageSync('intelligentizeItem')
const item = uni.getStorageSync('intelligentizeItem')
if (item) {
formData.value.id = item.id
formData.value.checkItemName = item.name || item.checkItemName || ''
formData.value.attachmentUrls = item.attachmentUrls || ''
const status = item.reviewStatus != null ? String(item.reviewStatus) : ''
formData.value.reviewStatusRaw = item.reviewStatus
// (0) u-radio (1)/(2)
if (status === '1' || status === '2') {
formData.value.reviewStatus = status
} else {
formData.value.reviewStatus = '' //
}
uni.removeStorageSync('intelligentizeItem')
}
}
onMounted(() => {
loadFromPrev()
loadFromPrev()
})
// u-upload
const getUploadFiles = (event) => {
if (!event) return []
if (Array.isArray(event)) return event
if (Array.isArray(event.file)) return event.file
if (event.file) return [event.file]
return []
if (!event) return []
if (Array.isArray(event)) return event
if (Array.isArray(event.file)) return event.file
if (event.file) return [event.file]
return []
}
//
const afterRead = async (event) => {
const files = getUploadFiles(event)
if (!files.length) return
const files = getUploadFiles(event)
if (!files.length) return
const currentFile = files[files.length - 1]
const localPath = currentFile?.url || currentFile?.path || currentFile?.thumb || ''
if (!localPath) {
uni.showToast({
title: '未获取到文件路径',
icon: 'none'
})
return
}
const currentFile = files[files.length - 1]
const localPath = currentFile?.url || currentFile?.path || currentFile?.thumb || ''
if (!localPath) {
uni.showToast({
title: '未获取到文件路径',
icon: 'none'
})
return
}
try {
const uploadRes = await uploadReformFile(localPath, 'file', {}, { loading: true, loadingText: '上传中...' })
const fileUrl = uploadRes?.url || uploadRes?.data?.url || uploadRes?.data?.data?.url || ''
if (!fileUrl) {
throw new Error('上传返回地址为空')
}
uploadedFileUrls.value = [fileUrl]
fileList.value = [{ url: fileUrl }]
formData.value.attachment = uploadedFileUrls.value.join(',')
} catch (error) {
fileList.value = []
uploadedFileUrls.value = []
formData.value.attachment = ''
uni.showToast({
title: error?.msg || '上传失败',
icon: 'none'
})
try {
const uploadRes = await uploadReformFile(localPath, 'file', {}, {loading: true, loadingText: '上传中...'})
const fileUrl = uploadRes?.url || uploadRes?.data?.url || uploadRes?.data?.data?.url || ''
if (!fileUrl) {
throw new Error('上传返回地址为空')
}
uploadedFileUrls.value = [fileUrl]
fileList.value = [{url: fileUrl}]
formData.value.attachment = uploadedFileUrls.value.join(',')
} catch (error) {
fileList.value = []
uploadedFileUrls.value = []
formData.value.attachment = ''
uni.showToast({
title: error?.msg || '上传失败',
icon: 'none'
})
}
}
//
const handleRemove = (event) => {
const index = event?.index || 0
if (uploadedFileUrls.value[index]) {
uploadedFileUrls.value.splice(index, 1)
}
fileList.value.splice(index, 1)
formData.value.attachment = uploadedFileUrls.value.join(',')
const index = event?.index || 0
if (uploadedFileUrls.value[index]) {
uploadedFileUrls.value.splice(index, 1)
}
fileList.value.splice(index, 1)
formData.value.attachment = uploadedFileUrls.value.join(',')
}
//
const handleChange = () => { }
const handlePreview = () => { }
const handleChange = () => {
}
const handlePreview = () => {
}
const handleSubmit = () => submitReview()
//
const goBack = () => {
safeNavigateBack()
safeNavigateBack()
}
//
const goHome = () => {
@ -183,177 +210,186 @@ const goHome = () => {
// submitIntelligentize
const submitReview = () => {
if (!formData.value.reviewStatus) {
uni.showToast({
title: '请选择复核结果',
icon: 'none'
})
return
}
const submitData = {
videoDetectionId: formData.value.id,
reviewResult: formData.value.reviewStatus,
attachmentUrls: formData.value.attachment || ''
}
IntelligentizeApi.submitIntelligentize(submitData).then((res) => {
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('intelligentize-review-success')
setTimeout(() => goBack(), 1500)
}).catch((err) => {
uni.showToast({
title: err?.msg || '提交失败',
icon: 'none'
})
if (!formData.value.riskLevel) {
uni.showToast({
title: '请选择风险等级',
icon: 'none'
})
return
}
if (!formData.value.reviewStatus) {
uni.showToast({
title: '请选择复核结果',
icon: 'none'
})
return
}
const submitData = {
videoDetectionId: formData.value.id,
reviewResult: formData.value.reviewStatus,
description: formData.value.riskLevel,
attachmentUrls: formData.value.attachment || ''
}
IntelligentizeApi.submitIntelligentize(submitData).then((res) => {
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('intelligentize-review-success')
setTimeout(() => goBack(), 1500)
}).catch((err) => {
uni.showToast({
title: err?.msg || '提交失败',
icon: 'none'
})
})
}
</script>
<style lang="scss" scoped>
.FlexBox {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
gap: 20rpx;
}
.FormItemBox {
padding: 20rpx;
background-color: #fff;
box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.2);
border-radius: 10rpx;
padding: 20rpx;
background-color: #fff;
box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.2);
border-radius: 10rpx;
margin-bottom: 20rpx;
.LabelBox {
font-size: 24rpx;
color: #333;
font-weight: bold;
margin-bottom: 20rpx;
}
.LabelBox {
font-size: 24rpx;
color: #333;
font-weight: bold;
margin-bottom: 20rpx;
}
.LabelBox {
font-size: 24rpx;
color: #333;
font-weight: bold;
margin-bottom: 20rpx;
}
.LabelBox {
font-size: 24rpx;
color: #333;
font-weight: bold;
margin-bottom: 20rpx;
}
.ValueBox {
font-size: 24rpx;
color: #666;
}
.ValueBox {
font-size: 24rpx;
color: #666;
.imgBox {
.placeholder {
width: 200rpx;
height: 200rpx;
background: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #999;
border-radius: 8rpx;
}
}
.imgBox {
.placeholder {
width: 200rpx;
height: 200rpx;
background: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #999;
border-radius: 8rpx;
}
}
.reviewStatusTag {
margin-bottom: 16rpx;
}
.reviewStatusTag {
margin-bottom: 16rpx;
}
.radioBox {
margin-top: 8rpx;
}
.radioBox {
margin-top: 8rpx;
}
}
.PageBox {
// background-color: #ff9900;
height: 100vh;
// background-color: #ff9900;
height: 100vh;
overflow: hidden;
.TopBox {
height: 100rpx;
padding: 20rpx;
background-color: #fff;
.iconBox {
font-size: 32rpx;
}
.Title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.informBox {
.MsgTxt {
padding: 8rpx;
background-color: hsla(17, 100%, 50%, 0.849);
color: #fff;
position: absolute;
top: 16rpx;
right: 16rpx;
border-radius: 50%;
}
}
}
.ContentBox {
// background-color: #c5d5d6;
background-color: #fff;
height: calc(100vh - 210rpx);
overflow: hidden;
padding: 20rpx;
}
.TopBox {
height: 100rpx;
padding: 20rpx;
background-color: #fff;
.TopBox {
height: 100rpx;
padding: 20rpx;
background-color: #fff;
.iconBox {
font-size: 32rpx;
}
.Title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.informBox {
.MsgTxt {
padding: 8rpx;
background-color: hsla(17, 100%, 50%, 0.849);
color: #fff;
position: absolute;
top: 16rpx;
right: 16rpx;
border-radius: 50%;
}
}
.iconBox {
font-size: 32rpx;
}
.ContentBox {
// background-color: #c5d5d6;
background-color: #fff;
height: calc(100vh - 210rpx);
overflow: hidden;
padding: 20rpx;
.Title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.TopBox {
height: 100rpx;
padding: 20rpx;
background-color: #fff;
.iconBox {
font-size: 32rpx;
}
.Title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.informBox {
.MsgTxt {
padding: 8rpx;
background-color: hsla(17, 100%, 50%, 0.849);
color: #fff;
position: absolute;
top: 16rpx;
right: 16rpx;
border-radius: 50%;
}
}
.informBox {
.MsgTxt {
padding: 8rpx;
background-color: hsla(17, 100%, 50%, 0.849);
color: #fff;
position: absolute;
top: 16rpx;
right: 16rpx;
border-radius: 50%;
}
}
}
.ContentBox {
// background-color: #c5d5d6;
background-color: #fff;
height: calc(100vh - 210rpx);
overflow: hidden;
padding: 20rpx;
}
.ContentBox {
// background-color: #c5d5d6;
background-color: #fff;
height: calc(100vh - 210rpx);
overflow: hidden;
padding: 20rpx;
}
.FootBox {
display: flex;
align-items: center;
justify-content: center;
gap: 20rpx;
padding: 20rpx;
background-color: #fff;
font-weight: bold;
}
.FootBox {
display: flex;
align-items: center;
justify-content: center;
gap: 20rpx;
padding: 20rpx;
background-color: #fff;
font-weight: bold;
}
}
</style>