frontend/src/views/machine/errorSystem/components/errorSystemDetailTable.vue
This commit is contained in:
@@ -42,8 +42,9 @@ export namespace CheckData {
|
||||
// 用来描述检测脚本类型
|
||||
export interface ScriptItem {
|
||||
id: string,
|
||||
code: string,
|
||||
scriptItemName: string,
|
||||
children?: ScriptItem[]
|
||||
//children?: ScriptItem[]
|
||||
}
|
||||
|
||||
// 用来描述 通道检测结果
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import http from "@/api";
|
||||
|
||||
export const getCheckItemDetail = (params: { checkItemId: string, deviceId: string, chnNum: number }) => {
|
||||
export const getCheckItemDetail = (params: { deviceId: string, chnNum: number, checkItemId?: string }) => {
|
||||
return http.post<any>("/check/test/detail/", params, {loading: false});
|
||||
}
|
||||
@@ -1,7 +1,34 @@
|
||||
import type { Device } from '@/api/device/interface/device'
|
||||
import http from '@/api'
|
||||
|
||||
|
||||
export const startTest = (params) => {
|
||||
return http.post(`/prepare/startTest`, 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})
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -62,7 +62,7 @@ export default class SocketService {
|
||||
if (message?.type && this.callBackMapping[message.type]) {
|
||||
this.callBackMapping[message.type](message);
|
||||
} else {
|
||||
console.log("抛弃")
|
||||
console.log("抛弃====>"+message)
|
||||
/* 丢弃或继续写你的逻辑 */
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,6 +67,7 @@ import DataCheckResultTable from './dataCheckResultTable.vue'
|
||||
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
||||
import {CheckData} from "@/api/check/interface";
|
||||
import {data as treeData} from "@/api/plan/autoTest.json";
|
||||
import {getCheckItemDetail} from "@/api/check/test";
|
||||
|
||||
const {appendToBody} = withDefaults(defineProps<{
|
||||
appendToBody: boolean
|
||||
@@ -279,10 +280,14 @@ const close = () => {
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
const open = (checkItemId: string, deviceId: string, chnNum?: number) => {
|
||||
console.log(checkItemId, deviceId, chnNum);
|
||||
const open = async (deviceId: string, chnNum: number, checkItemId?: string) => {
|
||||
// 发起后端请求,查询详细信息
|
||||
//const result = await getCheckItemDetail({checkItemId,deviceId, chnNum})
|
||||
// 当checkItemId为空时,默认显示全部测试项、全部不合格测试项
|
||||
// 当checkItemId不为空时,默认显示当前checkItemId的测试项、属于当前checkItemId的不合格测试项
|
||||
checkItemId = checkItemId ?? ''
|
||||
console.log(deviceId, chnNum, checkItemId);
|
||||
//const result = await getCheckItemDetail({deviceId, chnNum, checkItemId})
|
||||
|
||||
|
||||
// 数据处理
|
||||
// checkResultTableData=[];
|
||||
@@ -330,6 +335,7 @@ defineExpose({
|
||||
padding: 10px 0;
|
||||
border: 1px solid #ccc;
|
||||
overflow: auto;
|
||||
|
||||
.content-tree {
|
||||
min-width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<div class="dialog-left">
|
||||
<el-steps direction="vertical" :active="activeIndex" :process-status="currentStepStatus"
|
||||
finish-status="success">
|
||||
<el-step title="源通讯校验" />
|
||||
<el-step title="设备通讯校验" />
|
||||
<el-step title="协议校验" />
|
||||
<el-step title="相序校验" />
|
||||
<el-step title="检测完成" />
|
||||
<el-step :status="step1" title="源通讯校验" />
|
||||
<el-step :status="step2" title="设备通讯校验" />
|
||||
<el-step :status="step3" title="协议校验" />
|
||||
<el-step :status="step4" title="相序校验" />
|
||||
<el-step :status="step5" title="检测完成" />
|
||||
</el-steps>
|
||||
</div>
|
||||
<div class="dialog-right">
|
||||
@@ -63,7 +63,7 @@
|
||||
</template>
|
||||
<script lang="tsx" setup name="preTest">
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
import { defineExpose } from 'vue';
|
||||
const step1InitLog = ref([
|
||||
{
|
||||
type: 'info',
|
||||
@@ -160,6 +160,12 @@ const step4Log = ref([
|
||||
const collapseActiveName = ref('1')
|
||||
const activeIndex = ref(0)
|
||||
const activeTotalNum = ref(5)
|
||||
const step1 = ref('wait')
|
||||
const step2 = ref('wait')
|
||||
const step3 = ref('wait')
|
||||
const step4 = ref('wait')
|
||||
const step5 = ref('wait')
|
||||
|
||||
//定义与预检测配置数组
|
||||
const detectionOptions = ref([
|
||||
{
|
||||
@@ -224,7 +230,7 @@ const webMsgSend = toRef(props, 'webMsgSend');
|
||||
const ts = ref('');
|
||||
|
||||
watch(webMsgSend,function (newValue,oldValue){
|
||||
console.log(newValue)
|
||||
// console.log(newValue)
|
||||
|
||||
switch (newValue.requestId){
|
||||
case 'yjc_ytxjy':
|
||||
@@ -235,14 +241,19 @@ watch(webMsgSend,function (newValue,oldValue){
|
||||
type: 'info',
|
||||
log: '源校验成功!',
|
||||
})
|
||||
activeIndex.value++
|
||||
activeIndex.value = 1
|
||||
step1.value = 'success'
|
||||
step2.value = 'process'
|
||||
}else if(newValue.code == 10201){
|
||||
step1.value = 'process'
|
||||
step1InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行源校验!',
|
||||
}];
|
||||
}else if(newValue.code == 10552){
|
||||
ElMessage.error(newValue.code)
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -262,14 +273,23 @@ watch(webMsgSend,function (newValue,oldValue){
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step2.value = 'process'
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行设备通讯校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
step2.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value++
|
||||
activeIndex.value = 2
|
||||
step2.value = 'success'
|
||||
step3.value = 'process'
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -277,6 +297,29 @@ watch(webMsgSend,function (newValue,oldValue){
|
||||
break;
|
||||
case 'yjc_xyjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '统计数据协议校验:'+newValue.data+'通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
step3.value = 'error'
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$02':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
@@ -285,12 +328,19 @@ watch(webMsgSend,function (newValue,oldValue){
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3.value = 'process'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
step3.value = 'error'
|
||||
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$03':
|
||||
@@ -301,19 +351,105 @@ watch(webMsgSend,function (newValue,oldValue){
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
|
||||
step3.value = 'process'
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
//ElMessage.error("当前步骤已经初始化,执行自动关闭,请重新发起检测!")
|
||||
step3.value = 'error'
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value++
|
||||
activeIndex.value = 3
|
||||
step3.value = 'success'
|
||||
step4.value = 'process'
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'YJC_xujy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'OPER_GATHER':
|
||||
if (newValue.code == 10200) {
|
||||
step4InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '源已接通!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step4.value = 'process'
|
||||
step4InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在接通源.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
|
||||
step4.value = 'error'
|
||||
ts.value = 'error'
|
||||
} else if (newValue.code == 10520) {
|
||||
step4.value = 'error'
|
||||
step4InitLog.value.push({
|
||||
type: 'error',
|
||||
log: '解析报文异常',
|
||||
})
|
||||
ts.value = 'error'
|
||||
}
|
||||
break;
|
||||
|
||||
case 'DATA_REQUEST$02':
|
||||
if (newValue.code == 10200) {
|
||||
step4InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '相序校验:'+newValue.data,
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step4.value = 'process'
|
||||
step4InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '获取数据相序校验数据!',
|
||||
}];
|
||||
}
|
||||
else if (newValue.code == 25001) {
|
||||
step4.value = 'success'
|
||||
step5.value = 'success'
|
||||
step4InitLog.value.push({
|
||||
type: 'wait',
|
||||
log: '相序校验成功!',
|
||||
})
|
||||
}
|
||||
activeIndex.value = 5
|
||||
ts.value = 'success'
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'quit':
|
||||
break;
|
||||
case 'connect':
|
||||
switch (newValue.operateCode){
|
||||
case "Source":
|
||||
step1.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '源服务端连接失败!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
break;
|
||||
case "Dev":
|
||||
step2.value = 'error'
|
||||
step2InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '设备服务端连接失败!',
|
||||
}];
|
||||
ts.value = 'error'
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -322,45 +458,19 @@ watch(webMsgSend,function (newValue,oldValue){
|
||||
})
|
||||
|
||||
watch(activeIndex, function (newValue, oldValue) {
|
||||
if (newValue <= activeTotalNum.value - 2)
|
||||
|
||||
console.log(activeIndex.value)
|
||||
if (activeIndex.value === 1) {
|
||||
|
||||
}
|
||||
if (activeIndex.value === 2) {
|
||||
|
||||
}
|
||||
if (activeIndex.value === 3) {
|
||||
|
||||
}
|
||||
if (activeIndex.value > 3) {
|
||||
|
||||
}
|
||||
if (activeIndex.value < activeTotalNum.value - 2)
|
||||
collapseActiveName.value = (newValue + 1).toString()
|
||||
collapseActiveName.value = (newValue+1).toString()
|
||||
else
|
||||
collapseActiveName.value = (activeTotalNum.value - 1).toString()
|
||||
collapseActiveName.value = (newValue - 1).toString()
|
||||
})
|
||||
|
||||
//监听goods_sn的变化
|
||||
watch(testStatus, function (newValue, oldValue) {
|
||||
|
||||
ts.value = props.testStatus;
|
||||
if (ts.value === 'start') {
|
||||
ts.value = 'process'
|
||||
|
||||
/*let timer = setInterval(() => {
|
||||
if (activeIndex.value < activeTotalNum.value - 2)
|
||||
activeIndex.value++
|
||||
else if (activeIndex.value === activeTotalNum.value - 2) {
|
||||
activeIndex.value++
|
||||
activeIndex.value++
|
||||
}
|
||||
else {
|
||||
clearInterval(timer)
|
||||
ts.value = 'success'
|
||||
}
|
||||
|
||||
}, 1500);*/
|
||||
}else if(ts.value === 'waiting'){
|
||||
activeIndex.value = 0
|
||||
step1InitLog.value = [
|
||||
@@ -369,6 +479,11 @@ watch(testStatus, function (newValue, oldValue) {
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step1.value = 'finish'
|
||||
step2.value = 'wait'
|
||||
step3.value = 'wait'
|
||||
step4.value = 'wait'
|
||||
step5.value = 'wait'
|
||||
}
|
||||
})
|
||||
|
||||
@@ -379,6 +494,52 @@ watch(ts, function (newValue, oldValue) {
|
||||
emit('update:testStatus', ts.value)
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
// 定义一个初始化参数的方法
|
||||
function initializeParameters() {
|
||||
activeIndex.value = 0
|
||||
step1.value = 'process'
|
||||
step2.value = 'wait'
|
||||
step3.value = 'wait'
|
||||
step4.value = 'wait'
|
||||
step5.value = 'wait'
|
||||
|
||||
step1InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step2InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step3InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
step4InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
initializeParameters,
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.test-dialog {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
//查询
|
||||
@@ -909,8 +907,7 @@ const openDrawer = (title: string, row: any) => {
|
||||
|
||||
if(title === '检测数据查询')
|
||||
{
|
||||
let device={}
|
||||
dataCheckPopupRef.value?.open(device)
|
||||
dataCheckPopupRef.value?.open(row.id,-1)
|
||||
}
|
||||
if (title === '误差体系更换')
|
||||
{
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="testStatus=='process' && activeIndex < TEST_TOTAL"
|
||||
v-if="testStatus=='process' && activeIndex < checkTotal"
|
||||
:disabled="activeIndex===0"
|
||||
:icon="VideoPause"
|
||||
@click="emit('update:testStatus','paused')">停止检测
|
||||
</el-button>
|
||||
|
||||
<el-button type="success" v-if="activeIndex >= TEST_TOTAL" :icon="Check" disabled>检测完成</el-button>
|
||||
<el-button type="success" v-if="activeIndex >= checkTotal" :icon="Check" disabled>检测完成</el-button>
|
||||
|
||||
<el-button
|
||||
type="warning"
|
||||
v-if="testStatus=='paused' && activeIndex < TEST_TOTAL"
|
||||
v-if="testStatus=='paused' && activeIndex < checkTotal"
|
||||
:icon="Refresh"
|
||||
@click="emit('update:testStatus','process')"
|
||||
>继续检测
|
||||
@@ -26,7 +26,7 @@
|
||||
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
|
||||
<!-- <el-button
|
||||
type="warning"
|
||||
v-if="activeIndex >= TEST_TOTAL"
|
||||
v-if="activeIndex >= checkTotal"
|
||||
:icon="Refresh"
|
||||
@click="handleReCheck"
|
||||
>重新检测</el-button
|
||||
@@ -90,15 +90,20 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="drawer-container">
|
||||
<el-drawer v-model="drawer" title="检测项进度">
|
||||
<!-- <div ref="scrollContainer" > -->
|
||||
<!-- <template #header>-->
|
||||
<!-- <div style="background: #003078 !important; color: #fff !important; font-size: 18px;">检测项进度</div>-->
|
||||
<!-- </template>-->
|
||||
<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>
|
||||
</el-drawer>
|
||||
</div>
|
||||
|
||||
<resultPopup
|
||||
:visible="resultDialogVisible"
|
||||
@@ -110,74 +115,66 @@
|
||||
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 drawer = ref(false)
|
||||
const showTestLog = () => {
|
||||
drawer.value = true
|
||||
}
|
||||
|
||||
// 总测试项数
|
||||
const TEST_TOTAL = 12
|
||||
// 最大通道数
|
||||
const MAX_CHN_SUM = 10
|
||||
|
||||
// 总测试项数
|
||||
const checkTotal = ref(0)
|
||||
|
||||
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 scriptData = reactive<CheckData.ScriptItem[]>([])
|
||||
// 用来保存被检设备
|
||||
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)
|
||||
// 真正的检测结果(详细到通道)
|
||||
const checkResult = reactive<CheckData.ScriptChnItem[]>([])
|
||||
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格,则该检测项的id会被加入该数组。
|
||||
const errorCheckItem = reactive<string[]>([]);
|
||||
// 用来存放检测日志
|
||||
const testLogList = ref<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
||||
|
||||
const dataCheckSingleChannelSingleTestPopupRef = ref();
|
||||
const testStatus = toRef(props, 'testStatus')
|
||||
const webMsgSend = toRef(props, 'webMsgSend')
|
||||
|
||||
// const currentRow = ref<{
|
||||
// id: number;
|
||||
// scriptItemName: string;
|
||||
// name: string;
|
||||
// address: string;
|
||||
// hasChildren?: boolean;
|
||||
// children?: User[]
|
||||
// } | null>(null);
|
||||
// const currentRow = ref(null); // 用于存储当前选中的行
|
||||
const resultDialogVisible = ref(false)
|
||||
const scrollContainer = ref<HTMLElement | null>(null);
|
||||
const dataCheckSingleChannelSingleTestPopupRef = ref<InstanceType<typeof dataCheckSingleChannelSingleTestPopup>>()
|
||||
|
||||
|
||||
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
|
||||
@@ -187,116 +184,6 @@ const chnSum = computed(() => {
|
||||
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: '短时闪变'
|
||||
},
|
||||
])
|
||||
|
||||
}
|
||||
// 初始化设备列表
|
||||
const initDeviceList = () => {
|
||||
checkStore.devices.forEach(item => {
|
||||
deviceList.push({
|
||||
deviceId: item.deviceId,
|
||||
deviceName: item.deviceName,
|
||||
chnNum: item.chnNum,
|
||||
})
|
||||
})
|
||||
}
|
||||
// 真正的检测结果(详细到通道)
|
||||
const checkResult = reactive<CheckData.ScriptChnItem[]>([])
|
||||
// 初始化检测结果 (详细到通道)
|
||||
const initCheckResult = () => {
|
||||
scriptData.forEach(item => {
|
||||
// 处理当前节点的数据
|
||||
let temp: CheckData.ScriptChnItem = {
|
||||
scriptId: item.id,
|
||||
scriptItemName: item.scriptItemName,
|
||||
devices: []
|
||||
}
|
||||
for (let i = 0; i < deviceList?.length; i++) {
|
||||
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
||||
for (let j = 0; j < deviceList[i].chnNum; j++) {
|
||||
tempChnResult.push(CheckData.ChnCheckResultEnum.UNKNOWN)
|
||||
}
|
||||
temp.devices.push({
|
||||
deviceId: deviceList[i].deviceId,
|
||||
deviceName: deviceList[i].deviceName,
|
||||
chnResult: tempChnResult
|
||||
})
|
||||
}
|
||||
checkResult.push(temp)
|
||||
})
|
||||
}
|
||||
// 更新检测结果(详细到通道)
|
||||
const updateCheckResult = (data: CheckData.ScriptChnItem) => {
|
||||
const {scriptId} = {...data}
|
||||
|
||||
checkResult.forEach(item => {
|
||||
if (item.scriptId == scriptId) {
|
||||
item.devices.forEach((device, index) => {
|
||||
device.chnResult = [...data.devices[index].chnResult]
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 用来展示的检测结果
|
||||
const checkResultView = computed(() => {
|
||||
|
||||
@@ -346,7 +233,188 @@ const checkResultView = computed(() => {
|
||||
return result
|
||||
})
|
||||
|
||||
const scrollContainer = ref<HTMLElement | null>(null); // 声明 scrollContainer
|
||||
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 <= checkTotal.value) {
|
||||
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 / checkTotal.value * 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 initScriptData = () => {
|
||||
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: '闪变准确度检测'}
|
||||
]
|
||||
|
||||
let temp = response.map(item => {
|
||||
return {
|
||||
...item,
|
||||
scriptItemName: map.get(item.code) || item.scriptItemName
|
||||
}
|
||||
})
|
||||
|
||||
scriptData.push(...temp)
|
||||
checkTotal.value = scriptData.length + 1
|
||||
}
|
||||
// 初始化设备列表
|
||||
const initDeviceList = () => {
|
||||
checkStore.devices.forEach(item => {
|
||||
deviceList.push({
|
||||
deviceId: item.deviceId,
|
||||
deviceName: item.deviceName,
|
||||
chnNum: item.chnNum,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 初始化检测结果 (详细到通道)
|
||||
const initCheckResult = () => {
|
||||
scriptData.forEach(item => {
|
||||
// 处理当前节点的数据
|
||||
let temp: CheckData.ScriptChnItem = {
|
||||
scriptId: item.id,
|
||||
scriptItemName: item.scriptItemName,
|
||||
devices: []
|
||||
}
|
||||
for (let i = 0; i < deviceList?.length; i++) {
|
||||
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
||||
for (let j = 0; j < deviceList[i].chnNum; j++) {
|
||||
tempChnResult.push(CheckData.ChnCheckResultEnum.UNKNOWN)
|
||||
}
|
||||
temp.devices.push({
|
||||
deviceId: deviceList[i].deviceId,
|
||||
deviceName: deviceList[i].deviceName,
|
||||
chnResult: tempChnResult
|
||||
})
|
||||
}
|
||||
checkResult.push(temp)
|
||||
})
|
||||
}
|
||||
// 更新检测结果(详细到通道)
|
||||
const updateCheckResult = (data: CheckData.ScriptChnItem) => {
|
||||
const {scriptId} = {...data}
|
||||
|
||||
checkResult.forEach(item => {
|
||||
if (item.scriptId == scriptId) {
|
||||
item.devices.forEach((device, index) => {
|
||||
device.chnResult = [...data.devices[index].chnResult]
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const scrollToBottom = () => {
|
||||
if (scrollContainer.value) {
|
||||
scrollContainer.value.scrollTop = scrollContainer.value.scrollHeight;
|
||||
@@ -358,8 +426,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 +435,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 +455,6 @@ function getTimeDifference(timeDifference: number): string {
|
||||
}
|
||||
}
|
||||
|
||||
// 用来存放检测日志
|
||||
const testLogList = ref<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
||||
|
||||
// 更新日志
|
||||
const updateLog = () => {
|
||||
const currentTime = ref(new Date().toLocaleString());
|
||||
@@ -415,7 +474,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 +491,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 +508,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 +525,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 +542,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 +559,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 +576,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 +593,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 +610,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 +627,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 +644,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 +661,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 +682,6 @@ const updateLog = () => {
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格,则该检测项的id会被加入该数组。
|
||||
const errorCheckItem = reactive<string[]>([]);
|
||||
|
||||
// 动态获取表格单元格样式
|
||||
function tableCell({row, columnIndex}) {
|
||||
let items = errorCheckItem.filter((item) => item === row.scriptId)
|
||||
@@ -638,22 +694,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 +713,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 +735,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 +750,7 @@ const handlePauseOrContinue = () => {
|
||||
})
|
||||
pauseTimer()
|
||||
}
|
||||
if(testStatus.value == "process"){
|
||||
if (testStatus.value == "process") {
|
||||
startData.value = new Date();
|
||||
testLogList.value.push({
|
||||
type: 'info',
|
||||
@@ -730,104 +761,97 @@ const handlePauseOrContinue = () => {
|
||||
};
|
||||
|
||||
// 点击查看(设备)通道检测详情。参数1:设备信息,参数2:通道号,-1:代表查看全部通道
|
||||
const handleClick = (scriptId:string,deviceId: any, chnNum: number) => {
|
||||
dataCheckSingleChannelSingleTestPopupRef.value?.open(scriptId, deviceId, chnNum);
|
||||
const handleClick = (scriptId: string, deviceId: any, chnNum: number) => {
|
||||
dataCheckSingleChannelSingleTestPopupRef.value?.open(deviceId, chnNum, scriptId);
|
||||
};
|
||||
|
||||
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 = () => {
|
||||
if (activeIndex.value === 0) {
|
||||
activeIndex.value++;
|
||||
}
|
||||
//if (timer.value !== null) return; // 如果定时器已经启动,则不再重复启动
|
||||
timer.value = setInterval(() => {
|
||||
if (activeIndex.value <= TEST_TOTAL) {
|
||||
activeIndex.value++;
|
||||
updateLog()
|
||||
|
||||
if (activeIndex.value <= checkTotal.value) {
|
||||
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 +877,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">
|
||||
@@ -922,6 +958,24 @@ const handleFinishTest = () => {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.drawer-container{
|
||||
:deep(header.el-drawer__header){
|
||||
color: #fff !important;
|
||||
background-color: #003078 !important;
|
||||
|
||||
.el-drawer__close-btn svg:hover {
|
||||
color: #ccc !important;
|
||||
}
|
||||
|
||||
.el-drawer__title{
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//:deep(.el-drawer .el-drawer__title){
|
||||
// background-color: #003078 !important;
|
||||
//}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -935,4 +989,5 @@ const handleFinishTest = () => {
|
||||
padding: 5px 0 !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key" />
|
||||
</el-steps>
|
||||
</div>
|
||||
<preTest 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>
|
||||
<!-- <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,10 +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 {startTest} from '@/api/socket/socket'
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {startPreTest,startTest,pauseTest,resumeTest} from '@/api/socket/socket'
|
||||
|
||||
|
||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
||||
|
||||
@@ -87,6 +88,7 @@
|
||||
// (e: 'submit', data: any): void;
|
||||
// }>();
|
||||
|
||||
const checkStore = useCheckStore();
|
||||
const skipDisabled = ref(false);
|
||||
const nextStepText = ref('下一步');
|
||||
const dialogVisible = ref(false)
|
||||
@@ -143,6 +145,7 @@ const detectionOptions = ref([
|
||||
|
||||
const dialogTitle = ref('');
|
||||
const isTimeCheck = ref(false)
|
||||
const preTestRef = ref(null);
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (selection: Device.ResPqDev[],title: string,time:boolean) => {
|
||||
@@ -167,6 +170,11 @@ const detectionOptions = ref([
|
||||
dialogTitle.value = title;
|
||||
dialogVisible.value = true;
|
||||
isTimeCheck.value = time
|
||||
|
||||
if (preTestRef.value) {
|
||||
preTestRef.value.initializeParameters();
|
||||
}
|
||||
|
||||
preTestStatus.value = 'waiting';//预检测执行状态
|
||||
//开始创建webSocket客户端
|
||||
const data = reactive({
|
||||
@@ -217,6 +225,7 @@ const detectionOptions = ref([
|
||||
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'
|
||||
@@ -227,15 +236,15 @@ const detectionOptions = ref([
|
||||
text: '',
|
||||
background: 'rgb(255, 255, 255, 0)',
|
||||
})*/
|
||||
// startTest({
|
||||
// userPageId: "cdf",
|
||||
// devIds:["5eaba83670ff4d9daf892a62a5e13ea3","80b4b4f52a4c4064a18319525f8ac13c"],
|
||||
// //planId:"31cc203f3fa94fa39323ae7cc411cd66"
|
||||
// }).then(res=>{
|
||||
//
|
||||
//
|
||||
//
|
||||
// })
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds:["5eaba83670ff4d9daf892a62a5e13ea3","80b4b4f52a4c4064a18319525f8ac13c"],
|
||||
planId:"31cc203f3fa94fa39323ae7cc411cd66"
|
||||
}).then(res=>{
|
||||
|
||||
|
||||
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
timeTestStatus.value = 'start'
|
||||
@@ -245,10 +254,34 @@ const detectionOptions = ref([
|
||||
// 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;
|
||||
@@ -333,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) => {
|
||||
@@ -350,6 +385,7 @@ const getIcon = (index: number) => {
|
||||
)
|
||||
.then(() => {
|
||||
clearData()
|
||||
// todo 关闭弹窗,终止整个检测流程
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
dialogVisible.value = false;
|
||||
})
|
||||
|
||||
@@ -399,9 +399,9 @@ const resizeObserver = new ResizeObserver(entries => {
|
||||
chartsWidth.value = entry.contentRect.width;
|
||||
//console.log('Charts Info Width:', chartsWidth.value);
|
||||
|
||||
pieRef1.value.reSize(chartsWidth.value * 0.95, 180, true);
|
||||
pieRef2.value.reSize(chartsWidth.value * 0.95, 180, true);
|
||||
pieRef3.value.reSize(chartsWidth.value * 0.95, 180, true);
|
||||
pieRef1.value?.reSize(chartsWidth.value * 0.95, 180, true);
|
||||
pieRef2.value?.reSize(chartsWidth.value * 0.95, 180, true);
|
||||
pieRef3.value?.reSize(chartsWidth.value * 0.95, 180, true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user