Commit 11dd2308b385f3c3277890767e104f9b50f982c3
1 parent
5e46e0c4
feat:【infra】优化 codegen 的 vben 模版
Showing
6 changed files
with
9 additions
and
14 deletions
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
| @@ -123,7 +123,7 @@ const [FormModal, formModalApi] = useVbenModal({ | @@ -123,7 +123,7 @@ const [FormModal, formModalApi] = useVbenModal({ | ||
| 123 | 123 | ||
| 124 | /** 创建${table.classComment} */ | 124 | /** 创建${table.classComment} */ |
| 125 | function handleCreate() { | 125 | function handleCreate() { |
| 126 | - formModalApi.setData({}).open(); | 126 | + formModalApi.setData(null).open(); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | /** 编辑${table.classComment} */ | 129 | /** 编辑${table.classComment} */ |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/form_sub_erp.vue.vm
| @@ -43,7 +43,6 @@ | @@ -43,7 +43,6 @@ | ||
| 43 | if (!valid) { | 43 | if (!valid) { |
| 44 | return; | 44 | return; |
| 45 | } | 45 | } |
| 46 | - | ||
| 47 | modalApi.lock(); | 46 | modalApi.lock(); |
| 48 | // 提交表单 | 47 | // 提交表单 |
| 49 | const data = (await formApi.getValues()) as ${apiName}.${subSimpleClassName}; | 48 | const data = (await formApi.getValues()) as ${apiName}.${subSimpleClassName}; |
| @@ -63,7 +62,6 @@ | @@ -63,7 +62,6 @@ | ||
| 63 | formData.value = undefined; | 62 | formData.value = undefined; |
| 64 | return; | 63 | return; |
| 65 | } | 64 | } |
| 66 | - | ||
| 67 | // 加载数据 | 65 | // 加载数据 |
| 68 | let data = modalApi.getData<${apiName}.${subSimpleClassName}>(); | 66 | let data = modalApi.getData<${apiName}.${subSimpleClassName}>(); |
| 69 | if (!data) { | 67 | if (!data) { |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/form_sub_normal.vue.vm
| @@ -38,7 +38,7 @@ function onActionClick({ | @@ -38,7 +38,7 @@ function onActionClick({ | ||
| 38 | }: OnActionClickParams<${apiName}.${subSimpleClassName}>) { | 38 | }: OnActionClickParams<${apiName}.${subSimpleClassName}>) { |
| 39 | switch (code) { | 39 | switch (code) { |
| 40 | case 'delete': { | 40 | case 'delete': { |
| 41 | - onDelete(row); | 41 | + handleDelete(row); |
| 42 | break; | 42 | break; |
| 43 | } | 43 | } |
| 44 | } | 44 | } |
| @@ -64,12 +64,12 @@ gridOptions: { | @@ -64,12 +64,12 @@ gridOptions: { | ||
| 64 | }); | 64 | }); |
| 65 | 65 | ||
| 66 | /** 添加${subTable.classComment} */ | 66 | /** 添加${subTable.classComment} */ |
| 67 | -const onAdd = async () => { | 67 | +const handleAdd = async () => { |
| 68 | await gridApi.grid.insertAt({} as ${apiName}.${subSimpleClassName}, -1); | 68 | await gridApi.grid.insertAt({} as ${apiName}.${subSimpleClassName}, -1); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | /** 删除${subTable.classComment} */ | 71 | /** 删除${subTable.classComment} */ |
| 72 | -const onDelete = async (row: ${apiName}.${subSimpleClassName}) => { | 72 | +const handleDelete = async (row: ${apiName}.${subSimpleClassName}) => { |
| 73 | await gridApi.grid.remove(row); | 73 | await gridApi.grid.remove(row); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| @@ -188,7 +188,7 @@ watch( | @@ -188,7 +188,7 @@ watch( | ||
| 188 | #end | 188 | #end |
| 189 | </Grid> | 189 | </Grid> |
| 190 | <div class="flex justify-center -mt-4"> | 190 | <div class="flex justify-center -mt-4"> |
| 191 | - <Button :icon="h(Plus)" type="primary" ghost @click="onAdd" v-access:code="['${subTable.moduleName}:${simpleClassName_strikeCase}:create']"> | 191 | + <Button :icon="h(Plus)" type="primary" ghost @click="handleAdd" v-access:code="['${subTable.moduleName}:${simpleClassName_strikeCase}:create']"> |
| 192 | {{ $t('ui.actionTitle.create', ['${subTable.classComment}']) }} | 192 | {{ $t('ui.actionTitle.create', ['${subTable.classComment}']) }} |
| 193 | </Button> | 193 | </Button> |
| 194 | </div> | 194 | </div> |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm
| @@ -13,7 +13,7 @@ import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName} | @@ -13,7 +13,7 @@ import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName} | ||
| 13 | #if ($table.templateType == 11) ## erp | 13 | #if ($table.templateType == 11) ## erp |
| 14 | import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue' | 14 | import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue' |
| 15 | #end | 15 | #end |
| 16 | -import { useVbenModal } from '@vben/common-ui'; | 16 | +import { confirm, useVbenModal } from '@vben/common-ui'; |
| 17 | import { message } from 'ant-design-vue'; | 17 | import { message } from 'ant-design-vue'; |
| 18 | import { ref, computed, nextTick,watch } from 'vue'; | 18 | import { ref, computed, nextTick,watch } from 'vue'; |
| 19 | import { $t } from '#/locales'; | 19 | import { $t } from '#/locales'; |
| @@ -74,8 +74,9 @@ async function handleDelete(row: ${apiName}.${subSimpleClassName}) { | @@ -74,8 +74,9 @@ async function handleDelete(row: ${apiName}.${subSimpleClassName}) { | ||
| 74 | #if ($deleteBatchEnable) | 74 | #if ($deleteBatchEnable) |
| 75 | /** 批量删除${subTable.classComment} */ | 75 | /** 批量删除${subTable.classComment} */ |
| 76 | async function handleDeleteBatch() { | 76 | async function handleDeleteBatch() { |
| 77 | + await confirm($t('ui.actionMessage.deleteBatchConfirm')); | ||
| 77 | const hideLoading = message.loading({ | 78 | const hideLoading = message.loading({ |
| 78 | - content: $t('ui.actionMessage.deleting'), | 79 | + content: $t('ui.actionMessage.deletingBatch'), |
| 79 | duration: 0, | 80 | duration: 0, |
| 80 | }); | 81 | }); |
| 81 | try { | 82 | try { |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/index.vue.vm
| @@ -123,7 +123,7 @@ const [FormModal, formModalApi] = useVbenModal({ | @@ -123,7 +123,7 @@ const [FormModal, formModalApi] = useVbenModal({ | ||
| 123 | 123 | ||
| 124 | /** 创建${table.classComment} */ | 124 | /** 创建${table.classComment} */ |
| 125 | function handleCreate() { | 125 | function handleCreate() { |
| 126 | - formModalApi.setData({}).open(); | 126 | + formModalApi.setData(null).open(); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | /** 编辑${table.classComment} */ | 129 | /** 编辑${table.classComment} */ |
| @@ -142,7 +142,6 @@ function handleAppend(row: ${simpleClassName}Api.${simpleClassName}) { | @@ -142,7 +142,6 @@ function handleAppend(row: ${simpleClassName}Api.${simpleClassName}) { | ||
| 142 | async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { | 142 | async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { |
| 143 | const loadingInstance = ElLoading.service({ | 143 | const loadingInstance = ElLoading.service({ |
| 144 | text: $t('ui.actionMessage.deleting', [row.id]), | 144 | text: $t('ui.actionMessage.deleting', [row.id]), |
| 145 | - background: 'rgba(0, 0, 0, 0.7)', | ||
| 146 | }); | 145 | }); |
| 147 | try { | 146 | try { |
| 148 | await delete${simpleClassName}(row.id as number); | 147 | await delete${simpleClassName}(row.id as number); |
| @@ -158,7 +157,6 @@ async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { | @@ -158,7 +157,6 @@ async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { | ||
| 158 | async function handleDeleteBatch() { | 157 | async function handleDeleteBatch() { |
| 159 | const loadingInstance = ElLoading.service({ | 158 | const loadingInstance = ElLoading.service({ |
| 160 | text: $t('ui.actionMessage.deleting'), | 159 | text: $t('ui.actionMessage.deleting'), |
| 161 | - background: 'rgba(0, 0, 0, 0.7)', | ||
| 162 | }); | 160 | }); |
| 163 | try { | 161 | try { |
| 164 | await delete${simpleClassName}List(checkedIds.value); | 162 | await delete${simpleClassName}List(checkedIds.value); |
yudao-module-infra/src/main/resources/codegen/vue3_vben5_ele/general/views/modules/list_sub_erp.vue.vm
| @@ -69,7 +69,6 @@ function handleEdit(row: ${simpleClassName}Api.${subSimpleClassName}) { | @@ -69,7 +69,6 @@ function handleEdit(row: ${simpleClassName}Api.${subSimpleClassName}) { | ||
| 69 | async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { | 69 | async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { |
| 70 | const loadingInstance = ElLoading.service({ | 70 | const loadingInstance = ElLoading.service({ |
| 71 | text: $t('ui.actionMessage.deleting', [row.id]), | 71 | text: $t('ui.actionMessage.deleting', [row.id]), |
| 72 | - background: 'rgba(0, 0, 0, 0.7)', | ||
| 73 | }); | 72 | }); |
| 74 | try { | 73 | try { |
| 75 | await delete${subSimpleClassName}(row.id as number); | 74 | await delete${subSimpleClassName}(row.id as number); |
| @@ -85,7 +84,6 @@ async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { | @@ -85,7 +84,6 @@ async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { | ||
| 85 | async function handleDeleteBatch() { | 84 | async function handleDeleteBatch() { |
| 86 | const loadingInstance = ElLoading.service({ | 85 | const loadingInstance = ElLoading.service({ |
| 87 | text: $t('ui.actionMessage.deleting'), | 86 | text: $t('ui.actionMessage.deleting'), |
| 88 | - background: 'rgba(0, 0, 0, 0.7)', | ||
| 89 | }); | 87 | }); |
| 90 | try { | 88 | try { |
| 91 | await delete${subSimpleClassName}List(checkedIds.value); | 89 | await delete${subSimpleClassName}List(checkedIds.value); |