| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- /** 年调标差额补发批识别(统一口径,避免各页正则写坏) */
- export type AdjustBatchLike = {
- batchNo?: string | null
- month?: string | null
- payMonth?: string | null
- id?: string | null
- remarks?: string | null
- remark?: string | null
- yearlyAdjust?: boolean | string | null
- batchLevel?: string | null
- village?: string | null
- }
- function compact(raw?: string | null): string {
- return String(raw || '').replace(/[-_/]/g, '')
- }
- function hasAdjust99(raw?: string | null): boolean {
- return /20\d{2}99/.test(compact(raw))
- }
- function isCalendarMonthToken(raw?: string | null): boolean {
- const s = compact(raw)
- return /20\d{2}(0[1-9]|1[0-2])/.test(s) && !/20\d{2}99/.test(s)
- }
- /**
- * 是否年调标差额专批:业务号/发放月含 20xx99。
- * 全区月批、镇统计即使备注写了 YEARLY_ADJUST,也按日常发放批处理。
- */
- export function isYearlyAdjustBatchLike(b?: AdjustBatchLike | null): boolean {
- if (!b) return false
- const level = String(b.batchLevel || '').toUpperCase()
- if (level === 'DISTRICT' || level === 'TOWN' || b.village === '全区') return false
- if (
- isCalendarMonthToken(b.payMonth) ||
- isCalendarMonthToken(b.month) ||
- isCalendarMonthToken(b.batchNo)
- ) {
- return false
- }
- if (hasAdjust99(b.batchNo) || hasAdjust99(b.month) || hasAdjust99(b.payMonth)) return true
- return b.yearlyAdjust === true || b.yearlyAdjust === 'true'
- }
|