Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/objects/policy-attachment.object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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: '所属版本',
Expand All @@ -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' },
Expand All @@ -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',
Expand Down
16 changes: 8 additions & 8 deletions src/objects/policy-version.object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,38 @@ 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' },
{ label: '已失效', value: 'superseded', color: '#9CA3AF' },
],
}),
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' }),
Expand Down
29 changes: 0 additions & 29 deletions src/views/policy-attachment.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
31 changes: 0 additions & 31 deletions src/views/policy-version.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down