联调 正式检测结果页面

This commit is contained in:
guanj
2025-08-22 15:33:57 +08:00
parent 959ae1dee9
commit dd9ca8f956
7 changed files with 664 additions and 475 deletions

View File

@@ -1,127 +1,149 @@
export namespace CheckData {
export interface DataCheck {
scriptName: string,
errorSysId: string,
dataRule: string,
deviceName: string,
chnNum: string,
scriptName: string
errorSysId: string
dataRule: string
deviceName: string
chnNum: string
deviceId: string
num?: string | number | null
}
export interface PhaseCheckResult {
// 检测源定值-标准值
resultData: number,
resultData: number
// 装置原始数据-被检值
data: number,
data: number
// 误差值
errorData: number,
errorData: number
// 第几次谐波
num?: number,
num?: number
//符合、不符合
isData?: number,
isData?: number
//最大误差值
radius?: string,
unit?: string,
radius?: string
unit?: string
}
export interface DataItem {
num: number
isData: number
data: number
resultData: number
radius: string
errorData: number
unit: string
}
export interface TableRow {
isData: number
harmNum: number
radius: string
dataA: DataItem
dataB: DataItem
dataC: DataItem
dataT: DataItem | null
unit: string
}
/**
* 用于定义 查看(设备)通道检测结果响应数据 类型
*/
export interface ResCheckResult {
dataA?: PhaseCheckResult | null,
dataB?: PhaseCheckResult | null,
dataC?: PhaseCheckResult | null,
dataT?: PhaseCheckResult | null,
dataA?: PhaseCheckResult | null
dataB?: PhaseCheckResult | null
dataC?: PhaseCheckResult | null
dataT?: PhaseCheckResult | null
// 第几次谐波
//num: number | null,
//符合、不符合
isData?: number,
isData?: number
//最大误差值
radius?: string,
radius?: string
//单位
unit?: string,
unit?: string
}
/**
* 用于定义 查看(设备)通道检测结果表格展示数据 类型
*/
export interface CheckResult {
stdA?: string,
dataA?: string,
errorA?: string,
maxErrorA?: string,
isDataA?: number,
unitA?: string,
stdB?: string,
dataB?: string,
errorB?: string,
maxErrorB?: string,
isDataB?: number,
unitB?: string,
stdC?: string,
dataC?: string,
errorC?: string,
maxErrorC?: string,
isDataC?: number,
unitC?: string,
stdT?: string,
dataT?: string,
errorT?: string,
maxErrorT?: string,
isDataT?: number,
unitT?: string,
stdA?: string
dataA?: string
errorA?: string
maxErrorA?: string
isDataA?: number
unitA?: string
stdB?: string
dataB?: string
errorB?: string
maxErrorB?: string
isDataB?: number
unitB?: string
stdC?: string
dataC?: string
errorC?: string
maxErrorC?: string
isDataC?: number
unitC?: string
stdT?: string
dataT?: string
errorT?: string
maxErrorT?: string
isDataT?: number
unitT?: string
//最大误差值
maxError?: string,
unit?: string,
maxError?: string
unit?: string
//符合、不符合
result?: number,
result?: number
}
/**
* 用于定义 具体通道的原始数据类型
*/
export interface RawDataItem {
time?: string,
harmNum?: number | null,
dataA?: string,
dataB?: string,
dataC?: string,
dataT?: string,
time?: string
harmNum?: number | null
dataA?: string
dataB?: string
dataC?: string
dataT?: string
unit?: string | null
}
export interface Device {
deviceId: string; //装置序号Id
deviceName: string; //设备名称
chnNum: number; //设备通道数
deviceId: string //装置序号Id
deviceName: string //设备名称
chnNum: number //设备通道数
planId: string; //计划Id
devType: string; //设备类型
devVolt: number; //设备电压
devCurr: number; //设备电流
factorFlag: number; //是否支持系数校准
checkResult:number; //检测结果
chnNumList: object[]; //连线存储数据
planId: string //计划Id
devType: string //设备类型
devVolt: number //设备电压
devCurr: number //设备电流
factorFlag: number //是否支持系数校准
checkResult: number //检测结果
chnNumList: string[] //连线存储数据
}
// 用来描述检测脚本类型
export interface ScriptItem {
id: string,
code: string,
scriptName: string,
id: string
code: string
scriptName: string
}
// 用来描述 检测数据-左侧树结构
export interface TreeItem {
id: string | null,
scriptTypeName: string | null,
sourceDesc: string | null,
harmNum: number | null,
index: number | null,
fly: number | null,
children: TreeItem[] | null,
id: string | null
scriptTypeName: string | null
sourceDesc: string | null
harmNum: number | null
index: number | null
fly: number | null
children: TreeItem[] | null
}
// 用来描述 通道检测结果
@@ -136,8 +158,8 @@ export namespace CheckData {
}
export interface DeviceCheckResult {
deviceId: string,
deviceName: string,
deviceId: string
deviceName: string
chnResult: ChnCheckResultEnum[] //通道检测结果
}
@@ -155,7 +177,7 @@ export namespace CheckData {
LOADING = 'var(--el-color-primary)',
SUCCESS = '#91cc75',
WARNING = '#e6a23c',
DANGER = '#f56c6c',
DANGER = '#f56c6c'
}
/**
@@ -170,18 +192,17 @@ export namespace CheckData {
* 用于描述 脚本检测结果展示的按钮类型
*/
export interface ScriptChnViewItem {
scriptType: string,
scriptType: string
scriptName?: string //脚本项名称,可以不要该属性,有点多余
// 设备
devices: Array<{
deviceId: string,
deviceName: string,
chnResult: ButtonResult[],
deviceId: string
deviceName: string
chnResult: ButtonResult[]
}>
}
/**
* 定义检测日志类型
*/
@@ -194,21 +215,16 @@ export namespace CheckData {
* 定义手动检测时,勾选的测试项
*/
export interface SelectTestItem {
preTest: boolean,
timeTest: boolean,
channelsTest: boolean,
preTest: boolean
timeTest: boolean
channelsTest: boolean
test: boolean
}
//描述比对式检测项描述
export interface CompareTestItem {
id: string,
code: string,
name: string,
id: string
code: string
name: string
}
}

View File

@@ -1,14 +1,14 @@
import { pa } from 'element-plus/es/locale/index.mjs';
import http from "@/api";
import {CheckData} from "@/api/check/interface";
import { pa } from 'element-plus/es/locale/index.mjs'
import http from '@/api'
import { CheckData } from '@/api/check/interface'
export const getBigTestItem = (params: {
reCheckType: number,
planId: string,
devIds: string[],
reCheckType: number
planId: string
devIds: string[]
patternId: string
}) => {
return http.post(`/adPlan/getBigTestItem`, params, {loading: false});
return http.post(`/adPlan/getBigTestItem`, params, { loading: false })
}
/**
@@ -16,12 +16,12 @@ export const getBigTestItem = (params: {
* @param params 当为scriptType为null时表示查询所有脚本类型否则只查询指定脚本类型。当为chnNum为-1时表示查询所有通道否则只查询指定通道。
*/
export const getFormData = (params: {
planId: string,
deviceId: string,
chnNum: string,
planId: string
deviceId: string
chnNum: string
scriptType: string | null
}) => {
return http.post("/result/formContent/", params, {loading: false});
return http.post('/result/formContent/', params, { loading: false })
}
/**
@@ -29,13 +29,13 @@ export const getFormData = (params: {
* @param params
*/
export const getTreeData = (params: {
scriptId?: string,
devId?: string,
devNum?: string,
scriptType?: string | null,
code?: string,
scriptId?: string
devId?: string
devNum?: string
scriptType?: string | null
code?: string
}) => {
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: false});
return http.post<CheckData.TreeItem[]>('/result/treeData/', params, { loading: false })
}
/**
@@ -43,25 +43,25 @@ export const getTreeData = (params: {
* @param params
*/
export const getTableData = (params: {
scriptType: string | null,
scriptId: string,
devId: string,
devNum: string,
code: string,
index: number,
scriptType: string | null
scriptId: string
devId: string
devNum: string
code: string
index: number
}) => {
return http.post("/result/resultData/", params, {loading: false});
return http.post('/result/resultData/', params, { loading: false })
}
export const exportRawData = (params: {
scriptType: string | null,
scriptId: string,
devId: string,
devNum: string,
code: string,
index: number,
scriptType: string | null
scriptId: string
devId: string
devNum: string
code: string
index: number
}) => {
return http.download("/result/exportRawData", params, {loading: false});
return http.download('/result/exportRawData', params, { loading: false })
}
/**
@@ -69,13 +69,39 @@ export const exportRawData = (params: {
* @param params
*/
export const reCalculate = (params: {
planId: string,
scriptId: string,
errorSysId: string,
deviceId: string,
planId: string
scriptId: string
errorSysId: string
deviceId: string
code: string
}) => {
return http.post("/result/reCalculate", params, {loading: true});
return http.post('/result/reCalculate', params, { loading: true })
}
/**
* 获取数据获取基本信息
* @param params
*/
export const getContrastFormContent = (params: {
planId: string
scriptType: string
deviceId: string
chnNum: string | number
num: number | string | null
}) => {
return http.post('/result/getContrastFormContent', params, { loading: false })
}
/**
* 获取检测结果
* @param params
*/
export const getContrastResult = (params: {
planId: string
scriptType: string
deviceId: string
chnNum: string | number
num: number | string | null
}) => {
return http.post('/result/getContrastResult', params, { loading: false })
}
/**
@@ -83,13 +109,13 @@ export const reCalculate = (params: {
* @param params
*/
export const changeErrorSystem = (params: {
planId: string,
scriptId: string,
errorSysId: string,
deviceId: string,
planId: string
scriptId: string
errorSysId: string
deviceId: string
code: string
}) => {
return http.post("/result/changeErrorSystem", params, {loading: true});
return http.post('/result/changeErrorSystem', params, { loading: true })
}
/**
@@ -97,5 +123,5 @@ export const changeErrorSystem = (params: {
* @param code
*/
export const deleteTempTable = (code: string) => {
return http.get(`/result/deleteTempTable?code=${code}`, null, {loading: false})
return http.get(`/result/deleteTempTable?code=${code}`, null, { loading: false })
}

