正式检测录波数据查询
This commit is contained in:
@@ -75,7 +75,7 @@
|
||||
<!-- 当code为'wave_data'时显示下拉框 -->
|
||||
<el-select
|
||||
v-if="isWaveData"
|
||||
v-model="scriptNameOptions[0]"
|
||||
v-model="selectedScriptName"
|
||||
style="width: 200px"
|
||||
@change="handleScriptNameChange"
|
||||
>
|
||||
@@ -94,12 +94,12 @@
|
||||
label="录波次数"
|
||||
v-if="isWaveData"
|
||||
>
|
||||
<el-select v-model="waveNumber">
|
||||
<el-select v-model="waveNumber" @change="handleWaveNumberChange">
|
||||
<el-option
|
||||
v-for="i in waveNumCount"
|
||||
:key="i-1"
|
||||
:key="i"
|
||||
:label="i"
|
||||
:value="i-1"
|
||||
:value="i"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -181,21 +181,13 @@ const defaultProps = {
|
||||
|
||||
const chnMapList: any = ref({})
|
||||
const waveNumCount = ref(0)
|
||||
const waveNumber = ref(0)
|
||||
const waveNumber = ref(1)
|
||||
const selectedScriptName = ref('')
|
||||
const pattern = ref('')
|
||||
// 添加以下内容
|
||||
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>({
|
||||
scriptName: '',
|
||||
@@ -231,22 +223,28 @@ const currentRawTableData = computed(() => {
|
||||
})
|
||||
|
||||
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 = {}
|
||||
formContent.deviceId = deviceId || ''
|
||||
formContent.chnNum = chnNum
|
||||
sourceKey.value = source
|
||||
if (source == 1) {
|
||||
// 正式检测进入页面
|
||||
rowList.value = row
|
||||
// 正式检测进入页面 - 创建新的对象避免引用共享
|
||||
rowList.value = {
|
||||
scriptName: row.scriptName,
|
||||
scriptType: row.scriptType,
|
||||
// 复制其他需要的属性
|
||||
devices: row.devices ? [...row.devices] : []
|
||||
}
|
||||
} else if (source == 2) {
|
||||
// 检测数据查询进入
|
||||
await initScriptData(row)
|
||||
}
|
||||
visible.value = true
|
||||
|
||||
scriptType = null
|
||||
|
||||
formContent.errorSysId = checkStore.plan.errorSysId
|
||||
|
||||
pqErrorList.length = 0
|
||||
// 获取误差体系
|
||||
let { data: resPqErrorList } = await getPqErrSysList()
|
||||
@@ -255,15 +253,14 @@ const open = async (row: any, chnNum: string, deviceId: string | null, source: n
|
||||
await getBasicInformation()
|
||||
}
|
||||
// 查询大项树
|
||||
const initScriptData = async (row: any) => {
|
||||
const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''
|
||||
|
||||
const initScriptData = async (row?: any) => {
|
||||
let response: any = await getBigTestItem({
|
||||
reCheckType: checkStore.reCheckType,
|
||||
planId: checkStore.plan.id,
|
||||
devIds: checkStore.devices.map(item => item.deviceId),
|
||||
patternId: pattern
|
||||
patternId: pattern.value
|
||||
})
|
||||
|
||||
// 格式化脚本数据
|
||||
let temp = response.data.map((item: any) => {
|
||||
return {
|
||||
@@ -271,30 +268,45 @@ const initScriptData = async (row: any) => {
|
||||
scriptName: item.scriptName
|
||||
}
|
||||
})
|
||||
rowList.value.scriptName = temp[0].scriptName
|
||||
rowList.value.scriptType = temp[0].id
|
||||
// 保存脚本数据并设置总数
|
||||
|
||||
// 保存脚本数据
|
||||
scriptData.value = temp
|
||||
setTimeout(() => {
|
||||
treeRef.value?.setCurrentKey(temp[0].id)
|
||||
}, 0)
|
||||
|
||||
// 只有在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
|
||||
setTimeout(() => {
|
||||
treeRef.value?.setCurrentKey(temp[0].id)
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
|
||||
//获取基本信息
|
||||
const getBasicInformation = async () => {
|
||||
checkResultData.value = []
|
||||
rawTableData.value = []
|
||||
|
||||
// 确保scriptData已初始化
|
||||
if (scriptData.value.length === 0) {
|
||||
await initScriptData()
|
||||
}
|
||||
|
||||
getContrastFormContent({
|
||||
planId: checkStore.plan.id,
|
||||
scriptType: rowList.value.scriptType,
|
||||
deviceId: formContent.deviceId,
|
||||
chnNum: formContent.chnNum,
|
||||
num: formContent.num == '' ? null : parseInt(formContent.num),
|
||||
patternId: pattern.value
|
||||
}).then((res: any) => {
|
||||
formContent.dataRule = res.data.dataRule
|
||||
formContent.deviceName = res.data.deviceName
|
||||
formContent.errorSysId = res.data.errorSysId
|
||||
chnMapList.value = res.data.chnMap
|
||||
formContent.num = res.data.checkNum
|
||||
|
||||
let chnMap: string[] = []
|
||||
for (let key in res.data.chnMap) {
|
||||
chnMap.push(key)
|
||||
@@ -302,14 +314,37 @@ const getBasicInformation = async () => {
|
||||
chnList.value = chnMap
|
||||
formContent.chnNum = formContent.chnNum == null ? chnList.value[0] : formContent.chnNum
|
||||
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) => {
|
||||
console.log('data', data)
|
||||
rowList.value.scriptName = data.scriptName
|
||||
rowList.value.scriptType = data.id
|
||||
|
||||
@@ -318,11 +353,23 @@ const handleNodeClick = (data: any) => {
|
||||
isWaveData.value = true
|
||||
// 过滤掉"录波"选项,设置下拉框数据
|
||||
scriptNameOptions.value = scriptData.value
|
||||
.filter(item => item.code !== 'wave_data')
|
||||
.filter(item => item.code !== 'wave_data' && item.code !== 'FREQ')
|
||||
.map(item => ({
|
||||
label: 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 {
|
||||
isWaveData.value = false
|
||||
getResults(data.code)
|
||||
@@ -339,8 +386,9 @@ const getResults = async (code: any) => {
|
||||
deviceId: formContent.deviceId,
|
||||
chnNum: formContent.chnNum,
|
||||
num: formContent.num == '' ? null : formContent.num,
|
||||
waveNum: code == 'wave_data' ? null : 0 ,
|
||||
isWave: code == 'wave_data' ? true : false
|
||||
waveNum: code == 'wave_data' ? waveNumber.value : null,
|
||||
isWave: code == 'wave_data' ? true : false ,
|
||||
patternId: pattern.value
|
||||
}).then((res: any) => {
|
||||
let list: string[] = []
|
||||
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 = () => {
|
||||
visible.value = false
|
||||
formContent.num = ''
|
||||
|
||||
Reference in New Issue
Block a user