sige 1 year ago
parent
commit
91a1f8ae5d
  1. 27
      src/web/src/pages/main/contents/OperationTubeRackTakeOut.vue
  2. 40
      src/web/src/pages/main/contents/notification/TaskSampleTakeOutTubeRack.vue

27
src/web/src/pages/main/contents/OperationTubeRackTakeOut.vue

@ -33,28 +33,13 @@ function showTakeOutConfirm() {
});
}
//
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);
let client = ApiClient.getClient();
try {
await client.taskAppend('SampleTakeOut',{slotIndex:props.activeSlot.index * 1});
} catch ( e ) {
Modal.error({title: '取出失败', content: e.message});
}
}
</script>

40
src/web/src/pages/main/contents/notification/TaskSampleTakeOutTubeRack.vue

@ -0,0 +1,40 @@
<template>
<!-- 取出样品弹框 -->
<a-modal v-if="enable" v-model:open="enable" title="取出样本">
<p>取出样本后点击确认完成操作</p>
<template #footer>
<a-button type="primary" @click="actionOk">确定</a-button>
</template>
</a-modal>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { useAppStore } from '@/stores/AppStore';
import ApiClient from '@/utils/ApiClient';
/** @var {AppStore} */
const appStore = useAppStore();
/** @var {Ref<boolean>} */
const enable = ref(false);
/** @var {string} */
let taskId = null;
// on mounted
onMounted(mounted);
// mounted
function mounted() {
appStore.registerNotificationHandler('TaskSampleTakeOutTubeRack', handleNotification);
}
// handle TaskSampleAddTubeRackPutIn
function handleNotification( task ) {
taskId = task;
enable.value = true;
}
//
async function actionOk() {
enable.value = false;
let client = ApiClient.getClient();
await client.taskActionExecute(taskId, 'Done');
}
</script>
Loading…
Cancel
Save