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

View File

@@ -653,6 +653,8 @@ const saveAuncelData = () => {
//获取当前重量 //获取当前重量
let weight = currentAuncel.value.weightData let weight = currentAuncel.value.weightData
selectedField.value.value = weight selectedField.value.value = weight
syncFieldValueByEqualParamNo()
//计算 //计算
try { try {
calcAnalysisValue(fieldGroup.value) calcAnalysisValue(fieldGroup.value)
@@ -1089,6 +1091,7 @@ const listenNumKeyboard = () => {
} else { } else {
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition) selectedField.value.value = handleRoundFiveNumber(val, decimalPosition)
} }
syncFieldValueByEqualParamNo()
calcAnalysisValue(fieldGroup.value) calcAnalysisValue(fieldGroup.value)
//自动跳转下一个字段 //自动跳转下一个字段
setTimeout(() => { setTimeout(() => {
@@ -1096,6 +1099,16 @@ const listenNumKeyboard = () => {
}, 60) }, 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 = () => { const clearFieldVal = () => {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',