1602 lines
42 KiB
Vue
Raw Normal View History

<template>
<view class="qualitySpringback">
<headers :showBack="true">
<view class="headerName">
测量数据
</view>
</headers>
<view class="content">
<view class="top_wrap ">
<view class="title">·构件信息·</view>
<view class="storey_info">
<view class="flex2">
<text>测量楼栋: </text>
<text>{{buildName}}#</text>
</view>
<view class="flex2">
<text>测量楼层: </text>
<text>{{floorName}}F</text>
</view>
</view>
<view class="flex2 soil_value" v-if="detailId">
<view class="soil_type" style="width: 53%;">混凝土强度<text>{{form.surveyStrength}}</text></view>
<view class="soil_type" style="width: 47%;">测量结果<text>{{form.resultType==1?'合格':'不合格'}}</text></view>
</view>
</view>
<view class="measure_data">
<view class="title">·数据测量·</view>
<view class="measure_content">
<view class="flex2" style="margin:0px 0 20rpx">
<view style="font-size:30rpx;color:#372D66;width: 40%;position: relative;">
测量类型:
<uni-icons2 type="help" size="14" @click="showDetail = true"></uni-icons2>
<view v-show="showDetail" class="info_detail">
高强回弹仪 测量范围 C20-C100适用范围C50-C100
<uni-icons2 class="close_btn" type="closeempty" size="14" @click="showDetail = false"></uni-icons2>
</view>
</view>
<picker :disabled="detailId!=''" class="picker" @change="pickerChangeType" :value="typeIndex" :range="optionList3"
range-key="name">
<view class="uni-input">{{optionList3[typeIndex].name}}</view>
<uni-icons2 class="arrowdown" type="arrowdown"></uni-icons2>
</picker>
</view>
<view v-if="typeIndex!= 2" class="flex2" style="margin:0px 0 20rpx">
<view style="font-size:30rpx;color:#372D66;width: 40%">测量角度: </view>
<picker :disabled="detailId!=''" class="picker" @change="pickerChangeFloor" :value="angleIndex" :range="optionList"
range-key="name">
<view class="uni-input">{{optionList[angleIndex].name}}</view>
<uni-icons2 class="arrowdown" type="arrowdown"></uni-icons2>
</picker>
</view>
<view v-else-if="typeIndex == 2" class="flex2" style="margin:0px 0 20rpx">
<view style="font-size:30rpx;color:#372D66;width: 40%">测量角度: </view>
<picker :disabled="typeIndex == 2" class="picker" :value="0" :range="optionList"
range-key="name">
<view class="uni-input">水平0°</view>
<uni-icons2 class="arrowdown" type="arrowdown"></uni-icons2>
</picker>
</view>
<view v-if="typeIndex != 2" class="flex2" style="margin:0px 0 20rpx">
<view style="font-size:30rpx;color:#372D66;width: 40%;">测区混凝土类型: </view>
<picker :disabled="detailId!=''" class="picker" @change="pickerChangeConcreteType" :value="concreteType"
:range="concreteTypeList" range-key="name">
<view class="uni-input">{{concreteTypeList[concreteType].name}}</view>
<uni-icons2 class="arrowdown" type="arrowdown"></uni-icons2>
</picker>
</view>
<view v-else-if="typeIndex == 2" class="flex2" style="margin:0px 0 20rpx">
<view style="font-size:30rpx;color:#372D66;width: 40%;">测区混凝土类型: </view>
<picker :disabled="typeIndex == 2" class="picker" value=""
:range="concreteTypeList" range-key="name">
<view class="uni-input">动能4.5J回弹仪测区强度换算</view>
<uni-icons2 class="arrowdown" type="arrowdown"></uni-icons2>
</picker>
</view>
<view class="flex2" style="margin:0px 0 40rpx">
<view style="font-size:30rpx;color:#372D66;width: 40%">设计强度: </view>
<picker :disabled="detailId!=''" class="picker" @change="pickerChangeStrength" :value="strengthIndex"
:range="optionList2" range-key="name">
<view class="uni-input">{{optionList2[strengthIndex].name}}</view>
<uni-icons2 class="arrowdown" type="arrowdown"></uni-icons2>
</picker>
</view>
<view class="flex3">
<view class="table flex4">
<ul class="table_box">
<li :class="colorIndexArr.indexOf(1)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,1)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue1" /></li>
<li :class="colorIndexArr.indexOf(5)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,5)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue5" /></li>
<li :class="colorIndexArr.indexOf(9)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,9)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue9" /></li>
<li :class="colorIndexArr.indexOf(13)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,13)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue13" /></li>
</ul>
<ul class="table_box">
<li :class="colorIndexArr.indexOf(2)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,2)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue2" /></li>
<li :class="colorIndexArr.indexOf(6)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,6)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue6" /></li>
<li :class="colorIndexArr.indexOf(10)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,10)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue10" /></li>
<li :class="colorIndexArr.indexOf(14)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,14)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue14" /></li>
</ul>
<ul class="table_box">
<li :class="colorIndexArr.indexOf(3)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,3)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue3" /></li>
<li :class="colorIndexArr.indexOf(7)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,7)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue7" /></li>
<li :class="colorIndexArr.indexOf(11)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,11)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue11" /></li>
<li :class="colorIndexArr.indexOf(15)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,15)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue15" /></li>
</ul>
<ul class="table_box">
<li :class="colorIndexArr.indexOf(4)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,4)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue4" /></li>
<li :class="colorIndexArr.indexOf(8)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,8)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue8" /></li>
<li :class="colorIndexArr.indexOf(12)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,12)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue12" /></li>
<li :class="colorIndexArr.indexOf(16)!=-1?'red':''"><input class="uni-input"
@input="(e)=>reboundValue(e,16)" disabled placeholder-style="font-size:24rpx"
placeholder="--" v-model="table.reboundValue16" /></li>
</ul>
</view>
<view class="measure_right">
<view>
<view>{{form.reboundAvgValue}}</view>
<view>回弹平均值</view>
<!-- <view class="start_btn start_btn2" @click="send('24535253F8230D0A')">开始采集</view> -->
</view>
</view>
</view>
</view>
<view v-if="typeIndex != 2" class="title" style="margin-bottom: 20rpx;">·碳化深度·</view>
<view v-if="typeIndex != 2" class="flex2 depth_wrap">
<view class="depth" style="width: 22%;"><input class="uni-input" placeholder-style="font-size:24rpx"
placeholder="--" @input="(e)=>changeCarbonation(e,1)"
v-model="carbonation.carbonationDepth1" />
</view>
<view class="depth" style="width: 22%;"><input class="uni-input" placeholder-style="font-size:24rpx"
placeholder="--" @input="(e)=>changeCarbonation(e,2)"
v-model="carbonation.carbonationDepth2" />
</view>
<view class="depth" style="width: 22%;"><input class="uni-input" placeholder-style="font-size:24rpx"
placeholder="--" @input="(e)=>changeCarbonation(e,3)"
v-model="carbonation.carbonationDepth3" />
</view>
<view class="depth" style="width: 44%;">平均值: {{form.carbonationDepthAvg}}</view>
</view>
<view class="start_wrap" v-if="resultType!=1&&editId!=''">
<view class="start_btn" @click="measureAgainFn">重新测量构件</view>
</view>
<view class="start_wrap">
<view class="start_btn" @click="saveBtn">保存</view>
</view>
</view>
</view>
<dialogs ref="dialogs">
<template v-slot:content>
<view class="dialogTitle">
测强结果
</view>
<view class="formBox2">
<view class="circleBox" v-if="!isoutline" :class="resultType==1?'':'red'">
<view class="num">
{{surveyStrength}}
</view>
<view class="txt">
{{resultType==1?'合格':'不合格'}}
</view>
</view>
<view v-else>当前处于离线状态待网络通畅后再上传数据</view>
<view class="start_wrap">
<view class="start_btn" @click="backFn">测量下一个构件</view>
</view>
<view class="closeBtn" @click="backToHome">
返回到首页
</view>
</view>
</template>
</dialogs>
</view>
</template>
<script>
import { jsonData } from './js/jsonData.js'
import { angleJsonData } from './js/angleJsonData.js'
import dialogs from "../../../components/dialog/dialog.vue"
import {
writeBLE
} from '@/static/js/BLEConn.js';
export default {
components: {
dialogs
},
data() {
return {
showDetail: false,
jsonData: jsonData,
angleJsonData: angleJsonData,
surveyStrength: 0,
resultType: 2,//2不合格 1合格
buildName: '',
floorName: '',
typeIndex: 0,
optionList3:[{
name: '请选择',
value: ''
},{
name: '普通设备',
value: 1
},{
name: '高强设备',
value: 2
}],
optionList: [{
name: '请选择',
value: ''
},{
name: '向上90°',
value: 90
},
{
name: '向上60°',
value: 60
},
{
name: '向上45°',
value: 45
},
{
name: '向上30°',
value: 30
},
{
name: '水平0°',
value: 0
},
{
name: '向下30°',
value: -30
},
{
name: '向下45°',
value: -45
},
{
name: '向下60°',
value: -60
},
{
name: '向下90°',
value: -90
},
],
optionList2: [
// {
// name: 'C7.5',
// value: 'C7.5'
// },
// {
// name: 'C10',
// value: 'C10'
// },
{
name: '请选择',
value: ''
},
{
name: 'C15',
value: 'C15'
},
{
name: 'C20',
value: 'C20'
},
{
name: 'C25',
value: 'C25'
},
{
name: 'C30',
value: 'C30'
},
{
name: 'C35',
value: 'C35'
},
{
name: 'C40',
value: 'C40'
},
{
name: 'C45',
value: 'C45'
}, {
name: 'C50',
value: 'C50'
}, {
name: 'C55',
value: 'C55'
}, {
name: 'C60',
value: 'C60'
},
],
concreteTypeList: [{
name: '请选择',
value: ''
},{
name: '非泵送混凝土',
value: 1
},
{
name: '泵送混凝土',
value: 2
},
],
strengthIndex: 0,
concreteType: 0,
angleIndex: 0,
form: {
angle: 0,
floorId: '',
coordinateX: '',
coordinateY: '',
projectSn: '',
reboundAvgValue: 0,
carbonationDepthAvg: 0,
surveyType: 1,
measureDevType: 1,
designStrength: 'C15'
},
table: {
// reboundValue1: 0,
// reboundValue2: 1,
// reboundValue3: 2,
// reboundValue4: 7,
// reboundValue5: 10,
// reboundValue6: 5,
// reboundValue7: 6,
// reboundValue8: 7,
// reboundValue9: 5,
// reboundValue10: 11,
// reboundValue11: 4,
// reboundValue12: 0,
// reboundValue13: 0,
// reboundValue14: 1,
// reboundValue15: 2,
// reboundValue16: 3,
reboundValue1: '',
reboundValue2: '',
reboundValue3: '',
reboundValue4: '',
reboundValue5: '',
reboundValue6: '',
reboundValue7: '',
reboundValue8: '',
reboundValue9: '',
reboundValue10: '',
reboundValue11: '',
reboundValue12: '',
reboundValue13: '',
reboundValue14: '',
reboundValue15: '',
reboundValue16: '',
},
carbonation: {
carbonationDepth1: "",
carbonationDepth2: "",
carbonationDepth3: "",
},
dataIndex: 1,
colorIndexArr: [],
detailId:'',
editId:'',
isoutline: false,
isTest: false
}
},
onLoad(option) {
console.log(jsonData)
console.log((option))
this.buildName = option.buildName;
this.floorName = option.floorName;
this.form.floorId = option.floorId;
this.form.coordinateX = option.coordinateX;
this.form.coordinateY = option.coordinateY;
this.form.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
if(uni.getStorageSync('oldObj')){
// let obj = {
// typeIndex: that.typeIndex,
// angleIndex: that.angleIndex,
// concreteType: that.concreteType,
// strengthIndex: that.strengthIndex
// }
console.log(uni.getStorageSync('oldObj'))
let obj = uni.getStorageSync('oldObj')
this.form.measureDevType = obj.typeIndex
this.typeIndex = obj.typeIndex
this.angleIndex = obj.angleIndex,
this.concreteType = obj.concreteType,
this.strengthIndex = obj.strengthIndex
if(this.typeIndex == 2){
this.optionList2 = [{
name: '请选择',
value: ''
},{
name: 'C20',
value: 'C20'
},
{
name: 'C25',
value: 'C25'
},
{
name: 'C30',
value: 'C30'
},
{
name: 'C35',
value: 'C35'
},
{
name: 'C40',
value: 'C40'
},
{
name: 'C45',
value: 'C45'
}, {
name: 'C50',
value: 'C50'
}, {
name: 'C55',
value: 'C55'
}, {
name: 'C60',
value: 'C60'
},{
name: 'C65',
value: 'C65'
},{
name: 'C70',
value: 'C70'
},{
name: 'C75',
value: 'C75'
},{
name: 'C80',
value: 'C80'
},{
name: 'C85',
value: 'C85'
},{
name: 'C90',
value: 'C90'
},{
name: 'C95',
value: 'C95'
},{
name: 'C100',
value: 'C100'
}]
this.form.angle = 0
} else {
this.form.angle = this.optionList[this.angleIndex].value;
}
this.form.surveyType = this.concreteTypeList[this.concreteType].value
this.form.designStrength = this.optionList2[this.strengthIndex].value
// this.pickerChangeType({detail: uni.getStorageSync('measureDevType') - 1})
} else {
this.typeIndex = 0
this.angleIndex = 0
this.concreteType = 0
this.strengthIndex = 0
}
// setTimeout(() => {
// this.calculate();
// this.carbonationFn();
// }, 2000)
if(option.id){
this.detailId=option.id
this.editId=option.id
this.getDetails(option.id)
}else{
this.startSpringback()
}
// this.measureBtn()
if(option.isTest == 'true'){
this.isTest = true
}
},
mounted() {
// this.$refs.dialogs.showFn()
},
onUnload() {
this.stopGetData()
},
methods: {
getResult(data){
console.log(data)
// let obj = {
// carbonationDepthAvg: 1,
// reboundAvgValue: 19.0,
// designStrength: 'C20',
// measureDevType: 1,
// surveyType: 2,
// angle: 0
// }
let obj = data
if(obj.measureDevType == 2){
let result = 0.0079*obj.reboundAvgValue*obj.reboundAvgValue+0.75*obj.reboundAvgValue-7.83
this.surveyStrength = parseInt(result*100)/100
this.resultType = result >= obj.designStrength.split('C')[1] ? 1:2
this.editId=''
this.$refs.dialogs.showFn()
console.log(result,obj.designStrength.split('C'))
}else if(obj.measureDevType == 1){
if(obj.angle != 0 && obj.reboundAvgValue >= 20 && obj.reboundAvgValue <= 50){
obj.reboundAvgValue = this.getReboundAvgValue(obj.angle,obj.reboundAvgValue)
}
// 非泵送混凝土
if(obj.surveyType == 1){
if(obj.reboundAvgValue < 20){
this.surveyStrength = '小于10'
this.resultType = 2
this.$refs.dialogs.showFn()
} else if (obj.reboundAvgValue > 60){
this.surveyStrength = '大于60'
this.resultType = 1
this.$refs.dialogs.showFn()
} else {
let arr = this.jsonData.RECORDS.filter(item=>item.type == 1)
let arr2 = arr.filter(item=>item.rebound_avg_value == obj.reboundAvgValue || (item.rebound_avg_value < obj.reboundAvgValue && item.rebound_avg_value+0.1 >= obj.reboundAvgValue) || (item.rebound_avg_value > obj.reboundAvgValue && item.rebound_avg_value-0.1 <= obj.reboundAvgValue))
// console.log(arr2)
if(arr2 && arr2.length == 1){
let val = this.getCarbonationKey(obj.carbonationDepthAvg,arr2[0])
console.log(val)
if(val == 'up'){
this.surveyStrength = '大于60'
this.resultType = 1
this.$refs.dialogs.showFn()
} else if(val == 'down'){
this.surveyStrength = '小于10'
this.resultType = 2
this.$refs.dialogs.showFn()
} else {
this.surveyStrength = val
this.resultType = val >= obj.designStrength.split('C')[1] ? 1:2
this.$refs.dialogs.showFn()
}
} else if(arr2.length == 2){
let x = this.getCarbonationKey(obj.carbonationDepthAvg,arr2[0])
let y = this.getCarbonationKey(obj.carbonationDepthAvg,arr2[1])
if(x == 'down' || y == 'down'){
this.surveyStrength = '小于10'
this.resultType = 2
this.$refs.dialogs.showFn()
} else if(x == 'up' || y == 'up'){
this.surveyStrength = '大于60'
this.resultType = 1
this.$refs.dialogs.showFn()
} else {
let val = (y-x)*(obj.reboundAvgValue-arr2[0].rebound_avg_value)/(arr2[1].rebound_avg_value - arr2[0].rebound_avg_value)+x
this.surveyStrength = val.toFixed(2)
this.resultType = val >= obj.designStrength.split('C')[1] ? 1:2
this.$refs.dialogs.showFn()
console.log(val.toFixed(2))
}
}
}
} else if(obj.surveyType == 2){
if(obj.reboundAvgValue < 18.6){
this.surveyStrength = '小于10'
this.resultType = 2
this.$refs.dialogs.showFn()
} else if (obj.reboundAvgValue > 52.8){
this.surveyStrength = '大于60'
this.resultType = 1
this.$refs.dialogs.showFn()
} else {
let arr = this.jsonData.RECORDS.filter(item=>item.type == 2)
let arr2 = arr.filter(item=>item.rebound_avg_value == obj.reboundAvgValue || (item.rebound_avg_value < obj.reboundAvgValue && item.rebound_avg_value+0.1 >= obj.reboundAvgValue) || (item.rebound_avg_value > obj.reboundAvgValue && item.rebound_avg_value-0.1 <= obj.reboundAvgValue))
console.log(arr2)
if(arr2 && arr2.length == 1){
let val = this.getCarbonationKey(obj.carbonationDepthAvg,arr2[0])
console.log(val)
if(val == 'up'){
this.surveyStrength = '大于60'
this.resultType = 1
this.$refs.dialogs.showFn()
} else if(val == 'down'){
this.surveyStrength = '小于10'
this.resultType = 2
this.$refs.dialogs.showFn()
} else {
this.surveyStrength = val
this.resultType = val >= obj.designStrength.split('C')[1] ? 1:2
this.$refs.dialogs.showFn()
}
} else if(arr2.length == 2){
let x = this.getCarbonationKey(obj.carbonationDepthAvg,arr2[0])
let y = this.getCarbonationKey(obj.carbonationDepthAvg,arr2[1])
if(x == 'down' || y == 'down'){
this.surveyStrength = '小于10'
this.resultType = 2
this.$refs.dialogs.showFn()
} else if(x == 'up' || y == 'up'){
this.surveyStrength = '大于60'
this.resultType = 1
this.$refs.dialogs.showFn()
} else {
let val = (y-x)*(obj.reboundAvgValue-arr2[0].rebound_avg_value)/(arr2[1].rebound_avg_value - arr2[0].rebound_avg_value)+x
this.surveyStrength = val.toFixed(2)
this.resultType = val >= obj.designStrength.split('C')[1] ? 1:2
this.$refs.dialogs.showFn()
console.log(val.toFixed(2))
}
}
}
}
}
// console.log(data)
// console.log(jsonData)
},
// 获取计算值
getCarbonationKey(carbonationDepthAvg,val){
let result = ''
console.log(carbonationDepthAvg)
switch(carbonationDepthAvg) {
case 0:
result = val.carbonation_depth_zero == -2 ? 'up':val.carbonation_depth_zero == -1 ? 'down':val.carbonation_depth_zero
break;
case 0.5:
result = val.carbonation_depth_zero_point_five == -2 ? 'up':val.carbonation_depth_zero_point_five == -1 ? 'down':val.carbonation_depth_zero_point_five
break;
case 1:
result = val.carbonation_depth_one == -2 ? 'up':val.carbonation_depth_one == -1 ? 'down':val.carbonation_depth_one
break;
case 1.5:
result = val.carbonation_depth_one_point_five == -2 ? 'up':val.carbonation_depth_one_point_five == -1 ? 'down':val.carbonation_depth_one_point_five
break;
case 2:
result = val.carbonation_depth_two == -2 ? 'up':val.carbonation_depth_two == -1 ? 'down':val.carbonation_depth_two
break;
case 2.5:
result = val.carbonation_depth_two_point_five == -2 ? 'up':val.carbonation_depth_two_point_five == -1 ? 'down':val.carbonation_depth_two_point_five
break;
case 3:
return val.carbonation_depth_three == -2 ? 'up':val.carbonation_depth_three == -1 ? 'down':val.carbonation_depth_three
break;
case 3.5:
result = val.carbonation_depth_three_point_five == -2 ? 'up':val.carbonation_depth_three_point_five == -1 ? 'down':val.carbonation_depth_three_point_five
break;
case 4:
result = val.carbonation_depth_four == -2 ? 'up':carbonation_depth_four == -1 ? 'down':val.carbonation_depth_four
break;
case 4.5:
result = val.carbonation_depth_four_point_five == -2 ? 'up':val.carbonation_depth_four_point_five == -1 ? 'down':val.carbonation_depth_four_point_five
break;
case 5:
result = val.carbonation_depth_five == -2 ? 'up': val.carbonation_depth_five == -1 ? 'down': val.carbonation_depth_five
break;
case 5.5:
result = val.carbonation_depth_five_point_five == -2 ? 'up':val.carbonation_depth_five_point_five == -1 ? 'down':val.carbonation_depth_five_point_five
break;
case 6:
result = val.carbonation_depth_six == -2 ? 'up':val.carbonation_depth_six == -1 ? 'down':val.carbonation_depth_six
break;
default:
if(carbonationDepthAvg > 6){
result = val.carbonation_depth_six == -2 ? 'up':val.carbonation_depth_six == -1 ? 'down':val.carbonation_depth_six
} else {
result = ''
}
break;
}
return result
},
// 计算角度差值
getReboundAvgValue(angle,val){
console.log(angle,val,this.angleJsonData.RECORDS)
let result = ''
let a = this.angleJsonData.RECORDS.filter(item=>item.rebound_avg_value == val || (item.rebound_avg_value < val && item.rebound_avg_value+1 > val) || (item.rebound_avg_value > val && item.rebound_avg_value-1 < val))
if(a && a.length>0 && a.length == 1){
console.log(this.getVal(angle,a[0]))
result = Number(val)+Number(this.getVal(angle,a[0]))
console.log(result)
} else if(a && a.length>0 && a.length == 2){
let x = this.getVal(angle,a[0])
let y = this.getVal(angle,a[1])
console.log((y-x)*(val-val-1))
let b = (y-x)*(val-a[0].rebound_avg_value)/(a[1].rebound_avg_value - a[0].rebound_avg_value)+x
result = val+b
}
console.log(a,result)
return result
},
// 从Json中获取角度差值
getVal(angle,val){
console.log(angle,val)
let result = ''
switch(angle) {
case 90:
result = val.up90
break;
case 60:
result = val.up60
break;
case 45:
result = val.up45
break;
case 30:
result = val.up30
break;
case -30:
result = val.down30
break;
case -45:
result = val.down45
break;
case -60:
return val.down60
break;
case -90:
result = val.down90
break;
default:
result = ''
break;
}
return result
},
showInfo(){
// this.$refs.dialogs2.showFn()
},
saveBtn(){
this.measureBtn()
},
//开启回弹采集
startSpringback(){
this.send('24535253F8230D0A')
// this.send('dt')
//监听接收数据事件
uni.$on('recvEvent', this.reviceDevData)
},
//重新测量
measureAgainFn(){
this.table={
reboundValue1: '',
reboundValue2: '',
reboundValue3: '',
reboundValue4: '',
reboundValue5: '',
reboundValue6: '',
reboundValue7: '',
reboundValue8: '',
reboundValue9: '',
reboundValue10: '',
reboundValue11: '',
reboundValue12: '',
reboundValue13: '',
reboundValue14: '',
reboundValue15: '',
reboundValue16: '',
}
this.colorIndexArr=[]
this.dataIndex = 1
this.form.reboundAvgValue = 0;
if(this.detailId!=''){
this.editId=this.detailId
this.detailId=''
}
this.startSpringback()
},
getDetails(id){
this.sendRequest({
url: 'xmgl/massReboundSurveyArea/queryById',
method: 'post',
data: {
id: id
},
success: res => {
this.form=res.result
this.table=res.result
this.optionList2.forEach((element,index)=>{
if(this.form.designStrength==element.name){
this.strengthIndex=index;
}
})
this.optionList.forEach((element,index)=>{
if(this.form.angle==element.value){
this.angleIndex=index;
}
})
this.concreteType=this.form.surveyType-1
}
})
},
//停止回弹
stopGetData(){
console.log('停止回弹')
uni.$off('recvEvent');
this.send('24455253EA230D0A')
// this.send('dt')
},
backToHome() {
uni.navigateBack({
delta: 3
})
},
// 4. 发送数据
async send(data) {
//格式检查
// if (!this.sendData) {
// uni.showToast({
// title: '数据不能为空'
// })
// return
// }
// uni.showLoading({
// title: '正在发送数据',
// icon: "loading",
// mask: true
// })
console.log(data,'data')
await writeBLE(data).then(res => {
console.log('发送数据成功',res)
// uni.hideLoading()
// uni.showToast({
// title: '发送成功:' + res
// })
}).catch(err => {
// uni.hideLoading()
uni.showToast({
title: '开启采集数据失败',
icon: 'none'
})
})
},
reviceDevData(e) {
console.log('设备返回的数据')
console.log(e)
var arr = e.split('"')
var arrLrk = e.split(';')
if (arr[0] == '$RRD') {
this.table['reboundValue' + this.dataIndex] = arr[1]
this.calculate()
this.dataIndex++
// if (this.dataIndex > 16) {
if (this.dataIndex == 17) {
this.stopGetData()
// this.measureBtn()
}
}
if(arrLrk.length > 0 && arrLrk[0] == '$GLODON$'){
let valIndex = arrLrk[1].indexOf(':')
console.log(arrLrk[1].substr(valIndex + 1))
}
},
//新增
measureBtn() {
let state1 = true
let state2 = true
Object.values(this.table).map((item, index) => {
if (item == "" || item == null) {
state2 = false
}
})
if(this.typeIndex != 2){
Object.values(this.carbonation).map((item,index)=>{
console.log(item)
if(item == "" || item == null){
state1 = false
}
})
console.log(this.carbonation,state1)
}
if(!this.typeIndex){
uni.showToast({
title:'请选择测量类型',
icon:"none"
})
return
}
if(!this.angleIndex && this.typeIndex != 2){
uni.showToast({
title:'请选择测量角度',
icon:"none"
})
return
}
if(!this.concreteType && this.typeIndex != 2){
uni.showToast({
title:'请选择混凝土类型',
icon:"none"
})
return
}
if(!this.strengthIndex){
uni.showToast({
title:'请选择设计强度',
icon:"none"
})
return
}
if(!state1){
uni.showToast({
title:'请输入碳化深度',
icon:"none"
})
return
}
if (!state2) {
uni.showToast({
title: '请采集混凝土强度',
icon: "none"
})
return
}
if(this.typeIndex == 2){
this.carbonation.carbonationDepth1 = 0
this.carbonation.carbonationDepth2 = 0
this.carbonation.carbonationDepth3 = 0
this.form.carbonationDepthAvg = 0
this.form.surveyType = 3
this.form.angle = 0
}
let data = Object.assign(this.form, this.carbonation, this.table); //合并对象
// console.log('保存的数据')
// console.log(JSON.stringify(data))
// console.log(JSON.stringify(this.table))
let url = 'xmgl/massReboundSurveyArea/add'
if(this.editId){
url='xmgl/massReboundSurveyArea/saveAnewSurvey'
data.id=this.editId
}
let that = this
// console.log(data)
if(this.isTest){
data.opType = 1
} else {
data.opType = 0
}
uni.getNetworkType({
success: function (res) {
// console.log(res.networkType);
if(res.networkType == 'none'){
if(that.isTest){
that.getResult(data)
} else {
let outLineData = []
if(uni.getStorageSync('outLineData')){
outLineData = JSON.parse(uni.getStorageSync('outLineData'))
}
outLineData.push(data)
let obj = {
typeIndex: that.typeIndex,
angleIndex: that.angleIndex,
concreteType: that.concreteType,
strengthIndex: that.strengthIndex
}
// uni.setStorageSync('oldObj', obj);
// uni.setStorageSync('outLineData', JSON.stringify(outLineData));
console.log(outLineData)
that.isoutline = true
that.$refs.dialogs.showFn()
}
} else{
that.isoutline = false
that.sendRequest({
url: url,
method: 'post',
data: data,
success: (res) => {
if (res.code == 200) {
console.log('res.result', res.result)
that.surveyStrength = res.result.surveyStrength
that.resultType = res.result.resultType
that.editId=res.result.id
let obj = {
typeIndex: that.typeIndex,
angleIndex: that.angleIndex,
concreteType: that.concreteType,
strengthIndex: that.strengthIndex
}
uni.setStorageSync('oldObj', obj);
uni.showToast({
title: '保存成功'
})
that.$refs.dialogs.showFn()
}
}
})
}
}
});
},
backFn() {
uni.navigateBack({});
},
// 选择测量类型
pickerChangeType(e){
console.log(e)
this.typeIndex = e.detail.value;
this.form.measureDevType = this.optionList3[this.typeIndex].value;
if(this.typeIndex == 2){
this.strengthIndex = 0
this.form.designStrength = ''
this.optionList2 = [{
name: '请选择',
value: ''
},{
name: 'C20',
value: 'C20'
},
{
name: 'C25',
value: 'C25'
},
{
name: 'C30',
value: 'C30'
},
{
name: 'C35',
value: 'C35'
},
{
name: 'C40',
value: 'C40'
},
{
name: 'C45',
value: 'C45'
}, {
name: 'C50',
value: 'C50'
}, {
name: 'C55',
value: 'C55'
}, {
name: 'C60',
value: 'C60'
},{
name: 'C65',
value: 'C65'
},{
name: 'C70',
value: 'C70'
},{
name: 'C75',
value: 'C75'
},{
name: 'C80',
value: 'C80'
},{
name: 'C85',
value: 'C85'
},{
name: 'C90',
value: 'C90'
},{
name: 'C95',
value: 'C95'
},{
name: 'C100',
value: 'C100'
}]
this.angleIndex = 0
this.concreteType = 0
} else {
this.angleIndex = 0
this.strengthIndex = 0
this.form.designStrength = ''
this.concreteType = 0
this.optionList2 = [{
name: '请选择',
value: ''
},{
name: 'C15',
value: 'C15'
},
{
name: 'C20',
value: 'C20'
},
{
name: 'C25',
value: 'C25'
},
{
name: 'C30',
value: 'C30'
},
{
name: 'C35',
value: 'C35'
},
{
name: 'C40',
value: 'C40'
},
{
name: 'C45',
value: 'C45'
}, {
name: 'C50',
value: 'C50'
}, {
name: 'C55',
value: 'C55'
}, {
name: 'C60',
value: 'C60'
},]
}
},
//选择测量角度
pickerChangeFloor(e) {
this.angleIndex = e.detail.value;
this.form.angle = this.optionList[this.angleIndex].value;
this.table = {
reboundValue1: '',
reboundValue2: '',
reboundValue3: '',
reboundValue4: '',
reboundValue5: '',
reboundValue6: '',
reboundValue7: '',
reboundValue8: '',
reboundValue9: '',
reboundValue10: '',
reboundValue11: '',
reboundValue12: '',
reboundValue13: '',
reboundValue14: '',
reboundValue15: '',
reboundValue16: '',
};
this.form.reboundAvgValue = 0;
this.dataIndex = 1
this.minData = 0
this.minDataLength = 0
this.maxData = 0
this.maxDataLength = 0
},
pickerChangeStrength(e) {
this.strengthIndex = e.detail.value;
this.form.designStrength = this.optionList2[this.strengthIndex].value
},
//混凝土类型
pickerChangeConcreteType(e) {
this.concreteType = e.detail.value;
this.form.surveyType = this.concreteTypeList[this.concreteType].value
},
//输入测量混凝土硬化
reboundValue(e, type) {
// let state = true;
// this.table['reboundValue' + type] = e.detail.value;
// Object.values(this.table).map((item, index) => {
// if (item == "" || item == null) {
// state = false
// }
// })
// if (state) {
// // console.log(e,type)
// this.calculate();
// }
},
//输入碳化深度
changeCarbonation(e, type) {
this.carbonation['carbonationDepth' + type] = e.detail.value;
let state = true;
Object.values(this.carbonation).map((item, index) => {
if (item == "" || item == null) {
state = false
}
})
if (state) {
this.carbonationFn();
}
},
compare(property) {
return function(a, b) {
var value1 = a[property];
var value2 = b[property];
return value1 - value2;
}
},
//计算混凝土强度 平均值
calculate() {
var noSortData = []; //未排序的
var hasSortData = []; //已排序的
this.colorIndexArr=[]
Object.values(this.table).map((value, index) => {
noSortData.push({
value: Number(value),
index: index + 1
})
})
console.log('noSortData', noSortData)
hasSortData = noSortData.sort(this.compare('value'))
console.log('hasSortData', hasSortData)
let arr = [];
hasSortData.forEach((item, index) => {
if (index > 2 && index < 13) {
arr.push(item.value)
} else {
this.colorIndexArr.push(item.index)
}
})
console.log('this.colorIndexArr', this.colorIndexArr)
var len = arr.length;
var sum = 0;
//利用for循环遍历数组的内容利用sum累加求和
for (var i = 0; i < len; i++) {
sum += arr[i];
}
console.log(this.dataIndex)
// this.form.reboundAvgValue = (sum / len).toFixed(1);
// this.form.reboundAvgValue = (sum / this.dataIndex).toFixed(1);
if(this.table.reboundValue16){
this.form.reboundAvgValue = (sum / 10).toFixed(1);
}
},
//碳化 计算平均值
carbonationFn() {
var newData = [];
Object.values(this.carbonation).sort().map(value => {
newData.push(Number(value))
})
console.log(newData)
var len = newData.length;
var sum = 0;
//利用for循环遍历数组的内容利用sum累加求和
for (var i = 0; i < len; i++) {
sum += newData[i];
}
// 小于0.25修约为0大于等于0.25小于0.75的修约为0.5大于等于0.75的修约为1是按数值修约标准来的。
let val = (sum / len).toFixed(2);
let newVal = Number(val.split('.')[0]);
let decimals = Number(val.split('.')[1]);
let num = 0;
if (decimals < 25) {
num = 0;
} else if (decimals >= 25 && decimals < 75) {
num = 50
} else if (decimals >= 75) {
num = 1
}
if (num == 1) {
this.form.carbonationDepthAvg = Number((newVal + num).toFixed(2));
} else {
this.form.carbonationDepthAvg = Number(newVal + '.' + num);
}
},
}
}
</script>
<style scoped lang="scss">
.flex {
display: flex;
align-items: center;
justify-content: space-around;
}
.flex2 {
display: flex;
align-items: center;
}
.flex3 {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex4 {
display: flex;
}
.title {
text-align: center;
line-height: 42rpx;
font-size: 30rpx;
letter-spacing: 1.4px;
color: #2A2B5B;
opacity: 0.4;
}
.content {
padding: 20rpx 30rpx 40rpx;
box-sizing: border-box;
width: 100%;
}
.top_wrap {
width: 100%;
box-sizing: border-box;
padding: 20rpx 26rpx;
background-color: #FBFBFF;
box-shadow: 0 4rpx 20rpx 0 rgba(212, 220, 236, 0.65);
border-radius: 16rpx;
}
.storey_info {
padding: 20rpx 0;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #372D66;
font-size: 30rpx;
line-height: 42rpx;
letter-spacing: 6rpx;
/* border-bottom: 1px solid rgba(42,43,91,0.2); */
}
.soil_value {
width: 100%;
box-sizing: border-box;
flex-wrap: wrap-reverse;
margin: 10rpx 0;
color: rgba(55, 45, 102, 0.6);
}
.soil_type {
font-size: 26rpx;
line-height: 28rpx;
}
.soil_type text {
color: #2A2B5B;
}
.measure_data {
width: 100%;
box-sizing: border-box;
padding: 40rpx 30rpx 20rpx;
margin-top: 30rpx;
box-shadow: 0 4rpx 20rpx 0 rgba(212, 220, 236, 0.65);
border-radius: 16rpx;
}
.measure_content {
width: 100%;
margin: 25px 0;
}
.measure_title {
text-align: center;
margin: 20rpx 0 30rpx;
font-size: 30rpx;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #2A2B5B;
letter-spacing: 1px;
}
.measure_right {
width: 38%;
text-align: center;
font-size: 32rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 500;
color: #372D66;
}
.measure_btn {
padding: 8px 60rpx;
box-sizing: border-box;
border-radius: 60rpx;
color: #fff;
background-color: #4181FE;
}
.depth_wrap {
width: 100%;
border: 1px solid rgba(42, 43, 91, 0.2);
margin-bottom: 60rpx;
}
.depth {
width: 25%;
text-align: center;
line-height: 70rpx;
border-right: 1px solid rgba(42, 43, 91, 0.2);
}
.depth:last-child {
border-right: none;
font-size: 30rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #372D66;
}
.table {
border: 1px solid rgba(42, 43, 91, 0.2);
box-sizing: border-box;
flex-wrap: wrap;
}
.table_box {
width: 85rpx;
list-style: none;
border-right: 1px solid rgba(42, 43, 91, 0.2);
padding: 0;
font-size: 30rpx;
color: #372D66;
font-family: PingFangSC-Regular, PingFang SC;
}
.table_box:last-child {
border-right: none
}
.table_box li {
width: 100%;
height: 73rpx;
text-align: center;
line-height: 73rpx;
border-bottom: solid 1px rgba(42, 43, 91, 0.2);
}
.table_box li:last-child {
border-bottom: none
}
.uni-input {
height: 100%;
padding: 0 10rpx;
}
.start_wrap {
margin: 60rpx 0 20rpx;
}
.start_btn {
text-align: center;
pos-bottom: 40rpx;
line-height: 80rpx;
width: 60%;
margin: 0 auto;
/* background-color: #4181FE; */
color: #4181FE;
border-radius: 70rpx;
border: 1px solid #4181FE;
}
.start_btn:active {
background-color: rgba(65, 129, 254, 0.2);
color: #fff;
}
.start_btn2 {
font-size: 26rpx;
line-height: 60rpx;
margin-top: 20rpx;
}
.picker {
border: 1px solid rgba(91, 95, 102, 0.5);
padding: 6px 30rpx;
font-size: 30rpx;
border-radius: 60rpx;
width: 60%;
box-sizing: border-box;
position: relative;
margin-left: 20rpx;
}
.arrowdown {
position: absolute;
top: 20rpx;
right: 30rpx;
color: #262D47;
opacity: 0.8;
}
.closeBtn {
font-size: 30rpx;
color: rgba(42, 43, 91, 0.5);
padding: 20rpx 0;
text-align: center;
}
.yellow {
color: #ecd312;
}
.red {
color: #ec3c12;
}
.circleBox {
width: 100px;
height: 100px;
border-radius: 50%;
border: 4px solid #1dc349;
text-align: center;
margin: 0 auto;
color: #1dc349;
&.red {
border-color: #f95858;
color: #f95858;
}
.num {
font-size: 60rpx;
margin-top: 20rpx;
}
}
.dialogTitle {
padding: 20rpx 30rpx 0;
}
.info_detail{
position: absolute;
left: 0rpx;
top:-130rpx;
width: 570rpx;
padding: 20rpx;
padding-top: 30rpx;
word-break: break-all;
background: #fff;
background: #eee;
border: 1px solid #EEEEEE;
font-size: 24rpx;
border-radius: 6px;
.close_btn{
position: absolute;
right: 6rpx;
top: 6rpx;
}
}
.info_detail:after{
content: '';
width: 0;
height: 0;
border-left: 20rpx solid transparent;
border-right: 20rpx solid transparent;
border-top: 20rpx solid #eee;
position: absolute;
bottom: -20rpx;
left: 115rpx;
}
</style>