This commit is contained in:
sjl
2025-01-02 09:02:54 +08:00
11 changed files with 603 additions and 551 deletions

View File

@@ -13,12 +13,14 @@ export namespace CheckData {
export interface CheckResult { export interface CheckResult {
chnNum: string, chnNum: string,
standardValue: number, standardValue: number,
L1: number, A?: number,
L1_errValue: number, A_errValue?: number,
L2: number, B?: number,
L2_errValue: number, B_errValue?: number,
L3: number, C?: number,
L3_errValue: number, C_errValue?: number,
T?: number,
T_errValue?: number,
maxErrVaule: number, maxErrVaule: number,
result: string, result: string,
} }
@@ -28,9 +30,10 @@ export namespace CheckData {
*/ */
export interface RawDataItem { export interface RawDataItem {
updateTime: string, updateTime: string,
L1: number, A?: number,
L2: number, B?: number,
L3: number C?: number
T?: number
} }
export interface Device { export interface Device {
@@ -44,7 +47,6 @@ export namespace CheckData {
id: string, id: string,
code?: string, code?: string,
scriptName: string, scriptName: string,
pid?: string,
children?: ScriptItem[] children?: ScriptItem[]
} }
@@ -75,7 +77,7 @@ export namespace CheckData {
INFO = '#909399', INFO = '#909399',
LOADING = '#607eab', LOADING = '#607eab',
SUCCESS = '#67c23a', SUCCESS = '#67c23a',
WARNING ='#e6a23c', WARNING = '#e6a23c',
DANGER = '#f56c6c', DANGER = '#f56c6c',
} }

View File

@@ -1,13 +1,45 @@
import http from "@/api"; import http from "@/api";
export const getFormData = (params: { deviceId: string, chnNum: number}) => { export const getBigTestItem = (planId: string) => {
return http.post<any>("/check/detail/", params, {loading: false}); return http.get(`/adPlan/getBigTestItem?planId=${planId}`, {loading: false});
} }
export const getTreeData = (params: { deviceId: string, chnNum: number, checkItemId: string }) => { /**
return http.post<any>("/check/treeData/", params, {loading: false}); * 获取弹出框表单数据
* @param params 当为scriptType为null时表示查询所有脚本类型否则只查询指定脚本类型。当为chnNum为-1时表示查询所有通道否则只查询指定通道。
*/
export const getFormData = (params: {
scriptId: string,
deviceId: string,
chnNum: string,
scriptType: string | null
}) => {
return http.post("/result/formContent/", params, {loading: false});
} }
export const getCheckData = (params: { deviceId: string, chnNum: number, checkItemId: string }) => { /**
return http.post<any>("/check/data/", params, {loading: false}); * 获取树形结构数据
* @param params
*/
export const getTreeData = (params: {
scriptId: string,
deviceId: string,
chnNum: string,
scriptType: string | null,
flag: number
}) => {
return http.post("/result/treeData/", params, {loading: false});
}
/**
* 获取检查数据
* @param params
*/
export const getTableData = (params: {
scriptId: string,
deviceId: string,
chnNum: string,
scriptType: string | null
}) => {
return http.post("/result/tableData/", params, {loading: false});
} }

View File

@@ -13,15 +13,15 @@ export const closePreTest = (params) => {
* 开始正式检测 * 开始正式检测
* @param params * @param params
*/ */
export const startTest = (params: { deviceIds: string[] }) => { export const startTest = (params) => {
return http.post(`/test/startTest`, params, {loading: false}) return http.post(`/prepare/startTest`, params, {loading: false})
} }
/** /**
* 暂停正式检测 * 暂停正式检测
* @param params * @param params
*/ */
export const pauseTest = (params: { deviceIds: string[] }) => { export const pauseTest = (params) => {
return http.post(`/test/pauseTest`, params, {loading: false}) return http.post(`/test/pauseTest`, params, {loading: false})
} }
@@ -29,6 +29,6 @@ export const pauseTest = (params: { deviceIds: string[] }) => {
* 继续正式检测 * 继续正式检测
* @param params * @param params
*/ */
export const resumeTest = (params: { deviceIds: string[] }) => { export const resumeTest = (params) => {
return http.post(`/test/resumeTest`, params, {loading: false}) return http.post(`/test/resumeTest`, params, {loading: false})
} }

View File

@@ -9,6 +9,7 @@ export const useCheckStore = defineStore("check", {
state: () => ({ state: () => ({
devices: Array<CheckData.Device>(), devices: Array<CheckData.Device>(),
planId: String(""), planId: String(""),
scriptId: String(""),
}), }),
getters: {}, getters: {},
@@ -24,6 +25,10 @@ export const useCheckStore = defineStore("check", {
setPlanId(planId: string) { setPlanId(planId: string) {
this.planId = planId this.planId = planId
},
setScriptId(scriptId: string) {
this.scriptId = scriptId
} }
} }
}); });

View File

@@ -6,9 +6,14 @@
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="updateTime" label="数据时间"/> <el-table-column prop="updateTime" label="数据时间"/>
<el-table-column prop="L1" label="L1V"/> <template v-if="phaseFlag === 0">
<el-table-column prop="L2" label="L2V"/> <el-table-column prop="A" :label="`A${unit}`"/>
<el-table-column prop="L3" label="L3V"/> <el-table-column prop="B" :label="`B${unit}`"/>
<el-table-column prop="C" :label="`C${unit}`"/>
</template>
<template v-if="phaseFlag === 1">
<el-table-column prop="T" :label="`T${unit}`"/>
</template>
</el-table> </el-table>
</div> </div>
@@ -16,13 +21,25 @@
<script lang="tsx" setup> <script lang="tsx" setup>
import{CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
const {tableData} = defineProps<{ const {tableData} = defineProps<{
tableData: CheckData.RawDataItem[] tableData: CheckData.RawDataItem[]
}>() }>()
const unit = computed(() => {
return "V"
})
const phaseFlag = computed(() => {
let result = 0;
if (tableData.length > 0) {
result = !tableData[0].T ? 0 : 1;
}
return result;
})
</script> </script>
<style scoped> <style scoped>

View File

@@ -3,45 +3,70 @@
<div class="table-main"> <div class="table-main">
<el-table :data="tableData" height="335px" :header-cell-style="{ textAlign: 'center' } " <el-table :data="tableData" height="335px" :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }"> :cell-style="{ textAlign: 'center' }">
<el-table-column prop="chnNum" label="通道号" width="80"> <!-- <el-table-column prop="chnNum" label="通道号" width="80">-->
<template #default="{row}"> <!-- <template #default="{row}">-->
{{ '通道' + row.chnNum }} <!-- {{ '通道' + row.chnNum }}-->
</template> <!-- </template>-->
</el-table-column> <!-- </el-table-column>-->
<el-table-column prop="standardValue" label="标准值V"/> <template v-if="phaseFlag === 0">
<el-table-column label="L1V"> <el-table-column :label="`A${unit}`">
<el-table-column prop="L1" width="75" label="被检值"> <el-table-column prop="standardValue" width="74" label="标准值V"/>
<el-table-column prop="A" width="74" label="被检值">
</el-table-column>
<el-table-column prop="A_errValue" width="74" label="误差值">
</el-table-column>
</el-table-column>
<el-table-column :label="`B${unit}`">
<el-table-column prop="standardValue" width="74" label="标准值V"/>
<el-table-column prop="B" width="74" label="被检值">
</el-table-column>
<el-table-column prop="B_errValue" width="74" label="误差值">
</el-table-column>
</el-table-column>
<el-table-column :label="`C${unit}`">
<el-table-column prop="standardValue" width="74" label="标准值V"/>
<el-table-column prop="C" width="74" label="被检值">
</el-table-column>
<el-table-column prop="C_errValue" width="74" label="误差值">
</el-table-column>
</el-table-column>
<el-table-column prop="maxErrVaule" label="最大误差V">
</el-table-column> </el-table-column>
<el-table-column prop="L1_errValue" width="75" label="误差值"> <el-table-column prop="result" label="检测结果" width="70">
<template #default="scope">
<el-tag type="danger" v-if="scope.row.result === '不合格'">{{ scope.row.result }}</el-tag>
<span v-if="scope.row.result != '不合格'">{{ scope.row.result }}</span>
</template>
</el-table-column>
</template>
<template v-if="phaseFlag === 1">
<el-table-column :label="`T${unit}`">
<el-table-column prop="standardValue" label="标准值V"/>
<el-table-column prop="T" label="被检值">
</el-table-column>
<el-table-column prop="T_errValue" label="误差值">
</el-table-column>
</el-table-column>
<el-table-column prop="maxErrVaule" label="最大误差V">
</el-table-column> </el-table-column>
</el-table-column> <el-table-column prop="result" label="检测结果">
<el-table-column label="L2V"> <template #default="scope">
<el-table-column prop="L2" width="75" label="被检值"> <el-tag type="danger" v-if="scope.row.result === '不合格'">{{ scope.row.result }}</el-tag>
<span v-if="scope.row.result != '不合格'">{{ scope.row.result }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="L2_errValue" width="75" label="误差值"> </template>
</el-table-column>
</el-table-column>
<el-table-column label="L3V">
<el-table-column prop="L3" width="75" label="被检值">
</el-table-column>
<el-table-column prop="L3_errValue" width="75" label="误差值">
</el-table-column>
</el-table-column>
<el-table-column prop="maxErrVaule" width="110" label="最大误差V">
</el-table-column>
<el-table-column prop="result" label="检测结果" width="100">
<template #default="scope">
<el-tag type="danger" v-if="scope.row.result === '不合格'">{{ scope.row.result }}</el-tag>
<span v-if="scope.row.result != '不合格'">{{ scope.row.result }}</span>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
@@ -49,41 +74,56 @@
</template> </template>
<script lang="tsx" setup> <script lang="tsx" setup>
import {defineProps, reactive} from 'vue'; import {defineProps} from 'vue';
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
const {tableData}=defineProps<{ const {tableData} = defineProps<{
tableData:CheckData.CheckResult[], tableData: CheckData.CheckResult[],
}>(); }>();
const unit = computed(() => {
return "V"
})
const phaseFlag = computed(() => {
let result = 0;
if (tableData.length > 0) {
result = !tableData[0].T ? 0:1;
}
return result;
})
</script> </script>
<style scoped> <style scoped>
.form-grid { .form-grid {
display: flex; display: flex;
flex-direction: row; /* 横向排列 */ flex-direction: row; /* 横向排列 */
flex-wrap: wrap; /* 允许换行 */ flex-wrap: wrap; /* 允许换行 */
} }
.form-grid .el-form-item { .form-grid .el-form-item {
flex: 1 1 30%; /* 控件宽度 */ flex: 1 1 30%; /* 控件宽度 */
margin-right: 20px; /* 控件间距 */ margin-right: 20px; /* 控件间距 */
} }
.form-grid .el-form-item:last-child { .form-grid .el-form-item:last-child {
margin-right: 0; /* 最后一个控件不需要右边距 */ margin-right: 0; /* 最后一个控件不需要右边距 */
} }
.dialog-footer { .dialog-footer {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */ margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
} }
.el-tabs { .el-tabs {
margin-bottom: 20px; /* 添加底部边距 */ margin-bottom: 20px; /* 添加底部边距 */
} }
.el-table th, .el-table td { .el-table th, .el-table td {
text-align: center; /* 所有单元格文字居中 */ text-align: center; /* 所有单元格文字居中 */
} }
</style> </style>

View File

@@ -17,7 +17,7 @@
<el-input v-model='formContent.deviceName' :disabled="true"/> <el-input v-model='formContent.deviceName' :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label='通道号'> <el-form-item label='通道号'>
<el-select v-model="formContent.monitorIdx" @change="handleChnChange"> <el-select v-model="formContent.chnNum">
<el-option v-for="item in chnList" :key="item.value" :label="item.label" <el-option v-for="item in chnList" :key="item.value" :label="item.label"
:value="item.value"/> :value="item.value"/>
</el-select> </el-select>
@@ -28,16 +28,25 @@
<div class="data-check-body"> <div class="data-check-body">
<div class="content-left-tree"> <div class="content-left-tree">
<div> <div>
<el-radio-group v-model="switchItem"> <el-radio-group v-model="switchItem" @change="handleSwitchChange">
<el-radio-button label="不符合测试项" :value="0"/> <el-radio-button label="不符合测试项" :value="0"/>
<el-radio-button label="全部测试项" :value="1"/> <el-radio-button label="全部测试项" :value="1"/>
</el-radio-group> </el-radio-group>
</div> </div>
<div class="content-tree"> <div class="content-tree">
<el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="id" <el-tree v-if="switchItem === 0" :default-expanded-keys="defaultExpandedKeys" node-key="id"
:data="treeDataUnQualified" :props="defaultProps" @node-click="handleNodeClick"/> :data="treeDataUnqualified" :props="defaultProps" @node-click="handleNodeClick"
class="custom-tree">
<template #default="{ node, data }">
<span class="custom-tree-node">{{ data.scriptName }}</span>
</template>
</el-tree>
<el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="id" <el-tree v-if="switchItem === 1" :default-expanded-keys="defaultExpandedKeys" node-key="id"
:data="treeDataAll" :props="defaultProps" @node-click="handleNodeClick"/> :data="treeDataAll" :props="defaultProps" @node-click="handleNodeClick" class="custom-tree">
<template #default="{ node, data }">
<span class="custom-tree-node">{{ data.scriptName }}</span>
</template>
</el-tree>
</div> </div>
</div> </div>
@@ -68,8 +77,8 @@ import {reactive, ref} 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";
import {getFormData, getTreeData, getCheckData} from "@/api/check/test";
import {useDictStore} from "@/stores/modules/dict"; import {useDictStore} from "@/stores/modules/dict";
import {useCheckStore} from "@/stores/modules/check";
const {appendToBody} = withDefaults(defineProps<{ const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean appendToBody: boolean
@@ -81,6 +90,7 @@ const defaultProps = {
}; };
const dictStore = useDictStore() const dictStore = useDictStore()
const checkStore = useCheckStore()
const visible = ref(false) const visible = ref(false)
@@ -90,31 +100,30 @@ const formContent = reactive<CheckData.DataCheck>({
errorSysName: '', errorSysName: '',
dataRule: '', dataRule: '',
deviceName: '', deviceName: '',
monitorIdx: '', chnNum: '',
}) })
let deviceId: string = '' let deviceId: string = ''
let scriptType: string = '' let scriptType: string | null = null
// 通道下拉列表 // 通道下拉列表
let chnList: any[] = [] let chnList: any[] = []
// 不符合测试项、全部测试项切换 // 不符合测试项、全部测试项切换
const switchItem = ref<number>(-1) const switchItem = ref<number>(0)
// 左侧树数据-不符合测试项 // 左侧树数据
let treeDataUnQualified: CheckData.ScriptItem[] = [] let treeDataUnqualified: CheckData.ScriptItem[] = []
// 左侧树数据-全部测试项
let treeDataAll: CheckData.ScriptItem[] = [] let treeDataAll: CheckData.ScriptItem[] = []
// 左侧树被选中的叶子节点id // 左侧树被选中的叶子节点id
const checkedScriptId = ref<string>('') const checkedScriptId = ref<string>('')
const currentScriptDsc = ref(''); const currentScriptDsc = ref('');
// 右侧Tab选中项 // 右侧Tab选中项
const activeTab = ref<string>('resultTab') const activeTab = ref<string>('resultTab')
// 检测结果表格数据 // 检测结果表格数据
const checkResultTableData = reactive<CheckData.CheckResult[]>([]) let checkResultTableData: CheckData.CheckResult = []
// 原始数据表格数据 // 原始数据表格数据
const rawTableData = reactive<CheckData.RawDataItem[]>([]) let rawTableData: CheckData.RawDataItem[] = []
const resultTableRef = ref() const resultTableRef = ref()
const rawDataTableRef = ref() const rawDataTableRef = ref()
@@ -122,202 +131,291 @@ const rawDataTableRef = ref()
// 左侧树默认展开节点id // 左侧树默认展开节点id
let defaultExpandedKeys: string[] = [] let defaultExpandedKeys: string[] = []
// 监控通道号下拉框
const handleChnChange = (data: any) => {
console.log("通道号下拉框", data);
// 后端请求,查询该通道号下的测试项(可以只查询不合格测试项,也可以全部测试项、不合格测试项都查询)
// const result = await getTreeData({deviceId, formContent.monitorIdx, scriptType})
// treeDataUnQualified=[]
// treeDataAll=[]
}
// watch(() => formContent.monitorIdx, (newVal, oldVal) => {
// if (newVal) {
// console.log("通道号下拉框", newVal, oldVal);
//
// // 后端请求,查询该通道号下的测试项(可以只查询不合格测试项,也可以全部测试项、不合格测试项都查询)
// // const result = await getTreeData({deviceId, formContent.monitorIdx, scriptType})
// // treeDataUnQualified=[]
// // treeDataAll=[]
//
// }
// })
// 点击左侧树节点触发事件 // 点击左侧树节点触发事件
const handleNodeClick = (data: any) => { const handleNodeClick = async (data: any) => {
if (!data.children) { if (!data.children) {
checkedScriptId.value = data.id checkedScriptId.value = data.id
currentScriptDsc.value = data.scriptName currentScriptDsc.value = data.scriptName
if (checkedScriptId.value) {
await updateTableData()
}
} }
}; };
watch(checkedScriptId, (newVal, oldVal) => { watch(() => formContent.chnNum, async (newVal, oldVal) => {
if (newVal) { console.log("通道号", newVal);
console.log("左侧树被选中的叶子节点id", newVal);
// 发起请求,查询该测试项的检测结果 switchItem.value = 0
// const result = await getCheckData({deviceId, formContent.monitorIdx, scriptType}) await handleSwitchChange(0)
Object.assign(checkResultTableData, [{
chnNum: '1',
standardValue: 57.74,
L1: 57.73,
L1_errValue: 0.01,
L2: 57.73,
L2_errValue: 0.01,
L3: 57.73,
L3_errValue: 0.01,
maxErrVaule: 0.05774,
result: '合格',
}])
Object.assign(rawTableData, [
{
updateTime: "2024-10-10 09:30:00",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:03",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:06",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:09",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:12",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:15",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:18",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:21",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:24",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:27",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:30",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:33",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:36",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:39",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:42",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:45",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:48",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:51",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:54",
L1: 57.73,
L2: 57.73,
L3: 57.73,
},
{
updateTime: "2024-10-10 09:30:57",
L1: 57.73,
L2: 57.73,
L3: 57.73,
}
])
}
}) })
// 切换不合格测试项、全部测试项 触发事件 const handleSwitchChange = async (data: any) => {
watch(switchItem, (newVal, oldVal) => { console.log("切换不合格测试项、全部测试项", data);
let node = null
if (newVal === 0) { if (data === 0) {
node = getDefaultNode(treeDataUnQualified) // 发起请求,查询该测试项的检测结果
} // const result = await getTreeData({checkStore.scriptId,deviceId, formContent.chnNum+'', scriptType,0})
if (newVal === 1) { treeDataUnqualified = [{
node = getDefaultNode(treeDataAll) "id": "1",
"scriptName": "频率准确度检测",
"children": [
{
"id": "1-2",
"scriptName": "电压对频率测量的影响",
"children": [
{
"id": "1-2-1",
"scriptName": "输入:频率 50.05Hz Ua =10%Un..."
},
{
"id": "1-2-2",
"scriptName": "输入:频率 51.05Hz Ua =10%Un..."
},
{
"id": "1-2-3",
"scriptName": "输入:频率 52.05Hz Ua =10%Un..."
}
]
},
{
"id": "1-3",
"scriptName": "谐波对频率测量的影响",
"children": [
{
"id": "1-3-1",
"scriptName": "输入:频率 50.05Hz Ua =100%Un..."
}
]
}
]
}]
} else {
// 发起请求,查询该测试项的检测结果
// const result = await getTreeData({checkStore.scriptId,deviceId, formContent.chnNum+'', scriptType,1})
treeDataAll = [
{
"id": "1",
"scriptName": "频率准确度检测",
"children": [
{
"id": "1-1",
"scriptName": "额定工作条件下的检测",
"children": [
{
"id": "1-1-1",
"scriptName": "输入:频率 42.5Hz..."
},
{
"id": "1-1-2",
"scriptName": "输入:频率 50.0Hz..."
},
{
"id": "1-1-3",
"scriptName": "输入:频率 50.05Hz...."
}
]
},
{
"id": "1-2",
"scriptName": "电压对频率测量的影响",
"children": [
{
"id": "1-2-1",
"scriptName": "输入:频率 50.05Hz Ua =10%Un..."
},
{
"id": "1-2-2",
"scriptName": "输入:频率 51.05Hz Ua =10%Un..."
},
{
"id": "1-2-3",
"scriptName": "输入:频率 52.05Hz Ua =10%Un..."
}
]
},
{
"id": "1-3",
"scriptName": "谐波对频率测量的影响",
"children": [
{
"id": "1-3-1",
"scriptName": "输入:频率 50.05Hz Ua =100%Un..."
}
]
}
]
},
]
} }
defaultOperate()
await updateTableData()
}
// 默认操作
const defaultOperate = () => {
let node = null
if (switchItem.value === 0) {
node = getDefaultNode(treeDataUnqualified)
} else {
node = getDefaultNode(treeDataAll)
}
currentScriptDsc.value = node?.scriptName currentScriptDsc.value = node?.scriptName
checkedScriptId.value = node?.id checkedScriptId.value = node?.id
defaultExpandedKeys = [node?.id] defaultExpandedKeys = [node?.id]
}) }
const open = async (_deviceId: string, chnNum: number, _scriptType?: string) => { const updateTableData = async () => {
console.log(_deviceId, chnNum, _scriptType); console.log("左侧树被选中的叶子节点id", checkedScriptId.value);
// 发起请求,查询该测试项的检测结果
// const result = await getTableData({checkStore.scriptId,deviceId, formContent.chnNum, scriptType})
checkResultTableData = [{
chnNum: '1',
standardValue: 57.74,
A: 57.73,
A_errValue: 0.01,
B: 57.73,
B_errValue: 0.01,
C: 57.73,
C_errValue: 0.01,
maxErrVaule: 0.05774,
result: '合格',
}]
rawTableData = [
{
updateTime: "2024-10-10 09:30:00",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:03",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:06",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:09",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:12",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:15",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:18",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:21",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:24",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:27",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:30",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:33",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:36",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:39",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:42",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:45",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:48",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:51",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:54",
A: 57.73,
B: 57.73,
C: 57.73,
},
{
updateTime: "2024-10-10 09:30:57",
A: 57.73,
B: 57.73,
C: 57.73,
}
]
}
const open = (_deviceId: string, chnNum: string, _scriptType: string | null) => {
console.log(checkStore.scriptId, _deviceId, chnNum, _scriptType);
deviceId = _deviceId deviceId = _deviceId
scriptType = _scriptType ?? '' scriptType = _scriptType
switchItem.value = 0
// 发起后端请求,查询详细信息 当chnNum为-1时查询所有通道号 // 发起后端请求,查询详细信息 当chnNum为-1时查询所有通道号
//const result1 = await getFormData({deviceId, chnNum}) //const resFormContent = await getFormData({checkStore.scriptId,deviceId, chnNum,scriptType})
// 数据处理 // 数据处理
let resFormContent = { let resFormContent = {
@@ -325,7 +423,7 @@ const open = async (_deviceId: string, chnNum: number, _scriptType?: string) =>
errorSysName: 'Q/GDW 10650.2-2021', errorSysName: 'Q/GDW 10650.2-2021',
dataRule: '505f063f9f91ab108d895a9fe96b5dce', dataRule: '505f063f9f91ab108d895a9fe96b5dce',
deviceName: '被检设备1', deviceName: '被检设备1',
chnList:[ chnList: [
{value: '1', label: '1'}, {value: '1', label: '1'},
{value: '2', label: '0'}, {value: '2', label: '0'},
{value: '3', label: '1'}, {value: '3', label: '1'},
@@ -336,105 +434,11 @@ const open = async (_deviceId: string, chnNum: number, _scriptType?: string) =>
label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)` label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)`
})) }))
let dataRuleName = dictStore.getDictData('Data_Rule').find(item=>item.id==resFormContent.dataRule)?.name let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
Object.assign(formContent, {...resFormContent,dataRule:dataRuleName,monitorIdx: chnList[0].value}) Object.assign(formContent, {...resFormContent, dataRule: dataRuleName, chnNum: chnList[0].value})
// const result2 = await getTreeData({deviceId, formContent.monitorIdx, checkItemId})
treeDataAll = [{
"id": "1",
"pid": "0",
"scriptName": "频率准确度检测",
"children": [
{
"id": "1-1",
"pid": "1",
"scriptName": "额定工作条件下的检测",
"children": [
{
"id": "1-1-1",
"pid": "1-1",
"scriptName": "输入:频率 42.5Hz..."
},
{
"id": "1-1-2",
"pid": "1-1",
"scriptName": "输入:频率 50.0Hz..."
},
{
"id": "1-1-3",
"pid": "1-1",
"scriptName": "输入:频率 50.05Hz...."
}
]
},
{
"id": "1-2",
"pid": "1",
"scriptName": "电压对频率测量的影响",
"children": [
{
"id": "1-2-1",
"pid": "1-2",
"scriptName": "输入:频率 50.05Hz Ua =10%Un..."
},
{
"id": "1-2-1",
"pid": "1-2",
"scriptName": "输入:频率 51.05Hz Ua =10%Un..."
},
{
"id": "1-2-2",
"pid": "1-2",
"scriptName": "输入:频率 52.05Hz Ua =10%Un..."
}
]
},
{
"id": "1-3",
"pid": "1",
"scriptName": "谐波对频率测量的影响",
"children": [
{
"id": "1-3-1",
"pid": "1-3",
"scriptName": "输入:频率 50.05Hz Ua =100%Un..."
}
]
}
]
}]
treeDataUnQualified = [{
"id": "1",
"pid": "0",
"scriptName": "频率准确度检测",
"children": [
{
"id": "1-2",
"pid": "1",
"scriptName": "电压对频率测量的影响",
"children": [
{
"id": "1-2-1",
"pid": "1-2",
"scriptName": "输入:频率 50.05Hz Ua =10%Un..."
},
{
"id": "1-2-1",
"pid": "1-2",
"scriptName": "输入:频率 51.05Hz Ua =10%Un..."
},
{
"id": "1-2-2",
"pid": "1-2",
"scriptName": "输入:频率 52.05Hz Ua =10%Un..."
}
]
}
]
}]
visible.value = true; visible.value = true;
} }
@@ -445,14 +449,14 @@ const close = () => {
errorSysName: '', errorSysName: '',
dataRule: '', dataRule: '',
deviceName: '', deviceName: '',
monitorIdx: '', chnNum: '',
}) })
treeDataUnqualified = []
treeDataAll = [] treeDataAll = []
treeDataUnQualified = []
checkedScriptId.value = '' checkedScriptId.value = ''
activeTab.value = 'rawDataTab' activeTab.value = 'rawDataTab'
currentScriptDsc.value = '' currentScriptDsc.value = ''
switchItem.value = -1 switchItem.value = 0
visible.value = false; visible.value = false;
}; };
@@ -512,13 +516,19 @@ defineExpose({
padding: 10px 0; padding: 10px 0;
border: 1px solid #ccc; border: 1px solid #ccc;
overflow: auto; overflow-y: auto;
.content-tree { .content-tree {
min-width: 100%; width: 100%;
height: 100%; height: 100%;
max-height: 100%; max-height: 100%;
margin-top: 10px; margin-top: 10px;
.custom-tree-node {
overflow-x: hidden !important; // 溢出部分隐藏
white-space: nowrap !important; //禁止自动换行
text-overflow: ellipsis !important; // 使溢出部分以省略号显示
}
} }
} }

