| | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmReturnVendorApi } from '#/api/mes/wm/returnvendor'; |
| | | |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { Page, useVbenModal } from '@vben/common-ui'; |
| | | import { MesWmReturnVendorStatusEnum } from '@vben/constants'; |
| | | import { downloadFileFromBlobPart } from '@vben/utils'; |
| | |
| | | cancelReturnVendor, |
| | | deleteReturnVendor, |
| | | exportReturnVendor, |
| | | getReturnVendorApproveProcessList, |
| | | getReturnVendorPage, |
| | | submitReturnVendorApproval, |
| | | } from '#/api/mes/wm/returnvendor'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import ProcessSelectModal from '#/views/wls/components/process-select-modal.vue'; |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [ProcessModal, processModalApi] = useVbenModal({ |
| | | connectedComponent: ProcessSelectModal, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | /** 执行拣货 */ |
| | | function handleStock(row: MesWmReturnVendorApi.ReturnVendor) { |
| | | formModalApi.setData({ formType: 'stock', id: row.id }).open(); |
| | | } |
| | | |
| | | /** 提交审批 - 先获取流程列表 */ |
| | | async function handleSubmitApproval(row: MesWmReturnVendorApi.ReturnVendor) { |
| | | const hideLoading = message.loading({ |
| | | content: '获取审批流程...', |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | const processList = await getReturnVendorApproveProcessList(); |
| | | hideLoading(); |
| | | if (!processList || processList.length === 0) { |
| | | message.warning('暂无可用审批流程,请先配置 BPM 流程'); |
| | | return; |
| | | } |
| | | processModalApi |
| | | .setData({ |
| | | id: row.id, |
| | | processList, |
| | | submitFn: submitReturnVendorApproval, |
| | | }) |
| | | .open(); |
| | | } catch { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 查看审批详情 */ |
| | | function handleProcessDetail(row: MesWmReturnVendorApi.ReturnVendor) { |
| | | if (!row.processInstanceId) { |
| | | message.warning('该单据尚未提交审批'); |
| | | return; |
| | | } |
| | | router.push({ |
| | | name: 'BpmProcessInstanceDetail', |
| | | query: { id: row.processInstanceId }, |
| | | }); |
| | | } |
| | | |
| | | /** 完成退货 */ |
| | |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <ProcessModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="供应商退货单列表"> |
| | | <template #toolbar-tools> |
| | |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: '提交审批', |
| | | type: 'link', |
| | | auth: ['mes:wm-return-vendor:update'], |
| | | ifShow: row.status === MesWmReturnVendorStatusEnum.PREPARE, |
| | | onClick: handleSubmitApproval.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | |
| | | }, |
| | | }, |
| | | { |
| | | label: '查看审批', |
| | | type: 'link', |
| | | auth: ['mes:wm-return-vendor:query'], |
| | | ifShow: row.status === MesWmReturnVendorStatusEnum.APPROVING, |
| | | onClick: handleProcessDetail.bind(null, row), |
| | | }, |
| | | { |
| | | label: '执行拣货', |
| | | type: 'link', |
| | | auth: ['mes:wm-return-vendor:update'], |