|
|
@ -0,0 +1,60 @@ |
|
|
|
<template> |
|
|
|
<a-popconfirm title="是否取出样本?" ok-text="确认" cancel-text="取消" @confirm="actionTakeOut"> |
|
|
|
<a-button class="ml-1" |
|
|
|
style="background: transparent;border: solid 1px #becfe7;color: #7c92b1;" |
|
|
|
><MinusCircleOutlined /></a-button> |
|
|
|
</a-popconfirm> |
|
|
|
</template> |
|
|
|
<script setup> |
|
|
|
import ApiClient from '@/utils/ApiClient'; |
|
|
|
import Common from '@/utils/Common'; |
|
|
|
import { Modal } from 'ant-design-vue'; |
|
|
|
import { nextTick } from 'vue'; |
|
|
|
/** @var {Object} */ |
|
|
|
const props = defineProps({ |
|
|
|
activeSlot: Object, |
|
|
|
}); |
|
|
|
/** @var {String} */ |
|
|
|
let taskId = null; |
|
|
|
|
|
|
|
// 样本取出确认 |
|
|
|
async function takeOutConfirm( resolve ) { |
|
|
|
let client = ApiClient.getClient(); |
|
|
|
await client.taskActionExecute(taskId, 'done'); |
|
|
|
} |
|
|
|
|
|
|
|
// 显示取出确认 |
|
|
|
function showTakeOutConfirm() { |
|
|
|
return new Promise( resolve => { |
|
|
|
Modal.info({ |
|
|
|
title: '请取出样本后点击确认', |
|
|
|
onOk: () => takeOutConfirm(resolve), |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 样本取出 |
|
|
|
async function takeOut() { |
|
|
|
let client = ApiClient.getClient(); |
|
|
|
let task = await client.taskAppend('SampleTakeOut',{slotIndex:props.activeSlot.index * 1}); |
|
|
|
taskId = task.id; |
|
|
|
|
|
|
|
while( true ) { |
|
|
|
task = await client.taskExecutionGet(taskId); |
|
|
|
if ( 'RUNNING' === task.status ) { |
|
|
|
await showTakeOutConfirm(); |
|
|
|
} else if ( 'ERROR' === task.status ) { |
|
|
|
Modal.error({title: '取出失败', content: task.message}); |
|
|
|
break ; |
|
|
|
} else if ( 'FINISHED' === task.status ) { |
|
|
|
break ; |
|
|
|
} |
|
|
|
await Common.delay(1000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 样本取出确认 |
|
|
|
async function actionTakeOut() { |
|
|
|
nextTick(takeOut); |
|
|
|
} |
|
|
|
</script> |