分析值保留两位有效数字计算退回
This commit is contained in:
File diff suppressed because it is too large
Load Diff
511
nx/helper/calcAnalysisValue.js.bak
Normal file
511
nx/helper/calcAnalysisValue.js.bak
Normal file
File diff suppressed because it is too large
Load Diff
@@ -674,7 +674,7 @@ const saveDetail = async () => {
|
|||||||
if (item.calcMethod === 'calculateAverageValue') {
|
if (item.calcMethod === 'calculateAverageValue') {
|
||||||
item.value = calcAverageValue(sourceKey, currentAssayType.value.tableData)
|
item.value = calcAverageValue(sourceKey, currentAssayType.value.tableData)
|
||||||
} else {
|
} else {
|
||||||
item.value = handleRoundFiveNumber(row[sourceKey].value, row.decimalPosition, row.type === 'project')
|
item.value = handleRoundFiveNumber(row[sourceKey].value, row.decimalPosition)
|
||||||
}
|
}
|
||||||
// 如果处理后的值不为空,重新赋值该字段到其他样品类型下的样品上,并触发每一个样品的计算
|
// 如果处理后的值不为空,重新赋值该字段到其他样品类型下的样品上,并触发每一个样品的计算
|
||||||
for (const col of currentAssayType.value.columns) {
|
for (const col of currentAssayType.value.columns) {
|
||||||
@@ -707,10 +707,9 @@ const saveDetail = async () => {
|
|||||||
function calcAverageValue(fieldIndex, tableData) {
|
function calcAverageValue(fieldIndex, tableData) {
|
||||||
const rows = tableData.map(row => row[fieldIndex])
|
const rows = tableData.map(row => row[fieldIndex])
|
||||||
const decimalPosition = rows[0].decimalPosition
|
const decimalPosition = rows[0].decimalPosition
|
||||||
const isProject = rows[0].type === 'project'
|
|
||||||
const values = rows.map(row => Number(row.value))
|
const values = rows.map(row => Number(row.value))
|
||||||
if (values.some(item => item == null)) return null
|
if (values.some(item => item == null)) return null
|
||||||
return handleRoundFiveNumber(math.mean(values), decimalPosition, isProject)
|
return handleRoundFiveNumber(math.mean(values), decimalPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表格数据更新后重新计算
|
// 表格数据更新后重新计算
|
||||||
@@ -1110,13 +1109,12 @@ const listenNumKeyboard = () => {
|
|||||||
}
|
}
|
||||||
//自动补全小数位数
|
//自动补全小数位数
|
||||||
const decimalPosition = selectedField.value.decimalPosition
|
const decimalPosition = selectedField.value.decimalPosition
|
||||||
const isProject = selectedField.value.type === 'project'
|
|
||||||
let val = res.val
|
let val = res.val
|
||||||
const symbol = res.symbol
|
const symbol = res.symbol
|
||||||
if (decimalPosition == null) {
|
if (decimalPosition == null) {
|
||||||
selectedField.value.value = val
|
selectedField.value.value = val
|
||||||
} else {
|
} else {
|
||||||
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition, isProject)
|
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition)
|
||||||
}
|
}
|
||||||
if (symbol) {
|
if (symbol) {
|
||||||
selectedField.value.symbol = symbol
|
selectedField.value.symbol = symbol
|
||||||
|
|||||||
1515
pages/analysis/sample/sample-work-detail.vue.bak
Normal file
1515
pages/analysis/sample/sample-work-detail.vue.bak
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user