From bd75dc8a7075caa2d7a0656ec1b57a5674087c8a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 09:33:55 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=94=B9=E4=B8=BA=E9=9D=A0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=9C=AC=E8=BA=AB=E6=95=B4=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=A1=A8=E5=8D=95=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 云上的界面不读视图里的 form 布局,仍按对象的字段分组铺开,所以改字段本身: - 字段顺序:所属制度、版本号、版本标题、生效日期、版本状态、修订说明; - 条号索引、字数、token、哈希、原件、自动带出的所属制度和现行,放进「原件与导入信息」,默认折叠; - 去掉版本状态等写给 AI 的长说明,附件字段说明缩成一句; - 删掉视图里的 form 布局。 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RKKVniLvsfBswNHAfKKTVi --- src/objects/policy-attachment.object.ts | 21 +++++++++-------- src/objects/policy-version.object.ts | 16 ++++++------- src/views/policy-attachment.view.ts | 29 ----------------------- src/views/policy-version.view.ts | 31 ------------------------- 4 files changed, 19 insertions(+), 78 deletions(-) diff --git a/src/objects/policy-attachment.object.ts b/src/objects/policy-attachment.object.ts index 1f9ac43..86cf6ec 100644 --- a/src/objects/policy-attachment.object.ts +++ b/src/objects/policy-attachment.object.ts @@ -38,9 +38,10 @@ export const PolicyAttachment = ObjectSchema.create({ searchableFields: ['title'], fieldGroups: [ - { key: 'basic', label: '附件' }, - { key: 'content', label: '内容' }, - { key: 'import', label: '导入信息' }, + { key: 'basic', label: '附件信息' }, + { key: 'content', label: '附件正文' }, + // 自动带出 / 导入工具维护的字段和原件:收在最后,默认折叠 + { key: 'import', label: '原件与导入信息', collapse: 'collapsed' }, ], fields: { @@ -49,7 +50,7 @@ export const PolicyAttachment = ObjectSchema.create({ required: true, maxLength: 200, group: 'basic', - description: '附件自己的名称,原文怎么写就怎么写(如「本集团内训师申报表」),不带制度名', + description: '原文里附件自己的名称,不带制度名', }), policy_version: Field.masterDetail('brightrule_policy_version', { label: '所属版本', @@ -59,14 +60,14 @@ export const PolicyAttachment = ObjectSchema.create({ }), policy: Field.lookup('brightrule_policy', { label: '所属制度', - group: 'basic', + group: 'import', description: '由所属版本自动带出', }), attachment_class: Field.select({ label: '附件类别', required: true, group: 'basic', - description: 'normative 规范性附件与正文同等效力,一起读;form 表单、original 仅原件不作答复依据', + description: '规范性附件与正文同等效力,作答时一起读;表单、仅原件不作答复依据', options: [ { label: '规范性(并入全文)', value: 'normative' }, { label: '表单(交给用户)', value: 'form' }, @@ -77,17 +78,17 @@ export const PolicyAttachment = ObjectSchema.create({ label: '编号', maxLength: 20, group: 'basic', - description: '原文里的编号,如「附件1」「附表2」;正文里按这个编号引用附件,引用出处时也写它', + description: '原文里的编号,如「附件1」「附表2」', }), - sort_no: Field.number({ label: '序号', scale: 0, min: 1, group: 'basic', description: '附件的先后顺序:1、2、3…' }), + sort_no: Field.number({ label: '序号', scale: 0, min: 1, group: 'basic', }), is_current: Field.boolean({ label: '现行', defaultValue: false, - group: 'basic', + group: 'import', description: 'true = 属于现行版本;随所属版本的状态自动维护', }), - original_file: Field.file({ label: '原件(docx / PDF)', group: 'content' }), + original_file: Field.file({ label: '原件(docx / PDF)', group: 'import' }), body_md: Field.markdown({ label: '附件正文', group: 'content', diff --git a/src/objects/policy-version.object.ts b/src/objects/policy-version.object.ts index bdb79b4..f8aa312 100644 --- a/src/objects/policy-version.object.ts +++ b/src/objects/policy-version.object.ts @@ -40,17 +40,19 @@ export const PolicyVersion = ObjectSchema.create({ fieldGroups: [ { key: 'details', label: '版本信息' }, { key: 'content', label: '正文' }, - { key: 'import', label: '导入信息' }, + // 导入工具维护的字段和原件:收在最后,默认折叠 + { key: 'import', label: '原件与导入信息', collapse: 'collapsed' }, ], fields: { - title: Field.text({ label: '版本标题', required: true, maxLength: 200, group: 'details' }), policy: Field.masterDetail('brightrule_policy', { label: '所属制度', required: true, group: 'details', deleteBehavior: 'restrict' }), version_no: Field.text({ label: '版本号', maxLength: 20, group: 'details' }), + title: Field.text({ label: '版本标题', required: true, maxLength: 200, group: 'details' }), + effective_date: Field.date({ label: '生效日期', group: 'details' }), + version_status: Field.select({ label: '版本状态', group: 'details', - description: 'current = 现行,作答只用现行版本;draft = 草稿(导入后待核对);superseded = 已被新版本替代', options: [ { label: '草稿', value: 'draft', color: '#6B7280', default: true }, { label: '现行', value: 'current', color: '#10B981' }, @@ -58,20 +60,18 @@ export const PolicyVersion = ObjectSchema.create({ ], }), change_note: Field.textarea({ label: '修订说明', group: 'details' }), - effective_date: Field.date({ label: '生效日期', group: 'details' }), body_md: Field.markdown({ label: '正文', group: 'content', - description: - '本版本的正文全文(Markdown,已脱敏),条文以 **第X条** 开头、章节为 ## 标题;AI 作答的正文来源。规范性附件的全文在附件子表', + description: '脱敏后的正文全文(Markdown):条文以 **第X条** 开头,章节用 ## 标题。AI 按它作答,规范性附件的全文在附件里', }), article_index: Field.json({ label: '条号索引', - group: 'content', + group: 'import', description: '每一条:{ article, chapter, redacted: [起, 止] },偏移按正文的码点计;作答时直接读 body_md 即可', }), - original_file: Field.file({ label: '正文原件(docx / PDF)', group: 'content' }), + original_file: Field.file({ label: '正文原件(docx / PDF)', group: 'import' }), text_chars: Field.number({ label: '字数', scale: 0, min: 0, group: 'import', description: '正文的字数(码点数);0 表示还没有正文' }), text_tokens: Field.number({ label: 'Token 估算', scale: 0, min: 0, group: 'import' }), diff --git a/src/views/policy-attachment.view.ts b/src/views/policy-attachment.view.ts index 09c47e9..bc2d7fd 100644 --- a/src/views/policy-attachment.view.ts +++ b/src/views/policy-attachment.view.ts @@ -5,35 +5,6 @@ import { PolicyAttachment } from '../objects/policy-attachment.object.js'; // and loading it for every row costs the page. const policyAttachmentViews: UI.View = { object: PolicyAttachment.name, - // 表单只放人填的字段,两两成对排齐,附件正文紧接在后面;所属制度、现行由所属版本自动带出,字数、token、 - // 哈希由导入工具维护。原件现阶段不上传,字段留给后期,单独一组、默认折叠。helpText 覆盖写给 AI 的说明。 - form: { - type: 'simple', - modalSize: 'xl', - sections: [ - { - name: 'attachment_main', - label: '附件信息', - columns: 2, - fields: [ - { field: 'policy_version', span: 'full', helpText: '' }, - { field: 'label', helpText: '原文里的编号,如「附件1」' }, - { field: 'sort_no', helpText: '' }, - { field: 'title', helpText: '' }, - { field: 'attachment_class', helpText: '' }, - { field: 'body_md', span: 'full', helpText: '规范性附件的全文(Markdown,已脱敏);表单类可以不填' }, - ], - }, - { - name: 'attachment_original', - label: '原件(后期使用)', - columns: 1, - collapsible: true, - collapsed: true, - fields: [{ field: 'original_file', helpText: '' }], - }, - ], - }, list: { label: '全部附件', type: 'grid', diff --git a/src/views/policy-version.view.ts b/src/views/policy-version.view.ts index e976bdd..83194a7 100644 --- a/src/views/policy-version.view.ts +++ b/src/views/policy-version.view.ts @@ -3,37 +3,6 @@ import { PolicyVersion } from '../objects/policy-version.object.js'; const policyVersionViews: UI.View = { object: PolicyVersion.name, - // 新建 / 编辑表单只放人填的字段,两两成对排齐,正文紧接在后面。条号索引、字数、token 估算、内容哈希由 - // 导入工具(tools/redact)维护,不在表单里。正文原件现阶段不上传,字段留给后期,单独一组、默认折叠。 - // 对象字段的 description 写给 AI,表单里用 helpText 覆盖成给人看的短句(不需要提示的字段给空串)。 - form: { - type: 'simple', - modalSize: 'xl', - sections: [ - { - name: 'version_main', - label: '版本信息', - columns: 2, - fields: [ - 'policy', - { field: 'version_no', helpText: '' }, - { field: 'title', span: 'full', helpText: '' }, - { field: 'effective_date', helpText: '' }, - { field: 'version_status', helpText: '' }, - { field: 'change_note', span: 'full', helpText: '' }, - { field: 'body_md', span: 'full', helpText: '脱敏后的正文(Markdown):条文以 **第X条** 开头,章节用 ## 标题' }, - ], - }, - { - name: 'version_original', - label: '原件(后期使用)', - columns: 1, - collapsible: true, - collapsed: true, - fields: [{ field: 'original_file', helpText: '' }], - }, - ], - }, list: { label: '全部版本', type: 'grid',