perf: vben5 代码生成
This commit is contained in:
parent
a34de9f223
commit
6ba0484f33
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
import { Plus } from '@vben/icons';
|
||||
import { $t } from '#/locales';
|
||||
import { TableToolbar } from '#/components/table-toolbar';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { getRangePickerDefaultProps } from '@vben/utils';
|
||||
#end
|
||||
|
||||
#if ($table.templateType == 11) ## erp
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue