feat:分析
This commit is contained in:
@@ -30,6 +30,14 @@ const getSampleAnalysisByTaskId = businessAssayTaskId => {
|
||||
params: { businessAssayTaskId }
|
||||
})
|
||||
}
|
||||
// 质控样
|
||||
const batchSampleAndQcAnalysisByTaskId = businessAssayTaskId => {
|
||||
return request({
|
||||
url: '/qms/bus/sample/analysis/batchSampleAndQcAnalysisByTaskId',
|
||||
method: 'GET',
|
||||
params: { businessAssayTaskId }
|
||||
})
|
||||
}
|
||||
// 获取指派单动态配置项
|
||||
const getDynamicBaseFormSchema = params => {
|
||||
return request({
|
||||
@@ -161,6 +169,17 @@ const saveDetailValue = data => {
|
||||
}
|
||||
})
|
||||
}
|
||||
// 批量保存任务
|
||||
const saveBatchSmpleAndQcAnalysis = data => {
|
||||
return request({
|
||||
url: '/qms/bus/sample/analysis/saveBatchSmpleAndQcAnalysis',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
showSuccess: true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 提交任务明细-停用
|
||||
const submitTaskDetail = params => {
|
||||
@@ -256,6 +275,8 @@ export default {
|
||||
getAssayTaskList,
|
||||
getAssayTaskDataList,
|
||||
getSampleAnalysisByTaskId,
|
||||
batchSampleAndQcAnalysisByTaskId,
|
||||
saveBatchSmpleAndQcAnalysis,
|
||||
getDynamicBaseFormSchema,
|
||||
getAssayTaskDetailListByTaskNo,
|
||||
getAssayTaskDetailById,
|
||||
|
||||
@@ -4,8 +4,9 @@ math.config({
|
||||
number: 'BigNumber',
|
||||
precision: 64
|
||||
})
|
||||
export { math }
|
||||
/*
|
||||
* 计算分析值*/
|
||||
* 计算当前样品分析值*/
|
||||
export function calcAnalysisValue(group) {
|
||||
try {
|
||||
for (const g of group) {
|
||||
@@ -57,6 +58,43 @@ export function calcAnalysisValue(group) {
|
||||
}
|
||||
}
|
||||
|
||||
// 根据样品和配置列计算分析值
|
||||
export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) {
|
||||
if (!columnObj.paramNo) return
|
||||
for (let i = 0; i < dynamicsColumns.length; i++) {
|
||||
let curItem = dynamicsColumns[i]
|
||||
if (curItem.fieldIndex === columnObj.fieldIndex) continue
|
||||
|
||||
let param = columnObj.fieldIndex.charAt(0) === 'p' ? 'p' + columnObj.paramNo : 'e' + columnObj.paramNo
|
||||
if (curItem.formula && curItem.formula.includes(param)) {
|
||||
let formula = curItem.formula
|
||||
let formulas = formula.split('|')
|
||||
let formulaVal = ''
|
||||
formulas.forEach(f => {
|
||||
if (f.charAt(0) === 'p') {
|
||||
let o = dynamicsColumns.find(i => 'p' + i.paramNo === f)
|
||||
formulaVal += row[o.fieldIndex]?.value ? row[o.fieldIndex].value : 0
|
||||
} else if (f.charAt(0) === 'e') {
|
||||
let o = dynamicsColumns.find(i => 'e' + i.paramNo === f)
|
||||
formulaVal += row[o.fieldIndex]?.value ? row[o.fieldIndex].value : 0
|
||||
} else {
|
||||
formulaVal += f
|
||||
}
|
||||
})
|
||||
let v
|
||||
if (formulaVal.startsWith('Get')) {
|
||||
formulaVal = formulaVal.replace(')', ",'" + row.conBaseSampleId + "')")
|
||||
v = eval(formulaVal)
|
||||
} else {
|
||||
v = math.evaluate(formulaVal).toString()
|
||||
v = isFinite(v) ? v : 0
|
||||
}
|
||||
|
||||
row[curItem.fieldIndex].value = handleRoundFiveNumber(Number(v), row[curItem.fieldIndex].decimalPosition)
|
||||
calcRowAnalysisValue(row, curItem, dynamicsColumns)
|
||||
}
|
||||
}
|
||||
}
|
||||
const findFieldInGroup = function (paramNo, group, p) {
|
||||
for (const g of group) {
|
||||
for (const f of g.fields) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import $router from '@/nx/router'
|
||||
import $helper from '@/nx/helper'
|
||||
import $test from '@/nx/helper/test'
|
||||
import $store from '@/nx/store'
|
||||
import $measure from '@/nx/helper/measure'
|
||||
import $print from '@/nx/helper/print'
|
||||
@@ -21,7 +22,8 @@ const nx = {
|
||||
$measure,
|
||||
$print,
|
||||
$dayjs: dayjs,
|
||||
$api
|
||||
$api,
|
||||
$test
|
||||
}
|
||||
|
||||
// 加载Nx底层依赖
|
||||
|
||||
Reference in New Issue
Block a user