通道配对

This commit is contained in:
sjl
2025-07-24 08:29:03 +08:00
parent bccb4b1f17
commit 6e22c01dd8
5 changed files with 235 additions and 65 deletions

View File

@@ -274,7 +274,7 @@ import reportPopup from './reportPopup.vue'
import dataCheckPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import dataCheckChangeErrSysPopup from './dataCheckChangeErrSysPopup.vue'
import {generateDevReport, getBoundPqDevList} from '@/api/plan/plan.ts'
import {onBeforeMount, onMounted, reactive, ref, watch} from 'vue'
import {onBeforeMount, onMounted, PropType, reactive, ref, watch} from 'vue'
import {useDictStore} from '@/stores/modules/dict'
import ChannelsTest from './channelsTest.vue'
import {useModeStore,useAppSceneStore} from '@/stores/modules/mode' // 引入模式 store
@@ -291,6 +291,9 @@ import {ResultEnum} from '@/enums/httpEnum'
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue";
import WriteTHPopup from "@/views/home/components/writeTHPopup.vue";
import DeviceConnectionPopup from '@/views/home/components/deviceConnectionPopup.vue'
import { Plan } from '@/api/plan/interface'
import { StandardDevice } from '@/api/device/interface/standardDevice'
import { s } from 'vite/dist/node/types.d-aGj9QkWt'
const dictStore = useDictStore()
const checkStore = useCheckStore()
@@ -363,6 +366,10 @@ const props = defineProps({
type: Object,
default: null,
},
planArray: {
type: Array as PropType<Plan.ReqPlan[]>,
default: null,
},
})
const appSceneStore = useAppSceneStore()
@@ -522,13 +529,47 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{
prop: 'devType',
label: '设备类型',
minWidth: 100,
minWidth: 150,
// render: (scope) => {
// // 查找设备类型名称
// const name = devTypeOptions.value.find(option => option.id === scope.row.devType)
// return <span>{name?.name}</span>
// },
},
{
prop: 'boundPlanName',
label: '来源计划名称',
minWidth: 200,
isShow:modeStore.currentMode === '比对式',
render(scope) {
return scope.row.boundPlanName ? scope.row.boundPlanName : props.plan.name
}
},
{
prop: 'standardDevs',
label: '标准设备',
minWidth: 200,
isShow:modeStore.currentMode === '比对式',
render(scope) {
const boundPlanName = ref('')
if(scope.row.boundPlanName){
boundPlanName.value = scope.row.boundPlanName
}else{
boundPlanName.value = props.plan.name
}
const standardDevNames = props.planArray.flatMap(item => {
if (item.children) {
return item.children
.filter(child => child.name === boundPlanName.value)
.flatMap(child =>
child.standardDevs.map(dev => dev.name)
)
}
return []
})
return standardDevNames.length > 0 ? standardDevNames.join(',') : '/'
}
},
{
prop: 'devChns',
label: '通道数',
@@ -631,6 +672,7 @@ const resetSearchForm = () => {
let testType = 'test'//检测还是复检
const handleSelectionChange = (selection: any[]) => {
channelsSelection.value = selection
devNum = selection.length
devChannelsNum = 0
@@ -852,7 +894,64 @@ const addDevice = (val: string) => {
const handleTest2 = () => {
deviceConnectionPopupRef.value?.open()
if (devNum == 0) {
ElMessageBox.confirm(
'请先选择被检设备',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
return
}
const planName = channelsSelection.value.map(item => item.boundPlanName)
const isPlanConsistent = new Set(planName).size === 1
if (!isPlanConsistent) {
ElMessageBox.confirm(
'所勾选被检设备所属计划名称不一致,请重新选择',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
return
}
const boundPlanName = ref('')
if(channelsSelection.value[0].boundPlanName){
boundPlanName.value = channelsSelection.value[0].boundPlanName
}else{
boundPlanName.value = props.plan.name
}
const pqStandardDevList=ref<StandardDevice.ResPqStandardDevice[]>([])
pqStandardDevList.value = props.planArray.flatMap(item => {
if (item.children) {
return item.children
.filter(child => child.name === boundPlanName.value)
.flatMap(child =>
child.standardDevs
)
}
return []
})
if(pqStandardDevList.value.length==0){
ElMessageBox.confirm(
'所勾选被检设备所属计划无标准设备,请重新选择',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
return
}
deviceConnectionPopupRef.value?.open(channelsSelection.value,pqStandardDevList.value)
}
const handleTest = async (val: string) => {