Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
c007b3f2ff
|
|
@ -1,4 +1,6 @@
|
|||
import {get, post} from '../request'
|
||||
import { get, post } from '../request'
|
||||
|
||||
export default {
|
||||
// 提交复核结果
|
||||
submitIntelligentize: (data) => post('/manage/contractor/videoDetection/review', data),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue