数模没有标准设备

This commit is contained in:
sjl
2025-08-15 08:37:35 +08:00
parent 83c8dc5f19
commit 61b87304e6
9 changed files with 56 additions and 230 deletions

View File

@@ -203,6 +203,7 @@ export namespace CheckData {
//描述比对式检测项描述 //描述比对式检测项描述
export interface CompareTestItem { export interface CompareTestItem {
id: string, id: string,
code: string,
name: string, name: string,
} }
} }

View File

@@ -1,3 +1,4 @@
import { pa } from 'element-plus/es/locale/index.mjs';
import http from "@/api"; import http from "@/api";
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
@@ -5,6 +6,7 @@ export const getBigTestItem = (params: {
reCheckType: number, reCheckType: number,
planId: string, planId: string,
devIds: string[], devIds: string[],
patternId: string
}) => { }) => {
return http.post(`/adPlan/getBigTestItem`, params, {loading: false}); return http.post(`/adPlan/getBigTestItem`, params, {loading: false});
} }

View File

@@ -14,7 +14,6 @@ export const useCheckStore = defineStore(CHECK_STORE_KEY, {
showDetailType: 0, // 0:数据查询 1:误差体系跟换 2正式检测 showDetailType: 0, // 0:数据查询 1:误差体系跟换 2正式检测
temperature: 0, temperature: 0,
humidity: 0, humidity: 0,
compareTestItem: [] as CheckData.CompareTestItem[],
}), }),
getters: {}, getters: {},
actions: { actions: {
@@ -55,11 +54,6 @@ export const useCheckStore = defineStore(CHECK_STORE_KEY, {
setHumidity(humidity: number) { setHumidity(humidity: number) {
this.humidity = humidity this.humidity = humidity
}, },
setCompareTestItem(testItem: CheckData.CompareTestItem[]) {
this.compareTestItem.push(...testItem);
},
clearCompareTestItem() {
this.compareTestItem = [];
},
} }
}); });

View File

@@ -35,9 +35,9 @@
: row.devices[index1].chnResult[index2].icon==='WarnTriangleFilled' ? '数据异常' : row.devices[index1].chnResult[index2].icon==='WarnTriangleFilled' ? '数据异常'
: row.devices[index1].chnResult[index2].icon==='Loading'? '检测中':'连接中断'" : row.devices[index1].chnResult[index2].icon==='Loading'? '检测中':'连接中断'"
placement="right"> placement="right">
<!-- :disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING" -->
<el-button
<el-button
: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(item,chnItem,row.scriptType)" @click="handleClick(item,chnItem,row.scriptType)"
@@ -87,10 +87,12 @@ import {ElMessage, ElMessageBox} from "element-plus";
import {getBigTestItem} from "@/api/check/test"; import {getBigTestItem} from "@/api/check/test";
import {getAutoGenerate} from "@/api/user/login"; import {getAutoGenerate} from "@/api/user/login";
import {generateDevReport} from "@/api/plan/plan"; import {generateDevReport} from "@/api/plan/plan";
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { useDictStore } from '@/stores/modules/dict'
const checkStore = useCheckStore() const checkStore = useCheckStore()
const modeStore = useModeStore()
const dictStore = useDictStore()
// 最大通道数 // 最大通道数
const MAX_CHN_SUM = 12 const MAX_CHN_SUM = 12
@@ -158,7 +160,6 @@ const chnSum = computed(() => {
// 用来展示的检测结果 // 用来展示的检测结果
const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(() => { const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(() => {
let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => { let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => {
let temp: CheckData.ScriptChnViewItem = { let temp: CheckData.ScriptChnViewItem = {
scriptType: item.scriptType, scriptType: item.scriptType,
@@ -238,95 +239,8 @@ let count = 0
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') {
handleStartItem('V', 'newValue.desc')
if (props.stepsActive === 4) { if (props.stepsActive === 4) {
if (newValue.code == 10520) {
ElMessageBox.alert('报文解析异常!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:报文解析异常!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10521) {
ElMessageBox.alert('程控源參数有误!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:程控源參数有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10522) {
ElMessageBox.alert('测试项解析有误!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:测试项解析有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10523) {
if (count === 0) {
ElMessageBox.alert('源连接失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源连接失败!`})
emit('update:testStatus', 'test_init_fail')
count++
}
} else if (newValue.code == 10524) {
ElMessageBox.alert('获取源控制权失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:获取源控制权失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10525) {
ElMessageBox.alert('重置源失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:重置源失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10527) {
ElMessageBox.alert('源未进行初始化!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源未进行初始化!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10528) {
ElMessageBox.alert('目标源有误(该用户已控制其他源,在关闭前无法操作新的源)', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:目标源有误(该用户已控制其他源,在关闭前无法操作新的源)`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10529) {
ElMessageBox.alert('源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10550) {
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备连接异常!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10551) {
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备触发报告异常!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10552) { //todo 10552之后还会发送消息吗
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({
type: 'error',
log: `${new Date().toLocaleString()}:存在已经初始化步骤,执行自动关闭,请重新发起检测!`
})
// emit('update:testStatus', 'recheck')
emit('update:testStatus', 'test_init_fail')
} else {
switch (newValue.requestId) { switch (newValue.requestId) {
case 'server_error': case 'server_error':
if (newValue.operateCode === 'server_error' && count === 0) { if (newValue.operateCode === 'server_error' && count === 0) {
@@ -473,17 +387,11 @@ watch(webMsgSend, function (newValue, oldValue) {
pauseSuccessCallback() pauseSuccessCallback()
} }
break; break;
// case 'Pause_Fail':
// ElMessage.error('暂停失败')
// break;
case 'Resume_Success': case 'Resume_Success':
ElMessage.success('开始继续检测') ElMessage.success('开始继续检测')
emit('update:testStatus', 'process') emit('update:testStatus', 'process')
handleResumeTest() handleResumeTest()
break; break;
// case 'Resume_Fail':
// ElMessage.error('无法继续检测')
// break;
case 'FREQ_Start': case 'FREQ_Start':
handleStartItem('FREQ', newValue.desc) handleStartItem('FREQ', newValue.desc)
break; break;
@@ -562,11 +470,16 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
} }
} }
}
}, {deep: true}) }, {deep: true})
const handleStartItem = (code: string, desc: string | undefined) => { const handleStartItem = (code: string, desc: string | undefined) => {
if (desc === undefined) {
console.log('开始检测项:', code)
updateCheckResultView(code, true) // 更新界面为加载状态
} else {
// 子测试项开始
testLogList.push({ type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始` })
}
} }
const handleEndItem = (code: string, desc: string | undefined, devices: CheckData.DeviceCheckResult[] = []) => { const handleEndItem = (code: string, desc: string | undefined, devices: CheckData.DeviceCheckResult[] = []) => {
@@ -639,15 +552,26 @@ const showTestLog = () => {
// 初始化检测脚本数据 // 初始化检测脚本数据
const initScriptData = async () => { const initScriptData = async () => {
let temp = checkStore.compareTestItem.map(item => { const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '';
let response: any = await getBigTestItem({
reCheckType: checkStore.reCheckType,
planId: checkStore.plan.id,
devIds: checkStore.devices.map(item => item.deviceId),
patternId: pattern
})
// 格式化脚本数据
let temp = response.data.map((item: any) => {
return { return {
id: item.id, ...item,
code: '', scriptName: item.scriptName,
scriptName: item.name
} }
}) })
// 保存脚本数据并设置总数
scriptData.push(...temp) scriptData.push(...temp)
checkTotal = scriptData.length checkTotal = scriptData.length
} }
// 初始化设备列表 // 初始化设备列表
const initDeviceList = () => { const initDeviceList = () => {
@@ -861,86 +785,6 @@ const pauseSuccessCallback = () => {
console.log('暂停中') console.log('暂停中')
}; };
const todoItem = (code: string) => {
emit('update:webMsgSend', {
requestId: `${code}_Start`
})
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_Start`,
desc: '输入频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
})
}
}, 1000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
desc: '输入频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 1, 1, 1],
deviceId: "e90c09c0905248ad912e19e17a8672aa",
deviceName: "250226001"
}]
})
}
}, 2000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_Start`,
desc: '输入频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
})
}
}, 3000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
desc: '输入频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 1, 1, 1],
deviceId: "e90c09c0905248ad912e19e17a8672aa",
deviceName: "250226001"
}]
})
}
}, 5000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_Start`,
desc: '输入频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
})
}
}, 6000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
desc: '输入频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 1, 1, 1],
deviceId: "e90c09c0905248ad912e19e17a8672aa",
deviceName: "250226001"
}]
})
}
}, 8000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
data: [{
chnResult: [1, 2, 1, 1],
deviceId: "e90c09c0905248ad912e19e17a8672aa",
deviceName: "250226001"
}]
})
}
}, 9000)
}
const handleResumeTest = () => { const handleResumeTest = () => {
//activeIndex++ //activeIndex++
@@ -951,11 +795,6 @@ const handleResumeTest = () => {
console.log('开始继续检测') console.log('开始继续检测')
}; };
defineExpose({ defineExpose({
handlePause handlePause
}) })

View File

@@ -172,6 +172,7 @@ const open = async (title: string,mapping:any,plan: string,login: string,devIdsA
socketClient.Instance.connect(); socketClient.Instance.connect();
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)
@@ -228,7 +229,6 @@ const handleSubmitFast = async () => {
const checkNum = await mapValue() const checkNum = await mapValue()
switch (stepsActive.value) { switch (stepsActive.value) {
case 1: case 1:
if (preTestStatus.value == 'waiting') { if (preTestStatus.value == 'waiting') {
@@ -242,14 +242,24 @@ const handleSubmitFast = async () => {
testItemList:[checkStore.selectTestItems.preTest,false,checkStore.selectTestItems.test], testItemList:[checkStore.selectTestItems.preTest,false,checkStore.selectTestItems.test],
num: checkNum num: checkNum
}) })
preTestStatus.value = 'start' preTestStatus.value = 'start'
} }
} }
break; break;
case 2: case 2:
if (TestStatus.value == "waiting") { if (TestStatus.value == "waiting") {
// 如果没有预检测,直接进行正式检测需要先初始化
if (!checkStore.selectTestItems.preTest && checkStore.selectTestItems.test) {
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],
num: checkNum
})
}
TestStatus.value = 'start' TestStatus.value = 'start'
} else if (TestStatus.value == 'paused') { } else if (TestStatus.value == 'paused') {
// 发送继续指令 // 发送继续指令

View File

@@ -50,8 +50,6 @@ const open = async () => {
checkStore.setSelectTestItems(formContent) checkStore.setSelectTestItems(formContent)
dialogVisible.value = true dialogVisible.value = true
if(modeStore.currentMode === '比对式'){ if(modeStore.currentMode === '比对式'){
channelsTestShow.value = false channelsTestShow.value = false
}else{ }else{
if(AppSceneStore.currentScene === '1'){ if(AppSceneStore.currentScene === '1'){

View File

@@ -729,29 +729,6 @@ const handleTest2 = () => {
return return
} }
// 获取选中计划的数据源配置
const dataSources = ref([])
const matchedItem = props.planTable.data.find(item => item.name === props.plan.name)
if (matchedItem) {
dataSources.value = matchedItem.datasourceIds
}
// 获取选中计划的测试项配置
const compareTestItem = ref<CheckData.CompareTestItem[]>([])
const names = matchedItem.testItemNameStr ? matchedItem.testItemNameStr.split(',') : []
const ids = matchedItem.testItems || []
// 构造 compareTestItem 数组
compareTestItem.value = ids.map((id: string, index: number) => {
return {
id: id,
name: names[index] || ''
}
})
checkStore.clearCompareTestItem()
checkStore.setCompareTestItem(compareTestItem.value)
deviceConnectionPopupRef.value?.open(channelsSelection.value, pqStandardDevList.value,props.id) deviceConnectionPopupRef.value?.open(channelsSelection.value, pqStandardDevList.value,props.id)
} }

View File

@@ -118,11 +118,13 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { getBigTestItem } from '@/api/check/test' import { getBigTestItem } from '@/api/check/test'
import { getAutoGenerate } from '@/api/user/login' import { getAutoGenerate } from '@/api/user/login'
import { generateDevReport } from '@/api/plan/plan' import { generateDevReport } from '@/api/plan/plan'
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { useDictStore } from '@/stores/modules/dict'
// 获取检测状态管理实例 // 获取检测状态管理实例
const checkStore = useCheckStore() const checkStore = useCheckStore()
const modeStore = useModeStore()
const dictStore = useDictStore()
// 最大通道数限制,超过此数量将使用汇总显示 // 最大通道数限制,超过此数量将使用汇总显示
const MAX_CHN_SUM = 12 const MAX_CHN_SUM = 12
@@ -733,11 +735,13 @@ const showTestLog = () => {
// ========== 数据初始化函数 ========== // ========== 数据初始化函数 ==========
// 从服务器获取检测脚本配置数据 // 从服务器获取检测脚本配置数据
const initScriptData = async () => { const initScriptData = async () => {
const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '';
// 根据复检类型、计划ID、设备ID列表获取测试项 // 根据复检类型、计划ID、设备ID列表获取测试项
let response: any = await getBigTestItem({ let response: any = await getBigTestItem({
reCheckType: checkStore.reCheckType, reCheckType: checkStore.reCheckType,
planId: checkStore.plan.id, planId: checkStore.plan.id,
devIds: checkStore.devices.map(item => item.deviceId), devIds: checkStore.devices.map(item => item.deviceId),
patternId: pattern
}) })
// 格式化脚本数据 // 格式化脚本数据

View File

@@ -20,7 +20,7 @@
show-word-limit show-word-limit
/> />
</el-form-item> </el-form-item>
<el-form-item label="标准设备" prop="standardDevIds" :label-width="110"> <el-form-item label="标准设备" prop="standardDevIds" :label-width="110" v-if="selectByMode && planType == 0">
<el-select <el-select
v-model="formContent.standardDevIds" v-model="formContent.standardDevIds"
multiple multiple
@@ -29,6 +29,7 @@
:max-collapse-tags="2" :max-collapse-tags="2"
placeholder="请选择标准设备" placeholder="请选择标准设备"
clearable clearable
> >
<el-option <el-option
v-for="option in pqStandardDevArray" v-for="option in pqStandardDevArray"