From 6ba0484f336ab7f914c50e8e6055a2df29a72e0d Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Tue, 6 May 2025 22:14:10 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20vben5=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../codegen/vue3_vben5_antd/general/views/index.vue.vm | 9 ++++----- .../general/views/modules/list_sub_erp.vue.vm | 4 ++-- .../codegen/vue3_vben5_antd/schema/views/data.ts.vm | 4 ++-- .../codegen/vue3_vben5_antd/schema/views/form.vue.vm | 5 +---- .../codegen/vue3_vben5_antd/schema/views/index.vue.vm | 9 +++------ .../schema/views/modules/form_sub_erp.vue.vm | 5 +---- .../schema/views/modules/list_sub_erp.vue.vm | 7 ++----- 7 files changed, 15 insertions(+), 28 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm index c7f4822686..0a39bb6aa0 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm +++ b/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 import type { VxeTableInstance } from 'vxe-table'; import { Page, useVbenModal } from '@vben/common-ui'; -import { cloneDeep, formatDateTime } from '@vben/utils'; +import { cloneDeep, formatDateTime, getRangePickerDefaultProps } from '@vben/utils'; import { Button, message,Tabs,Pagination,Form,RangePicker,DatePicker,Select,Input } from 'ant-design-vue'; import { DictTag } from '#/components/dict-tag'; import { DICT_TYPE, getDictOptions } from '#/utils/dict'; @@ -12,7 +12,6 @@ import { Download, Plus, RefreshCw, Search } from '@vben/icons'; import { ContentWrap } from "#/components/content-wrap"; import { VxeColumn, VxeTable } from 'vxe-table'; import { TableToolbar } from '#/components/table-toolbar'; -import { getRangePickerDefaultProps } from '#/utils/date'; ## 特殊:主子表专属逻辑 #if ( $table.templateType == 11 || $table.templateType == 12 ) @@ -31,7 +30,7 @@ import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClas #else## 标准表接口 import { get${simpleClassName}Page, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}'; #end -import { downloadByData } from '#/utils/download'; +import { downloadFileFromBlobPart } from '@vben/utils'; #if ($table.templateType == 12 || $table.templateType == 11) ## 内嵌和erp情况 /** 子表的列表 */ @@ -162,7 +161,7 @@ async function onExport() { try { exportLoading.value = true; const data = await export${simpleClassName}(queryParams); - downloadByData(data, '${table.classComment}.xls'); + downloadFileFromBlobPart({ fileName: '${table.classComment}.xls', source: data }); }finally { exportLoading.value = false; } @@ -281,7 +280,7 @@ onMounted(async () => { - + \ No newline at end of file + diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm index f4034cbe5c..4357944ada 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/data.ts.vm +++ b/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 import { z } from '#/adapter/form'; #if(${table.templateType} == 2)## 树表需要导入这些 import { get${simpleClassName}List } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}'; -import { handleTree } from '#/utils/tree'; +import { handleTree } from '@vben/utils'; #end import { DICT_TYPE, getDictOptions } from '#/utils/dict'; -import { getRangePickerDefaultProps } from '#/utils/date'; +import { getRangePickerDefaultProps } from '@vben/utils'; import { useAccess } from '@vben/access'; const { hasAccessByCodes } = useAccess(); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm index 227b8c2982..c4e0eecfb4 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/form.vue.vm +++ b/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({ // 关闭并提示 await modalApi.close(); emit('success'); - message.success({ - content: $t('ui.actionMessage.operationSuccess'), - key: 'action_process_msg', - }); + message.success( $t('ui.actionMessage.operationSuccess') ); } finally { modalApi.unlock(); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm index bf27df8052..9b3fbde62f 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/index.vue.vm +++ b/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 #else## 标准表接口 import { get${simpleClassName}Page, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}'; #end -import { downloadByData } from '#/utils/download'; +import { downloadFileFromBlobPart } from '@vben/utils'; import { useGridColumns, useGridFormSchema } from './data'; @@ -85,10 +85,7 @@ async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) { }); try { await delete${simpleClassName}(row.id as number); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.id]), - key: 'action_process_msg', - }); + message.success( $t('ui.actionMessage.deleteSuccess', [row.id]) ); onRefresh(); } catch { hideLoading(); @@ -98,7 +95,7 @@ async function onDelete(row: ${simpleClassName}Api.${simpleClassName}) { /** 导出表格 */ async function onExport() { const data = await export${simpleClassName}(await gridApi.formApi.getValues()); - downloadByData(data, '${table.classComment}.xls'); + downloadFileFromBlobPart({ fileName: '${table.classComment}.xls', source: data }); } /** 表格操作按钮的回调函数 */ diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/form_sub_erp.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/form_sub_erp.vue.vm index e114b7daea..739849631c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/form_sub_erp.vue.vm +++ b/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 @@ // 关闭并提示 await modalApi.close(); emit('success'); - message.success({ - content: $t('ui.actionMessage.operationSuccess'), - key: 'action_process_msg', - }); + message.success( $t('ui.actionMessage.operationSuccess') ); } finally { modalApi.unlock(); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm index b7990a5de2..616be9f299 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm +++ b/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}) { }); try { await delete${subSimpleClassName}(row.id as number); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.id]), - key: 'action_process_msg', - }); + message.success( $t('ui.actionMessage.deleteSuccess', [row.id]) ); onRefresh(); } catch { hideLoading(); @@ -181,4 +178,4 @@ const onRefresh = async ()=> { #else #end - \ No newline at end of file +