| | |
| | | exportItemType, |
| | | getItemTypeList, |
| | | } from '#/api/mes/md/item/type'; |
| | | import { getItemPage as getMesItemPage } from '#/api/mes/md/item'; |
| | | import { getItemPage as getMdmItemPage } from '#/api/mdm/item'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | |
| | | |
| | | /** 删除分类 */ |
| | | async function handleDelete(row: MesMdItemTypeApi.ItemType) { |
| | | try { |
| | | const [mesResult, mdmResult] = await Promise.all([ |
| | | getMesItemPage({ pageNo: 1, pageSize: 1, itemTypeId: row.id }), |
| | | getMdmItemPage({ pageNo: 1, pageSize: 1, categoryId: row.id } as any), |
| | | ]); |
| | | if (mesResult.total > 0 || mdmResult.total > 0) { |
| | | message.error('该分类下存在物料,无法删除'); |
| | | return; |
| | | } |
| | | } catch { |
| | | // 查询异常时继续执行删除,由后端兜底校验 |
| | | } |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.name]), |
| | | duration: 0, |