|
@@ -8,6 +8,7 @@ const socketStore = socket();
|
|
|
const clientStore = client();
|
|
const clientStore = client();
|
|
|
|
|
|
|
|
export const checkInfo = defineStore('checkInfo', () => {
|
|
export const checkInfo = defineStore('checkInfo', () => {
|
|
|
|
|
+
|
|
|
// 定义设备列表
|
|
// 定义设备列表
|
|
|
const devices = reactive({
|
|
const devices = reactive({
|
|
|
mcu: {
|
|
mcu: {
|
|
@@ -35,6 +36,11 @@ export const checkInfo = defineStore('checkInfo', () => {
|
|
|
const checkTime = ref(0)
|
|
const checkTime = ref(0)
|
|
|
let CKTimerInterval:any = null
|
|
let CKTimerInterval:any = null
|
|
|
|
|
|
|
|
|
|
+ //mcu 初始化
|
|
|
|
|
+ const mcu = reactive({
|
|
|
|
|
+ isInitSend:false,
|
|
|
|
|
+ status:0,
|
|
|
|
|
+ })
|
|
|
// 计算完成进度
|
|
// 计算完成进度
|
|
|
const getProgress = computed(() => {
|
|
const getProgress = computed(() => {
|
|
|
let completed = 0;
|
|
let completed = 0;
|
|
@@ -47,10 +53,18 @@ export const checkInfo = defineStore('checkInfo', () => {
|
|
|
|
|
|
|
|
// 获取错误信息
|
|
// 获取错误信息
|
|
|
const getErrorMsg = computed(() => {
|
|
const getErrorMsg = computed(() => {
|
|
|
|
|
+
|
|
|
|
|
+ if(mcu.status === -1){
|
|
|
|
|
+ clearInterval(CKTimerInterval)
|
|
|
|
|
+ checkTime.value = 0
|
|
|
|
|
+ mcu.isInitSend = false
|
|
|
|
|
+ return '相机初始化失败,请重新监测或强制初始化!';
|
|
|
|
|
+ }
|
|
|
for (const device of Object.values(devices)) {
|
|
for (const device of Object.values(devices)) {
|
|
|
if (device.status === -1) {
|
|
if (device.status === -1) {
|
|
|
clearInterval(CKTimerInterval)
|
|
clearInterval(CKTimerInterval)
|
|
|
checkTime.value = 0
|
|
checkTime.value = 0
|
|
|
|
|
+ mcu.isInitSend = false
|
|
|
return device.msg;
|
|
return device.msg;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -99,8 +113,31 @@ export const checkInfo = defineStore('checkInfo', () => {
|
|
|
await socketStore.connectSocket();
|
|
await socketStore.connectSocket();
|
|
|
await socketStore.sendMessage({ type: messageType });
|
|
await socketStore.sendMessage({ type: messageType });
|
|
|
clientStore.ipc.on(icpList.socket.message+'_'+deviceName, (event, result) => {
|
|
clientStore.ipc.on(icpList.socket.message+'_'+deviceName, (event, result) => {
|
|
|
|
|
+
|
|
|
|
|
+ console.log(result);
|
|
|
if (result && checkTime.value > 0) {
|
|
if (result && checkTime.value > 0) {
|
|
|
- if([-1,0,2].includes(result.status)){
|
|
|
|
|
|
|
+ if(deviceName === 'mcu'){
|
|
|
|
|
+ console.log(result);
|
|
|
|
|
+ if(result.status === 2 ){
|
|
|
|
|
+ if(!mcu.isInitSend){
|
|
|
|
|
+ socketStore.sendMessage({ type: 'init_mcu' });
|
|
|
|
|
+ mcu.isInitSend = true
|
|
|
|
|
+ mcu.status = 1
|
|
|
|
|
+ }
|
|
|
|
|
+ if(mcu.isInitSend && result.msg === '设备初始化完成'){
|
|
|
|
|
+ devices[deviceName].status = result.status;
|
|
|
|
|
+ devices[deviceName].msg = result.msg;
|
|
|
|
|
+ mcu.status = 2
|
|
|
|
|
+ }
|
|
|
|
|
+ if(checkTime.value >= 60 && mcu.status !== 2){
|
|
|
|
|
+ mcu.status == -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if([-1,0].includes(result.status)){
|
|
|
|
|
+ devices[deviceName].status = result.status;
|
|
|
|
|
+ devices[deviceName].msg = result.msg;
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if([-1,0,2].includes(result.status)){
|
|
|
devices[deviceName].status = result.status;
|
|
devices[deviceName].status = result.status;
|
|
|
devices[deviceName].msg = result.msg;
|
|
devices[deviceName].msg = result.msg;
|
|
|
}
|
|
}
|