Compare commits
2 Commits
5a1b95ea5d
...
b3b4f29d5d
Author | SHA1 | Date |
---|---|---|
yangws | b3b4f29d5d | |
小杨 | 5dc9e4e20d |
|
@ -0,0 +1,59 @@
|
|||
<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