diff --git a/frontend/src/api/check/test/index.ts b/frontend/src/api/check/test/index.ts index 4461508..c5474c3 100644 --- a/frontend/src/api/check/test/index.ts +++ b/frontend/src/api/check/test/index.ts @@ -14,6 +14,7 @@ export const getBigTestItem = (params: { export const getScriptList = (params: { devId:string, chnNum:number, + num:number }) => { return http.post('/result/getCheckItem', params, {loading: false}) } diff --git a/frontend/src/views/home/components/compareDataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/compareDataCheckSingleChannelSingleTestPopup.vue index 784f12c..1eb2cc9 100644 --- a/frontend/src/views/home/components/compareDataCheckSingleChannelSingleTestPopup.vue +++ b/frontend/src/views/home/components/compareDataCheckSingleChannelSingleTestPopup.vue @@ -238,7 +238,7 @@ const open = async (row: any, chnNum: string, deviceId: string | null, source: n formContent.deviceId = deviceId || '' formContent.chnNum = chnNum sourceKey.value = source - // 获取基本信息 + // 获取基本信息 await getBasicInformation(row.scriptType) if (source == 1) { // 正式检测进入页面 - 创建新的对象避免引用共享 @@ -265,36 +265,32 @@ const open = async (row: any, chnNum: string, deviceId: string | null, source: n } const initGetResult = async () => { - // 查询表格数据 - if(sourceKey.value == 1 && rowList.value.scriptName == "录波"){ - isWaveData.value = true - // 设置录波数据相关的选项,与选中左侧录波树时保持一致 - scriptNameOptions.value = selectScript.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 - - } + // 判断是否为录波数据 + const isLuoboData = (sourceKey.value == 1 && rowList.value.scriptName == "录波") || + (sourceKey.value == 2 && scriptData.value[0]?.code == "wave_data"); + + if (isLuoboData) { + isWaveData.value = true + // 设置录波数据相关的选项 + scriptNameOptions.value = selectScript.value.map(item => ({ + label: item.scriptName, + value: item.scriptName + })) + + // 默认选中第一个选项 + if (scriptNameOptions.value.length > 0) { + selectedScriptName.value = scriptNameOptions.value[0].value + // 更新rowList以匹配选中的script + const selectedItem = selectScript.value.find(item => item.scriptName === selectedScriptName.value) + if (selectedItem) { + rowList.value.scriptName = selectedScriptName.value + rowList.value.scriptType = selectedItem.id } - - await getResults('wave_data') - } else { - await getResults('') } - - + await getResults('wave_data') + } else { + await getResults('') + } } @@ -303,6 +299,7 @@ const initScriptData = async () => { let response: any = await getScriptList({ devId: formContent.deviceId, chnNum: formContent.chnNum, + num: formContent.num }) // 格式化脚本数据 @@ -335,6 +332,7 @@ const initScriptData = async () => { // 只有在sourceKey == 2时才设置rowList和tree相关属性 if (sourceKey.value === 2 && temp.length > 0) { + rowList.value.scriptName = temp[0].scriptName rowList.value.scriptType = temp[0].id selectedScriptName.value = temp[0].scriptName @@ -346,8 +344,6 @@ const initScriptData = async () => { } - - // 获取基本信息 const getBasicInformation = async (scriptType: any) => { checkResultData.value = [] @@ -424,7 +420,6 @@ const handleCommonChange = async () => { if (sourceKey.value === 2 && scriptData.value.length > 0) { // 查找当前选中的节点 const currentNode = scriptData.value.find((item: any) => item.id === rowList.value.scriptType) - if (currentNode) { // 如果找到了当前节点,则触发点击事件 handleNodeClick(currentNode) @@ -470,16 +465,19 @@ const handleNodeClick = (data: any) => { // 每次选中录波数据时都重置为第一个选项并触发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) + const selectedItem = selectScript.value.find(item => item.scriptName === selectedScriptName.value) + if (selectedItem) { rowList.value.scriptType = selectedItem.id getResults('wave_data') } } } else { + isWaveData.value = false getResults(data.code) } @@ -520,7 +518,7 @@ const handleScriptNameChange = (value: string) => { selectedScriptName.value = value rowList.value.scriptName = value // 查找选中项的scriptType - const selectedItem = scriptData.value.find(item => item.scriptName === value) + const selectedItem = selectScript.value.find(item => item.scriptName === value) if (selectedItem) { rowList.value.scriptType = selectedItem.id getResults('wave_data') @@ -544,7 +542,6 @@ const close = async () => { } const handleErrorSysChange = async () => { - console.log("切换误差体系", formContent.errorSysId); changeErrorSystem({ planId: checkStore.plan.id, scriptId: '', diff --git a/frontend/src/views/home/components/comparePreTest.vue b/frontend/src/views/home/components/comparePreTest.vue index cb740e1..e7195c9 100644 --- a/frontend/src/views/home/components/comparePreTest.vue +++ b/frontend/src/views/home/components/comparePreTest.vue @@ -15,7 +15,7 @@ finish-status="success"> - + @@ -39,7 +39,7 @@

- +