| | |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { Page, useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | 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 { deleteItemType, getItemTypeList } from '#/api/mes/md/item/type'; |
| | | import { |
| | | deleteItemType, |
| | | exportItemType, |
| | | getItemTypeList, |
| | | } from '#/api/mes/md/item/type'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | import ImportForm from './modules/import-form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [ImportModal, importModalApi] = useVbenModal({ |
| | | connectedComponent: ImportForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | /** 创建分类 */ |
| | | function handleCreate() { |
| | | formModalApi.setData(null).open(); |
| | | } |
| | | |
| | | /** 导入分类 */ |
| | | function handleImport() { |
| | | importModalApi.open(); |
| | | } |
| | | |
| | | /** 导出分类(按当前列表查询条件导出全部命中数据) */ |
| | | async function handleExport() { |
| | | const data = await exportItemType(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: '物料分类数据.xls', source: data }); |
| | | } |
| | | |
| | | /** 添加下级分类 */ |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <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: ['mes:md-item-type:import'], |
| | | onClick: handleImport, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:md-item-type:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | { |
| | | label: isExpanded ? '收缩' : '展开', |
| | | type: 'primary', |
| | | onClick: handleExpand, |