|
@@ -152,6 +152,7 @@ async function buildTownVillageChartsFromApi(townId: string, payMonth: string) {
|
|
|
townId,
|
|
townId,
|
|
|
payMonth,
|
|
payMonth,
|
|
|
batchLevel: 'TOWN',
|
|
batchLevel: 'TOWN',
|
|
|
|
|
+ lite: true,
|
|
|
}),
|
|
}),
|
|
|
)
|
|
)
|
|
|
const peopleMap = new Map<string, number>()
|
|
const peopleMap = new Map<string, number>()
|
|
@@ -295,6 +296,7 @@ async function fetchWorkbenchLegacy(
|
|
|
townId: townId || undefined,
|
|
townId: townId || undefined,
|
|
|
villageId: villageId || undefined,
|
|
villageId: villageId || undefined,
|
|
|
batchLevel: townId ? 'TOWN' : 'DISTRICT',
|
|
batchLevel: townId ? 'TOWN' : 'DISTRICT',
|
|
|
|
|
+ lite: true,
|
|
|
},
|
|
},
|
|
|
{ silent: true },
|
|
{ silent: true },
|
|
|
).catch(() => null),
|
|
).catch(() => null),
|
|
@@ -678,6 +680,7 @@ export async function fetchVillageBatches(): Promise<VillageBatch[]> {
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
pageSize: 50,
|
|
pageSize: 50,
|
|
|
batchLevel: 'DISTRICT',
|
|
batchLevel: 'DISTRICT',
|
|
|
|
|
+ lite: true,
|
|
|
})
|
|
})
|
|
|
let list = districtPage?.list || []
|
|
let list = districtPage?.list || []
|
|
|
if (!list.length) {
|
|
if (!list.length) {
|
|
@@ -685,6 +688,7 @@ export async function fetchVillageBatches(): Promise<VillageBatch[]> {
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
pageSize: 50,
|
|
pageSize: 50,
|
|
|
batchLevel: 'TOWN',
|
|
batchLevel: 'TOWN',
|
|
|
|
|
+ lite: true,
|
|
|
})
|
|
})
|
|
|
const towns = townPage?.list || []
|
|
const towns = townPage?.list || []
|
|
|
const seen = new Set<string>()
|
|
const seen = new Set<string>()
|
|
@@ -733,6 +737,12 @@ export type PeoplePageParams = {
|
|
|
/** 退养资格 WITH_LAND / WITHOUT_LAND / INELIGIBLE / UNSET */
|
|
/** 退养资格 WITH_LAND / WITHOUT_LAND / INELIGIBLE / UNSET */
|
|
|
retireQualifyType?: string
|
|
retireQualifyType?: string
|
|
|
source?: string
|
|
source?: string
|
|
|
|
|
+ /** 排除业务状态,逗号分隔 */
|
|
|
|
|
+ bizStatusNotIn?: string
|
|
|
|
|
+ /** 仅包含业务状态,逗号分隔 */
|
|
|
|
|
+ bizStatusIn?: string
|
|
|
|
|
+ /** 非本村视角隐藏他村 DRAFT */
|
|
|
|
|
+ hideDraftUnlessVillage?: boolean
|
|
|
pageNum?: number
|
|
pageNum?: number
|
|
|
pageSize?: number
|
|
pageSize?: number
|
|
|
}
|
|
}
|
|
@@ -766,6 +776,9 @@ export async function fetchPeoplePage(
|
|
|
: undefined,
|
|
: undefined,
|
|
|
retireQualifyUnset: params?.retireQualifyType === 'UNSET' ? true : undefined,
|
|
retireQualifyUnset: params?.retireQualifyType === 'UNSET' ? true : undefined,
|
|
|
source: params?.source || undefined,
|
|
source: params?.source || undefined,
|
|
|
|
|
+ bizStatusNotIn: params?.bizStatusNotIn || undefined,
|
|
|
|
|
+ bizStatusIn: params?.bizStatusIn || undefined,
|
|
|
|
|
+ hideDraftUnlessVillage: params?.hideDraftUnlessVillage ? true : undefined,
|
|
|
payMonth: params?.batchNo || undefined,
|
|
payMonth: params?.batchNo || undefined,
|
|
|
}, { timeout: 90_000 })
|
|
}, { timeout: 90_000 })
|
|
|
const list = (res?.list || []).map((p) => mapPerson(p, params?.batchNo || currentPayMonth()))
|
|
const list = (res?.list || []).map((p) => mapPerson(p, params?.batchNo || currentPayMonth()))
|
|
@@ -1543,6 +1556,7 @@ export async function fetchInsuranceBatchesPage(params?: {
|
|
|
tab?: 'todo' | 'history'
|
|
tab?: 'todo' | 'history'
|
|
|
batchNo?: string
|
|
batchNo?: string
|
|
|
stage?: string
|
|
stage?: string
|
|
|
|
|
+ townId?: string
|
|
|
pageNum?: number
|
|
pageNum?: number
|
|
|
pageSize?: number
|
|
pageSize?: number
|
|
|
}): Promise<{ list: VillageBatch[]; total: number; pageNum: number; pageSize: number }> {
|
|
}): Promise<{ list: VillageBatch[]; total: number; pageNum: number; pageSize: number }> {
|
|
@@ -1554,21 +1568,28 @@ export async function fetchInsuranceBatchesPage(params?: {
|
|
|
: params?.tab === 'history'
|
|
: params?.tab === 'history'
|
|
|
? 'PENDING_LEADER_APPROVE,READY_EXPORT,EXPORTED,RETURNED,ARCHIVED'
|
|
? 'PENDING_LEADER_APPROVE,READY_EXPORT,EXPORTED,RETURNED,ARCHIVED'
|
|
|
: 'PENDING_INSURANCE_MATCH,PENDING_STATUS_MAINTAIN'
|
|
: 'PENDING_INSURANCE_MATCH,PENDING_STATUS_MAINTAIN'
|
|
|
|
|
+ const townId = params?.townId || undefined
|
|
|
|
|
+ const batchLevel = townId ? 'TOWN' : 'DISTRICT'
|
|
|
const res = await post<PageResult<Record<string, unknown>>>('/batches/page', {
|
|
const res = await post<PageResult<Record<string, unknown>>>('/batches/page', {
|
|
|
pageNum,
|
|
pageNum,
|
|
|
pageSize,
|
|
pageSize,
|
|
|
- batchLevel: 'DISTRICT',
|
|
|
|
|
|
|
+ batchLevel,
|
|
|
|
|
+ townId,
|
|
|
batchNo: params?.batchNo || undefined,
|
|
batchNo: params?.batchNo || undefined,
|
|
|
statusIn: statusIn || undefined,
|
|
statusIn: statusIn || undefined,
|
|
|
|
|
+ lite: true,
|
|
|
|
|
+ withTownTotals: true,
|
|
|
})
|
|
})
|
|
|
let list = (res?.list || []).map(mapVillageBatch)
|
|
let list = (res?.list || []).map(mapVillageBatch)
|
|
|
- if (!list.length && !params?.batchNo) {
|
|
|
|
|
|
|
+ if (!list.length && !params?.batchNo && !townId) {
|
|
|
const fallback = await post<PageResult<Record<string, unknown>>>('/batches/page', {
|
|
const fallback = await post<PageResult<Record<string, unknown>>>('/batches/page', {
|
|
|
pageNum,
|
|
pageNum,
|
|
|
pageSize,
|
|
pageSize,
|
|
|
batchLevel: 'TOWN',
|
|
batchLevel: 'TOWN',
|
|
|
batchNo: params?.batchNo || undefined,
|
|
batchNo: params?.batchNo || undefined,
|
|
|
statusIn: statusIn || undefined,
|
|
statusIn: statusIn || undefined,
|
|
|
|
|
+ lite: true,
|
|
|
|
|
+ withTownTotals: true,
|
|
|
})
|
|
})
|
|
|
list = (fallback?.list || []).map(mapVillageBatch)
|
|
list = (fallback?.list || []).map(mapVillageBatch)
|
|
|
return {
|
|
return {
|
|
@@ -1656,6 +1677,7 @@ export async function fetchInsuranceResultsPage(params?: {
|
|
|
pageNum,
|
|
pageNum,
|
|
|
pageSize,
|
|
pageSize,
|
|
|
},
|
|
},
|
|
|
|
|
+ { timeout: 120_000 },
|
|
|
)
|
|
)
|
|
|
const rows = Array.isArray(raw) ? raw : raw?.list || []
|
|
const rows = Array.isArray(raw) ? raw : raw?.list || []
|
|
|
const total = Array.isArray(raw) ? raw.length : Number(raw?.total || rows.length)
|
|
const total = Array.isArray(raw) ? raw.length : Number(raw?.total || rows.length)
|
|
@@ -1683,8 +1705,16 @@ export async function fetchInsuranceResults(params?: {
|
|
|
return page.list
|
|
return page.list
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export async function triggerInsuranceMatch(batchIds?: string | string[]) {
|
|
|
|
|
|
|
+export async function triggerInsuranceMatch(
|
|
|
|
|
+ batchIds?: string | string[],
|
|
|
|
|
+ personnelIds?: string | string[],
|
|
|
|
|
+) {
|
|
|
const ids = batchIds == null ? [] : Array.isArray(batchIds) ? batchIds : [batchIds]
|
|
const ids = batchIds == null ? [] : Array.isArray(batchIds) ? batchIds : [batchIds]
|
|
|
|
|
+ const pids = personnelIds == null
|
|
|
|
|
+ ? []
|
|
|
|
|
+ : Array.isArray(personnelIds)
|
|
|
|
|
+ ? personnelIds.map(String)
|
|
|
|
|
+ : [String(personnelIds)]
|
|
|
let count = 0
|
|
let count = 0
|
|
|
let lastSummary: Record<string, unknown> | null = null
|
|
let lastSummary: Record<string, unknown> | null = null
|
|
|
for (const batchId of ids) {
|
|
for (const batchId of ids) {
|
|
@@ -1695,7 +1725,11 @@ export async function triggerInsuranceMatch(batchIds?: string | string[]) {
|
|
|
successCount?: number
|
|
successCount?: number
|
|
|
manualCount?: number
|
|
manualCount?: number
|
|
|
items?: Array<Record<string, unknown>>
|
|
items?: Array<Record<string, unknown>>
|
|
|
- }>('/insurance-match/trigger', { batchId, operator: operatorOf() })
|
|
|
|
|
|
|
+ }>('/insurance-match/trigger', {
|
|
|
|
|
+ batchId,
|
|
|
|
|
+ personnelIds: pids.length ? pids : undefined,
|
|
|
|
|
+ operator: operatorOf(),
|
|
|
|
|
+ })
|
|
|
lastSummary = {
|
|
lastSummary = {
|
|
|
batchId,
|
|
batchId,
|
|
|
...(res || {}),
|
|
...(res || {}),
|
|
@@ -1760,6 +1794,20 @@ export async function fetchUnresolvedInsuranceCount(batchId: string): Promise<nu
|
|
|
return Number(res?.count || 0)
|
|
return Number(res?.count || 0)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 批量查询居保未闭环人数(月补贴清单列表用) */
|
|
|
|
|
+export async function fetchUnresolvedInsuranceCounts(
|
|
|
|
|
+ batchIds: string[],
|
|
|
|
|
+): Promise<Record<string, number>> {
|
|
|
|
|
+ const ids = (batchIds || []).filter(Boolean)
|
|
|
|
|
+ if (!ids.length) return {}
|
|
|
|
|
+ const res = await post<Record<string, number>>(
|
|
|
|
|
+ '/batches/unresolved-insurance-counts',
|
|
|
|
|
+ { batchIds: ids },
|
|
|
|
|
+ { silent: true },
|
|
|
|
|
+ )
|
|
|
|
|
+ return res || {}
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
export async function exportCompareList(_batchId?: string) {
|
|
export async function exportCompareList(_batchId?: string) {
|
|
|
return {
|
|
return {
|
|
|
ok: false as const,
|
|
ok: false as const,
|
|
@@ -1921,6 +1969,7 @@ export async function fetchApprovals(params?: {
|
|
|
batchLevel: 'TOWN',
|
|
batchLevel: 'TOWN',
|
|
|
status: 'PENDING_LEADER_APPROVE',
|
|
status: 'PENDING_LEADER_APPROVE',
|
|
|
batchNo: params?.batchNo || undefined,
|
|
batchNo: params?.batchNo || undefined,
|
|
|
|
|
+ lite: true,
|
|
|
})
|
|
})
|
|
|
const specials = await collectSpecialApprovals({
|
|
const specials = await collectSpecialApprovals({
|
|
|
townId,
|
|
townId,
|
|
@@ -1963,6 +2012,8 @@ async function pageTownStatRows(opts: {
|
|
|
batchLevel: 'TOWN',
|
|
batchLevel: 'TOWN',
|
|
|
status: opts.status,
|
|
status: opts.status,
|
|
|
batchNo: opts.batchNo,
|
|
batchNo: opts.batchNo,
|
|
|
|
|
+ lite: true,
|
|
|
|
|
+ withTownTotals: true,
|
|
|
}),
|
|
}),
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -1975,6 +2026,8 @@ async function pageDistrictBatchRows(opts?: { status?: string; batchNo?: string
|
|
|
batchLevel: 'DISTRICT',
|
|
batchLevel: 'DISTRICT',
|
|
|
status: opts?.status,
|
|
status: opts?.status,
|
|
|
batchNo: opts?.batchNo,
|
|
batchNo: opts?.batchNo,
|
|
|
|
|
+ lite: true,
|
|
|
|
|
+ withDistrictTotals: true,
|
|
|
}),
|
|
}),
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -2092,6 +2145,12 @@ async function collectSpecialApprovals(opts: {
|
|
|
fileUrls: s.fileUrls ? String(s.fileUrls) : undefined,
|
|
fileUrls: s.fileUrls ? String(s.fileUrls) : undefined,
|
|
|
deathDate: deathDate || undefined,
|
|
deathDate: deathDate || undefined,
|
|
|
amount: s.amount != null ? Number(s.amount) : undefined,
|
|
amount: s.amount != null ? Number(s.amount) : undefined,
|
|
|
|
|
+ opinion:
|
|
|
|
|
+ statusRaw === '待分管领导审批' || statusRaw === '待审批' || !statusRaw
|
|
|
|
|
+ ? undefined
|
|
|
|
|
+ : s.opinion
|
|
|
|
|
+ ? String(s.opinion)
|
|
|
|
|
+ : undefined,
|
|
|
heirName: s.heirName ? String(s.heirName) : undefined,
|
|
heirName: s.heirName ? String(s.heirName) : undefined,
|
|
|
idCard: idCard || undefined,
|
|
idCard: idCard || undefined,
|
|
|
})
|
|
})
|
|
@@ -2180,6 +2239,7 @@ export async function decideApproval(payload: {
|
|
|
} else {
|
|
} else {
|
|
|
await post('/special-biz/leader-approve', body)
|
|
await post('/special-biz/leader-approve', body)
|
|
|
}
|
|
}
|
|
|
|
|
+ clearGetCache()
|
|
|
return { ok: true }
|
|
return { ok: true }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2843,6 +2903,7 @@ export async function fetchAdjustReissueRoster(params?: {
|
|
|
pageSize: 20,
|
|
pageSize: 20,
|
|
|
batchLevel: 'DISTRICT',
|
|
batchLevel: 'DISTRICT',
|
|
|
batchNo: params?.batchNo,
|
|
batchNo: params?.batchNo,
|
|
|
|
|
+ lite: true,
|
|
|
})
|
|
})
|
|
|
const batches = batchRes?.list || []
|
|
const batches = batchRes?.list || []
|
|
|
const adjustBatches = batches.filter((b) => {
|
|
const adjustBatches = batches.filter((b) => {
|
|
@@ -2949,6 +3010,8 @@ export async function fetchVillageMonthlyBatchesPage(params?: {
|
|
|
town?: string
|
|
town?: string
|
|
|
pageNum?: number
|
|
pageNum?: number
|
|
|
pageSize?: number
|
|
pageSize?: number
|
|
|
|
|
+ /** 默认 true;列表首屏可传 false 先出表,再异步补全镇人数/金额 */
|
|
|
|
|
+ withTownTotals?: boolean
|
|
|
}): Promise<{ list: VillageMonthlyBatch[]; total: number; pageNum: number; pageSize: number }> {
|
|
}): Promise<{ list: VillageMonthlyBatch[]; total: number; pageNum: number; pageSize: number }> {
|
|
|
await ensureTowns()
|
|
await ensureTowns()
|
|
|
const cfg = getAppConfig()
|
|
const cfg = getAppConfig()
|
|
@@ -2957,6 +3020,7 @@ export async function fetchVillageMonthlyBatchesPage(params?: {
|
|
|
if (townId) await ensureVillages(townId)
|
|
if (townId) await ensureVillages(townId)
|
|
|
const pageNum = params?.pageNum || 1
|
|
const pageNum = params?.pageNum || 1
|
|
|
const pageSize = params?.pageSize || 10
|
|
const pageSize = params?.pageSize || 10
|
|
|
|
|
+ const withTownTotals = params?.withTownTotals !== false
|
|
|
const res = await post<PageResult<Record<string, unknown>>>('/batches/page', {
|
|
const res = await post<PageResult<Record<string, unknown>>>('/batches/page', {
|
|
|
pageNum,
|
|
pageNum,
|
|
|
pageSize,
|
|
pageSize,
|
|
@@ -2964,6 +3028,8 @@ export async function fetchVillageMonthlyBatchesPage(params?: {
|
|
|
batchLevel: 'TOWN',
|
|
batchLevel: 'TOWN',
|
|
|
statusIn:
|
|
statusIn:
|
|
|
'PENDING_STATUS_MAINTAIN,PENDING_LEADER_APPROVE,READY_EXPORT,EXPORTED,RETURNED,ARCHIVED',
|
|
'PENDING_STATUS_MAINTAIN,PENDING_LEADER_APPROVE,READY_EXPORT,EXPORTED,RETURNED,ARCHIVED',
|
|
|
|
|
+ lite: true,
|
|
|
|
|
+ withTownTotals,
|
|
|
})
|
|
})
|
|
|
const list = (res?.list || []).map(mapVillageMonthly)
|
|
const list = (res?.list || []).map(mapVillageMonthly)
|
|
|
return { list, total: Number(res?.total || list.length), pageNum, pageSize }
|
|
return { list, total: Number(res?.total || list.length), pageNum, pageSize }
|
|
@@ -3207,23 +3273,101 @@ export async function fetchRefundStats() {
|
|
|
|
|
|
|
|
export type ReportTopicType = 'pay-abnormal' | 'personnel-change' | 'special-biz'
|
|
export type ReportTopicType = 'pay-abnormal' | 'personnel-change' | 'special-biz'
|
|
|
|
|
|
|
|
-/** 专题报表 topics */
|
|
|
|
|
-export async function fetchReportTopic(
|
|
|
|
|
|
|
+/** 专题报表 topics(分页) */
|
|
|
|
|
+export async function fetchReportTopicPage(
|
|
|
type: ReportTopicType,
|
|
type: ReportTopicType,
|
|
|
- params?: { townId?: string; payMonth?: string; bizType?: string },
|
|
|
|
|
-) {
|
|
|
|
|
|
|
+ params?: {
|
|
|
|
|
+ townId?: string
|
|
|
|
|
+ payMonth?: string
|
|
|
|
|
+ bizType?: string
|
|
|
|
|
+ pageNum?: number
|
|
|
|
|
+ pageSize?: number
|
|
|
|
|
+ },
|
|
|
|
|
+): Promise<{ list: Record<string, unknown>[]; total: number }> {
|
|
|
const path =
|
|
const path =
|
|
|
type === 'pay-abnormal'
|
|
type === 'pay-abnormal'
|
|
|
? '/reports/topics/pay-abnormal'
|
|
? '/reports/topics/pay-abnormal'
|
|
|
: type === 'personnel-change'
|
|
: type === 'personnel-change'
|
|
|
? '/reports/topics/personnel-change'
|
|
? '/reports/topics/personnel-change'
|
|
|
: '/reports/topics/special-biz'
|
|
: '/reports/topics/special-biz'
|
|
|
- const list = await get<Record<string, unknown>[]>(path, {
|
|
|
|
|
|
|
+ const res = await get<PageResult<Record<string, unknown>>>(path, {
|
|
|
townId: params?.townId || undefined,
|
|
townId: params?.townId || undefined,
|
|
|
payMonth: params?.payMonth || undefined,
|
|
payMonth: params?.payMonth || undefined,
|
|
|
bizType: params?.bizType || undefined,
|
|
bizType: params?.bizType || undefined,
|
|
|
|
|
+ pageNum: params?.pageNum || 1,
|
|
|
|
|
+ pageSize: params?.pageSize || 20,
|
|
|
})
|
|
})
|
|
|
- return Array.isArray(list) ? list : []
|
|
|
|
|
|
|
+ return {
|
|
|
|
|
+ list: Array.isArray(res?.list) ? res.list : [],
|
|
|
|
|
+ total: Number(res?.total || 0),
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** @deprecated use fetchReportTopicPage */
|
|
|
|
|
+export async function fetchReportTopic(
|
|
|
|
|
+ type: ReportTopicType,
|
|
|
|
|
+ params?: { townId?: string; payMonth?: string; bizType?: string },
|
|
|
|
|
+) {
|
|
|
|
|
+ const page = await fetchReportTopicPage(type, { ...params, pageNum: 1, pageSize: 20 })
|
|
|
|
|
+ return page.list
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** 报表页首屏:summary + region-stats,避免拉完整 workbench 扫全库人员 */
|
|
|
|
|
+export async function fetchReportPageBootstrap(params?: {
|
|
|
|
|
+ payMonth?: string
|
|
|
|
|
+ town?: string
|
|
|
|
|
+ village?: string
|
|
|
|
|
+}): Promise<{
|
|
|
|
|
+ personnelCount: number
|
|
|
|
|
+ townQualify: WorkbenchApi['townQualify']
|
|
|
|
|
+ villageCharts: WorkbenchApi['villageCharts']
|
|
|
|
|
+} | null> {
|
|
|
|
|
+ await ensureTowns()
|
|
|
|
|
+ const cfg = getAppConfig()
|
|
|
|
|
+ const role = cfg.roles.find((r) => r.key === cfg.currentRole)
|
|
|
|
|
+ const { townId, villageId } = await resolveScopeIds(
|
|
|
|
|
+ params?.town || role?.town,
|
|
|
|
|
+ params?.village || role?.village,
|
|
|
|
|
+ )
|
|
|
|
|
+ const payMonth = params?.payMonth || currentPayMonth()
|
|
|
|
|
+ const [summary, region] = await Promise.all([
|
|
|
|
|
+ get<WorkbenchApi['summary']>('/dashboard/summary', {
|
|
|
|
|
+ payMonth,
|
|
|
|
|
+ townId: townId || undefined,
|
|
|
|
|
+ }).catch(() => null),
|
|
|
|
|
+ get<RegionDashRow>('/dashboard/region-stats', {
|
|
|
|
|
+ payMonth,
|
|
|
|
|
+ townId: townId || undefined,
|
|
|
|
|
+ villageId: villageId || undefined,
|
|
|
|
|
+ months: 1,
|
|
|
|
|
+ }).catch(() => null),
|
|
|
|
|
+ ])
|
|
|
|
|
+ if (!summary && !region) return null
|
|
|
|
|
+ const townQualify = (summary?.townStats || []).map((s) => ({
|
|
|
|
|
+ townId: String(s.townId || ''),
|
|
|
|
|
+ peopleCount: Number(s.shouldPayCount || 0),
|
|
|
|
|
+ villageCount: 0,
|
|
|
|
|
+ withLandCount: 0,
|
|
|
|
|
+ withoutLandCount: 0,
|
|
|
|
|
+ qualifiedCount: 0,
|
|
|
|
|
+ amount: s.shouldPayAmount,
|
|
|
|
|
+ }))
|
|
|
|
|
+ let villageCharts: WorkbenchApi['villageCharts']
|
|
|
|
|
+ if (townId && !villageId) {
|
|
|
|
|
+ const charts = await buildTownVillageChartsFromApi(townId, payMonth).catch(() => null)
|
|
|
|
|
+ if (charts) {
|
|
|
|
|
+ villageCharts = charts.people.map((p, idx) => ({
|
|
|
|
|
+ villageId: p.name,
|
|
|
|
|
+ peopleCount: p.value,
|
|
|
|
|
+ amount: charts.amount[idx]?.value || 0,
|
|
|
|
|
+ }))
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ personnelCount: Number(region?.personnelCount || summary?.totalPeople || 0),
|
|
|
|
|
+ townQualify,
|
|
|
|
|
+ villageCharts,
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 月度汇总导出 csv */
|
|
/** 月度汇总导出 csv */
|
|
@@ -3234,6 +3378,9 @@ export async function exportReportSummary(payMonth?: string) {
|
|
|
timeout: 120_000,
|
|
timeout: 120_000,
|
|
|
})
|
|
})
|
|
|
const blob = res.data as Blob
|
|
const blob = res.data as Blob
|
|
|
|
|
+ if (blob.size <= 80) {
|
|
|
|
|
+ throw new Error('所选月份暂无批次/发放明细,无法导出月度汇总')
|
|
|
|
|
+ }
|
|
|
let fileName = `monthly-summary-${payMonth || 'all'}.csv`
|
|
let fileName = `monthly-summary-${payMonth || 'all'}.csv`
|
|
|
const cd = String(res.headers?.['content-disposition'] || '')
|
|
const cd = String(res.headers?.['content-disposition'] || '')
|
|
|
const m = /filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i.exec(cd)
|
|
const m = /filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i.exec(cd)
|
|
@@ -3511,6 +3658,8 @@ export async function fetchDisksPage(params?: {
|
|
|
townId: townId || undefined,
|
|
townId: townId || undefined,
|
|
|
batchLevel: 'TOWN',
|
|
batchLevel: 'TOWN',
|
|
|
statusIn: 'EXPORTED,RETURNED,ARCHIVED',
|
|
statusIn: 'EXPORTED,RETURNED,ARCHIVED',
|
|
|
|
|
+ lite: true,
|
|
|
|
|
+ withTownTotals: true,
|
|
|
})
|
|
})
|
|
|
const filtered = res?.list || []
|
|
const filtered = res?.list || []
|
|
|
if (!townId) {
|
|
if (!townId) {
|
|
@@ -3566,16 +3715,15 @@ export async function fetchDiskFailPeoplePage(
|
|
|
params?: { pageNum?: number; pageSize?: number },
|
|
params?: { pageNum?: number; pageSize?: number },
|
|
|
): Promise<{ list: DiskFailPerson[]; total: number; pageNum: number; pageSize: number }> {
|
|
): Promise<{ list: DiskFailPerson[]; total: number; pageNum: number; pageSize: number }> {
|
|
|
const pageNum = params?.pageNum || 1
|
|
const pageNum = params?.pageNum || 1
|
|
|
- const pageSize = params?.pageSize || 10
|
|
|
|
|
|
|
+ const pageSize = params?.pageSize || 200
|
|
|
const res = await post<PageResult<Record<string, unknown>>>('/return-disk/details/page', {
|
|
const res = await post<PageResult<Record<string, unknown>>>('/return-disk/details/page', {
|
|
|
pageNum,
|
|
pageNum,
|
|
|
pageSize,
|
|
pageSize,
|
|
|
batchId: diskId,
|
|
batchId: diskId,
|
|
|
})
|
|
})
|
|
|
- const list = (res?.list || [])
|
|
|
|
|
- .filter((d) => d.success === false)
|
|
|
|
|
- .map((d) => mapReturnFail(d, diskId))
|
|
|
|
|
- return { list, total: Number(res?.total || list.length), pageNum, pageSize }
|
|
|
|
|
|
|
+ const failed = (res?.list || []).filter((d) => d.success === false)
|
|
|
|
|
+ const list = failed.map((d) => mapReturnFail(d, diskId))
|
|
|
|
|
+ return { list, total: failed.length, pageNum, pageSize }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export async function fetchDiskFailPeople(diskId: string): Promise<DiskFailPerson[]> {
|
|
export async function fetchDiskFailPeople(diskId: string): Promise<DiskFailPerson[]> {
|
|
@@ -3718,6 +3866,8 @@ export async function pageAdminBatches(params?: {
|
|
|
status?: string
|
|
status?: string
|
|
|
pageNum?: number
|
|
pageNum?: number
|
|
|
pageSize?: number
|
|
pageSize?: number
|
|
|
|
|
+ /** 默认 false;列表首屏先出表,再异步 true 补镇人数/金额 */
|
|
|
|
|
+ withTownTotals?: boolean
|
|
|
}): Promise<{
|
|
}): Promise<{
|
|
|
list: Array<Record<string, unknown>>
|
|
list: Array<Record<string, unknown>>
|
|
|
total: number
|
|
total: number
|
|
@@ -3727,6 +3877,7 @@ export async function pageAdminBatches(params?: {
|
|
|
await ensureTowns()
|
|
await ensureTowns()
|
|
|
const pageNum = params?.pageNum || 1
|
|
const pageNum = params?.pageNum || 1
|
|
|
const pageSize = params?.pageSize || 10
|
|
const pageSize = params?.pageSize || 10
|
|
|
|
|
+ const withTownTotals = params?.withTownTotals === true
|
|
|
const res = await post<PageResult<Record<string, unknown>>>('/batches/page', {
|
|
const res = await post<PageResult<Record<string, unknown>>>('/batches/page', {
|
|
|
pageNum,
|
|
pageNum,
|
|
|
pageSize,
|
|
pageSize,
|
|
@@ -3735,6 +3886,9 @@ export async function pageAdminBatches(params?: {
|
|
|
villageId: params?.villageId || undefined,
|
|
villageId: params?.villageId || undefined,
|
|
|
status: params?.status || undefined,
|
|
status: params?.status || undefined,
|
|
|
batchLevel: params?.batchLevel || undefined,
|
|
batchLevel: params?.batchLevel || undefined,
|
|
|
|
|
+ lite: true,
|
|
|
|
|
+ withTownTotals,
|
|
|
|
|
+ withDistrictTotals: withTownTotals,
|
|
|
})
|
|
})
|
|
|
const list = (res?.list || [])
|
|
const list = (res?.list || [])
|
|
|
.filter((b) => String(b.batchLevel || '') !== 'VILLAGE')
|
|
.filter((b) => String(b.batchLevel || '') !== 'VILLAGE')
|