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

View File

@@ -11,7 +11,7 @@
v-if="testStatus=='process' && activeIndex < checkTotal"
:disabled="activeIndex===0"
:icon="VideoPause"
@click="emit('update:testStatus','paused')">停止检测
@click="handlePauseTest">停止检测
</el-button>
<el-button type="success" v-if="activeIndex >= checkTotal" :icon="Check" disabled>检测完成</el-button>
@@ -20,7 +20,7 @@
type="warning"
v-if="testStatus=='paused' && activeIndex < checkTotal"
:icon="Refresh"
@click="emit('update:testStatus','process')"
@click="handleResumeTest"
>继续检测
</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 {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check";
import {ElMessage, ElMessageBox} from "element-plus";
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)
@@ -187,7 +188,7 @@ const timeDifference = ref(0)
// 真正的检测结果(详细到通道)
const checkResult = reactive<CheckData.ScriptChnItem[]>([])
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格则该检测项的id会被加入该数组。
let errorCheckItem:Array<{ scriptId: string, type: 'info' | 'warning' | 'error' }> = []
let errorCheckItem: Array<{ scriptId: string, type: 'info' | 'warning' | 'error' }> = []
// 用来存放检测日志
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
@@ -303,6 +304,28 @@ watch(testStatus, function (newValue, oldValue) {
watch(webMsgSend, function (newValue, oldValue) {
if (activeIndex <= checkTotal) {
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':
updateCheckResultView("VOL", true)
updateLog(true)
@@ -312,7 +335,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false)
updatePercentage()
if (testStatus.value != 'paused') {
activeIndex++;
activeIndex++
startTimer()
}
break;
@@ -838,7 +861,6 @@ const handlePauseOrContinue = () => {
type: 'info',
log: currentTime.value + ':暂停检测',
})
//pauseTimer()
console.log('暂停中')
}
if (testStatus.value == "process") {
@@ -847,7 +869,6 @@ const handlePauseOrContinue = () => {
type: 'info',
log: currentTime.value + ':继续检测',
})
//resumeTimer()
startTimer()
console.log('开始继续检测')
}
@@ -1016,20 +1037,15 @@ const startTimer = () => {
}
};
// const pauseTimer = () => {
// if (timer.value) {
// clearInterval(timer.value);
// timer.value = null;
// }
// console.log('暂停中')
// };
const handlePauseTest = () => {
// 发送暂停指令
emit('sendPause')
};
// const resumeTimer = () => {
// if (!timer.value) {
// startTimer();
// }
// console.log('开始继续检测')
// };
const handleResumeTest = () => {
// 发送继续检测指令
emit('sendResume')
};
//完成检测
const handleFinishTest = () => {

View File

@@ -17,7 +17,7 @@
<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>
<!-- <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>
<div>
@@ -208,6 +208,8 @@ const detectionOptions = ref([
});
}
let loading;
@@ -257,6 +259,7 @@ const detectionOptions = ref([
// })
TestStatus.value = 'start'
} else if (TestStatus.value == 'process') {
// 发送暂停指令
// pauseTest({deviceIds}).then(res => {
// console.log(res)
// if (res.code === 20000) {
@@ -268,6 +271,7 @@ const detectionOptions = ref([
// })
TestStatus.value = 'paused'
} else if (TestStatus.value == 'paused') {
// 发送继续指令
// resumeTest({deviceIds}).then(res => {
// console.log(res)
// if (res.code === 20000) {
@@ -325,6 +329,14 @@ const detectionOptions = ref([
}
})
const sendPause = () => {
console.log('发送暂停指令')
}
const sendResume = () => {
console.log('发送继续检测指令')
}
const getIcon = (index: number) => {
if (stepsActiveIndex.value > index) return SuccessFilled;
switch (index) {