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/approvalModuleListSearch.js | 333 +++++++++++++++++++++--------------------
src/pages/oa/_utils/finReimbursementMappers.js | 70 +++++---
src/pages/oa/_components/ApprovalInstanceListPage.vue | 13 +
src/pages/oa/_components/FinReimbursementListPage.vue | 14 +
src/pages/oa/_utils/approvalModuleRegistry.js | 5
src/pages/oa/_utils/approveListUtils.js | 38 +---
6 files changed, 254 insertions(+), 219 deletions(-)
diff --git a/src/pages/oa/_components/ApprovalInstanceListPage.vue b/src/pages/oa/_components/ApprovalInstanceListPage.vue
index 86b102f..02b1f37 100644
--- a/src/pages/oa/_components/ApprovalInstanceListPage.vue
+++ b/src/pages/oa/_components/ApprovalInstanceListPage.vue
@@ -128,6 +128,7 @@
filterRowsByModuleBusinessType,
formatDateRangeLabel,
getModuleSearchMeta,
+ hasActiveModuleSearch,
} from "../_utils/approvalModuleListSearch.js";
import {
buildInstanceListParams,
@@ -235,14 +236,22 @@
const res = await listApprovalInstancePage(buildListRequestParams());
const { records, total } = unwrapInstancePage(res);
const listFields = moduleConfig.value?.listFields || [];
- const mapped = records.map(row => mapInstanceListRow(row, listFields));
+ let mapped = records.map(row => mapInstanceListRow(row, listFields));
+ if (hasActiveModuleSearch(props.moduleKey, searchForm)) {
+ mapped = filterRowsByModuleSearch(props.moduleKey, mapped, searchForm);
+ }
if (page.current === 1) {
list.value = mapped;
} else {
list.value = [...list.value, ...mapped];
}
- page.total = total;
+ const dropped = records.length - mapped.length;
+ page.total = hasActiveModuleSearch(props.moduleKey, searchForm)
+ ? list.value.length
+ : dropped > 0
+ ? Math.max(0, Number(total) - dropped)
+ : Number(total);
if (list.value.length >= total || records.length < page.size) {
pageStatus.value = "nomore";
diff --git a/src/pages/oa/_components/FinReimbursementListPage.vue b/src/pages/oa/_components/FinReimbursementListPage.vue
index 1cbc1d1..ab6ad06 100644
--- a/src/pages/oa/_components/FinReimbursementListPage.vue
+++ b/src/pages/oa/_components/FinReimbursementListPage.vue
@@ -118,7 +118,6 @@
import { getApprovalModuleConfig } from "../_utils/approvalModuleRegistry.js";
import {
createModuleSearchForm,
- filterRowsByModuleSearch,
formatDateRangeLabel,
getModuleSearchMeta,
} from "../_utils/approvalModuleListSearch.js";
@@ -132,7 +131,9 @@
deleteFinReimbursement,
getReimbursementTypeByModuleKey,
enrichReimbursementListRowsWithApprovalFlow,
+ filterReimbursementRowsBySearch,
filterRowsByReimbursementType,
+ hasActiveReimbursementSearch,
mapFinReimbursementFromApi,
resolveReimbursementDeleteId,
unwrapFinReimbursementPage,
@@ -170,7 +171,7 @@
}
const displayList = computed(() =>
- filterRowsByModuleSearch(props.moduleKey, list.value, searchForm)
+ filterReimbursementRowsBySearch(list.value, searchForm)
);
const hasActiveFilter = computed(() => Boolean(filterSummary.value));
@@ -242,6 +243,9 @@
mapped,
reimbursementType.value
);
+ if (hasActiveReimbursementSearch(searchForm)) {
+ mapped = filterReimbursementRowsBySearch(mapped, searchForm);
+ }
if (page.current === 1) {
list.value = mapped;
@@ -249,8 +253,12 @@
list.value = [...list.value, ...mapped];
}
const dropped = records.length - filtered.length;
- page.total =
+ let nextTotal =
dropped > 0 ? Math.max(0, Number(total) - dropped) : Number(total);
+ if (hasActiveReimbursementSearch(searchForm)) {
+ nextTotal = list.value.length;
+ }
+ page.total = nextTotal;
if (list.value.length >= total || records.length < page.size) {
pageStatus.value = "nomore";
diff --git a/src/pages/oa/_utils/approvalModuleListSearch.js b/src/pages/oa/_utils/approvalModuleListSearch.js
index a81b174..a98409a 100644
--- a/src/pages/oa/_utils/approvalModuleListSearch.js
+++ b/src/pages/oa/_utils/approvalModuleListSearch.js
@@ -178,61 +178,135 @@
return hit?.value ?? hit?.defaultValue ?? "";
}
-function pickDateRange(searchForm) {
- const range =
- searchForm?.createTimeRange ??
- searchForm?.applyDateRange ??
- searchForm?.transferDateRange;
- if (!Array.isArray(range) || !range[0]) return {};
- const out = { createTimeStart: range[0] };
- if (range[1]) out.createTimeEnd = range[1];
+/** 鎵佸钩鍖栦负 Spring GET 鍙粦瀹氱殑 query锛坅pprovalInstanceDto.xxx锛屽嬁鐢ㄦ柟鎷彿锛� */
+export 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;
+ }
+}
+
+function pickApplicantFromSearchForm(searchForm = {}) {
+ const out = {};
+ const sf = searchForm || {};
+ const name = (sf.applicantName || "").trim();
+ const kw = (sf.applicantKeyword || "").trim();
+ const id = sf.applicantId;
+
+ if (name) out.applicantName = name;
+ if (kw) {
+ out.applicantName = kw;
+ if (/^\d+$/.test(kw)) out.applicantId = Number(kw);
+ }
+ if (id != null && id !== "") {
+ out.applicantId = typeof id === "number" ? id : Number(id) || id;
+ }
return out;
}
-/** 鍚勬ā鍧楅粯璁ゆ煡璇㈣〃鍗曪紙涓� Web searchForm 瀛楁涓�鑷达級 */
-export function createModuleSearchForm(moduleKey) {
- switch (moduleKey) {
- case APPROVAL_MODULE_KEYS.REGULAR:
- return { applicantName: "", applyDateRange: null };
- case APPROVAL_MODULE_KEYS.TRANSFER:
- return { applicantId: "", transferDateRange: null };
- case APPROVAL_MODULE_KEYS.WORK_HANDOVER:
- return { applicantId: "", handoverStatus: "", handoverType: "" };
- case APPROVAL_MODULE_KEYS.LEAVE:
- return { applicantKeyword: "", leaveType: "" };
- case APPROVAL_MODULE_KEYS.OVERTIME:
- return { applicantKeyword: "", overtimeType: "" };
- case APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE:
- case APPROVAL_MODULE_KEYS.COST_REIMBURSE:
- case APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS:
- return { applicantKeyword: "" };
- default:
- return {};
- }
+function pickInstanceNoFromSearchForm(searchForm = {}) {
+ const no = (searchForm?.instanceNo || "").trim();
+ return no ? { instanceNo: no } : {};
}
-/** 鏈嶅姟绔� listPage DTO 鐗囨锛堜笌 Web buildExtraListParams + buildApprovalInstanceListParams 涓�鑷达級 */
-export function buildModuleListDto(moduleKey, searchForm = {}) {
- const sf = searchForm || {};
- const dto = { ...pickDateRange(sf) };
+/** 鏀寔瀹℃壒鍗曞彿鏌ヨ鐨勫鎵圭敵璇锋ā鍧� */
+export const INSTANCE_NO_SEARCH_MODULE_KEYS = new Set([
+ APPROVAL_MODULE_KEYS.REGULAR,
+ APPROVAL_MODULE_KEYS.TRANSFER,
+ APPROVAL_MODULE_KEYS.WORK_HANDOVER,
+ APPROVAL_MODULE_KEYS.LEAVE,
+ APPROVAL_MODULE_KEYS.OVERTIME,
+]);
- switch (moduleKey) {
- case APPROVAL_MODULE_KEYS.REGULAR: {
- const name = (sf.applicantName || "").trim();
- if (name) dto.applicantName = name;
- break;
- }
- case APPROVAL_MODULE_KEYS.TRANSFER:
- break;
- case APPROVAL_MODULE_KEYS.WORK_HANDOVER:
- break;
- case APPROVAL_MODULE_KEYS.LEAVE:
- case APPROVAL_MODULE_KEYS.OVERTIME:
- break;
- default:
- break;
- }
+const INSTANCE_NO_SEARCH_FIELD = {
+ key: "instanceNo",
+ type: "input",
+ label: "瀹℃壒鍗曞彿",
+ placeholder: "璇疯緭鍏ュ鎵瑰崟鍙�",
+};
+
+/** 缁勮 approvalInstanceDto 鏌ヨ鐗囨锛堢敵璇蜂汉 + 瀹℃壒鍗曞彿锛� */
+export function buildApprovalInstanceSearchDto(searchForm = {}, extraParams = {}) {
+ const dto = {
+ ...(extraParams && typeof extraParams === "object" ? extraParams : {}),
+ };
+ Object.assign(dto, pickApplicantFromSearchForm(searchForm));
+ Object.assign(dto, pickInstanceNoFromSearchForm(searchForm));
+ delete dto.createTime;
+ delete dto.createTimeStart;
+ delete dto.createTimeEnd;
return dto;
+}
+
+function pickDateRange(searchForm) {
+ return buildApprovalInstanceSearchDto(searchForm);
+}
+
+/** 鍚勬ā鍧楅粯璁ゆ煡璇㈣〃鍗曪紙涓� Web searchForm 瀛楁涓�鑷达級 */
+const APPLICANT_ONLY_MODULE_KEYS = new Set([
+ APPROVAL_MODULE_KEYS.REGULAR,
+ APPROVAL_MODULE_KEYS.TRANSFER,
+ APPROVAL_MODULE_KEYS.WORK_HANDOVER,
+ APPROVAL_MODULE_KEYS.LEAVE,
+ APPROVAL_MODULE_KEYS.OVERTIME,
+ APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE,
+ APPROVAL_MODULE_KEYS.COST_REIMBURSE,
+]);
+
+function withInstanceNoSearch(moduleKey, base) {
+ if (INSTANCE_NO_SEARCH_MODULE_KEYS.has(moduleKey)) {
+ return { instanceNo: "", ...base };
+ }
+ return base;
+}
+
+function applicantOnlySearchForm(moduleKey) {
+ if (moduleKey === APPROVAL_MODULE_KEYS.REGULAR) {
+ return withInstanceNoSearch(moduleKey, { applicantName: "" });
+ }
+ if (
+ moduleKey === APPROVAL_MODULE_KEYS.TRANSFER ||
+ moduleKey === APPROVAL_MODULE_KEYS.WORK_HANDOVER
+ ) {
+ return withInstanceNoSearch(moduleKey, { applicantId: "" });
+ }
+ if (APPLICANT_ONLY_MODULE_KEYS.has(moduleKey)) {
+ return withInstanceNoSearch(moduleKey, { applicantKeyword: "" });
+ }
+ return {};
+}
+
+export function createModuleSearchForm(moduleKey) {
+ if (APPLICANT_ONLY_MODULE_KEYS.has(moduleKey)) {
+ return applicantOnlySearchForm(moduleKey);
+ }
+ if (moduleKey === APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS) {
+ return { applicantKeyword: "" };
+ }
+ return {};
+}
+
+/** 鏈嶅姟绔� listPage DTO 鐗囨锛堜笌 Web buildApprovalInstanceListParams 涓�鑷达級 */
+export function buildModuleListDto(moduleKey, searchForm = {}) {
+ return buildApprovalInstanceSearchDto(searchForm);
+}
+
+function matchInstanceNo(row, instanceNo) {
+ const kw = (instanceNo || "").trim().toLowerCase();
+ if (!kw) return true;
+ const parts = [row?.instanceNo, row?.bizId]
+ .filter(v => v != null && v !== "")
+ .map(v => String(v).toLowerCase());
+ return parts.some(p => p.includes(kw));
+}
+
+export function hasActiveModuleSearch(moduleKey, searchForm = {}) {
+ const sf = searchForm || {};
+ if ((sf.instanceNo || "").trim()) return true;
+ if ((sf.applicantKeyword || "").trim()) return true;
+ if ((sf.applicantName || "").trim()) return true;
+ return sf.applicantId != null && sf.applicantId !== "";
}
function matchApplicantKeyword(row, keyword) {
@@ -298,131 +372,66 @@
});
}
-/** 鍓嶇绛涢�夛紙Web 鏈笅鍙戞帴鍙g殑瀛楁涓� Web 琛屼负涓�鑷达級 */
+/** 鎸夌敵璇蜂汉銆佸鎵瑰崟鍙峰仛鍓嶇鍏滃簳绛涢�� */
export function filterRowsByModuleSearch(moduleKey, rows, searchForm = {}) {
const sf = searchForm || {};
const list = Array.isArray(rows) ? rows : [];
+ if (!hasActiveModuleSearch(moduleKey, sf)) return list;
- switch (moduleKey) {
- case APPROVAL_MODULE_KEYS.TRANSFER:
- return list.filter(
- row =>
- matchApplicantId(row, sf.applicantId) &&
- matchApplicantKeyword(row, sf.applicantKeyword)
- );
- case APPROVAL_MODULE_KEYS.WORK_HANDOVER:
- return list.filter(
- row =>
- matchApplicantId(row, sf.applicantId) &&
- matchSelectValue(row, ["handoverStatus", "浜ゆ帴鐘舵��"], sf.handoverStatus) &&
- matchSelectValue(row, ["handoverType", "浜ゆ帴绫诲瀷"], sf.handoverType)
- );
- case APPROVAL_MODULE_KEYS.LEAVE:
- return list.filter(
- row =>
- matchApplicantKeyword(row, sf.applicantKeyword) &&
- matchSelectValue(row, ["leaveType", "璇峰亣绫诲瀷"], sf.leaveType)
- );
- case APPROVAL_MODULE_KEYS.OVERTIME:
- return list.filter(
- row =>
- matchApplicantKeyword(row, sf.applicantKeyword) &&
- matchSelectValue(row, ["overtimeType", "鍔犵彮绫诲瀷"], sf.overtimeType)
- );
- case APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE:
- case APPROVAL_MODULE_KEYS.COST_REIMBURSE:
- case APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS:
- return list.filter(row => matchApplicantKeyword(row, sf.applicantKeyword));
- default:
- return list;
- }
+ return list.filter(
+ row =>
+ matchInstanceNo(row, sf.instanceNo) &&
+ matchApplicantId(row, sf.applicantId) &&
+ matchApplicantKeyword(row, sf.applicantKeyword || sf.applicantName)
+ );
+}
+
+function prependInstanceNoField(fields, moduleKey) {
+ if (!INSTANCE_NO_SEARCH_MODULE_KEYS.has(moduleKey)) return fields;
+ return [INSTANCE_NO_SEARCH_FIELD, ...fields];
}
/** 妯″潡绛涢�� UI 閰嶇疆 */
export function getModuleSearchMeta(moduleKey) {
- switch (moduleKey) {
- case APPROVAL_MODULE_KEYS.REGULAR:
- return {
- fields: [
+ if (moduleKey === APPROVAL_MODULE_KEYS.REGULAR) {
+ return {
+ fields: prependInstanceNoField(
+ [
{ key: "applicantName", type: "input", label: "鐢宠浜�", placeholder: "璇疯緭鍏ョ敵璇蜂汉" },
- { key: "applyDateRange", type: "daterange", label: "鐢宠鏃ユ湡" },
],
- };
- case APPROVAL_MODULE_KEYS.TRANSFER:
- return {
- fields: [
- { key: "applicantId", type: "user", label: "鐢宠浜�", placeholder: "璇烽�夋嫨鐢宠浜�" },
- { key: "transferDateRange", type: "daterange", label: "杞矖鏃堕棿" },
- ],
- };
- case APPROVAL_MODULE_KEYS.WORK_HANDOVER:
- return {
- fields: [
- { key: "applicantId", type: "user", label: "鐢宠浜�", placeholder: "璇烽�夋嫨鐢宠浜�" },
- {
- key: "handoverStatus",
- type: "select",
- label: "浜ゆ帴鐘舵��",
- options: HANDOVER_STATUS_OPTIONS,
- },
- {
- key: "handoverType",
- type: "select",
- label: "浜ゆ帴绫诲瀷",
- options: HANDOVER_TYPE_OPTIONS,
- },
- ],
- };
- case APPROVAL_MODULE_KEYS.LEAVE:
- return {
- fields: [
- {
- key: "applicantKeyword",
- type: "input",
- label: "鐢宠浜�",
- placeholder: "濮撳悕鎴栫紪鍙�",
- },
- {
- key: "leaveType",
- type: "select",
- label: "璇峰亣绫诲瀷",
- options: LEAVE_TYPE_OPTIONS,
- },
- ],
- };
- case APPROVAL_MODULE_KEYS.OVERTIME:
- return {
- fields: [
- {
- key: "applicantKeyword",
- type: "input",
- label: "鐢宠浜�",
- placeholder: "濮撳悕鎴栫紪鍙�",
- },
- {
- key: "overtimeType",
- type: "select",
- label: "鍔犵彮绫诲瀷",
- options: OVERTIME_TYPE_OPTIONS,
- },
- ],
- };
- case APPROVAL_MODULE_KEYS.TRAVEL_REIMBURSE:
- case APPROVAL_MODULE_KEYS.COST_REIMBURSE:
- case APPROVAL_MODULE_KEYS.ENTERPRISE_NEWS:
- return {
- fields: [
- {
- key: "applicantKeyword",
- type: "input",
- label: "鐢宠浜�",
- placeholder: "濮撳悕鎴栫紪鍙�",
- },
- ],
- };
- default:
- return { fields: [] };
+ moduleKey
+ ),
+ };
}
+ if (
+ moduleKey === APPROVAL_MODULE_KEYS.TRANSFER ||
+ moduleKey === APPROVAL_MODULE_KEYS.WORK_HANDOVER
+ ) {
+ return {
+ fields: prependInstanceNoField(
+ [
+ { key: "applicantId", type: "user", label: "鐢宠浜�", placeholder: "璇烽�夋嫨鐢宠浜�" },
+ ],
+ moduleKey
+ ),
+ };
+ }
+ if (APPLICANT_ONLY_MODULE_KEYS.has(moduleKey)) {
+ return {
+ fields: prependInstanceNoField(
+ [
+ {
+ key: "applicantKeyword",
+ type: "input",
+ label: "鐢宠浜�",
+ placeholder: "濮撳悕鎴栫紪鍙�",
+ },
+ ],
+ moduleKey
+ ),
+ };
+ }
+ return { fields: [] };
}
export function resetModuleSearchForm(moduleKey, target) {
diff --git a/src/pages/oa/_utils/approvalModuleRegistry.js b/src/pages/oa/_utils/approvalModuleRegistry.js
index 2fca61e..1019d35 100644
--- a/src/pages/oa/_utils/approvalModuleRegistry.js
+++ b/src/pages/oa/_utils/approvalModuleRegistry.js
@@ -30,6 +30,7 @@
businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.REGULAR],
typeLabels: ["杞", "杞鐢宠"],
listFields: [
+ { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
{ label: "鍏ヨ亴鏃ユ湡", prop: "entryDate" },
{ label: "杞鏃ユ湡", prop: "regularDate" },
],
@@ -40,6 +41,7 @@
businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.TRANSFER],
typeLabels: ["璋冨矖", "璋冨姩", "璋冨矖鐢宠", "璋冨姩鐢宠"],
listFields: [
+ { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
{ label: "鍘熷矖浣�", prop: "fromPost" },
{ label: "鐩爣宀椾綅", prop: "toPost" },
],
@@ -50,6 +52,7 @@
businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.WORK_HANDOVER],
typeLabels: ["宸ヤ綔浜ゆ帴", "浜ゆ帴", "宸ヤ綔浜ゆ帴瀹℃壒"],
listFields: [
+ { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
{ label: "浜ゆ帴浜�", prop: "handoverTo" },
{ label: "浜ゆ帴浜嬮」", prop: "handoverItems" },
],
@@ -60,6 +63,7 @@
businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.LEAVE],
typeLabels: ["璇峰亣", "璇峰亣鐢宠", "璇峰亣瀹℃壒"],
listFields: [
+ { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
{ label: "璇峰亣绫诲瀷", prop: "leaveType" },
{ label: "寮�濮嬫椂闂�", prop: "startTime" },
{ label: "缁撴潫鏃堕棿", prop: "endTime" },
@@ -71,6 +75,7 @@
businessType: APPROVAL_BUSINESS_TYPE[APPROVAL_MODULE_KEYS.OVERTIME],
typeLabels: ["鍔犵彮", "鍔犵彮鐢宠", "鍔犵彮瀹℃壒"],
listFields: [
+ { label: "瀹℃壒鍗曞彿", prop: "instanceNo" },
{ label: "鍔犵彮鏃ユ湡", prop: "overtimeDate" },
{ label: "鏃堕暱(灏忔椂)", prop: "hours" },
],
diff --git a/src/pages/oa/_utils/approveListUtils.js b/src/pages/oa/_utils/approveListUtils.js
index f7ddc00..538fec9 100644
--- a/src/pages/oa/_utils/approveListUtils.js
+++ b/src/pages/oa/_utils/approveListUtils.js
@@ -6,6 +6,8 @@
mergeFormConfigForEdit,
} from "./approvalFormField.js";
import {
+ appendDotNotationQuery,
+ buildApprovalInstanceSearchDto,
formatKnownSelectLabel,
resolveInstanceFormPayload,
resolveListFieldRawValue,
@@ -272,8 +274,7 @@
}
/**
- * 涓� Web buildApprovalInstanceListParams 涓�鑷达細鎵佸钩 query锛坈urrent/size/businessType/...锛�
- * 瀹℃壒鍒楄〃涓嶄紶 businessType 鍗虫煡鍏ㄩ儴
+ * 涓� Web buildApprovalInstanceListParams 涓�鑷�
*/
export function buildInstanceListParams({
page,
@@ -281,37 +282,20 @@
extraDto = {},
searchForm,
}) {
- const extra = { ...(extraDto && typeof extraDto === "object" ? extraDto : {}) };
- if (extra.createTime != null && extra.createTimeStart == null) {
- extra.createTimeStart = extra.createTime;
+ const dto = buildApprovalInstanceSearchDto(searchForm, extraDto);
+ const bizType = businessType ?? searchForm?.businessType;
+ if (bizType != null && bizType !== "") {
+ dto.businessType = bizType;
}
- delete extra.createTime;
const params = {
current: page.current,
size: page.size,
- ...extra,
+ "page.current": page.current,
+ "page.size": page.size,
+ ...dto,
};
-
- const bizType = businessType ?? searchForm?.businessType;
- if (bizType != null && bizType !== "") {
- params.businessType = bizType;
- }
- if (searchForm?.status) {
- params.status = searchForm.status;
- }
-
- const range =
- searchForm?.createTimeRange ??
- searchForm?.applyDateRange ??
- searchForm?.transferDateRange;
- if (Array.isArray(range) && range[0] && params.createTimeStart == null) {
- params.createTimeStart = range[0];
- }
- if (Array.isArray(range) && range[1] && params.createTimeEnd == null) {
- params.createTimeEnd = range[1];
- }
-
+ appendDotNotationQuery(params, "approvalInstanceDto", dto);
return params;
}
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