This commit is contained in:
caozehui
2024-12-30 14:41:34 +08:00
parent 45a5dcb068
commit c334c07b39
3 changed files with 76 additions and 37 deletions

View File

@@ -69,6 +69,7 @@ import DataCheckResultTable from './dataCheckResultTable.vue'
import DataCheckRawDataTable from './dataCheckRawDataTable.vue' import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
import {getFormData, getTreeData, getCheckData} from "@/api/check/test"; import {getFormData, getTreeData, getCheckData} from "@/api/check/test";
import {useDictStore} from "@/stores/modules/dict";
const {appendToBody} = withDefaults(defineProps<{ const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean appendToBody: boolean
@@ -79,6 +80,8 @@ const defaultProps = {
children: "children", children: "children",
}; };
const dictStore = useDictStore()
const visible = ref(false) const visible = ref(false)
// 表单数据 // 表单数据
@@ -90,7 +93,7 @@ const formContent = reactive<CheckData.DataCheck>({
monitorIdx: '', monitorIdx: '',
}) })
let deviceId: string = '' let deviceId: string = ''
let checkItemId: string = '' let scriptType: string = ''
// 通道下拉列表 // 通道下拉列表
let chnList: any[] = [] let chnList: any[] = []
@@ -125,7 +128,7 @@ const handleChnChange = (data: any) => {
console.log("通道号下拉框", data); console.log("通道号下拉框", data);
// 后端请求,查询该通道号下的测试项(可以只查询不合格测试项,也可以全部测试项、不合格测试项都查询) // 后端请求,查询该通道号下的测试项(可以只查询不合格测试项,也可以全部测试项、不合格测试项都查询)
// const result = await getTreeData({deviceId, formContent.monitorIdx, checkItemId}) // const result = await getTreeData({deviceId, formContent.monitorIdx, scriptType})
// treeDataUnQualified=[] // treeDataUnQualified=[]
// treeDataAll=[] // treeDataAll=[]
@@ -136,7 +139,7 @@ const handleChnChange = (data: any) => {
// console.log("通道号下拉框", newVal, oldVal); // console.log("通道号下拉框", newVal, oldVal);
// //
// // 后端请求,查询该通道号下的测试项(可以只查询不合格测试项,也可以全部测试项、不合格测试项都查询) // // 后端请求,查询该通道号下的测试项(可以只查询不合格测试项,也可以全部测试项、不合格测试项都查询)
// // const result = await getTreeData({deviceId, formContent.monitorIdx, checkItemId}) // // const result = await getTreeData({deviceId, formContent.monitorIdx, scriptType})
// // treeDataUnQualified=[] // // treeDataUnQualified=[]
// // treeDataAll=[] // // treeDataAll=[]
// //
@@ -155,7 +158,7 @@ watch(checkedScriptId, (newVal, oldVal) => {
if (newVal) { if (newVal) {
console.log("左侧树被选中的叶子节点id", newVal); console.log("左侧树被选中的叶子节点id", newVal);
// 发起请求,查询该测试项的检测结果 // 发起请求,查询该测试项的检测结果
// const result = await getCheckData({deviceId, formContent.monitorIdx, checkItemId}) // const result = await getCheckData({deviceId, formContent.monitorIdx, scriptType})
Object.assign(checkResultTableData, [{ Object.assign(checkResultTableData, [{
chnNum: '1', chnNum: '1',
standardValue: 57.74, standardValue: 57.74,
@@ -308,27 +311,35 @@ watch(switchItem, (newVal, oldVal) => {
defaultExpandedKeys = [node?.id] defaultExpandedKeys = [node?.id]
}) })
const open = async (_deviceId: string, chnNum: number, _checkItemId?: string) => { const open = async (_deviceId: string, chnNum: number, _scriptType?: string) => {
console.log(deviceId, chnNum, checkItemId); console.log(_deviceId, chnNum, _scriptType);
deviceId = _deviceId deviceId = _deviceId
checkItemId = _checkItemId ?? '' scriptType = _scriptType ?? ''
switchItem.value = 0 switchItem.value = 0
// 发起后端请求,查询详细信息 当chnNum为-1时查询所有通道号 // 发起后端请求,查询详细信息 当chnNum为-1时查询所有通道号
//const result1 = await getFormData({deviceId, chnNum}) //const result1 = await getFormData({deviceId, chnNum})
// 数据处理 // 数据处理
chnList = [ let resFormContent = {
{value: 1, label: '1'},
{value: 2, label: '2 (不合格)'},
{value: 3, label: '3'},
{value: 4, label: '4 (不合格)'}]
Object.assign(formContent, {
scriptName: 'Q/GDW 10650.4-2021 模拟式', scriptName: 'Q/GDW 10650.4-2021 模拟式',
errorSysName: 'Q/GDW 10650.2-2021', errorSysName: 'Q/GDW 10650.2-2021',
dataRule: '所有值', dataRule: '505f063f9f91ab108d895a9fe96b5dce',
deviceName: '被检设备1', deviceName: '被检设备1',
monitorIdx: chnList[0].value chnList:[
}) {value: '1', label: '1'},
{value: '2', label: '0'},
{value: '3', label: '1'},
{value: '4', label: '0'}],
}
chnList = resFormContent.chnList.map(item => ({
value: item.value,
label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)`
}))
let dataRuleName = dictStore.getDictData('Data_Rule').find(item=>item.id==resFormContent.dataRule)?.name
Object.assign(formContent, {...resFormContent,dataRule:dataRuleName,monitorIdx: chnList[0].value})
// const result2 = await getTreeData({deviceId, formContent.monitorIdx, checkItemId}) // const result2 = await getTreeData({deviceId, formContent.monitorIdx, checkItemId})
treeDataAll = [{ treeDataAll = [{

View File

@@ -11,7 +11,7 @@
v-if="testStatus=='process' && activeIndex < checkTotal" v-if="testStatus=='process' && activeIndex < checkTotal"
:disabled="activeIndex===0" :disabled="activeIndex===0"
:icon="VideoPause" :icon="VideoPause"
@click="emit('update:testStatus','paused')">停止检测 @click="handlePauseTest">停止检测
</el-button> </el-button>
<el-button type="success" v-if="activeIndex >= checkTotal" :icon="Check" disabled>检测完成</el-button> <el-button type="success" v-if="activeIndex >= checkTotal" :icon="Check" disabled>检测完成</el-button>
@@ -20,7 +20,7 @@
type="warning" type="warning"
v-if="testStatus=='paused' && activeIndex < checkTotal" v-if="testStatus=='paused' && activeIndex < checkTotal"
:icon="Refresh" :icon="Refresh"
@click="emit('update:testStatus','process')" @click="handleResumeTest"
>继续检测 >继续检测
</el-button> </el-button>
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button> <el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
@@ -145,6 +145,7 @@ import {reactive, ref, watch} from "vue";
import {dialogBig} from "@/utils/elementBind"; import {dialogBig} from "@/utils/elementBind";
import {CheckData} from "@/api/check/interface" import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import {ElMessage, ElMessageBox} from "element-plus";
const checkStore = useCheckStore() const checkStore = useCheckStore()
@@ -165,7 +166,7 @@ const props = defineProps({
} }
}) })
const emit = defineEmits(['update:testStatus', 'update:webMsgSend']); const emit = defineEmits(['update:testStatus', 'update:webMsgSend','sendPause','sendResume']);
// 用来保存测试项进度抽屉是否打开 // 用来保存测试项进度抽屉是否打开
const drawer = ref(false) const drawer = ref(false)
@@ -303,6 +304,28 @@ watch(testStatus, function (newValue, oldValue) {
watch(webMsgSend, function (newValue, oldValue) { watch(webMsgSend, function (newValue, oldValue) {
if (activeIndex <= checkTotal) { if (activeIndex <= checkTotal) {
switch (newValue.requestId) { switch (newValue.requestId) {
case 'Test_PreTest_Fail':
ElMessageBox.alert('预检测失败,请检查设备连接情况', '预检测失败', {
confirmButtonText: '确定',
type: 'error',
}).then(() => {
emit('update:testStatus', 'success')
})
break;
case 'Test_Pause_Success':
ElMessage.success('暂停成功')
emit('update:testStatus','paused')
break;
case 'Test_Pause_Fail':
ElMessage.error('暂停失败')
break;
case 'Test_Resume_Success':
ElMessage.success('开始继续检测')
emit('update:testStatus','process')
break;
case 'Test_Resume_Fail':
ElMessage.error('无法继续检测')
break;
case 'Test_VOL_Start': case 'Test_VOL_Start':
updateCheckResultView("VOL", true) updateCheckResultView("VOL", true)
updateLog(true) updateLog(true)
@@ -312,7 +335,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex++; activeIndex++
startTimer() startTimer()
} }
break; break;
@@ -838,7 +861,6 @@ const handlePauseOrContinue = () => {
type: 'info', type: 'info',
log: currentTime.value + ':暂停检测', log: currentTime.value + ':暂停检测',
}) })
//pauseTimer()
console.log('暂停中') console.log('暂停中')
} }
if (testStatus.value == "process") { if (testStatus.value == "process") {
@@ -847,7 +869,6 @@ const handlePauseOrContinue = () => {
type: 'info', type: 'info',
log: currentTime.value + ':继续检测', log: currentTime.value + ':继续检测',
}) })
//resumeTimer()
startTimer() startTimer()
console.log('开始继续检测') console.log('开始继续检测')
} }
@@ -1016,20 +1037,15 @@ const startTimer = () => {
} }
}; };
// const pauseTimer = () => { const handlePauseTest = () => {
// if (timer.value) { // 发送暂停指令
// clearInterval(timer.value); emit('sendPause')
// timer.value = null; };
// }
// console.log('暂停中')
// };
// const resumeTimer = () => { const handleResumeTest = () => {
// if (!timer.value) { // 发送继续检测指令
// startTimer(); emit('sendResume')
// } };
// console.log('开始继续检测')
// };
//完成检测 //完成检测
const handleFinishTest = () => { const handleFinishTest = () => {

View File

@@ -17,7 +17,7 @@
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest> <preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest> <timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> --> <!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
<test ref="testRef" v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"></test> <test ref="testRef" v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume"></test>
<template #footer> <template #footer>
<div> <div>
@@ -208,6 +208,8 @@ const detectionOptions = ref([
}); });
} }
let loading; let loading;
@@ -257,6 +259,7 @@ const detectionOptions = ref([
// }) // })
TestStatus.value = 'start' TestStatus.value = 'start'
} else if (TestStatus.value == 'process') { } else if (TestStatus.value == 'process') {
// 发送暂停指令
// pauseTest({deviceIds}).then(res => { // pauseTest({deviceIds}).then(res => {
// console.log(res) // console.log(res)
// if (res.code === 20000) { // if (res.code === 20000) {
@@ -268,6 +271,7 @@ const detectionOptions = ref([
// }) // })
TestStatus.value = 'paused' TestStatus.value = 'paused'
} else if (TestStatus.value == 'paused') { } else if (TestStatus.value == 'paused') {
// 发送继续指令
// resumeTest({deviceIds}).then(res => { // resumeTest({deviceIds}).then(res => {
// console.log(res) // console.log(res)
// if (res.code === 20000) { // if (res.code === 20000) {
@@ -325,6 +329,14 @@ const detectionOptions = ref([
} }
}) })
const sendPause = () => {
console.log('发送暂停指令')
}
const sendResume = () => {
console.log('发送继续检测指令')
}
const getIcon = (index: number) => { const getIcon = (index: number) => {
if (stepsActiveIndex.value > index) return SuccessFilled; if (stepsActiveIndex.value > index) return SuccessFilled;
switch (index) { switch (index) {