diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm index a600d3de26..3ab28d2a1c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm @@ -202,6 +202,9 @@ export function useGridColumns( onActionClick?: OnActionClickFn<${simpleClassName}Api.${simpleClassName}>, ): VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>['columns'] { return [ +#if ($table.templateType == 12) ## 内嵌情况 + { type: 'expand', width: 80, slots: { content: 'expand_content' } }, +#end #foreach($column in $columns) #if ($column.listOperationResult) #set ($dictType = $column.dictType) @@ -274,6 +277,7 @@ export function useGridColumns( #set ($subColumns = $subColumnsList.get($index))##当前字段数组 #set ($subSimpleClassName = $subSimpleClassNames.get($index)) #set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 + #set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index)) // ==================== 子表($subTable.classComment) ==================== #if ($table.templateType == 11) ## erp 情况 /** 新增/修改的表单 */ @@ -409,9 +413,6 @@ export function use${subSimpleClassName}GridColumns( props: { type: DICT_TYPE.$dictType.toUpperCase() }, }, #end - #if (${table.templateType} == 2 && $column.id == $treeNameColumn.id)## 树表特有:标记树节点列 - treeNode: true, - #end }, #end #end @@ -426,30 +427,18 @@ export function use${subSimpleClassName}GridColumns( cellRender: { attrs: { nameField: '${columns[0].javaField}', - nameTitle: '${table.classComment}', + nameTitle: '${subTable.classComment}', onClick: onActionClick, }, name: 'CellOperation', options: [ - #if (${table.templateType} == 2)## 树表特有操作 - { - code: 'append', - text: '新增下级', - show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:create']), - }, - #end { code: 'edit', - show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:update']), + show: hasAccessByCodes(['${subTable.moduleName}:${subSimpleClassName_strikeCase}:update']), }, { code: 'delete', - show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:delete']), - #if (${table.templateType} == 2)## 树表禁止删除带有子节点的数据 - disabled: (row: ${simpleClassName}Api.${simpleClassName}) => { - return !!(row.children && row.children.length > 0); - }, - #end + show: hasAccessByCodes(['${subTable.moduleName}:${subSimpleClassName_strikeCase}:delete']), }, ], }, @@ -458,8 +447,8 @@ export function use${subSimpleClassName}GridColumns( } #else #if ($subTable.subJoinMany) ## 一对多 - /** 列表的字段 */ - export function use${subSimpleClassName}GridColumns( + /** 新增/修改列表的字段 */ + export function use${subSimpleClassName}GridEditColumns( onActionClick?: OnActionClickFn<${simpleClassName}Api.${subSimpleClassName}>, ): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] { return [ @@ -634,5 +623,32 @@ export function use${subSimpleClassName}GridColumns( ]; } #end + #if ($table.templateType == 12) ## 内嵌情况 + /** 列表的字段 */ + export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] { + return [ + #foreach($column in $subColumns) + #if ($column.listOperationResult) + #set ($dictType = $column.dictType) + #set ($javaField = $column.javaField) + #set ($comment = $column.columnComment) + { + field: '${javaField}', + title: '${comment}', + minWidth: 120, + #if ($column.javaType == "LocalDateTime")## 时间类型 + formatter: 'formatDateTime', + #elseif("" != $dictType)## 数据字典 + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.$dictType.toUpperCase() }, + }, + #end + }, + #end + #end + ]; + } + #end #end #end \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm index 8d48c20794..bdb7dd7d21 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm @@ -116,6 +116,7 @@ const [Modal, modalApi] = useVbenModal({ }, async onOpenChange(isOpen: boolean) { if (!isOpen) { + formData.value = undefined; return; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm index f488d97f15..41c4692702 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm @@ -3,10 +3,17 @@ import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-tab import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}'; import { Page, useVbenModal } from '@vben/common-ui'; -import { Button, message } from 'ant-design-vue'; +import { Button, message,Tabs } from 'ant-design-vue'; import { Download, Plus } from '@vben/icons'; import Form from './modules/form.vue'; +## 特殊:主子表专属逻辑 +#if ( $table.templateType == 11 || $table.templateType == 12 ) + #foreach ($subSimpleClassName in $subSimpleClassNames) + import ${subSimpleClassName}List from './modules/${subSimpleClassName}List.vue' + #end +#end + import { ref, h } from 'vue'; import { $t } from '#/locales'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; @@ -19,6 +26,11 @@ import { downloadByData } from '#/utils/download'; import { useGridColumns, useGridFormSchema } from './data'; +#if ($table.templateType == 12) ## 内嵌情况 +/** 子表的列表 */ +const subTabsName = ref('$subClassNameVars.get(0)') +#end + const [FormModal, formModalApi] = useVbenModal({ connectedComponent: Form, destroyOnClose: true, @@ -35,7 +47,11 @@ function toggleExpand() { /** 刷新表格 */ function onRefresh() { +#if ($table.templateType == 12) ## 内嵌情况 + gridApi.reload(); +#else gridApi.query(); +#end } /** 导出表格 */ @@ -46,7 +62,7 @@ async function onExport() { /** 创建${table.classComment} */ function onCreate() { - formModalApi.setData(null).open(); + formModalApi.setData({}).open(); } /** 编辑${table.classComment} */ @@ -160,6 +176,22 @@ const [Grid, gridApi] = useVbenVxeGrid({ + #if ($table.templateType == 12) ## 内嵌情况 + + #end