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