From 059864d193040bcbef04737928f63da7a8f0e7bb Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Tue, 11 Mar 2025 18:58:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/plan/interface/index.ts | 2 +- .../components/controlSourceDetail.vue | 14 +++++---- .../machine/controlSource/components/tree.vue | 29 ++++++++++++------- .../src/views/machine/controlSource/index.vue | 2 +- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/frontend/src/api/plan/interface/index.ts b/frontend/src/api/plan/interface/index.ts index b5b6fc8..d8bfa3d 100644 --- a/frontend/src/api/plan/interface/index.ts +++ b/frontend/src/api/plan/interface/index.ts @@ -7,7 +7,7 @@ export namespace Plan { export interface ResPlan { id: string; //检测计划ID name: string; //检测计划名称 - pattern: string; //模式,字典表(数字、模拟、比对) + pattern?: string; //模式,字典表(数字、模拟、比对) fatherPlanId?: string; //父计划ID dataSourceId: string; //数据源ID scriptId: string; //检测脚本ID diff --git a/frontend/src/views/machine/controlSource/components/controlSourceDetail.vue b/frontend/src/views/machine/controlSource/components/controlSourceDetail.vue index babfbe3..c07e5e1 100644 --- a/frontend/src/views/machine/controlSource/components/controlSourceDetail.vue +++ b/frontend/src/views/machine/controlSource/components/controlSourceDetail.vue @@ -155,7 +155,7 @@ type="primary" size="large" @click="startLoading" - :disabled="startDisabeld" + >启动 props.formControl.scriptId,()=>{ - console.log("切换脚本",props.formControl.scriptId); + //console.log("切换脚本",props.formControl.scriptId); if(props.formControl.scriptId!=''){ getTree() } @@ -304,13 +304,14 @@ const getTree = () => { }).then(res => { if (res.code === 'A0000') { treeData.value = res.data - + //console.log('tree',res.data) // 为 treeData 及其子节点添加 id let idCounter = 0; const addIdToTree = (nodes: any[]) => { nodes.forEach(node => { node.id = idCounter++; // 为每个节点添加唯一的 id if (node.children && node.children.length > 0) { + node.disabled = true addIdToTree(node.children); // 递归为子节点添加 id } }); @@ -348,6 +349,9 @@ const getTree = () => { } }) }) + + //console.log('2222',treeData.value) + tabChange() } }) @@ -368,7 +372,7 @@ const setTab = row => { const copyActiveName = ref('') // 获取通讯脚本点击 const getCommunication = () => { - console.log('controlSourceDetail',communRef.value[0]?.getData()) + //console.log('controlSourceDetail',communRef.value[0]?.getData()) communicationList.value = communRef.value[0]?.getData() } // 切换大tab控制小tab @@ -410,7 +414,7 @@ const inquireTable = () => { } }) - console.log('treeData',treeData.value) + //console.log('treeData',treeData.value) } diff --git a/frontend/src/views/machine/controlSource/components/tree.vue b/frontend/src/views/machine/controlSource/components/tree.vue index 46e3ae9..6822fe7 100644 --- a/frontend/src/views/machine/controlSource/components/tree.vue +++ b/frontend/src/views/machine/controlSource/components/tree.vue @@ -26,6 +26,7 @@ import { ref, reactive } from 'vue' import { CheckData } from '@/api/check/interface' +import { da } from 'element-plus/es/locale' const props = defineProps({ treeData: { type: Array, @@ -44,7 +45,6 @@ const childActiveName = ref('') const activeIndex = ref() const treeRef = ref() const handleNodeClick = (data, node) => { - //console.log('handleNodeClick', props.treeData) if(data.index!= null){ let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200'] const parents = getParentNodes(node, []) @@ -63,6 +63,8 @@ const handleNodeClick = (data, node) => { activeIndex:data.index }) } + + } } @@ -103,16 +105,21 @@ function findTargetCodes(data: any[], targetCodes: string[]) { } function handleCheckChange(data,isChecked) { - console.log('handleCheckChange', data,isChecked) - if(isChecked){ - const checked = [data.id]; // id为tree的node-key属性 - treeRef.value?.setCheckedKeys(checked); - emit('setTab', { - activeIndex:data.index - }) - - } -} + if (isChecked) + { + // 如果没有子节点,允许勾选 + const checked = [data.id]; // id为tree的node-key属性 + treeRef.value?.setCheckedKeys(checked); + emit('setTab', { + activeName: data.scriptType, + childActiveName: data.scriptTypeCode, + activeIndex:data.index + }) + } +} + + + // // 对外映射 // defineExpose({ init }) diff --git a/frontend/src/views/machine/controlSource/index.vue b/frontend/src/views/machine/controlSource/index.vue index 422abf1..992c254 100644 --- a/frontend/src/views/machine/controlSource/index.vue +++ b/frontend/src/views/machine/controlSource/index.vue @@ -138,7 +138,7 @@ onMounted(async () => { }) const pqSource_Result = await getTestSourceList({ - 'pattern': "a303b2224845fcc6f60098b8ca73dca7", + pattern: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id , datasourceIds: '', sourceIds: '', planId: '',