Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -84,7 +84,6 @@
|
|||||||
import {ElMessage, ElMessageBox, StepProps} from "element-plus";
|
import {ElMessage, ElMessageBox, StepProps} from "element-plus";
|
||||||
import {defineExpose, PropType, ref, toRef, watch} from 'vue';
|
import {defineExpose, PropType, ref, toRef, watch} from 'vue';
|
||||||
import RealTimeData from './realTimeDataAlign.vue'
|
import RealTimeData from './realTimeDataAlign.vue'
|
||||||
import { el } from "element-plus/es/locale";
|
|
||||||
|
|
||||||
const realTimeDataRef = ref()
|
const realTimeDataRef = ref()
|
||||||
|
|
||||||
@@ -119,7 +118,7 @@ const step4InitLog = ref([
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const isShowDialog = ref(true)
|
const isShowDialog = ref(false)
|
||||||
const collapseActiveName = ref('1')
|
const collapseActiveName = ref('1')
|
||||||
const activeIndex = ref(0)
|
const activeIndex = ref(0)
|
||||||
const activeTotalNum = ref(5)
|
const activeTotalNum = ref(5)
|
||||||
@@ -176,13 +175,43 @@ const testStatus = toRef(props, 'testStatus');
|
|||||||
const webMsgSend = toRef(props, 'webMsgSend');
|
const webMsgSend = toRef(props, 'webMsgSend');
|
||||||
const ts = ref('');
|
const ts = ref('');
|
||||||
|
|
||||||
|
|
||||||
|
// 在 script setup 中定义接口
|
||||||
|
interface ChannelData {
|
||||||
|
devNum: string;
|
||||||
|
standardDevInfo: string;
|
||||||
|
dataList: {
|
||||||
|
timeDev: string | null;
|
||||||
|
uaDev: number | null;
|
||||||
|
ubDev: number | null;
|
||||||
|
ucDev: number | null;
|
||||||
|
timeStdDev: string | null;
|
||||||
|
uaStdDev: number | null;
|
||||||
|
ubStdDev: number | null;
|
||||||
|
ucStdDev: number | null;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DeviceData {
|
||||||
|
devName: string;
|
||||||
|
channelDataList: ChannelData[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改 testDataStructure 的类型声明
|
||||||
|
const testDataStructure = ref<Record<string, DeviceData>>({});
|
||||||
|
|
||||||
watch(webMsgSend, function (newValue, oldValue) {
|
watch(webMsgSend, function (newValue, oldValue) {
|
||||||
console.log('webMsgSend', newValue)
|
console.log('webMsgSend', newValue)
|
||||||
if (testStatus.value !== 'waiting') {
|
if (testStatus.value !== 'waiting') {
|
||||||
|
if(newValue.code == 25004){
|
||||||
|
ElMessage.error('接收数据超时!')
|
||||||
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
|
}
|
||||||
switch (newValue.requestId) {
|
switch (newValue.requestId) {
|
||||||
case 'yjc_sbtxjy':
|
case 'yjc_sbtxjy':
|
||||||
switch (newValue.operateCode) {
|
switch (newValue.operateCode) {
|
||||||
case 'INIT_GATHER$01':
|
case 'INIT_GATHER$02':
|
||||||
if (newValue.code == 10200) {
|
if (newValue.code == 10200) {
|
||||||
step1InitLog.value.push({
|
step1InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
@@ -233,8 +262,14 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
if (newValue.code == 10200) { //单个监测点成功
|
if (newValue.code == 10200) { //单个监测点成功
|
||||||
step2InitLog.value.push({
|
step2InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: '模型一致性检验成功!',
|
log: newValue.data + '模型一致性检验成功!',
|
||||||
})
|
})
|
||||||
|
}else if (newValue.code == 10201) {
|
||||||
|
step2.value = 'process'
|
||||||
|
step2InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '正在进行模型一致性校验.....',
|
||||||
|
}];
|
||||||
} else if (newValue.code == 25002) { //单个监测点失败
|
} else if (newValue.code == 25002) { //单个监测点失败
|
||||||
step2InitLog.value.push({
|
step2InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -258,18 +293,27 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
if (newValue.code == 10200) { //单个监测点成功
|
if (newValue.code == 10200) { //单个监测点成功
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: '实时数据对齐检验成功!',
|
log: newValue.data +'实时数据对齐检验成功!',
|
||||||
})
|
})
|
||||||
|
}else if (newValue.code == 10201) {
|
||||||
|
step3.value = 'process'
|
||||||
|
step3InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '正在进行实时数据对齐检验.....',
|
||||||
|
}];
|
||||||
}else if (newValue.code == 25002) { //单个监测点失败
|
}else if (newValue.code == 25002) { //单个监测点失败
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: '实时数据对齐检验失败!',
|
log: '实时数据对齐检验失败!',
|
||||||
})
|
})
|
||||||
}else if (newValue.code == 25001) { //最终成功
|
}else if (newValue.code == 25001 && newValue.data) { //最终成功
|
||||||
step3.value = 'error'
|
isShowDialog.value = true
|
||||||
|
step3.value = 'success'
|
||||||
step4.value = 'process'
|
step4.value = 'process'
|
||||||
activeIndex.value = 3
|
activeIndex.value = 3
|
||||||
|
testDataStructure.value = newValue.data
|
||||||
}else if (newValue.code == 25003) { //最终失败
|
}else if (newValue.code == 25003) { //最终失败
|
||||||
|
isShowDialog.value = true
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
step5.value = 'error'
|
step5.value = 'error'
|
||||||
@@ -279,31 +323,18 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
break;
|
break;
|
||||||
case 'YJC_xujy':
|
case 'YJC_xujy':
|
||||||
switch (newValue.operateCode) {
|
switch (newValue.operateCode) {
|
||||||
case 'OPER_GATHER':
|
|
||||||
if (newValue.code == 10552) {
|
|
||||||
step4InitLog.value.push({
|
|
||||||
type: 'error',
|
|
||||||
log: '存在已经初始化步骤,已经自动关闭,请重新发起检测',
|
|
||||||
})
|
|
||||||
step4.value = 'error'
|
|
||||||
ts.value = 'error'
|
|
||||||
step5.value = 'error'
|
|
||||||
} else if (newValue.code == 10520) {
|
|
||||||
step4InitLog.value.push({
|
|
||||||
type: 'error',
|
|
||||||
log: '解析报文异常',
|
|
||||||
})
|
|
||||||
step4.value = 'error'
|
|
||||||
ts.value = 'error'
|
|
||||||
step5.value = 'error'
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'DATA_REQUEST$02':
|
case 'DATA_REQUEST$02':
|
||||||
if (newValue.code == 10200) {
|
if (newValue.code == 10200) {
|
||||||
step4InitLog.value.push({
|
step4InitLog.value.push({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
log: newValue.data,
|
log: newValue.data,
|
||||||
})
|
})
|
||||||
|
}else if (newValue.code == 10201) {
|
||||||
|
step4.value = 'process'
|
||||||
|
step4InitLog.value = [{
|
||||||
|
type: 'wait',
|
||||||
|
log: '正在进行相序性检.....',
|
||||||
|
}];
|
||||||
} else if(newValue.code == 25002){
|
} else if(newValue.code == 25002){
|
||||||
step4InitLog.value.push({
|
step4InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -384,7 +415,7 @@ watch(activeIndex, function (newValue, oldValue) {
|
|||||||
if (newValue <= activeTotalNum.value - 2) {
|
if (newValue <= activeTotalNum.value - 2) {
|
||||||
collapseActiveName.value = (newValue + 1).toString()
|
collapseActiveName.value = (newValue + 1).toString()
|
||||||
} else {
|
} else {
|
||||||
collapseActiveName.value = (newValue - 1).toString()
|
collapseActiveName.value = newValue.toString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -416,11 +447,10 @@ watch(ts, function (newValue, oldValue) {
|
|||||||
emit('update:testStatus', ts.value)
|
emit('update:testStatus', ts.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 定义一个初始化参数的方法
|
// 定义一个初始化参数的方法
|
||||||
function initializeParameters() {
|
function initializeParameters() {
|
||||||
activeIndex.value = 0
|
activeIndex.value = 0
|
||||||
step1.value = 'process'
|
step1.value = 'wait'
|
||||||
step2.value = 'wait'
|
step2.value = 'wait'
|
||||||
step3.value = 'wait'
|
step3.value = 'wait'
|
||||||
step4.value = 'wait'
|
step4.value = 'wait'
|
||||||
@@ -450,10 +480,14 @@ function initializeParameters() {
|
|||||||
log: '暂无数据,等待检测开始',
|
log: '暂无数据,等待检测开始',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// 清空实时数据对齐验证的数据
|
||||||
|
testDataStructure.value = {}
|
||||||
|
isShowDialog.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const openDialog = () => {
|
const openDialog = () => {
|
||||||
realTimeDataRef.value.open(props.mapping)
|
realTimeDataRef.value.open(props.mapping,testDataStructure.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
@@ -461,8 +495,6 @@ defineExpose({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
|
||||||
.title-icon {
|
.title-icon {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@@ -10,10 +10,15 @@
|
|||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ComparePreTest v-if="showComponent&&preTestSelected" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus"
|
<keep-alive>
|
||||||
|
<ComparePreTest v-if="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus"
|
||||||
:webMsgSend="webMsgSend" :mapping = "channelMapping"/>
|
:webMsgSend="webMsgSend" :mapping = "channelMapping"/>
|
||||||
<CompareTest v-if="showComponent&&testSelected" ref="testRef" v-show="testSelected && stepsActiveView==2" v-model:testStatus="TestStatus"
|
</keep-alive>
|
||||||
|
<keep-alive>
|
||||||
|
<CompareTest v-if="testSelected && stepsActiveView==2" ref="testRef" v-model:testStatus="TestStatus"
|
||||||
:stepsActive="stepsActive"/>
|
:stepsActive="stepsActive"/>
|
||||||
|
</keep-alive>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmitFast">开始检测</el-button>
|
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmitFast">开始检测</el-button>
|
||||||
@@ -42,7 +47,10 @@
|
|||||||
@click="sendResume"
|
@click="sendResume"
|
||||||
>继续检测
|
>继续检测
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button type="warning" :icon="VideoPlay"
|
||||||
|
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||||
|
@click="handleSubmitAgain">重新检测
|
||||||
|
</el-button>
|
||||||
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||||
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||||
@click="nextStep">
|
@click="nextStep">
|
||||||
@@ -54,12 +62,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup name="testPopup">
|
<script lang="tsx" setup name="testPopup">
|
||||||
import {reactive, ref, watch} from 'vue';
|
import {nextTick, reactive, ref, watch} from 'vue';
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
import {Coin, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
import {Coin, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPause, VideoPlay} from '@element-plus/icons-vue'
|
||||||
import ComparePreTest from './comparePreTest.vue'
|
import ComparePreTest from './comparePreTest.vue'
|
||||||
@@ -79,7 +85,7 @@ const dialogVisible = ref(false)
|
|||||||
const showSteps = ref(false)
|
const showSteps = ref(false)
|
||||||
const stepsTotalNum = ref(-1);//步骤总数
|
const stepsTotalNum = ref(-1);//步骤总数
|
||||||
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||||
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
const stepsActiveView = ref(1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||||
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
||||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||||
const preTestStatus = ref('waiting');//预检测执行状态
|
const preTestStatus = ref('waiting');//预检测执行状态
|
||||||
@@ -89,7 +95,7 @@ const webMsgSend = ref();//webSocket推送的数据
|
|||||||
|
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('')
|
||||||
const showComponent = ref(true)
|
const showComponent = ref(true)
|
||||||
const preTestRef = ref(null)
|
const preTestRef = ref<InstanceType<typeof ComparePreTest> | null>(null)
|
||||||
const testRef = ref(null)
|
const testRef = ref(null)
|
||||||
|
|
||||||
const dataSocket = reactive({
|
const dataSocket = reactive({
|
||||||
@@ -97,7 +103,7 @@ const dataSocket = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 勾选的检测内容
|
// 勾选的检测内容
|
||||||
const preTestSelected = ref(false)
|
const preTestSelected = ref(true)
|
||||||
const testSelected = ref(false)
|
const testSelected = ref(false)
|
||||||
|
|
||||||
const initOperate = () => {
|
const initOperate = () => {
|
||||||
@@ -138,7 +144,11 @@ const loginName = ref('')
|
|||||||
const devIds = ref<[]>()
|
const devIds = ref<[]>()
|
||||||
const standardDevIds = ref<[]>()
|
const standardDevIds = ref<[]>()
|
||||||
const pairs = ref<any>()
|
const pairs = ref<any>()
|
||||||
const open = (title: string,mapping:any,plan: string,login: string,devIdsArray: [],standardDevIdsArray: [],pair:any) => {
|
const testAgain = ref(false)//重新检测按钮是否显示
|
||||||
|
const open = async (title: string,mapping:any,plan: string,login: string,devIdsArray: [],standardDevIdsArray: [],pair:any) => {
|
||||||
|
if(checkStore.selectTestItems.preTest && !checkStore.selectTestItems.test){
|
||||||
|
testAgain.value = true
|
||||||
|
}
|
||||||
channelMapping.value = mapping
|
channelMapping.value = mapping
|
||||||
planId.value = plan
|
planId.value = plan
|
||||||
loginName.value = login
|
loginName.value = login
|
||||||
@@ -150,6 +160,9 @@ const open = (title: string,mapping:any,plan: string,login: string,devIdsArray:
|
|||||||
dialogTitle.value = title;
|
dialogTitle.value = title;
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
|
|
||||||
|
// 等待组件渲染完成
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
if (preTestRef.value) {
|
if (preTestRef.value) {
|
||||||
preTestRef.value.initializeParameters();
|
preTestRef.value.initializeParameters();
|
||||||
}
|
}
|
||||||
@@ -159,7 +172,6 @@ const open = (title: string,mapping:any,plan: string,login: string,devIdsArray:
|
|||||||
dataSocket.socketServe = socketClient.Instance;
|
dataSocket.socketServe = socketClient.Instance;
|
||||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||||
// 处理来自服务器的消息
|
// 处理来自服务器的消息
|
||||||
// console.log('Received message:', res);
|
|
||||||
if (res.code === 20000) {
|
if (res.code === 20000) {
|
||||||
//ElMessage.error(message.message)
|
//ElMessage.error(message.message)
|
||||||
// loading.close()
|
// loading.close()
|
||||||
@@ -169,12 +181,48 @@ const open = (title: string,mapping:any,plan: string,login: string,devIdsArray:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//预检测-重新检测
|
||||||
|
const handleSubmitAgain = async () => {
|
||||||
|
stepsActiveIndex.value = 1
|
||||||
|
stepsActiveView.value = 1
|
||||||
|
stepsActive.value = 1
|
||||||
|
let count = 0
|
||||||
|
for (let key in checkStore.selectTestItems) {
|
||||||
|
if (checkStore.selectTestItems[key]) {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stepsTotalNum.value = count + 1
|
||||||
|
|
||||||
|
// 通知子组件清空并重新初始化
|
||||||
|
if (preTestRef.value) {
|
||||||
|
preTestRef.value.initializeParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置状态
|
||||||
|
ActiveStatue.value = 'waiting'
|
||||||
|
preTestStatus.value = 'waiting'
|
||||||
|
|
||||||
|
|
||||||
|
await contrastTest({
|
||||||
|
planId: planId.value,
|
||||||
|
loginName: loginName.value,
|
||||||
|
devIds: devIds.value,
|
||||||
|
standardDevIds: standardDevIds.value,
|
||||||
|
pairs:pairs.value,
|
||||||
|
testItemList:[checkStore.selectTestItems.preTest,false,checkStore.selectTestItems.test]
|
||||||
|
})
|
||||||
|
|
||||||
|
preTestStatus.value = 'start'
|
||||||
|
};
|
||||||
|
|
||||||
|
//开始检测
|
||||||
const handleSubmitFast = async () => {
|
const handleSubmitFast = async () => {
|
||||||
if (!dataSocket.socketServe.connected) {
|
if (!dataSocket.socketServe.connected) {
|
||||||
ElMessage.error('webSocket连接中断!')
|
ElMessage.error('webSocket连接中断!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log("handleSubmit", stepsActive.value, TestStatus.value)
|
console.log("handleSubmit", TestStatus.value)
|
||||||
switch (stepsActive.value) {
|
switch (stepsActive.value) {
|
||||||
case 1:
|
case 1:
|
||||||
if (preTestStatus.value == 'waiting') {
|
if (preTestStatus.value == 'waiting') {
|
||||||
@@ -212,18 +260,24 @@ const emit = defineEmits<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
watch(preTestStatus, function (newValue, oldValue) {
|
watch(preTestStatus, function (newValue, oldValue) {
|
||||||
console.log('预检测',newValue, oldValue);
|
console.log('预检测状态',newValue, oldValue);
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
ActiveStatue.value = newValue
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(TestStatus, function (newValue, oldValue) {
|
watch(TestStatus, function (newValue, oldValue) {
|
||||||
console.log(newValue, oldValue);
|
console.log('正式检测状态',newValue, oldValue);
|
||||||
|
|
||||||
ActiveStatue.value = newValue
|
ActiveStatue.value = newValue
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(stepsActiveIndex, function (newValue, oldValue) {
|
||||||
|
console.log('步骤索引',newValue, oldValue);
|
||||||
|
})
|
||||||
|
|
||||||
watch(ActiveStatue, function (newValue, oldValue) {
|
watch(ActiveStatue, function (newValue, oldValue) {
|
||||||
|
console.log('当前步骤状态-----',newValue);
|
||||||
|
console.log('stepsActiveIndex-----',stepsActiveIndex.value);
|
||||||
|
console.log('stepsTotalNum----',stepsTotalNum.value);
|
||||||
if (newValue === 'error') {
|
if (newValue === 'error') {
|
||||||
stepsActiveIndex.value = stepsTotalNum.value + 1
|
stepsActiveIndex.value = stepsTotalNum.value + 1
|
||||||
nextStepText.value = '检测失败'
|
nextStepText.value = '检测失败'
|
||||||
@@ -247,8 +301,7 @@ watch(ActiveStatue, function (newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
||||||
nextStep() // 实现自动点击,进入下一个测试内容
|
nextStep() // 实现自动点击,进入下一个测试内容
|
||||||
//handleSubmit()
|
//handleSubmitFast()
|
||||||
handleSubmitFast()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -327,17 +380,21 @@ const nextStep = () => {
|
|||||||
if (ActiveStatue.value != 'error') {
|
if (ActiveStatue.value != 'error') {
|
||||||
ActiveStatue.value = 'waiting'
|
ActiveStatue.value = 'waiting'
|
||||||
let tempStep = stepsActiveIndex.value
|
let tempStep = stepsActiveIndex.value
|
||||||
let idx = 1
|
let idx = -1
|
||||||
stepsActiveIndex.value++
|
stepsActiveIndex.value++
|
||||||
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
||||||
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
||||||
|
console.log('selectTestItemsKey1')
|
||||||
stepsActiveView.value = idx
|
stepsActiveView.value = idx
|
||||||
stepsActive.value = idx
|
stepsActive.value = idx
|
||||||
|
console.log('stepsActiveView.value999', stepsActiveView.value)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
||||||
|
console.log('selectTestItemsKey2')
|
||||||
tempStep--
|
tempStep--
|
||||||
}
|
}
|
||||||
|
console.log('selectTestItemsKey3',idx)
|
||||||
idx++
|
idx++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,22 +42,18 @@
|
|||||||
:cell-style="{ textAlign: 'center' }"
|
:cell-style="{ textAlign: 'center' }"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}">
|
:style="{ height: '400px',maxHeight: '400px',overflow:'hidden'}">
|
||||||
<el-table-column prop="monitorNum" label="数据时标" width="180"/>
|
|
||||||
<el-table-column :label="`${deviceName}-${selectedChannels[deviceName] || '通道1'}`">
|
<el-table-column :label="`${deviceName}-${selectedChannels[deviceName] || '通道1'}`">
|
||||||
<el-table-column prop="Ua1" label="A相(V)">
|
<el-table-column prop="timeDev" label="数据时标" width="200"/>
|
||||||
</el-table-column>
|
<el-table-column prop="uaDev" label="A相(V)"/>
|
||||||
<el-table-column prop="Ub1" label="B相(V)">
|
<el-table-column prop="ubDev" label="B相(V)"/>
|
||||||
</el-table-column>
|
<el-table-column prop="ucDev" label="C相(V)"/>
|
||||||
<el-table-column prop="Uc1" label="C相(V)">
|
|
||||||
</el-table-column>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="formatStandardChannelLabel(getMappedStandardChannel(deviceName, selectedChannels[deviceName]))">
|
<el-table-column :label="formatStandardChannelLabel(getMappedStandardChannel(deviceName, selectedChannels[deviceName]))">
|
||||||
<el-table-column prop="Ua2" label="A相(V)">
|
<el-table-column prop="timeStdDev" label="数据时标" width="200"/>
|
||||||
</el-table-column>
|
<el-table-column prop="uaStdDev" label="A相(V)"/>
|
||||||
<el-table-column prop="Ub2" label="B相(V)">
|
<el-table-column prop="uaStdDev" label="B相(V)"/>
|
||||||
</el-table-column>
|
<el-table-column prop="uaStdDev" label="C相(V)"/>
|
||||||
<el-table-column prop="Uc2" label="C相(V)">
|
|
||||||
</el-table-column>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -74,178 +70,201 @@ import { CircleCheck, CircleClose } from '@element-plus/icons-vue';
|
|||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
const activeTab = ref('channel1');
|
const activeTab = ref('channel1');
|
||||||
|
|
||||||
|
// 在 script setup 中定义接口
|
||||||
|
interface ChannelData {
|
||||||
|
devNum: string;
|
||||||
|
standardDevInfo: string;
|
||||||
|
dataList: {
|
||||||
|
timeDev: string | null;
|
||||||
|
uaDev: number | null;
|
||||||
|
ubDev: number | null;
|
||||||
|
ucDev: number | null;
|
||||||
|
timeStdDev: string | null;
|
||||||
|
uaStdDev: number | null;
|
||||||
|
ubStdDev: number | null;
|
||||||
|
ucStdDev: number | null;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DeviceData {
|
||||||
|
devName: string;
|
||||||
|
channelDataList: ChannelData[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改 testDataStructure 的类型声明
|
||||||
|
const testDataStructure = ref<Record<string, DeviceData>>({});
|
||||||
|
|
||||||
// 重构后的 testDataStructure
|
// 重构后的 testDataStructure
|
||||||
const testDataStructure = ref({
|
// const testDataStructure = ref({
|
||||||
"被检1": {
|
// "被检1": {
|
||||||
devName: "被检设备1",
|
// devName: "被检设备1",
|
||||||
channelDataList: [
|
// channelDataList: [
|
||||||
{
|
// {
|
||||||
devNum: "1",
|
// devNum: "1",
|
||||||
standardDevInfo: "标准设备1通道1",
|
// standardDevInfo: "标准设备1通道1",
|
||||||
dataList: [
|
// dataList: [
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.231",
|
// timeDev: "2025-09-02 14:00:02.231",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.234",
|
// timeDev: "2025-09-02 14:00:02.234",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: null,
|
// timeStdDev: null,
|
||||||
uaStdDev: null,
|
// uaStdDev: null,
|
||||||
ubStdDev: null,
|
// ubStdDev: null,
|
||||||
ucStdDev: null
|
// ucStdDev: null
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
timeDev: null,
|
// timeDev: null,
|
||||||
uaDev: null,
|
// uaDev: null,
|
||||||
ubDev: null,
|
// ubDev: null,
|
||||||
ucDev: null,
|
// ucDev: null,
|
||||||
timeStdDev: "2025-09-02 14:00:02.237",
|
// timeStdDev: "2025-09-02 14:00:02.237",
|
||||||
uaStdDev: 57.74,
|
// uaStdDev: 57.74,
|
||||||
ubStdDev: 57.74,
|
// ubStdDev: 57.74,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
devNum: "2",
|
// devNum: "2",
|
||||||
standardDevInfo: "标准设备2通道4",
|
// standardDevInfo: "标准设备2通道4",
|
||||||
dataList: [
|
// dataList: [
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.231",
|
// timeDev: "2025-09-02 14:00:02.231",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.231",
|
// timeDev: "2025-09-02 14:00:02.231",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.231",
|
// timeDev: "2025-09-02 14:00:02.231",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
"被检2": {
|
// "被检2": {
|
||||||
devName: "被检设备2",
|
// devName: "被检设备2",
|
||||||
channelDataList: [
|
// channelDataList: [
|
||||||
{
|
// {
|
||||||
devNum: "1",
|
// devNum: "1",
|
||||||
standardDevInfo: "标准设备1通道1",
|
// standardDevInfo: "标准设备1通道1",
|
||||||
dataList: [
|
// dataList: [
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.231",
|
// timeDev: "2025-09-02 14:00:02.231",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.234",
|
// timeDev: "2025-09-02 14:00:02.234",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.234",
|
// timeDev: "2025-09-02 14:00:02.234",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.237",
|
// timeStdDev: "2025-09-02 14:00:02.237",
|
||||||
uaStdDev: 57.74,
|
// uaStdDev: 57.74,
|
||||||
ubStdDev: 57.74,
|
// ubStdDev: 57.74,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
devNum: "3",
|
// devNum: "3",
|
||||||
standardDevInfo: "标准设备2通道4",
|
// standardDevInfo: "标准设备2通道4",
|
||||||
dataList: [
|
// dataList: [
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.231",
|
// timeDev: "2025-09-02 14:00:02.231",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.231",
|
// timeDev: "2025-09-02 14:00:02.231",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
timeDev: "2025-09-02 14:00:02.231",
|
// timeDev: "2025-09-02 14:00:02.231",
|
||||||
uaDev: 57.74,
|
// uaDev: 57.74,
|
||||||
ubDev: 57.74,
|
// ubDev: 57.74,
|
||||||
ucDev: 57.74,
|
// ucDev: 57.74,
|
||||||
timeStdDev: "2025-09-02 14:00:02.231",
|
// timeStdDev: "2025-09-02 14:00:02.231",
|
||||||
uaStdDev: 57.73,
|
// uaStdDev: 57.73,
|
||||||
ubStdDev: 57.73,
|
// ubStdDev: 57.73,
|
||||||
ucStdDev: 57.74
|
// ucStdDev: 57.74
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
// 每个设备选中的通道
|
// 每个设备选中的通道
|
||||||
const selectedChannels = ref<Record<string, string>>({});
|
const selectedChannels = ref<Record<string, string>>({});
|
||||||
|
|
||||||
// 通道映射关系:被检设备通道 -> 标准设备通道
|
// 通道映射关系:被检设备通道 -> 标准设备通道
|
||||||
const channelMapping = ref<Record<string, Record<string, string>>>({
|
const channelMapping = ref<Record<string, Record<string, string>>>({
|
||||||
'被检1': {
|
// '被检1': {
|
||||||
'通道1': '标准设备1通道2',
|
// '通道1': '标准设备1通道2',
|
||||||
'通道2': '标准设备2通道4',
|
// '通道2': '标准设备2通道4',
|
||||||
},
|
// },
|
||||||
'被检2': {
|
// '被检2': {
|
||||||
'通道1': '标准设备1通道3',
|
// '通道1': '标准设备1通道3',
|
||||||
'通道3': '标准设备2通道1'
|
// '通道3': '标准设备2通道1'
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
// 每个设备的表格数据
|
// 每个设备的表格数据
|
||||||
@@ -301,13 +320,14 @@ const generateTableData = (deviceName: string, dutChannel: string) => {
|
|||||||
// 生成表格数据
|
// 生成表格数据
|
||||||
return channelData.dataList.map(dataItem => {
|
return channelData.dataList.map(dataItem => {
|
||||||
return {
|
return {
|
||||||
monitorNum: dataItem.timeDev || dataItem.timeStdDev || '',
|
timeDev: dataItem.timeDev !== null ? dataItem.timeDev : '/',
|
||||||
Ua1: dataItem.uaDev !== null ? dataItem.uaDev : '/',
|
uaDev: dataItem.uaDev !== null ? dataItem.uaDev : '/',
|
||||||
Ub1: dataItem.ubDev !== null ? dataItem.ubDev : '/',
|
ubDev: dataItem.ubDev !== null ? dataItem.ubDev : '/',
|
||||||
Uc1: dataItem.ucDev !== null ? dataItem.ucDev : '/',
|
ucDev: dataItem.ucDev !== null ? dataItem.ucDev : '/',
|
||||||
Ua2: dataItem.uaStdDev !== null ? dataItem.uaStdDev : '/',
|
timeStdDev: dataItem.timeStdDev !== null ? dataItem.timeStdDev : '/',
|
||||||
Ub2: dataItem.ubStdDev !== null ? dataItem.ubStdDev : '/',
|
uaStdDev: dataItem.uaStdDev !== null ? dataItem.uaStdDev : '/',
|
||||||
Uc2: dataItem.ucStdDev !== null ? dataItem.ucStdDev : '/'
|
ubStdDev: dataItem.ubStdDev !== null ? dataItem.ubStdDev : '/',
|
||||||
|
ucStdDev: dataItem.ucStdDev !== null ? dataItem.ucStdDev : '/'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -339,10 +359,49 @@ const initAllTableData = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const open = async (mapping : Record<string, Record<string, string>>) => {
|
const open = async (mapping : Record<string, Record<string, string>>,data : any) => {
|
||||||
console.log('mapping11111111:', mapping);
|
let parsedData = data;
|
||||||
console.log('mapping22222222:',channelMapping);
|
|
||||||
//channelMapping.value = mapping;
|
// 如果 data 是字符串,先解析为对象
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
try {
|
||||||
|
parsedData = JSON.parse(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('数据解析失败:', error);
|
||||||
|
ElMessage.error('数据格式错误');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 转换数据格式以匹配组件期望的格式
|
||||||
|
const convertedData: Record<string, DeviceData> = {};
|
||||||
|
// 假设传入的数据是一个数组,需要转换为以设备名为键的对象
|
||||||
|
if (Array.isArray(parsedData)) {
|
||||||
|
parsedData.forEach((deviceItem: any) => {
|
||||||
|
const deviceName = deviceItem.devName;
|
||||||
|
convertedData[deviceName] = {
|
||||||
|
devName: deviceName,
|
||||||
|
channelDataList: deviceItem.channelDataList.map((channel: any) => ({
|
||||||
|
devNum: channel.devNum,
|
||||||
|
standardDevInfo: channel.standardDevInfo,
|
||||||
|
dataList: channel.dataList.map((dataItem: any) => ({
|
||||||
|
timeDev: dataItem.timeDev,
|
||||||
|
uaDev: dataItem.uaDev,
|
||||||
|
ubDev: dataItem.ubDev,
|
||||||
|
ucDev: dataItem.ucDev,
|
||||||
|
timeStdDev: dataItem.timeStdDev,
|
||||||
|
uaStdDev: dataItem.uaStdDev,
|
||||||
|
ubStdDev: dataItem.ubStdDev,
|
||||||
|
ucStdDev: dataItem.ucStdDev
|
||||||
|
}))
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} else if (parsedData && typeof parsedData === 'object') {
|
||||||
|
// 如果已经是期望的格式,直接使用
|
||||||
|
Object.assign(convertedData, parsedData);
|
||||||
|
}
|
||||||
|
testDataStructure.value = convertedData;
|
||||||
|
channelMapping.value = mapping;
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
// 初始化数据和状态
|
// 初始化数据和状态
|
||||||
initAllTableData();
|
initAllTableData();
|
||||||
|
|||||||
Reference in New Issue
Block a user