feat:样品分析
This commit is contained in:
@@ -51,7 +51,10 @@
|
||||
v-for="(sample, index) in sampleDataList"
|
||||
:key="index"
|
||||
class="u-tab-item"
|
||||
:class="currentSampleIndex === index ? 'u-tab-item-active' : ''"
|
||||
:class="[
|
||||
currentSampleIndex === index ? 'u-tab-item-active' : '',
|
||||
sample.rollbackStatus === 'in_progress' ? 'u-tab-item-disabled' : ''
|
||||
]"
|
||||
:data-current="index"
|
||||
@tap.stop="switchSample(index, false)"
|
||||
>
|
||||
@@ -60,11 +63,25 @@
|
||||
<view>
|
||||
{{ sample.sampleCode }}
|
||||
</view>
|
||||
<view> {{ getDataSourceTypeShow(sample.dataSourceType) }}{{ sample.sampleName }} </view>
|
||||
<view> {{ sample.sampleName }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<u-button class="btn-operation" type="primary" @click="submitTask()">数据上报</u-button>
|
||||
<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'"
|
||||
@click="handleIngredients()"
|
||||
>{{ taskIngredientsStatus === 'initial' ? '下发配料' : '等待配料' }}</u-button
|
||||
>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<view class="field-name" v-html="selectedField.title" />
|
||||
@@ -248,6 +265,7 @@ const { proxy } = getCurrentInstance()
|
||||
|
||||
// 响应式数据定义
|
||||
const taskId = ref('')
|
||||
const taskIngredientsStatus = ref('') //配料状态
|
||||
const configReportTemplateKey = ref('')
|
||||
const elId = nx.$helper.uuid()
|
||||
const scrollTop = ref(0) //tab标题的滚动条位置
|
||||
@@ -378,9 +396,17 @@ const autoNextField = () => {
|
||||
|
||||
//自动切换到下一个样品
|
||||
const autoNextSample = () => {
|
||||
if (sampleDataList.value.length <= currentSampleIndex.value + 1) return
|
||||
const index = currentSampleIndex.value + 1
|
||||
switchSample(index, true)
|
||||
let index = currentSampleIndex.value + 1
|
||||
// 在数组范围内,且当前样品是 in_progress,就继续往后找
|
||||
while (index < sampleDataList.value.length) {
|
||||
const sample = sampleDataList.value[index]
|
||||
if (sample.rollbackStatus !== 'in_progress') {
|
||||
// 找到了合法的样品,切换
|
||||
switchSample(index, true)
|
||||
return
|
||||
}
|
||||
index++
|
||||
}
|
||||
}
|
||||
|
||||
//手动切换样品
|
||||
@@ -831,11 +857,16 @@ function handleAssayTypeChange({ index, value }) {
|
||||
}
|
||||
// 获取任务数据
|
||||
async function getSampleAnalysisByTaskId() {
|
||||
const { assayTaskAnalysisDataList, configAssayMethodProjectRangeList, businessAssayTasNo, formValue } =
|
||||
await nx.$api.assayTask.batchSampleAndQcAnalysisByTaskId(taskId.value)
|
||||
const {
|
||||
assayTaskAnalysisDataList,
|
||||
configAssayMethodProjectRangeList,
|
||||
businessAssayTasNo,
|
||||
formValue,
|
||||
ingredientsStatus
|
||||
} = await nx.$api.assayTask.batchSampleAndQcAnalysisByTaskId(taskId.value)
|
||||
title.value = '样品分析-任务单编号:' + businessAssayTasNo
|
||||
taskIngredientsStatus.value = ingredientsStatus
|
||||
// 处理分析数据
|
||||
|
||||
assayGroups.value = assayTaskAnalysisDataList.map(group => {
|
||||
// 必须深拷贝 datas!防止多个表格共享引用
|
||||
const tableData = JSON.parse(JSON.stringify(group.datas || []))
|
||||
@@ -1083,29 +1114,29 @@ const auncelDoSelect = res => {
|
||||
|
||||
//提交任务单
|
||||
const submitTask = () => {
|
||||
// const params = {
|
||||
// businessAssayTaskId: taskId.value
|
||||
// }
|
||||
// const msg = '请确认所有样品数据都已保存,然后再提交指派单!是否继续?'
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: msg,
|
||||
// cancelColor: '#0055A2',
|
||||
// confirmColor: '#0055A2',
|
||||
// success: res => {
|
||||
// if (res.cancel) return
|
||||
|
||||
// nx.$api.assayTask.submitTask(params).then(res => {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/analysis/sample/sample-report-search'
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
|
||||
if (checkSampleReturning()) return
|
||||
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 = {
|
||||
businessAssayTaskId: businessAssayTaskId.value
|
||||
}
|
||||
nx.$api.assayTask.taskIngredients(params).then(res => {
|
||||
getSampleAnalysisByTaskId()
|
||||
})
|
||||
}
|
||||
function checkSampleReturning() {
|
||||
const analysisSampleData = assayGroups.value.filter(t => t.value == 'analysis').tableData
|
||||
const hasReturning = analysisSampleData.some(item => item.rollbackStatus === 'in_progress')
|
||||
if (hasReturning) {
|
||||
nx.$helper.showToast('该任务单存在退回中的样品')
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
// 生命周期
|
||||
const { lockOrientation } = useScreenOrientation()
|
||||
|
||||
@@ -1242,6 +1273,11 @@ onBackPress(() => {
|
||||
color: #0055a2;
|
||||
font-weight: 600;
|
||||
}
|
||||
.u-tab-item-disabled {
|
||||
background-color: #ddd;
|
||||
pointer-events: none;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.btn-operation {
|
||||
width: 80%;
|
||||
|
||||
Reference in New Issue
Block a user