feat:样品分析计算
This commit is contained in:
@@ -66,21 +66,25 @@
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<u-button
|
||||
v-if="taskIngredientsStatus === 'allow_submit' || taskIsIngredients == '0'"
|
||||
class="btn-operation"
|
||||
type="primary"
|
||||
@click="submitTask()"
|
||||
>数据上报</u-button
|
||||
>
|
||||
<u-button
|
||||
v-else
|
||||
class="btn-operation"
|
||||
type="primary"
|
||||
:disabled="taskIngredientsStatus === 'in_progress'"
|
||||
@click="handleIngredients()"
|
||||
>{{ taskIngredientsStatus === 'initial' ? '下发配料' : '等待配料' }}</u-button
|
||||
>
|
||||
<view v-if="taskIsIngredients == 1" class="x-f">
|
||||
<template v-if="taskIngredientsWay === 'initial'">
|
||||
<u-button class="btn-operation mr10" type="primary" @click="handleIngredients()">自动配料</u-button>
|
||||
<u-button class="btn-operation ml10" type="primary" @click="handleManualIngredients()">人工配料</u-button>
|
||||
</template>
|
||||
<template v-else-if="taskIngredientsWay == 'automatic'">
|
||||
<u-button
|
||||
v-if="taskIngredientsStatus === 'allow_submit'"
|
||||
class="btn-operation"
|
||||
type="primary"
|
||||
@click="submitTask()"
|
||||
>数据上报</u-button
|
||||
>
|
||||
<u-button v-else class="btn-operation" type="primary" :disabled="taskIngredientsStatus === 'in_progress'"
|
||||
>等待配料</u-button
|
||||
>
|
||||
</template>
|
||||
</view>
|
||||
<u-button v-else class="btn-operation" type="primary" @click="submitTask()">数据上报</u-button>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<view class="x-bc">
|
||||
@@ -269,6 +273,7 @@ import {
|
||||
calcAnalysisValue,
|
||||
handleRoundFiveNumber,
|
||||
calcRowAnalysisValue,
|
||||
evaluateGetFromFormula,
|
||||
math,
|
||||
groupByField,
|
||||
validateElementRange
|
||||
@@ -287,6 +292,7 @@ const { proxy } = getCurrentInstance()
|
||||
const taskId = ref('')
|
||||
const taskIngredientsStatus = ref('') //配料状态
|
||||
const taskIsIngredients = ref('')
|
||||
const taskIngredientsWay = ref('')
|
||||
const configReportTemplateKey = ref('')
|
||||
const elId = nx.$helper.uuid()
|
||||
const scrollTop = ref(0) //tab标题的滚动条位置
|
||||
@@ -685,7 +691,7 @@ const saveAuncelData = () => {
|
||||
syncFieldValueByEqualParamNo()
|
||||
//计算
|
||||
try {
|
||||
calcAnalysisValue(fieldGroup.value)
|
||||
calcAnalysisValue(fieldGroup.value, dynamicFormData, taskIngredientsWay.value)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
@@ -767,7 +773,7 @@ function updateTableDataByConfigFields() {
|
||||
const columnObj = tab.columns.find(c => {
|
||||
if (c.formula) {
|
||||
let FromKey = c.formula.split(':')
|
||||
return FromKey[1] === key
|
||||
return FromKey[1] === key || FromKey[0] === 'GetFrom'
|
||||
}
|
||||
return false
|
||||
})
|
||||
@@ -775,9 +781,21 @@ function updateTableDataByConfigFields() {
|
||||
tab.tableData.forEach(row => {
|
||||
// 赋值配置列参与计算
|
||||
if (row[columnObj.fieldIndex]) {
|
||||
row[columnObj.fieldIndex].value = dynamicFormData[key]
|
||||
calcRowAnalysisValue(row, columnObj, tab.columns)
|
||||
if (columnObj.formula.startsWith('From')) {
|
||||
row[columnObj.fieldIndex].value = dynamicFormData[key]
|
||||
}
|
||||
if (columnObj.formula.startsWith('GetFrom')) {
|
||||
row[columnObj.fieldIndex].value = evaluateGetFromFormula(
|
||||
columnObj.formula,
|
||||
true,
|
||||
dynamicFormData,
|
||||
columnObj,
|
||||
row,
|
||||
tab.columns
|
||||
)
|
||||
}
|
||||
}
|
||||
calcRowAnalysisValue(row, columnObj, tab.columns, dynamicFormData, taskIngredientsWay.value)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -935,11 +953,13 @@ async function getSampleAnalysisByTaskId() {
|
||||
businessAssayTasNo,
|
||||
formValue,
|
||||
ingredientsStatus,
|
||||
isIngredients
|
||||
isIngredients,
|
||||
ingredientsWay
|
||||
} = await nx.$api.assayTask.batchSampleAndQcAnalysisByTaskId(taskId.value)
|
||||
title.value = '样品分析-任务单编号:' + businessAssayTasNo
|
||||
taskIngredientsStatus.value = ingredientsStatus
|
||||
taskIsIngredients.value = isIngredients
|
||||
taskIngredientsWay.value = ingredientsWay
|
||||
// 处理分析数据
|
||||
assayGroups.value = assayTaskAnalysisDataList.map(group => {
|
||||
// 必须深拷贝 datas!防止多个表格共享引用
|
||||
@@ -1142,7 +1162,7 @@ const listenNumKeyboard = () => {
|
||||
selectedField.value.symbol = symbol
|
||||
}
|
||||
syncFieldValueByEqualParamNo()
|
||||
calcAnalysisValue(fieldGroup.value)
|
||||
calcAnalysisValue(fieldGroup.value, dynamicFormData, taskIngredientsWay.value)
|
||||
//自动跳转下一个字段
|
||||
setTimeout(() => {
|
||||
autoNextField()
|
||||
@@ -1171,7 +1191,7 @@ const clearFieldVal = () => {
|
||||
}
|
||||
selectedField.value.value = ''
|
||||
//重新计算
|
||||
calcAnalysisValue(fieldGroup.value)
|
||||
calcAnalysisValue(fieldGroup.value, dynamicFormData, taskIngredientsWay.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1222,7 +1242,7 @@ const submitTask = () => {
|
||||
const url = `/pages/analysis/sample/pdf-preview?businessAssayTaskId=${taskId.value}&reportKey=${configReportTemplateKey.value}&showConfirmBtn=true`
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
// 配料下发
|
||||
// 自动配料
|
||||
function handleIngredients() {
|
||||
if (checkSampleReturning()) return
|
||||
const params = {
|
||||
@@ -1232,6 +1252,16 @@ function handleIngredients() {
|
||||
getSampleAnalysisByTaskId()
|
||||
})
|
||||
}
|
||||
// 人工配料
|
||||
function handleManualIngredients() {
|
||||
const params = {
|
||||
businessAssayTaskId: taskId.value
|
||||
}
|
||||
nx.$api.assayTask.manualIngredients(params).then(res => {
|
||||
getSampleAnalysisByTaskId()
|
||||
})
|
||||
}
|
||||
//
|
||||
function checkSampleReturning() {
|
||||
const analysisSampleData = assayGroups.value.find(t => t.value == 'analysis').tableData
|
||||
const hasReturning = analysisSampleData.some(item => item.rollbackStatus === 'in_progress')
|
||||
|
||||
Reference in New Issue
Block a user