修改右侧表格结构
This commit is contained in:
@@ -22,6 +22,12 @@
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="harmNumList.length" label='谐波次数'>
|
||||
<el-select v-model="currentHarmNum">
|
||||
<el-option v-for="item in harmNumList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
@@ -53,7 +59,8 @@
|
||||
<div class="content-right">
|
||||
<div class="content-right-title">
|
||||
<span class="content-right-title-text">当前检测项目:</span>
|
||||
<el-popover trigger="hover" :content="currentDesc? currentDesc : '无'" popper-class="popover-class" width="33%" placement="right">
|
||||
<el-popover trigger="hover" :content="currentDesc? currentDesc : '无'" popper-class="popover-class"
|
||||
width="32%" placement="right-start">
|
||||
<template #reference>
|
||||
<el-button type="text" style="font-size: 16px;">
|
||||
{{ currentScriptTypeName ? currentScriptTypeName : '无' }}
|
||||
@@ -68,7 +75,7 @@
|
||||
<div class="content-right-Tabs">
|
||||
<el-tabs type="border-card" v-model="activeTab">
|
||||
<el-tab-pane label="检测结果" name="resultTab">
|
||||
<DataCheckResultTable :tableData="checkResultTableData"/>
|
||||
<DataCheckResultTable :tableData="checkResultData" :info="infoMsg"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="原始数据" name="rawDataTab">
|
||||
<DataCheckRawDataTable :tableData="rawTableData"/>
|
||||
@@ -105,6 +112,9 @@ const checkStore = useCheckStore()
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
// 格式化数字
|
||||
const fixed = 4;
|
||||
|
||||
// 表单数据
|
||||
const formContent = reactive<CheckData.DataCheck>({
|
||||
scriptName: '',
|
||||
@@ -113,6 +123,11 @@ const formContent = reactive<CheckData.DataCheck>({
|
||||
deviceName: '',
|
||||
chnNum: '',
|
||||
})
|
||||
// 当前选中的谐波次数
|
||||
const currentHarmNum = ref<string>("-1")
|
||||
// 谐波次数列表
|
||||
const harmNumList = reactive([])
|
||||
|
||||
let deviceId: string = ''
|
||||
let scriptType: string | null = null
|
||||
|
||||
@@ -125,8 +140,7 @@ let switchItem = 0
|
||||
// 左侧树数据
|
||||
let treeDataUnqualified: CheckData.TreeItem[] = []
|
||||
let treeDataAll: CheckData.TreeItem[] = []
|
||||
// const treeDataUnqualified=reactive<CheckData.TreeItem[]>([])
|
||||
// const treeDataAll=reactive<CheckData.TreeItem[]>([])
|
||||
|
||||
|
||||
// 左侧树被选中的叶子节点id
|
||||
const checkIndex = ref<string>('')
|
||||
@@ -138,8 +152,14 @@ const currentDesc = ref('');
|
||||
// 右侧Tab选中项
|
||||
const activeTab = ref<string>('resultTab')
|
||||
|
||||
//存放相应的表格数据
|
||||
let resTableData: { resultData: Map<string, any>, rawData: Map<string, any> } = {}
|
||||
|
||||
// 检测结果表格数据
|
||||
const checkResultTableData = reactive<CheckData.CheckResult[]>([])
|
||||
const checkResultData = reactive<CheckData.CheckResult[]>([])
|
||||
|
||||
const infoMsg = reactive<{ title: string, name: string }[]>([])
|
||||
|
||||
// 原始数据表格数据
|
||||
const rawTableData = reactive<CheckData.RawDataItem[]>([])
|
||||
|
||||
@@ -172,7 +192,6 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||
code: checkStore.planCode
|
||||
})
|
||||
treeDataAll = resTreeDataTemp
|
||||
|
||||
// treeDataAll = [
|
||||
// {
|
||||
// scriptTypeName: "频率准确度检测",
|
||||
@@ -278,6 +297,14 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||
}
|
||||
})
|
||||
|
||||
watch(currentHarmNum, (newVal, oldVal) => {
|
||||
console.log("谐波次数", newVal);
|
||||
if(newVal !== '-1'){
|
||||
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString())
|
||||
setCheckResultData(resCheckResult)
|
||||
}
|
||||
})
|
||||
|
||||
const handleSwitchChange = async (data: any) => {
|
||||
console.log("切换不合格测试项、全部测试项", data);
|
||||
|
||||
@@ -311,20 +338,139 @@ const updateTableData = async () => {
|
||||
if (checkIndex.value) {
|
||||
console.log("更新表格数据");
|
||||
// 发起请求,查询该测试项的检测结果
|
||||
// const result = await getTableData({checkStore.scriptId,deviceId, formContent.chnNum, scriptType,checkIndex})
|
||||
// const {data} = await getTableData({checkStore.scriptId,deviceId, formContent.chnNum, scriptType,checkIndex})
|
||||
// resTableData =data
|
||||
|
||||
Object.assign(checkResultTableData, [{
|
||||
chnNum: '1',
|
||||
standardValue: 57.74,
|
||||
A: 57.73,
|
||||
A_errValue: 0.01,
|
||||
B: 57.73,
|
||||
B_errValue: 0.01,
|
||||
C: 57.73,
|
||||
C_errValue: 0.01,
|
||||
maxErrVaule: 0.05774,
|
||||
result: '合格',
|
||||
let resultData = new Map()
|
||||
// resultData.set("频率", [{
|
||||
// dataT: {
|
||||
// data: 57.7401,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// dataB: {
|
||||
// data: 57.7401,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// dataC: {
|
||||
// data: 57.7401,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// radius: 0.05774,
|
||||
// isData: '符合',
|
||||
// }])
|
||||
|
||||
// resultData.set('3', [{
|
||||
// dataA: {
|
||||
// data: 57.7401,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// dataB: {
|
||||
// data: 57.7401,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// dataC: {
|
||||
// data: 57.7401,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// radius: 0.05774,
|
||||
// isData: '符合',
|
||||
// }])
|
||||
// resultData.set('5', [{
|
||||
// dataA: {
|
||||
// data: 57.7402,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// dataB: {
|
||||
// data: 57.7402,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// dataC: {
|
||||
// data: 57.7402,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// radius: 0.05774,
|
||||
// isData: '符合',
|
||||
// }])
|
||||
// resultData.set('7', [{
|
||||
// dataA: {
|
||||
// data: 57.7403,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// dataB: {
|
||||
// data: 57.7403,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// dataC: {
|
||||
// data: 57.7403,
|
||||
// resultData: 57.7301,
|
||||
// },
|
||||
// radius: 0.05774,
|
||||
// isData: '符合',
|
||||
// }])
|
||||
|
||||
resultData.set("电压幅值", [{
|
||||
dataT: {
|
||||
data: 57.7401,
|
||||
resultData: 57.7301,
|
||||
},
|
||||
radius: 0.05774,
|
||||
isData: '符合',
|
||||
}])
|
||||
resultData.set("持续时间", [{
|
||||
dataT: {
|
||||
data: 57.7402,
|
||||
resultData: 57.7302,
|
||||
},
|
||||
radius: 0.05774,
|
||||
isData: '符合',
|
||||
}])
|
||||
|
||||
let rawData = new Map()
|
||||
|
||||
resTableData = {
|
||||
resultData: resultData,
|
||||
rawData: rawData
|
||||
}
|
||||
|
||||
let resCheckResult: CheckData.ResCheckResult = []
|
||||
let tempInfoMsg: { title: string, name: string } = []
|
||||
|
||||
if (resTableData.resultData.size === 1) {
|
||||
resCheckResult = resTableData.resultData.values().next().value
|
||||
Object.assign(harmNumList, [])
|
||||
currentHarmNum.value = '-1'
|
||||
|
||||
setCheckResultData(resCheckResult)
|
||||
} else {
|
||||
if (resTableData.resultData.get('电压幅值') || resTableData.resultData.get('持续时间')) {
|
||||
if (resTableData.resultData.get('电压幅值')) {
|
||||
tempInfoMsg.push({title: '电压幅值', name: 'Voltage'})
|
||||
resCheckResult.push(...resTableData.resultData.get('电压幅值'))
|
||||
}
|
||||
if (resTableData.resultData.get('持续时间')) {
|
||||
tempInfoMsg.push({title: '持续时间', name: 'Duration'})
|
||||
resCheckResult.push(...resTableData.resultData.get('持续时间'))
|
||||
}
|
||||
Object.assign(harmNumList, [])
|
||||
currentHarmNum.value = '-1'
|
||||
|
||||
Object.assign(infoMsg, tempInfoMsg)
|
||||
|
||||
setCheckResultData(resCheckResult)
|
||||
} else {
|
||||
let tempHarmNumList = []
|
||||
resTableData.resultData.forEach((value, key) => {
|
||||
tempHarmNumList.push({
|
||||
value: key,
|
||||
label: key
|
||||
})
|
||||
})
|
||||
Object.assign(harmNumList, tempHarmNumList)
|
||||
currentHarmNum.value = harmNumList[0].value
|
||||
}
|
||||
}
|
||||
|
||||
// setCheckResultData(resCheckResult)
|
||||
|
||||
Object.assign(rawTableData, [
|
||||
{
|
||||
@@ -507,6 +653,11 @@ const close = () => {
|
||||
treeDataAll = []
|
||||
Object.assign(treeDataUnqualified, [])
|
||||
Object.assign(treeDataAll, [])
|
||||
Object.assign(harmNumList, [])
|
||||
currentHarmNum.value = '-1'
|
||||
Object.assign(checkResultData, [])
|
||||
Object.assign(infoMsg, [])
|
||||
Object.assign(rawTableData, [])
|
||||
defaultExpandedKeys = []
|
||||
checkIndex.value = ''
|
||||
activeTab.value = 'resultTab'
|
||||
@@ -517,6 +668,34 @@ const close = () => {
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
const setCheckResultData = (data: CheckData.ResCheckResult[]) => {
|
||||
let result: CheckData.CheckResult[] = []
|
||||
data.forEach((item: CheckData.ResCheckResult) => {
|
||||
let temp: CheckData.CheckResult = {
|
||||
aStd: item.dataA?.resultData,
|
||||
aData: item.dataA?.data,
|
||||
aError: Math.abs(item.dataA?.data - item.dataA?.resultData).toFixed(fixed),
|
||||
bStd: item.dataB?.resultData,
|
||||
bData: item.dataB?.data,
|
||||
bError: Math.abs(item.dataB?.data - item.dataB?.resultData).toFixed(fixed),
|
||||
cStd: item.dataC?.resultData,
|
||||
cData: item.dataC?.data,
|
||||
cError: Math.abs(item.dataC?.data - item.dataC?.resultData).toFixed(fixed),
|
||||
tStd: item.dataT?.resultData,
|
||||
tData: item.dataT?.data,
|
||||
tError: Math.abs(item.dataT?.data - item.dataT?.resultData).toFixed(fixed),
|
||||
|
||||
maxError: item.radius,
|
||||
result: item.isData,
|
||||
}
|
||||
result.push(temp)
|
||||
})
|
||||
Object.assign(checkResultData, result)
|
||||
}
|
||||
|
||||
// const toFixed = (num: number, pow: number): string => {
|
||||
// return Math.floor(num * Math.pow(10, pow)) / Math.pow(10, pow)
|
||||
// }
|
||||
const findFirstLeafNode = (node: any): any => {
|
||||
if (!node.children || node.children.length === 0) {
|
||||
return node;
|
||||
@@ -534,52 +713,6 @@ const getDefaultNode = (data: any[]) => {
|
||||
return findFirstLeafNode(firstElement);
|
||||
}
|
||||
|
||||
// let treeD: any = [{
|
||||
// "scriptTypeName": "暂态",
|
||||
// "sort": null,
|
||||
// "fly": null,
|
||||
// "children": [
|
||||
// {
|
||||
// "scriptTypeName": "额定工作条件下的测量1",
|
||||
// "sort": null,
|
||||
// "fly": null,
|
||||
// "children": [
|
||||
// {
|
||||
// "scriptTypeName": "输入:频率=50.0Hz Ua=100.0%Un Ub=100.0%Un Uc=100.0%Un Ia=100.0%In Ib=100.0%In Ic=100.0%In 暂态 A相(暂态深度=null% 暂态持续时间=null%) B相(暂态深度=null% 暂态持续时间=null%) C相(暂态深度=null% 暂态持续时间=null%) ",
|
||||
// "sort": 81,
|
||||
// "fly": 1,
|
||||
// "children": null
|
||||
// },
|
||||
// {
|
||||
// "scriptTypeName": "输入:频率=45.0Hz Ua=100.0%Un Ub=100.0%Un Uc=100.0%Un Ia=100.0%In Ib=100.0%In Ic=100.0%In 暂态 A相(暂态深度=null% 暂态持续时间=null%) B相(暂态深度=null% 暂态持续时间=null%) C相(暂态深度=null% 暂态持续时间=null%) ",
|
||||
// "sort": 81,
|
||||
// "fly": 0,
|
||||
// "children": null
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "scriptTypeName": "额定工作条件下的测量2",
|
||||
// "sort": null,
|
||||
// "fly": null,
|
||||
// "children": [
|
||||
// {
|
||||
// "scriptTypeName": "输入:频率=50.0Hz Ua=100.0%Un Ub=100.0%Un Uc=100.0%Un Ia=100.0%In Ib=100.0%In Ic=100.0%In 暂态 A相(暂态深度=null% 暂态持续时间=null%) B相(暂态深度=null% 暂态持续时间=null%) C相(暂态深度=null% 暂态持续时间=null%) ",
|
||||
// "sort": 81,
|
||||
// "fly": 1,
|
||||
// "children": null
|
||||
// },
|
||||
// {
|
||||
// "scriptTypeName": "输入:频率=45.0Hz Ua=100.0%Un Ub=100.0%Un Uc=100.0%Un Ia=100.0%In Ib=100.0%In Ic=100.0%In 暂态 A相(暂态深度=null% 暂态持续时间=null%) B相(暂态深度=null% 暂态持续时间=null%) C相(暂态深度=null% 暂态持续时间=null%) ",
|
||||
// "sort": 81,
|
||||
// "fly": 0,
|
||||
// "children": null
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// }]
|
||||
|
||||
// fly: 1合格 2不合格 4数据错误
|
||||
const filterTree = (treeData: any[], fly: number): any[] => {
|
||||
if (!treeData || treeData.length === 0) {
|
||||
@@ -638,7 +771,7 @@ defineExpose({
|
||||
flex-direction: row;
|
||||
|
||||
.content-left-tree {
|
||||
width: 25%;
|
||||
width: 22%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
@@ -663,7 +796,7 @@ defineExpose({
|
||||
}
|
||||
|
||||
.content-right {
|
||||
width: 75%;
|
||||
width: 78%;
|
||||
margin-left: 10px;
|
||||
flex: 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user