录波数据查询
This commit is contained in:
@@ -74,6 +74,7 @@ export const reCalculate = (params: {
|
|||||||
deviceId: string
|
deviceId: string
|
||||||
code: string
|
code: string
|
||||||
patternId: string
|
patternId: string
|
||||||
|
|
||||||
}) => {
|
}) => {
|
||||||
return http.post('/result/reCalculate', params, {loading: true})
|
return http.post('/result/reCalculate', params, {loading: true})
|
||||||
}
|
}
|
||||||
@@ -87,6 +88,8 @@ export const getContrastFormContent = (params: {
|
|||||||
deviceId: string
|
deviceId: string
|
||||||
chnNum: string
|
chnNum: string
|
||||||
num: number | null
|
num: number | null
|
||||||
|
// waveNum: number | null
|
||||||
|
// isWave: boolean
|
||||||
}) => {
|
}) => {
|
||||||
return http.post('/result/getContrastFormContent', params, {loading: false})
|
return http.post('/result/getContrastFormContent', params, {loading: false})
|
||||||
}
|
}
|
||||||
@@ -100,6 +103,8 @@ export const getContrastResult = (params: {
|
|||||||
deviceId: string
|
deviceId: string
|
||||||
chnNum: string | number
|
chnNum: string | number
|
||||||
num: number | string | null
|
num: number | string | null
|
||||||
|
waveNum: number | null
|
||||||
|
isWave: boolean
|
||||||
}) => {
|
}) => {
|
||||||
return http.post('/result/getContrastResult', params, {loading: true})
|
return http.post('/result/getContrastResult', params, {loading: true})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,14 +69,43 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-right">
|
<div class="content-right">
|
||||||
<div class="content-right-title">
|
<div class="content-right-title">
|
||||||
<div style="width: 840px">
|
<div style="width: 840px">
|
||||||
<span class="content-right-title-text">当前检测项目:</span>
|
<span class="content-right-title-text">当前检测项目:</span>
|
||||||
<span style="color: var(--el-color-primary)">{{ rowList.scriptName }}</span>
|
<!-- 当code为'wave_data'时显示下拉框 -->
|
||||||
|
<el-select
|
||||||
|
v-if="isWaveData"
|
||||||
|
v-model="scriptNameOptions[0]"
|
||||||
|
style="width: 200px"
|
||||||
|
@change="handleScriptNameChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in scriptNameOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<!-- 否则显示原来的文本 -->
|
||||||
|
<span v-else style="color: var(--el-color-primary)">{{ rowList.scriptName }}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
style="margin-left: 280px; margin-bottom: 0px !important; width: 280px"
|
style="margin: 0 auto; margin-bottom: 0px !important; width: 200px; position: absolute; left: 50%; transform: translateX(-50%);"
|
||||||
label="测试项"
|
label="录波次数"
|
||||||
|
v-if="isWaveData"
|
||||||
|
>
|
||||||
|
<el-select v-model="waveNumber">
|
||||||
|
<el-option
|
||||||
|
v-for="i in waveNumCount"
|
||||||
|
:key="i-1"
|
||||||
|
:label="i"
|
||||||
|
:value="i-1"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
style="margin-left: 280px; margin-bottom: 0px !important; width: 300px"
|
||||||
|
label="测试项"
|
||||||
>
|
>
|
||||||
<el-select v-model="currentCheckItem">
|
<el-select v-model="currentCheckItem">
|
||||||
<el-option
|
<el-option
|
||||||
@@ -151,7 +180,22 @@ const defaultProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const chnMapList: any = ref({})
|
const chnMapList: any = ref({})
|
||||||
|
const waveNumCount = ref(0)
|
||||||
|
const waveNumber = ref(0)
|
||||||
|
// 添加以下内容
|
||||||
|
const isWaveData = ref(false)
|
||||||
|
const scriptNameOptions = ref<{label: string, value: string}[]>([])
|
||||||
|
|
||||||
|
// 添加处理scriptName变化的方法
|
||||||
|
const handleScriptNameChange = (value: string) => {
|
||||||
|
rowList.value.scriptName = value
|
||||||
|
// 查找选中项的scriptType
|
||||||
|
const selectedItem = scriptData.value.find(item => item.scriptName === value)
|
||||||
|
if (selectedItem) {
|
||||||
|
rowList.value.scriptType = selectedItem.id
|
||||||
|
getResults('wave_data')
|
||||||
|
}
|
||||||
|
}
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formContent = reactive<CheckData.DataCheck>({
|
const formContent = reactive<CheckData.DataCheck>({
|
||||||
scriptName: '',
|
scriptName: '',
|
||||||
@@ -244,7 +288,7 @@ const getBasicInformation = async () => {
|
|||||||
scriptType: rowList.value.scriptType,
|
scriptType: rowList.value.scriptType,
|
||||||
deviceId: formContent.deviceId,
|
deviceId: formContent.deviceId,
|
||||||
chnNum: formContent.chnNum,
|
chnNum: formContent.chnNum,
|
||||||
num: formContent.num == '' ? null : parseInt(formContent.num)
|
num: formContent.num == '' ? null : parseInt(formContent.num),
|
||||||
}).then((res: any) => {
|
}).then((res: any) => {
|
||||||
formContent.dataRule = res.data.dataRule
|
formContent.dataRule = res.data.dataRule
|
||||||
formContent.deviceName = res.data.deviceName
|
formContent.deviceName = res.data.deviceName
|
||||||
@@ -257,19 +301,35 @@ const getBasicInformation = async () => {
|
|||||||
}
|
}
|
||||||
chnList.value = chnMap
|
chnList.value = chnMap
|
||||||
formContent.chnNum = formContent.chnNum == null ? chnList.value[0] : formContent.chnNum
|
formContent.chnNum = formContent.chnNum == null ? chnList.value[0] : formContent.chnNum
|
||||||
|
waveNumCount.value = res.data.waveNumTotal
|
||||||
// 查询表格数据
|
// 查询表格数据
|
||||||
getResults()
|
getResults('')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 左边树变化
|
// 左边树变化
|
||||||
const handleNodeClick = (data: any) => {
|
const handleNodeClick = (data: any) => {
|
||||||
|
console.log('data', data)
|
||||||
rowList.value.scriptName = data.scriptName
|
rowList.value.scriptName = data.scriptName
|
||||||
rowList.value.scriptType = data.id
|
rowList.value.scriptType = data.id
|
||||||
getResults()
|
|
||||||
|
// 判断是否为录波数据
|
||||||
|
if (data.code === 'wave_data') {
|
||||||
|
isWaveData.value = true
|
||||||
|
// 过滤掉"录波"选项,设置下拉框数据
|
||||||
|
scriptNameOptions.value = scriptData.value
|
||||||
|
.filter(item => item.code !== 'wave_data')
|
||||||
|
.map(item => ({
|
||||||
|
label: item.scriptName,
|
||||||
|
value: item.scriptName
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
isWaveData.value = false
|
||||||
|
getResults(data.code)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 获取结果
|
// 获取结果
|
||||||
const getResults = async () => {
|
const getResults = async (code: any) => {
|
||||||
checkResultData.value = []
|
checkResultData.value = []
|
||||||
rawTableData.value = []
|
rawTableData.value = []
|
||||||
|
|
||||||
@@ -278,7 +338,9 @@ const getResults = async () => {
|
|||||||
scriptType: rowList.value.scriptType,
|
scriptType: rowList.value.scriptType,
|
||||||
deviceId: formContent.deviceId,
|
deviceId: formContent.deviceId,
|
||||||
chnNum: formContent.chnNum,
|
chnNum: formContent.chnNum,
|
||||||
num: formContent.num == '' ? null : formContent.num
|
num: formContent.num == '' ? null : formContent.num,
|
||||||
|
waveNum: code == 'wave_data' ? null : 0 ,
|
||||||
|
isWave: code == 'wave_data' ? true : false
|
||||||
}).then((res: any) => {
|
}).then((res: any) => {
|
||||||
let list: string[] = []
|
let list: string[] = []
|
||||||
for (let key in res.data.resultMap) {
|
for (let key in res.data.resultMap) {
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
<script lang="tsx" setup name="test">
|
<script lang="tsx" setup name="test">
|
||||||
import {InfoFilled, Loading} from '@element-plus/icons-vue'
|
import {InfoFilled, Loading} from '@element-plus/icons-vue'
|
||||||
import CompareDataCheckSingleChannelSingleTestPopup from './compareDataCheckSingleChannelSingleTestPopup.vue'
|
import CompareDataCheckSingleChannelSingleTestPopup from './compareDataCheckSingleChannelSingleTestPopup.vue'
|
||||||
import {computed, ComputedRef, onBeforeMount, onMounted, reactive, ref, toRef, watch} from 'vue'
|
import {computed, ComputedRef, nextTick, onBeforeMount, onMounted, reactive, ref, toRef, watch} from 'vue'
|
||||||
import {dialogBig} from '@/utils/elementBind'
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
import {CheckData} from '@/api/check/interface'
|
import {CheckData} from '@/api/check/interface'
|
||||||
import {useCheckStore} from '@/stores/modules/check'
|
import {useCheckStore} from '@/stores/modules/check'
|
||||||
@@ -191,6 +191,8 @@ const checkResult = reactive<CheckData.ScriptChnItem[]>([])
|
|||||||
let errorCheckItem: Array<{ scriptType: string; type: CheckData.ChnCheckResultEnum }> = []
|
let errorCheckItem: Array<{ scriptType: string; type: CheckData.ChnCheckResultEnum }> = []
|
||||||
// 用来存放检测日志
|
// 用来存放检测日志
|
||||||
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
||||||
|
// 添加一个响应式变量来跟踪是否需要显示录波项目
|
||||||
|
const showWaveItem = ref(false)
|
||||||
|
|
||||||
const testStatus = toRef(props, 'testStatus')
|
const testStatus = toRef(props, 'testStatus')
|
||||||
const webMsgSend = toRef(props, 'webMsgSend')
|
const webMsgSend = toRef(props, 'webMsgSend')
|
||||||
@@ -340,6 +342,13 @@ watch(
|
|||||||
case 25005:
|
case 25005:
|
||||||
let result: CheckData.ScriptChnItem[] = []
|
let result: CheckData.ScriptChnItem[] = []
|
||||||
let message = JSON.parse(newValue.data)
|
let message = JSON.parse(newValue.data)
|
||||||
|
|
||||||
|
// 当收到 25005 消息时,显示录波项目
|
||||||
|
if (newValue.code == 25005) {
|
||||||
|
showWaveItem.value = true
|
||||||
|
// 添加录波项目到 scriptData
|
||||||
|
addWaveScriptItem()
|
||||||
|
}
|
||||||
|
|
||||||
scriptData.forEach(item => {
|
scriptData.forEach(item => {
|
||||||
// 处理当前节点的数据
|
// 处理当前节点的数据
|
||||||
@@ -386,6 +395,30 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (newValue.requestId) {
|
switch (newValue.requestId) {
|
||||||
|
case 'record_wave_step2':
|
||||||
|
switch (newValue.code) {
|
||||||
|
|
||||||
|
case 10200:
|
||||||
|
setLogList('info', newValue.data)
|
||||||
|
break
|
||||||
|
case 25002:
|
||||||
|
setLogList('error', newValue.data)
|
||||||
|
break
|
||||||
|
case 25003:
|
||||||
|
ElMessageBox.alert('录波对齐失败!', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
stopTimeCount()
|
||||||
|
break
|
||||||
|
case 25001:
|
||||||
|
console.log('newValue.code', newValue.code)
|
||||||
|
// 当录波校验完成时,更新录波项目的按钮状态
|
||||||
|
setLogList('info', newValue.data)
|
||||||
|
updateWaveItemStatus(CheckData.ChnCheckResultEnum.SUCCESS) // 或根据实际结果设置状态
|
||||||
|
break
|
||||||
|
}
|
||||||
|
break
|
||||||
case 'connect':
|
case 'connect':
|
||||||
switch (newValue.operateCode) {
|
switch (newValue.operateCode) {
|
||||||
case 'Contrast_Dev':
|
case 'Contrast_Dev':
|
||||||
@@ -439,6 +472,67 @@ const setLogList = (state: 'error' | 'info' | 'warning', text: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加录波项目到 scriptData 的函数
|
||||||
|
const addWaveScriptItem = () => {
|
||||||
|
// 检查是否已经添加过录波项目
|
||||||
|
if (!scriptData.some(item => item.code === 'wave_data')) {
|
||||||
|
// 从原始数据中找到录波项目
|
||||||
|
// 这里需要根据实际情况获取录波项目的原始数据
|
||||||
|
const waveItem = scriptData.find(item => item.code === 'wave_data')
|
||||||
|
const waveItem2 = {
|
||||||
|
id: 'wave_data_id', // 需要替换为实际的ID
|
||||||
|
code: 'wave_data',
|
||||||
|
scriptName: '录波',
|
||||||
|
// 添加其他必要的属性
|
||||||
|
}
|
||||||
|
|
||||||
|
scriptData.push(waveItem2 as any)
|
||||||
|
checkTotal = scriptData.length
|
||||||
|
|
||||||
|
// 初始化录波项目的检查结果为LOADING状态
|
||||||
|
initWaveCheckResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化录波项目的检查结果
|
||||||
|
const initWaveCheckResult = () => {
|
||||||
|
const waveItem = scriptData.find(item => item.code === 'wave_data')
|
||||||
|
if (waveItem) {
|
||||||
|
let temp: CheckData.ScriptChnItem = {
|
||||||
|
scriptType: waveItem.id,
|
||||||
|
code: waveItem.code,
|
||||||
|
scriptName: waveItem.scriptName,
|
||||||
|
devices: []
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < deviceList?.length; i++) {
|
||||||
|
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
||||||
|
for (let j = 0; j < checkStore.chnNumList.length; j++) {
|
||||||
|
tempChnResult.push(CheckData.ChnCheckResultEnum.LOADING) // 设置为LOADING状态
|
||||||
|
}
|
||||||
|
temp.devices.push({
|
||||||
|
deviceId: deviceList[i].deviceId,
|
||||||
|
deviceName: deviceList[i].deviceName,
|
||||||
|
chnResult: tempChnResult
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加到checkResult中
|
||||||
|
checkResult.push(temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新录波项目状态的函数
|
||||||
|
const updateWaveItemStatus = (status: CheckData.ChnCheckResultEnum) => {
|
||||||
|
const waveResultItem = checkResult.find(item => item.code === 'wave_data')
|
||||||
|
if (waveResultItem) {
|
||||||
|
// 更新所有通道的状态
|
||||||
|
waveResultItem.devices.forEach(device => {
|
||||||
|
device.chnResult.fill(status)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 更新进度条
|
// 更新进度条
|
||||||
const updatePercentage = async () => {
|
const updatePercentage = async () => {
|
||||||
if (testLogList.length - 1 < checkStore.chnNumList.length) {
|
if (testLogList.length - 1 < checkStore.chnNumList.length) {
|
||||||
@@ -529,13 +623,15 @@ const initScriptData = async () => {
|
|||||||
patternId: pattern
|
patternId: pattern
|
||||||
})
|
})
|
||||||
|
|
||||||
// 格式化脚本数据
|
// 格式化脚本数据,初始化时排除录波项目
|
||||||
let temp = response.data.map((item: any) => {
|
let temp = response.data
|
||||||
return {
|
.filter((item: any) => item.code !== 'wave_data') // 排除录波项目
|
||||||
...item,
|
.map((item: any) => {
|
||||||
scriptName: item.scriptName
|
return {
|
||||||
}
|
...item,
|
||||||
})
|
scriptName: item.scriptName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// 保存脚本数据并设置总数
|
// 保存脚本数据并设置总数
|
||||||
scriptData.push(...temp)
|
scriptData.push(...temp)
|
||||||
|
|||||||
Reference in New Issue
Block a user