| | |
| | | import { |
| | | deleteParameter, |
| | | getParameterPage, |
| | | exportParameterExcel, |
| | | } from '#/api/mes/pro/processdesign/parameter'; |
| | | import { $t } from '#/locales'; |
| | | import { downloadFileFromBlobPart } from '../../../../packages/utils/src'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | |
| | | /** 删除工艺参数 */ |
| | | async function handleDelete(row: MesPdParameterApi.Parameter) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.name]), |
| | | content: $t('ui.actionMessage.deleting', [row.paramName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteParameter(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.name])); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.paramName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 导出工艺参数 */ |
| | | async function handleExport() { |
| | | const formValues = await gridApi.formApi.getValues(); |
| | | const data = await exportParameterExcel(formValues); |
| | | downloadFileFromBlobPart({ fileName: '工艺参数.xlsx', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | |
| | | auth: ['mes:pd:parameter:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:pd:parameter:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)">{{ row.code }}</Button> |
| | | <template #paramCode="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)">{{ row.paramCode }}</Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:pd:parameter:delete'], |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.name]), |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.paramName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |