首页判断被检设备下绑定监测点
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import type { Monitor } from '@/api/device/interface/monitor'
|
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6,23 +5,9 @@ import http from '@/api'
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//获取监测点
|
//获取监测点
|
||||||
export const getPqMonList = (params: Monitor.ReqPqMonParams) => {
|
export const getPqMonList = (param:any) => {
|
||||||
//return http.post(`/pqMon/list`, params)
|
return http.post(`/pqMonitor/list`, param)
|
||||||
}
|
|
||||||
|
|
||||||
//添加监测点
|
|
||||||
export const addPqMon = (params: Monitor.ResPqMon) => {
|
|
||||||
//return http.post(`/pqMon/add`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
//编辑监测点
|
|
||||||
export const updatePqMon = (params: Monitor.ResPqMon) => {
|
|
||||||
//return http.post(`/pqMon/update`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除监测点
|
|
||||||
export const deletePqMon = (params: string[]) => {
|
|
||||||
//return http.post(`/pqMon/delete`, params)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,10 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
ElMessage.error('接收数据超时!')
|
ElMessage.error('接收数据超时!')
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
step5.value = 'error'
|
step5.value = 'error'
|
||||||
|
}else if(newValue.code == 10550){
|
||||||
|
ElMessage.error('设备连接异常!')
|
||||||
|
ts.value = 'error'
|
||||||
|
step5.value = 'error'
|
||||||
}
|
}
|
||||||
switch (newValue.requestId) {
|
switch (newValue.requestId) {
|
||||||
case 'yjc_sbtxjy':
|
case 'yjc_sbtxjy':
|
||||||
@@ -224,15 +228,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
type: 'wait',
|
type: 'wait',
|
||||||
log: '正在进行设备通讯校验.....',
|
log: '正在进行设备通讯校验.....',
|
||||||
}];
|
}];
|
||||||
} else if (newValue.code == 10550) {
|
} else if (newValue.code == 10551) {
|
||||||
step1InitLog.value.push({
|
|
||||||
type: 'error',
|
|
||||||
log: newValue.data + '设备连接异常!',
|
|
||||||
})
|
|
||||||
step1.value = 'error'
|
|
||||||
ts.value = 'error'
|
|
||||||
step5.value = 'error'
|
|
||||||
} else if (newValue.code == 10551) {
|
|
||||||
step1InitLog.value.push({
|
step1InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data + '设备触发报告异常!',
|
log: newValue.data + '设备触发报告异常!',
|
||||||
@@ -372,7 +368,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case 'error_flow_end':
|
case 'error_flow_end':
|
||||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'error_flow_end':
|
case 'error_flow_end':
|
||||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '初始化失败', {
|
ElMessageBox.alert(`当前流程存在异常结束!`, '初始化失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ const devIds = ref<string[]>()
|
|||||||
const standardDevIds = ref<string[]>()
|
const standardDevIds = ref<string[]>()
|
||||||
|
|
||||||
const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],fatherPlanId: string) => {
|
const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],fatherPlanId: string) => {
|
||||||
|
console.log('device:', device);
|
||||||
edges.value = []
|
edges.value = []
|
||||||
devIds.value = device.map(d => d.id)
|
devIds.value = device.map(d => d.id)
|
||||||
standardDevIds.value = standardDev.map(d => d.id)
|
standardDevIds.value = standardDev.map(d => d.id)
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
case 'unknown_operate':
|
case 'unknown_operate':
|
||||||
break;
|
break;
|
||||||
case 'error_flow_end':
|
case 'error_flow_end':
|
||||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ import { useAuthStore } from '@/stores/modules/auth'
|
|||||||
import { useDownload } from '@/hooks/useDownload'
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import { documentedPqDev } from '@/api/device/report'
|
import { documentedPqDev } from '@/api/device/report'
|
||||||
import { ResultEnum } from '@/enums/httpEnum'
|
import { ResultEnum } from '@/enums/httpEnum'
|
||||||
|
import {getPqMonList} from '@/api/device/monitor/index.ts'
|
||||||
|
|
||||||
const checkStore = useCheckStore()
|
const checkStore = useCheckStore()
|
||||||
let devNum = 0//当前选取的被检设备数量
|
let devNum = 0//当前选取的被检设备数量
|
||||||
@@ -665,7 +665,7 @@ function refreshStatusList() {
|
|||||||
* 通道配对功能处理函数(比对模式专用)
|
* 通道配对功能处理函数(比对模式专用)
|
||||||
* 校验选中设备的一致性,然后打开通道配对弹窗
|
* 校验选中设备的一致性,然后打开通道配对弹窗
|
||||||
*/
|
*/
|
||||||
const handleTest2 = () => {
|
const handleTest2 = async () => {
|
||||||
// 检查是否选择了设备
|
// 检查是否选择了设备
|
||||||
if (devNum == 0) {
|
if (devNum == 0) {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
@@ -729,7 +729,67 @@ const handleTest2 = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceConnectionPopupRef.value?.open(channelsSelection.value, pqStandardDevList.value,props.id)
|
const devBindMonList = await getPqMonList({devIds: channelsSelection.value.map(d => d.id)})
|
||||||
|
|
||||||
|
// 创建一个映射来存储每个设备的监测点信息(支持多个监测点)
|
||||||
|
const deviceMonitoringMap = new Map<string, any[]>()
|
||||||
|
devBindMonList.data.forEach((item: any) => {
|
||||||
|
if (deviceMonitoringMap.has(item.devId)) {
|
||||||
|
// 如果设备已存在,添加新的监测点信息
|
||||||
|
deviceMonitoringMap.get(item.devId)?.push(item)
|
||||||
|
} else {
|
||||||
|
// 如果设备不存在,创建新的数组存储监测点信息
|
||||||
|
deviceMonitoringMap.set(item.devId, [item])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 过滤出至少有一个监测点的设备
|
||||||
|
const filteredChannelsSelection = channelsSelection.value.filter(device => {
|
||||||
|
return deviceMonitoringMap.has(device.id)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 如果没有设备有监测点,则提示并返回
|
||||||
|
if (filteredChannelsSelection.length === 0) {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'所选设备均无监测点,请检查设备配置',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有设备被过滤掉
|
||||||
|
const devicesWithoutMonitoring = channelsSelection.value.filter(device => {
|
||||||
|
return !deviceMonitoringMap.has(device.id)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 提示完全没有监测点的设备
|
||||||
|
if (devicesWithoutMonitoring.length > 0) {
|
||||||
|
const deviceNames = devicesWithoutMonitoring.map(d => d.name).join(', ')
|
||||||
|
ElMessage.warning(`以下设备没有监测点: ${deviceNames}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查监测点数量与通道数是否一致,并指出具体哪些通道未绑定
|
||||||
|
const inconsistentPointDevices = filteredChannelsSelection.filter(device => {
|
||||||
|
const monitoringInfoArray = deviceMonitoringMap.get(device.id)
|
||||||
|
const pointCount = monitoringInfoArray ? monitoringInfoArray.length : 0
|
||||||
|
// 只有当监测点数量与通道数不一致时才需要提示
|
||||||
|
return pointCount !== device.devChns
|
||||||
|
})
|
||||||
|
|
||||||
|
if (inconsistentPointDevices.length > 0) {
|
||||||
|
const deviceNames = inconsistentPointDevices.map(d => d.name).join(', ')
|
||||||
|
ElMessage.warning(`以下设备存在通道未绑定监测点: ${deviceNames}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 只传递有监测点的设备
|
||||||
|
deviceConnectionPopupRef.value?.open(filteredChannelsSelection, pqStandardDevList.value, props.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ watch(webMsgSend, function(newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'error_flow_end':
|
case 'error_flow_end':
|
||||||
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '初始化失败', {
|
ElMessageBox.alert(`当前流程存在异常结束!`, '初始化失败', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -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" v-if="selectByMode">
|
<el-form-item label="标准设备" prop="standardDevIds" :label-width="110" v-if="selectByMode" >
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formContent.standardDevIds"
|
v-model="formContent.standardDevIds"
|
||||||
multiple
|
multiple
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
:max-collapse-tags="2"
|
:max-collapse-tags="2"
|
||||||
placeholder="请选择标准设备"
|
placeholder="请选择标准设备"
|
||||||
clearable
|
clearable
|
||||||
|
:disabled="planType == 2"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="option in pqStandardDevArray"
|
v-for="option in pqStandardDevArray"
|
||||||
|
|||||||
Reference in New Issue
Block a user