From 7d5f9791941d0ef9cd6d2daae80b5ae391e18b43 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 01 七月 2026 16:10:10 +0800
Subject: [PATCH] 银川 1.联调产品维护页面 2.添加采购申请页面、联调

---
 src/views/erp/purchase/request/index.vue |  100 +++++++++++++++++++++++---------------------------
 1 files changed, 46 insertions(+), 54 deletions(-)

diff --git a/src/views/erp/purchase/request/index.vue b/src/views/erp/purchase/request/index.vue
index a3cd39c..1eebbc5 100644
--- a/src/views/erp/purchase/request/index.vue
+++ b/src/views/erp/purchase/request/index.vue
@@ -4,29 +4,41 @@
 
 import { ref } from 'vue';
 
-import { Page, useVbenModal } from '../../../../packages/effects/common-ui/src';
+import { confirm, Page, useVbenModal } from '../../../../packages/effects/common-ui/src';
 import { downloadFileFromBlobPart, isEmpty } from '../../../../packages/utils/src';
 
 import { message, Tag } from 'ant-design-vue';
 
 import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
 import {
-  approvePurchaseRequest,
-  convertToPurchaseOrder,
   deletePurchaseRequest,
   exportPurchaseRequest,
+  getApproveProcessList,
   getPurchaseRequestPage,
+  submitPurchaseRequest,
 } from '#/api/erp/purchase/request';
 import { $t } from '#/locales';
 
-import { useGridColumns, useGridFormSchema, PURCHASE_REQUEST_STATUS } from './data';
+import { useGridColumns, useGridFormSchema } from './data';
 import Form from './modules/form.vue';
+import OrderForm from './modules/order-form.vue';
+import ProcessSelectModal from './modules/process-select-modal.vue';
 
 /** ERP 閲囪喘鐢宠鍒楄〃 */
 defineOptions({ name: 'ErpPurchaseRequest' });
 
 const [FormModal, formModalApi] = useVbenModal({
   connectedComponent: Form,
+  destroyOnClose: true,
+});
+
+const [OrderFormModal, orderFormModalApi] = useVbenModal({
+  connectedComponent: OrderForm,
+  destroyOnClose: true,
+});
+
+const [ProcessModal, processModalApi] = useVbenModal({
+  connectedComponent: ProcessSelectModal,
   destroyOnClose: true,
 });
 
@@ -66,34 +78,29 @@
   }
 }
 
