Merge remote-tracking branch 'origin/main'

This commit is contained in:
huangyaohui 2026-03-24 08:48:41 +08:00
commit c007b3f2ff
3 changed files with 230 additions and 117 deletions

View File

@ -1,4 +1,6 @@
import {get, post} from '../request'
import { get, post } from '../request'
export default {
// 提交复核结果
submitIntelligentize: (data) => post('/manage/contractor/videoDetection/review', data),
}

View File

@ -1,16 +1,70 @@
<!-- 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>
<view class="Title">AI识别项复核</view>
<view class="informBox">
<u-icon name="bell-fill" size="24"></u-icon>
<view class="MsgTxt"></view>
</view>
<view class="PageBox">
<view class="TopBox FlexBox">
<view class="iconBox FlexBox">
<!-- 返回列表页 -->
<u-icon name="arrow-leftward" size="24" @click="goBack"></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.imgUrl" :src="formData.imgUrl" 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 :action="uploadUrl" :auto-upload="false" @change="handleChange" @preview="handlePreview"
@remove="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="ContentBox">
<view class="FormItemBox">
@ -50,19 +104,42 @@
<u-button plain type="primary" @click="goBack">取消</u-button>
<u-button type="primary" @click="handleSubmit">提交复核结果</u-button>
</view>
</view>
</template>
<script setup>
import {ref, onMounted} from 'vue'
import {uploadFile} from "@/api/request";
import { ref, onMounted } from 'vue'
import IntelligentizeApi from '@/api/modules/Intelligentize'
const formData = ref({
reviewResult: '', //
attachment: '' //
id: '',
checkItemName: '', //
imgUrl: '', //
reviewStatusRaw: null, // 0 1 2 Tag
reviewStatus: '', // u-radio '' | '1' | '2'
attachment: '' //
})
//
const fileList = ref([])
// 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.imgUrl = item.imgUrl || ''
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()
})
//
const goBack = () => {
@ -71,83 +148,35 @@ const goBack = () => {
})
}
const data = ref(null)
//
const afterRead = async (event) => {
console.log("🚀 ~ afterRead ~ event: ", event);
const { file } = event
//
try {
const res = await uploadFile(
'/file/upload', //
file.path, //
'file', // key
{}, // form data
{ loading: true, loadingText: '上传中...' }
)
console.log("🚀 ~ afterRead ~ res: ", res);
//
fileList.value = [{
url: res.url || res.filePath, //
response: res //
}]
// formData
formData.value.attachment = res.url || res.filePath
uni.showToast({
title: '上传成功',
icon: 'success'
// 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'
})
})
} catch (error) {
console.error("🚀 ~ afterRead ~ error: ", error);
//
fileList.value = []
}
}
const handleSubmit = async () => {
//
if (!formData.value.reviewResult) {
uni.showToast({
title: '请选择复核结果',
icon: 'none'
})
return
}
if (!formData.value.attachment) {
uni.showToast({
title: '请上传附件',
icon: 'none'
})
return
}
console.log("🚀 ~ 提交数据 ~ formData: ", formData.value);
// TODO:
// await submitReview(formData.value)
uni.showToast({
title: '提交成功',
icon: 'success'
})
setTimeout(() => {
goBack()
}, 1500)
}
onMounted(() => {
data.value = uni.getStorageSync('reviewData');
console.log("🚀 ~ ~ data.value: ", data.value);
})
</script>
<style lang="scss" scoped>
.FlexBox {
@ -171,10 +200,39 @@ onMounted(() => {
margin-bottom: 20rpx;
}
.ValueBox {
font-size: 24rpx;
color: #666;
}
.LabelBox {
font-size: 24rpx;
color: #333;
font-weight: bold;
margin-bottom: 20rpx;
}
.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;
}
}
.reviewStatusTag {
margin-bottom: 16rpx;
}
.radioBox {
margin-top: 8rpx;
}
}
@ -219,14 +277,50 @@ onMounted(() => {
padding: 20rpx;
}
.FootBox {
display: flex;
align-items: center;
justify-content: center;
gap: 20rpx;
padding: 20rpx;
background-color: #fff;
font-weight: bold;
}
.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;
}
.FootBox {
display: flex;
align-items: center;
justify-content: center;
gap: 20rpx;
padding: 20rpx;
background-color: #fff;
font-weight: bold;
}
}
</style>

View File

@ -7,9 +7,9 @@
<view class="ShadeBox">
<view class="FlexBox" style="justify-content: space-between;">
<view class="fw-600">{{ item.name }}</view>
<u-tag v-if="item.reviewStatus == 0" text="待复核" type="warning" plain></u-tag>
<u-tag v-if="item.reviewStatus == 1" text="合格" type="success" plain></u-tag>
<u-tag v-if="item.reviewStatus == 2" text="不合格" type="success" plain></u-tag>
<u-tag v-if="item.reviewStatus == '0'" text="待复核" type="warning" plain></u-tag>
<u-tag v-if="item.reviewStatus == '1'" text="合格" type="success" plain></u-tag>
<u-tag v-if="item.reviewStatus == '2'" text="不合格" type="success" plain></u-tag>
</view>
<view class="FlexBox">
<view class="imgBox">
@ -31,11 +31,11 @@
</view>
</template>
<script setup>
import {ref, watch} from 'vue'
import { ref, watch, onMounted, onUnmounted } from 'vue'
import _day from 'dayjs'
import api from '@/api/modules/project'
const {projectId} = defineProps({
const { projectId } = defineProps({
projectId: {
type: String,
default: ''
@ -46,9 +46,9 @@ const dataSource = ref([])
const getPendingReview = async () => {
const res = await api.pendingReview(projectId)
if (res.code === 200){
if (res.code === 200) {
dataSource.value = res.rows
}else {
} else {
uni.showToast({
title: res.msg,
icon: 'none'
@ -56,17 +56,34 @@ const getPendingReview = async () => {
}
}
//
const handleReviewSuccess = () => {
getPendingReview()
}
//
const goReview = (item) => {
uni.setStorageSync('reviewData', item);
uni.setStorageSync('intelligentizeItem', {
id: item.id,
name: item.name,
imgUrl: item.imgUrl,
reviewStatus: item.reviewStatus // 0 1 2
})
uni.navigateTo({
url: '/pages/Intelligentize/index'
url: '/pages/Intelligentize/index?id=' + item.id
})
}
watch(() => projectId, (newValue, oldValue) => {
getPendingReview()
},{immediate: true})
}, { immediate: true })
onMounted(() => {
uni.$on('intelligentize-review-success', handleReviewSuccess)
})
onUnmounted(() => {
uni.$off('intelligentize-review-success', handleReviewSuccess)
})
</script>
<style lang="scss" scoped>