View File

@@ -918,7 +918,7 @@ const openDrawer = (title: string, row: any) => {
if(title === '检测数据查询') if(title === '检测数据查询')
{ {
dataCheckPopupRef.value?.open(row.id,-1) dataCheckPopupRef.value?.open(row.id,'-1',null)
} }
if (title === '误差体系更换') if (title === '误差体系更换')
{ {

View File

@@ -41,7 +41,7 @@
<el-table :data="checkResultView" row-key="scriptId" height="450px" <el-table :data="checkResultView" row-key="scriptId" height="450px"
:header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%" :header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' } " style="width: 100%"
border> border>
<el-table-column fixed prop="scriptName" label="检测项目" width="140px" align="center"> <el-table-column fixed prop="scriptName" label="检测项目" width="150px" align="center">
</el-table-column> </el-table-column>
<template v-if="chnSum<=MAX_CHN_SUM"> <template v-if="chnSum<=MAX_CHN_SUM">
@@ -54,10 +54,10 @@
:content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'" :content="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
placement="top"> placement="top">
<el-button <el-button
:disabled="row.devices[index1].chnResult[index2].color==CheckData.ButtonColorEnum.INFO" :disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING"
:color="row.devices[index1].chnResult[index2].color" :color="row.devices[index1].chnResult[index2].color"
size="small" size="small"
@click="handleClick(row.scriptId,item.deviceId,chnItem)" @click="handleClick(item.deviceId,chnItem+'',row.scriptId)"
style="align-self: center;" style="align-self: center;"
> >
<el-icon v-if="row.devices[index1].chnResult[index2].icon==='Loading'" class="loading-box" <el-icon v-if="row.devices[index1].chnResult[index2].icon==='Loading'" class="loading-box"
@@ -83,10 +83,10 @@
:content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'" :content="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO ? '暂无数据' : '点击查看详情'"
placement="top"> placement="top">
<el-button <el-button
:disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO" :disabled="row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[0].color===CheckData.ButtonColorEnum.LOADING"
:color="row.devices[index1].chnResult[0].color" :color="row.devices[index1].chnResult[0].color"
size="small" size="small"
@click="handleClick(row.scriptId,item.deviceId,-1)" @click="handleClick(item.deviceId,'-1',row.scriptId)"
> >
<el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box" <el-icon v-if="row.devices[index1].chnResult[0].icon==='Loading'" class="loading-box"
style="color: #fff"> style="color: #fff">
@@ -127,18 +127,7 @@
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/> <dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
</template> </template>
<script lang="tsx" setup name="test"> <script lang="tsx" setup name="test">
import { import {Check, InfoFilled, Loading, Refresh, VideoPause} from '@element-plus/icons-vue'
Check,
InfoFilled,
Refresh,
VideoPause,
Minus,
Close,
CircleCheckFilled,
WarnTriangleFilled,
Loading,
Link
} from '@element-plus/icons-vue'
import resultPopup from './resultPopup.vue' import resultPopup from './resultPopup.vue'
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue' import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import {computed, reactive, ref, toRef, watch} from "vue"; import {computed, reactive, ref, toRef, watch} from "vue";
@@ -146,6 +135,7 @@ import {dialogBig} from "@/utils/elementBind";
import {CheckData} from "@/api/check/interface" import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import {ElMessage, ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import {getBigTestItem} from "@/api/check/test";
const checkStore = useCheckStore() const checkStore = useCheckStore()
@@ -166,14 +156,14 @@ const props = defineProps({
} }
}) })
const emit = defineEmits(['update:testStatus', 'update:webMsgSend','sendPause','sendResume']); const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause', 'sendResume']);
// 用来保存测试项进度抽屉是否打开 // 用来保存测试项进度抽屉是否打开
const drawer = ref(false) const drawer = ref(false)
// 进度条颜色 // 进度条颜色
const customColors = [{color: "#5cb87a", percentage: 100}] const customColors = [{color: "#5cb87a", percentage: 100}]
// 检测脚本数据 // 检测脚本数据
const scriptData = reactive<CheckData.ScriptItem[]>([]) let scriptData: CheckData.ScriptItem[] = []
// 用来保存被检设备 // 用来保存被检设备
const deviceList = reactive<CheckData.Device[]>([]) const deviceList = reactive<CheckData.Device[]>([])
// 当前进行的测试项索引 // 当前进行的测试项索引
@@ -289,7 +279,7 @@ const checkResultView = computed(() => {
watch(testStatus, function (newValue, oldValue) { watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') { if (newValue == 'start') {
startTimer() // todo 可移除 //startTimer() // todo 可移除
emit('update:testStatus', 'process') emit('update:testStatus', 'process')
} }
if (newValue == 'paused' && oldValue == 'process') { if (newValue == 'paused' && oldValue == 'process') {
@@ -304,7 +294,10 @@ watch(testStatus, function (newValue, oldValue) {
watch(webMsgSend, function (newValue, oldValue) { watch(webMsgSend, function (newValue, oldValue) {
if (activeIndex <= checkTotal) { if (activeIndex <= checkTotal) {
switch (newValue.requestId) { switch (newValue.requestId) {
case 'Test_PreTest_Fail': case 'PreTest_Success':
ElMessage.success('预检成功!')
break;
case 'PreTest_Fail':
ElMessageBox.alert('预检测失败,请检查设备连接情况', '预检测失败', { ElMessageBox.alert('预检测失败,请检查设备连接情况', '预检测失败', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
@@ -312,26 +305,39 @@ watch(webMsgSend, function (newValue, oldValue) {
emit('update:testStatus', 'success') emit('update:testStatus', 'success')
}) })
break; break;
case 'Test_Pause_Success': case 'Pause_Success':
ElMessage.success('暂停成功') ElMessage.success('暂停成功')
emit('update:testStatus','paused') emit('update:testStatus', 'paused')
break; break;
case 'Test_Pause_Fail': case 'Pause_Fail':
ElMessage.error('暂停失败') ElMessage.error('暂停失败')
break; break;
case 'Test_Resume_Success': case 'Resume_Success':
ElMessage.success('开始继续检测') ElMessage.success('开始继续检测')
emit('update:testStatus','process') emit('update:testStatus', 'process')
break; break;
case 'Test_Resume_Fail': case 'Resume_Fail':
ElMessage.error('无法继续检测') ElMessage.error('无法继续检测')
break; break;
case 'Test_VOL_Start': case 'FREQ_Start':
updateCheckResultView("VOL", true) updateCheckResultView("FREQ", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_VOL_End': case 'FREQ_End':
updateCheckResultView("VOL", false) updateCheckResultView("FREQ", false)
updateLog(false)
updatePercentage()
if (testStatus.value != 'paused') {
activeIndex++;
startTimer()
}
break;
case 'VOL_Start':
updateCheckResultView("V", true)
updateLog(true)
break;
case 'VOL_End':
updateCheckResultView("V", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -339,12 +345,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_Freq_Start': case 'Harm_V_Start':
updateCheckResultView("Freq", true) updateCheckResultView("HV", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_Freq_End': case 'Harm_V_End':
updateCheckResultView("Freq", false) updateCheckResultView("HV", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -352,12 +358,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_Harm_V_Start': case 'Harm_I_Start':
updateCheckResultView("Harm_V", true) updateCheckResultView("HI", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_Harm_V_End': case 'Harm_I_End':
updateCheckResultView("Harm_V", false) updateCheckResultView("HI", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -365,12 +371,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_Harm_I_Start': case 'Harm_P_Start':
updateCheckResultView("Harm_I", true) updateCheckResultView("HP", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_Harm_I_End': case 'Harm_P_End':
updateCheckResultView("Harm_I", false) updateCheckResultView("HP", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -378,12 +384,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_Harm_P_Start': case 'InHarm_V_Start':
updateCheckResultView("Harm_P", true) updateCheckResultView("HSV", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_Harm_P_End': case 'InHarm_V_End':
updateCheckResultView("Harm_P", false) updateCheckResultView("HSV", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -391,12 +397,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_InHarm_V_Start': case 'InHarm_I_Start':
updateCheckResultView("InHarm_V", true) updateCheckResultView("HSI", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_InHarm_V_End': case 'InHarm_I_End':
updateCheckResultView("InHarm_V", false) updateCheckResultView("HSI", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -404,12 +410,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_InHarm_I_Start': case 'Dip_Start':
updateCheckResultView("InHarm_I", true) updateCheckResultView("VOLTAGE", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_InHarm_I_End': case 'Dip_End':
updateCheckResultView("InHarm_I", false) updateCheckResultView("VOLTAGE", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -417,12 +423,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_Dip_Start': case 'CUR_Start':
updateCheckResultView("Dip", true) updateCheckResultView("I", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_Dip_End': case 'CUR_End':
updateCheckResultView("Dip", false) updateCheckResultView("I", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -430,12 +436,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_CUR_Start': case 'MSQI_U_Start':
updateCheckResultView("CUR", true) updateCheckResultView("IMBV", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_CUR_End': case 'MSQI_U_End':
updateCheckResultView("CUR", false) updateCheckResultView("IMBV", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -443,12 +449,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_MSQI_U_Start': case 'MSQI_I_Start':
updateCheckResultView("MSQI_U", true) updateCheckResultView("IMBA", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_MSQI_U_End': case 'MSQI_I_End':
updateCheckResultView("MSQI_U", false) updateCheckResultView("IMBA", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -456,12 +462,12 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_MSQI_I_Start': case 'Flicker_Start':
updateCheckResultView("MSQI_I", true) updateCheckResultView("F", true)
updateLog(true) updateLog(true)
break; break;
case 'Test_MSQI_I_End': case 'Flicker_End':
updateCheckResultView("MSQI_I", false) updateCheckResultView("F", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
@@ -469,20 +475,7 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Test_Flicker_Start': case 'Quit':
updateCheckResultView("Flicker", true)
updateLog(true)
break;
case 'Test_Flicker_End':
updateCheckResultView("Flicker", false)
updateLog(false)
updatePercentage()
if (testStatus.value != 'paused') {
activeIndex++;
startTimer()
}
break;
case 'Test_Quit':
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
console.log('检测结束') console.log('检测结束')
@@ -514,8 +507,8 @@ let randomUnConnectedDeviceId = -1
let randomErrorDataRaw = -1 let randomErrorDataRaw = -1
// todo 可移除end // todo 可移除end
onBeforeMount(() => { onBeforeMount(async () => {
initScriptData() await initScriptData()
initDeviceList() initDeviceList()
initCheckResult() initCheckResult()
@@ -536,40 +529,14 @@ const showTestLog = () => {
} }
// 初始化检测脚本数据 // 初始化检测脚本数据
const initScriptData = () => { const initScriptData = async () => {
let map = new Map<string, string>()
map.set('VOL', '电压')
.set('Freq', '频率')
.set('Harm_V', '谐波电压')
.set('Harm_I', '谐波电流')
.set('Harm_P', '谐波有功功率')
.set('InHarm_V', '间谐波电压')
.set('InHarm_I', '间谐波电流')
.set('Dip', '暂态')
.set('CUR', '电流')
.set('MSQI_U', '电压不平衡度')
.set('MSQI_I', '电流不平衡度')
.set('Flicker', '短时闪变')
let response: CheckData.ScriptItem[] = [ let response: any = await getBigTestItem(checkStore.planId)
{id: '1', code: 'VOL', scriptName: '电压准确度检测'},
{id: '2', code: 'Freq', scriptName: '频率准确度检测'},
{id: '3', code: 'Harm_V', scriptName: '谐波电压准确度检测'},
{id: '4', code: 'Harm_I', scriptName: '谐波电流准确度检测'},
{id: '5', code: 'Harm_P', scriptName: '谐波有功功率准确度检测'},
{id: '6', code: 'InHarm_V', scriptName: '间谐波电压准确度检测'},
{id: '7', code: 'InHarm_I', scriptName: '间谐波电流准确度检测'},
{id: '8', code: 'Dip', scriptName: '暂态准确度检测'},
{id: '9', code: 'CUR', scriptName: '电流准确度检测'},
{id: '10', code: 'MSQI_U', scriptName: '三相电压不平衡度检测'},
{id: '11', code: 'MSQI_I', scriptName: '三相电流不平衡度检测'},
{id: '12', code: 'Flicker', scriptName: '闪变准确度检测'}
]
let temp = response.map(item => { let temp = response.data.map(item => {
return { return {
...item, ...item,
scriptName: map.get(item.code) || item.scriptName scriptName: item.scriptName
} }
}) })
@@ -811,35 +778,6 @@ const getCheckResult = (scriptId: string) => {
}) })
} }
// devices = deviceList.map(item => {
//
// let tempChnResult: CheckData.ChnCheckResultEnum[] = []
// for (let i = 0; i < item.chnNum; i++) {
// tempChnResult.push(CheckData.ChnCheckResultEnum.SUCCESS)
// }
//
// let randomNum = getRandomInt(item.chnNum * 2)
// if (activeIndex >= 2 && activeIndex <= 8) {
// if (randomNum % 3 === 0) {
// let a = getRandomInt(2) === 1 ? CheckData.ChnCheckResultEnum.ERRORDATA : CheckData.ChnCheckResultEnum.UNCONNECTED
// tempChnResult.splice(tempChnResult.length - 1 - item.chnNum, item.chnNum, CheckData.ChnCheckResultEnum.ERRORDATA)
// }else{
// if (randomNum < item.chnNum) {
// tempChnResult[randomNum] = (randomNum % 2) + 1
//
// errorCheckItem.push(scriptId)
// }
// }
// }
//
// return {
// deviceId: item.deviceId,
// deviceName: item.deviceName,
// chnResult: tempChnResult,
// }
// })
let tempScriptChnItem: CheckData.ScriptChnItem = { let tempScriptChnItem: CheckData.ScriptChnItem = {
scriptId, scriptId,
devices, devices,
@@ -875,8 +813,8 @@ const handlePauseOrContinue = () => {
}; };
// 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道 // 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道
const handleClick = (scriptId: string, deviceId: any, chnNum: number) => { const handleClick = (deviceId: string, chnNum: string, scriptType: string) => {
dataCheckSingleChannelSingleTestPopupRef.value?.open(deviceId, chnNum, scriptId); dataCheckSingleChannelSingleTestPopupRef.value?.open(deviceId, chnNum, scriptType);
}; };
// todo 可移除 // todo 可移除
@@ -885,152 +823,151 @@ const startTimer = () => {
switch (activeIndex) { switch (activeIndex) {
case 1: case 1:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_VOL_Start', requestId: 'FREQ_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_VOL_End', requestId: 'FREQ_End',
params: {} params: {}
}) })
}, 2000); }, 2000);
break; break;
case 2: case 2:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Freq_Start', requestId: 'VOL_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Freq_End', requestId: 'VOL_End',
params: {} params: {}
}) })
}, 2000); }, 2000);
break; break;
case 3: case 3:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Harm_V_Start', requestId: 'Harm_V_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Harm_V_End', requestId: 'Harm_V_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 4: case 4:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Harm_I_Start', requestId: 'Harm_I_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Harm_I_End', requestId: 'Harm_I_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 5: case 5:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Harm_P_Start', requestId: 'Harm_P_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Harm_P_End', requestId: 'Harm_P_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 6: case 6:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_InHarm_V_Start', requestId: 'InHarm_V_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_InHarm_V_End', requestId: 'InHarm_V_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 7: case 7:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_InHarm_I_Start', requestId: 'InHarm_I_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_InHarm_I_End', requestId: 'InHarm_I_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 8: case 8:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Dip_Start', requestId: 'Dip_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Dip_End', requestId: 'Dip_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 9: case 9:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_CUR_Start', requestId: 'CUR_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_CUR_End', requestId: 'CUR_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 10: case 10:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_MSQI_U_Start', requestId: 'MSQI_U_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_MSQI_U_End', requestId: 'MSQI_U_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 11: case 11:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_MSQI_I_Start', requestId: 'MSQI_I_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_MSQI_I_End', requestId: 'MSQI_I_End',
params: {} params: {}
}, 2000) }, 2000)
}) })
break; break;
case 12: case 12:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Flicker_Start', requestId: 'Flicker_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Flicker_End', requestId: 'Flicker_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 13: case 13:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Test_Quit', requestId: 'Quit',
params: {} params: {}
}) })
break; break;

View File

@@ -248,15 +248,20 @@ const detectionOptions = ref([
// break; // break;
case 2: case 2:
if (TestStatus.value == "waiting") { if (TestStatus.value == "waiting") {
// startTest({deviceIds}).then(res => { startTest({
// console.log(res) userPageId: "cdf",
// if (res.code === 20000) { devIds:deviceIds,
// TestStatus.value = 'start' planId:planId,
// webMsgSend.value = '' operateType:'1' // '0'为预检测、1为正式检测
// } else { }).then(res => {
// ElMessage.error(res.message) console.log(res)
// } // if (res.code === 20000) {
// }) // TestStatus.value = 'start'
// webMsgSend.value = ''
// } else {
// ElMessage.error(res.message)
// }
})
TestStatus.value = 'start' TestStatus.value = 'start'
} else if (TestStatus.value == 'process') { } else if (TestStatus.value == 'process') {
// 发送暂停指令 // 发送暂停指令

View File

@@ -37,8 +37,11 @@ import { type Plan } from '@/api/plan/interface';
import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue' import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
import { onMounted, ref, watch } from 'vue'; import { onMounted, ref, watch } from 'vue';
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import {useCheckStore} from "@/stores/modules/check";
const router = useRouter() const router = useRouter()
const checkStore = useCheckStore()
const data: any = ref([]) const data: any = ref([])
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
@@ -71,6 +74,7 @@ watch(
}, },
) )
const handleNodeClick = (data: Plan.ResPlan) => { const handleNodeClick = (data: Plan.ResPlan) => {
checkStore.setScriptId(data.scriptId)
updateSelectedTreeNode(data.id) updateSelectedTreeNode(data.id)
} }
const filterNode = (value: string, data: any) => { const filterNode = (value: string, data: any) => {