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 | 123 | |
| 124 | 124 | /** 创建${table.classComment} */ |
| 125 | 125 | function handleCreate() { |
| 126 | - formModalApi.setData({}).open(); | |
| 126 | + formModalApi.setData(null).open(); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 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 | 43 | if (!valid) { |
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | - | |
| 47 | 46 | modalApi.lock(); |
| 48 | 47 | // 提交表单 |
| 49 | 48 | const data = (await formApi.getValues()) as ${apiName}.${subSimpleClassName}; |
| ... | ... | @@ -63,7 +62,6 @@ |
| 63 | 62 | formData.value = undefined; |
| 64 | 63 | return; |
| 65 | 64 | } |
| 66 | - | |
| 67 | 65 | // 加载数据 |
| 68 | 66 | let data = modalApi.getData<${apiName}.${subSimpleClassName}>(); |
| 69 | 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 | 38 | }: OnActionClickParams<${apiName}.${subSimpleClassName}>) { |
| 39 | 39 | switch (code) { |
| 40 | 40 | case 'delete': { |
| 41 | - onDelete(row); | |
| 41 | + handleDelete(row); | |
| 42 | 42 | break; |
| 43 | 43 | } |
| 44 | 44 | } |
| ... | ... | @@ -64,12 +64,12 @@ gridOptions: { |
| 64 | 64 | }); |
| 65 | 65 | |
| 66 | 66 | /** 添加${subTable.classComment} */ |
| 67 | -const onAdd = async () => { | |
| 67 | +const handleAdd = async () => { | |
| 68 | 68 | await gridApi.grid.insertAt({} as ${apiName}.${subSimpleClassName}, -1); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** 删除${subTable.classComment} */ |
| 72 | -const onDelete = async (row: ${apiName}.${subSimpleClassName}) => { | |
| 72 | +const handleDelete = async (row: ${apiName}.${subSimpleClassName}) => { | |
| 73 | 73 | await gridApi.grid.remove(row); |
| 74 | 74 | } |
| 75 | 75 | |
| ... | ... | @@ -188,7 +188,7 @@ watch( |
| 188 | 188 | #end |
| 189 | 189 | </Grid> |
| 190 | 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 | 192 | {{ $t('ui.actionTitle.create', ['${subTable.classComment}']) }} |
| 193 | 193 | </Button> |
| 194 | 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 | 13 | #if ($table.templateType == 11) ## erp |
| 14 | 14 | import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue' |
| 15 | 15 | #end |
| 16 | -import { useVbenModal } from '@vben/common-ui'; | |
| 16 | +import { confirm, useVbenModal } from '@vben/common-ui'; | |
| 17 | 17 | import { message } from 'ant-design-vue'; |
| 18 | 18 | import { ref, computed, nextTick,watch } from 'vue'; |
| 19 | 19 | import { $t } from '#/locales'; |
| ... | ... | @@ -74,8 +74,9 @@ async function handleDelete(row: ${apiName}.${subSimpleClassName}) { |
| 74 | 74 | #if ($deleteBatchEnable) |
| 75 | 75 | /** 批量删除${subTable.classComment} */ |
| 76 | 76 | async function handleDeleteBatch() { |
| 77 | + await confirm($t('ui.actionMessage.deleteBatchConfirm')); | |
| 77 | 78 | const hideLoading = message.loading({ |
| 78 | - content: $t('ui.actionMessage.deleting'), | |
| 79 | + content: $t('ui.actionMessage.deletingBatch'), | |
| 79 | 80 | duration: 0, |
| 80 | 81 | }); |
| 81 | 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 | 123 | |
| 124 | 124 | /** 创建${table.classComment} */ |
| 125 | 125 | function handleCreate() { |
| 126 | - formModalApi.setData({}).open(); | |
| 126 | + formModalApi.setData(null).open(); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** 编辑${table.classComment} */ |
| ... | ... | @@ -142,7 +142,6 @@ function handleAppend(row: ${simpleClassName}Api.${simpleClassName}) { |
| 142 | 142 | async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { |
| 143 | 143 | const loadingInstance = ElLoading.service({ |
| 144 | 144 | text: $t('ui.actionMessage.deleting', [row.id]), |
| 145 | - background: 'rgba(0, 0, 0, 0.7)', | |
| 146 | 145 | }); |
| 147 | 146 | try { |
| 148 | 147 | await delete${simpleClassName}(row.id as number); |
| ... | ... | @@ -158,7 +157,6 @@ async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) { |
| 158 | 157 | async function handleDeleteBatch() { |
| 159 | 158 | const loadingInstance = ElLoading.service({ |
| 160 | 159 | text: $t('ui.actionMessage.deleting'), |
| 161 | - background: 'rgba(0, 0, 0, 0.7)', | |
| 162 | 160 | }); |
| 163 | 161 | try { |
| 164 | 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 | 69 | async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { |
| 70 | 70 | const loadingInstance = ElLoading.service({ |
| 71 | 71 | text: $t('ui.actionMessage.deleting', [row.id]), |
| 72 | - background: 'rgba(0, 0, 0, 0.7)', | |
| 73 | 72 | }); |
| 74 | 73 | try { |
| 75 | 74 | await delete${subSimpleClassName}(row.id as number); |
| ... | ... | @@ -85,7 +84,6 @@ async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { |
| 85 | 84 | async function handleDeleteBatch() { |
| 86 | 85 | const loadingInstance = ElLoading.service({ |
| 87 | 86 | text: $t('ui.actionMessage.deleting'), |
| 88 | - background: 'rgba(0, 0, 0, 0.7)', | |
| 89 | 87 | }); |
| 90 | 88 | try { |
| 91 | 89 | await delete${subSimpleClassName}List(checkedIds.value); | ... | ... |