微调
This commit is contained in:
@@ -286,6 +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);
|
||||
if(props.formControl.scriptId!=''){
|
||||
getTree()
|
||||
}
|
||||
@@ -303,6 +304,19 @@ const getTree = () => {
|
||||
}).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
treeData.value = 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) {
|
||||
addIdToTree(node.children); // 递归为子节点添加 id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
addIdToTree(treeData.value);
|
||||
|
||||
// 添加tab子项
|
||||
props.options.forEach((k: any, i: number) => {
|
||||
@@ -312,6 +326,7 @@ const getTree = () => {
|
||||
item.children.forEach((s: any) => {
|
||||
k.children.forEach((P: any) => {
|
||||
if (P.code == s.scriptTypeCode) {
|
||||
|
||||
tabData.value[i].children.push({
|
||||
label: P.label,
|
||||
value: P.code,
|
||||
@@ -336,6 +351,8 @@ const getTree = () => {
|
||||
tabChange()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +393,7 @@ const tabChange = () => {
|
||||
const inquireTable = () => {
|
||||
const sortOrder = ['Ua', 'Ia', 'Ub', 'Ib', 'Uc', 'Ic']
|
||||
dlsDetails({
|
||||
scriptId: '9ff96807cf8c7524587982ed8baa8b57',
|
||||
scriptId: props.formControl.scriptId,
|
||||
scriptType: activeName.value,
|
||||
scriptSubType: childActiveName.value
|
||||
}).then((res: any) => {
|
||||
@@ -393,7 +410,7 @@ const inquireTable = () => {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
console.log('treeData',treeData.value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user