[CLAUDE] PurchaseEvaluation: rename 71 WorkItems theo format PMH anh Kiet FDC chot (MAT-n/SUB-n/MEP-SUB-n/MEP-EQU-n + ten "STT nhom ten") + FE sort numeric
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 4m33s

- anh Kiet 16:59: "MA CV gom chu MEP-SUB-1 roi ten 1 MEP Sub MEP (Full) - dung kieu vay".
- DbInitializer seed tuples 71 ma moi (VT->MAT, TP->SUB, MEP-0n->MEP-SUB-n, TB->MEP-EQU-n).
- scripts/s59-rename-workitems-pmh.sql DA CHAY prod + LocalDB Dev TRUOC push (UPDATE giu Id,
  71/71, OLD-CODES=0, verify JSON qua API prod tieng Viet nguyen ven).
- FE x2 app (SHA256 mirror): PeWorkspaceCreateView + PeHeaderForm sort numeric-aware
  (ma khong pad -> string-sort loan "10"<"2") + tree Panel 1 workItemName numeric:true.
- scripts/master-import-data.generated.md sync 71 dong W| + note mapping.
This commit is contained in:
pqhuy1987
2026-06-11 17:14:06 +07:00
parent bbd1554f74
commit c869d2617d
9 changed files with 286 additions and 148 deletions

View File

@ -59,10 +59,14 @@ export function PeHeaderForm({
})
// S57bis — list Hạng mục công việc (active only, mirror PeWorkspaceCreateView).
// S59 — sort numeric-aware client (mã PMH không pad số — mirror CreateView).
const workItems = useQuery({
queryKey: ['catalogs', 'work-items'],
queryFn: async () => (await api.get<WorkItemOption[]>('/catalogs/work-items')).data,
select: rows => rows.filter(r => r.isActive !== false),
select: rows => rows
.filter(r => r.isActive !== false)
.sort((a, b) => (a.category ?? '').localeCompare(b.category ?? '', 'vi')
|| a.code.localeCompare(b.code, 'vi', { numeric: true })),
})
const [form, setForm] = useState({

View File

@ -87,10 +87,15 @@ export function PeWorkspaceCreateView({
})
// S57bis — list Hạng mục công việc (active only — filter client nếu BE trả isActive).
// S59 — sort numeric-aware client: mã PMH không pad số (MAT-1..16, MEP-SUB-1…)
// → BE OrderBy(Code) string xếp "MAT-10" trước "MAT-2"; re-sort {numeric:true}.
const workItems = useQuery({
queryKey: ['catalogs', 'work-items'],
queryFn: async () => (await api.get<WorkItemOption[]>('/catalogs/work-items')).data,
select: rows => rows.filter(r => r.isActive !== false),
select: rows => rows
.filter(r => r.isActive !== false)
.sort((a, b) => (a.category ?? '').localeCompare(b.category ?? '', 'vi')
|| a.code.localeCompare(b.code, 'vi', { numeric: true })),
})
// Mig 23 — fetch list quy trình duyệt V2 (filter ApplicableType khớp defaultType).

View File

@ -170,7 +170,8 @@ export function PurchaseEvaluationsListPage() {
for (const yg of arr) {
yg.projects.sort((a, b) => a.projectName.localeCompare(b.projectName, 'vi'))
for (const pg of yg.projects) {
pg.workItems.sort((a, b) => a.workItemName.localeCompare(b.workItemName, 'vi'))
// S59 — numeric:true vì tên PMH bắt đầu bằng STT không pad ("2 Mat…" < "10 Mat…")
pg.workItems.sort((a, b) => a.workItemName.localeCompare(b.workItemName, 'vi', { numeric: true }))
for (const wg of pg.workItems) {
wg.items.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())
}