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 {
id: string; //检测计划ID
name: string; //检测计划名称
pattern: string; //模式,字典表(数字、模拟、比对)
pattern?: string; //模式,字典表(数字、模拟、比对)
fatherPlanId?: string; //父计划ID
dataSourceId: string; //数据源ID
scriptId: string; //检测脚本ID

View File

@@ -155,7 +155,7 @@
type="primary"
size="large"
@click="startLoading"
:disabled="startDisabeld"
>启动</el-button>
<el-button :icon="VideoPause"
type="primary"
@@ -286,7 +286,7 @@ const second = ref(0)
const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled'])
watch(()=>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)
}

View File

@@ -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 })
</script>

View File

@@ -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: '',