|
|
@ -94,7 +94,8 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import { useRouter } from 'vue-router'; |
|
|
|
import { ref, onMounted, onBeforeUnmount } from 'vue'; |
|
|
|
import { Time, InitWarn, LoadingModal } from './components/Consumables'; |
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
import { Time, InitWarn, LoadingModal } from './Components/Consumables'; |
|
|
|
import { startWork, pauseWork, continueWork, stopWork, getDeviceWorkState, getInitState, initDevice, saveMountedCardInfo, openBuzzer, closeBuzzer } from '../../services/index'; |
|
|
|
import { User } from '../../types/Index'; |
|
|
|
import { useConsumablesStore } from '../../store'; |
|
|
@ -243,10 +244,18 @@ const startTest = async () => { |
|
|
|
return |
|
|
|
} |
|
|
|
try { |
|
|
|
showDeviceWaitingModal.value = true |
|
|
|
const res = await startWork(); |
|
|
|
if (res.success) { |
|
|
|
deviceReadyCallback = () => isTesting.value = true; |
|
|
|
await untilDeviceReady() |
|
|
|
} else { |
|
|
|
showDeviceWaitingModal.value = false |
|
|
|
ElMessage({ |
|
|
|
message: res.data.info, |
|
|
|
type: 'error', |
|
|
|
duration: 2000, |
|
|
|
}) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('开始测试失败:', error); |
|
|
@ -256,21 +265,38 @@ const startTest = async () => { |
|
|
|
|
|
|
|
// 暂停测试 |
|
|
|
const pauseTest = async () => { |
|
|
|
showDeviceWaitingModal.value = true |
|
|
|
const res = await pauseWork(); |
|
|
|
if (res.success) { |
|
|
|
deviceReadyCallback = () => isPaused.value = true; |
|
|
|
await untilDeviceReady() |
|
|
|
} else { |
|
|
|
showDeviceWaitingModal.value = false |
|
|
|
ElMessage({ |
|
|
|
message: res.data.info, |
|
|
|
type: 'error', |
|
|
|
duration: 2000, |
|
|
|
}) |
|
|
|
} |
|
|
|
// 在这里添加暂停测试的逻辑 |
|
|
|
}; |
|
|
|
|
|
|
|
// 停止测试时清除标记 |
|
|
|
const stopTest = async () => { |
|
|
|
console.log('测试已停止'); |
|
|
|
showDeviceWaitingModal.value = true |
|
|
|
const res = await stopWork(); |
|
|
|
if (res.success) { |
|
|
|
deviceReadyCallback = () => isTesting.value = false; |
|
|
|
deviceReadyCallback = () => { |
|
|
|
isTesting.value = false; |
|
|
|
sessionStorage.removeItem('deviceResetFinished') |
|
|
|
} |
|
|
|
await untilDeviceReady() |
|
|
|
} else { |
|
|
|
showDeviceWaitingModal.value = false |
|
|
|
ElMessage({ |
|
|
|
message: res.data.info, |
|
|
|
type: 'error', |
|
|
|
duration: 2000, |
|
|
|
}) |
|
|
|
} |
|
|
|
}; |
|
|
|
//继续测试 |
|
|
|