Commit bde8637e8c274f64b7baa84904a888cdd99b1474
1 parent
b76c39fa
perf: 优化 vben5-general 代码生成模板
Showing
2 changed files
with
19 additions
and
19 deletions
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
| @@ -123,24 +123,24 @@ const [FormModal, formModalApi] = useVbenModal({ | @@ -123,24 +123,24 @@ const [FormModal, formModalApi] = useVbenModal({ | ||
| 123 | }); | 123 | }); |
| 124 | 124 | ||
| 125 | /** 创建${table.classComment} */ | 125 | /** 创建${table.classComment} */ |
| 126 | -function onCreate() { | 126 | +function handleCreate() { |
| 127 | formModalApi.setData({}).open(); | 127 | formModalApi.setData({}).open(); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | /** 编辑${table.classComment} */ | 130 | /** 编辑${table.classComment} */ |
| 131 | -function onEdit(row: ${simpleClassName}Api.${simpleClassName}) { | 131 | +function handleEdit(row: ${simpleClassName}Api.${simpleClassName}) { |
| 132 | formModalApi.setData(row).open(); | 132 | formModalApi.setData(row).open(); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | #if (${table.templateType} == 2)## 树表特有:新增下级 | 135 | #if (${table.templateType} == 2)## 树表特有:新增下级 |
| 136 | /** 新增下级${table.classComment} */ | 136 | /** 新增下级${table.classComment} */ |
| 137 | -function onAppend(row: ${simpleClassName}Api.${simpleClassName}) { | 137 | +function handleAppend(row: ${simpleClassName}Api.${simpleClassName}) { |
| 138 | formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open(); | 138 | formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open(); |
| 139 | } | 139 | } |
| 140 | #end | 140 | #end |
| 141 | 141 | ||
| 142 | /** 删除${table.classComment} */ | 142 | /** 删除${table.classComment} */ |
| 143 | -async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) { | 143 | +async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { |
| 144 | const hideLoading = message.loading({ | 144 | const hideLoading = message.loading({ |
| 145 | content: $t('ui.actionMessage.deleting', [row.id]), | 145 | content: $t('ui.actionMessage.deleting', [row.id]), |
| 146 | duration: 0, | 146 | duration: 0, |
| @@ -157,10 +157,10 @@ async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) { | @@ -157,10 +157,10 @@ async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) { | ||
| 157 | hideLoading(); | 157 | hideLoading(); |
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | -// TODO @puhui999: 改成和 schema 模式一样 | 160 | + |
| 161 | #if ($table.templateType != 2 && $deleteBatchEnable) | 161 | #if ($table.templateType != 2 && $deleteBatchEnable) |
| 162 | /** 批量删除${table.classComment} */ | 162 | /** 批量删除${table.classComment} */ |
| 163 | -async function onDeleteBatch() { | 163 | +async function handleDeleteBatch() { |
| 164 | const hideLoading = message.loading({ | 164 | const hideLoading = message.loading({ |
| 165 | content: $t('ui.actionMessage.deleting'), | 165 | content: $t('ui.actionMessage.deleting'), |
| 166 | duration: 0, | 166 | duration: 0, |
| @@ -315,7 +315,7 @@ onMounted(() => { | @@ -315,7 +315,7 @@ onMounted(() => { | ||
| 315 | class="ml-2" | 315 | class="ml-2" |
| 316 | :icon="h(Plus)" | 316 | :icon="h(Plus)" |
| 317 | type="primary" | 317 | type="primary" |
| 318 | - @click="onCreate" | 318 | + @click="handleCreate" |
| 319 | v-access:code="['${permissionPrefix}:create']" | 319 | v-access:code="['${permissionPrefix}:create']" |
| 320 | > | 320 | > |
| 321 | {{ $t('ui.actionTitle.create', ['${table.classComment}']) }} | 321 | {{ $t('ui.actionTitle.create', ['${table.classComment}']) }} |
| @@ -337,7 +337,7 @@ onMounted(() => { | @@ -337,7 +337,7 @@ onMounted(() => { | ||
| 337 | danger | 337 | danger |
| 338 | class="ml-2" | 338 | class="ml-2" |
| 339 | :disabled="isEmpty(checkedIds)" | 339 | :disabled="isEmpty(checkedIds)" |
| 340 | - @click="onDeleteBatch" | 340 | + @click="handleDeleteBatch" |
| 341 | v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']" | 341 | v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']" |
| 342 | > | 342 | > |
| 343 | 批量删除 | 343 | 批量删除 |
| @@ -426,7 +426,7 @@ onMounted(() => { | @@ -426,7 +426,7 @@ onMounted(() => { | ||
| 426 | <Button | 426 | <Button |
| 427 | size="small" | 427 | size="small" |
| 428 | type="link" | 428 | type="link" |
| 429 | - @click="onAppend(row as any)" | 429 | + @click="handleAppend(row as any)" |
| 430 | v-access:code="['${permissionPrefix}:create']" | 430 | v-access:code="['${permissionPrefix}:create']" |
| 431 | > | 431 | > |
| 432 | 新增下级 | 432 | 新增下级 |
| @@ -435,7 +435,7 @@ onMounted(() => { | @@ -435,7 +435,7 @@ onMounted(() => { | ||
| 435 | <Button | 435 | <Button |
| 436 | size="small" | 436 | size="small" |
| 437 | type="link" | 437 | type="link" |
| 438 | - @click="onEdit(row as any)" | 438 | + @click="handleEdit(row as any)" |
| 439 | v-access:code="['${permissionPrefix}:update']" | 439 | v-access:code="['${permissionPrefix}:update']" |
| 440 | > | 440 | > |
| 441 | {{ $t('ui.actionTitle.edit') }} | 441 | {{ $t('ui.actionTitle.edit') }} |
| @@ -448,7 +448,7 @@ onMounted(() => { | @@ -448,7 +448,7 @@ onMounted(() => { | ||
| 448 | #if ( $table.templateType == 2 ) | 448 | #if ( $table.templateType == 2 ) |
| 449 | :disabled="!isEmpty(row?.children)" | 449 | :disabled="!isEmpty(row?.children)" |
| 450 | #end | 450 | #end |
| 451 | - @click="onDelete(row as any)" | 451 | + @click="handleDelete(row as any)" |
| 452 | v-access:code="['${permissionPrefix}:delete']" | 452 | v-access:code="['${permissionPrefix}:delete']" |
| 453 | > | 453 | > |
| 454 | {{ $t('ui.actionTitle.delete') }} | 454 | {{ $t('ui.actionTitle.delete') }} |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm
| @@ -50,7 +50,7 @@ const props = defineProps<{ | @@ -50,7 +50,7 @@ const props = defineProps<{ | ||
| 50 | }); | 50 | }); |
| 51 | 51 | ||
| 52 | /** 创建${subTable.classComment} */ | 52 | /** 创建${subTable.classComment} */ |
| 53 | -function onCreate() { | 53 | +function handleCreate() { |
| 54 | if (!props.${subJoinColumn.javaField}){ | 54 | if (!props.${subJoinColumn.javaField}){ |
| 55 | message.warning("请先选择一个${table.classComment}!") | 55 | message.warning("请先选择一个${table.classComment}!") |
| 56 | return | 56 | return |
| @@ -59,12 +59,12 @@ function onCreate() { | @@ -59,12 +59,12 @@ function onCreate() { | ||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /** 编辑${subTable.classComment} */ | 61 | /** 编辑${subTable.classComment} */ |
| 62 | -function onEdit(row: ${simpleClassName}Api.${subSimpleClassName}) { | 62 | +function handleEdit(row: ${simpleClassName}Api.${subSimpleClassName}) { |
| 63 | formModalApi.setData(row).open(); | 63 | formModalApi.setData(row).open(); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | /** 删除${subTable.classComment} */ | 66 | /** 删除${subTable.classComment} */ |
| 67 | -async function onDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { | 67 | +async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { |
| 68 | const hideLoading = message.loading({ | 68 | const hideLoading = message.loading({ |
| 69 | content: $t('ui.actionMessage.deleting', [row.id]), | 69 | content: $t('ui.actionMessage.deleting', [row.id]), |
| 70 | duration: 0, | 70 | duration: 0, |
| @@ -84,7 +84,7 @@ async function onDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { | @@ -84,7 +84,7 @@ async function onDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { | ||
| 84 | 84 | ||
| 85 | #if ($deleteBatchEnable) | 85 | #if ($deleteBatchEnable) |
| 86 | /** 批量删除${subTable.classComment} */ | 86 | /** 批量删除${subTable.classComment} */ |
| 87 | -async function onDeleteBatch() { | 87 | +async function handleDeleteBatch() { |
| 88 | const hideLoading = message.loading({ | 88 | const hideLoading = message.loading({ |
| 89 | content: $t('ui.actionMessage.deleting'), | 89 | content: $t('ui.actionMessage.deleting'), |
| 90 | duration: 0, | 90 | duration: 0, |
| @@ -299,7 +299,7 @@ onMounted(() => { | @@ -299,7 +299,7 @@ onMounted(() => { | ||
| 299 | class="ml-2" | 299 | class="ml-2" |
| 300 | :icon="h(Plus)" | 300 | :icon="h(Plus)" |
| 301 | type="primary" | 301 | type="primary" |
| 302 | - @click="onCreate" | 302 | + @click="handleCreate" |
| 303 | v-access:code="['${permissionPrefix}:create']" | 303 | v-access:code="['${permissionPrefix}:create']" |
| 304 | > | 304 | > |
| 305 | {{ $t('ui.actionTitle.create', ['${table.classComment}']) }} | 305 | {{ $t('ui.actionTitle.create', ['${table.classComment}']) }} |
| @@ -311,7 +311,7 @@ onMounted(() => { | @@ -311,7 +311,7 @@ onMounted(() => { | ||
| 311 | danger | 311 | danger |
| 312 | class="ml-2" | 312 | class="ml-2" |
| 313 | :disabled="isEmpty(checkedIds)" | 313 | :disabled="isEmpty(checkedIds)" |
| 314 | - @click="onDeleteBatch" | 314 | + @click="handleDeleteBatch" |
| 315 | v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']" | 315 | v-access:code="['${table.moduleName}:${simpleClassName_strikeCase}:delete']" |
| 316 | > | 316 | > |
| 317 | 批量删除 | 317 | 批量删除 |
| @@ -361,7 +361,7 @@ onMounted(() => { | @@ -361,7 +361,7 @@ onMounted(() => { | ||
| 361 | <Button | 361 | <Button |
| 362 | size="small" | 362 | size="small" |
| 363 | type="link" | 363 | type="link" |
| 364 | - @click="onEdit(row as any)" | 364 | + @click="handleEdit(row as any)" |
| 365 | v-access:code="['${permissionPrefix}:update']" | 365 | v-access:code="['${permissionPrefix}:update']" |
| 366 | > | 366 | > |
| 367 | {{ $t('ui.actionTitle.edit') }} | 367 | {{ $t('ui.actionTitle.edit') }} |
| @@ -371,7 +371,7 @@ onMounted(() => { | @@ -371,7 +371,7 @@ onMounted(() => { | ||
| 371 | type="link" | 371 | type="link" |
| 372 | danger | 372 | danger |
| 373 | class="ml-2" | 373 | class="ml-2" |
| 374 | - @click="onDelete(row as any)" | 374 | + @click="handleDelete(row as any)" |
| 375 | v-access:code="['${permissionPrefix}:delete']" | 375 | v-access:code="['${permissionPrefix}:delete']" |
| 376 | > | 376 | > |
| 377 | {{ $t('ui.actionTitle.delete') }} | 377 | {{ $t('ui.actionTitle.delete') }} |