This commit is contained in:
sjl
2025-03-11 18:58:26 +08:00
parent 9af98b034f
commit 059864d193
4 changed files with 29 additions and 18 deletions

View File

@@ -7,7 +7,7 @@ export namespace Plan {
export interface ResPlan { export interface ResPlan {
id: string; //检测计划ID id: string; //检测计划ID
name: string; //检测计划名称 name: string; //检测计划名称
pattern: string; //模式,字典表(数字、模拟、比对) pattern?: string; //模式,字典表(数字、模拟、比对)
fatherPlanId?: string; //父计划ID fatherPlanId?: string; //父计划ID
dataSourceId: string; //数据源ID dataSourceId: string; //数据源ID
scriptId: string; //检测脚本ID scriptId: string; //检测脚本ID

View File

@@ -155,7 +155,7 @@
type="primary" type="primary"
size="large" size="large"
@click="startLoading" @click="startLoading"
:disabled="startDisabeld"
>启动</el-button> >启动</el-button>
<el-button :icon="VideoPause" <el-button :icon="VideoPause"
type="primary" type="primary"
@@ -286,7 +286,7 @@ const second = ref(0)
const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled']) const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled'])
watch(()=>props.formControl.scriptId,()=>{ watch(()=>props.formControl.scriptId,()=>{
console.log("切换脚本",props.formControl.scriptId); //console.log("切换脚本",props.formControl.scriptId);
if(props.formControl.scriptId!=''){ if(props.formControl.scriptId!=''){
getTree() getTree()
} }
@@ -304,13 +304,14 @@ const getTree = () => {
}).then(res => { }).then(res => {
if (res.code === 'A0000') { if (res.code === 'A0000') {
treeData.value = res.data treeData.value = res.data
//console.log('tree',res.data)
// 为 treeData 及其子节点添加 id // 为 treeData 及其子节点添加 id
let idCounter = 0; let idCounter = 0;
const addIdToTree = (nodes: any[]) => { const addIdToTree = (nodes: any[]) => {
nodes.forEach(node => { nodes.forEach(node => {
node.id = idCounter++; // 为每个节点添加唯一的 id node.id = idCounter++; // 为每个节点添加唯一的 id
if (node.children && node.children.length > 0) { if (node.children && node.children.length > 0) {
node.disabled = true
addIdToTree(node.children); // 递归为子节点添加 id addIdToTree(node.children); // 递归为子节点添加 id
} }
}); });
@@ -348,6 +349,9 @@ const getTree = () => {
} }
}) })
}) })
//console.log('2222',treeData.value)
tabChange() tabChange()
} }
}) })
@@ -368,7 +372,7 @@ const setTab = row => {
const copyActiveName = ref('') const copyActiveName = ref('')
// 获取通讯脚本点击 // 获取通讯脚本点击
const getCommunication = () => { const getCommunication = () => {
console.log('controlSourceDetail',communRef.value[0]?.getData()) //console.log('controlSourceDetail',communRef.value[0]?.getData())
communicationList.value = communRef.value[0]?.getData() communicationList.value = communRef.value[0]?.getData()
} }
// 切换大tab控制小tab // 切换大tab控制小tab
@@ -410,7 +414,7 @@ const inquireTable = () => {
} }
}) })
console.log('treeData',treeData.value) //console.log('treeData',treeData.value)
} }

View File

@@ -26,6 +26,7 @@
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { CheckData } from '@/api/check/interface' import { CheckData } from '@/api/check/interface'
import { da } from 'element-plus/es/locale'
const props = defineProps({ const props = defineProps({
treeData: { treeData: {
type: Array, type: Array,
@@ -44,7 +45,6 @@ const childActiveName = ref('')
const activeIndex = ref() const activeIndex = ref()
const treeRef = ref() const treeRef = ref()
const handleNodeClick = (data, node) => { const handleNodeClick = (data, node) => {
//console.log('handleNodeClick', props.treeData)
if(data.index!= null){ if(data.index!= null){
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200'] let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
const parents = getParentNodes(node, []) const parents = getParentNodes(node, [])
@@ -63,6 +63,8 @@ const handleNodeClick = (data, node) => {
activeIndex:data.index activeIndex:data.index
}) })
} }
} }
} }
@@ -103,16 +105,21 @@ function findTargetCodes(data: any[], targetCodes: string[]) {
} }
function handleCheckChange(data,isChecked) { function handleCheckChange(data,isChecked) {
console.log('handleCheckChange', data,isChecked) if (isChecked)
if(isChecked){ {
const checked = [data.id]; // id为tree的node-key属性 // 如果没有子节点,允许勾选
treeRef.value?.setCheckedKeys(checked); const checked = [data.id]; // id为tree的node-key属性
emit('setTab', { treeRef.value?.setCheckedKeys(checked);
activeIndex:data.index emit('setTab', {
}) activeName: data.scriptType,
childActiveName: data.scriptTypeCode,
} activeIndex:data.index
} })
}
}
// // 对外映射 // // 对外映射
// defineExpose({ init }) // defineExpose({ init })
</script> </script>

View File

@@ -138,7 +138,7 @@ onMounted(async () => {
}) })
const pqSource_Result = await getTestSourceList({ const pqSource_Result = await getTestSourceList({
'pattern': "a303b2224845fcc6f60098b8ca73dca7", pattern: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ,
datasourceIds: '', datasourceIds: '',
sourceIds: '', sourceIds: '',
planId: '', planId: '',