View File

@@ -1,94 +1,165 @@
<template>
<div class="table-main">
<el-table :data="mockTableData" height="357px" :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }">
<el-table-column label="A相" >
<el-table-column prop="stdA" :label="'被检值'"/>
<el-table-column prop="dataA" :label="'标准值'"/>
<el-table
:data="prop.tableData"
height="357px"
:header-cell-style="{ textAlign: 'center' }"
:cell-style="{ textAlign: 'center' }"
>
<el-table-column label="A相" v-if="prop.tableData[0].dataT ==null">
<el-table-column prop="stdA" :label="'被检值'">
<template #default="{ row }">
{{ row.dataA.data }}
</template>
</el-table-column>
<el-table-column prop="dataA" :label="'标准值'">
<template #default="{ row }">
{{ row.dataA.resultData }}
</template>
</el-table-column>
<el-table-column prop="isDataA" label="检测结果">
<template #default="scope">
<template #default="{ row }">
<el-tooltip effect="dark" placement="bottom">
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
<template #content>
误差范围{{ addPercentSigns(row.dataA.radius,row.dataA.unit) }}
<br />
误差值{{ row.dataA.errorData }}
</template>
<el-tag type="success" v-if="row.dataA.isData === 1">符合</el-tag>
<el-tag type="danger" v-if="row.dataA.isData === 2">不符合</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="B相" >
<el-table-column prop="stdB" :label="'被检值'"/>
<el-table-column prop="dataB" :label="'标准值'"/>
<el-table-column label="B相" v-if="prop.tableData[0].dataT==null">
<el-table-column prop="stdB" :label="'被检值'">
<template #default="{ row }">
{{ row.dataB.data }}
</template>
</el-table-column>
<el-table-column prop="dataB" :label="'标准值'">
<template #default="{ row }">
{{ row.dataB.resultData }}
</template>
</el-table-column>
<el-table-column prop="isDataB" label="检测结果">
<template #default="scope">
<template #default="{ row }">
<el-tooltip effect="dark" placement="bottom">
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
<template #content>
误差范围{{ addPercentSigns(row.dataB.radius,row.dataB.unit) }}
<br />
误差值{{ row.dataB.errorData }}
</template>
<el-tag type="success" v-if="row.dataB.isData === 1">符合</el-tag>
<el-tag type="danger" v-if="row.dataB.isData === 2">不符合</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="C相" >
<el-table-column prop="stdC" :label="'被检值'"/>
<el-table-column prop="dataC" :label="'标准值'"/>
<el-table-column label="C相" v-if="prop.tableData[0].dataT==null">
<el-table-column prop="stdC" :label="'被检值'" >
<template #default="{ row }">
{{ row.dataC.data }}
</template>
</el-table-column>
<el-table-column prop="dataC" :label="'标准值'">
<template #default="{ row }">
{{ row.dataC.resultData }}
</template>
</el-table-column>
<el-table-column prop="isDataC" label="检测结果">
<template #default="scope">
<template #default="{ row }">
<el-tooltip effect="dark" placement="bottom">
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
<el-tag type="info" v-if="scope.row.isDataA === 5">-</el-tag>
<template #content>
误差范围{{ addPercentSigns(row.dataC.radius,row.dataC.unit) }}
<br />
误差值{{ row.dataC.errorData }}
</template>
<el-tag type="success" v-if="row.dataC.isData === 1">符合</el-tag>
<el-tag type="danger" v-if="row.dataC.isData === 2">不符合</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="T相" v-if="prop.tableData[0].dataT">
<el-table-column prop="stdT" :label="'被检值'" >
<template #default="{ row }">
{{ row.dataT.data }}
</template>
</el-table-column>
<el-table-column prop="dataT" :label="'标准值'">
<template #default="{ row }">
{{ row.dataT.resultData }}
</template>
</el-table-column>
<el-table-column prop="isDataT" label="检测结果">
<template #default="{ row }">
<el-tooltip effect="dark" placement="bottom">
<template #content>
误差范围{{ addPercentSigns(row.dataT.radius,row.dataT.unit) }}
<br />
误差值{{ row.dataT.errorData }}
</template>
<el-tag type="success" v-if="row.dataT.isData === 1">符合</el-tag>
<el-tag type="danger" v-if="row.dataT.isData === 2">不符合</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
</template>
<script lang="tsx" setup>
import {} from 'vue'
import { CheckData } from '@/api/check/interface'
const prop = defineProps({
tableData: {
type: Array as () => CheckData.TableRow[],
default: []
}
})
// 添加单位
const addPercentSigns = (text: string,unit: string) => {
return text
.split('~')
.map(part => `${part}${unit}`)
.join('~')
}
const mockTableData = [
{
stdA: "220.00",
dataA: "219.85",
stdA: '220.00',
dataA: '219.85',
isDataA: 1,
maxErrorA: "±0.5%",
errorA: "0.068%",
unitA: "%",
stdB: "220.00",
dataB: "220.12",
maxErrorA: '±0.5%',
errorA: '0.068%',
unitA: '%',
stdB: '220.00',
dataB: '220.12',
isDataB: 1,
maxErrorB: "±0.5%",
errorB: "0.055%",
unitB: "%",
stdC: "220.00",
dataC: "219.95",
maxErrorB: '±0.5%',
errorB: '0.055%',
unitB: '%',
stdC: '220.00',
dataC: '219.95',
isDataC: 1,
maxErrorC: "±0.5%",
errorC: "0.023%",
unitC: "%",
stdT: "0.15",
dataT: "0.12",
maxErrorC: '±0.5%',
errorC: '0.023%',
unitC: '%',
stdT: '0.15',
dataT: '0.12',
isDataT: 1,
maxErrorT: "±0.2",
errorT: "0.03",
unitT: "",
unit: "V"
maxErrorT: '±0.2',
errorT: '0.03',
unitT: '',
unit: 'V'
}
];
]
</script>
<style scoped>
.form-grid {
display: flex;
flex-direction: row; /* 横向排列 */
@@ -114,8 +185,8 @@ const mockTableData = [
margin-bottom: 20px; /* 添加底部边距 */
}
.el-table th, .el-table td {
.el-table th,
.el-table td {
text-align: center; /* 所有单元格文字居中 */
}
</style>

View File

@@ -1,57 +1,87 @@
<template>
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close"
v-bind="dialogBig" :draggable="false" width="1400px">
<el-dialog
:append-to-body="appendToBody"
class="dialog"
title="数据查询"
:model-value="visible"
@close="close"
v-bind="dialogBig"
:draggable="false"
width="1400px"
>
<div class="data-check-dialog">
<div >
<el-form :model='formContent' label-width="auto" class="form-three ">
<div>
<el-form :model="formContent" label-width="auto" class="form-three">
<el-form-item label="误差体系">
<el-select :disabled="checkStore.showDetailType===2 || checkStore.showDetailType===0" v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off"
@change="handleErrorSysChange">
<el-select
:disabled="checkStore.showDetailType === 2 || checkStore.showDetailType === 0"
v-model="formContent.errorSysId"
placeholder="请选择误差体系"
autocomplete="off"
>
<el-option
v-for="(option) in pqErrorList"
v-for="option in pqErrorList"
:key="option.id"
:label="option.name"
:value="option.id"/>
:value="option.id"
/>
</el-select>
</el-form-item>
<el-form-item label="数据原则">
<el-input v-model='formContent.dataRule' :disabled="true"/>
<el-input v-model="formContent.dataRule" :disabled="true" />
</el-form-item>
<el-form-item label="设备名称">
<el-input v-model='formContent.deviceName' :disabled="true"/>
<el-input v-model="formContent.deviceName" :disabled="true" />
</el-form-item>
<el-form-item label='通道号'>
<el-form-item label="通道号">
<el-select v-model="formContent.chnNum">
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
<el-option v-for="item in chnList" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
<el-form-item v-if="checkStore.showDetailType===1">
<el-button type="primary" :icon="Postcard" >报告生成</el-button>
<el-form-item v-if="checkStore.showDetailType === 1">
<el-button type="primary" :icon="Postcard">报告生成</el-button>
</el-form-item>
<el-form-item v-if="checkStore.showDetailType===0">
<el-button type="primary" :icon="Histogram" >重新计算</el-button>
<el-form-item v-if="checkStore.showDetailType === 0">
<el-button type="primary" :icon="Histogram">重新计算</el-button>
</el-form-item>
</el-form>
</div>
<div class="data-check-body">
<div class="content-right">
<div class="content-right-title">
<div style="width: 840px;">
<div style="width: 840px">
<span class="content-right-title-text">当前检测项目</span>
<span style="color: var(--el-color-primary);">频率</span>
<span style="color: var(--el-color-primary)">{{ rowList.scriptName }}</span>
</div>
<el-form-item style="margin-left: 280px;margin-bottom:0px !important;width: 280px;" label='测试项'>
<el-cascader v-model="currentCheckItem" :options="options" clearable />
<el-form-item
style="margin-left: 280px; margin-bottom: 0px !important; width: 280px"
label="测试项"
>
<el-select v-model="currentCheckItem">
<el-option
v-for="item in tesList"
:key="item"
:label="item.replace(/\.0$/, '')"
:value="item"
/>
</el-select>
</el-form-item>
</div>
<div class="content-right-Tabs">
<el-tabs type="border-card" v-model="activeTab">
<el-tab-pane label="检测结果" name="resultTab">
<CompareDataCheckResultTable :tableData="checkResultData" :currentScriptTypeName="currentScriptTypeName"/>
<CompareDataCheckResultTable
:tableData="currentCheckResultData"
:currentScriptTypeName="currentScriptTypeName"
/>
</el-tab-pane>
<el-tab-pane label="原始数据" name="rawDataTab">
<CompareDataCheckRawDataTable :tableData="rawTableData" :currentScriptTypeName="currentScriptTypeName" @exportRawDataHandler="exportRawDataHandler"/>
<CompareDataCheckRawDataTable
:tableData="rawTableData[currentCheckItem]"
:currentScriptTypeName="currentScriptTypeName"
@exportRawDataHandler="exportRawDataHandler"
/>
</el-tab-pane>
</el-tabs>
</div>
@@ -59,36 +89,40 @@
</div>
</div>
</el-dialog>
</template>
<script setup lang='ts'>
import {dialogBig} from '@/utils/elementBind'
import {reactive, ref, watch} from 'vue'
<script setup lang="ts">
import { dialogBig } from '@/utils/elementBind'
import { reactive, ref, watch, computed } from 'vue'
import CompareDataCheckResultTable from './compareDataCheckResultTable.vue'
import CompareDataCheckRawDataTable from './compareDataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface";
import {useCheckStore} from "@/stores/modules/check";
import {Histogram, Postcard} from "@element-plus/icons-vue";
import {getPqErrSysList} from '@/api/plan/plan'
import { getFormData} from "@/api/check/test";
import { CheckData } from '@/api/check/interface'
import { useCheckStore } from '@/stores/modules/check'
import { Histogram, Postcard } from '@element-plus/icons-vue'
import { getPqErrSysList } from '@/api/plan/plan'
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { useDictStore } from '@/stores/modules/dict'
import { getContrastFormContent, getContrastResult, getBigTestItem } from '@/api/check/test'
const {appendToBody} = withDefaults(defineProps<{
const { appendToBody } = withDefaults(
defineProps<{
appendToBody: boolean
}>(), {appendToBody: true})
}>(),
{ appendToBody: true }
)
const checkStore = useCheckStore()
const modeStore = useModeStore()
const dictStore = useDictStore()
const visible = ref(false)
const treeRef = ref()
const searchValue = ref<string>('')
const pqErrorList = reactive<{ id: string; name: string; }[]>([])
const pqErrorList = reactive<{ id: string; name: string }[]>([])
const activeTab = ref('resultTab')
const currentCheckItem = ref<any>()
let deviceId: string = ''
const rowList: any = ref([])
let scriptType: string | null = null
watch(searchValue, (val) => {
watch(searchValue, val => {
treeRef.value!.filter(val)
})
@@ -99,70 +133,100 @@ const formContent = reactive<CheckData.DataCheck>({
dataRule: '',
deviceName: '',
chnNum: '',
deviceId: '',
num: null
})
// 通道下拉列表
let chnList: any[] = []
const chnList: any = ref([])
// 当前检测项目名称
const currentScriptTypeName = ref('')
// 检测结果表格数据
const checkResultData = reactive<CheckData.CheckResult[]>([])
const checkResultData = ref<CheckData.CheckResult[]>([])
// 原始数据表格数据
const rawTableData = reactive<CheckData.RawDataItem[]>([])
const rawTableData = ref<CheckData.RawDataItem[]>([])
const tesList: any = ref([])
// 检测结果
const currentCheckResultData = computed(() => {
const data = checkResultData.value[currentCheckItem.value]
return Array.isArray(data) ? data : []
})
const open = async (row: any, chnNum: string, deviceId: string | null, source: number) => {
if (source == 1) {
// 正式检测进入页面
rowList.value = row
formContent.chnNum = chnNum
formContent.deviceId = deviceId || ''
}
visible.value = true
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
visible.value = true;
deviceId = _deviceId
scriptType = null
// 设置默认选中第一个选项
if (options.length > 0) {
const firstOption = options[0];
currentCheckItem.value = [firstOption.value];
// 如果第一个选项有子选项,默认也选中第一个子选项
if (firstOption.children && firstOption.children.length > 0) {
currentCheckItem.value.push(firstOption.children[0].value);
}
}
formContent.errorSysId = checkStore.plan.errorSysId
pqErrorList.length = 0
let {data: resPqErrorList} = await getPqErrSysList()
// 获取误差体系
let { data: resPqErrorList } = await getPqErrSysList()
Object.assign(pqErrorList, resPqErrorList)
// 获取基本信息
await getBasicInformation()
await getTestItem()
await getResults()
}
//获取基本信息
const getBasicInformation = async () => {
getContrastFormContent({
planId: checkStore.plan.id,
scriptType: rowList.value.scriptType,
deviceId: formContent.deviceId,
chnNum: formContent.chnNum,
num: formContent.num ?? null
}).then((res: any) => {
formContent.dataRule = res.data.dataRule
formContent.deviceName = res.data.deviceName
formContent.errorSysId = res.data.errorSysId
let chnMap: string[] = []
for (let key in res.data.chnMap) {
chnMap.push(key)
}
chnList.value = chnMap
})
}
// 获取测试项
const getTestItem = async () => {
getBigTestItem({
reCheckType: 1,
planId: checkStore.plan.id,
devIds: [formContent.deviceId],
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''
}).then((res: any) => {})
}
// 获取结果
const getResults = async () => {
getContrastResult({
planId: checkStore.plan.id,
scriptType: rowList.value.scriptType,
deviceId: formContent.deviceId,
chnNum: formContent.chnNum,
num: formContent.num ?? null
}).then((res: any) => {
let list: string[] = []
for (let key in res.data.resultMap) {
list.push(key)
}
currentCheckItem.value = list[0]
tesList.value = list
checkResultData.value = res.data.resultMap
rawTableData.value = res.data.rawDataMap
})
}
const close = () => {
visible.value = false;
visible.value = false
// 可以在这里添加其他清理逻辑
}
const options = [
{
value: 'guide',
label: '谐波电压',
children: [
{
value: 'disciplines',
label: '2次',
},
{
value: 'disciplines',
label: '3次',
},
],
},
]
defineExpose({
open
})
@@ -175,7 +239,6 @@ defineExpose({
overflow-y: hidden;
overflow-x: hidden;
.data-check-dialog {
display: flex;
flex-direction: column;

View File

@@ -40,7 +40,7 @@
<el-table-column
v-for="(chnItem, index2) in checkStore.chnNumList"
:key="`${item.deviceId}${chnItem}`"
:label="'通道' + chnItem.label"
:label="'通道' + chnItem"
align="center"
>
<template #default="{ row }">
@@ -70,7 +70,7 @@
"
:color="row.devices[index1].chnResult[index2].color"
size="small"
@click="handleClick(item, chnItem, row.scriptType)"
@click="handleClick(row, chnItem, row.scriptType)"
style="align-self: center"
>
<el-icon
@@ -329,6 +329,8 @@ watch(
// 失败
if (newValue.data != undefined) return
setLogList('error', str + '失败!')
emit('update:testStatus', 'error')
stopTimeCount()
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
break
}
@@ -361,17 +363,16 @@ watch(
Object.assign(checkResult, result)
setLogList('info', '检测完成!')
stopTimeCount()
updatePercentage()
break
case 25003:
setLogList('error', '检测失败!')
stopTimeCount()
updatePercentage()
break
default:
if (newValue.code != 10201) {
setLogList(newValue.code == 10200 ? 'info' : 'error', newValue.data)
updatePercentage()
}
break
@@ -382,6 +383,7 @@ watch(
switch (newValue.operateCode) {
case 'Contrast_Dev':
setLogList('error', '设备服务端连接失败!')
stopTimeCount()
break
}
break
@@ -393,6 +395,7 @@ watch(
type: 'error'
})
setLogList('error', '当前流程存在异常结束!')
stopTimeCount()
break
case 'socket_timeout':
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
@@ -400,6 +403,7 @@ watch(
type: 'error'
})
setLogList('error', '设备连接异常,请检查设备连接情况!')
stopTimeCount()
break
case 'server_error':
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
@@ -407,6 +411,7 @@ watch(
type: 'error'
})
setLogList('error', '服务端主动关闭连接!')
stopTimeCount()
break
case 'device_error':
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
@@ -414,6 +419,7 @@ watch(
type: 'error'
})
setLogList('error', '设备主动关闭连接!')
stopTimeCount()
break
}
},
@@ -501,6 +507,7 @@ const showTestLog = () => {
// 初始化检测脚本数据
const initScriptData = async () => {
scriptData = []
const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''
let response: any = await getBigTestItem({
reCheckType: checkStore.reCheckType,
@@ -675,41 +682,41 @@ const getResult = (devices: CheckData.DeviceCheckResult[] = []) => {
// 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道
const handleClick = (item: any, chnNum: number, scriptType: string) => {
// let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType)
// let flag = -1
// if (checkResultItem) {
// let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId)
// if (device) {
// let chnResult = device.chnResult
// if (chnNum === -1) {
// if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.TIMEOUT) !== -1) {
// flag = 0
// }
// if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.ERRORDATA) !== -1) {
// flag = 1
// }
// } else {
// if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.TIMEOUT) {
// flag = 0
// }
// if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.ERRORDATA) {
// flag = 1
// }
// }
// }
// }
let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType)
let flag = -1
if (checkResultItem) {
let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId)
if (device) {
let chnResult = device.chnResult
if (chnNum === -1) {
if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.TIMEOUT) !== -1) {
flag = 0
}
if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.ERRORDATA) !== -1) {
flag = 1
}
} else {
if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.TIMEOUT) {
flag = 0
}
if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.ERRORDATA) {
flag = 1
}
}
}
}
// if (flag === 0) {
// ElMessageBox.alert('连接超时,请检查设备通讯是否正常', '连接超时', {
// confirmButtonText: '确定',
// type: 'warning',
// })
// }
// if (flag === -1 || flag === 1) {
// checkStore.setShowDetailType(2)
console.log('handleTest', item.deviceId, chnNum, scriptType)
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType)
//}
if (flag === 0) {
ElMessageBox.alert('连接超时,请检查设备通讯是否正常', '连接超时', {
confirmButtonText: '确定',
type: 'warning',
})
}
if (flag === -1 || flag === 1) {
checkStore.setShowDetailType(2)
dataCheckSingleChannelSingleTestPopupRef.value?.open(item, chnNum+'', item.devices[0].deviceId,1)
}
}
const handlePause = () => {
@@ -723,9 +730,9 @@ const initializeParameters = async () => {
await initScriptData()
initDeviceList()
initCheckResult()
percentage.value = 0
timeCount.value = 0
timeView.value = '00:00:00'
testLogList.splice(0, testLogList.length, {
type: 'info',
log: checkStore.selectTestItems.preTest ? '正在检测,请稍等...' : '暂无数据,等待检测开始'
@@ -754,9 +761,10 @@ const handleResumeTest = () => {
}
//
onMounted(() => {
console.log(123123)
if (!checkStore.selectTestItems.preTest) {
// 判断是否预检测
initializeParameters()
}
})
defineExpose({

View File

@@ -63,12 +63,12 @@
>
开始检测
</el-button>
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
<!-- <el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
<el-icon class="loading-box" style="color: #fff; margin-right: 8px">
<component :is="Refresh" />
</el-icon>
初始化中
</el-button>
</el-button> -->
<el-button type="primary" v-if="TestStatus == 'process'" :icon="VideoPause" @click="handlePause()">
停止检测
</el-button>
@@ -81,7 +81,6 @@
<el-button type="warning" v-if="TestStatus == 'paused'" :icon="VideoPlay" @click="sendResume">
继续检测
</el-button>
<el-button
type="warning"
:icon="VideoPlay"
@@ -259,9 +258,17 @@ const open = async (
//预检测-重新检测
const handleSubmitAgain = async () => {
console.log("🚀 ~ handleSubmitAgain ~ stepsActive.value:", stepsActiveIndex.value,stepsActiveView.value , stepsActive.value)
if(checkStore.selectTestItems.preTest){
stepsActiveIndex.value = 1
stepsActiveView.value = 1
stepsActive.value = 1
}else{
stepsActiveIndex.value = 1
stepsActiveView.value = 2
stepsActive.value = 2
}
let count = 0
for (let key in checkStore.selectTestItems) {
if (checkStore.selectTestItems[key]) {
@@ -319,6 +326,8 @@ const handleSubmitFast = async () => {
})
preTestStatus.value = 'start'
if (checkStore.selectTestItems.test) {
console.log(111111);
testRef.value.initializeParameters()
testRef.value.showTestLog()
}
@@ -369,7 +378,6 @@ watch(TestStatus, function (newValue, oldValue) {
watch(stepsActiveIndex, function (newValue, oldValue) {
if (checkStore.selectTestItems.test && checkStore.selectTestItems.preTest && newValue == 2) {
setTimeout(() => {
console.log(1);
testRef.value.initializeParameters()
testRef.value.showTestLog()

View File

@@ -214,15 +214,12 @@ const handleNext = async () => {
return
}
// const sourceKey = edge.source.replace('被检通道-', '').replace('-', '_');
let chnNumList: object[] = []
let chnNumList: string[] = []
await edges.value.forEach(edge => {
const match = edge.source.split('-')
if (match) {
chnNumList.push({
deviceId: match[1],
label: match[2]
})
chnNumList.push(match[2])
}
})