Compare commits
No commits in common. "b3b4f29d5da42e55d5f8af2df369de848d0eb27d" and "5a1b95ea5d5846b46a7cf946722afe08f9576da3" have entirely different histories.
b3b4f29d5d
...
5a1b95ea5d
|
@ -1,59 +0,0 @@
|
||||||
<template>
|
|
||||||
<div style="padding: 10px;">
|
|
||||||
<el-dialog
|
|
||||||
v-model="dialogVisible"
|
|
||||||
width="30%"
|
|
||||||
append-to-body
|
|
||||||
>
|
|
||||||
<div style="display: flex;justify-content: center;">
|
|
||||||
<ChooseTextbook @node-click="nodeClick" />
|
|
||||||
</div>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
|
||||||
<el-button type="primary" @click.stop="save">确定</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, defineExpose } from 'vue'
|
|
||||||
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
|
||||||
const getNodeInfo = ref([])
|
|
||||||
|
|
||||||
const openDialog = () => {
|
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const getFullObj = (node) => {
|
|
||||||
const obj = []
|
|
||||||
const recursive = (currentNode) => {
|
|
||||||
// 这里添加节点参数
|
|
||||||
if (currentNode.parentNode) {
|
|
||||||
obj.unshift(Object.assign({curentId: currentNode.id,title:currentNode.itemtitle}, currentNode.parentNode))
|
|
||||||
recursive(currentNode.parentNode)
|
|
||||||
} else {
|
|
||||||
obj.unshift({id: currentNode.id,title:currentNode.itemtitle})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
recursive(node)
|
|
||||||
return obj
|
|
||||||
}
|
|
||||||
|
|
||||||
const nodeClick = (data) => {
|
|
||||||
getNodeInfo.value = getFullObj(data.node)
|
|
||||||
console.log(getNodeInfo.value, 'getNodeInfo.value')
|
|
||||||
}
|
|
||||||
|
|
||||||
const save = () => {
|
|
||||||
dialogVisible.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
openDialog
|
|
||||||
})
|
|
||||||
</script>
|
|
Loading…
Reference in New Issue