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