系数校准动态通道数
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
export namespace CheckData {
|
||||
export interface DataCheck {
|
||||
testScriptName: string,
|
||||
errorSysName: string,
|
||||
@@ -32,6 +33,11 @@ export interface RawDataItem {
|
||||
L3: number
|
||||
}
|
||||
|
||||
export interface Device {
|
||||
deviceId: string; //装置序号Id
|
||||
deviceName: string; //设备名称
|
||||
chnNum: number; //设备通道数
|
||||
}
|
||||
|
||||
// 用来描述检测脚本类型
|
||||
export interface ScriptItem {
|
||||
@@ -49,12 +55,12 @@ export enum ChnCheckResultEnum {
|
||||
|
||||
//用来描述 某个脚本测试项对所有通道的检测结果
|
||||
export interface ScriptChnItem {
|
||||
scriptID: string
|
||||
scriptItemName: string
|
||||
scriptId: string
|
||||
scriptItemName?: string //可以不要该属性,有点多余
|
||||
|
||||
// 设备
|
||||
devices: Array<{
|
||||
deviceID: string,
|
||||
deviceId: string,
|
||||
deviceName: string,
|
||||
chnResult: ChnCheckResultEnum[] //通道检测结果
|
||||
}>
|
||||
@@ -72,12 +78,12 @@ export interface ButtonResult {
|
||||
* 用于描述 脚本检测结果展示的按钮类型
|
||||
*/
|
||||
export interface ScriptChnViewItem {
|
||||
scriptID: string,
|
||||
scriptItemName: string //脚本项名称
|
||||
scriptId: string,
|
||||
scriptItemName?: string //脚本项名称,可以不要该属性,有点多余
|
||||
|
||||
// 设备
|
||||
devices: Array<{
|
||||
deviceID: string,
|
||||
deviceId: string,
|
||||
deviceName: string,
|
||||
chnResult: ButtonResult[],
|
||||
}>
|
||||
@@ -91,6 +97,8 @@ export interface LogItem {
|
||||
type: 'info' | 'error'
|
||||
log: string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5
frontend/src/api/check/test/index.ts
Normal file
5
frontend/src/api/check/test/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import http from "@/api";
|
||||
|
||||
export const getCheckItemDetail = (params: { checkItemId: string, deviceId: string, chnNum: number }) => {
|
||||
return http.post<any>("/check/test/detail/", params, {loading: false});
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
"isChildNode":true,
|
||||
"pid": "0-1",
|
||||
"id": "0-1-3",
|
||||
"name": "输入:频率 50.05Hz..."
|
||||
"name": "输入:频率 50.05Hz...."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
7
frontend/src/api/socket/socket.ts
Normal file
7
frontend/src/api/socket/socket.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Device } from '@/api/device/interface/device'
|
||||
import http from '@/api'
|
||||
|
||||
|
||||
export const startTest = (params) => {
|
||||
return http.post(`/prepare/startTest`, params,{ loading: false })
|
||||
}
|
||||
@@ -17,3 +17,5 @@ export const USER_STORE_KEY = "cn-user";
|
||||
// pinia中dict store的key
|
||||
export const DICT_STORE_KEY = "cn-dictData";
|
||||
|
||||
export const CHECK_STORE_KEY = "cn-check";
|
||||
|
||||
|
||||
24
frontend/src/stores/modules/check.ts
Normal file
24
frontend/src/stores/modules/check.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
|
||||
|
||||
export const useCheckStore = defineStore("check", {
|
||||
id: CHECK_STORE_KEY,
|
||||
|
||||
state: () => ({
|
||||
devices: Array<CheckData.Device>()
|
||||
}),
|
||||
|
||||
getters: {},
|
||||
|
||||
actions: {
|
||||
addDevices(device: CheckData.Device[]) {
|
||||
this.devices.push(...device);
|
||||
},
|
||||
|
||||
clearDevices() {
|
||||
this.devices = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
103
frontend/src/utils/webSocketClient.ts
Normal file
103
frontend/src/utils/webSocketClient.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
export default class SocketService {
|
||||
static instance = null;
|
||||
static get Instance() {
|
||||
if (!this.instance) {
|
||||
this.instance = new SocketService();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
// 和服务端连接的socket对象
|
||||
ws = null;
|
||||
// 存储回调函数
|
||||
callBackMapping = {};
|
||||
// 标识是否连接成功
|
||||
connected = false;
|
||||
// 记录重试的次数
|
||||
sendRetryCount = 0;
|
||||
// 重新连接尝试的次数
|
||||
connectRetryCount = 0;
|
||||
// 定义连接服务器的方法
|
||||
connect(url) {
|
||||
|
||||
// 连接服务器
|
||||
if (!window.WebSocket) {
|
||||
return console.log('您的浏览器不支持WebSocket');
|
||||
}
|
||||
console.log(url)
|
||||
// let token = $.cookie('123');
|
||||
// let token = '4E6EF539AAF119D82AC4C2BC84FBA21F';
|
||||
|
||||
|
||||
this.ws = new WebSocket(url);
|
||||
// 连接成功的事件
|
||||
this.ws.onopen = () => {
|
||||
ElMessage.success("webSocket连接服务端成功了");
|
||||
console.log('连接服务端成功了');
|
||||
this.connected = true;
|
||||
// 重置重新连接的次数
|
||||
this.connectRetryCount = 0;
|
||||
};
|
||||
// 1.连接服务端失败
|
||||
// 2.当连接成功之后, 服务器关闭的情况
|
||||
this.ws.onclose = () => {
|
||||
console.log('连接服务端失败');
|
||||
this.connected = false;
|
||||
this.connectRetryCount++;
|
||||
setTimeout(() => {
|
||||
// this.connect();
|
||||
}, 500 * this.connectRetryCount);
|
||||
};
|
||||
// 得到服务端发送过来的数据
|
||||
this.ws.onmessage = (event) => {
|
||||
let message: { [key: string]: any };
|
||||
try {
|
||||
message = JSON.parse(event.data);
|
||||
} catch (e) {
|
||||
return console.error("消息解析失败", event.data, e);
|
||||
}
|
||||
//console.log(message, "从服务端获取到了数据");
|
||||
/* 通过接受服务端发送的type字段来回调函数 */
|
||||
if (message?.type && this.callBackMapping[message.type]) {
|
||||
this.callBackMapping[message.type](message);
|
||||
} else {
|
||||
console.log("抛弃")
|
||||
/* 丢弃或继续写你的逻辑 */
|
||||
}
|
||||
};
|
||||
}
|
||||
// 回调函数的注册
|
||||
registerCallBack(socketType, callBack) {
|
||||
this.callBackMapping[socketType] = callBack;
|
||||
}
|
||||
// 取消某一个回调函数
|
||||
unRegisterCallBack(socketType) {
|
||||
this.callBackMapping[socketType] = null;
|
||||
}
|
||||
// 发送数据的方法
|
||||
send(data) {
|
||||
// 判断此时此刻有没有连接成功
|
||||
if (this.connected) {
|
||||
this.sendRetryCount = 0;
|
||||
try {
|
||||
this.ws.send(JSON.stringify(data));
|
||||
} catch (e) {
|
||||
this.ws.send(data);
|
||||
}
|
||||
} else {
|
||||
this.sendRetryCount++;
|
||||
setTimeout(() => {
|
||||
this.send(data);
|
||||
}, this.sendRetryCount * 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 断开方法
|
||||
closeWs() {
|
||||
if (this.connected) {
|
||||
this.ws.close()
|
||||
}
|
||||
console.log('WS关闭中..');
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ const errorStates = ref(new Array(name.value.length).fill(false));
|
||||
// 定义 TableDataItem 接口
|
||||
interface TableDataItem {
|
||||
id: string;
|
||||
deviceName: string;
|
||||
deviceName?: string;
|
||||
MonitorIdx: number;
|
||||
UaData?: number | string;
|
||||
UaChannel?: number | string;
|
||||
@@ -141,6 +141,135 @@ interface TableDataItem {
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
|
||||
// 定义每种状态的数据模板
|
||||
const dataTemplates = [
|
||||
{
|
||||
deviceName: '大电压大电流1',
|
||||
UaData: 57.74,
|
||||
UaChannel: 1.0003,
|
||||
UbData: 57.74,
|
||||
UbChannel: 1.0003,
|
||||
UcData: 57.74,
|
||||
UcChannel: 1.0003,
|
||||
IaData: 5,
|
||||
IaChannel: 1.0001,
|
||||
IbData: 5,
|
||||
IbChannel: 1.0001,
|
||||
IcData: 5,
|
||||
IcChannel: 1.0001,
|
||||
},
|
||||
{
|
||||
deviceName: '小电压小电流1',
|
||||
UaData: 57.74,
|
||||
UaChannel: 1.0003,
|
||||
UbData: 57.74,
|
||||
UbChannel: 1.0003,
|
||||
UcData: 57.74,
|
||||
UcChannel: 1.0003,
|
||||
IaData: 5,
|
||||
IaChannel: 1.0001,
|
||||
IbData: 5,
|
||||
IbChannel: 1.0001,
|
||||
IcData: 5,
|
||||
IcChannel: 1.0001,
|
||||
},
|
||||
{
|
||||
deviceName: '大电压大电流2',
|
||||
UaData: 57.74,
|
||||
UaChannel: '合格',
|
||||
UbData: 57.74,
|
||||
UbChannel: '合格',
|
||||
UcData: 57.74,
|
||||
UcChannel: '合格',
|
||||
IaData: 5,
|
||||
IaChannel: '合格',
|
||||
IbData: 5,
|
||||
IbChannel: '合格',
|
||||
IcData: 5,
|
||||
IcChannel: '合格',
|
||||
},
|
||||
{
|
||||
deviceName: '小电压小电流2',
|
||||
UaData: 57.74,
|
||||
UaChannel: '合格',
|
||||
UbData: 57.74,
|
||||
UbChannel: '合格',
|
||||
UcData: 57.74,
|
||||
UcChannel: '合格',
|
||||
IaData: 5,
|
||||
IaChannel: '合格',
|
||||
IbData: 5,
|
||||
IbChannel: '合格',
|
||||
IcData: 5,
|
||||
IcChannel: '合格',
|
||||
},
|
||||
];
|
||||
|
||||
// 定义每种状态的数据模板
|
||||
const dataTemplates2 = [
|
||||
{
|
||||
deviceName: '大电压大电流1',
|
||||
UaData: 57.74,
|
||||
UaChannel: 1.0003,
|
||||
UbData: 57.74,
|
||||
UbChannel: 1.0003,
|
||||
UcData: 57.74,
|
||||
UcChannel: 1.0003,
|
||||
IaData: 5,
|
||||
IaChannel: 1.0001,
|
||||
IbData: 5,
|
||||
IbChannel: 1.0001,
|
||||
IcData: 5,
|
||||
IcChannel: 1.0001,
|
||||
},
|
||||
{
|
||||
deviceName: '小电压小电流1',
|
||||
UaData: 57.74,
|
||||
UaChannel: 1.0003,
|
||||
UbData: 57.74,
|
||||
UbChannel: 1.0003,
|
||||
UcData: 57.74,
|
||||
UcChannel: 1.0003,
|
||||
IaData: 5,
|
||||
IaChannel: 1.0001,
|
||||
IbData: 5,
|
||||
IbChannel: 1.0001,
|
||||
IcData: 5,
|
||||
IcChannel: 1.0001,
|
||||
},
|
||||
{
|
||||
deviceName: '大电压大电流2',
|
||||
UaData: 57.74,
|
||||
UaChannel: '不合格',
|
||||
UbData: 57.74,
|
||||
UbChannel: '合格',
|
||||
UcData: 57.74,
|
||||
UcChannel: '合格',
|
||||
IaData: 5,
|
||||
IaChannel: '合格',
|
||||
IbData: 5,
|
||||
IbChannel: '合格',
|
||||
IcData: 5,
|
||||
IcChannel: '合格',
|
||||
},
|
||||
{
|
||||
deviceName: '小电压小电流2',
|
||||
UaData: 57.74,
|
||||
UaChannel: '合格',
|
||||
UbData: 57.74,
|
||||
UbChannel: '合格',
|
||||
UcData: 57.74,
|
||||
UcChannel: '合格',
|
||||
IaData: 5,
|
||||
IaChannel: '不合格',
|
||||
IbData: 5,
|
||||
IbChannel: '合格',
|
||||
IcData: 5,
|
||||
IcChannel: '合格',
|
||||
},
|
||||
];
|
||||
|
||||
// 更新错误状态的方法
|
||||
const updateErrorState = (index: number, hasError: boolean) => {
|
||||
errorStates.value[index] = hasError;
|
||||
@@ -175,6 +304,7 @@ const activities = [
|
||||
hollow: true,
|
||||
},
|
||||
]
|
||||
|
||||
const tableData1 = ref<TableDataItem[]>([
|
||||
{
|
||||
id: '1',
|
||||
@@ -464,12 +594,12 @@ const tableData3 = ref<TableDataItem[]>([
|
||||
|
||||
|
||||
const tableDataMap = new Map<number, Ref<TableDataItem[]>>([
|
||||
[0, tableData1],
|
||||
[1, tableData2],
|
||||
[2, tableData3],
|
||||
[3, tableData1],
|
||||
[4, tableData1],
|
||||
[5, tableData1],
|
||||
// [0, tableData1],
|
||||
// [1, tableData2],
|
||||
// [2, tableData3],
|
||||
// [3, tableData1],
|
||||
// [4, tableData1],
|
||||
// [5, tableData1],
|
||||
]);
|
||||
|
||||
|
||||
@@ -498,6 +628,29 @@ const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process
|
||||
channel.value = selection.map(item => item.devChns)
|
||||
dialogVisible.value = true;
|
||||
total.value = name.value.length
|
||||
|
||||
|
||||
// 循环生成数据
|
||||
for (let i = 0; i < channel.value.length; i++) {
|
||||
const currentTableData = ref<TableDataItem[]>([]);
|
||||
|
||||
|
||||
// 随机选择 dataTemplates 或 dataTemplates2
|
||||
const selectedTemplates = Math.random() < 0.5 ? dataTemplates : dataTemplates2;
|
||||
|
||||
for(let j = 0; j < channel.value[i]; j++){
|
||||
const id = (j + 1).toString();
|
||||
selectedTemplates.forEach((template) => {
|
||||
currentTableData.value.push({
|
||||
id: id,
|
||||
MonitorIdx: j + 1,
|
||||
...template,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
tableDataMap.set(i,currentTableData)
|
||||
}
|
||||
}
|
||||
|
||||
const handleCancel=() => {
|
||||
|
||||
@@ -10,33 +10,33 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="standardValue" label="标准值(V)"/>
|
||||
<el-table-column label="L1(V)">
|
||||
<el-table-column prop="L1" width="80" label="被检值">
|
||||
<el-table-column prop="L1" width="75" label="被检值">
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="L1_errValue" width="80" label="误差值">
|
||||
<el-table-column prop="L1_errValue" width="75" label="误差值">
|
||||
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="L2(V)">
|
||||
<el-table-column prop="L2" width="80" label="被检值">
|
||||
<el-table-column prop="L2" width="75" label="被检值">
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="L2_errValue" width="80" label="误差值">
|
||||
<el-table-column prop="L2_errValue" width="75" label="误差值">
|
||||
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="L3(V)">
|
||||
<el-table-column prop="L3" width="80" label="被检值">
|
||||
<el-table-column prop="L3" width="75" label="被检值">
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="L3_errValue" width="80" label="误差值">
|
||||
<el-table-column prop="L3_errValue" width="75" label="误差值">
|
||||
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column prop="maxErrVaule" width="130" label="最大误差(V)">
|
||||
<el-table-column prop="maxErrVaule" width="110" label="最大误差(V)">
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="result" label="检测结果">
|
||||
<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>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div class="content-tree">
|
||||
<el-tree :default-expanded-keys="['0', '0-1', '0-2', '0-3', '1']" node-key="id" :data="treeData"
|
||||
<el-tree :default-expanded-keys="['0', '0-2']" node-key="id" :data="treeData"
|
||||
:props="defaultProps" @node-click="handleNodeClick"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -65,7 +65,7 @@ import {dialogBig} from '@/utils/elementBind'
|
||||
import {reactive, ref} from 'vue'
|
||||
import DataCheckResultTable from './dataCheckResultTable.vue'
|
||||
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
|
||||
import type {CheckResult, DataCheck, RawDataItem} from "@/api/check/interface";
|
||||
import {CheckData} from "@/api/check/interface";
|
||||
import {data as treeData} from "@/api/plan/autoTest.json";
|
||||
|
||||
const {appendToBody} = withDefaults(defineProps<{
|
||||
@@ -73,7 +73,7 @@ const {appendToBody} = withDefaults(defineProps<{
|
||||
}>(), {appendToBody: false})
|
||||
|
||||
|
||||
const formContent = reactive<DataCheck>({
|
||||
const formContent = reactive<CheckData.DataCheck>({
|
||||
testScriptName: 'Q/GDW 10650.4-2021 模拟式',
|
||||
errorSysName: 'Q/GDW 10650.2-2021',
|
||||
dataRule: '所有值',
|
||||
@@ -128,7 +128,7 @@ const handleNodeClick = (data: any) => {
|
||||
console.log(data);
|
||||
};
|
||||
|
||||
const checkResultTableData = reactive<CheckResult[]>([
|
||||
const checkResultTableData = reactive<CheckData.CheckResult[]>([
|
||||
{
|
||||
chnNum: '1',
|
||||
standardValue: 57.74,
|
||||
@@ -143,7 +143,7 @@ const checkResultTableData = reactive<CheckResult[]>([
|
||||
}
|
||||
])
|
||||
|
||||
const rawTableData = reactive<RawDataItem[]>([
|
||||
const rawTableData = reactive<CheckData.RawDataItem[]>([
|
||||
{
|
||||
updateTime: "2024-10-10 09:30:00",
|
||||
L1: 57.73,
|
||||
@@ -279,9 +279,10 @@ const close = () => {
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
const open = (deviceItem: any, chnNum?: number) => {
|
||||
const open = (checkItemId: string, deviceId: string, chnNum?: number) => {
|
||||
console.log(checkItemId, deviceId, chnNum);
|
||||
// 发起后端请求,查询详细信息
|
||||
// const deviceItem = await getDetail(planId,checkItemId,deviceItem.id, chnNum)
|
||||
//const result = await getCheckItemDetail({checkItemId,deviceId, chnNum})
|
||||
|
||||
// 数据处理
|
||||
// checkResultTableData=[];
|
||||
@@ -302,7 +303,7 @@ defineExpose({
|
||||
flex-direction: column;
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
|
||||
|
||||
.data-check-dialog {
|
||||
display: flex;
|
||||
@@ -315,30 +316,30 @@ defineExpose({
|
||||
}
|
||||
|
||||
.data-check-body {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
|
||||
.content-left-tree {
|
||||
width: 25%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
max-height: 473px;
|
||||
|
||||
padding: 10px 0;
|
||||
border: 1px solid #ccc;
|
||||
|
||||
overflow: auto;
|
||||
.content-tree {
|
||||
width: 250px;
|
||||
max-width: 250px;
|
||||
height: 450px;
|
||||
max-height: 450px;
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
min-width: 100%;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.content-right {
|
||||
width: 75%;
|
||||
margin-left: 10px;
|
||||
flex: 1;
|
||||
|
||||
@@ -360,4 +361,5 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -62,6 +62,8 @@
|
||||
|
||||
</template>
|
||||
<script lang="tsx" setup name="preTest">
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const step1InitLog = ref([
|
||||
{
|
||||
type: 'info',
|
||||
@@ -206,28 +208,133 @@ const props = defineProps({
|
||||
testStatus: {
|
||||
type: String,
|
||||
default: 'wait'
|
||||
},
|
||||
webMsgSend: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const testStatus = toRef(props, 'testStatus');
|
||||
const webMsgSend = toRef(props, 'webMsgSend');
|
||||
const ts = ref('');
|
||||
|
||||
watch(webMsgSend,function (newValue,oldValue){
|
||||
console.log(newValue)
|
||||
|
||||
switch (newValue.requestId){
|
||||
case 'yjc_ytxjy':
|
||||
switch (newValue.operateCode){
|
||||
case 'INIT_GATHER':
|
||||
if(newValue.code == 10200) {
|
||||
step1InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '源校验成功!',
|
||||
})
|
||||
activeIndex.value++
|
||||
}else if(newValue.code == 10201){
|
||||
step1InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行源校验!',
|
||||
}];
|
||||
}else if(newValue.code == 10552){
|
||||
ElMessage.error(newValue.code)
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 'yjc_sbtxjy':
|
||||
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step2InitLog.value.push({
|
||||
type: 'info',
|
||||
log: newValue.data+'设备通讯校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行设备通讯校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value++
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'yjc_xyjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$02':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '实时数据协议校验:'+newValue.data+'通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$03':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '暂态数据协议校验:'+newValue.data+'通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value++
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'YJC_xujy':
|
||||
break;
|
||||
case 'quit':
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
watch(activeIndex, function (newValue, oldValue) {
|
||||
|
||||
console.log(activeIndex.value)
|
||||
if (activeIndex.value === 1) {
|
||||
step1InitLog.value.length = 0;
|
||||
step1InitLog.value = step1Log.value;
|
||||
|
||||
}
|
||||
if (activeIndex.value === 2) {
|
||||
step2InitLog.value.length = 0;
|
||||
step2InitLog.value = step2Log.value;
|
||||
|
||||
}
|
||||
if (activeIndex.value === 3) {
|
||||
step3InitLog.value.length = 0;
|
||||
step3InitLog.value = step3Log.value;
|
||||
|
||||
}
|
||||
if (activeIndex.value > 3) {
|
||||
step4InitLog.value.length = 0;
|
||||
step4InitLog.value = step4Log.value;
|
||||
|
||||
}
|
||||
if (activeIndex.value < activeTotalNum.value - 2)
|
||||
collapseActiveName.value = (newValue + 1).toString()
|
||||
@@ -241,7 +348,7 @@ watch(testStatus, function (newValue, oldValue) {
|
||||
if (ts.value === 'start') {
|
||||
ts.value = 'process'
|
||||
|
||||
let timer = setInterval(() => {
|
||||
/*let timer = setInterval(() => {
|
||||
if (activeIndex.value < activeTotalNum.value - 2)
|
||||
activeIndex.value++
|
||||
else if (activeIndex.value === activeTotalNum.value - 2) {
|
||||
@@ -253,7 +360,15 @@ watch(testStatus, function (newValue, oldValue) {
|
||||
ts.value = 'success'
|
||||
}
|
||||
|
||||
}, 1500);
|
||||
}, 1500);*/
|
||||
}else if(ts.value === 'waiting'){
|
||||
activeIndex.value = 0
|
||||
step1InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -255,8 +255,12 @@ import { onMounted, reactive, ref, watch } from "vue";
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import ChannelsTest from './channelsTest.vue'
|
||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||
import {useCheckStore} from '@/stores/modules/check'
|
||||
import {CheckData} from '@/api/check/interface'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const checkStore = useCheckStore()
|
||||
|
||||
let devNum = 0;//当前选取的被检设备数量
|
||||
let devChannelsNum = 0;//当前选择的被检设备通道总数
|
||||
let devTestedNum = 0;//当前选择的已完成检测的被检设备数量
|
||||
@@ -555,6 +559,18 @@ const handleSelectionChange = (selection: any[]) => {
|
||||
{
|
||||
testType= "reTest";
|
||||
}
|
||||
let devices: CheckData.Device[] = selection.map((item: any) => {
|
||||
return {
|
||||
deviceId: item.id,
|
||||
deviceName: item.name,
|
||||
deviceType: item.devType,
|
||||
chnNum: item.devChns,
|
||||
}
|
||||
});
|
||||
checkStore.clearDevices()
|
||||
checkStore.addDevices(devices)
|
||||
|
||||
|
||||
}
|
||||
|
||||
//查询
|
||||
@@ -791,7 +807,6 @@ const handleTest = async (val:string) => {
|
||||
}
|
||||
else
|
||||
{
|
||||
//ElMessage.success(val);
|
||||
dialogTitle.value = val;
|
||||
testPopup.value?.open(channelsSelection.value,dialogTitle.value,props.isTimeCheck)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key" />
|
||||
</el-steps>
|
||||
</div>
|
||||
<preTest v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus"></preTest>
|
||||
<preTest v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
|
||||
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
||||
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus"></test>
|
||||
@@ -25,6 +25,7 @@
|
||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled" @click="nextStep">跳过</el-button>
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
||||
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'process'" @click="handleSubmit">停止检测</el-button>
|
||||
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button>
|
||||
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
|
||||
<el-button type="primary" :icon="Right" v-if="ActiveStatue === 'success'" @click="nextStep">{{nextStepText}}</el-button>
|
||||
</div>
|
||||
@@ -35,17 +36,29 @@
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup name="testPopup">
|
||||
import { h } from 'vue';
|
||||
import{ElMessage, ElMessageBox, ElSelectV2, FormInstance,FormItemRule}from'element-plus'
|
||||
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
||||
import { dialogBig,dialogMiddle} from '@/utils/elementBind'
|
||||
import {h, reactive, ref, watch} from 'vue';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
||||
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument,Edit, Picture, UploadFilled, SuccessFilled,VideoPlay,Right,Refresh,Close, Odometer,Coin,Key, DArrowRight} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import {
|
||||
Close,
|
||||
Coin,
|
||||
DArrowRight,
|
||||
Edit,
|
||||
Key,
|
||||
Odometer,
|
||||
Refresh,
|
||||
Right,
|
||||
SuccessFilled,
|
||||
UploadFilled,
|
||||
VideoPlay
|
||||
} from '@element-plus/icons-vue'
|
||||
import preTest from './preTest.vue'
|
||||
import timeTest from './timeTest.vue'
|
||||
import channelsTest from './channelsTest.vue'
|
||||
import { Device } from '@/api/device/interface/device';
|
||||
import socketClient from '@/utils/webSocketClient';
|
||||
import {startTest} from '@/api/socket/socket'
|
||||
|
||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
||||
|
||||
// import preTestIcon from '@/assets/icons/preTest.svg'
|
||||
@@ -126,11 +139,15 @@ const detectionOptions = ref([
|
||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||
const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
||||
const TestStatus = ref('waiting');//正式检测执行状态
|
||||
const webMsgSend = ref();//webSocket推送的数据
|
||||
|
||||
const dialogTitle = ref('');
|
||||
const isTimeCheck = ref(false)
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (selection: Device.ResPqDev[],title: string,time:boolean) => {
|
||||
|
||||
|
||||
const checkStates = selection.map(item => item.checkState);
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
||||
|
||||
@@ -150,8 +167,101 @@ const detectionOptions = ref([
|
||||
dialogTitle.value = title;
|
||||
dialogVisible.value = true;
|
||||
isTimeCheck.value = time
|
||||
preTestStatus.value = 'waiting';//预检测执行状态
|
||||
//开始创建webSocket客户端
|
||||
const data = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
const url = 'ws://localhost:7777/hello?name=cdf';
|
||||
socketClient.Instance.connect(url);
|
||||
data.socketServe = socketClient.Instance;
|
||||
data.socketServe.registerCallBack('aaa', (res) => {
|
||||
// 处理来自服务器的消息
|
||||
console.log('Received message:', res);
|
||||
// 根据需要在这里添加更多的处理逻辑
|
||||
|
||||
if(res.code === 20000){
|
||||
ElMessage.error(message.message)
|
||||
loading.close()
|
||||
}else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* else if(res.code === 10200){
|
||||
switch (res.operateCode){
|
||||
case 'INIT_GATHER':
|
||||
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
}else if(res.code === 10201){
|
||||
switch (res.operateCode){
|
||||
case 'INIT_GATHER':
|
||||
//开始进入源初始化检测
|
||||
|
||||
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
let loading;
|
||||
const handleSubmit = () => {
|
||||
skipDisabled.value = true
|
||||
console.log('=============',stepsActiveIndex.value)
|
||||
switch (stepsActiveIndex.value) {
|
||||
case 0:
|
||||
preTestStatus.value = 'start'
|
||||
|
||||
|
||||
/* loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '',
|
||||
background: 'rgb(255, 255, 255, 0)',
|
||||
})*/
|
||||
// startTest({
|
||||
// userPageId: "cdf",
|
||||
// devIds:["5eaba83670ff4d9daf892a62a5e13ea3","80b4b4f52a4c4064a18319525f8ac13c"],
|
||||
// //planId:"31cc203f3fa94fa39323ae7cc411cd66"
|
||||
// }).then(res=>{
|
||||
//
|
||||
//
|
||||
//
|
||||
// })
|
||||
break;
|
||||
case 1:
|
||||
timeTestStatus.value = 'start'
|
||||
break;
|
||||
// case 2:
|
||||
// channelsTestStatus.value = 'start'
|
||||
// break;
|
||||
case 2:
|
||||
if (TestStatus.value == "waiting") {
|
||||
TestStatus.value = 'start'
|
||||
} else if (TestStatus.value == 'process') {
|
||||
TestStatus.value = 'paused'
|
||||
} else if (TestStatus.value == 'paused') {
|
||||
TestStatus.value = 'process'
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
watch(preTestStatus,function(newValue,oldValue){
|
||||
console.log(newValue,oldValue);
|
||||
|
||||
@@ -264,28 +374,8 @@ const getIcon = (index: number) => {
|
||||
|
||||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
skipDisabled.value = true
|
||||
switch (stepsActiveIndex.value) {
|
||||
case 0:
|
||||
preTestStatus.value = 'start'
|
||||
break;
|
||||
case 1:
|
||||
timeTestStatus.value = 'start'
|
||||
break;
|
||||
// case 2:
|
||||
// channelsTestStatus.value = 'start'
|
||||
// break;
|
||||
case 2:
|
||||
TestStatus.value = 'start'
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
// // 当 props.visible 改变时,更新 formData
|
||||
// watch(() => props.visible, (newVal) => {
|
||||
// if (!newVal) {
|
||||
|
||||
@@ -430,8 +430,6 @@ onBeforeMount(async () => {
|
||||
};
|
||||
planList.value = (await getPlanListByPattern(reqPlan)) as ResultData<Plan.ReqPlan[]>;
|
||||
|
||||
console.log('qqq', planList.value)
|
||||
|
||||
if (planList.value.data[0].children[0]) {
|
||||
currentId.value = planList.value.data[0].children[0].id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user