From e10c70e819caa8a16d6cb7f1b38a15070571b1f6 Mon Sep 17 00:00:00 2001 From: houjunxiang Date: Wed, 4 Feb 2026 15:47:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=A0=B7=E5=93=81=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=98=BE=E7=A4=BA=E4=B8=8E=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nx/helper/calcAnalysisValue.js | 11 ++-- pages/analysis/sample/sample-work-detail.vue | 66 ++++--------------- .../analysis/sample/sample-work-edit-task.vue | 6 +- 3 files changed, 22 insertions(+), 61 deletions(-) diff --git a/nx/helper/calcAnalysisValue.js b/nx/helper/calcAnalysisValue.js index 75fafdb..b2900df 100644 --- a/nx/helper/calcAnalysisValue.js +++ b/nx/helper/calcAnalysisValue.js @@ -60,14 +60,17 @@ const Get_C_KNO3_bySValue = function (sValue, weight, operator) { return '' } -const Get_C_KNO3 = function (sValue, weight, operator) { +const Get_C_KNO3 = function (weight, sValue, operator) { //判断sValue是数字 + const S = number(sValue) + const W = number(weight) + console.log(S, W) - if (sValue === 0 || weight === 0) { + //如果样重为0就不计算 + if (W === 0) { + console.log('结束') return '' } - let S = number(sValue) - const W = number(weight) if (W === 0) return '' const V = ((W * S) / 100) * 22 - 75 if (operator === '<' && V < 0) { diff --git a/pages/analysis/sample/sample-work-detail.vue b/pages/analysis/sample/sample-work-detail.vue index 9f2f187..79d82b1 100644 --- a/pages/analysis/sample/sample-work-detail.vue +++ b/pages/analysis/sample/sample-work-detail.vue @@ -54,9 +54,8 @@ class="u-tab-item" :class="[currentSampleIndex === index ? 'u-tab-item-active' : '']" :data-current="index" - @tap.stop="switchSample(index, false)" + @tap.stop="switchSample(index)" > - @@ -151,18 +150,6 @@ - - - - - - 保存样品数据 @@ -467,7 +425,7 @@ const autoNextSample = indexParam => { if (sample.rollbackStatus !== 'in_progress') { // 找到了合法的样品,切换 - switchSample(index, true) + switchSample(index) return } index++ @@ -475,16 +433,7 @@ const autoNextSample = indexParam => { } //手动切换样品 -const switchSample = async (index, autoFlag) => { - // if (!autoFlag) { - // const shouldContinue = await tools.showPromiseModal( - // '提示', - // `请确认样品【${currentSampleData.value.sampleCode}】数据已经保存,是否继续?` - // ) - // if (!shouldContinue) { - // return // 用户点了取消,直接退出 - // } - // } +const switchSample = async index => { //重置天平归0 weightDataIsToZero.value = false if (index === currentSampleIndex.value) return @@ -991,9 +940,18 @@ function setValueToField() { field.value = value let symbol = getFieldSymbol(field) field.symbol = symbol + if (!getField(field)) { + field.hidden = 1 + } else { + field.hidden = 0 + } }) } } +function getField(field) { + const fieldObj = currentSampleData.value[field.fieldIndex] + return fieldObj +} function getFieldValue(field) { const fieldValue = currentSampleData.value[field.fieldIndex]?.value if (fieldValue) { diff --git a/pages/analysis/sample/sample-work-edit-task.vue b/pages/analysis/sample/sample-work-edit-task.vue index 8a7d413..65d9fa1 100644 --- a/pages/analysis/sample/sample-work-edit-task.vue +++ b/pages/analysis/sample/sample-work-edit-task.vue @@ -331,10 +331,10 @@ function checkPropertyEquality() { for (const column of allColumns) { const formula = column.formula if (!formula) continue - for (const [key, value] of Object.entries(dynamicFormData.value)) { + for (const [key, value] of Object.entries(realFormData.value)) { if (formula.includes(key)) { - const originalValue = value - const currentValue = realFormData.value[key] + const currentValue = value + const originalValue = dynamicFormData.value[key] if (!looseEqual(originalValue, currentValue)) { return true }