diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm index 02f175da18..b358094685 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/api/api.ts.vm @@ -1,5 +1,7 @@ #set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api") +#if ( $table.templateType != 2 ) import type { PageParam, PageResult } from '@vben/request'; +#end import type { Dayjs } from 'dayjs'; import { requestClient } from '#/api/request'; @@ -97,8 +99,8 @@ export function update${simpleClassName}(data: ${apiName}.${simpleClassName}) { export function delete${simpleClassName}(id: number) { return requestClient.delete(`${baseURL}/delete?id=${id}`); } - #if ( $table.templateType != 2 && $deleteBatchEnable) + /** 批量删除${table.classComment} */ export function delete${simpleClassName}List(ids: number[]) { return requestClient.delete( diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/form.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/form.vue.vm index 2d8c4104e3..c3342c4d49 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/form.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/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_ele/schema/views/index.vue.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/index.vue.vm index 5b1ce10616..fd59cdbad4 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/schema/views/index.vue.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/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 { ElLoading, ElMessage#if ($table.templateType == 11), ElTabs, ElTabPane#end } from 'element-plus'; @@ -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}) { @@ -145,16 +145,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 @@ -186,15 +179,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 @@ -229,13 +231,6 @@ const [Grid, gridApi] = useVbenVxeGrid({