2024-11-19 19:34:00 +08:00
|
|
|
|
<template>
|
2024-12-18 20:26:18 +08:00
|
|
|
|
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close"
|
2025-04-18 13:42:48 +08:00
|
|
|
|
v-bind="dialogBig" :draggable="false" width="1400px">
|
2024-12-18 18:53:55 +08:00
|
|
|
|
<div class="data-check-dialog">
|
|
|
|
|
|
<div class="data-check-head">
|
|
|
|
|
|
<el-form :model='formContent' label-width="auto" class="form-three ">
|
|
|
|
|
|
<el-form-item label="检测脚本">
|
2024-12-25 13:22:54 +08:00
|
|
|
|
<el-input v-model='formContent.scriptName' :disabled="true"/>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="误差体系">
|
2025-04-22 15:52:03 +08:00
|
|
|
|
<el-select :disabled="checkStore.showDetailType===2 || checkStore.showDetailType===0" v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off"
|
2025-03-12 15:01:58 +08:00
|
|
|
|
@change="handleErrorSysChange">
|
2025-03-06 15:50:45 +08:00
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="(option) in pqErrorList"
|
|
|
|
|
|
:key="option.id"
|
|
|
|
|
|
:label="option.name"
|
|
|
|
|
|
:value="option.id"/>
|
|
|
|
|
|
</el-select>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="数据原则">
|
|
|
|
|
|
<el-input v-model='formContent.dataRule' :disabled="true"/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="设备名称">
|
|
|
|
|
|
<el-input v-model='formContent.deviceName' :disabled="true"/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label='通道号'>
|
2024-12-31 19:03:52 +08:00
|
|
|
|
<el-select v-model="formContent.chnNum">
|
2025-01-06 19:20:36 +08:00
|
|
|
|
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
2025-03-13 14:40:33 +08:00
|
|
|
|
<el-form-item v-if="checkStore.showDetailType===1">
|
|
|
|
|
|
<el-button type="primary" :icon="Postcard" @click="handleGenerateReport">报告生成</el-button>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item v-if="checkStore.showDetailType===0">
|
|
|
|
|
|
<el-button type="primary" :icon="Histogram" @click="handleReCalculate">重新计算</el-button>
|
2025-03-06 15:50:45 +08:00
|
|
|
|
</el-form-item>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="data-check-body">
|
|
|
|
|
|
<div class="content-left-tree">
|
2025-01-08 14:33:47 +08:00
|
|
|
|
<div style="width: 99%;">
|
2025-01-07 11:19:33 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
placeholder='请输入测试项名称'
|
|
|
|
|
|
clearable
|
|
|
|
|
|
v-model='searchValue'
|
|
|
|
|
|
></el-input>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="content-tree">
|
2025-01-07 11:19:33 +08:00
|
|
|
|
<el-tree :filter-node-method='filterNode' :highlight-current="true" :default-expanded-keys="defaultExpandedKeys"
|
|
|
|
|
|
node-key="index"
|
|
|
|
|
|
:data="treeDataAll"
|
|
|
|
|
|
:props="defaultProps"
|
|
|
|
|
|
@node-click="handleNodeClick" class="custom-tree" ref="treeRef">
|
2024-12-31 19:54:27 +08:00
|
|
|
|
<template #default="{ node, data }">
|
2025-04-24 16:16:04 +08:00
|
|
|
|
<el-tooltip effect="dark" :content="data.scriptTypeName" placement="right">
|
2025-01-09 15:49:32 +08:00
|
|
|
|
<span class="custom-tree-node" :style="data.fly===2? 'color: #F56C6C;':data.fly===4? 'color: #e6a23c;':''">{{
|
|
|
|
|
|
data.scriptTypeName
|
|
|
|
|
|
}}</span>
|
2025-01-07 14:54:44 +08:00
|
|
|
|
</el-tooltip>
|
2024-12-31 19:54:27 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-tree>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="content-right">
|
|
|
|
|
|
<div class="content-right-title">
|
2025-04-21 09:10:24 +08:00
|
|
|
|
<div style="width: 840px;">
|
2025-01-06 14:50:36 +08:00
|
|
|
|
<span class="content-right-title-text">当前检测项目:
|
2025-01-08 14:33:47 +08:00
|
|
|
|
<el-popover trigger="hover" :content="currentDesc" :width="popoverWidth" placement="right">
|
2025-01-06 14:50:36 +08:00
|
|
|
|
<template #reference>
|
2025-01-07 11:19:33 +08:00
|
|
|
|
<el-button type="text" style="font-size: 14px;">
|
2025-01-08 14:33:47 +08:00
|
|
|
|
{{ currentScriptTypeName }}
|
2025-01-06 14:50:36 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2025-04-21 09:10:24 +08:00
|
|
|
|
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 280px;" v-if="checkListLevel.length" label='测试项'>
|
|
|
|
|
|
<el-cascader
|
|
|
|
|
|
v-model="currentCheckItem"
|
|
|
|
|
|
:options="checkListLevel"
|
|
|
|
|
|
:props="{expandTrigger: 'click' as const}"
|
|
|
|
|
|
placement="bottom-end"
|
|
|
|
|
|
/>
|
2025-01-06 14:50:36 +08:00
|
|
|
|
</el-form-item>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="content-right-Tabs">
|
2024-12-25 18:04:16 +08:00
|
|
|
|
<el-tabs type="border-card" v-model="activeTab">
|
2024-12-18 18:53:55 +08:00
|
|
|
|
<el-tab-pane label="检测结果" name="resultTab">
|
2025-01-15 10:14:33 +08:00
|
|
|
|
<DataCheckResultTable :tableData="checkResultData" :currentScriptTypeName="currentScriptTypeName"/>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
<el-tab-pane label="原始数据" name="rawDataTab">
|
2025-01-22 14:03:50 +08:00
|
|
|
|
<DataCheckRawDataTable :tableData="rawTableData" :currentScriptTypeName="currentScriptTypeName" @exportRawDataHandler="exportRawDataHandler"/>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
</el-tabs>
|
|
|
|
|
|
</div>
|
2024-11-19 19:34:00 +08:00
|
|
|
|
</div>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-dialog>
|
2024-11-19 19:34:00 +08:00
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script setup lang='ts'>
|
2024-12-18 18:53:55 +08:00
|
|
|
|
import {dialogBig} from '@/utils/elementBind'
|
2025-01-09 15:49:32 +08:00
|
|
|
|
import {reactive, ref, watch} from 'vue'
|
2024-11-19 19:34:00 +08:00
|
|
|
|
import DataCheckResultTable from './dataCheckResultTable.vue'
|
|
|
|
|
|
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
2024-12-23 13:23:28 +08:00
|
|
|
|
import {CheckData} from "@/api/check/interface";
|
2024-12-30 14:41:34 +08:00
|
|
|
|
import {useDictStore} from "@/stores/modules/dict";
|
2024-12-30 20:55:11 +08:00
|
|
|
|
import {useCheckStore} from "@/stores/modules/check";
|
2025-03-13 14:40:33 +08:00
|
|
|
|
import {changeErrorSystem, deleteTempTable, exportRawData, getFormData, getTableData, getTreeData, reCalculate} from "@/api/check/test";
|
2025-04-25 14:32:17 +08:00
|
|
|
|
import {generateDevReport, getPqErrSysList} from '@/api/plan/plan'
|
2025-01-21 14:52:44 +08:00
|
|
|
|
import {useDownload} from "@/hooks/useDownload";
|
2025-03-13 14:40:33 +08:00
|
|
|
|
import {Histogram, Postcard} from "@element-plus/icons-vue";
|
2025-03-14 14:45:39 +08:00
|
|
|
|
import {ResultEnum} from "@/enums/httpEnum";
|
|
|
|
|
|
import {ElMessage} from "element-plus";
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
2024-12-20 10:19:58 +08:00
|
|
|
|
const {appendToBody} = withDefaults(defineProps<{
|
|
|
|
|
|
appendToBody: boolean
|
2025-01-02 18:00:58 +08:00
|
|
|
|
}>(), {appendToBody: true})
|
2024-12-18 20:26:18 +08:00
|
|
|
|
|
2024-12-25 18:04:16 +08:00
|
|
|
|
const defaultProps = {
|
2025-01-03 18:57:35 +08:00
|
|
|
|
label: "scriptTypeName",
|
2024-12-25 18:04:16 +08:00
|
|
|
|
children: "children",
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-12-30 14:41:34 +08:00
|
|
|
|
const dictStore = useDictStore()
|
2024-12-30 20:55:11 +08:00
|
|
|
|
const checkStore = useCheckStore()
|
2024-12-30 14:41:34 +08:00
|
|
|
|
|
2024-12-28 16:50:32 +08:00
|
|
|
|
const visible = ref(false)
|
2025-01-07 11:19:33 +08:00
|
|
|
|
const treeRef = ref()
|
|
|
|
|
|
const searchValue = ref<string>('')
|
2025-03-06 15:50:45 +08:00
|
|
|
|
const pqErrorList = reactive<{ id: string; name: string; }[]>([])
|
2025-01-07 11:19:33 +08:00
|
|
|
|
watch(searchValue, (val) => {
|
|
|
|
|
|
treeRef.value!.filter(val)
|
|
|
|
|
|
})
|
2024-12-28 16:50:32 +08:00
|
|
|
|
|
2025-01-06 08:51:14 +08:00
|
|
|
|
// 格式化数字
|
2025-01-06 19:20:36 +08:00
|
|
|
|
const fixed = 4;
|
2025-01-06 08:51:14 +08:00
|
|
|
|
|
2024-12-25 18:04:16 +08:00
|
|
|
|
// 表单数据
|
2024-12-23 13:23:28 +08:00
|
|
|
|
const formContent = reactive<CheckData.DataCheck>({
|
2024-12-25 13:22:54 +08:00
|
|
|
|
scriptName: '',
|
2025-03-06 15:50:45 +08:00
|
|
|
|
errorSysId: '',
|
2024-12-25 13:22:54 +08:00
|
|
|
|
dataRule: '',
|
|
|
|
|
|
deviceName: '',
|
2024-12-31 19:03:52 +08:00
|
|
|
|
chnNum: '',
|
2024-12-18 18:53:55 +08:00
|
|
|
|
})
|
2025-03-12 15:01:58 +08:00
|
|
|
|
// 原始误差体系id
|
|
|
|
|
|
let originErrorSysId: string = ''
|
|
|
|
|
|
let planCode: string = ''
|
2025-01-06 08:51:14 +08:00
|
|
|
|
// 谐波次数列表
|
2025-01-13 21:50:24 +08:00
|
|
|
|
// const harmNumList = reactive<{ value: string, label: string }[]>([])
|
2025-01-06 14:50:36 +08:00
|
|
|
|
// 当前选中的检测项
|
2025-04-21 09:10:24 +08:00
|
|
|
|
const currentCheckItem = ref<any>()
|
2025-01-06 14:50:36 +08:00
|
|
|
|
// 检测项列表
|
2025-04-21 09:10:24 +08:00
|
|
|
|
// const checkList = reactive<{ value: string, label: string }[]>([])
|
|
|
|
|
|
// 带有层级的检测项列表
|
|
|
|
|
|
const checkListLevel = reactive<{ value: string, label: string, children: { value: string, label: string }[] }[]>([])
|
2025-01-06 08:51:14 +08:00
|
|
|
|
|
2024-12-28 16:50:32 +08:00
|
|
|
|
let deviceId: string = ''
|
2025-01-15 10:49:28 +08:00
|
|
|
|
let originScriptType: string | null = null
|
2024-12-31 14:27:36 +08:00
|
|
|
|
let scriptType: string | null = null
|
2024-12-28 16:50:32 +08:00
|
|
|
|
|
2024-12-25 18:04:16 +08:00
|
|
|
|
// 通道下拉列表
|
2024-12-28 16:50:32 +08:00
|
|
|
|
let chnList: any[] = []
|
2024-12-25 18:04:16 +08:00
|
|
|
|
|
2025-01-04 16:33:23 +08:00
|
|
|
|
|
2024-12-31 19:03:52 +08:00
|
|
|
|
// 左侧树数据
|
2025-01-07 11:19:33 +08:00
|
|
|
|
const treeDataAll = reactive<CheckData.TreeItem[]>([])
|
2025-01-06 08:51:14 +08:00
|
|
|
|
|
2024-12-25 13:22:54 +08:00
|
|
|
|
// 左侧树被选中的叶子节点id
|
2025-01-03 18:57:35 +08:00
|
|
|
|
const checkIndex = ref<string>('')
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
2025-01-05 14:52:37 +08:00
|
|
|
|
// 当前检测项目名称
|
|
|
|
|
|
const currentScriptTypeName = ref('')
|
|
|
|
|
|
// 当前检测项目描述
|
2025-01-03 18:57:35 +08:00
|
|
|
|
const currentDesc = ref('');
|
2024-12-25 18:04:16 +08:00
|
|
|
|
// 右侧Tab选中项
|
|
|
|
|
|
const activeTab = ref<string>('resultTab')
|
2025-01-03 11:27:36 +08:00
|
|
|
|
|
2025-01-06 08:51:14 +08:00
|
|
|
|
//存放相应的表格数据
|
2025-04-21 09:10:24 +08:00
|
|
|
|
const resTableData = reactive<{ resultData: Map<string, any>, rawData: Map<string, any> }>({resultData: new Map(), rawData: new Map()})
|
2025-01-06 08:51:14 +08:00
|
|
|
|
|
2024-12-25 13:22:54 +08:00
|
|
|
|
// 检测结果表格数据
|
2025-01-06 08:51:14 +08:00
|
|
|
|
const checkResultData = reactive<CheckData.CheckResult[]>([])
|
|
|
|
|
|
|
2025-01-06 14:50:36 +08:00
|
|
|
|
const popoverWidth: ComputedRef<string> = computed(() => {
|
2025-04-22 14:12:07 +08:00
|
|
|
|
return `${1140 - (currentScriptTypeName.value.length + 7 + 3) * 14 - (checkListLevel.length ? 280 : 0)}px`
|
2025-01-06 14:50:36 +08:00
|
|
|
|
})
|
2025-01-06 08:51:14 +08:00
|
|
|
|
|
2025-01-22 14:03:50 +08:00
|
|
|
|
|
2024-12-25 13:22:54 +08:00
|
|
|
|
// 原始数据表格数据
|
2025-01-03 18:57:35 +08:00
|
|
|
|
const rawTableData = reactive<CheckData.RawDataItem[]>([])
|
2024-12-18 15:56:59 +08:00
|
|
|
|
|
2024-12-25 18:04:16 +08:00
|
|
|
|
// 左侧树默认展开节点id
|
2024-12-28 16:50:32 +08:00
|
|
|
|
let defaultExpandedKeys: string[] = []
|
2024-12-25 13:22:54 +08:00
|
|
|
|
|
2025-01-07 11:19:33 +08:00
|
|
|
|
const filterNode = (value: string, data: any) => {
|
|
|
|
|
|
if (!value) return true
|
|
|
|
|
|
return data.scriptTypeName.includes(value)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-25 13:22:54 +08:00
|
|
|
|
// 点击左侧树节点触发事件
|
2024-12-31 19:03:52 +08:00
|
|
|
|
const handleNodeClick = async (data: any) => {
|
2024-12-25 13:22:54 +08:00
|
|
|
|
if (!data.children) {
|
2025-01-03 18:57:35 +08:00
|
|
|
|
checkIndex.value = data.index
|
2025-01-05 14:52:37 +08:00
|
|
|
|
currentScriptTypeName.value = data.scriptTypeName
|
2025-01-03 18:57:35 +08:00
|
|
|
|
currentDesc.value = data.sourceDesc
|
2025-01-15 10:49:28 +08:00
|
|
|
|
scriptType = data.scriptType ?? scriptType
|
2024-12-31 19:03:52 +08:00
|
|
|
|
|
2025-02-27 14:45:22 +08:00
|
|
|
|
console.log("点击左侧树节点触发事件handleNodeClick", checkIndex.value)
|
2025-03-06 15:50:45 +08:00
|
|
|
|
if (checkIndex.value !== '') {
|
2024-12-31 19:03:52 +08:00
|
|
|
|
await updateTableData()
|
2025-01-22 14:03:50 +08:00
|
|
|
|
activeTab.value = 'resultTab'
|
2024-12-31 19:03:52 +08:00
|
|
|
|
}
|
2024-12-25 13:22:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2024-12-25 18:04:16 +08:00
|
|
|
|
|
2025-03-12 15:01:58 +08:00
|
|
|
|
const handleErrorSysChange = async () => {
|
|
|
|
|
|
console.log("切换误差体系", formContent.errorSysId);
|
2025-03-14 14:45:39 +08:00
|
|
|
|
changeErrorSystem({
|
2025-03-13 14:40:33 +08:00
|
|
|
|
planId: checkStore.plan.id,
|
|
|
|
|
|
scriptId: checkStore.plan.scriptId,
|
|
|
|
|
|
errorSysId: formContent.errorSysId,
|
|
|
|
|
|
deviceId: deviceId,
|
|
|
|
|
|
code: checkStore.plan.code + '',
|
2025-03-14 14:45:39 +08:00
|
|
|
|
}).then((res) => {
|
|
|
|
|
|
if (res.code === ResultEnum.SUCCESS) {
|
|
|
|
|
|
ElMessage.success('切换误差体系成功')
|
|
|
|
|
|
if (originErrorSysId != formContent.errorSysId) {
|
|
|
|
|
|
planCode = checkStore.plan.code + "_temp"
|
|
|
|
|
|
} else {
|
|
|
|
|
|
planCode = checkStore.plan.code + ''
|
|
|
|
|
|
}
|
|
|
|
|
|
if (formContent.chnNum != chnList[0].value) {
|
|
|
|
|
|
formContent.chnNum = chnList[0].value
|
|
|
|
|
|
} else {
|
|
|
|
|
|
handleChnNumChange()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-03-13 14:40:33 +08:00
|
|
|
|
})
|
2025-03-12 15:01:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-06 15:50:45 +08:00
|
|
|
|
|
2024-12-31 19:03:52 +08:00
|
|
|
|
watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
2025-01-21 14:52:44 +08:00
|
|
|
|
// console.log("通道号", newVal);
|
2025-03-06 15:50:45 +08:00
|
|
|
|
if (newVal != '') {
|
2025-03-12 15:01:58 +08:00
|
|
|
|
handleChnNumChange()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-01-03 18:57:35 +08:00
|
|
|
|
|
2025-03-12 15:01:58 +08:00
|
|
|
|
const handleChnNumChange = async () => {
|
|
|
|
|
|
console.log("通道号", formContent.chnNum);
|
|
|
|
|
|
// 发起请求,查询该测试项的检测结果
|
|
|
|
|
|
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
|
|
|
|
|
|
scriptId: checkStore.plan.scriptId,
|
|
|
|
|
|
devId: deviceId,
|
|
|
|
|
|
devNum: formContent.chnNum + '',
|
|
|
|
|
|
scriptType: originScriptType,
|
|
|
|
|
|
code: planCode
|
|
|
|
|
|
})
|
|
|
|
|
|
updateTreeFly(resTreeDataTemp, 4)
|
|
|
|
|
|
updateTreeFly(resTreeDataTemp, 2)
|
2025-01-15 10:49:28 +08:00
|
|
|
|
|
2025-03-12 15:01:58 +08:00
|
|
|
|
treeDataAll.length = 0
|
2025-01-03 11:27:36 +08:00
|
|
|
|
|
2025-03-12 15:01:58 +08:00
|
|
|
|
Object.assign(treeDataAll, resTreeDataTemp)
|
|
|
|
|
|
|
|
|
|
|
|
defaultOperate()
|
|
|
|
|
|
await updateTableData()
|
2025-01-10 14:15:07 +08:00
|
|
|
|
activeTab.value = 'resultTab'
|
2025-03-12 15:01:58 +08:00
|
|
|
|
}
|
2025-01-03 11:27:36 +08:00
|
|
|
|
|
2025-03-06 15:50:45 +08:00
|
|
|
|
|
2025-01-06 14:50:36 +08:00
|
|
|
|
watch(currentCheckItem, (newVal, oldVal) => {
|
2025-03-06 15:50:45 +08:00
|
|
|
|
if (newVal !== '') {
|
2025-04-21 09:10:24 +08:00
|
|
|
|
let key = newVal[0]
|
|
|
|
|
|
if (newVal.length == 2) {
|
|
|
|
|
|
key += "_" + newVal[1]
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log("当前检测项", key);
|
|
|
|
|
|
doCurrentCheckItemUpdate(key)
|
2025-01-22 14:03:50 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
activeTab.value = 'resultTab'
|
2025-01-06 14:50:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2024-12-31 19:03:52 +08:00
|
|
|
|
// 默认操作
|
|
|
|
|
|
const defaultOperate = () => {
|
2025-01-07 11:19:33 +08:00
|
|
|
|
let node = getDefaultNode(treeDataAll)
|
|
|
|
|
|
|
2025-01-02 20:27:36 +08:00
|
|
|
|
if (node) {
|
2025-01-05 14:52:37 +08:00
|
|
|
|
currentScriptTypeName.value = node.scriptTypeName
|
2025-01-03 18:57:35 +08:00
|
|
|
|
currentDesc.value = node.sourceDesc
|
|
|
|
|
|
checkIndex.value = node.index
|
|
|
|
|
|
defaultExpandedKeys = [node.index]
|
2025-01-08 09:46:47 +08:00
|
|
|
|
|
|
|
|
|
|
treeRef.value?.setCurrentKey(node.index);
|
2025-01-13 15:03:24 +08:00
|
|
|
|
scriptType = node.scriptType ?? scriptType
|
2025-01-02 20:27:36 +08:00
|
|
|
|
} else {
|
2025-01-05 14:52:37 +08:00
|
|
|
|
currentScriptTypeName.value = ''
|
2025-01-03 18:57:35 +08:00
|
|
|
|
currentDesc.value = ''
|
|
|
|
|
|
checkIndex.value = ''
|
2025-01-02 20:27:36 +08:00
|
|
|
|
defaultExpandedKeys = []
|
|
|
|
|
|
}
|
2024-12-31 19:03:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const updateTableData = async () => {
|
2025-02-27 14:45:22 +08:00
|
|
|
|
console.log("左侧树被选中的叶子节点checkIndex", checkIndex.value);
|
|
|
|
|
|
if (checkIndex.value !== '') {
|
2025-04-21 09:10:24 +08:00
|
|
|
|
|
|
|
|
|
|
checkListLevel.length = 0
|
|
|
|
|
|
checkResultData.length = 0
|
|
|
|
|
|
rawTableData.length = 0
|
|
|
|
|
|
currentCheckItem.value = ''
|
|
|
|
|
|
|
2025-01-21 14:52:44 +08:00
|
|
|
|
// console.log("更新表格数据");
|
2025-01-03 11:27:36 +08:00
|
|
|
|
// 发起请求,查询该测试项的检测结果
|
2025-01-06 19:20:36 +08:00
|
|
|
|
const {data} = await getTableData({
|
|
|
|
|
|
scriptType,
|
2025-02-25 10:17:33 +08:00
|
|
|
|
scriptId: checkStore.plan.scriptId,
|
2025-01-06 19:20:36 +08:00
|
|
|
|
devId: deviceId,
|
|
|
|
|
|
devNum: formContent.chnNum + '',
|
2025-03-12 15:01:58 +08:00
|
|
|
|
code: planCode,
|
2025-01-06 19:20:36 +08:00
|
|
|
|
index: parseInt(checkIndex.value),
|
2025-01-06 14:50:36 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2025-01-06 19:20:36 +08:00
|
|
|
|
let keys1 = Object.keys(data.resultData)
|
|
|
|
|
|
let resultData = new Map()
|
|
|
|
|
|
for (let key of keys1) {
|
2025-04-21 09:10:24 +08:00
|
|
|
|
let children = []
|
2025-04-22 14:12:07 +08:00
|
|
|
|
let label = key
|
2025-04-21 09:10:24 +08:00
|
|
|
|
if ((key.includes('谐波') || key.includes('简谐波')) && key !== '谐波有功功率') {
|
|
|
|
|
|
for (let item of data.resultData[key]) {
|
|
|
|
|
|
let num = formatHarmNum(item.harmNum + '')
|
2025-04-22 14:12:07 +08:00
|
|
|
|
label = item.isData === 1 ? `${num}` : item.isData === 4 ? `${num}(/)` : item.isData === 5 ? `${num}(-)` : `${num}(不符合)`
|
2025-04-21 09:10:24 +08:00
|
|
|
|
children.push({label: label, value: num})
|
|
|
|
|
|
resultData.set(key + "_" + num, item)
|
|
|
|
|
|
}
|
|
|
|
|
|
checkListLevel.push({label: key, value: key, children: children})
|
|
|
|
|
|
} else {
|
2025-04-22 14:12:07 +08:00
|
|
|
|
label = data.resultData[key][0].isData === 1 ? `${key}` : data.resultData[key][0].isData === 4 ? `${key}(/)` : data.resultData[key][0].isData === 5 ? `${key}(-)` : `${key}(不符合)`
|
2025-04-21 09:10:24 +08:00
|
|
|
|
resultData.set(key, data.resultData[key][0])
|
|
|
|
|
|
checkListLevel.push({label: label, value: key, children: []})
|
|
|
|
|
|
}
|
2025-01-06 19:20:36 +08:00
|
|
|
|
}
|
2025-01-05 14:52:37 +08:00
|
|
|
|
|
2025-04-21 09:10:24 +08:00
|
|
|
|
|
2025-01-06 19:20:36 +08:00
|
|
|
|
let keys2 = Object.keys(data.rawData)
|
2025-01-06 08:51:14 +08:00
|
|
|
|
let rawData = new Map()
|
2025-01-06 19:20:36 +08:00
|
|
|
|
for (let key of keys2) {
|
2025-04-21 09:10:24 +08:00
|
|
|
|
if ((key.includes('谐波') || key.includes('简谐波')) && key !== '谐波有功功率') {
|
|
|
|
|
|
for (let item of data.rawData[key]) {
|
|
|
|
|
|
let num = formatHarmNum(item.harmNum + '')
|
|
|
|
|
|
let value = rawData.get(key + "_" + num)
|
|
|
|
|
|
if (!value) {
|
|
|
|
|
|
rawData.set(key + "_" + num, [item])
|
|
|
|
|
|
} else {
|
|
|
|
|
|
value.push(item)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
rawData.set(key, data.rawData[key])
|
|
|
|
|
|
}
|
2025-01-06 08:51:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-21 09:10:24 +08:00
|
|
|
|
resTableData.resultData = resultData
|
|
|
|
|
|
resTableData.rawData = rawData
|
2025-01-14 15:34:35 +08:00
|
|
|
|
|
2025-04-21 09:10:24 +08:00
|
|
|
|
toAngleLast()
|
2025-01-16 10:00:49 +08:00
|
|
|
|
|
2025-04-21 09:10:24 +08:00
|
|
|
|
if (checkListLevel.length !== 0) {
|
|
|
|
|
|
if (checkListLevel[0].children.length !== 0) {
|
|
|
|
|
|
currentCheckItem.value = [checkListLevel[0].value + '', checkListLevel[0].children[0].value + '']
|
2025-01-14 16:16:30 +08:00
|
|
|
|
} else {
|
2025-04-21 09:10:24 +08:00
|
|
|
|
currentCheckItem.value = [checkListLevel[0].value + '']
|
2025-01-14 16:16:30 +08:00
|
|
|
|
}
|
2025-01-06 08:51:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-21 09:10:24 +08:00
|
|
|
|
|
|
|
|
|
|
} else {
|
2025-01-06 19:20:36 +08:00
|
|
|
|
checkResultData.length = 0
|
|
|
|
|
|
rawTableData.length = 0
|
2025-01-03 11:27:36 +08:00
|
|
|
|
}
|
2024-12-31 19:03:52 +08:00
|
|
|
|
}
|
2024-11-19 19:34:00 +08:00
|
|
|
|
|
2025-01-20 15:24:29 +08:00
|
|
|
|
const doCurrentCheckItemUpdate = (newVal: string) => {
|
2025-01-14 16:16:30 +08:00
|
|
|
|
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal)
|
|
|
|
|
|
setCheckResultData(resCheckResult)
|
|
|
|
|
|
|
|
|
|
|
|
let tempRawData = resTableData.rawData.get(newVal)
|
|
|
|
|
|
if (tempRawData) {
|
|
|
|
|
|
setRawData(tempRawData)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
setRawData([])
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
activeTab.value = 'resultTab'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-02 18:00:58 +08:00
|
|
|
|
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
|
2025-03-12 15:01:58 +08:00
|
|
|
|
planCode = checkStore.plan.code + ''
|
2024-12-28 16:50:32 +08:00
|
|
|
|
deviceId = _deviceId
|
2025-01-15 10:49:28 +08:00
|
|
|
|
originScriptType = _scriptType
|
2024-12-31 14:27:36 +08:00
|
|
|
|
scriptType = _scriptType
|
2024-12-31 19:03:52 +08:00
|
|
|
|
|
2024-12-28 16:50:32 +08:00
|
|
|
|
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
2025-01-03 11:27:36 +08:00
|
|
|
|
const {data: resFormContent}: { data: any } = await getFormData({
|
2025-02-25 10:17:33 +08:00
|
|
|
|
planId: checkStore.plan.id,
|
2025-01-03 11:27:36 +08:00
|
|
|
|
deviceId,
|
|
|
|
|
|
chnNum,
|
|
|
|
|
|
scriptType
|
|
|
|
|
|
})
|
2024-12-18 15:56:59 +08:00
|
|
|
|
|
2025-01-03 11:27:36 +08:00
|
|
|
|
chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
|
2024-12-30 14:41:34 +08:00
|
|
|
|
value: item.value,
|
2025-02-14 10:59:21 +08:00
|
|
|
|
label: item.value
|
|
|
|
|
|
//label: item.label == '1' ? `${item.value}` : item.label == '2' ? `${item.value}(不符合)` : `${item.value}`
|
2024-12-30 14:41:34 +08:00
|
|
|
|
}))
|
|
|
|
|
|
|
2024-12-31 14:27:36 +08:00
|
|
|
|
let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
|
2024-12-30 14:41:34 +08:00
|
|
|
|
|
2025-01-02 18:00:58 +08:00
|
|
|
|
Object.assign(formContent, {
|
|
|
|
|
|
...resFormContent,
|
|
|
|
|
|
dataRule: dataRuleName,
|
2025-01-03 11:27:36 +08:00
|
|
|
|
chnNum: chnList.length > 0 ? chnList[0].value : '',
|
2025-01-02 18:00:58 +08:00
|
|
|
|
})
|
2025-03-12 15:01:58 +08:00
|
|
|
|
originErrorSysId = formContent.errorSysId
|
2024-12-31 19:03:52 +08:00
|
|
|
|
|
2025-03-06 15:50:45 +08:00
|
|
|
|
pqErrorList.length = 0
|
|
|
|
|
|
let {data: resPqErrorList} = await getPqErrSysList()
|
|
|
|
|
|
Object.assign(pqErrorList, resPqErrorList)
|
2024-11-19 19:34:00 +08:00
|
|
|
|
|
2024-12-18 15:56:59 +08:00
|
|
|
|
visible.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-25 14:32:17 +08:00
|
|
|
|
const handleGenerateReport = async () => {
|
|
|
|
|
|
await generateDevReport({'planId': checkStore.plan.id, 'devIdList': [deviceId],'scriptId':checkStore.plan.scriptId,'planCode':planCode})
|
|
|
|
|
|
ElMessage.success({message: `报告生成成功!`})
|
2025-03-06 15:50:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-13 14:40:33 +08:00
|
|
|
|
const handleReCalculate = async () => {
|
2025-03-14 14:45:39 +08:00
|
|
|
|
reCalculate({
|
2025-03-13 14:40:33 +08:00
|
|
|
|
planId: checkStore.plan.id,
|
|
|
|
|
|
scriptId: checkStore.plan.scriptId,
|
|
|
|
|
|
errorSysId: formContent.errorSysId,
|
|
|
|
|
|
deviceId: deviceId,
|
|
|
|
|
|
code: checkStore.plan.code + ''
|
2025-03-14 14:45:39 +08:00
|
|
|
|
}).then((res) => {
|
|
|
|
|
|
ElMessage.success('重新计算成功!')
|
|
|
|
|
|
// if (originErrorSysId != formContent.errorSysId) {
|
|
|
|
|
|
// planCode = checkStore.plan.code + "_temp"
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// planCode = checkStore.plan.code + ''
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (formContent.chnNum != chnList[0].value) {
|
|
|
|
|
|
formContent.chnNum = chnList[0].value
|
|
|
|
|
|
} else {
|
|
|
|
|
|
handleChnNumChange()
|
|
|
|
|
|
}
|
2025-03-13 14:40:33 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-12 15:01:58 +08:00
|
|
|
|
const close = async () => {
|
2024-12-28 16:50:32 +08:00
|
|
|
|
//数据清空
|
|
|
|
|
|
Object.assign(formContent, {
|
|
|
|
|
|
scriptName: '',
|
|
|
|
|
|
errorSysName: '',
|
|
|
|
|
|
dataRule: '',
|
|
|
|
|
|
deviceName: '',
|
2024-12-31 19:03:52 +08:00
|
|
|
|
chnNum: '',
|
2024-12-28 16:50:32 +08:00
|
|
|
|
})
|
2025-01-06 19:20:36 +08:00
|
|
|
|
treeDataAll.length = 0
|
2025-01-13 21:50:24 +08:00
|
|
|
|
// harmNumList.length = 0
|
|
|
|
|
|
// currentHarmNum.value = '-1'
|
2025-01-08 14:33:47 +08:00
|
|
|
|
currentCheckItem.value = ''
|
2025-01-06 19:20:36 +08:00
|
|
|
|
checkResultData.length = 0
|
|
|
|
|
|
rawTableData.length = 0
|
2025-04-21 09:10:24 +08:00
|
|
|
|
//checkList.length = 0
|
2025-01-04 16:33:23 +08:00
|
|
|
|
defaultExpandedKeys = []
|
2025-01-03 18:57:35 +08:00
|
|
|
|
checkIndex.value = ''
|
|
|
|
|
|
activeTab.value = 'resultTab'
|
2025-01-05 14:52:37 +08:00
|
|
|
|
currentScriptTypeName.value = ''
|
2025-01-03 18:57:35 +08:00
|
|
|
|
currentDesc.value = ''
|
2025-03-06 15:50:45 +08:00
|
|
|
|
pqErrorList.length = 0
|
2025-03-12 15:01:58 +08:00
|
|
|
|
planCode = ''
|
2024-12-28 16:50:32 +08:00
|
|
|
|
|
|
|
|
|
|
visible.value = false;
|
2025-03-12 15:01:58 +08:00
|
|
|
|
|
|
|
|
|
|
if (checkStore.showDetailType === 1) {
|
|
|
|
|
|
await deleteTempTable(checkStore.plan.code + '')
|
|
|
|
|
|
}
|
2024-12-28 16:50:32 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-01-20 15:24:29 +08:00
|
|
|
|
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
|
2025-01-06 08:51:14 +08:00
|
|
|
|
let result: CheckData.CheckResult[] = []
|
2025-01-14 15:34:35 +08:00
|
|
|
|
if (data == null || data == undefined) {
|
|
|
|
|
|
Object.assign(checkResultData, [])
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-01-08 14:33:47 +08:00
|
|
|
|
if (data.dataA != null && data.dataB != null && data.dataC != null) {
|
2025-01-06 14:50:36 +08:00
|
|
|
|
result.push({
|
2025-04-22 13:49:59 +08:00
|
|
|
|
// stdA: numberToFixed(data.dataA.resultData),
|
|
|
|
|
|
// dataA: numberToFixed(data.dataA.data),
|
2025-04-22 14:12:07 +08:00
|
|
|
|
stdA: dataToShow(data.dataA.resultData),
|
|
|
|
|
|
dataA: dataToShow(data.dataA.data),
|
2025-04-10 10:50:53 +08:00
|
|
|
|
errorA: data.dataA.errorData == null ? '/' : data.dataA.errorData + '',
|
2025-03-31 13:22:57 +08:00
|
|
|
|
maxErrorA: toMaxErrorStr(data.dataA.radius, data.dataA.unit),
|
|
|
|
|
|
unitA: data.dataA.unit,
|
2025-01-08 14:33:47 +08:00
|
|
|
|
isDataA: data.dataA.isData,
|
2025-04-22 13:49:59 +08:00
|
|
|
|
// stdB: numberToFixed(data.dataB.resultData),
|
|
|
|
|
|
// dataB: numberToFixed(data.dataB.data),
|
2025-04-22 14:12:07 +08:00
|
|
|
|
stdB: dataToShow(data.dataB.resultData),
|
|
|
|
|
|
dataB: dataToShow(data.dataB.data),
|
2025-04-10 10:50:53 +08:00
|
|
|
|
errorB: data.dataB.errorData == null ? '/' : data.dataB.errorData + '',
|
2025-03-31 13:22:57 +08:00
|
|
|
|
maxErrorB: toMaxErrorStr(data.dataB.radius, data.dataB.unit),
|
2025-01-08 14:33:47 +08:00
|
|
|
|
isDataB: data.dataB.isData,
|
2025-03-31 13:22:57 +08:00
|
|
|
|
unitB: data.dataB.unit,
|
2025-04-22 13:49:59 +08:00
|
|
|
|
// stdC: numberToFixed(data.dataC.resultData),
|
|
|
|
|
|
// dataC: numberToFixed(data.dataC.data),
|
2025-04-22 14:12:07 +08:00
|
|
|
|
stdC: dataToShow(data.dataC.resultData),
|
|
|
|
|
|
dataC: dataToShow(data.dataC.data),
|
2025-04-10 10:50:53 +08:00
|
|
|
|
errorC: data.dataC.errorData == null ? '/' : data.dataC.errorData + '',
|
2025-03-31 13:22:57 +08:00
|
|
|
|
maxErrorC: toMaxErrorStr(data.dataC.radius, data.dataC.unit),
|
2025-01-08 14:33:47 +08:00
|
|
|
|
isDataC: data.dataC.isData,
|
2025-03-31 13:22:57 +08:00
|
|
|
|
unitC: data.dataC.unit,
|
2025-01-06 14:50:36 +08:00
|
|
|
|
|
|
|
|
|
|
maxError: data.radius,
|
2025-01-06 19:20:36 +08:00
|
|
|
|
unit: data.unit,
|
2025-01-06 14:50:36 +08:00
|
|
|
|
result: data.isData,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-09 20:06:08 +08:00
|
|
|
|
if (data.dataT != null && data.dataA == null && data.dataB == null && data.dataC == null) {
|
2025-01-06 14:50:36 +08:00
|
|
|
|
result.push({
|
2025-04-22 13:49:59 +08:00
|
|
|
|
// stdT: numberToFixed(data.dataT.resultData),
|
|
|
|
|
|
// dataT: numberToFixed(data.dataT.data),
|
2025-04-22 14:12:07 +08:00
|
|
|
|
stdT: dataToShow(data.dataT.resultData),
|
|
|
|
|
|
dataT: dataToShow(data.dataT.data),
|
2025-04-10 10:50:53 +08:00
|
|
|
|
errorT: data.dataT.errorData == null ? '/' : data.dataT.errorData + '',
|
2025-03-31 13:22:57 +08:00
|
|
|
|
maxErrorT: toMaxErrorStr(data.dataT.radius, data.dataT.unit),
|
2025-01-07 11:19:33 +08:00
|
|
|
|
isDataT: data.dataT?.isData,
|
2025-03-31 13:22:57 +08:00
|
|
|
|
unitT: data.dataT.unit,
|
2025-01-08 14:33:47 +08:00
|
|
|
|
|
2025-01-06 14:50:36 +08:00
|
|
|
|
maxError: data.radius,
|
2025-01-06 19:20:36 +08:00
|
|
|
|
unit: data.unit,
|
2025-01-06 14:50:36 +08:00
|
|
|
|
result: data.isData,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-01-06 08:51:14 +08:00
|
|
|
|
Object.assign(checkResultData, result)
|
2025-04-09 20:06:08 +08:00
|
|
|
|
console.log("检测结果", checkResultData);
|
2025-01-06 08:51:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-21 14:52:44 +08:00
|
|
|
|
const exportRawDataHandler = () => {
|
2025-04-22 15:52:03 +08:00
|
|
|
|
useDownload(exportRawData, '原始数据', {
|
2025-01-21 14:52:44 +08:00
|
|
|
|
scriptType,
|
2025-02-25 10:17:33 +08:00
|
|
|
|
scriptId: checkStore.plan.scriptId,
|
2025-01-21 14:52:44 +08:00
|
|
|
|
devId: deviceId,
|
|
|
|
|
|
devNum: formContent.chnNum + '',
|
2025-03-12 15:01:58 +08:00
|
|
|
|
code: checkStore.plan.code + '',
|
2025-01-21 14:52:44 +08:00
|
|
|
|
index: parseInt(checkIndex.value),
|
|
|
|
|
|
}, false, '.xlsx')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-13 13:57:24 +08:00
|
|
|
|
const formatHarmNum = (num: string) => {
|
2025-01-21 14:52:44 +08:00
|
|
|
|
// debugger
|
2025-01-13 15:03:24 +08:00
|
|
|
|
if (num.includes('.5')) {
|
2025-01-13 13:57:24 +08:00
|
|
|
|
return num
|
2025-01-13 15:03:24 +08:00
|
|
|
|
} else {
|
2025-01-13 21:50:24 +08:00
|
|
|
|
num = num.replace('.0', '')
|
|
|
|
|
|
return num
|
2025-01-13 13:57:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-06 19:20:36 +08:00
|
|
|
|
const setRawData = (data: CheckData.RawDataItem[]) => {
|
2025-01-07 09:01:10 +08:00
|
|
|
|
data.forEach((item: CheckData.RawDataItem) => {
|
2025-04-22 14:12:07 +08:00
|
|
|
|
// item.dataA = stringToFixed(item.dataA)
|
|
|
|
|
|
// item.dataB = stringToFixed(item.dataB)
|
|
|
|
|
|
// item.dataC = stringToFixed(item.dataC)
|
|
|
|
|
|
// item.dataT = stringToFixed(item.dataT)
|
|
|
|
|
|
item.dataA = dataToShow(item.dataA)
|
|
|
|
|
|
item.dataB = dataToShow(item.dataB)
|
|
|
|
|
|
item.dataC = dataToShow(item.dataC)
|
|
|
|
|
|
item.dataT = dataToShow(item.dataT)
|
2025-01-07 09:01:10 +08:00
|
|
|
|
})
|
2025-03-05 10:42:25 +08:00
|
|
|
|
rawTableData.length = 0
|
2025-01-06 19:20:36 +08:00
|
|
|
|
Object.assign(rawTableData, data)
|
2025-01-13 22:05:46 +08:00
|
|
|
|
console.log("原始数据", rawTableData)
|
2025-01-06 19:20:36 +08:00
|
|
|
|
}
|
2025-04-22 14:12:07 +08:00
|
|
|
|
const dataToShow = (num: number): string => {
|
|
|
|
|
|
if (num == null || num == undefined) {
|
|
|
|
|
|
return '/'
|
|
|
|
|
|
}
|
|
|
|
|
|
return num+''
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-06 19:20:36 +08:00
|
|
|
|
|
2025-01-07 11:19:33 +08:00
|
|
|
|
const numberToFixed = (num: number): string => {
|
|
|
|
|
|
if (num == null || num == undefined) {
|
2025-01-08 14:33:47 +08:00
|
|
|
|
return '/'
|
2025-01-07 11:19:33 +08:00
|
|
|
|
} else {
|
2025-01-13 21:50:24 +08:00
|
|
|
|
let result = num.toFixed(fixed)
|
|
|
|
|
|
if (result === "-0.0000") {
|
|
|
|
|
|
return result.replace(/-/g, "")
|
|
|
|
|
|
}
|
|
|
|
|
|
return result
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const stringToFixed = (str: string): string => {
|
|
|
|
|
|
if (str == null || str == undefined) {
|
|
|
|
|
|
return '/'
|
|
|
|
|
|
} else {
|
2025-01-13 22:05:46 +08:00
|
|
|
|
let num = Number(str)
|
|
|
|
|
|
if (isNaN(num)) {
|
|
|
|
|
|
return '/'
|
2025-01-20 15:24:29 +08:00
|
|
|
|
} else {
|
2025-01-13 22:05:46 +08:00
|
|
|
|
let result = num.toFixed(fixed)
|
|
|
|
|
|
if (result === "-0.0000") {
|
|
|
|
|
|
return result.replace(/-/g, "")
|
|
|
|
|
|
}
|
|
|
|
|
|
return result
|
2025-01-13 21:50:24 +08:00
|
|
|
|
}
|
2025-01-07 11:19:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-06 14:50:36 +08:00
|
|
|
|
const getError = (num1: number, num2: number): string => {
|
2025-01-06 19:20:36 +08:00
|
|
|
|
if (num1 == null || num1 == undefined || num2 == null || num2 == undefined) {
|
2025-01-08 14:33:47 +08:00
|
|
|
|
return '/'
|
2025-01-06 19:20:36 +08:00
|
|
|
|
}
|
2025-01-07 11:19:33 +08:00
|
|
|
|
return Math.abs(Number(numberToFixed(num1)) - Number(numberToFixed(num2))).toFixed(fixed)
|
2025-01-06 14:50:36 +08:00
|
|
|
|
}
|
2025-01-06 19:20:36 +08:00
|
|
|
|
|
2025-01-10 13:49:09 +08:00
|
|
|
|
const toMaxErrorStr = (oldMaxErroe: any, unit: any) => {
|
|
|
|
|
|
let result = oldMaxErroe ?? '/'
|
|
|
|
|
|
let idx = result.indexOf('~');
|
|
|
|
|
|
if (idx > 0) {
|
2025-01-20 15:24:29 +08:00
|
|
|
|
let left = result.substring(0, idx)
|
|
|
|
|
|
let right = result.substring(idx, result.length)
|
|
|
|
|
|
result = left + unit + right + unit;
|
2025-01-10 13:49:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-28 16:50:32 +08:00
|
|
|
|
const findFirstLeafNode = (node: any): any => {
|
2024-12-25 18:04:16 +08:00
|
|
|
|
if (!node.children || node.children.length === 0) {
|
2024-12-28 16:50:32 +08:00
|
|
|
|
return node;
|
2024-12-25 18:04:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return findFirstLeafNode(node.children[0]);
|
|
|
|
|
|
}
|
2024-12-28 16:50:32 +08:00
|
|
|
|
const getDefaultNode = (data: any[]) => {
|
2024-12-25 18:04:16 +08:00
|
|
|
|
if (!data || data.length === 0) {
|
|
|
|
|
|
return null;
|
2024-12-25 13:22:54 +08:00
|
|
|
|
}
|
2024-12-25 18:04:16 +08:00
|
|
|
|
|
|
|
|
|
|
const firstElement = data[0];
|
|
|
|
|
|
|
|
|
|
|
|
return findFirstLeafNode(firstElement);
|
2024-12-25 13:22:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-21 09:10:24 +08:00
|
|
|
|
const toAngleLast = () => {
|
2025-01-16 10:00:49 +08:00
|
|
|
|
let angleIndex = -1
|
2025-04-21 09:10:24 +08:00
|
|
|
|
for (let i = 0; i < checkListLevel.length; i++) {
|
|
|
|
|
|
if (checkListLevel[i].value.toString().includes('相角')) {
|
2025-01-16 10:00:49 +08:00
|
|
|
|
angleIndex = i
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (angleIndex != -1) {
|
2025-04-21 09:10:24 +08:00
|
|
|
|
let temp = checkListLevel[angleIndex]
|
|
|
|
|
|
checkListLevel.splice(angleIndex, 1)
|
|
|
|
|
|
checkListLevel.push(temp)
|
2025-01-16 10:00:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-02 20:27:36 +08:00
|
|
|
|
// fly: 1合格 2不合格 4数据错误
|
|
|
|
|
|
const filterTree = (treeData: any[], fly: number): any[] => {
|
|
|
|
|
|
if (!treeData || treeData.length === 0) {
|
|
|
|
|
|
return []
|
|
|
|
|
|
}
|
|
|
|
|
|
filter(treeData, fly)
|
|
|
|
|
|
return treeData
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const filter = (treeData: any[], fly: number) => {
|
2025-01-04 14:09:01 +08:00
|
|
|
|
for (let i = treeData.length - 1; i >= 0; i--) {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
let node = treeData[i]
|
2025-01-04 14:09:01 +08:00
|
|
|
|
if (node.fly !== fly) {
|
2025-01-02 20:27:36 +08:00
|
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
|
|
|
filter(node.children, fly)
|
2025-01-03 18:57:35 +08:00
|
|
|
|
// 检查 children 是否被全部移除
|
|
|
|
|
|
if (node.children.length === 0) {
|
|
|
|
|
|
treeData.splice(i, 1);
|
|
|
|
|
|
}
|
2025-01-02 20:27:36 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
treeData.splice(i, 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-07 11:19:33 +08:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-18 15:56:59 +08:00
|
|
|
|
defineExpose({
|
|
|
|
|
|
open
|
|
|
|
|
|
})
|
2024-11-19 19:34:00 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
<style lang="scss" scoped>
|
2024-12-18 20:26:18 +08:00
|
|
|
|
.dialog {
|
2024-12-18 18:53:55 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
overflow-y: hidden;
|
|
|
|
|
|
overflow-x: hidden;
|
2024-12-23 13:23:28 +08:00
|
|
|
|
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
2024-12-18 20:26:18 +08:00
|
|
|
|
.data-check-dialog {
|
2024-11-19 19:34:00 +08:00
|
|
|
|
display: flex;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
flex-direction: column;
|
2025-01-04 16:33:23 +08:00
|
|
|
|
overflow-y: hidden;
|
2024-11-19 19:34:00 +08:00
|
|
|
|
|
2024-12-18 20:26:18 +08:00
|
|
|
|
.data-check-head {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
|
width: 100%;
|
2024-12-18 18:53:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-18 20:26:18 +08:00
|
|
|
|
.data-check-body {
|
2025-01-04 16:33:23 +08:00
|
|
|
|
height: 500px;
|
2024-12-23 13:23:28 +08:00
|
|
|
|
width: 100%;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
|
|
|
|
|
|
|
.content-left-tree {
|
2025-01-07 11:19:33 +08:00
|
|
|
|
width: 18%;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
2025-01-13 13:57:24 +08:00
|
|
|
|
max-height: 495px;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
|
2025-01-08 14:33:47 +08:00
|
|
|
|
padding: 10px 0.5% 0px 0.5%;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
border: 1px solid #ccc;
|
2024-12-31 19:54:27 +08:00
|
|
|
|
overflow-y: auto;
|
2025-01-08 14:33:47 +08:00
|
|
|
|
overflow-x: auto;
|
2024-12-24 19:21:43 +08:00
|
|
|
|
|
2024-12-18 20:26:18 +08:00
|
|
|
|
.content-tree {
|
2024-12-31 19:54:27 +08:00
|
|
|
|
width: 100%;
|
2024-12-23 13:23:28 +08:00
|
|
|
|
height: 100%;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
margin-top: 10px;
|
2024-12-31 19:54:27 +08:00
|
|
|
|
|
|
|
|
|
|
.custom-tree-node {
|
2025-01-07 14:54:44 +08:00
|
|
|
|
overflow-x: hidden !important;
|
|
|
|
|
|
white-space: nowrap !important;
|
|
|
|
|
|
text-overflow: ellipsis !important;
|
2024-12-31 19:54:27 +08:00
|
|
|
|
}
|
2024-12-18 18:53:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-18 20:26:18 +08:00
|
|
|
|
.content-right {
|
2025-01-07 11:19:33 +08:00
|
|
|
|
width: 82%;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
margin-left: 10px;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
|
|
.content-right-title {
|
2025-01-06 14:50:36 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
padding: 10px 0;
|
2025-01-05 14:52:37 +08:00
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
line-height: 1.5;
|
2025-01-04 16:33:23 +08:00
|
|
|
|
|
2025-01-05 14:52:37 +08:00
|
|
|
|
.content-right-title-text {
|
2025-01-07 11:19:33 +08:00
|
|
|
|
font-size: 14px;
|
2025-01-05 14:52:37 +08:00
|
|
|
|
font-weight: bold;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-18 18:53:55 +08:00
|
|
|
|
|
2025-01-05 14:52:37 +08:00
|
|
|
|
//.el-divider--horizontal {
|
|
|
|
|
|
// //margin-top: 0px;
|
|
|
|
|
|
// margin-bottom: 5px;
|
|
|
|
|
|
// height: 20px;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//.content-right-title-desc {
|
|
|
|
|
|
// font-size: 16px;
|
|
|
|
|
|
// height: 48px;
|
|
|
|
|
|
// max-height: 48px;
|
|
|
|
|
|
// overflow-y: auto;
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.content-right-Tabs {
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
max-height: 400px;
|
2024-12-18 20:26:18 +08:00
|
|
|
|
}
|
2024-12-18 18:53:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-19 19:34:00 +08:00
|
|
|
|
}
|
2025-01-05 14:52:37 +08:00
|
|
|
|
</style>
|
|
|
|
|
|
<!--<style lang="scss">-->
|
|
|
|
|
|
<!--.el-popover.popover-class {-->
|
|
|
|
|
|
<!-- .el-popover__title {-->
|
|
|
|
|
|
<!-- color: #fff;-->
|
2025-03-17 15:55:30 +08:00
|
|
|
|
<!-- background-color: var(--el-color-primary) !important;-->
|
2025-01-05 14:52:37 +08:00
|
|
|
|
<!-- }-->
|
|
|
|
|
|
<!--}-->
|
|
|
|
|
|
<!--</style>-->
|