From 18340ebdeb405be3ba01eb4d1600d9b26cee7ccd Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期一, 14 九月 2026 16:56:13 +0800
Subject: [PATCH] fix(erp): 查看审批明细时明细表格取消固定列
---
src/api/erp/purchase/request/index.ts | 65 +++++++++++++++++++++++++++++++-
1 files changed, 63 insertions(+), 2 deletions(-)
diff --git a/src/api/erp/purchase/request/index.ts b/src/api/erp/purchase/request/index.ts
index a7702d1..3553382 100644
--- a/src/api/erp/purchase/request/index.ts
+++ b/src/api/erp/purchase/request/index.ts
@@ -1,4 +1,4 @@
-import type { PageParam, PageResult } from '../../../../packages/effects/request/src';
+import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
@@ -8,6 +8,7 @@
id?: number; // 缂栧彿
no?: string; // 鐢宠缂栧彿
status?: number; // 鐘舵�侊細0鏈彁浜� 10瀹℃壒涓� 20瀹℃牳閫氳繃 30瀹℃牳涓嶉�氳繃 40宸插彇娑�
+ processInstanceId?: string; // 宸ヤ綔娴佺紪鍙�
requestUserId?: number; // 鐢宠浜虹紪鍙�
requestUserName?: string; // 鐢宠浜哄悕绉�
requestDeptId?: number; // 鐢宠閮ㄩ棬缂栧彿
@@ -17,13 +18,14 @@
supplierId?: number; // 渚涘簲鍟嗙紪鍙�
supplierName?: string; // 渚涘簲鍟嗗悕绉�
discountPercent?: number; // 浼樻儬鐜�
- fileUrl?: string; // 闄勪欢鍦板潃
+ attachmentList?: { id: number; name?: string; url?: string }[]; // 闄勪欢鍒楄〃
remark?: string; // 澶囨敞
totalCount?: number; // 鎬绘暟閲�
totalPrice?: number; // 鎬婚噾棰�
productNames?: string; // 浜у搧鍚嶇О鍒楄〃
orderId?: number; // 鐢熸垚鐨勯噰璐鍗曠紪鍙�
orderNo?: string; // 鐢熸垚鐨勯噰璐鍗曞彿
+ processInstanceId?: number; // 瀹℃壒娴佺▼瀹炰緥缂栧彿
items?: PurchaseRequestItem[]; // 鐢宠鏄庣粏
createTime?: string; // 鍒涘缓鏃堕棿
}
@@ -44,6 +46,16 @@
}
}
+/** 閲囪喘鐢宠瀵煎叆缁撴灉 */
+export interface ImportResult {
+ /** 鍒涘缓鎴愬姛鐨勯噰璐敵璇峰崟鍙� */
+ createList?: string[];
+ /** 鏇存柊鎴愬姛鐨勯噰璐敵璇峰崟鍙� */
+ updateList?: string[];
+ /** 瀵煎叆澶辫触闆嗗悎锛宬ey 涓洪噰璐敵璇峰崟鍙锋垨琛屽彿锛寁alue 涓哄け璐ュ師鍥� */
+ failureList?: Record<string, string>;
+}
+
/** 鍒涘缓閲囪喘鐢宠 */
export function createPurchaseRequest(data: ErpPurchaseRequestApi.PurchaseRequest) {
return requestClient.post('/erp/purchase-request/create', data);
@@ -57,6 +69,11 @@
/** 鎻愪氦閲囪喘鐢宠瀹℃壒 */
export function submitPurchaseRequest(id: number, processDefinitionKey: string) {
return requestClient.put('/erp/purchase-request/submit', null, { params: { id, processDefinitionKey } });
+}
+
+/** 閲嶇疆琚┏鍥炵殑閲囪喘鐢宠涓鸿崏绋跨姸鎬� */
+export function resetPurchaseRequestStatus(id: number) {
+ return requestClient.put('/erp/purchase-request/reset-status', null, { params: { id } });
}
/** 鐢熸垚閲囪喘璁㈠崟 */
@@ -93,3 +110,47 @@
export function getApproveProcessList(id: number) {
return requestClient.get(`/erp/purchase-request/approve-process-list`, { params: { id } });
}
+
+/** BPM 娴佺▼瀹炰緥鐘舵�� 鈫� 涓氬姟鐘舵�佹槧灏� */
+export const BPM_STATUS_TO_BIZ: Record<number, number> = {
+ 1: 10, // RUNNING 鈫� 瀹℃壒涓�
+ 2: 20, // APPROVE 鈫� 瀹℃牳閫氳繃
+ 3: 30, // REJECT 鈫� 瀹℃牳涓嶉�氳繃
+ 4: 40, // CANCEL 鈫� 宸插彇娑�
+};
+
+/**
+ * 鍚屾閲囪喘鐢宠鐨勪笟鍔$姸鎬侊紙鏍规嵁 BPM 娴佺▼瀹炰緥瀹為檯鐘舵�侊級
+ * 鐢ㄤ簬淇鍚庣鐩戝惉鍣ㄦ湭姝g‘鍥炲啓瀵艰嚧鐨勪笟鍔$姸鎬佷笉涓�鑷撮棶棰�
+ */
+export async function syncPurchaseRequestStatus(items: ErpPurchaseRequestApi.PurchaseRequest[]) {
+ const processingItems = items.filter(
+ (item) => item.status === 10 && item.processInstanceId,
+ );
+ if (processingItems.length === 0) return;
+
+ const { getApprovalDetail } = await import('#/api/bpm/processInstance');
+ for (const item of processingItems) {
+ try {
+ const detail = await getApprovalDetail({
+ processInstanceId: item.processInstanceId,
+ });
+ const bizStatus = BPM_STATUS_TO_BIZ[detail.processInstance?.status];
+ if (bizStatus && bizStatus !== 10) {
+ item.status = bizStatus;
+ }
+ } catch {
+ // 鏌ヨ澶辫触鏃朵繚鎸佸師鏈夌姸鎬�
+ }
+ }
+}
+
+/** 涓嬭浇閲囪喘鐢宠瀵煎叆妯℃澘 */
+export function importPurchaseRequestTemplate() {
+ return requestClient.download('/erp/purchase-request/get-import-template');
+}
+
+/** 瀵煎叆閲囪喘鐢宠 */
+export function importPurchaseRequest(file: File) {
+ return requestClient.upload<ImportResult>('/erp/purchase-request/import', { file });
+}
--
Gitblit v1.9.3