| | |
| | | import type { SrmSupplierApi } from '#/api/srm/supplier'; |
| | | |
| | | import { Page, useVbenModal } from '@vben/common-ui'; |
| | | import { downloadFileFromBlobPart } from '@vben/utils'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteSupplier, |
| | | exportSupplierExcel, |
| | | getSupplierPage, |
| | | } from '#/api/srm/supplier'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import SupplierForm from './modules/form.vue'; |
| | | import SupplierImportForm from './modules/import-form.vue'; |
| | | |
| | | defineOptions({ name: 'SrmSupplier' }); |
| | | |
| | |
| | | |
| | | function handleEdit(row: SrmSupplierApi.SupplierVO) { |
| | | formModalApi.setData(row).open(); |
| | | } |
| | | |
| | | /** 导入供应商 */ |
| | | function handleImport() { |
| | | importModalApi.open(); |
| | | } |
| | | |
| | | /** 导出供应商(按当前搜索条件) */ |
| | | async function handleExport() { |
| | | const formValues = await gridApi.formApi.getValues(); |
| | | const data = await exportSupplierExcel(formValues); |
| | | downloadFileFromBlobPart({ fileName: '供应商数据.xlsx', source: data }); |
| | | } |
| | | |
| | | async function handleDelete(row: SrmSupplierApi.SupplierVO) { |
| | |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: SupplierForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [SupplierImportModal, importModalApi] = useVbenModal({ |
| | | connectedComponent: SupplierImportForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <SupplierImportModal @success="handleRefresh" /> |
| | | <Grid table-title="供应商列表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | |
| | | auth: ['srm:supplier:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.import'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.UPLOAD, |
| | | auth: ['srm:supplier:import'], |
| | | onClick: handleImport, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['srm:supplier:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |