fix: 代码生成器

This commit is contained in:
xingyu
2022-10-14 17:52:04 +08:00
parent ff938a9e30
commit aa983a6fa9
14 changed files with 30 additions and 19 deletions

View File

@ -15,7 +15,8 @@ const props = defineProps({
default: () => null
}
})
const defaultProps = {
const menuProps = {
checkStrictly: true,
children: 'children',
label: 'name',
value: 'id'
@ -31,7 +32,6 @@ const rules = reactive({
})
const templateTypeOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)
const sceneOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)
const parentMenuId = ref()
const treeRef = ref<InstanceType<typeof ElTreeSelect>>()
const menuOptions = ref<any>([]) // 树形结构
const getTree = async () => {
@ -112,9 +112,13 @@ const schema = reactive<FormSchema[]>([
const { register, methods, elFormRef } = useForm({
schema
})
const parentMenuId = ref<number>()
//子组件像父组件传值
const emit = defineEmits(['menu'])
const handleNodeClick = () => {
console.log(parentMenuId.value)
emit('menu', parentMenuId.value)
}
// ========== 初始化 ==========
onMounted(async () => {
await getTree()
@ -143,10 +147,9 @@ defineExpose({
v-model="parentMenuId"
ref="treeRef"
node-key="id"
check-on-click-node
expand-on-click-node="false"
:props="defaultProps"
:props="menuProps"
:data="menuOptions"
check-strictly
@node-click="handleNodeClick"
/>
</template>