微调
This commit is contained in:
@@ -287,9 +287,15 @@ const second = ref(0)
|
||||
|
||||
const emit = defineEmits(['update:activeName','update:activeIndex','update:startDisabeld','update:pauseDisabled'])
|
||||
|
||||
watch(()=>props.formControl.scriptId,()=>{
|
||||
watch(()=>props.formControl.scriptId,async ()=>{
|
||||
if(props.formControl.scriptId!=''){
|
||||
getTree()
|
||||
|
||||
nextTick(async () => {
|
||||
await getTree()
|
||||
console.log('props.formControl.scriptId')
|
||||
treeRef.value.checkTree()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
@@ -357,8 +363,8 @@ const getTree = () => {
|
||||
tabChange()
|
||||
}
|
||||
})
|
||||
|
||||
treeRef.value.checkTree()
|
||||
//console.log('获取树')
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</el-tree>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, watch } from 'vue'
|
||||
import { ref, reactive, onMounted, watch, nextTick } from 'vue'
|
||||
|
||||
import { CheckData } from '@/api/check/interface'
|
||||
import { da } from 'element-plus/es/locale'
|
||||
@@ -130,20 +130,24 @@ function findFirstLeafNode(node: any): any {
|
||||
}
|
||||
|
||||
const checkTree = () => {
|
||||
|
||||
console.log('checkTree11')
|
||||
console.log('checkTree22',props.treeData.length)
|
||||
console.log('checkTree33',treeRef.value)
|
||||
if (props.treeData.length > 0 && treeRef.value) {
|
||||
console.log('checkTree44')
|
||||
const firstNode = props.treeData[0];
|
||||
const firstLeafNode = findFirstLeafNode(firstNode);
|
||||
const firstLeafNodeId = firstLeafNode.id;
|
||||
treeRef.value.setCheckedKeys([firstLeafNodeId]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 确保在组件挂载后也执行一次
|
||||
onMounted(() => {
|
||||
|
||||
checkTree()
|
||||
console.log('onMounted',props.treeData);
|
||||
nextTick(() => {
|
||||
checkTree()
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ const handleActiveIndexChange = (newActiveIndex: number) => {
|
||||
// 定义 handleScriptChange 方法
|
||||
const handleScriptChange = (value: string) => {
|
||||
// 根据业务需求实现具体逻辑
|
||||
console.log('检测脚本变更:', value);
|
||||
//console.log('检测脚本变更:', value);
|
||||
router.push({
|
||||
path: '/machine/controlSource',
|
||||
state: { title: '新增检测脚本', row: '', mode: modeStore.currentMode }
|
||||
|
||||
Reference in New Issue
Block a user