feat:分析录入支持录入负数

This commit is contained in:
houjunxiang
2025-12-04 10:03:19 +08:00
parent ee29bdfcc8
commit 182fd11399
2 changed files with 17 additions and 21 deletions

View File

@@ -8,7 +8,6 @@
<view class="keypad">
<view
class="oner"
:class="item.class"
:style="getListItemStyle(index)"
v-for="(item, index) in numbers"
:key="'num_' + index"
@@ -54,7 +53,8 @@ const numbers = ref([
{ text: '7' },
{ text: '8' },
{ text: '9' },
{ text: '0', class: 'zero' },
{ text: '0' },
{ text: '-' },
{ text: '.' }
])
@@ -119,14 +119,15 @@ defineExpose({ clearNum })
.keypad {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: 1fr;
gap: 10px;
padding: 10px;
flex: 4;
height: 95%;
}
.oner {
width: 95%;
height: 55px;
font-size: 20px;
border: none;
border-radius: 5px;
@@ -137,11 +138,6 @@ defineExpose({ clearNum })
box-sizing: border-box;
}
.zero {
width: 98%;
grid-column: span 2;
}
.func-pad {
height: 100%;
display: flex;
@@ -171,17 +167,4 @@ defineExpose({ clearNum })
font-family: zzjc-lcd;
height: 40px;
}
@media (max-width: 700px) {
.weight-data {
font-size: 25px;
}
.oner {
height: 33px;
font-size: 16px;
}
.weight-data {
height: 20px;
}
}
</style>

View File

@@ -653,6 +653,8 @@ const saveAuncelData = () => {
//获取当前重量
let weight = currentAuncel.value.weightData
selectedField.value.value = weight
syncFieldValueByEqualParamNo()
//计算
try {
calcAnalysisValue(fieldGroup.value)
@@ -1089,6 +1091,7 @@ const listenNumKeyboard = () => {
} else {
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition)
}
syncFieldValueByEqualParamNo()
calcAnalysisValue(fieldGroup.value)
//自动跳转下一个字段
setTimeout(() => {
@@ -1096,6 +1099,16 @@ const listenNumKeyboard = () => {
}, 60)
})
}
// 查找paramNo相同的列使其值同步
function syncFieldValueByEqualParamNo() {
for (const group of fieldGroup.value) {
group.fields.forEach(field => {
if (field.paramNo === selectedField.value.paramNo) {
field.value = selectedField.value.value
}
})
}
}
const clearFieldVal = () => {
uni.showModal({
title: '提示',