正式检测-预检测提示及日志功能

This commit is contained in:
caozehui
2025-01-02 18:00:58 +08:00
parent 4031724fa9
commit 410cd53e51
8 changed files with 268 additions and 122 deletions

View File

@@ -34,14 +34,14 @@
</el-radio-group>
</div>
<div class="content-tree">
<el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="id"
<el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="scriptType"
:data="treeDataUnqualified" :props="defaultProps" @node-click="handleNodeClick"
class="custom-tree">
<template #default="{ node, data }">
<span class="custom-tree-node">{{ data.scriptName }}</span>
</template>
</el-tree>
<el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="id"
<el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="scriptType"
:data="treeDataAll" :props="defaultProps" @node-click="handleNodeClick" class="custom-tree">
<template #default="{ node, data }">
<span class="custom-tree-node">{{ data.scriptName }}</span>
@@ -79,10 +79,11 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface";
import {useDictStore} from "@/stores/modules/dict";
import {useCheckStore} from "@/stores/modules/check";
import {getFormData, getTreeData, getTableData} from "@/api/check/test";
const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean
}>(), {appendToBody: false})
}>(), {appendToBody: true})
const defaultProps = {
label: "scriptName",
@@ -115,7 +116,7 @@ let treeDataUnqualified: CheckData.ScriptItem[] = []
let treeDataAll: CheckData.ScriptItem[] = []
// 左侧树被选中的叶子节点id
const checkedScriptId = ref<string>('')
const checkedScriptType = ref<string>('')
const currentScriptDsc = ref('');
// 右侧Tab选中项
@@ -134,10 +135,10 @@ let defaultExpandedKeys: string[] = []
// 点击左侧树节点触发事件
const handleNodeClick = async (data: any) => {
if (!data.children) {
checkedScriptId.value = data.id
checkedScriptType.value = data.scriptType
currentScriptDsc.value = data.scriptName
if (checkedScriptId.value) {
if (checkedScriptType.value) {
await updateTableData()
}
}
@@ -155,36 +156,33 @@ const handleSwitchChange = async (data: any) => {
if (data === 0) {
// 发起请求,查询该测试项的检测结果
// const result = await getTreeData({checkStore.scriptId,deviceId, formContent.chnNum+'', scriptType,0})
// const result = await getTreeData({scriptId:checkStore.scriptId,deviceId, chnNum: formContent.chnNum+'', scriptType,0})
treeDataUnqualified = [{
"id": "1",
"scriptName": "频率准确度检测",
"children": [
{
"id": "1-2",
"scriptName": "电压对频率测量的影响",
"children": [
{
"id": "1-2-1",
"scriptName": "输入:频率 50.05Hz Ua =10%Un..."
"scriptName": "输入:频率 50.05Hz Ua =10%Un...",
"scriptType": '2346adafdf'
},
{
"id": "1-2-2",
"scriptName": "输入:频率 51.05Hz Ua =10%Un..."
"scriptName": "输入:频率 51.05Hz Ua =10%Un...",
"scriptType": '1246adaafdf'
},
{
"id": "1-2-3",
"scriptName": "输入:频率 52.05Hz Ua =10%Un..."
"scriptName": "输入:频率 52.05Hz Ua =10%Un...",
"scriptType": '2136ada3fdf'
}
]
},
{
"id": "1-3",
"scriptName": "谐波对频率测量的影响",
"children": [
{
"id": "1-3-1",
"scriptName": "输入:频率 50.05Hz Ua =100%Un..."
"scriptName": "输入:频率 50.05Hz Ua =100%Un...",
"scriptType": '234246adafdf'
}
]
}
@@ -192,60 +190,56 @@ const handleSwitchChange = async (data: any) => {
}]
} else {
// 发起请求,查询该测试项的检测结果
// const result = await getTreeData({checkStore.scriptId,deviceId, formContent.chnNum+'', scriptType,1})
// const result = await getTreeData({scriptId:checkStore.scriptId,deviceId, chnNum: formContent.chnNum+'', scriptType,1})
treeDataAll = [
{
"id": "1",
"scriptName": "频率准确度检测",
"children": [
{
"id": "1-1",
"scriptName": "额定工作条件下的检测",
"children": [
{
"id": "1-1-1",
"scriptName": "输入:频率 42.5Hz..."
"scriptName": "输入:频率 42.5Hz...",
"scriptType": '2246ada2fdf'
},
{
"id": "1-1-2",
"scriptName": "输入:频率 50.0Hz..."
"scriptName": "输入:频率 50.0Hz...",
"scriptType": '2246a3dafdf'
},
{
"id": "1-1-3",
"scriptName": "输入:频率 50.05Hz...."
"scriptName": "输入:频率 50.05Hz....",
"scriptType": '22246adafdf'
}
]
},
{
"id": "1-2",
"scriptName": "电压对频率测量的影响",
"children": [
{
"id": "1-2-1",
"scriptName": "输入:频率 50.05Hz Ua =10%Un..."
"scriptName": "输入:频率 50.05Hz Ua =10%Un...",
"scriptType": '224a6adafdf'
},
{
"id": "1-2-2",
"scriptName": "输入:频率 51.05Hz Ua =10%Un..."
"scriptName": "输入:频率 51.05Hz Ua =10%Un...",
"scriptType": '2246aadafdf'
},
{
"id": "1-2-3",
"scriptName": "输入:频率 52.05Hz Ua =10%Un..."
"scriptName": "输入:频率 52.05Hz Ua =10%Un...",
"scriptType": '2246adaffdf'
}
]
},
{
"id": "1-3",
"scriptName": "谐波对频率测量的影响",
"children": [
{
"id": "1-3-1",
"scriptName": "输入:频率 50.05Hz Ua =100%Un..."
"scriptName": "输入:频率 50.05Hz Ua =100%Un...",
"scriptType": '2246aadafdf'
}
]
}
]
},
}
]
}
@@ -263,12 +257,12 @@ const defaultOperate = () => {
node = getDefaultNode(treeDataAll)
}
currentScriptDsc.value = node?.scriptName
checkedScriptId.value = node?.id
defaultExpandedKeys = [node?.id]
checkedScriptType.value = node?.scriptType
defaultExpandedKeys = [node?.scriptType]
}
const updateTableData = async () => {
console.log("左侧树被选中的叶子节点id", checkedScriptId.value);
console.log("左侧树被选中的叶子节点scriptType", checkedScriptType.value);
// 发起请求,查询该测试项的检测结果
// const result = await getTableData({checkStore.scriptId,deviceId, formContent.chnNum, scriptType})
@@ -409,26 +403,26 @@ const updateTableData = async () => {
]
}
const open = (_deviceId: string, chnNum: string, _scriptType: string | null) => {
console.log(checkStore.scriptId, _deviceId, chnNum, _scriptType);
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
// console.log(checkStore.scriptId, _deviceId, chnNum, _scriptType);
deviceId = _deviceId
scriptType = _scriptType
// 发起后端请求,查询详细信息 当chnNum为-1时查询所有通道号
//const resFormContent = await getFormData({checkStore.scriptId,deviceId, chnNum,scriptType})
const {data: resFormContent} = await getFormData({planId: checkStore.planId, deviceId, chnNum, scriptType})
// 数据处理
let resFormContent = {
scriptName: 'Q/GDW 10650.4-2021 模拟式',
errorSysName: 'Q/GDW 10650.2-2021',
dataRule: '505f063f9f91ab108d895a9fe96b5dce',
deviceName: '被检设备1',
chnList: [
{value: '1', label: '1'},
{value: '2', label: '0'},
{value: '3', label: '1'},
{value: '4', label: '0'}],
}
// let resFormContent = {
// scriptName: 'Q/GDW 10650.4-2021 模拟式',
// errorSysName: 'Q/GDW 10650.2-2021',
// dataRule: '505f063f9f91ab108d895a9fe96b5dce',
// deviceName: '被检设备1',
// chnList: [
// {value: '1', label: '1'},
// {value: '2', label: '0'},
// {value: '3', label: '1'},
// {value: '4', label: '0'}],
// }
chnList = resFormContent.chnList.map(item => ({
value: item.value,
label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)`
@@ -436,7 +430,11 @@ const open = (_deviceId: string, chnNum: string, _scriptType: string | null) =>
let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
Object.assign(formContent, {...resFormContent, dataRule: dataRuleName, chnNum: chnList[0].value})
Object.assign(formContent, {
...resFormContent,
dataRule: dataRuleName,
chnNum: chnList[0].value
})
visible.value = true;
@@ -453,7 +451,7 @@ const close = () => {
})
treeDataUnqualified = []
treeDataAll = []
checkedScriptId.value = ''
checkedScriptType.value = ''
activeTab.value = 'rawDataTab'
currentScriptDsc.value = ''
switchItem.value = 0