From a241b66efcc41e973290a6722fb7a4d79b833ea1 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 13 十月 2026 09:54:32 +0800
Subject: [PATCH] feat(bi): 为图表配置接口添加名称字段
---
src/api/erp/purchase/request/index.ts | 114 ++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 93 insertions(+), 21 deletions(-)
diff --git a/src/api/erp/purchase/request/index.ts b/src/api/erp/purchase/request/index.ts
index c35f89c..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';
@@ -7,15 +7,25 @@
export interface PurchaseRequest {
id?: number; // 缂栧彿
no?: string; // 鐢宠缂栧彿
+ status?: number; // 鐘舵�侊細0鏈彁浜� 10瀹℃壒涓� 20瀹℃牳閫氳繃 30瀹℃牳涓嶉�氳繃 40宸插彇娑�
+ processInstanceId?: string; // 宸ヤ綔娴佺紪鍙�
+ requestUserId?: number; // 鐢宠浜虹紪鍙�
+ requestUserName?: string; // 鐢宠浜哄悕绉�
+ requestDeptId?: number; // 鐢宠閮ㄩ棬缂栧彿
+ requestDeptName?: string; // 鐢宠閮ㄩ棬鍚嶇О
+ requestTime: string; // 鐢宠鏃堕棿
+ requestReason?: string; // 鐢宠鐞嗙敱
supplierId?: number; // 渚涘簲鍟嗙紪鍙�
supplierName?: string; // 渚涘簲鍟嗗悕绉�
- requestTime: string; // 鐢宠鏃堕棿
- requesterId?: number; // 鐢宠浜虹紪鍙�
- requesterName?: string; // 鐢宠浜哄悕绉�
- reason?: string; // 鐢宠鐞嗙敱
- estimatedAmount?: number; // 棰勪及閲戦
- status?: number; // 鐘舵��
+ discountPercent?: number; // 浼樻儬鐜�
+ 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; // 鍒涘缓鏃堕棿
}
@@ -25,13 +35,25 @@
id?: number; // 缂栧彿
productId: number; // 浜у搧缂栧彿
productName?: string; // 浜у搧鍚嶇О
- productUnitName?: string; // 浜у搧鍗曚綅
+ productUnitId?: number; // 浜у搧鍗曚綅缂栧彿
+ productUnitName?: string; // 浜у搧鍗曚綅鍚嶇О
productBarCode?: string; // 浜у搧鏉$爜
- requestCount: number; // 鐢宠鏁伴噺
- estimatedPrice?: number; // 棰勪及鍗曚环
- requiredDate?: string; // 闇�姹傛棩鏈�
+ productPrice?: number; // 浜у搧鍗曚环锛堝弬鑰冧环锛�
+ count: number; // 鏁伴噺
+ taxPercent?: number; // 绋庣巼
+ demandTime?: string; // 闇�姹傛棩鏈�
remark?: string; // 澶囨敞
}
+}
+
+/** 閲囪喘鐢宠瀵煎叆缁撴灉 */
+export interface ImportResult {
+ /** 鍒涘缓鎴愬姛鐨勯噰璐敵璇峰崟鍙� */
+ createList?: string[];
+ /** 鏇存柊鎴愬姛鐨勯噰璐敵璇峰崟鍙� */
+ updateList?: string[];
+ /** 瀵煎叆澶辫触闆嗗悎锛宬ey 涓洪噰璐敵璇峰崟鍙锋垨琛屽彿锛寁alue 涓哄け璐ュ師鍥� */
+ failureList?: Record<string, string>;
}
/** 鍒涘缓閲囪喘鐢宠 */
@@ -44,18 +66,19 @@
return requestClient.put('/erp/purchase-request/update', data);
}
-/** 瀹℃壒閲囪喘鐢宠 */
-export function approvePurchaseRequest(params: {
- id: number;
- status: number;
- remark?: string;
-}) {
- return requestClient.put('/erp/purchase-request/approve', null, { params });
+/** 鎻愪氦閲囪喘鐢宠瀹℃壒 */
+export function submitPurchaseRequest(id: number, processDefinitionKey: string) {
+ return requestClient.put('/erp/purchase-request/submit', null, { params: { id, processDefinitionKey } });
}
-/** 杞负閲囪喘璁㈠崟 */
-export function convertToPurchaseOrder(id: number) {
- return requestClient.put('/erp/purchase-request/convert', null, { params: { id } });
+/** 閲嶇疆琚┏鍥炵殑閲囪喘鐢宠涓鸿崏绋跨姸鎬� */
+export function resetPurchaseRequestStatus(id: number) {
+ return requestClient.put('/erp/purchase-request/reset-status', null, { params: { id } });
+}
+
+/** 鐢熸垚閲囪喘璁㈠崟 */
+export function generatePurchaseOrder(id: number, supplierId: number) {
+ return requestClient.post<number>('/erp/purchase-request/generate-order', null, { params: { id, supplierId } });
}
/** 鍒犻櫎閲囪喘鐢宠 */
@@ -82,3 +105,52 @@
export function exportPurchaseRequest(params: any) {
return requestClient.download('/erp/purchase-request/export-excel', { params });
}
+
+/** 鑾峰彇瀹℃壒娴佺▼鍒楄〃 */
+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