Commit 6ba0484f336ab7f914c50e8e6055a2df29a72e0d
1 parent
a34de9f2
perf: vben5 代码生成
Showing
7 changed files
with
15 additions
and
28 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
| ... | ... | @@ -3,7 +3,7 @@ import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleCl |
| 3 | 3 | import type { VxeTableInstance } from 'vxe-table'; |
| 4 | 4 | |
| 5 | 5 | import { Page, useVbenModal } from '@vben/common-ui'; |
| 6 | -import { cloneDeep, formatDateTime } from '@vben/utils'; | |
| 6 | +import { cloneDeep, formatDateTime, getRangePickerDefaultProps } from '@vben/utils'; | |
| 7 | 7 | import { Button, message,Tabs,Pagination,Form,RangePicker,DatePicker,Select,Input } from 'ant-design-vue'; |
| 8 | 8 | import { DictTag } from '#/components/dict-tag'; |
| 9 | 9 | import { DICT_TYPE, getDictOptions } from '#/utils/dict'; |
| ... | ... | @@ -12,7 +12,6 @@ import { Download, Plus, RefreshCw, Search } from '@vben/icons'; |
| 12 | 12 | import { ContentWrap } from "#/components/content-wrap"; |
| 13 | 13 | import { VxeColumn, VxeTable } from 'vxe-table'; |
| 14 | 14 | import { TableToolbar } from '#/components/table-toolbar'; |
| 15 | -import { getRangePickerDefaultProps } from '#/utils/date'; | |
| 16 | 15 | |
| 17 | 16 | ## 特殊:主子表专属逻辑 |
| 18 | 17 | #if ( $table.templateType == 11 || $table.templateType == 12 ) |
| ... | ... | @@ -31,7 +30,7 @@ import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClas |
| 31 | 30 | #else## 标准表接口 |
| 32 | 31 | import { get${simpleClassName}Page, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}'; |
| 33 | 32 | #end |
| 34 | -import { downloadByData } from '#/utils/download'; | |
| 33 | +import { downloadFileFromBlobPart } from '@vben/utils'; | |
| 35 | 34 | |
| 36 | 35 | #if ($table.templateType == 12 || $table.templateType == 11) ## 内嵌和erp情况 |
| 37 | 36 | /** 子表的列表 */ |
| ... | ... | @@ -162,7 +161,7 @@ async function onExport() { |
| 162 | 161 | try { |
| 163 | 162 | exportLoading.value = true; |
| 164 | 163 | const data = await export${simpleClassName}(queryParams); |
| 165 | - downloadByData(data, '${table.classComment}.xls'); | |
| 164 | + downloadFileFromBlobPart({ fileName: '${table.classComment}.xls', source: data }); | |
| 166 | 165 | }finally { |
| 167 | 166 | exportLoading.value = false; |
| 168 | 167 | } |
| ... | ... | @@ -281,7 +280,7 @@ onMounted(async () => { |
| 281 | 280 | </Form.Item> |
| 282 | 281 | </Form> |
| 283 | 282 | </ContentWrap> |
| 284 | - | |
| 283 | + | |
| 285 | 284 | <!-- 列表 --> |
| 286 | 285 | <ContentWrap title="${table.classComment}"> |
| 287 | 286 | <template #extra> | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | import { Plus } from '@vben/icons'; |
| 27 | 27 | import { $t } from '#/locales'; |
| 28 | 28 | import { TableToolbar } from '#/components/table-toolbar'; |
| 29 | - import { getRangePickerDefaultProps } from '#/utils/date'; | |
| 29 | + import { getRangePickerDefaultProps } from '@vben/utils'; | |
| 30 | 30 | #end |
| 31 | 31 | |
| 32 | 32 | #if ($table.templateType == 11) ## erp |
| ... | ... | @@ -387,4 +387,4 @@ onMounted(async () => { |
| 387 | 387 | </vxe-table> |
| 388 | 388 | </ContentWrap> |
| 389 | 389 | #end |
| 390 | -</template> | |
| 391 | 390 | \ No newline at end of file |
| 391 | +</template> | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm
| ... | ... | @@ -5,10 +5,10 @@ import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleCl |
| 5 | 5 | import { z } from '#/adapter/form'; |
| 6 | 6 | #if(${table.templateType} == 2)## 树表需要导入这些 |
| 7 | 7 | import { get${simpleClassName}List } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}'; |
| 8 | -import { handleTree } from '#/utils/tree'; | |
| 8 | +import { handleTree } from '@vben/utils'; | |
| 9 | 9 | #end |
| 10 | 10 | import { DICT_TYPE, getDictOptions } from '#/utils/dict'; |
| 11 | -import { getRangePickerDefaultProps } from '#/utils/date'; | |
| 11 | +import { getRangePickerDefaultProps } from '@vben/utils'; | |
| 12 | 12 | import { useAccess } from '@vben/access'; |
| 13 | 13 | |
| 14 | 14 | const { hasAccessByCodes } = useAccess(); | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm
| ... | ... | @@ -102,10 +102,7 @@ const [Modal, modalApi] = useVbenModal({ |
| 102 | 102 | // 关闭并提示 |
| 103 | 103 | await modalApi.close(); |
| 104 | 104 | emit('success'); |
| 105 | - message.success({ | |
| 106 | - content: $t('ui.actionMessage.operationSuccess'), | |
| 107 | - key: 'action_process_msg', | |
| 108 | - }); | |
| 105 | + message.success( $t('ui.actionMessage.operationSuccess') ); | |
| 109 | 106 | } finally { |
| 110 | 107 | modalApi.unlock(); |
| 111 | 108 | } | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm
| ... | ... | @@ -24,7 +24,7 @@ import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClas |
| 24 | 24 | #else## 标准表接口 |
| 25 | 25 | import { get${simpleClassName}Page, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}'; |
| 26 | 26 | #end |
| 27 | -import { downloadByData } from '#/utils/download'; | |
| 27 | +import { downloadFileFromBlobPart } from '@vben/utils'; | |
| 28 | 28 | |
| 29 | 29 | import { useGridColumns, useGridFormSchema } from './data'; |
| 30 | 30 | |
| ... | ... | @@ -85,10 +85,7 @@ async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) { |
| 85 | 85 | }); |
| 86 | 86 | try { |
| 87 | 87 | await delete${simpleClassName}(row.id as number); |
| 88 | - message.success({ | |
| 89 | - content: $t('ui.actionMessage.deleteSuccess', [row.id]), | |
| 90 | - key: 'action_process_msg', | |
| 91 | - }); | |
| 88 | + message.success( $t('ui.actionMessage.deleteSuccess', [row.id]) ); | |
| 92 | 89 | onRefresh(); |
| 93 | 90 | } catch { |
| 94 | 91 | hideLoading(); |
| ... | ... | @@ -98,7 +95,7 @@ async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) { |
| 98 | 95 | /** 导出表格 */ |
| 99 | 96 | async function onExport() { |
| 100 | 97 | const data = await export${simpleClassName}(await gridApi.formApi.getValues()); |
| 101 | - downloadByData(data, '${table.classComment}.xls'); | |
| 98 | + downloadFileFromBlobPart({ fileName: '${table.classComment}.xls', source: data }); | |
| 102 | 99 | } |
| 103 | 100 | |
| 104 | 101 | /** 表格操作按钮的回调函数 */ | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/form_sub_erp.vue.vm
| ... | ... | @@ -52,10 +52,7 @@ |
| 52 | 52 | // 关闭并提示 |
| 53 | 53 | await modalApi.close(); |
| 54 | 54 | emit('success'); |
| 55 | - message.success({ | |
| 56 | - content: $t('ui.actionMessage.operationSuccess'), | |
| 57 | - key: 'action_process_msg', | |
| 58 | - }); | |
| 55 | + message.success( $t('ui.actionMessage.operationSuccess') ); | |
| 59 | 56 | } finally { |
| 60 | 57 | modalApi.unlock(); |
| 61 | 58 | } | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm
| ... | ... | @@ -65,10 +65,7 @@ async function onDelete(row: ${simpleClassName}Api.${subSimpleClassName}) { |
| 65 | 65 | }); |
| 66 | 66 | try { |
| 67 | 67 | await delete${subSimpleClassName}(row.id as number); |
| 68 | - message.success({ | |
| 69 | - content: $t('ui.actionMessage.deleteSuccess', [row.id]), | |
| 70 | - key: 'action_process_msg', | |
| 71 | - }); | |
| 68 | + message.success( $t('ui.actionMessage.deleteSuccess', [row.id]) ); | |
| 72 | 69 | onRefresh(); |
| 73 | 70 | } catch { |
| 74 | 71 | hideLoading(); |
| ... | ... | @@ -181,4 +178,4 @@ const onRefresh = async ()=> { |
| 181 | 178 | #else |
| 182 | 179 | <Grid table-title="${subTable.classComment}列表" /> |
| 183 | 180 | #end |
| 184 | -</template> | |
| 185 | 181 | \ No newline at end of file |
| 182 | +</template> | ... | ... |