微调
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="testStatus=='process' && activeIndex < checkTotal"
|
||||
:disabled="activeIndex===0"
|
||||
:icon="VideoPause"
|
||||
@click="emit('sendPause')">停止检测
|
||||
</el-button>
|
||||
@@ -180,7 +179,7 @@ let scriptData: CheckData.ScriptItem[] = []
|
||||
// 用来保存被检设备
|
||||
const deviceList = reactive<CheckData.Device[]>([])
|
||||
// 当前进行的测试项索引
|
||||
let activeIndex = 1
|
||||
let activeIndex = 0
|
||||
// 百分比
|
||||
const percentage = ref(0);
|
||||
//测试项开始检测时间(或继续检测时间)
|
||||
@@ -213,7 +212,7 @@ const chnSum = computed(() => {
|
||||
})
|
||||
|
||||
// 用来展示的检测结果
|
||||
const checkResultView: any[] = computed(() => {
|
||||
const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(() => {
|
||||
|
||||
let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => {
|
||||
let temp: CheckData.ScriptChnViewItem = {
|
||||
@@ -381,6 +380,10 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
case 'DATA_REQUEST$02':
|
||||
ElMessage.success('预检测成功!')
|
||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:预检测成功!`})
|
||||
|
||||
activeIndex = getNextActiveIndex()+2
|
||||
startTimer()
|
||||
|
||||
emit('update:testStatus', 'process')
|
||||
break
|
||||
}
|
||||
@@ -406,11 +409,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'FREQ_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("FREQ", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('FREQ')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -419,11 +422,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'V_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("V", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++
|
||||
activeIndex = getNextActiveIndex('V')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -432,11 +435,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'HV_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("HV", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('HV')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -445,11 +448,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'HI_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("HI", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('HI')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -458,11 +461,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'HP_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("HP", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('HP')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -471,11 +474,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'HSV_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("HSV", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('HSV')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -484,11 +487,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'HSI_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("HSI", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('HSI')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -497,11 +500,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'VOLTAGE_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("VOLTAGE", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('VOLTAGE')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -510,11 +513,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'I_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("I", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('I')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -523,11 +526,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'IMBV_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("IMBV", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('IMBV')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -536,11 +539,11 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'IMBA_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("IMBA", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('IMBA')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
@@ -549,17 +552,17 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
updateLog(true)
|
||||
break;
|
||||
case 'F_End':
|
||||
updatePercentage()
|
||||
updateCheckResultView("F", false)
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
if (testStatus.value != 'paused') {
|
||||
activeIndex++;
|
||||
activeIndex = getNextActiveIndex('F')
|
||||
startTimer()
|
||||
}
|
||||
break;
|
||||
case 'Quit':
|
||||
updateLog(false)
|
||||
updatePercentage()
|
||||
updateLog(false)
|
||||
console.log('检测结束')
|
||||
break;
|
||||
}
|
||||
@@ -905,7 +908,7 @@ const handleClick = (item: any, chnNum: string, scriptType: string) => {
|
||||
const startTimer = () => {
|
||||
console.log('开始检测第' + activeIndex + '项')
|
||||
switch (activeIndex) {
|
||||
case 1:
|
||||
case 0:
|
||||
setTimeout(() => {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: 'yjc_ytxjy',
|
||||
@@ -927,18 +930,20 @@ const startTimer = () => {
|
||||
operateCode: "DATA_REQUEST$02"
|
||||
})
|
||||
}, 6000)
|
||||
break;
|
||||
case 1:
|
||||
setTimeout(() => {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: 'FREQ_Start',
|
||||
params: {}
|
||||
})
|
||||
}, 9000)
|
||||
}, 1000)
|
||||
setTimeout(() => {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: 'FREQ_End',
|
||||
params: {}
|
||||
})
|
||||
}, 12000);
|
||||
}, 2000);
|
||||
break;
|
||||
case 2:
|
||||
emit('update:webMsgSend', {
|
||||
@@ -1057,7 +1062,7 @@ const startTimer = () => {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: 'IMBA_End',
|
||||
params: {}
|
||||
}, 2000)
|
||||
}, 4000)
|
||||
})
|
||||
break;
|
||||
case 12:
|
||||
@@ -1111,13 +1116,26 @@ const handleFinishTest = () => {
|
||||
};
|
||||
|
||||
const handleReCheck = () => {
|
||||
activeIndex = 1;
|
||||
activeIndex = 0;
|
||||
percentage.value = 0;
|
||||
testLogList.length = 0;
|
||||
errorCheckItem.length = 0;
|
||||
// resumeTimer()
|
||||
};
|
||||
|
||||
// 获取当前执行的大测试项序 的 下一个大测试项序号
|
||||
const getNextActiveIndex = (code: string = ''): number => {
|
||||
if (code === '') {
|
||||
return -1
|
||||
}
|
||||
for (let i = 0; i < scriptData.length; i++) {
|
||||
if (scriptData[i].code === code) {
|
||||
return i + 2
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
function clear() {
|
||||
errorCheckItem.length = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user