| | |
| | | deleteDictTypeList, |
| | | exportDictType, |
| | | getDictTypePage, |
| | | importDictType, |
| | | importDictTypeTemplate, |
| | | } from '#/api/system/dict/type'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import ImportModalComponent from '#/components/import-modal'; |
| | | |
| | | import { useTypeGridColumns, useTypeGridFormSchema } from '../data'; |
| | | import TypeForm from './type-form.vue'; |
| | |
| | | |
| | | const [TypeFormModal, typeFormModalApi] = useVbenModal({ |
| | | connectedComponent: TypeForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [ImportModal, importModalApi] = useVbenModal({ |
| | | connectedComponent: ImportModalComponent, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | async function handleExport() { |
| | | const data = await exportDictType(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: '字典类型.xls', source: data }); |
| | | } |
| | | |
| | | /** 导入字典类型 */ |
| | | function handleImport() { |
| | | importModalApi |
| | | .setData({ |
| | | title: $t('ui.actionTitle.import', ['字典类型']), |
| | | fileName: '字典类型导入模板.xls', |
| | | importFn: importDictType, |
| | | templateFn: importDictTypeTemplate, |
| | | }) |
| | | .open(); |
| | | } |
| | | |
| | | /** 创建字典类型 */ |
| | |
| | | <template> |
| | | <div class="h-full"> |
| | | <TypeFormModal @success="handleRefresh" /> |
| | | <ImportModal @success="handleRefresh" /> |
| | | <Grid table-title="字典类型列表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | |
| | | onClick: handleExport, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.import', ['字典类型']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.UPLOAD, |
| | | auth: ['system:dict:import'], |
| | | onClick: handleImport, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.deleteBatch'), |
| | | type: 'primary', |
| | | danger: true, |