完善归档接口

This commit is contained in:
caozehui
2025-01-13 22:50:55 +08:00
parent f29d6e8d88
commit 9ff5423368
2 changed files with 194 additions and 114 deletions

View File

@@ -154,8 +154,7 @@
v-if="form.activeTabs === 4" v-if="form.activeTabs === 4"
>数据查看</el-button >数据查看</el-button
> --> > -->
<el-button <el-button type='primary'
:type="scope.row.check_State === '检测完成' ? 'primary' : 'info'"
link link
:icon="Notebook" :icon="Notebook"
@click="openDrawer('归档', scope.row)" @click="openDrawer('归档', scope.row)"
@@ -264,6 +263,7 @@ import { useDownload } from '@/hooks/useDownload'
import {downloadDevData} from '@/api/plan/plan.ts' import {downloadDevData} from '@/api/plan/plan.ts'
import {documentedPqDev} from "@/api/device/device"; import {documentedPqDev} from "@/api/device/device";
import { getPqDev } from '@/api/device/device/index.ts' import { getPqDev } from '@/api/device/device/index.ts'
import {ResultEnum} from "@/enums/httpEnum";
const dictStore = useDictStore() const dictStore = useDictStore()
const checkStore = useCheckStore() const checkStore = useCheckStore()
const webMsgSend = ref();//webSocket推送的数据 const webMsgSend = ref();//webSocket推送的数据
@@ -1005,7 +1005,11 @@ const handleTest = async (val:string) => {
// loading.close() // loading.close()
// ElMessage.success("归档成功"); // ElMessage.success("归档成功");
// }, 2000) // }, 2000)
documentedPqDev(checkStore.devices.map(item => {item.deviceId})) documentedPqDev(checkStore.devices.map(item => {item.deviceId})).then((res) => {
if(res.code === ResultEnum.SUCCESS){
ElMessage.success("归档成功!");
}
})
} }
@@ -1043,7 +1047,11 @@ const openDrawer = async (title: string, row: any) => {
if (title === '归档') if (title === '归档')
{ {
await documentedPqDev([row.id]) await documentedPqDev([row.id]).then((res) => {
if(res.code === ResultEnum.SUCCESS){
ElMessage.success("归档成功!");
}
})
emit('batchGenerateClicked'); // 触发事件 emit('batchGenerateClicked'); // 触发事件
// const loading = ElLoading.service({ // const loading = ElLoading.service({
// lock: true, // lock: true,

View File

@@ -306,7 +306,7 @@ watch(testStatus, function (newValue, oldValue) {
percentage.value = 0 percentage.value = 0
} }
emit('update:testStatus', 'test_init') emit('update:testStatus', 'test_init')
//startTimer() // todo 可移除 startTimer() // todo 可移除
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
} }
}) })
@@ -357,25 +357,25 @@ watch(webMsgSend, function (newValue, oldValue) {
break; break;
} }
break; break;
case 'connect': // case 'connect':
switch (newValue.operateCode) { // switch (newValue.operateCode) {
case "Source": // case "Source":
ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', { // ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', {
confirmButtonText: '确定', // confirmButtonText: '确定',
type: 'error', // type: 'error',
}) // })
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`}) // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`})
break; // break;
case "Dev": // case "Dev":
ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', { // ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', {
confirmButtonText: '确定', // confirmButtonText: '确定',
type: 'error', // type: 'error',
}) // })
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`}) // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`})
break; // break;
} // }
emit('update:testStatus', 'test_init_fail') // emit('update:testStatus', 'test_init_fail')
break; // break;
case 'yjc_ytxjy': case 'yjc_ytxjy':
switch (newValue.operateCode) { switch (newValue.operateCode) {
case 'INIT_GATHER': case 'INIT_GATHER':
@@ -414,7 +414,7 @@ watch(webMsgSend, function (newValue, oldValue) {
percentage.value = 3 percentage.value = 3
activeIndex = getNextActiveIndex() + 2 activeIndex = getNextActiveIndex() + 2
//startTimer() startTimer()
emit('update:testStatus', 'process') emit('update:testStatus', 'process')
} }
@@ -448,7 +448,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('FREQ') activeIndex = getNextActiveIndex('FREQ')
//startTimer() startTimer()
} }
break; break;
case 'V_Start': case 'V_Start':
@@ -462,7 +462,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('V') activeIndex = getNextActiveIndex('V')
//startTimer() startTimer()
} }
break; break;
case 'HV_Start': case 'HV_Start':
@@ -476,7 +476,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HV') activeIndex = getNextActiveIndex('HV')
//startTimer() startTimer()
} }
break; break;
case 'HI_Start': case 'HI_Start':
@@ -490,7 +490,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HI') activeIndex = getNextActiveIndex('HI')
//startTimer() startTimer()
} }
break; break;
case 'HP_Start': case 'HP_Start':
@@ -504,7 +504,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HP') activeIndex = getNextActiveIndex('HP')
//startTimer() startTimer()
} }
break; break;
case 'HSV_Start': case 'HSV_Start':
@@ -518,7 +518,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSV') activeIndex = getNextActiveIndex('HSV')
//startTimer() startTimer()
} }
break; break;
case 'HSI_Start': case 'HSI_Start':
@@ -532,7 +532,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSI') activeIndex = getNextActiveIndex('HSI')
//startTimer() startTimer()
} }
break; break;
case 'VOLTAGE_Start': case 'VOLTAGE_Start':
@@ -546,7 +546,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('VOLTAGE') activeIndex = getNextActiveIndex('VOLTAGE')
//startTimer() startTimer()
} }
break; break;
case 'I_Start': case 'I_Start':
@@ -560,7 +560,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('I') activeIndex = getNextActiveIndex('I')
//startTimer() startTimer()
} }
break; break;
case 'IMBV_Start': case 'IMBV_Start':
@@ -574,7 +574,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBV') activeIndex = getNextActiveIndex('IMBV')
//startTimer() startTimer()
} }
break; break;
case 'IMBA_Start': case 'IMBA_Start':
@@ -588,7 +588,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBA') activeIndex = getNextActiveIndex('IMBA')
//startTimer() startTimer()
} }
break; break;
case 'F_Start': case 'F_Start':
@@ -602,7 +602,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('F') activeIndex = getNextActiveIndex('F')
//startTimer() startTimer()
} }
break; break;
case 'Quit': case 'Quit':
@@ -865,7 +865,7 @@ function getErrorCheckItem(scriptType: string) {
const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: CheckData.DeviceCheckResult[] = []) => { const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: CheckData.DeviceCheckResult[] = []) => {
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
// devices = [ devices = [
// { // {
// chnResult: [3, 4], // chnResult: [3, 4],
// deviceId: "80b4b4f52a4c4064a18319525f8ac13c", // deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
@@ -880,7 +880,13 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
// chnResult: [1, 1, 1, 1], // chnResult: [1, 1, 1, 1],
// deviceId: "ae5a7628260349c0a5e7c86c81fbd417", // deviceId: "ae5a7628260349c0a5e7c86c81fbd417",
// deviceName: "240004" // deviceName: "240004"
// }] // }
{
chnResult: [1, 1, 1, 1],
deviceId: "2957b271f39d4240a1c5e275c453676c",
deviceName: "测试003"
},
]
let temp = null let temp = null
if (isStart) { if (isStart) {
temp = getLoadingResult(scriptType) temp = getLoadingResult(scriptType)
@@ -1074,6 +1080,62 @@ const startTimer = () => {
}, 6000) }, 6000)
break; break;
case 1: case 1:
emit('update:webMsgSend', {
requestId: 'V_Start'
})
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'V_End'
})
}, 2000);
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_Start'
// })
// }, 1000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_End'
// })
// }, 2000);
break;
case 2:
emit('update:webMsgSend', {
requestId: 'I_Start'
})
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'I_End'
})
}, 2000)
// emit('update:webMsgSend', {
// requestId: 'V_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'V_End'
// })
// }, 2000);
break;
case 3:
emit('update:webMsgSend', {
requestId: 'IMBV_Start'
})
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'IMBV_End'
})
}, 2000)
// emit('update:webMsgSend', {
// requestId: 'HV_Start',
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HV_End'
// })
// }, 2000)
break;
case 4:
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'FREQ_Start' requestId: 'FREQ_Start'
@@ -1084,18 +1146,16 @@ const startTimer = () => {
requestId: 'FREQ_End' requestId: 'FREQ_End'
}) })
}, 2000); }, 2000);
// emit('update:webMsgSend', {
// requestId: 'HI_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HI_End'
// })
// }, 2000)
break; break;
case 2: case 5:
emit('update:webMsgSend', {
requestId: 'V_Start'
})
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'V_End'
})
}, 2000);
break;
case 3:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'HV_Start', requestId: 'HV_Start',
}) })
@@ -1104,8 +1164,16 @@ const startTimer = () => {
requestId: 'HV_End' requestId: 'HV_End'
}) })
}, 2000) }, 2000)
// emit('update:webMsgSend', {
// requestId: 'HP_Start',
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HP_End'
// })
// }, 2000)
break; break;
case 4: case 6:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'HI_Start' requestId: 'HI_Start'
}) })
@@ -1114,18 +1182,16 @@ const startTimer = () => {
requestId: 'HI_End' requestId: 'HI_End'
}) })
}, 2000) }, 2000)
// emit('update:webMsgSend', {
// requestId: 'HSV_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HSV_End'
// })
// }, 2000)
break; break;
case 5: case 7:
emit('update:webMsgSend', {
requestId: 'HP_Start',
})
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'HP_End'
})
}, 2000)
break;
case 6:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'HSV_Start' requestId: 'HSV_Start'
}) })
@@ -1134,8 +1200,16 @@ const startTimer = () => {
requestId: 'HSV_End' requestId: 'HSV_End'
}) })
}, 2000) }, 2000)
// emit('update:webMsgSend', {
// requestId: 'HSI_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HSI_End'
// })
// }, 2000)
break; break;
case 7: case 8:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'HSI_Start' requestId: 'HSI_Start'
}) })
@@ -1144,57 +1218,55 @@ const startTimer = () => {
requestId: 'HSI_End' requestId: 'HSI_End'
}) })
}, 2000) }, 2000)
// emit('update:webMsgSend', {
// requestId: 'VOLTAGE_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'VOLTAGE_End'
// })
// }, 2000)
break; break;
case 8: // case 9:
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'VOLTAGE_Start' // requestId: 'I_Start'
}) // })
setTimeout(() => { // setTimeout(() => {
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'VOLTAGE_End' // requestId: 'I_End'
}) // })
}, 2000) // }, 2000)
break; // break;
case 9: // case 10:
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'I_Start' // requestId: 'IMBV_Start'
}) // })
setTimeout(() => { // setTimeout(() => {
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'I_End' // requestId: 'IMBV_End'
}) // })
}, 2000) // }, 2000)
break; // break;
case 10: // case 11:
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'IMBV_Start' // requestId: 'IMBA_Start'
}) // })
setTimeout(() => { // setTimeout(() => {
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'IMBV_End' // requestId: 'IMBA_End'
}) // })
}, 2000) // }, 2000)
break; // break;
case 11: // case 12:
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'IMBA_Start' // requestId: 'F_Start'
}) // })
setTimeout(() => { // setTimeout(() => {
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'IMBA_End' // requestId: 'F_End'
}) // })
}, 2000) // }, 2000)
break; // break;
case 12:
emit('update:webMsgSend', {
requestId: 'F_Start'
})
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'F_End'
})
}, 2000)
break;
case 13: case 13:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Quit' requestId: 'Quit'
@@ -1222,7 +1294,7 @@ const handleResumeTest = () => {
type: 'info', type: 'info',
log: `${new Date().toLocaleString()}:继续检测`, log: `${new Date().toLocaleString()}:继续检测`,
}) })
//startTimer() startTimer()
console.log('开始继续检测') console.log('开始继续检测')
}; };