修改检测结果弹窗框
This commit is contained in:
@@ -48,15 +48,19 @@ export namespace CheckData {
|
|||||||
aStd?: string,
|
aStd?: string,
|
||||||
aData?: string,
|
aData?: string,
|
||||||
aError?: string,
|
aError?: string,
|
||||||
|
isDataA?: number,
|
||||||
bStd?: string,
|
bStd?: string,
|
||||||
bData?: string,
|
bData?: string,
|
||||||
bError?: string,
|
bError?: string,
|
||||||
|
isDataB?: number,
|
||||||
cStd?: string,
|
cStd?: string,
|
||||||
cData?: string,
|
cData?: string,
|
||||||
cError?: string,
|
cError?: string,
|
||||||
|
isDataC?: number,
|
||||||
tStd?: string,
|
tStd?: string,
|
||||||
tData?: string,
|
tData?: string,
|
||||||
tError?: string,
|
tError?: string,
|
||||||
|
isDataT?: number,
|
||||||
|
|
||||||
//最大误差值
|
//最大误差值
|
||||||
maxError?: string,
|
maxError?: string,
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
<el-table-column type="index" label="序号" width="70" fixed="left"/>
|
||||||
<el-table-column prop="time" label="数据时间"/>
|
<el-table-column prop="time" label="数据时间"/>
|
||||||
<template v-if="phaseFlag === 0">
|
<template v-if="phaseT === 0">
|
||||||
<el-table-column prop="dataA" :label="`A(${unit})`"/>
|
<el-table-column prop="dataA" :label="`A(${unit})`"/>
|
||||||
<el-table-column prop="dataB" :label="`B(${unit})`"/>
|
<el-table-column prop="dataB" :label="`B(${unit})`"/>
|
||||||
<el-table-column prop="dataC" :label="`C(${unit})`"/>
|
<el-table-column prop="dataC" :label="`C(${unit})`"/>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="phaseFlag === 1">
|
<template v-if="phaseT === 1">
|
||||||
<el-table-column prop="dataT" :label="`T(${unit})`"/>
|
<el-table-column prop="dataT" :label="`T(${unit})`"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -31,7 +31,7 @@ const unit = computed(() => {
|
|||||||
return tableData.length > 0 ? tableData[0].unit : '';
|
return tableData.length > 0 ? tableData[0].unit : '';
|
||||||
})
|
})
|
||||||
|
|
||||||
const phaseFlag = computed(() => {
|
const phaseT = computed(() => {
|
||||||
let result = 0;
|
let result = 0;
|
||||||
if (tableData.length > 0) {
|
if (tableData.length > 0) {
|
||||||
result = !tableData[0].dataT ? 0 : 1;
|
result = !tableData[0].dataT ? 0 : 1;
|
||||||
|
|||||||
@@ -8,24 +8,42 @@
|
|||||||
<!-- {{ '通道' + row.chnNum }}-->
|
<!-- {{ '通道' + row.chnNum }}-->
|
||||||
<!-- </template>-->
|
<!-- </template>-->
|
||||||
<!-- </el-table-column>-->
|
<!-- </el-table-column>-->
|
||||||
<template v-if="phaseFlag === 0">
|
<template v-if="phaseT === 0">
|
||||||
<el-table-column :label="`A(${unit})`">
|
<el-table-column :label="`A(${unit})`">
|
||||||
<el-table-column prop="aStd" width="74" label="标准值"/>
|
<el-table-column prop="aStd" width="72" label="标准值"/>
|
||||||
<el-table-column prop="aData" width="74" label="被检值"/>
|
<el-table-column prop="aData" width="72" label="被检值"/>
|
||||||
<el-table-column prop="aError" width="74" label="误差值"/>
|
<el-table-column prop="aError" width="85" label="误差值">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.isDataA === 1">{{scope.row.aError}}</span>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataA === 2">{{scope.row.aError}}</el-tag>
|
||||||
|
<span v-if="scope.row.isDataA === 4">/</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="`B(${unit})`">
|
<el-table-column :label="`B(${unit})`">
|
||||||
<el-table-column prop="bStd" width="74" label="标准值"/>
|
<el-table-column prop="bStd" width="72" label="标准值"/>
|
||||||
<el-table-column prop="bData" width="74" label="被检值"/>
|
<el-table-column prop="bData" width="72" label="被检值"/>
|
||||||
<el-table-column prop="bError" width="74" label="误差值"/>
|
<el-table-column prop="bError" width="85" label="误差值">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.isDataB === 1">{{scope.row.bError}}</span>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataB === 2">{{scope.row.bError}}</el-tag>
|
||||||
|
<span v-if="scope.row.isDataB === 4">/</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="`C(${unit})`">
|
<el-table-column :label="`C(${unit})`">
|
||||||
<el-table-column prop="cStd" width="74" label="标准值"/>
|
<el-table-column prop="cStd" width="72" label="标准值"/>
|
||||||
<el-table-column prop="cData" width="74" label="被检值"/>
|
<el-table-column prop="cData" width="72" label="被检值"/>
|
||||||
<el-table-column prop="cError" width="74" label="误差值"/>
|
<el-table-column prop="cError" width="85" label="误差值">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.isDataC === 1">{{scope.row.cError}}</span>
|
||||||
|
<el-tag type="danger" v-if="scope.row.isDataC === 2">{{scope.row.cError}}</el-tag>
|
||||||
|
<span v-if="scope.row.isDataC === 4">/</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="maxError" :label="`最大误差`"/>
|
<el-table-column prop="maxError" :label="`最大误差(${unit})`"/>
|
||||||
<el-table-column prop="result" label="检测结果" width="95">
|
<el-table-column prop="result" label="检测结果" width="88">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>
|
<el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>
|
||||||
<span v-if="scope.row.result === 1">符合</span>
|
<span v-if="scope.row.result === 1">符合</span>
|
||||||
@@ -34,7 +52,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="phaseFlag === 1">
|
<template v-if="phaseT === 1">
|
||||||
<el-table-column :label="`T(${unit})`">
|
<el-table-column :label="`T(${unit})`">
|
||||||
<el-table-column prop="tStd" label="标准值"/>
|
<el-table-column prop="tStd" label="标准值"/>
|
||||||
<el-table-column prop="tData" label="被检值"/>
|
<el-table-column prop="tData" label="被检值"/>
|
||||||
@@ -43,8 +61,8 @@
|
|||||||
<el-table-column prop="maxError" label="最大误差"/>
|
<el-table-column prop="maxError" label="最大误差"/>
|
||||||
<el-table-column prop="result" label="检测结果">
|
<el-table-column prop="result" label="检测结果">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>
|
|
||||||
<span v-if="scope.row.result === 1">符合</span>
|
<span v-if="scope.row.result === 1">符合</span>
|
||||||
|
<el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>
|
||||||
<span v-if="scope.row.result === 4">/</span>
|
<span v-if="scope.row.result === 4">/</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -68,7 +86,7 @@ const unit = computed(() => {
|
|||||||
return tableData.length > 0 ? tableData[0].unit : '';
|
return tableData.length > 0 ? tableData[0].unit : '';
|
||||||
})
|
})
|
||||||
|
|
||||||
const phaseFlag = computed(() => {
|
const phaseT = computed(() => {
|
||||||
let result = 0;
|
let result = 0;
|
||||||
if (tableData.length > 0) {
|
if (tableData.length > 0) {
|
||||||
result = !tableData[0].tData ? 0 : 1;
|
result = !tableData[0].tData ? 0 : 1;
|
||||||
|
|||||||
@@ -26,24 +26,21 @@
|
|||||||
|
|
||||||
<div class="data-check-body">
|
<div class="data-check-body">
|
||||||
<div class="content-left-tree">
|
<div class="content-left-tree">
|
||||||
<div>
|
<div style="width: 190px;">
|
||||||
<el-radio-group v-model="switchItem" @change="handleSwitchChange">
|
<el-input
|
||||||
<el-radio-button label="不符合测试项" :value="0"/>
|
placeholder='请输入测试项名称'
|
||||||
<el-radio-button label="全部测试项" :value="1"/>
|
clearable
|
||||||
</el-radio-group>
|
v-model='searchValue'
|
||||||
|
></el-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-tree">
|
<div class="content-tree">
|
||||||
<el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="index"
|
<el-tree :filter-node-method='filterNode' :highlight-current="true" :default-expanded-keys="defaultExpandedKeys"
|
||||||
:data="treeDataUnqualified" :props="defaultProps" @node-click="handleNodeClick"
|
node-key="index"
|
||||||
class="custom-tree">
|
:data="treeDataAll"
|
||||||
|
:props="defaultProps"
|
||||||
|
@node-click="handleNodeClick" class="custom-tree" ref="treeRef">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<span class="custom-tree-node">{{ data.scriptTypeName }}</span>
|
<span class="custom-tree-node" :style="data.fly===2? 'color: red;':''">{{ data.scriptTypeName }}</span>
|
||||||
</template>
|
|
||||||
</el-tree>
|
|
||||||
<el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="index"
|
|
||||||
:data="treeDataAll" :props="defaultProps" @node-click="handleNodeClick" class="custom-tree">
|
|
||||||
<template #default="{ node, data }">
|
|
||||||
<span class="custom-tree-node">{{ data.scriptTypeName }}</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
@@ -55,7 +52,7 @@
|
|||||||
<span class="content-right-title-text">当前检测项目:
|
<span class="content-right-title-text">当前检测项目:
|
||||||
<el-popover trigger="hover" :content="currentDesc? currentDesc : '无'" :width="popoverWidth" placement="right">
|
<el-popover trigger="hover" :content="currentDesc? currentDesc : '无'" :width="popoverWidth" placement="right">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button type="text" style="font-size: 16px;">
|
<el-button type="text" style="font-size: 14px;">
|
||||||
{{ currentScriptTypeName ? currentScriptTypeName : '无' }}
|
{{ currentScriptTypeName ? currentScriptTypeName : '无' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -91,7 +88,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import {dialogBig} from '@/utils/elementBind'
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
import {reactive, ref} from 'vue'
|
import {reactive, ref, watch} from 'vue'
|
||||||
import DataCheckResultTable from './dataCheckResultTable.vue'
|
import DataCheckResultTable from './dataCheckResultTable.vue'
|
||||||
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
||||||
import {CheckData} from "@/api/check/interface";
|
import {CheckData} from "@/api/check/interface";
|
||||||
@@ -112,6 +109,11 @@ const dictStore = useDictStore()
|
|||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
|
|
||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
|
const treeRef = ref()
|
||||||
|
const searchValue = ref<string>('')
|
||||||
|
watch(searchValue, (val) => {
|
||||||
|
treeRef.value!.filter(val)
|
||||||
|
})
|
||||||
|
|
||||||
// 格式化数字
|
// 格式化数字
|
||||||
const fixed = 4;
|
const fixed = 4;
|
||||||
@@ -139,12 +141,9 @@ let scriptType: string | null = null
|
|||||||
// 通道下拉列表
|
// 通道下拉列表
|
||||||
let chnList: any[] = []
|
let chnList: any[] = []
|
||||||
|
|
||||||
// 不符合测试项、全部测试项切换
|
|
||||||
let switchItem = ref(0)
|
|
||||||
|
|
||||||
// 左侧树数据
|
// 左侧树数据
|
||||||
let treeDataUnqualified: CheckData.TreeItem[] = []
|
const treeDataAll = reactive<CheckData.TreeItem[]>([])
|
||||||
let treeDataAll: CheckData.TreeItem[] = []
|
|
||||||
|
|
||||||
// 左侧树被选中的叶子节点id
|
// 左侧树被选中的叶子节点id
|
||||||
const checkIndex = ref<string>('')
|
const checkIndex = ref<string>('')
|
||||||
@@ -163,7 +162,7 @@ let resTableData: { resultData: Map<string, any>, rawData: Map<string, any> } =
|
|||||||
const checkResultData = reactive<CheckData.CheckResult[]>([])
|
const checkResultData = reactive<CheckData.CheckResult[]>([])
|
||||||
|
|
||||||
const popoverWidth: ComputedRef<string> = computed(() => {
|
const popoverWidth: ComputedRef<string> = computed(() => {
|
||||||
return `${680 - currentScriptTypeName.value.length * 16 - (harmNumList.length || checkList.length ? 120 : 0)}px`
|
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 140 : 0)}px`
|
||||||
})
|
})
|
||||||
|
|
||||||
// 原始数据表格数据
|
// 原始数据表格数据
|
||||||
@@ -172,6 +171,11 @@ const rawTableData = reactive<CheckData.RawDataItem[]>([])
|
|||||||
// 左侧树默认展开节点id
|
// 左侧树默认展开节点id
|
||||||
let defaultExpandedKeys: string[] = []
|
let defaultExpandedKeys: string[] = []
|
||||||
|
|
||||||
|
const filterNode = (value: string, data: any) => {
|
||||||
|
if (!value) return true
|
||||||
|
return data.scriptTypeName.includes(value)
|
||||||
|
}
|
||||||
|
|
||||||
// 点击左侧树节点触发事件
|
// 点击左侧树节点触发事件
|
||||||
const handleNodeClick = async (data: any) => {
|
const handleNodeClick = async (data: any) => {
|
||||||
if (!data.children) {
|
if (!data.children) {
|
||||||
@@ -197,18 +201,17 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
|||||||
scriptType: scriptType,
|
scriptType: scriptType,
|
||||||
code: parseInt(checkStore.planCode)
|
code: parseInt(checkStore.planCode)
|
||||||
})
|
})
|
||||||
treeDataAll = resTreeDataTemp
|
updateTreeFly(resTreeDataTemp, 2)
|
||||||
|
|
||||||
let treeDataTemp = JSON.parse(JSON.stringify(treeDataAll))
|
Object.assign(treeDataAll, resTreeDataTemp)
|
||||||
filterTree(treeDataTemp, 2)
|
console.log("树数据", treeDataAll)
|
||||||
treeDataUnqualified = treeDataTemp
|
|
||||||
|
|
||||||
switchItem.value = 0
|
// await handleSwitchChange(0)
|
||||||
await handleSwitchChange(0)
|
defaultOperate()
|
||||||
|
await updateTableData()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
watch(currentHarmNum, (newVal, oldVal) => {
|
watch(currentHarmNum, (newVal, oldVal) => {
|
||||||
console.log("谐波次数", newVal);
|
console.log("谐波次数", newVal);
|
||||||
if (newVal !== '-1') {
|
if (newVal !== '-1') {
|
||||||
@@ -228,21 +231,17 @@ watch(currentCheckItem, (newVal, oldVal) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleSwitchChange = async (data: any) => {
|
// const handleSwitchChange = async (data: any) => {
|
||||||
console.log("切换不合格测试项、全部测试项", data);
|
// console.log("切换不合格测试项、全部测试项", data);
|
||||||
|
//
|
||||||
defaultOperate()
|
// defaultOperate()
|
||||||
await updateTableData()
|
// await updateTableData()
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 默认操作
|
// 默认操作
|
||||||
const defaultOperate = () => {
|
const defaultOperate = () => {
|
||||||
let node = null
|
let node = getDefaultNode(treeDataAll)
|
||||||
if (switchItem.value === 0) {
|
|
||||||
node = getDefaultNode(treeDataUnqualified)
|
|
||||||
} else {
|
|
||||||
node = getDefaultNode(treeDataAll)
|
|
||||||
}
|
|
||||||
if (node) {
|
if (node) {
|
||||||
currentScriptTypeName.value = node.scriptTypeName
|
currentScriptTypeName.value = node.scriptTypeName
|
||||||
currentDesc.value = node.sourceDesc
|
currentDesc.value = node.sourceDesc
|
||||||
@@ -374,9 +373,6 @@ const close = () => {
|
|||||||
deviceName: '',
|
deviceName: '',
|
||||||
chnNum: '',
|
chnNum: '',
|
||||||
})
|
})
|
||||||
treeDataUnqualified = []
|
|
||||||
treeDataAll = []
|
|
||||||
treeDataUnqualified.length = 0
|
|
||||||
treeDataAll.length = 0
|
treeDataAll.length = 0
|
||||||
harmNumList.length = 0
|
harmNumList.length = 0
|
||||||
currentHarmNum.value = '-1'
|
currentHarmNum.value = '-1'
|
||||||
@@ -387,7 +383,6 @@ const close = () => {
|
|||||||
activeTab.value = 'resultTab'
|
activeTab.value = 'resultTab'
|
||||||
currentScriptTypeName.value = ''
|
currentScriptTypeName.value = ''
|
||||||
currentDesc.value = ''
|
currentDesc.value = ''
|
||||||
switchItem.value = 0
|
|
||||||
|
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
};
|
};
|
||||||
@@ -396,15 +391,18 @@ const setCheckResultData = (data: CheckData.ResCheckResult) => {
|
|||||||
let result: CheckData.CheckResult[] = []
|
let result: CheckData.CheckResult[] = []
|
||||||
if (data.dataA && data.dataB && data.dataC) {
|
if (data.dataA && data.dataB && data.dataC) {
|
||||||
result.push({
|
result.push({
|
||||||
aStd: data.dataA?.resultData.toFixed(fixed),
|
aStd: numberToFixed(data.dataA?.resultData),
|
||||||
aData: data.dataA?.data?.toFixed(fixed),
|
aData: numberToFixed(data.dataA?.data),
|
||||||
aError: getError(data.dataA?.resultData, data.dataA?.data),
|
aError: getError(data.dataA?.resultData, data.dataA?.data),
|
||||||
bStd: data.dataB?.resultData?.toFixed(fixed),
|
isDataA: data.dataA?.isData,
|
||||||
bData: data.dataB?.data?.toFixed(fixed),
|
bStd: numberToFixed(data.dataB?.resultData),
|
||||||
|
bData: numberToFixed(data.dataB?.data),
|
||||||
bError: getError(data.dataB?.resultData, data.dataB?.data),
|
bError: getError(data.dataB?.resultData, data.dataB?.data),
|
||||||
cStd: data.dataC?.resultData?.toFixed(fixed),
|
isDataB: data.dataB?.isData,
|
||||||
cData: data.dataC?.data?.toFixed(fixed),
|
cStd: numberToFixed(data.dataC?.resultData),
|
||||||
|
cData: numberToFixed(data.dataC?.data),
|
||||||
cError: getError(data.dataC?.resultData, data.dataC?.data),
|
cError: getError(data.dataC?.resultData, data.dataC?.data),
|
||||||
|
isDataC: data.dataC?.isData,
|
||||||
|
|
||||||
maxError: data.radius,
|
maxError: data.radius,
|
||||||
unit: data.unit,
|
unit: data.unit,
|
||||||
@@ -414,33 +412,43 @@ const setCheckResultData = (data: CheckData.ResCheckResult) => {
|
|||||||
|
|
||||||
if (data.dataT) {
|
if (data.dataT) {
|
||||||
result.push({
|
result.push({
|
||||||
tStd: data.dataT?.resultData?.toFixed(fixed),
|
tStd: numberToFixed(data.dataT?.resultData),
|
||||||
tData: data.dataT?.data?.toFixed(fixed),
|
tData: numberToFixed(data.dataT?.data),
|
||||||
tError: getError(data.dataT?.resultData, data.dataT?.data),
|
tError: getError(data.dataT?.resultData, data.dataT?.data),
|
||||||
|
isDataT: data.dataT?.isData,
|
||||||
maxError: data.radius,
|
maxError: data.radius,
|
||||||
unit: data.unit,
|
unit: data.unit,
|
||||||
result: data.isData,
|
result: data.isData,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
console.log("检测结果", result);
|
||||||
Object.assign(checkResultData, result)
|
Object.assign(checkResultData, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
const setRawData = (data: CheckData.RawDataItem[]) => {
|
const setRawData = (data: CheckData.RawDataItem[]) => {
|
||||||
data.forEach((item: CheckData.RawDataItem) => {
|
data.forEach((item: CheckData.RawDataItem) => {
|
||||||
item.dataA = item.dataA == null || item.dataA == undefined ? '' : Number(item.dataA).toFixed(fixed)
|
item.dataA = item.dataA == null || item.dataA == undefined ? '' : Number(item.dataA).toFixed(fixed).replace(/-/g, "")
|
||||||
item.dataB = item.dataB == null || item.dataB == undefined ? '' : Number(item.dataB).toFixed(fixed)
|
item.dataB = item.dataB == null || item.dataB == undefined ? '' : Number(item.dataB).toFixed(fixed).replace(/-/g, "")
|
||||||
item.dataC = item.dataC == null || item.dataC == undefined ? '' : Number(item.dataC).toFixed(fixed)
|
item.dataC = item.dataC == null || item.dataC == undefined ? '' : Number(item.dataC).toFixed(fixed).replace(/-/g, "")
|
||||||
item.dataT = item.dataT == null || item.dataT == undefined ? '' : Number(item.dataT).toFixed(fixed)
|
item.dataT = item.dataT == null || item.dataT == undefined ? '' : Number(item.dataT).toFixed(fixed).replace(/-/g, "")
|
||||||
})
|
})
|
||||||
|
console.log("原始数据", data)
|
||||||
Object.assign(rawTableData, data)
|
Object.assign(rawTableData, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const numberToFixed = (num: number): string => {
|
||||||
|
if (num == null || num == undefined) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
|
return num.toFixed(fixed).replace(/-/g, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getError = (num1: number, num2: number): string => {
|
const getError = (num1: number, num2: number): string => {
|
||||||
if (num1 == null || num1 == undefined || num2 == null || num2 == undefined) {
|
if (num1 == null || num1 == undefined || num2 == null || num2 == undefined) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
return Math.abs(Number(num1.toFixed(fixed)) - Number(num2.toFixed(fixed))).toFixed(fixed)
|
return Math.abs(Number(numberToFixed(num1)) - Number(numberToFixed(num2))).toFixed(fixed)
|
||||||
}
|
}
|
||||||
|
|
||||||
const findFirstLeafNode = (node: any): any => {
|
const findFirstLeafNode = (node: any): any => {
|
||||||
@@ -486,6 +494,42 @@ const filter = (treeData: any[], fly: number) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateTreeFly = (treeData: any[], fly: number) => {
|
||||||
|
// 递归函数
|
||||||
|
function recursiveUpdate(node: any, targetFly: number) {
|
||||||
|
//if (!node) return false; // 如果节点不存在,返回 false
|
||||||
|
|
||||||
|
// 如果当前节点是叶子节点且 fly 字段等于 targetFly
|
||||||
|
if (!node.children || node.children.length === 0) {
|
||||||
|
if (node.fly === targetFly) {
|
||||||
|
node.fly = targetFly; // 确保叶子节点的 fly 字段被设置为 targetFly
|
||||||
|
return true; // 返回 true 表示找到并更新了
|
||||||
|
}
|
||||||
|
return false; // 否则返回 false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 递归更新子节点
|
||||||
|
let updated = false;
|
||||||
|
for (let child of node.children) {
|
||||||
|
if (recursiveUpdate(child, targetFly)) {
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果有子节点被更新了,则更新当前节点的 fly 字段
|
||||||
|
if (updated) {
|
||||||
|
node.fly = targetFly;
|
||||||
|
}
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < treeData.length; i++) {
|
||||||
|
// 调用递归函数从根节点开始更新
|
||||||
|
recursiveUpdate(treeData[i], fly);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open
|
open
|
||||||
})
|
})
|
||||||
@@ -518,7 +562,7 @@ defineExpose({
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
.content-left-tree {
|
.content-left-tree {
|
||||||
width: 20%;
|
width: 18%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -543,7 +587,7 @@ defineExpose({
|
|||||||
}
|
}
|
||||||
|
|
||||||
.content-right {
|
.content-right {
|
||||||
width: 80%;
|
width: 82%;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
@@ -554,7 +598,7 @@ defineExpose({
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
|
||||||
.content-right-title-text {
|
.content-right-title-text {
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -564,9 +564,9 @@ const updatePercentage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo 可移除start
|
// todo 可移除start
|
||||||
let randomUnConnectedRaw = -1
|
// let randomUnConnectedRaw = -1
|
||||||
let randomUnConnectedDeviceId = -1
|
// let randomUnConnectedDeviceId = -1
|
||||||
let randomErrorDataRaw = -1
|
// let randomErrorDataRaw = -1
|
||||||
// todo 可移除end
|
// todo 可移除end
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
@@ -575,13 +575,13 @@ onBeforeMount(async () => {
|
|||||||
initCheckResult()
|
initCheckResult()
|
||||||
|
|
||||||
// todo 可移除start
|
// todo 可移除start
|
||||||
let a = getRandomInt(scriptData.length) + 4
|
// let a = getRandomInt(scriptData.length) + 4
|
||||||
randomUnConnectedRaw = a < scriptData.length ? a : scriptData.length
|
// randomUnConnectedRaw = a < scriptData.length ? a : scriptData.length
|
||||||
randomUnConnectedDeviceId = deviceList[getRandomInt(deviceList.length)].deviceId
|
// randomUnConnectedDeviceId = deviceList[getRandomInt(deviceList.length)].deviceId
|
||||||
randomErrorDataRaw = getRandomInt(scriptData.length) + 1
|
// randomErrorDataRaw = getRandomInt(scriptData.length) + 1
|
||||||
while (randomErrorDataRaw === randomUnConnectedRaw) {
|
// while (randomErrorDataRaw === randomUnConnectedRaw) {
|
||||||
randomErrorDataRaw = getRandomInt(scriptData.length) + 1
|
// randomErrorDataRaw = getRandomInt(scriptData.length) + 1
|
||||||
}
|
// }
|
||||||
// todo 可移除end
|
// todo 可移除end
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -794,36 +794,36 @@ const getCheckResult = (scriptType: string) => {
|
|||||||
// debugger
|
// debugger
|
||||||
let devices = []
|
let devices = []
|
||||||
|
|
||||||
if (activeIndex === randomErrorDataRaw) {
|
// if (activeIndex === randomErrorDataRaw) {
|
||||||
|
// devices = deviceList.map(item => {
|
||||||
|
// let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
||||||
|
// if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
|
||||||
|
// for (let i = 0; i < item.chnNum; i++) {
|
||||||
|
// tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
|
||||||
|
// //errorCheckItem.push({scriptType,type:'warning'})
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// for (let i = 0; i < item.chnNum; i++) {
|
||||||
|
// tempChnResult.push(CheckData.ChnCheckResultEnum.ERRORDATA)
|
||||||
|
// //errorCheckItem.push({scriptType,type:'warning'})
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return {
|
||||||
|
// deviceId: item.deviceId,
|
||||||
|
// deviceName: item.deviceName,
|
||||||
|
// chnResult: tempChnResult,
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
devices = deviceList.map(item => {
|
devices = deviceList.map(item => {
|
||||||
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
||||||
if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
|
// if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
|
||||||
for (let i = 0; i < item.chnNum; i++) {
|
// for (let i = 0; i < item.chnNum; i++) {
|
||||||
tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
|
// tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
|
||||||
//errorCheckItem.push({scriptType,type:'warning'})
|
// //errorCheckItem.push({scriptType,type:'warning'})
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
for (let i = 0; i < item.chnNum; i++) {
|
|
||||||
tempChnResult.push(CheckData.ChnCheckResultEnum.ERRORDATA)
|
|
||||||
//errorCheckItem.push({scriptType,type:'warning'})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
deviceId: item.deviceId,
|
|
||||||
deviceName: item.deviceName,
|
|
||||||
chnResult: tempChnResult,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
devices = deviceList.map(item => {
|
|
||||||
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
|
|
||||||
if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
|
|
||||||
for (let i = 0; i < item.chnNum; i++) {
|
|
||||||
tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
|
|
||||||
//errorCheckItem.push({scriptType,type:'warning'})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (let i = 0; i < item.chnNum; i++) {
|
for (let i = 0; i < item.chnNum; i++) {
|
||||||
tempChnResult.push(CheckData.ChnCheckResultEnum.SUCCESS)
|
tempChnResult.push(CheckData.ChnCheckResultEnum.SUCCESS)
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ const getCheckResult = (scriptType: string) => {
|
|||||||
tempChnResult[randomNum] = CheckData.ChnCheckResultEnum.FAIL
|
tempChnResult[randomNum] = CheckData.ChnCheckResultEnum.FAIL
|
||||||
errorCheckItem.push({scriptType, type: 'error'})
|
errorCheckItem.push({scriptType, type: 'error'})
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
return {
|
return {
|
||||||
deviceId: item.deviceId,
|
deviceId: item.deviceId,
|
||||||
@@ -840,7 +840,7 @@ const getCheckResult = (scriptType: string) => {
|
|||||||
chnResult: tempChnResult,
|
chnResult: tempChnResult,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
// }
|
||||||
|
|
||||||
let tempScriptChnItem: CheckData.ScriptChnItem = {
|
let tempScriptChnItem: CheckData.ScriptChnItem = {
|
||||||
scriptType,
|
scriptType,
|
||||||
|
|||||||
Reference in New Issue
Block a user