| | |
| | | import { |
| | | deleteUnit, |
| | | getUnitPage, |
| | | importUnit, |
| | | importUnitTemplate, |
| | | } from '#/api/mdm/unit'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | import ImportModalComponent from '#/components/import-modal'; |
| | | |
| | | defineOptions({ name: 'MdmUnit' }); |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [ImportModal, importModalApi] = useVbenModal({ |
| | | connectedComponent: ImportModalComponent, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | /** 创建计量单位 */ |
| | | function handleCreate() { |
| | | formModalApi.setData(null).open(); |
| | | } |
| | | |
| | | /** 导入计量单位 */ |
| | | function handleImport() { |
| | | importModalApi |
| | | .setData({ |
| | | title: $t('ui.actionTitle.import', ['计量单位']), |
| | | fileName: '计量单位导入模板.xls', |
| | | importFn: importUnit, |
| | | templateFn: importUnitTemplate, |
| | | }) |
| | | .open(); |
| | | } |
| | | |
| | | /** 编辑计量单位 */ |
| | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <ImportModal @success="handleRefresh" /> |
| | | <Grid table-title="计量单位列表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | |
| | | auth: ['mdm:unit:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.import', ['计量单位']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.UPLOAD, |
| | | auth: ['mdm:unit:import'], |
| | | onClick: handleImport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |