| | |
| | | <script lang="ts" setup> |
| | | import { automaticApproval } from '#/store/audit-policy'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { ErpPurchaseRequestApi } from '#/api/erp/purchase/request'; |
| | | |
| | |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | import ImportForm from './modules/import-form.vue'; |
| | | import OrderForm from './modules/order-form.vue'; |
| | | import ProcessSelectModal from './modules/process-select-modal.vue'; |
| | | |
| | |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [ImportModal, importModalApi] = useVbenModal({ |
| | | connectedComponent: ImportForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | async function handleExport() { |
| | | const data = await exportPurchaseRequest(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: '采购申请.xls', source: data }); |
| | | } |
| | | |
| | | /** 导入采购申请 */ |
| | | function handleImport() { |
| | | importModalApi.open(); |
| | | } |
| | | |
| | | /** 新增采购申请 */ |
| | |
| | | /** 提交审批 - 先获取流程列表 */ |
| | | async function handleSubmit(row: ErpPurchaseRequestApi.PurchaseRequest) { |
| | | const hideLoading = message.loading({ |
| | | content: '获取审批流程...', |
| | | content: automaticApproval.value ? '正在提交生效...' : '获取审批流程...', |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | if (automaticApproval.value) { |
| | | await submitPurchaseRequest(row.id!, 'purchase_request_approve'); |
| | | hideLoading(); |
| | | message.success('已提交生效'); |
| | | handleRefresh(); |
| | | return; |
| | | } |
| | | const processList = await getApproveProcessList(row.id!); |
| | | hideLoading(); |
| | | if (!processList || processList.length === 0) { |
| | |
| | | return; |
| | | } |
| | | // 打开流程选择弹窗 |
| | | |
| | | processModalApi.setData({ id: row.id, processList }).open(); |
| | | } catch { |
| | | hideLoading(); |
| | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <ImportModal @success="handleRefresh" /> |
| | | <OrderFormModal @success="handleRefresh" /> |
| | | <ProcessModal @success="handleRefresh" /> |
| | | <Grid table-title="采购申请列表"> |
| | |
| | | onClick: handleExport, |
| | | }, |
| | | { |
| | | label: '导入', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.UPLOAD, |
| | | auth: ['erp:purchase-request:import'], |
| | | onClick: handleImport, |
| | | }, |
| | | { |
| | | label: '批量删除', |
| | | type: 'primary', |
| | | danger: true, |