|
|
|
@ -2941,16 +2941,35 @@ const currentComponentOptions = computed(() => { |
|
|
|
return controlData.value.options |
|
|
|
}) |
|
|
|
|
|
|
|
// 获取当前选择的索引列节点(用于获取label) |
|
|
|
const currentIndexColumnNode = computed(() => { |
|
|
|
if (!controlData.value?.control?.zdtcsz?.tby) return null |
|
|
|
return zdtcszTree.value.find(item => item.id == controlData.value.control.zdtcsz.tby) |
|
|
|
}) |
|
|
|
// 递归查找树节点 |
|
|
|
const findTreeNode = (tree, id) => { |
|
|
|
if (!tree || !Array.isArray(tree)) return null |
|
|
|
|
|
|
|
for (let node of tree) { |
|
|
|
if (node.id === id) { |
|
|
|
return node |
|
|
|
} |
|
|
|
|
|
|
|
// 如果有子节点,递归查找 |
|
|
|
if (node.children && node.children.length > 0) { |
|
|
|
const found = findTreeNode(node.children, id) |
|
|
|
if (found) return found |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null |
|
|
|
} |
|
|
|
|
|
|
|
// 获取当前选择的标题行节点(用于获取label) |
|
|
|
const currentTitleColumnNode = computed(() => { |
|
|
|
if (!controlData.value?.control?.zdtcsz?.tbx) return null |
|
|
|
return zdtcszTree.value.find(item => item.id == controlData.value.control.zdtcsz.tbx) |
|
|
|
return findTreeNode(zdtcszTree.value, controlData.value.control.zdtcsz.tbx) |
|
|
|
}) |
|
|
|
|
|
|
|
// 获取当前选择的索引列节点(用于获取label) |
|
|
|
const currentIndexColumnNode = computed(() => { |
|
|
|
if (!controlData.value?.control?.zdtcsz?.tby) return null |
|
|
|
return findTreeNode(zdtcszTree.value, controlData.value.control.zdtcsz.tby) |
|
|
|
}) |
|
|
|
|
|
|
|
// 索引列的标签 |
|
|
|
@ -2989,8 +3008,10 @@ const zdtcszTableColumns = computed(() => { |
|
|
|
|
|
|
|
// 监听标题行和索引列的变化,重新生成表格数据 |
|
|
|
watch([titleOptions, indexOptions], ([newTitleOptions, newIndexOptions]) => { |
|
|
|
|
|
|
|
// 如果都没有选择,清空表格数据 |
|
|
|
if (!newTitleOptions.length && !newIndexOptions.length) { |
|
|
|
console.log("如果都没有选择,清空表格数据") |
|
|
|
zdtcszTableData.value = [] |
|
|
|
return |
|
|
|
} |
|
|
|
|