diff --git a/src/views/policy.view.ts b/src/views/policy.view.ts index ef96380..f3baa79 100644 --- a/src/views/policy.view.ts +++ b/src/views/policy.view.ts @@ -9,7 +9,13 @@ import { Policy } from '../objects/policy.object.js'; // form; 「文件性质」 sits beside 上级制度, which a forwarded or followed policy // points at. 制度大类 and 制度层级 (brightrule#54) sit beside 制度分类, so a // list filters and groups by the policy system's 三类三层级. -// 制度库 by 制度大类: what the home page's three cards open (src/pages/home.page.ts). +// 制度库 sorts the way the policy system reads: 大类 → 分类 → 层级, the newest +// in effect first within a level. A select sorts by its stored value, so 大类 +// (governance, operations, party) and 层级 (level_1..3) come out in order, while +// 分类 comes out alphabetically by value, not in the system's order. 所属单位 +// cannot lead: a lookup sorts by the stored id, and the list's sort picker +// leaves lookup columns out; filter by 所属单位 to read one unit's policies. +// 制度库 by 制度大类: reached from the view switcher. const publishedOf = (group: string, label: string) => ({ label: `制度库 · ${label}`, type: 'grid' as const, @@ -27,7 +33,11 @@ const publishedOf = (group: string, label: string) => ({ { field: 'status', operator: 'equals' as const, value: 'published' }, { field: 'category_group', operator: 'equals' as const, value: group }, ], - sort: [{ field: 'effective_date', order: 'desc' as const }], + sort: [ + { field: 'category', order: 'asc' as const }, + { field: 'policy_level', order: 'asc' as const }, + { field: 'effective_date', order: 'desc' as const }, + ], }); const policyViews: UI.View = { @@ -72,7 +82,12 @@ const policyViews: UI.View = { { field: 'summary' }, ], filter: [{ field: 'status', operator: 'equals', value: 'published' }], - sort: [{ field: 'effective_date', order: 'desc' }], + sort: [ + { field: 'category_group', order: 'asc' }, + { field: 'category', order: 'asc' }, + { field: 'policy_level', order: 'asc' }, + { field: 'effective_date', order: 'desc' }, + ], userFilters: { element: 'dropdown' as const, fields: [{ field: 'category_group' }, { field: 'category' }, { field: 'owning_unit' }, { field: 'policy_level' }],