From 552ec6b7d8ccc56c379da195fc6c9c74312b1070 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 22 五月 2026 17:57:46 +0800
Subject: [PATCH] OA部分查询条件变更
---
src/pages/oa/_utils/finReimbursementMappers.js | 70 ++++++++++++++++++++++------------
1 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/src/pages/oa/_utils/finReimbursementMappers.js b/src/pages/oa/_utils/finReimbursementMappers.js
index fcf993c..9c9a511 100644
--- a/src/pages/oa/_utils/finReimbursementMappers.js
+++ b/src/pages/oa/_utils/finReimbursementMappers.js
@@ -159,8 +159,43 @@
function pickApplicantQuery(searchForm = {}) {
const kw = (searchForm.applicantKeyword || "").trim();
if (!kw) return {};
- if (/[\u4e00-\u9fa5]/.test(kw)) return { applicantName: kw };
- return { applicantCode: kw };
+ const out = { applicantName: kw };
+ if (!/[\u4e00-\u9fa5]/.test(kw)) {
+ out.applicantCode = kw;
+ }
+ return out;
+}
+
+export function hasActiveReimbursementSearch(searchForm = {}) {
+ return Boolean((searchForm?.applicantKeyword || "").trim());
+}
+
+export function filterReimbursementRowsBySearch(rows, searchForm = {}) {
+ const list = Array.isArray(rows) ? rows : [];
+ const kw = (searchForm?.applicantKeyword || "").trim().toLowerCase();
+ if (!kw) return list;
+
+ return list.filter((row) => {
+ const parts = [
+ row.applicantName,
+ row.employeeName,
+ row.applicantNo,
+ row.applicantCode,
+ row.employeeNo,
+ ]
+ .filter((v) => v != null && v !== "")
+ .map((v) => String(v).toLowerCase());
+ return parts.some((p) => p.includes(kw));
+ });
+}
+
+/** 鎵佸钩鍖栦负 Spring GET 鍙粦瀹氱殑 query锛坒inReimbursementDto.xxx锛屽嬁鐢ㄦ柟鎷彿锛� */
+function appendDotNotationQuery(target, prefix, fields) {
+ if (!fields || typeof fields !== "object") return;
+ for (const [key, value] of Object.entries(fields)) {
+ if (value == null || value === "") continue;
+ target[`${prefix}.${key}`] = value;
+ }
}
export function buildFinReimbursementListParams({
@@ -175,30 +210,15 @@
...(extraDto && typeof extraDto === "object" ? extraDto : {}),
};
- const range = searchForm?.createTimeRange ?? searchForm?.applyDateRange;
- if (Array.isArray(range) && range[0]) {
- dto.createTimeStart = range[0];
- }
- if (Array.isArray(range) && range[1]) {
- dto.createTimeEnd = range[1];
- }
-
- if (reimbursementType === FIN_REIMBURSEMENT_TYPE.TRAVEL) {
- if (searchForm?.travelStartFrom) {
- dto.startTimeStart = searchForm.travelStartFrom;
- }
- if (searchForm?.travelEndTo) {
- dto.endTimeEnd = searchForm.travelEndTo;
- }
- }
-
- return {
- page: {
- current: page.current,
- size: page.size,
- },
- finReimbursementDto: dto,
+ const params = {
+ current: page.current,
+ size: page.size,
+ "page.current": page.current,
+ "page.size": page.size,
+ ...dto,
};
+ appendDotNotationQuery(params, "finReimbursementDto", dto);
+ return params;
}
function pickTravelField(obj, keys) {
--
Gitblit v1.9.3