diff --git a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm index 46c19d96d5..113061e29a 100644 --- a/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm +++ b/yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm @@ -1,5 +1,5 @@ import type { VbenFormSchema } from '#/adapter/form'; -import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}'; import { z } from '#/adapter/form'; @@ -12,9 +12,6 @@ import { import { get${simpleClassName}List } from '#/api/${table.moduleName}/${table.businessName}'; import { handleTree } from '@vben/utils'; #end -import { useAccess } from '@vben/access'; - -const { hasAccessByCodes } = useAccess(); /** 新增/修改的表单 */ export function useFormSchema(): VbenFormSchema[] { @@ -189,9 +186,7 @@ export function useGridFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function useGridColumns( - onActionClick?: OnActionClickFn<${simpleClassName}Api.${simpleClassName}>, -): VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>['columns'] { +export function useGridColumns(): VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>['columns'] { return [ #if ($table.templateType != 2 && $deleteBatchEnable) { type: 'checkbox', width: 40 }, @@ -223,43 +218,10 @@ export function useGridColumns( #end #end { - field: 'operation', title: '操作', - minWidth: 200, - align: 'center', + width: 200, fixed: 'right', - headerAlign: 'center', - showOverflow: false, - cellRender: { - attrs: { - nameField: '${columns[0].javaField}', - nameTitle: '${table.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']), - }, - { - 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 - }, - ], - }, + slots: { default: 'actions' }, }, ]; } @@ -427,9 +389,7 @@ export function use${subSimpleClassName}GridFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function use${subSimpleClassName}GridColumns( - onActionClick?: OnActionClickFn<${simpleClassName}Api.${subSimpleClassName}>, -): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] { +export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] { return [ #if ($table.templateType != 2 && $deleteBatchEnable) { type: 'checkbox', width: 40 }, @@ -455,31 +415,10 @@ export function use${subSimpleClassName}GridColumns( #end #end { - field: 'operation', title: '操作', - minWidth: 200, - align: 'center', + width: 200, fixed: 'right', - headerAlign: 'center', - showOverflow: false, - cellRender: { - attrs: { - nameField: '${columns[0].javaField}', - nameTitle: '${subTable.classComment}', - onClick: onActionClick, - }, - name: 'CellOperation', - options: [ - { - code: 'edit', - show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:update']), - }, - { - code: 'delete', - show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:delete']), - }, - ], - }, + slots: { default: 'actions' }, }, ]; } @@ -525,27 +464,10 @@ export function use${subSimpleClassName}GridColumns( #end #end { - field: 'operation', title: '操作', - minWidth: 60, - align: 'center', + width: 200, fixed: 'right', - headerAlign: 'center', - showOverflow: false, - cellRender: { - attrs: { - nameField: '${columns[0].javaField}', - nameTitle: '${table.classComment}', - onClick: onActionClick, - }, - name: 'CellOperation', - options: [ - { - code: 'delete', - show: hasAccessByCodes(['${table.moduleName}:${simpleClassName_strikeCase}:delete']), - }, - ], - }, + slots: { default: 'actions' }, }, ]; } @@ -680,7 +602,6 @@ export function use${subSimpleClassName}GridColumns( #end ]; } - #end #end #end 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 ffbd052c57..2cfa0ed690 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 @@ -1,10 +1,9 @@