-/** 瀹℃壒閲囪喘鐢宠 */
-async function handleApprove(row: ErpPurchaseRequestApi.PurchaseRequest, status: number) {
+/** 鎻愪氦瀹℃壒 - 鍏堣幏鍙栨祦绋嬪垪琛� */
+async function handleSubmit(row: ErpPurchaseRequestApi.PurchaseRequest) {
   const hideLoading = message.loading({
-    content: `纭畾${status === 1 ? '瀹℃壒閫氳繃' : '瀹℃壒鎷掔粷'}璇ョ敵璇峰悧锛焋,
+    content: '鑾峰彇瀹℃壒娴佺▼...',
     duration: 0,
   });
   try {
-    await approvePurchaseRequest({ id: row.id!, status, remark: '' });
-    message.success(`${status === 1 ? '瀹℃壒閫氳繃' : '瀹℃壒鎷掔粷'}鎴愬姛`);
-    handleRefresh();
-  } finally {
+    const processList = await getApproveProcessList(row.id!);
+    hideLoading();
+    if (!processList || processList.length === 0) {
+      message.warning('鏆傛棤鍙敤瀹℃壒娴佺▼锛岃鍏堥厤缃� BPM 娴佺▼');
+      return;
+    }
+    // 鎵撳紑娴佺▼閫夋嫨寮圭獥
+    processModalApi.setData({ id: row.id, processList }).open();
+  } catch {
     hideLoading();
   }
 }
 
-/** 杞负閲囪喘璁㈠崟 */
-async function handleConvert(row: ErpPurchaseRequestApi.PurchaseRequest) {
-  const hideLoading = message.loading({
-    content: '姝e湪杞负閲囪喘璁㈠崟...',
-    duration: 0,
-  });
-  try {
-    await convertToPurchaseOrder(row.id!);
-    message.success('宸叉垚鍔熻浆涓洪噰璐鍗�');
-    handleRefresh();
-  } finally {
-    hideLoading();
-  }
+/** 鐢熸垚閲囪喘璁㈠崟 */
+function handleGenerateOrder(row: ErpPurchaseRequestApi.PurchaseRequest) {
+  orderFormModalApi.setData({ id: row.id, supplierId: row.supplierId }).open();
 }
 
 const checkedIds = ref<number[]>([]);
@@ -148,6 +155,8 @@
 <template>
   <Page auto-content-height>
     <FormModal @success="handleRefresh" />
+    <OrderFormModal @success="handleRefresh" />
+    <ProcessModal @success="handleRefresh" />
     <Grid table-title="閲囪喘鐢宠鍒楄〃">
       <template #toolbar-tools>
         <TableAction
@@ -182,10 +191,11 @@
         />
       </template>
       <template #status="{ row }">
-        <Tag v-if="row.status === 0" color="warning">寰呭鎵�</Tag>
-        <Tag v-else-if="row.status === 1" color="success">宸插鎵�</Tag>
-        <Tag v-else-if="row.status === 2" color="error">宸叉嫆缁�</Tag>
-        <Tag v-else-if="row.status === 3" color="default">宸茶浆璁㈠崟</Tag>
+        <Tag v-if="row.status === 0" color="default">鏈彁浜�</Tag>
+        <Tag v-else-if="row.status === 10" color="processing">瀹℃壒涓�</Tag>
+        <Tag v-else-if="row.status === 20" color="success">瀹℃牳閫氳繃</Tag>
+        <Tag v-else-if="row.status === 30" color="error">瀹℃牳涓嶉�氳繃</Tag>
+        <Tag v-else-if="row.status === 40" color="warning">宸插彇娑�</Tag>
       </template>
       <template #actions="{ row }">
         <TableAction
@@ -206,35 +216,17 @@
               onClick: handleEdit.bind(null, row),
             },
             {
-              label: '瀹℃壒閫氳繃',
+              label: '鎻愪氦',
               type: 'link',
-              auth: ['erp:purchase-request:approve'],
-              ifShow: () => row.status === 0,
-              popConfirm: {
-                title: '纭瀹℃壒閫氳繃璇ョ敵璇峰悧锛�',
-                confirm: handleApprove.bind(null, row, 1),
-              },
+              ifShow: () => row.status === 0 || row.status === 30,
+              onClick: handleSubmit.bind(null, row),
             },
             {
-              label: '瀹℃壒鎷掔粷',
+              label: '鐢熸垚璁㈠崟',
               type: 'link',
-              danger: true,
-              auth: ['erp:purchase-request:approve'],
-              ifShow: () => row.status === 0,
-              popConfirm: {
-                title: '纭瀹℃壒鎷掔粷璇ョ敵璇峰悧锛�',
-                confirm: handleApprove.bind(null, row, 2),
-              },
-            },
-            {
-              label: '杞鍗�',
-              type: 'link',
-              auth: ['erp:purchase-request:convert'],
-              ifShow: () => row.status === 1,
-              popConfirm: {
-                title: '纭杞负閲囪喘璁㈠崟鍚楋紵',
-                confirm: handleConvert.bind(null, row),
-              },
+              auth: ['erp:purchase-request:generate-order'],
+              ifShow: () => row.status === 20 && !row.orderId,
+              onClick: handleGenerateOrder.bind(null, row),
             },
             {
               label: $t('common.delete'),
@@ -253,4 +245,4 @@
       </template>
     </Grid>
   </Page>
-</template>
\ No newline at end of file
+</template>

--
Gitblit v1.9.3