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