This commit is contained in:
caozehui
2024-12-24 11:29:31 +08:00
parent c241d8b819
commit 30c1f90513
6 changed files with 436 additions and 262 deletions

View File

@@ -42,8 +42,9 @@ export namespace CheckData {
// 用来描述检测脚本类型
export interface ScriptItem {
id: string,
code: string,
scriptItemName: string,
children?: ScriptItem[]
//children?: ScriptItem[]
}
// 用来描述 通道检测结果

View File

@@ -1,12 +1,34 @@
import type { Device } from '@/api/device/interface/device'
import http from '@/api'
export const startProTest = (params) => {
return http.post(`/prepare/startPreTest`, params,{ loading: false })
export const startPreTest = (params) => {
return http.post(`/prepare/startPreTest`, params, {loading: false})
}
export const closePreTest = (params) => {
return http.post(`/prepare/closePreTest`, params,{ loading: false })
}
}
/**
* 开始正式检测
* @param params
*/
export const startTest = (params: { deviceIds: string[] }) => {
return http.post(`/test/startTest`, params, {loading: false})
}
/**
* 暂停正式检测
* @param params
*/
export const pauseTest = (params: { deviceIds: string[] }) => {
return http.post(`/test/pauseTest`, params, {loading: false})
}
/**
* 继续正式检测
* @param params
*/
export const resumeTest = (params: { deviceIds: string[] }) => {
return http.post(`/test/resumeTest`, params, {loading: false})
}

View File

@@ -7,7 +7,8 @@ export const useCheckStore = defineStore("check", {
id: CHECK_STORE_KEY,
state: () => ({
devices: Array<CheckData.Device>()
devices: Array<CheckData.Device>(),
planId: String(""),
}),
getters: {},
@@ -19,6 +20,10 @@ export const useCheckStore = defineStore("check", {
clearDevices() {
this.devices = [];
},
setPlanId(planId: string) {
this.planId = planId
}
}
});

View File

@@ -542,7 +542,6 @@ let testType = "test";//检测还是复检
const handleSelectionChange = (selection: any[]) => {
channelsSelection.value = selection
console.log(selection);
devNum = selection.length;
devChannelsNum = 0;
for (let i = 0; i < selection.length; i++) {
@@ -569,8 +568,7 @@ const handleSelectionChange = (selection: any[]) => {
});
checkStore.clearDevices()
checkStore.addDevices(devices)
checkStore.setPlanId(selection[0].planId)
}
//查询

View File

@@ -91,13 +91,13 @@
</div>
<el-drawer v-model="drawer" title="检测项进度">
<!-- <div ref="scrollContainer" > -->
<p v-for="(item, index) in testLogList"
:key="index"
:style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
{{ item.log }}<br/>
</p>
<!-- </div> -->
<div ref="scrollContainer">
<p v-for="(item, index) in testLogList"
:key="index"
:style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
{{ item.log }}<br/>
</p>
</div>
</el-drawer>
<resultPopup
@@ -110,28 +110,163 @@
import {Check, InfoFilled, Refresh, VideoPause} from '@element-plus/icons-vue'
import resultPopup from './resultPopup.vue'
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import {reactive, ref} from "vue";
import {reactive, ref, watch} from "vue";
import {dialogBig} from "@/utils/elementBind";
import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check";
const checkStore = useCheckStore()
// 总测试项数
const TEST_TOTAL = 12 + 1
// 最大通道数
const MAX_CHN_SUM = 10
const props = defineProps({
testStatus: {
type: String,
default: 'waiting'
},
webMsgSend: {
type: Object,
default: () => ({})
}
})
const emit = defineEmits(['update:testStatus', 'update:webMsgSend']);
// 用来保存测试项进度抽屉是否打开
const drawer = ref(false)
// 进度条颜色
const customColors = [{color: "#5cb87a", percentage: 100}]
// 用来保存被检设备
const deviceList = reactive<CheckData.Device[]>([])
// 用来保存定时器
const timer: any = ref("");
// 当前进行的测试项索引
const activeIndex = ref(0)
// 百分比
const percentage = ref(0);
//测试项开始检测时间(或继续检测时间)
const startData = ref(new Date())
//测试项检测结束时间(或暂停时的时间)
const endData = ref(new Date())
const timeDifference = ref(0)
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格则该检测项的id会被加入该数组。
const errorCheckItem = reactive<string[]>([]);
// 用来存放检测日志
const testLogList = ref<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
const testStatus = toRef(props, 'testStatus')
const webMsgSend = toRef(props, 'webMsgSend')
const resultDialogVisible = ref(false)
const dataCheckSingleChannelSingleTestPopupRef = ref()
// 总通道数
const chnSum = computed(() => {
let sum = 0
deviceList.forEach((item) => {
sum += item.chnNum
})
return sum
})
watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') {
emit('update:testStatus', 'process')
startTimer()
}
if (newValue == 'paused' && oldValue == 'process') {
handlePauseOrContinue()
}
if (newValue === 'process' && oldValue == 'paused') {
handlePauseOrContinue()
}
})
watch(webMsgSend, function (newValue, oldValue) {
if (activeIndex.value <= TEST_TOTAL) {
console.log('检测开始')
switch (newValue.requestId) {
case 'Test_Freq':
updateCheckResultView("Freq")
break;
case 'Test_VOL':
updateCheckResultView("VOL")
break;
case 'Test_Harm_V':
updateCheckResultView("Harm_V")
break;
case 'Test_Harm_I':
updateCheckResultView("Harm_I")
break;
case 'Test_Harm_P':
updateCheckResultView("Harm_P")
break;
case 'Test_InHarm_V':
updateCheckResultView("InHarm_V")
break;
case 'Test_InHarm_I':
updateCheckResultView("InHarm_I")
break;
case 'Test_Dip':
updateCheckResultView("Dip")
break;
case 'Test_CUR':
updateCheckResultView("CUR")
break;
case 'Test_MSQI_U':
updateCheckResultView("MSQI_U")
break;
case 'Test_MSQI_I':
updateCheckResultView("MSQI_I")
break;
case 'Test_Flicker':
updateCheckResultView("Flicker")
break;
case 'Test_Quit':
console.log('检测结束')
break;
}
updateLog()
activeIndex.value++;
if (percentage.value < 100) {
percentage.value = Math.trunc(activeIndex.value / TEST_TOTAL * 100);
} else {
percentage.value = 100;
clearInterval(timer.value)
timer.value = null;
emit('update:testStatus', 'success')
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
// if you want to disable its autofocus
// autofocus: false,
confirmButtonText: '确定',
})
clear();
}
} else {
clearInterval(timer.value)
timer.value = null;
emit('update:testStatus', 'success')
scrollToBottom();
}
}, {deep: true})
onBeforeMount(() => {
initScriptData()
initDeviceList()
initCheckResult()
})
const showTestLog = () => {
drawer.value = true
}
// 总测试项数
const TEST_TOTAL = 12
// 最大通道数
const MAX_CHN_SUM = 10
// 当前进行的测试项索引
const activeIndex = ref(0)
const dataCheckSingleChannelSingleTestPopupRef = ref();
// const currentRow = ref<{
// id: number;
// scriptItemName: string;
@@ -143,111 +278,110 @@ const dataCheckSingleChannelSingleTestPopupRef = ref();
// const currentRow = ref(null); // 用于存储当前选中的行
const deviceList = reactive<CheckData.Device[]>([
// {
// deviceID: '1',
// deviceName: '240001',
// chnNum: 1,
// monitorIdx: 1,
// label: '240001',
// prop: 'Result1',
// },
// {
// deviceID: '2',
// deviceName: '240002',
// chnNum: 1,
// monitorIdx: 2,
// label: '240002',
// prop: 'Result2',
// },
// {
// deviceID: '3',
// deviceName: '240003',
// chnNum: 2,
// monitorIdx: 1,
// label: '240003',
// prop: 'Result3',
// },
// {
// deviceID: '4',
// deviceName: '240004',
// chnNum: 4,
// monitorIdx: 2,
// label: '240004',
// prop: 'Result4',
// }
])
// 总通道数
const chnSum = computed(() => {
let sum = 0
deviceList.forEach((item) => {
sum += item.chnNum
})
return sum
})
onBeforeMount(() => {
initScriptData()
initDeviceList()
initCheckResult()
})
// 检测脚本数据
const scriptData = reactive<CheckData.ScriptItem[]>([])
// 初始化检测脚本数据
const initScriptData = () => {
Object.assign(scriptData, [
{
id: '1',
scriptItemName: '频率'
},
{
id: '2',
scriptItemName: '电压'
},
{
id: '3',
scriptItemName: '谐波电压'
},
{
id: '4',
scriptItemName: '谐波电流'
},
{
id: '5',
scriptItemName: '谐波有功功率'
},
{
id: '6',
scriptItemName: '间谐波电压'
},
{
id: '7',
scriptItemName: '间谐波电流'
},
{
id: '8',
scriptItemName: '暂态'
},
{
id: '9',
scriptItemName: '电流'
},
{
id: '10',
scriptItemName: '电压不平衡度'
},
{
id: '11',
scriptItemName: '电流不平衡度'
},
{
id: '12',
scriptItemName: '短时闪变'
},
])
let map = new Map<string, string>()
map.set('Freq', '频率')
.set('VOL', '电压')
.set('Harm_V', '谐波电压')
.set('Harm_I', '谐波电流')
.set('Harm_P', '谐波有功功率')
.set('InHarm_V', '间谐波电压')
.set('InHarm_I', '间谐波电流')
.set('Dip', '暂态')
.set('CUR', '电流')
.set('MSQI_U', '电压不平衡度')
.set('MSQI_I', '电流不平衡度')
.set('Flicker', '短时闪变')
let response: CheckData.ScriptItem[] = [
{id: '1', code: 'Freq', scriptItemName: '频率准确度检测'},
{id: '2', code: 'VOL', scriptItemName: '电压准确度检测'},
{id: '3', code: 'Harm_V', scriptItemName: '谐波电压准确度检测'},
{id: '4', code: 'Harm_I', scriptItemName: '谐波电流准确度检测'},
{id: '5', code: 'Harm_P', scriptItemName: '谐波有功功率准确度检测'},
{id: '6', code: 'InHarm_V', scriptItemName: '间谐波电压准确度检测'},
{id: '7', code: 'InHarm_I', scriptItemName: '间谐波电流准确度检测'},
{id: '8', code: 'Dip', scriptItemName: '暂态准确度检测'},
{id: '9', code: 'CUR', scriptItemName: '电流准确度检测'},
{id: '10', code: 'MSQI_U', scriptItemName: '三相电压不平衡度检测'},
{id: '11', code: 'MSQI_I', scriptItemName: '三相电流不平衡度检测'},
{id: '12', code: 'Flicker', scriptItemName: '闪变准确度检测'}
]
// Object.assign(scriptData, [
// {
// id: '1',
// code: 'Freq',
// scriptItemName: '频率'
// },
// {
// id: '2',
// code: 'VOL',
// scriptItemName: '电压'
// },
// {
// id: '3',
// code: 'Harm_V',
// scriptItemName: '谐波电压'
// },
// {
// id: '4',
// code: 'Harm_I',
// scriptItemName: '谐波电流'
// },
// {
// id: '5',
// code: 'Harm_P',
// scriptItemName: '谐波有功功率'
// },
// {
// id: '6',
// code: 'InHarm_V',
// scriptItemName: '间谐波电压'
// },
// {
// id: '7',
// code: 'InHarm_I',
// scriptItemName: '间谐波电流'
// },
// {
// id: '8',
// code: 'Dip',
// scriptItemName: '暂态'
// },
// {
// id: '9',
// code: 'CUR',
// scriptItemName: '电流'
// },
// {
// id: '10',
// code: 'MSQI_U',
// scriptItemName: '电压不平衡度'
// },
// {
// id: '11',
// code: 'MSQI_I',
// scriptItemName: '电流不平衡度'
// },
// {
// id: '12',
// code: 'Flicker',
// scriptItemName: '短时闪变'
// },
// ])
let temp = response.map(item => {
return {
...item,
scriptItemName: map.get(item.code) || item.scriptItemName
}
})
scriptData.push(...temp)
}
// 初始化设备列表
const initDeviceList = () => {
@@ -358,8 +492,8 @@ function getRandomInt(max: number): number {
}
//判断该检测项(例如 频率准确度检测)是否全部合格(所有设备所有通道所有子检测项目全部合格为合格,否则为不合格)
function getItemCheckResult(index: number): boolean {
let items = errorCheckItem.filter((item) => item === index.toString())
function getItemCheckResult(scriptId: string): boolean {
let items = errorCheckItem.filter((item) => item === scriptId)
if (items.length > 0) {
return false
} else {
@@ -367,12 +501,6 @@ function getItemCheckResult(index: number): boolean {
}
}
//测试项开始检测时间(或继续检测时间)
const startData = ref(new Date())
//测试项检测结束时间(或暂停时的时间)
const endData = ref(new Date())
const timeDifference = ref(0)
function getTimeDifference(timeDifference: number): string {
// 将时间差转换为天、小时、分钟、秒
const millisecondsPerDay = 1000 * 60 * 60 * 24;
@@ -393,9 +521,6 @@ function getTimeDifference(timeDifference: number): string {
}
}
// 用来存放检测日志
const testLogList = ref<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
// 更新日志
const updateLog = () => {
const currentTime = ref(new Date().toLocaleString());
@@ -415,7 +540,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':频率准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -432,7 +557,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':电压准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -449,7 +574,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':谐波电压准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -466,7 +591,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':谐波电流准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -483,7 +608,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':谐波有功功率准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -500,7 +625,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':间谐波电压准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -517,7 +642,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':间谐波电流准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -534,7 +659,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':暂态准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -551,7 +676,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':电流准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -568,7 +693,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':电压不平衡度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -585,7 +710,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':电流不平衡度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -602,7 +727,7 @@ const updateLog = () => {
endData.value = new Date();
timeDifferenceItem = endData.value.getTime() - startData.value.getTime();
timeDifference.value += timeDifferenceItem
if (getItemCheckResult(activeIndex.value - 1)) {
if (getItemCheckResult(scriptData[activeIndex.value - 2].id)) {
testLogList.value.push({
type: 'info',
log: currentTime.value + ':闪变准确度检测合格,用时' + getTimeDifference(timeDifferenceItem),
@@ -623,9 +748,6 @@ const updateLog = () => {
scrollToBottom();
}
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格则该检测项的id会被加入该数组。
const errorCheckItem = reactive<string[]>([]);
// 动态获取表格单元格样式
function tableCell({row, columnIndex}) {
let items = errorCheckItem.filter((item) => item === row.scriptId)
@@ -638,22 +760,10 @@ function tableCell({row, columnIndex}) {
}
}
// 百分比
const percentage = ref(0);
const customColors = [
{color: "#5cb87a", percentage: 100}, //绿
];
const resultDialogVisible = ref(false)
function clear() {
}
const updateCheckResultView = (scriptId: string) => {
const temp = simulateCheck(scriptId)
const updateCheckResultView = (scriptCode: string) => {
let scriptId = scriptData.filter(item => item.code === scriptCode)[0]?.id
let temp = simulateCheck(scriptId)
updateCheckResult(temp)
// traverseTableData(scriptData, id);
};
// 模拟检测 todo 可移除
@@ -669,7 +779,7 @@ const simulateCheck = (scriptId: string) => {
let randomNum = getRandomInt(item.chnNum * 2)
if (activeIndex.value >= 4 && activeIndex.value <= 6) {
if (randomNum <= item.chnNum) {
if (randomNum < item.chnNum) {
tempChnResult[randomNum] = CheckData.ChnCheckResultEnum.FAIL
errorCheckItem.push(scriptId)
@@ -691,19 +801,6 @@ const simulateCheck = (scriptId: string) => {
return tempScriptChnItem
}
const handleReCheck = () => {
activeIndex.value = 0;
percentage.value = 0;
// tableData.value.length = 0;
testLogList.value.length = 0;
errorCheckItem.length = 0;
//tableData.value = JSON.parse(JSON.stringify(operatorTableData.value));
resumeTimer()
};
// 用来保存定时器
const timer: any = ref("");
// 处理暂停、继续按钮点击事件
const handlePauseOrContinue = () => {
const currentTime = ref(new Date().toLocaleString());
@@ -719,7 +816,7 @@ const handlePauseOrContinue = () => {
})
pauseTimer()
}
if(testStatus.value == "process"){
if (testStatus.value == "process") {
startData.value = new Date();
testLogList.value.push({
type: 'info',
@@ -730,104 +827,95 @@ const handlePauseOrContinue = () => {
};
// 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道
const handleClick = (scriptId:string,deviceId: any, chnNum: number) => {
const handleClick = (scriptId: string, deviceId: any, chnNum: number) => {
dataCheckSingleChannelSingleTestPopupRef.value?.open(scriptId, deviceId, chnNum);
};
const props = defineProps({
testStatus: {
type: String,
default: 'waiting'
}
})
const testStatus = toRef(props, 'testStatus');
//监听goods_sn的变化
watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') {
emit('update:testStatus', 'process')
startTimer()
}
if (newValue == 'paused' && oldValue == 'process') {
handlePauseOrContinue()
}
if (newValue === 'process' && oldValue == 'paused') {
handlePauseOrContinue()
}
})
const emit = defineEmits(['update:testStatus']);
const startTimer = () => {
activeIndex.value++;
//if (timer.value !== null) return; // 如果定时器已经启动,则不再重复启动
timer.value = setInterval(() => {
if (activeIndex.value <= TEST_TOTAL) {
activeIndex.value++;
updateLog()
switch (activeIndex.value) {
case 1:
// todo 向后端获取检测结果
// updateCheckResult(null)
// updateCheckResultView("1-1-1")
// updateCheckResultView("1-1-2")
// updateCheckResultView("1-1-3")
// updateCheckResultView("1-1-4")
// updateCheckResultView("1-1")
// updateCheckResultView("1-2-1")
// updateCheckResultView("1-2")
// updateCheckResultView("1-3-1")
// updateCheckResultView("1-3")
updateCheckResultView("1")
emit('update:webMsgSend', {
requestId: 'Test_Freq',
params: {}
})
break;
case 2:
// updateCheckResultView("2-1-1")
// updateCheckResultView("2-1-2")
// updateCheckResultView("2-1-3")
// updateCheckResultView("2-1-4")
// updateCheckResultView("2-1-5")
// updateCheckResultView("2-1")
// updateCheckResultView("2-2-1")
// updateCheckResultView("2-2")
// updateCheckResultView("2-3-1")
// updateCheckResultView("2-3")
updateCheckResultView("2")
emit('update:webMsgSend', {
requestId: 'Test_VOL',
params: {}
})
break;
case 3:
emit('update:webMsgSend', {
requestId: 'Test_Harm_V',
params: {}
})
break;
case 4:
emit('update:webMsgSend', {
requestId: 'Test_Harm_I',
params: {}
})
break;
case 5:
emit('update:webMsgSend', {
requestId: 'Test_Harm_P',
params: {}
})
break;
case 6:
emit('update:webMsgSend', {
requestId: 'Test_InHarm_V',
params: {}
})
break;
case 7:
emit('update:webMsgSend', {
requestId: 'Test_InHarm_I',
params: {}
})
break;
case 8:
emit('update:webMsgSend', {
requestId: 'Test_Dip',
params: {}
})
break;
case 9:
emit('update:webMsgSend', {
requestId: 'Test_CUR',
params: {}
})
break;
case 10:
emit('update:webMsgSend', {
requestId: 'Test_MSQI_U',
params: {}
})
break;
case 11:
emit('update:webMsgSend', {
requestId: 'Test_MSQI_I',
params: {}
})
break;
case 12:
updateCheckResultView(activeIndex.value.toString())
emit('update:webMsgSend', {
requestId: 'Test_Flicker',
params: {}
})
break;
case 13:
emit('update:webMsgSend', {
requestId: 'Test_Quit',
params: {}
})
break;
}
if (percentage.value < 100) {
percentage.value = Math.trunc(activeIndex.value / TEST_TOTAL * 100);
} else {
percentage.value = 100;
clearInterval(timer.value)
timer.value = null;
emit('update:testStatus', 'success')
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
// if you want to disable its autofocus
// autofocus: false,
confirmButtonText: '确定',
})
clear();
}
} else {
clearInterval(timer.value)
timer.value = null;
emit('update:testStatus', 'success')
scrollToBottom();
}
}, 2000);
};
@@ -853,6 +941,18 @@ const handleFinishTest = () => {
ElMessage.success("完成检测");
};
const handleReCheck = () => {
activeIndex.value = 0;
percentage.value = 0;
// tableData.value.length = 0;
testLogList.value.length = 0;
errorCheckItem.length = 0;
//tableData.value = JSON.parse(JSON.stringify(operatorTableData.value));
resumeTimer()
};
function clear() {
}
</script>
<style scoped lang="scss">

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 v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus"></test>
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"></test>
<template #footer>
<div>
@@ -54,11 +54,11 @@
} from '@element-plus/icons-vue'
import preTest from './preTest.vue'
import timeTest from './timeTest.vue'
import channelsTest from './channelsTest.vue'
import { Device } from '@/api/device/interface/device';
import socketClient from '@/utils/webSocketClient';
import {useCheckStore} from "@/stores/modules/check";
import {startPreTest,startTest,pauseTest,resumeTest} from '@/api/socket/socket'
import {startProTest} from '@/api/socket/socket'
//import SvgIcon from '@/components/SvgIcon.vue';
@@ -88,6 +88,7 @@
// (e: 'submit', data: any): void;
// }>();
const checkStore = useCheckStore();
const skipDisabled = ref(false);
const nextStepText = ref('下一步');
const dialogVisible = ref(false)
@@ -196,6 +197,25 @@ const checkStates = selection.map(item => item.checkState);
/* else if(res.code === 10200){
switch (res.operateCode){
case 'INIT_GATHER':
break
}
}else if(res.code === 10201){
switch (res.operateCode){
case 'INIT_GATHER':
//开始进入源初始化检测
break
}
}*/
});
@@ -205,6 +225,7 @@ const checkStates = selection.map(item => item.checkState);
const handleSubmit = () => {
skipDisabled.value = true
console.log('=============',stepsActiveIndex.value)
let deviceIds = checkStore.devices.map((item) => item.deviceId)
switch (stepsActiveIndex.value) {
case 0:
preTestStatus.value = 'start'
@@ -215,7 +236,7 @@ const checkStates = selection.map(item => item.checkState);
text: '',
background: 'rgb(255, 255, 255, 0)',
})*/
startProTest({
startPreTest({
userPageId: "cdf",
devIds:["5eaba83670ff4d9daf892a62a5e13ea3","80b4b4f52a4c4064a18319525f8ac13c"],
planId:"31cc203f3fa94fa39323ae7cc411cd66"
@@ -233,10 +254,34 @@ const checkStates = selection.map(item => item.checkState);
// break;
case 2:
if (TestStatus.value == "waiting") {
// startTest({deviceIds}).then(res => {
// console.log(res)
// if (res.code === 20000) {
// TestStatus.value = 'process'
// } else {
// ElMessage.error(res.message)
// }
// })
TestStatus.value = 'start'
} else if (TestStatus.value == 'process') {
// pauseTest({deviceIds}).then(res => {
// console.log(res)
// if (res.code === 20000) {
// TestStatus.value = 'paused'
// } else {
// ElMessage.error(res.message)
// }
// })
TestStatus.value = 'paused'
} else if (TestStatus.value == 'paused') {
// resumeTest({deviceIds}).then(res => {
// console.log(res)
// if (res.code === 20000) {
// TestStatus.value = 'process'
// } else {
// ElMessage.error(res.message)
// }
// })
TestStatus.value = 'process'
}
break;
@@ -321,6 +366,8 @@ const getIcon = (index: number) => {
timeTestStatus.value = "waiting"
channelsTestStatus.value = "waiting"
TestStatus.value = "waiting"
ActiveStatue.value = "waiting"
skipDisabled.value = false
nextStepText.value = "下一步"
}
const beforeClose = (done: () => void) => {
@@ -338,6 +385,7 @@ const getIcon = (index: number) => {
)
.then(() => {
clearData()
// todo 关闭弹窗,终止整个检测流程
//emit('update:visible', false); // 关闭对话框
dialogVisible.value = false;
})