| | |
| | | deleteDataSourceConfig, |
| | | deleteDataSourceConfigList, |
| | | getDataSourceConfigList, |
| | | importDataSourceConfig, |
| | | importDataSourceConfigTemplate, |
| | | } from '#/api/infra/data-source-config'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import ImportModalComponent from '#/components/import-modal'; |
| | | |
| | | import { useGridColumns } from './data'; |
| | | import Form from './modules/form.vue'; |
| | |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [ImportModal, importModalApi] = useVbenModal({ |
| | | connectedComponent: ImportModalComponent, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** 刷新表格 */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** 导入数据源 */ |
| | | function handleImport() { |
| | | importModalApi |
| | | .setData({ |
| | | title: $t('ui.actionTitle.import', ['数据源']), |
| | | fileName: '数据源配置导入模板.xls', |
| | | importFn: importDataSourceConfig, |
| | | templateFn: importDataSourceConfigTemplate, |
| | | }) |
| | | .open(); |
| | | } |
| | | |
| | | /** 创建数据源 */ |
| | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <ImportModal @success="handleRefresh" /> |
| | | <Grid table-title="数据源列表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.import', ['数据源']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.UPLOAD, |
| | | auth: ['infra:data-source-config:import'], |
| | | onClick: handleImport, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.deleteBatch'), |
| | | type: 'primary', |
| | | danger: true, |