From baddb052ccd4a91ef1881ba663e6a4e55b05f4fb Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 14 十月 2026 15:51:55 +0800
Subject: [PATCH] feat(hrm): 社保公积金方案表单加「适用部门」与默认缴费基数,修比例输入精度
---
src/api/erp/purchase/request/index.ts | 71 ++++++++++++++++++++++++++++++++++-
1 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/src/api/erp/purchase/request/index.ts b/src/api/erp/purchase/request/index.ts
index a7702d1..128bdd0 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; // 鍒涘缓鏃堕棿
}
@@ -36,12 +38,26 @@
productUnitId?: number; // 浜у搧鍗曚綅缂栧彿
productUnitName?: string; // 浜у搧鍗曚綅鍚嶇О
productBarCode?: string; // 浜у搧鏉$爜
- productPrice?: number; // 浜у搧鍗曚环锛堝弬鑰冧环锛�
+ productPrice?: number; // 鍚◣鍗曚环锛堝弬鑰冧环锛�
count: number; // 鏁伴噺
taxPercent?: number; // 绋庣巼
+ totalPrice?: number; // 涓嶅惈绋庨噾棰�
+ taxPrice?: number; // 绋庨
demandTime?: string; // 闇�姹傛棩鏈�
remark?: string; // 澶囨敞
+ qcCheckFlag?: boolean; // 鏄惁璐ㄦ
+ inCount?: number; // 鍏ュ簱鏁伴噺
}
+}
+
+/** 閲囪喘鐢宠瀵煎叆缁撴灉 */
+export interface ImportResult {
+ /** 鍒涘缓鎴愬姛鐨勯噰璐敵璇峰崟鍙� */
+ createList?: string[];
+ /** 鏇存柊鎴愬姛鐨勯噰璐敵璇峰崟鍙� */
+ updateList?: string[];
+ /** 瀵煎叆澶辫触闆嗗悎锛宬ey 涓洪噰璐敵璇峰崟鍙锋垨琛屽彿锛寁alue 涓哄け璐ュ師鍥� */
+ failureList?: Record<string, string>;
}
/** 鍒涘缓閲囪喘鐢宠 */
@@ -57,6 +73,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 +114,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