feat:分析值保留两位有效数字计算

This commit is contained in:
houjunxiang
2026-02-05 11:10:44 +08:00
parent e10c70e819
commit da01e1efcd
8 changed files with 123 additions and 80 deletions

View File

@@ -1,14 +1,14 @@
<template>
<view>
<up-sticky>
<navbar-back title="检">
<navbar-back title="设备巡检">
<up-button
v-if="detailInfo.id"
type="primary"
:plain="true"
icon="list"
size="small"
text="设备检记录"
text="设备检记录"
@click="handleCheckRecord"
></up-button>
</navbar-back>
@@ -16,18 +16,19 @@
<view class="container">
<n-scanTemp
v-if="!detailInfo.id"
title="请扫描设备条码进行检"
title="请扫描设备条码进行检"
icon="dailyCheck"
@deviceId="id => getDailyCheckRecord(id)"
@scanResult="result => handleScanResult(result)"
/>
<view v-else class="content">
<view>
<uni-section titleFontSize="22px" type="line" title="设备检信息">
<uni-section titleFontSize="22px" type="line" title="设备检信息">
<template v-slot:right>
<up-button
v-if="detailInfo.submitFlag == '1'"
type="success"
text="新建检"
text="新建检"
@click="handleCreateDailyCheck"
></up-button>
</template>
@@ -43,7 +44,7 @@
<view>
<uni-section titleFontSize="22px" type="line" title="检查项"> </uni-section>
<up-row class="p10 font-bold" style="background-color: #f5f5f5">
<up-col span="4">检项目</up-col>
<up-col span="4">检项目</up-col>
<up-col span="3">检查标准</up-col>
<up-col span="2"> 频次</up-col>
<up-col style="text-align: center" span="3">是否正常</up-col>
@@ -75,10 +76,10 @@
<up-textarea v-model="detailInfo.content" placeholder="请输入内容"></up-textarea>
<view class="p10">附件照片</view>
<n-upload v-model="detailInfo.attachment" />
<view class="p10">检人</view>
<view class="p10">检人</view>
<up-input v-model="detailInfo.checkUserName"></up-input>
<view v-if="detailInfo.submitFlag == '1'">
<view class="p10">检日期</view>
<view class="p10">检日期</view>
<uni-datetime-picker type="datetime" v-model="detailInfo.checkDate" />
</view>
</view>
@@ -129,32 +130,37 @@ const { lockOrientation } = useScreenOrientation()
const pageLoading = ref(false)
let detailInfo = ref({})
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (newVal && nx.$router.getCurrentPage().route == 'pages/device/deviceBusDailyCheck/index') {
try {
const codeObj = JSON.parse(newVal)
if (!pageLoading.value) {
getDailyCheckRecord(codeObj.id)
}
scanQRInfo.value = ''
} catch (error) {
scanQRInfo.value = ''
uni.showToast({
title: '请扫描设备码',
icon: 'none'
})
}
function handleScanResult(result) {
const codeObj = JSON.parse(result)
if (!pageLoading.value) {
getDailyCheckRecord(codeObj.id)
}
})
}
// const { scanQRInfo } = toRefs(nx.$store('biz'))
// watch(scanQRInfo, newVal => {
// if (newVal && nx.$router.getCurrentPage().route == 'pages/device/deviceBusDailyCheck/index') {
// try {
// const codeObj = JSON.parse(newVal)
// if (!pageLoading.value) {
// getDailyCheckRecord(codeObj.id)
// }
// scanQRInfo.value = ''
// } catch (error) {
// scanQRInfo.value = ''
// uni.showToast({
// title: '请扫描设备码',
// icon: 'none'
// })
// }
// }
// })
const modalText = computed(() => {
return `确定${modalType.value == '0' ? '暂存' : '提交'}吗?${modalType.value == '0' ? '' : '提交后不能修改'} `
})
onShow(() => {
scanQRInfo.value = ''
})
let goBack = ref(false)
// onShow(() => {
// scanQRInfo.value = ''
// })
let goBack = ref(false) //设备使用前进行点检操作标记
onLoad(options => {
if (options.deviceId) {
goBack.value = true
@@ -211,7 +217,7 @@ function handleSubmit(type) {
}
if (!detailInfo.value.checkUserName) {
return uni.showToast({
title: '请输入检人',
title: '请输入检人',
icon: 'none'
})
}
@@ -246,11 +252,11 @@ function handleCheckRecord() {
nx.$store('biz').deviceInfo = deviceInfo
nx.$router.go('/pages/device/deviceBusDailyCheck/list')
}
// 新建
// 新建
function handleCreateDailyCheck() {
uni.showModal({
title: '提示',
content: '确定新建检吗?',
content: '确定新建检吗?',
success: async function (res) {
if (res.confirm) {
const res = await dailyCheckApi.createDailyCheck({