bonus-checkVerify-app/pages/verify/checkingDetails.vue

205 lines
5.9 KiB
Vue

<template>
<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
<view class="page">
<view class="order-Info">
<view class="protection-name">{{paramsData.protectionName}}</view>
<view style="margin-left: 20px;"><text style="font-weight: bold;">定值单编号:</text> <text>{{paramsData.protectionCode}}</text></view>
<view style="margin-left: 20px;"><text style="font-weight: bold;">设备所属:</text> <text>{{paramsData.deviceName}}</text></view>
<view style="margin-left: 20px;"><text style="font-weight: bold;">一次设备名称:</text> <text>{{paramsData.oneDevice}}</text></view>
<view style="margin-left: 20px;"><text style="font-weight: bold;">保护装置名称:</text> <text>{{paramsData.protectionDevice}}</text></view>
<view style="margin-left: 20px;"><text style="font-weight: bold;">保护装置型号:</text> <text>{{paramsData.protectionDeviceModel}}</text></view>
</view>
<view class="mid-view">
<view style="font-weight: bold;font-size: 32rpx;">数据核对</view>
<view class="btn-view" @click="goOcrScan">ocr识别</view>
</view>
<scroll-view style="width: 100%;height: 60vh;background: #000;" scroll-y="true">
<view class="sub-item" v-for="item in scanResultList">
<view class="item-view">
<view style="width: 50%;word-break: break-all;" v-if="item.state==1">序号:{{item.num}}</view>
<view style="width: 50%;word-break: break-all;" v-else>序号:无</view>
<view style="width: 50%;word-break: break-all;"v-if="item.state==0">识别结果:不一致</view>
<view style="width: 50%;word-break: break-all;"v-if="item.state==1">识别结果:一致</view>
</view>
<view class="item-view">
<view style="width: 100%;word-break: break-all;">定值类型:{{item.typeName}}</view>
</view>
<view class="item-view">
<view style="width: 100%;word-break: break-all;">定值名称:{{item.checkName}}</view>
</view>
<view class="item-view">
<view style="width: 50%;word-break: break-all;">解析值:{{item.attributeValue}}</view>
<view style="width: 50%;word-break: break-all;">识别值:{{item.checkValue}}</view>
</view>
</view>
</scroll-view>
<view class="confirm-btn" @click="handleConfirm">
<text style="color: #FFF;">确认提交</text>
</view>
</view>
</template>
<script>
import { getProdectionInfoByIdApi,protectionAnalysisCheckResultApi,confirmAnalysisApi } from '@/api/protection/index.js'
export default {
data() {
return {
fontValue:uni.getStorageSync('fontSize') || 8,
paramsData:{},
//解析结果
scanResultList:[],
}
},
onLoad(options) {
console.log(options)
this.paramsData = JSON.parse(options.params)
console.log(this.paramsData)
if(options.analysisId&&options.analysisId!=""){
this.analysisId = options.analysisId
}else{
this.analysisId = ""
}
},
onShow() {
if(this.analysisId&&this.analysisId!=""){
this.getOrderDetail()
}
},
methods: {
async getOrderDetail() {
try {
console.log(this.paramsData)
console.log(this.analysisId)
let param = {
"protectionId":this.paramsData.protectionId,
"analysisId":this.analysisId
}
const res = await protectionAnalysisCheckResultApi(param)
console.log('?? ~ getList ~ res:', res)
this.scanResultList = res.data;
} catch (error) {
console.log(error)
}
},
goOcrScan(){
uni.navigateTo({
url: `/pages/verify/deviceOcrScan?protectionId=${this.paramsData.protectionId}&params=${JSON.stringify(this.paramsData)}`
})
},
async handleConfirm() {
try {
if(this.analysisId&&this.analysisId!=""){
let params = {
analysisId:this.analysisId
}
console.log(params)
const res = await confirmAnalysisApi(params)
console.log('?? ~ getList ~ res:', res)
if(res.code==200){
uni.showToast({
title: '提交成功',
icon: 'success', // 可以是 'success', 'loading', 'none' 等
});
uni.switchTab({
url: `/pages/work/index`
})
}else{
uni.showToast({
title: '提交失败',
icon: 'success', // 可以是 'success', 'loading', 'none' 等
duration: 2000 // 显示时间,单位为毫秒
});
}
}else{
uni.showToast({
title: '无识别记录无法提交!',
icon: 'success', // 可以是 'success', 'loading', 'none' 等
});
}
} catch (error) {
console.log(error)
}
},
}
}
</script>
<style lang="scss" scoped>
.page {
background: #fff;
padding: 16px;
height: 95vh;
color: #000;
}
.order-Info{
width: 96%;
height: auto;
margin: 10px auto;
background: #eee;
padding: 20rpx;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
// align-items: center;
}
.protection-name{
width: 100%;text-align: center;font-size: 32rpx;font-weight: bold;margin-bottom: 20rpx;
}
.mid-view{
width: 96%;
height: auto;
margin: 0px auto;
margin-bottom: 10rpx;
display: flex;
justify-content: space-between;
}
.btn-view{
width: 180rpx;
height: 72rpx;
background: #4b8eff;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
border-radius: 12rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
}
.sub-item{
width: 96%;
height: auto;
margin: 10px auto;
background: #eee;
padding: 20rpx;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 20rpx;
}
.item-view{
width: 100%;
display: flex;
justify-content: space-between;
}
.item-text-view{
width: 49%;
}
.confirm-btn{
width: 100%;
height: 80rpx;
display: flex;justify-content: center;align-items: center;
margin: 20px auto;
background: #4b8eff;
color: #fff;
font-size: 32rpx;
font-weight: 600;
border-radius: 12rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
}
</style>