diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm index f13e868baf..e94f439f43 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm @@ -117,6 +117,10 @@ const [Modal, modalApi] = useVbenModal({ // 加载数据 const data = modalApi.getData<${apiName}.${simpleClassName}>(); if (!data || !data.id) { +#if (${table.templateType} == 2)## 树表特有 + // 设置上级 + await formApi.setValues(data); +#end return; } modalApi.lock(); diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm index ea52c7d7ce..97189b023f 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm @@ -6,7 +6,7 @@ import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName} import { ref } from 'vue'; import {#if ($table.templateType != 2 && $deleteBatchEnable) confirm,#end Page, useVbenModal } from '@vben/common-ui'; -import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; +import { downloadFileFromBlobPart#if ($table.templateType != 2 && $deleteBatchEnable), isEmpty#end } from '@vben/utils'; import { message#if ($table.templateType == 11), Tabs#end } from 'ant-design-vue'; @@ -73,18 +73,18 @@ function onRefresh() { function handleCreate() { formModalApi.setData(null).open(); } +#if (${table.templateType} == 2)## 树表特有:新增下级 + +/** 添加下级${table.classComment} */ +function handleAppend(row: ${apiName}.${simpleClassName}) { + formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open(); +} +#end /** 编辑${table.classComment} */ function handleEdit(row: ${apiName}.${simpleClassName}) { formModalApi.setData(row).open(); } -#if (${table.templateType} == 2)## 树表特有:新增下级 - -/** 新增下级${table.classComment} */ -function handleAppend(row: ${apiName}.${simpleClassName}) { - formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open(); -} -#end /** 删除${table.classComment} */ async function handleDelete(row: ${apiName}.${simpleClassName}) { @@ -147,16 +147,9 @@ const [Grid, gridApi] = useVbenVxeGrid({ height: 'auto', #end #if (${table.templateType} == 2)## 树表设置 - treeConfig: { - parentField: '${treeParentColumn.javaField}', - rowField: 'id', - transform: true, - expandAll: true, - reserve: true, - }, - pagerConfig: { - enabled: false, - }, + pagerConfig: { + enabled: false, + }, #else## 标准表设置 keepSource: true, #end @@ -188,15 +181,24 @@ const [Grid, gridApi] = useVbenVxeGrid({ refresh: true, search: true, }, +#if (${table.templateType} == 2)## 树表设置 + treeConfig: { + parentField: '${treeParentColumn.javaField}', + rowField: 'id', + transform: true, + expandAll: true, + reserve: true, + }, +#end } as VxeTableGridOptions<${apiName}.${simpleClassName}>, -#if (${table.templateType} == 11 || $deleteBatchEnable) +#if (${table.templateType} == 11 || (${table.templateType} != 2 && $deleteBatchEnable)) gridEvents: { #if(${table.templateType} == 11) cellClick: ({ row }: { row: ${apiName}.${simpleClassName}}) => { select${simpleClassName}.value = row; }, #end - #if(${table.templateType} != 2 && $deleteBatchEnable) + #if (${table.templateType} != 2 && $deleteBatchEnable) checkboxAll: handleRowCheckboxChange, checkboxChange: handleRowCheckboxChange, #end @@ -231,13 +233,6 @@ const [Grid, gridApi] = useVbenVxeGrid({