From 0127fd119fe2a349fbfee92b375a5680e10d3275 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期四, 27 八月 2026 14:30:33 +0800
Subject: [PATCH] feat(erp): 销售订单审批接入协同办公前端支持

---
 src/views/erp/sale/order/index.vue |   61 ++++++++++++++++++------------
 1 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/src/views/erp/sale/order/index.vue b/src/views/erp/sale/order/index.vue
index 6124ec7..925be2a 100644
--- a/src/views/erp/sale/order/index.vue
+++ b/src/views/erp/sale/order/index.vue
@@ -16,8 +16,9 @@
   deleteSaleOrder,
   enableSaleOrder,
   exportSaleOrder,
+  getSaleOrderApproveProcessList,
   getSaleOrderPage,
-  updateSaleOrderStatus,
+  submitSaleOrder,
 } from '#/api/erp/sale/order';
 import { generateFromSaleOrder } from '#/api/mes/wm/salesnotice';
 import { $t } from '#/locales';
@@ -79,21 +80,34 @@
   }
 }
 
-/** 瀹℃壒/鍙嶅鎵规搷浣� */
-async function handleUpdateStatus(
-  row: ErpSaleOrderApi.SaleOrder,
-  status: number,
-) {
+/** 鎻愪氦閿�鍞鍗曞鎵癸紙鍗忓悓鍔炲叕锛� */
+async function handleSubmit(row: ErpSaleOrderApi.SaleOrder) {
+  // 鑾峰彇鍙敤鐨勫鎵规祦绋嬪畾涔�
+  const processList = await getSaleOrderApproveProcessList();
+  if (isEmpty(processList)) {
+    message.error('閿�鍞鍗曞鎵规祦绋嬫湭閰嶇疆锛岃鍏堝湪銆屽崗鍚屽姙鍏啋娴佺▼绠$悊銆嶄腑鍒涘缓骞跺彂甯冮攢鍞鍗曞鎵规祦绋�');
+    return;
+  }
   const hideLoading = message.loading({
-    content: `纭畾${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}璇ヨ鍗曞悧锛焋,
+    content: '姝e湪鎻愪氦瀹℃壒...',
     duration: 0,
   });
   try {
-    await updateSaleOrderStatus(row.id!, status);
-    message.success(`${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}鎴愬姛`);
+    await submitSaleOrder(row.id!, processList[0].key);
+    message.success('鎻愪氦瀹℃壒鎴愬姛锛岃鍒板崗鍚屽姙鍏腑澶勭悊');
     handleRefresh();
   } finally {
     hideLoading();
+  }
+}
+
+/** 鏌ョ湅瀹℃壒杩涘害锛堣烦杞崗鍚屽姙鍏祦绋嬭鎯咃紝鍙妯″紡锛屼笉鏄剧ず瀹℃壒鎿嶄綔锛� */
+function handleViewApproval(row: ErpSaleOrderApi.SaleOrder) {
+  if (row.processInstanceId) {
+    router.push({
+      name: 'BpmProcessInstanceDetail',
+      query: { id: row.processInstanceId, viewOnly: '1' },
+    });
   }
 }
 
@@ -278,8 +292,10 @@
         <span v-else>-</span>
       </template>
       <template #status="{ row }">
-        <Tag v-if="row.status === 10" color="warning">鏈鏍�</Tag>
+        <Tag v-if="row.status === 0" color="default">鏈彁浜�</Tag>
+        <Tag v-if="row.status === 15" color="processing">瀹℃壒涓�</Tag>
         <Tag v-if="row.status === 20" color="success">宸插鏍�</Tag>
+        <Tag v-if="row.status === 35" color="warning">宸查┏鍥�</Tag>
         <Tag v-if="row.status === 30" color="error">宸蹭綔搴�</Tag>
       </template>
       <template #needProduction="{ row }">
@@ -323,30 +339,27 @@
               type: 'link',
               icon: ACTION_ICON.EDIT,
               auth: ['erp:sale-order:update'],
-              ifShow: () => row.status === 10,
+              ifShow: () => row.status === 0 || row.status === 35,
               onClick: handleEdit.bind(null, row),
             },
             {
-              label: '瀹℃壒',
+              label: '鎻愪氦瀹℃壒',
               type: 'link',
               icon: ACTION_ICON.AUDIT,
               auth: ['erp:sale-order:update-status'],
-              ifShow: () => row.status === 10,
+              ifShow: () => row.status === 0 || row.status === 35,
               popConfirm: {
-                title: `纭瀹℃壒${row.no}鍚楋紵`,
-                confirm: handleUpdateStatus.bind(null, row, 20),
+                title: `纭鎻愪氦${row.no}鐨勫鎵瑰悧锛熸彁浜ゅ悗瀹℃壒灏嗗湪鍗忓悓鍔炲叕涓畬鎴恅,
+                confirm: handleSubmit.bind(null, row),
               },
             },
             {
-              label: '鍙嶅鎵�',
+              label: '瀹℃壒杩涘害',
               type: 'link',
-              icon: ACTION_ICON.AUDIT,
-              auth: ['erp:sale-order:update-status'],
-              ifShow: () => row.status === 20,
-              popConfirm: {
-                title: `纭鍙嶅鎵�${row.no}鍚楋紵`,
-                confirm: handleUpdateStatus.bind(null, row, 10),
-              },
+              icon: 'lucide:file-clock',
+              auth: ['erp:sale-order:query'],
+              ifShow: () => row.status === 15 && !!row.processInstanceId,
+              onClick: handleViewApproval.bind(null, row),
             },
             {
               label: '浣滃簾',
@@ -384,7 +397,7 @@
               danger: true,
               icon: ACTION_ICON.DELETE,
               auth: ['erp:sale-order:delete'],
-              ifShow: () => row.status === 10,
+              ifShow: () => row.status === 0 || row.status === 35,
               popConfirm: {
                 title: $t('ui.actionMessage.deleteConfirm', [row.no]),
                 confirm: handleDelete.bind(null, [row.id!]),

--
Gitblit v1.9.3