正式检测录波数据查询
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { pa } from 'element-plus/es/locale/index.mjs';
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import {CheckData} from '@/api/check/interface'
|
import {CheckData} from '@/api/check/interface'
|
||||||
|
|
||||||
@@ -88,8 +89,7 @@ export const getContrastFormContent = (params: {
|
|||||||
deviceId: string
|
deviceId: string
|
||||||
chnNum: string
|
chnNum: string
|
||||||
num: number | null
|
num: number | null
|
||||||
// waveNum: number | null
|
patternId: string
|
||||||
// isWave: boolean
|
|
||||||
}) => {
|
}) => {
|
||||||
return http.post('/result/getContrastFormContent', params, {loading: false})
|
return http.post('/result/getContrastFormContent', params, {loading: false})
|
||||||
}
|
}
|
||||||
@@ -105,6 +105,7 @@ export const getContrastResult = (params: {
|
|||||||
num: number | string | null
|
num: number | string | null
|
||||||
waveNum: number | null
|
waveNum: number | null
|
||||||
isWave: boolean
|
isWave: boolean
|
||||||
|
patternId: string
|
||||||
}) => {
|
}) => {
|
||||||
return http.post('/result/getContrastResult', params, {loading: true})
|
return http.post('/result/getContrastResult', params, {loading: true})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export namespace DevType {
|
|||||||
devChns: number; //设备通道数
|
devChns: number; //设备通道数
|
||||||
reportName: string| null;//报告模版名称
|
reportName: string| null;//报告模版名称
|
||||||
state: number;
|
state: number;
|
||||||
|
waveCmd:string| null;//录波指令
|
||||||
createBy?: string| null; //创建用户
|
createBy?: string| null; //创建用户
|
||||||
createTime?: string| null; //创建时间
|
createTime?: string| null; //创建时间
|
||||||
updateBy?: string| null; //更新用户
|
updateBy?: string| null; //更新用户
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
<!-- 当code为'wave_data'时显示下拉框 -->
|
<!-- 当code为'wave_data'时显示下拉框 -->
|
||||||
<el-select
|
<el-select
|
||||||
v-if="isWaveData"
|
v-if="isWaveData"
|
||||||
v-model="scriptNameOptions[0]"
|
v-model="selectedScriptName"
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
@change="handleScriptNameChange"
|
@change="handleScriptNameChange"
|
||||||
>
|
>
|
||||||
@@ -94,12 +94,12 @@
|
|||||||
label="录波次数"
|
label="录波次数"
|
||||||
v-if="isWaveData"
|
v-if="isWaveData"
|
||||||
>
|
>
|
||||||
<el-select v-model="waveNumber">
|
<el-select v-model="waveNumber" @change="handleWaveNumberChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="i in waveNumCount"
|
v-for="i in waveNumCount"
|
||||||
:key="i-1"
|
:key="i"
|
||||||
:label="i"
|
:label="i"
|
||||||
:value="i-1"
|
:value="i"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -181,21 +181,13 @@ const defaultProps = {
|
|||||||
|
|
||||||
const chnMapList: any = ref({})
|
const chnMapList: any = ref({})
|
||||||
const waveNumCount = ref(0)
|
const waveNumCount = ref(0)
|
||||||
const waveNumber = ref(0)
|
const waveNumber = ref(1)
|
||||||
|
const selectedScriptName = ref('')
|
||||||
|
const pattern = ref('')
|
||||||
// 添加以下内容
|
// 添加以下内容
|
||||||
const isWaveData = ref(false)
|
const isWaveData = ref(false)
|
||||||
const scriptNameOptions = ref<{label: string, value: string}[]>([])
|
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: '',
|
||||||
@@ -231,22 +223,28 @@ const currentRawTableData = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const open = async (row: any, chnNum: string, deviceId: string | null, source: number) => {
|
const open = async (row: any, chnNum: string, deviceId: string | null, source: number) => {
|
||||||
|
isWaveData.value = false
|
||||||
|
pattern.value = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||||
rowList.value = {}
|
rowList.value = {}
|
||||||
formContent.deviceId = deviceId || ''
|
formContent.deviceId = deviceId || ''
|
||||||
formContent.chnNum = chnNum
|
formContent.chnNum = chnNum
|
||||||
sourceKey.value = source
|
sourceKey.value = source
|
||||||
if (source == 1) {
|
if (source == 1) {
|
||||||
// 正式检测进入页面
|
// 正式检测进入页面 - 创建新的对象避免引用共享
|
||||||
rowList.value = row
|
rowList.value = {
|
||||||
|
scriptName: row.scriptName,
|
||||||
|
scriptType: row.scriptType,
|
||||||
|
// 复制其他需要的属性
|
||||||
|
devices: row.devices ? [...row.devices] : []
|
||||||
|
}
|
||||||
} else if (source == 2) {
|
} else if (source == 2) {
|
||||||
// 检测数据查询进入
|
// 检测数据查询进入
|
||||||
await initScriptData(row)
|
await initScriptData(row)
|
||||||
}
|
}
|
||||||
visible.value = true
|
visible.value = true
|
||||||
|
|
||||||
scriptType = null
|
scriptType = null
|
||||||
|
|
||||||
formContent.errorSysId = checkStore.plan.errorSysId
|
formContent.errorSysId = checkStore.plan.errorSysId
|
||||||
|
|
||||||
pqErrorList.length = 0
|
pqErrorList.length = 0
|
||||||
// 获取误差体系
|
// 获取误差体系
|
||||||
let { data: resPqErrorList } = await getPqErrSysList()
|
let { data: resPqErrorList } = await getPqErrSysList()
|
||||||
@@ -255,15 +253,14 @@ const open = async (row: any, chnNum: string, deviceId: string | null, source: n
|
|||||||
await getBasicInformation()
|
await getBasicInformation()
|
||||||
}
|
}
|
||||||
// 查询大项树
|
// 查询大项树
|
||||||
const initScriptData = async (row: any) => {
|
const initScriptData = async (row?: any) => {
|
||||||
const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''
|
|
||||||
|
|
||||||
let response: any = await getBigTestItem({
|
let response: any = await getBigTestItem({
|
||||||
reCheckType: checkStore.reCheckType,
|
reCheckType: checkStore.reCheckType,
|
||||||
planId: checkStore.plan.id,
|
planId: checkStore.plan.id,
|
||||||
devIds: checkStore.devices.map(item => item.deviceId),
|
devIds: checkStore.devices.map(item => item.deviceId),
|
||||||
patternId: pattern
|
patternId: pattern.value
|
||||||
})
|
})
|
||||||
|
|
||||||
// 格式化脚本数据
|
// 格式化脚本数据
|
||||||
let temp = response.data.map((item: any) => {
|
let temp = response.data.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
@@ -271,30 +268,45 @@ const initScriptData = async (row: any) => {
|
|||||||
scriptName: item.scriptName
|
scriptName: item.scriptName
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
rowList.value.scriptName = temp[0].scriptName
|
|
||||||
rowList.value.scriptType = temp[0].id
|
// 保存脚本数据
|
||||||
// 保存脚本数据并设置总数
|
|
||||||
scriptData.value = temp
|
scriptData.value = temp
|
||||||
setTimeout(() => {
|
|
||||||
treeRef.value?.setCurrentKey(temp[0].id)
|
// 只有在sourceKey == 2时才设置rowList和tree相关属性
|
||||||
}, 0)
|
if (sourceKey.value === 2 && temp.length > 0) {
|
||||||
|
rowList.value.scriptName = temp[0].scriptName
|
||||||
|
rowList.value.scriptType = temp[0].id
|
||||||
|
selectedScriptName.value = temp[0].scriptName
|
||||||
|
setTimeout(() => {
|
||||||
|
treeRef.value?.setCurrentKey(temp[0].id)
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取基本信息
|
//获取基本信息
|
||||||
const getBasicInformation = async () => {
|
const getBasicInformation = async () => {
|
||||||
checkResultData.value = []
|
checkResultData.value = []
|
||||||
rawTableData.value = []
|
rawTableData.value = []
|
||||||
|
|
||||||
|
// 确保scriptData已初始化
|
||||||
|
if (scriptData.value.length === 0) {
|
||||||
|
await initScriptData()
|
||||||
|
}
|
||||||
|
|
||||||
getContrastFormContent({
|
getContrastFormContent({
|
||||||
planId: checkStore.plan.id,
|
planId: checkStore.plan.id,
|
||||||
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),
|
||||||
|
patternId: pattern.value
|
||||||
}).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
|
||||||
formContent.errorSysId = res.data.errorSysId
|
formContent.errorSysId = res.data.errorSysId
|
||||||
chnMapList.value = res.data.chnMap
|
chnMapList.value = res.data.chnMap
|
||||||
formContent.num = res.data.checkNum
|
formContent.num = res.data.checkNum
|
||||||
|
|
||||||
let chnMap: string[] = []
|
let chnMap: string[] = []
|
||||||
for (let key in res.data.chnMap) {
|
for (let key in res.data.chnMap) {
|
||||||
chnMap.push(key)
|
chnMap.push(key)
|
||||||
@@ -302,14 +314,37 @@ 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
|
waveNumCount.value = res.data.waveNumTotal
|
||||||
|
|
||||||
// 查询表格数据
|
// 查询表格数据
|
||||||
getResults('')
|
if(sourceKey.value == 1 && rowList.value.scriptName == "录波"){
|
||||||
|
isWaveData.value = true
|
||||||
|
// 设置录波数据相关的选项,与选中左侧录波树时保持一致
|
||||||
|
scriptNameOptions.value = scriptData.value
|
||||||
|
.filter(item => item.code !== 'wave_data' && item.code !== 'FREQ')
|
||||||
|
.map(item => ({
|
||||||
|
label: item.scriptName,
|
||||||
|
value: item.scriptName
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 默认选中第一个选项
|
||||||
|
if (scriptNameOptions.value.length > 0) {
|
||||||
|
selectedScriptName.value = scriptNameOptions.value[0].value
|
||||||
|
// 更新rowList以匹配选中的script
|
||||||
|
const selectedItem = scriptData.value.find(item => item.scriptName === selectedScriptName.value)
|
||||||
|
if (selectedItem) {
|
||||||
|
rowList.value.scriptName = selectedScriptName.value
|
||||||
|
rowList.value.scriptType = selectedItem.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getResults('wave_data')
|
||||||
|
}else{
|
||||||
|
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
|
||||||
|
|
||||||
@@ -318,11 +353,23 @@ const handleNodeClick = (data: any) => {
|
|||||||
isWaveData.value = true
|
isWaveData.value = true
|
||||||
// 过滤掉"录波"选项,设置下拉框数据
|
// 过滤掉"录波"选项,设置下拉框数据
|
||||||
scriptNameOptions.value = scriptData.value
|
scriptNameOptions.value = scriptData.value
|
||||||
.filter(item => item.code !== 'wave_data')
|
.filter(item => item.code !== 'wave_data' && item.code !== 'FREQ')
|
||||||
.map(item => ({
|
.map(item => ({
|
||||||
label: item.scriptName,
|
label: item.scriptName,
|
||||||
value: item.scriptName
|
value: item.scriptName
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// 每次选中录波数据时都重置为第一个选项并触发getResults
|
||||||
|
if (scriptNameOptions.value.length > 0) {
|
||||||
|
selectedScriptName.value = scriptNameOptions.value[0].value
|
||||||
|
// 更新rowList并触发getResults
|
||||||
|
rowList.value.scriptName = selectedScriptName.value
|
||||||
|
const selectedItem = scriptData.value.find(item => item.scriptName === selectedScriptName.value)
|
||||||
|
if (selectedItem) {
|
||||||
|
rowList.value.scriptType = selectedItem.id
|
||||||
|
getResults('wave_data')
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
isWaveData.value = false
|
isWaveData.value = false
|
||||||
getResults(data.code)
|
getResults(data.code)
|
||||||
@@ -339,8 +386,9 @@ const getResults = async (code: any) => {
|
|||||||
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 ,
|
waveNum: code == 'wave_data' ? waveNumber.value : null,
|
||||||
isWave: code == 'wave_data' ? true : false
|
isWave: code == 'wave_data' ? true : false ,
|
||||||
|
patternId: pattern.value
|
||||||
}).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) {
|
||||||
@@ -353,6 +401,25 @@ const getResults = async (code: any) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加处理scriptName变化的方法
|
||||||
|
const handleScriptNameChange = (value: string) => {
|
||||||
|
selectedScriptName.value = value
|
||||||
|
rowList.value.scriptName = value
|
||||||
|
// 查找选中项的scriptType
|
||||||
|
const selectedItem = scriptData.value.find(item => item.scriptName === value)
|
||||||
|
if (selectedItem) {
|
||||||
|
rowList.value.scriptType = selectedItem.id
|
||||||
|
getResults('wave_data')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加处理waveNumber变化的方法
|
||||||
|
const handleWaveNumberChange = (value: number) => {
|
||||||
|
waveNumber.value = value
|
||||||
|
// 当录波次数改变时,重新获取结果
|
||||||
|
getResults('wave_data')
|
||||||
|
}
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
visible.value = false
|
visible.value = false
|
||||||
formContent.num = ''
|
formContent.num = ''
|
||||||
|
|||||||
@@ -193,7 +193,6 @@ let errorCheckItem: Array<{ scriptType: string; type: CheckData.ChnCheckResultEn
|
|||||||
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
|
||||||
// 添加一个响应式变量来跟踪是否需要显示录波项目
|
// 添加一个响应式变量来跟踪是否需要显示录波项目
|
||||||
const showWaveItem = ref(false)
|
const showWaveItem = ref(false)
|
||||||
|
|
||||||
const testStatus = toRef(props, 'testStatus')
|
const testStatus = toRef(props, 'testStatus')
|
||||||
const webMsgSend = toRef(props, 'webMsgSend')
|
const webMsgSend = toRef(props, 'webMsgSend')
|
||||||
|
|
||||||
@@ -212,7 +211,6 @@ const chnSum = computed(() => {
|
|||||||
|
|
||||||
// 用来展示的检测结果
|
// 用来展示的检测结果
|
||||||
const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(() => {
|
const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(() => {
|
||||||
|
|
||||||
let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => {
|
let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => {
|
||||||
let temp: CheckData.ScriptChnViewItem = {
|
let temp: CheckData.ScriptChnViewItem = {
|
||||||
scriptType: item.scriptType,
|
scriptType: item.scriptType,
|
||||||
@@ -257,6 +255,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
temp.devices.push({
|
temp.devices.push({
|
||||||
deviceId: device.deviceId,
|
deviceId: device.deviceId,
|
||||||
deviceName: device.deviceName,
|
deviceName: device.deviceName,
|
||||||
@@ -293,111 +292,12 @@ watch(testStatus, function (newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 次数
|
|
||||||
let count = 0
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
webMsgSend,
|
webMsgSend,
|
||||||
function (newValue, oldValue) {
|
function (newValue, oldValue) {
|
||||||
if (checkStore.selectTestItems.preTest == false && newValue.requestId != 'formal_real') {
|
switch (newValue.requestId) {
|
||||||
if (testLogList[0].log == '正在检测,请稍等...' || testLogList[0].log == '暂无数据,等待检测开始') {
|
|
||||||
testLogList.shift()
|
|
||||||
setLogList('info', '初始化开始!')
|
|
||||||
}
|
|
||||||
let str =
|
|
||||||
newValue.requestId == 'yjc_sbtxjy'
|
|
||||||
? '设备通讯校验'
|
|
||||||
: newValue.requestId == 'yjc_mxyzxjy'
|
|
||||||
? '模型一致性检验'
|
|
||||||
: newValue.requestId == 'yjc_align'
|
|
||||||
? '实时数据对齐检验'
|
|
||||||
: newValue.requestId == 'YJC_xujy'
|
|
||||||
? '相序校验'
|
|
||||||
: ''
|
|
||||||
// 预检测处理
|
|
||||||
switch (newValue.code) {
|
|
||||||
case 25001:
|
|
||||||
// 成功
|
|
||||||
if (newValue.data != undefined) return
|
|
||||||
setLogList('info', str + '成功!')
|
|
||||||
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化成功!')
|
|
||||||
break
|
|
||||||
case 25003:
|
|
||||||
// 失败
|
|
||||||
if (newValue.data != undefined) return
|
|
||||||
setLogList('error', str + '失败!')
|
|
||||||
emit('update:testStatus', 'error')
|
|
||||||
stopTimeCount()
|
|
||||||
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 预监测 正式检测
|
|
||||||
else if (newValue.requestId == 'formal_real') {
|
|
||||||
if (testLogList[0].log == '正在检测,请稍等...' || testLogList[0].log == '暂无数据,等待检测开始') {
|
|
||||||
testLogList.shift()
|
|
||||||
}
|
|
||||||
switch (newValue.code) {
|
|
||||||
case 25001:
|
|
||||||
case 25005:
|
|
||||||
let result: CheckData.ScriptChnItem[] = []
|
|
||||||
let message = JSON.parse(newValue.data)
|
|
||||||
|
|
||||||
// 当收到 25005 消息时,显示录波项目
|
|
||||||
if (newValue.code == 25005) {
|
|
||||||
showWaveItem.value = true
|
|
||||||
// 添加录波项目到 scriptData
|
|
||||||
addWaveScriptItem()
|
|
||||||
}
|
|
||||||
|
|
||||||
scriptData.forEach(item => {
|
|
||||||
// 处理当前节点的数据
|
|
||||||
const temp: CheckData.ScriptChnItem = {
|
|
||||||
scriptType: item.id,
|
|
||||||
scriptName: item.scriptName,
|
|
||||||
devices: []
|
|
||||||
}
|
|
||||||
// 找到message中所有scriptName与当前item.code匹配的项
|
|
||||||
const matchedDevices = message
|
|
||||||
.filter((msg: any) => msg.scriptName === item.code)
|
|
||||||
.map((msg: any) => ({
|
|
||||||
deviceId: msg.deviceId,
|
|
||||||
deviceName: msg.deviceName, // 如果有的话
|
|
||||||
chnResult: msg.chnResult
|
|
||||||
}))
|
|
||||||
|
|
||||||
// 添加匹配到的设备
|
|
||||||
temp.devices.push(...matchedDevices)
|
|
||||||
result.push(temp)
|
|
||||||
})
|
|
||||||
Object.assign(checkResult, result)
|
|
||||||
|
|
||||||
if (newValue.code == 25001) {
|
|
||||||
setLogList('info', '检测完成!')
|
|
||||||
stopTimeCount()
|
|
||||||
updatePercentage()
|
|
||||||
}
|
|
||||||
if(newValue.code == 25005){
|
|
||||||
setLogList("error", '实时数据校验失败!开始录波校验...')
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 25003:
|
|
||||||
setLogList('error', '检测失败!')
|
|
||||||
stopTimeCount()
|
|
||||||
updatePercentage()
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
if (newValue.code != 10201) {
|
|
||||||
setLogList(newValue.code == 10200 ? 'info' : 'error', newValue.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (newValue.requestId) {
|
|
||||||
case 'record_wave_step2':
|
case 'record_wave_step2':
|
||||||
switch (newValue.code) {
|
switch (newValue.code) {
|
||||||
|
|
||||||
case 10200:
|
case 10200:
|
||||||
setLogList('info', newValue.data)
|
setLogList('info', newValue.data)
|
||||||
break
|
break
|
||||||
@@ -411,12 +311,26 @@ watch(
|
|||||||
})
|
})
|
||||||
stopTimeCount()
|
stopTimeCount()
|
||||||
break
|
break
|
||||||
case 25001:
|
case 25001: {
|
||||||
console.log('newValue.code', newValue.code)
|
|
||||||
// 当录波校验完成时,更新录波项目的按钮状态
|
// 当录波校验完成时,更新录波项目的按钮状态
|
||||||
setLogList('info', newValue.data)
|
setLogList('info', '录波对齐完成!')
|
||||||
updateWaveItemStatus(CheckData.ChnCheckResultEnum.SUCCESS) // 或根据实际结果设置状态
|
// 找到录波项目并更新其状态
|
||||||
break
|
const waveResultItem = checkResult.find(item => item.scriptType === 'wave_data')
|
||||||
|
console.log('waveResultItem1111111:', waveResultItem)
|
||||||
|
if (waveResultItem) {
|
||||||
|
// 将录波项目状态设置为SUCCESS
|
||||||
|
waveResultItem.devices.forEach(device => {
|
||||||
|
device.chnResult.fill(CheckData.ChnCheckResultEnum.SUCCESS)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log('waveResultItem2222222:', waveResultItem)
|
||||||
|
// 触发响应式更新
|
||||||
|
// 由于Vue可能无法检测到深层嵌套属性的更改,我们手动触发更新
|
||||||
|
checkResult.splice(0, 0) // 这会触发响应式更新
|
||||||
|
console.log('waveResultItem3333333:', checkResult)
|
||||||
|
stopTimeCount()
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'connect':
|
case 'connect':
|
||||||
@@ -462,6 +376,116 @@ watch(
|
|||||||
stopTimeCount()
|
stopTimeCount()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if (checkStore.selectTestItems.preTest == false && newValue.requestId != 'formal_real') {
|
||||||
|
if (testLogList[0].log == '正在检测,请稍等...' || testLogList[0].log == '暂无数据,等待检测开始') {
|
||||||
|
testLogList.shift()
|
||||||
|
setLogList('info', '初始化开始!')
|
||||||
|
}
|
||||||
|
let str =
|
||||||
|
newValue.requestId == 'yjc_sbtxjy'
|
||||||
|
? '设备通讯校验'
|
||||||
|
: newValue.requestId == 'yjc_mxyzxjy'
|
||||||
|
? '模型一致性检验'
|
||||||
|
: newValue.requestId == 'yjc_align'
|
||||||
|
? '实时数据对齐检验'
|
||||||
|
: newValue.requestId == 'YJC_xujy'
|
||||||
|
? '相序校验'
|
||||||
|
: ''
|
||||||
|
// 预检测处理
|
||||||
|
switch (newValue.code) {
|
||||||
|
case 25001:
|
||||||
|
// 成功
|
||||||
|
if (newValue.data != undefined) return
|
||||||
|
setLogList('info', str + '成功!')
|
||||||
|
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化成功!')
|
||||||
|
break
|
||||||
|
case 25003:
|
||||||
|
// 失败
|
||||||
|
if (newValue.data != undefined) return
|
||||||
|
setLogList('error', str + '失败!')
|
||||||
|
emit('update:testStatus', 'error')
|
||||||
|
stopTimeCount()
|
||||||
|
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 预监测 正式检测
|
||||||
|
else if (newValue.requestId == 'formal_real') {
|
||||||
|
if (testLogList[0].log == '正在检测,请稍等...' || testLogList[0].log == '暂无数据,等待检测开始') {
|
||||||
|
testLogList.shift()
|
||||||
|
}
|
||||||
|
switch (newValue.code) {
|
||||||
|
case 25001:
|
||||||
|
case 25005:
|
||||||
|
{
|
||||||
|
let result: CheckData.ScriptChnItem[] = []
|
||||||
|
let message = JSON.parse(newValue.data)
|
||||||
|
// 当收到 25005 消息时,录波项目开始loading
|
||||||
|
if (newValue.code == 25005) {
|
||||||
|
// 设置录波项目为LOADING状态
|
||||||
|
const waveResultItem = checkResult.find(item => item.code === 'wave_data')
|
||||||
|
|
||||||
|
if (waveResultItem) {
|
||||||
|
waveResultItem.devices.forEach(device => {
|
||||||
|
device.chnResult.fill(CheckData.ChnCheckResultEnum.LOADING)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
scriptData.forEach(item => {
|
||||||
|
// 处理当前节点的数据
|
||||||
|
const temp: CheckData.ScriptChnItem = {
|
||||||
|
scriptType: item.id,
|
||||||
|
scriptName: item.scriptName,
|
||||||
|
devices: []
|
||||||
|
}
|
||||||
|
// 特殊处理录波项目 - 如果是25005消息且当前项目是录波项目,则使用已设置的状态
|
||||||
|
if (newValue.code == 25005 && item.code === 'wave_data') {
|
||||||
|
const existingWaveItem = checkResult.find(checkItem => checkItem.scriptType === 'wave_data')
|
||||||
|
if (existingWaveItem) {
|
||||||
|
temp.devices = [...existingWaveItem.devices] // 保留已设置的devices
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 找到message中所有scriptName与当前item.code匹配的项
|
||||||
|
const matchedDevices = message
|
||||||
|
.filter((msg: any) => msg.scriptName === item.code)
|
||||||
|
.map((msg: any) => ({
|
||||||
|
deviceId: msg.deviceId,
|
||||||
|
deviceName: msg.deviceName,
|
||||||
|
chnResult: msg.chnResult
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 添加匹配到的设备
|
||||||
|
temp.devices.push(...matchedDevices)
|
||||||
|
}
|
||||||
|
result.push(temp)
|
||||||
|
})
|
||||||
|
Object.assign(checkResult, result)
|
||||||
|
|
||||||
|
if (newValue.code == 25001) {
|
||||||
|
setLogList('info', '检测完成!')
|
||||||
|
stopTimeCount()
|
||||||
|
updatePercentage()
|
||||||
|
}
|
||||||
|
if(newValue.code == 25005){
|
||||||
|
setLogList("error", '实时数据校验失败!开始录波校验...')
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
case 25003:
|
||||||
|
setLogList('error', '检测失败!')
|
||||||
|
stopTimeCount()
|
||||||
|
updatePercentage()
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
if (newValue.code != 10201) {
|
||||||
|
setLogList(newValue.code == 10200 ? 'info' : 'error', newValue.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{deep: true}
|
{deep: true}
|
||||||
)
|
)
|
||||||
@@ -472,67 +496,6 @@ 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) {
|
||||||
@@ -622,10 +585,8 @@ const initScriptData = async () => {
|
|||||||
devIds: checkStore.devices.map(item => item.deviceId),
|
devIds: checkStore.devices.map(item => item.deviceId),
|
||||||
patternId: pattern
|
patternId: pattern
|
||||||
})
|
})
|
||||||
|
|
||||||
// 格式化脚本数据,初始化时排除录波项目
|
// 格式化脚本数据,初始化时排除录波项目
|
||||||
let temp = response.data
|
let temp = response.data
|
||||||
.filter((item: any) => item.code !== 'wave_data') // 排除录波项目
|
|
||||||
.map((item: any) => {
|
.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
@@ -643,10 +604,8 @@ const initDeviceList = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化检测结果 (详细到通道)
|
// 初始化检测结果 (详细到通道)
|
||||||
// 修改函数定义
|
|
||||||
const initCheckResult = (defaultValue: CheckData.ChnCheckResultEnum) => {
|
const initCheckResult = (defaultValue: CheckData.ChnCheckResultEnum) => {
|
||||||
let result: CheckData.ScriptChnItem[] = []
|
let result: CheckData.ScriptChnItem[] = []
|
||||||
console.log('🚀 ~ initCheckResult ~ scriptData:', scriptData)
|
|
||||||
|
|
||||||
scriptData.forEach(item => {
|
scriptData.forEach(item => {
|
||||||
let temp: CheckData.ScriptChnItem = {
|
let temp: CheckData.ScriptChnItem = {
|
||||||
@@ -659,7 +618,12 @@ const initCheckResult = (defaultValue: CheckData.ChnCheckResultEnum) => {
|
|||||||
for (let i = 0; i < deviceList?.length; i++) {
|
for (let i = 0; i < deviceList?.length; i++) {
|
||||||
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
||||||
for (let j = 0; j < checkStore.chnNumList.length; j++) {
|
for (let j = 0; j < checkStore.chnNumList.length; j++) {
|
||||||
tempChnResult.push(defaultValue)
|
// 录波项目初始化为UNKNOWN状态,其他项目使用传入的默认值
|
||||||
|
if (item.code === 'wave_data') {
|
||||||
|
tempChnResult.push(CheckData.ChnCheckResultEnum.UNKNOWN)
|
||||||
|
} else {
|
||||||
|
tempChnResult.push(defaultValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
temp.devices.push({
|
temp.devices.push({
|
||||||
deviceId: deviceList[i].deviceId,
|
deviceId: deviceList[i].deviceId,
|
||||||
@@ -690,6 +654,7 @@ watch(
|
|||||||
// 点击查看(设备)通道检测详情。参数1:设备信息,参数2:通道号,-1:代表查看全部通道
|
// 点击查看(设备)通道检测详情。参数1:设备信息,参数2:通道号,-1:代表查看全部通道
|
||||||
const handleClick = (item: any, chnNum: number, scriptType: string) => {
|
const handleClick = (item: any, chnNum: number, scriptType: string) => {
|
||||||
let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType)
|
let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType)
|
||||||
|
|
||||||
let flag = -1
|
let flag = -1
|
||||||
if (checkResultItem) {
|
if (checkResultItem) {
|
||||||
let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId)
|
let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId)
|
||||||
@@ -748,7 +713,9 @@ const initializeParameters = async () => {
|
|||||||
|
|
||||||
//
|
//
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
||||||
if (!checkStore.selectTestItems.preTest) {
|
if (!checkStore.selectTestItems.preTest) {
|
||||||
|
console.log(222222)
|
||||||
// 判断是否预检测
|
// 判断是否预检测
|
||||||
initializeParameters()
|
initializeParameters()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,9 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="录波指令" prop="waveCmd" v-if="modeStore.currentMode == '比对式'">
|
||||||
|
<el-input v-model='formContent.waveCmd' placeholder="请输入录波指令" maxlength="32" show-word-limit/>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@@ -90,7 +93,9 @@
|
|||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import {addDevType,updateDevType} from '@/api/device/devType'
|
import {addDevType,updateDevType} from '@/api/device/devType'
|
||||||
import {getICDAllList} from '@/api/device/icd'
|
import {getICDAllList} from '@/api/device/icd'
|
||||||
|
import { useModeStore } from '@/stores/modules/mode'
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
const modeStore = useModeStore()
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
const dialogFormRef = ref()
|
const dialogFormRef = ref()
|
||||||
const scene = ref('')
|
const scene = ref('')
|
||||||
@@ -108,6 +113,7 @@
|
|||||||
devChns: 1, //设备通道数
|
devChns: 1, //设备通道数
|
||||||
reportName: '',//报告模版名称
|
reportName: '',//报告模版名称
|
||||||
state: 1,
|
state: 1,
|
||||||
|
waveCmd: 'RDRE1$CO$RcdTrg$Oper',
|
||||||
})
|
})
|
||||||
return { dialogVisible, titleType, formContent }
|
return { dialogVisible, titleType, formContent }
|
||||||
}
|
}
|
||||||
@@ -127,6 +133,7 @@ const resetFormContent = () => {
|
|||||||
devChns: 1, //设备通道数
|
devChns: 1, //设备通道数
|
||||||
reportName: '',//报告模版名称
|
reportName: '',//报告模版名称
|
||||||
state: 1,
|
state: 1,
|
||||||
|
waveCmd: 'RDRE1$CO$RcdTrg$Oper',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -884,6 +884,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
|
|||||||
if (Array.isArray(user_Result.data)) {
|
if (Array.isArray(user_Result.data)) {
|
||||||
if (user_Result.data.length > 0) {
|
if (user_Result.data.length > 0) {
|
||||||
// 为leaderData和memberData分别创建独立的对象数组
|
// 为leaderData和memberData分别创建独立的对象数组
|
||||||
|
|
||||||
leaderData.value = user_Result.data
|
leaderData.value = user_Result.data
|
||||||
.filter((user: any) => !user.roleCodes.includes('root'))
|
.filter((user: any) => !user.roleCodes.includes('root'))
|
||||||
.map((user: any) => ({
|
.map((user: any) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user