From 0251fb6f8979a5943f58478686265ce776103ab4 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 25 八月 2026 09:08:17 +0800
Subject: [PATCH] feat(erp): 采购订单审批进协同办公——移除页面审批按钮,已办任务增加反审批
---
src/views/erp/purchase/order/index.vue | 36 +-----------------
src/views/bpm/task/done/data.ts | 2
src/api/erp/purchase/order/index.ts | 7 +++
src/views/bpm/task/done/index.vue | 35 +++++++++++++++++
4 files changed, 45 insertions(+), 35 deletions(-)
diff --git a/src/api/erp/purchase/order/index.ts b/src/api/erp/purchase/order/index.ts
index 5ea3dff..f28d66a 100644
--- a/src/api/erp/purchase/order/index.ts
+++ b/src/api/erp/purchase/order/index.ts
@@ -103,6 +103,13 @@
return requestClient.get<any[]>('/erp/purchase-order/approve-process-list');
}
+/** 鍙嶅鎵癸紙鍗忓悓鍔炲叕宸插姙浠诲姟涓挙鍥炲凡瀹℃牳璁㈠崟锛屽洖閫�涓烘湭瀹℃牳锛� */
+export function reverseApprove(processInstanceId: string) {
+ return requestClient.post('/erp/purchase-order/reverse-approve', null, {
+ params: { processInstanceId },
+ });
+}
+
/** 鑾峰彇閲囪喘瀹℃牳娴佺▼鍒楄〃鍝嶅簲 */
export interface ProcessDefinition {
id: string; // 娴佺▼瀹氫箟ID
diff --git a/src/views/bpm/task/done/data.ts b/src/views/bpm/task/done/data.ts
index 3c5e9f6..66aae84 100644
--- a/src/views/bpm/task/done/data.ts
+++ b/src/views/bpm/task/done/data.ts
@@ -146,7 +146,7 @@
},
{
title: '鎿嶄綔',
- width: 120,
+ width: 180,
fixed: 'right',
slots: { default: 'actions' },
},
diff --git a/src/views/bpm/task/done/index.vue b/src/views/bpm/task/done/index.vue
index 753eda8..4bf1c3a 100644
--- a/src/views/bpm/task/done/index.vue
+++ b/src/views/bpm/task/done/index.vue
@@ -7,6 +7,7 @@
import { message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import { reverseApprove } from '#/api/erp/purchase/order';
import { getTaskDonePage, withdrawTask } from '#/api/bpm/task';
import { router } from '#/router';
@@ -34,6 +35,28 @@
try {
await withdrawTask(row.id);
message.success('鎾ゅ洖鎴愬姛');
+ await gridApi.query();
+ } finally {
+ hideLoading();
+ }
+}
+
+/** 鏄惁閲囪喘璁㈠崟瀹℃壒浠诲姟锛堢敤浜庢樉绀�"鍙嶅鎵�"銆侀殣钘忛�氱敤"鎾ゅ洖"锛� */
+function isPurchaseOrderApprove(row: BpmTaskApi.Task) {
+ return (row.processInstance?.processDefinitionId || '').startsWith(
+ 'purchase_order_approve',
+ );
+}
+
+/** 鍙嶅鎵归噰璐鍗曪紙宸插鏍� -> 鏈鏍革紝鍦ㄥ崗鍚屽姙鍏凡鍔炰换鍔′腑鎿嶄綔锛� */
+async function handleReverseApprove(row: BpmTaskApi.Task) {
+ const hideLoading = message.loading({
+ content: '鍙嶅鎵逛腑...',
+ duration: 0,
+ });
+ try {
+ await reverseApprove(row.processInstance.id);
+ message.success('鍙嶅鎵规垚鍔燂紝璁㈠崟宸查噸鏂拌繘鍏ュ緟鍔炲鎵�');
await gridApi.query();
} finally {
hideLoading();
@@ -77,10 +100,22 @@
<TableAction
:actions="[
{
+ label: '鍙嶅鎵�',
+ type: 'link',
+ danger: true,
+ icon: ACTION_ICON.AUDIT,
+ ifShow: () => isPurchaseOrderApprove(row),
+ popConfirm: {
+ title: '纭畾瑕佸弽瀹℃壒璇ラ噰璐鍗曞悧锛熻鍗曞皢閲嶆柊杩涘叆寰呭姙瀹℃壒',
+ confirm: handleReverseApprove.bind(null, row),
+ },
+ },
+ {
label: '鎾ゅ洖',
type: 'link',
danger: true,
icon: ACTION_ICON.DELETE,
+ ifShow: () => !isPurchaseOrderApprove(row),
popConfirm: {
title: '纭畾瑕佹挙鍥炶浠诲姟鍚楋紵',
confirm: handleWithdraw.bind(null, row),
diff --git a/src/views/erp/purchase/order/index.vue b/src/views/erp/purchase/order/index.vue
index c56c84d..79a6a6c 100644
--- a/src/views/erp/purchase/order/index.vue
+++ b/src/views/erp/purchase/order/index.vue
@@ -16,7 +16,6 @@
deletePurchaseOrder,
exportPurchaseOrder,
getPurchaseOrderPage,
- updatePurchaseOrderStatus,
} from '#/api/erp/purchase/order';
import { $t } from '#/locales';
@@ -63,24 +62,6 @@
try {
await deletePurchaseOrder(ids);
message.success($t('ui.actionMessage.deleteSuccess'));
- handleRefresh();
- } finally {
- hideLoading();
- }
-}
-
-/** 瀹℃壒/鍙嶅鎵规搷浣� */
-async function handleUpdateStatus(
- row: ErpPurchaseOrderApi.PurchaseOrder,
- status: number,
-) {
- const hideLoading = message.loading({
- content: `纭畾${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}璇ヨ鍗曞悧锛焋,
- duration: 0,
- });
- try {
- await updatePurchaseOrderStatus(row.id!, status);
- message.success(`${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}鎴愬姛`);
handleRefresh();
} finally {
hideLoading();
@@ -159,7 +140,8 @@
</script>
<template>
- <Page auto-content-height><FormModal @success="handleRefresh" />
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
<Grid table-title="閲囪喘璁㈠崟鍒楄〃">
<template #toolbar-tools>
<TableAction
@@ -215,20 +197,6 @@
auth: ['erp:purchase-order:update'],
ifShow: () => row.status !== 20,
onClick: handleEdit.bind(null, row),
- },
- {
- label: row.status === 10 ? '瀹℃壒' : '鍙嶅鎵�',
- type: 'link',
- icon: ACTION_ICON.AUDIT,
- auth: ['erp:purchase-order:update-status'],
- popConfirm: {
- title: `纭${row.status === 10 ? '瀹℃壒' : '鍙嶅鎵�'}${row.no}鍚楋紵`,
- confirm: handleUpdateStatus.bind(
- null,
- row,
- row.status === 10 ? 20 : 10,
- ),
- },
},
{
label: '纭鏀惰揣',
--
Gitblit v1.9.3