Proposal: 模板包机制——表单 Schema、流程定义与视图配置
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- go, json, yaml
- Área
- backend-api-design
Línea de trabajo
Start with the overall proposal in #1 and the storage design in #2, then review this issue’s schema, workflow, SLA, assignment, and view_config examples. The issue names no implementation files or tests; its expected outcome is an approved design that defines shared validation and rendering semantics, with #12 and #13 starting only after approval.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
背景
模板包是 TickFlow 的核心抽象(总体方案见 #1):工单类型 = 表单 schema + 流程 + SLA + 分派 + 视图配置,它决定「不同类型不同 UI、不同用法」如何落地。存储见 #2(ticket_types 表的 JSONB 字段),本文定义各 JSONB 的内部结构与校验规则。
表单 schema(form_schema)
采用 JSON Schema 的受限子集,前后端共用同一份做校验(后端校验必须存在,前端校验只为体验):
{
"fields": [
{ "key": "device_sn", "label": "设备编号", "type": "string", "required": true, "placeholder": "位于机身底部标签" },
{ "key": "category", "label": "故障分类", "type": "select", "required": true,
"options": [
{ "value": "hardware", "label": "硬件故障" },
{ "value": "software", "label": "软件异常" }
] },
{ "key": "occur_at", "label": "发生时间", "type": "datetime" },
{ "key": "photos", "label": "现场照片", "type": "attachments", "max_count": 9 }
]
}
- 类型集:
string/textarea/number/select/multiselect/boolean/date/datetime/attachments; - 字段
key为英文蛇形命名,落库到tickets.custom_fields;label为展示文案; - 校验项:
required、max_length、min/max、pattern、max_count; - schema 本身的合法性在保存类型时校验:未知类型、重复 key、非法 options、未知校验项一律拒绝保存。
流程定义(workflow)
可配置状态机,状态不进数据库枚举:
{
"states": [
{ "key": "pending", "name": "待受理", "type": "initial" },
{ "key": "processing", "name": "处理中", "type": "normal" },
{ "key": "confirming", "name": "待确认", "type": "normal" },
{ "key": "closed", "name": "已关闭", "type": "final" }
],
"transitions": [
{ "from": "pending", "action": "accept", "to": "processing", "roles": ["agent", "tenant_admin"] },
{ "from": "processing", "action": "resolve", "to": "confirming", "roles": ["agent", "tenant_admin"] },
{ "from": "confirming", "action": "confirm", "to": "closed", "roles": ["creator", "agent", "tenant_admin"] },
{ "from": "confirming", "action": "reject", "to": "processing", "roles": ["creator"] },
{ "from": "closed", "action": "reopen", "to": "pending", "roles": ["creator", "tenant_admin"] }
]
}
roles中的creator是相对角色(工单创建者本人),其余为租户角色;- 保存时校验:有且仅有一个
initial、至少一个final、所有from/to必须存在于 states、同一状态下action不重复; - 运行时:
POST /api/tickets/:id/transitions按 action 找到流转,校验角色(与 #6 权限矩阵取交集),通过后更新state、向 timeline 写入state_change记录、发布领域事件(见 #7); - 审批链(顺序 / 会签节点)是 P2 的节点扩展,P0 的 DSL 不预留半成品字段。
SLA 策略(sla_policy)
{
"first_response_minutes": 30,
"resolve_minutes": 480,
"escalation": []
}
P0 仅存配置并在工单详情展示时限倒计时;计时、超时提醒、升级属 P1(见 #1 路线图),P0 不实现扫描器。
分派策略(assignment)
{ "mode": "manual" }
P0 仅支持 manual;round_robin、skill_group 为 P1。保存时校验枚举合法即可。
视图配置(view_config)
{
"portal": {
"title": "设备报修",
"description": "请填写故障信息,工程师将在 30 分钟内响应",
"success_text": "已提交,请留意通知"
},
"list_columns": [
{ "field": "number" }, { "field": "title" }, { "field": "state" },
{ "field": "assignee" }, { "field": "created_at" }
],
"detail_groups": [
{ "title": "基础信息", "fields": ["number", "title", "priority", "state"] },
{ "title": "表单信息", "fields": ["device_sn", "category", "occur_at"] }
]
}
field可引用内置字段(number/title/state/assignee/created_at/priority等)或 form_schema 的字段 key,引用不存在时保存报错;- 工作台列表与详情按此渲染。注意区分:界面固定文案由前端代码维护(展示与数据分离),而 portal 的 title / description 等是租户配置的数据内容,允许存库。
内置种子模板包
四个场景各一个,YAML 文件内置在仓库 seed/ 目录(任务见 #19):新租户创建时自动复制为其初始类型(标记 is_builtin = true,允许停用与修改)。机制实现见 #12。
Expect
- Go 校验器(schema / workflow / view_config)与 Vue 渲染器覆盖同一份语义,测试 fixtures 共享(seed YAML 即测试用例);
- 本设计评审通过前,#12 与 #13 不开工。
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 0
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de LinuxSuRen/tick-flow
-
项目门面:logo、README 与仓库 AboutPosiblemente ocupada @linuxsuren-fs la tomó hace 9 días. Abiertodocumentation good first issue help wanted P0
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
LinuxSuRen/tick-flow#20 ·
-
编写四个内置种子模板包Posiblemente ocupada @linuxsuren-fs la tomó hace 9 días. Abiertogood first issue help wanted P0
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
LinuxSuRen/tick-flow#19 ·
-
实现处理工作台前端:列表、详情与处理动作Posiblemente ocupada @linuxsuren-fs la tomó hace 9 días. Abiertohelp wanted P0
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
LinuxSuRen/tick-flow#18 ·
-
实现提交门户前端:表单渲染器与我的工单Posiblemente ocupada @linuxsuren-fs la tomó hace 9 días. Abiertohelp wanted P0
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
LinuxSuRen/tick-flow#17 ·
-
实现站内通知与邮件通知Posiblemente ocupada @linuxsuren-fs la tomó hace 9 días. Abiertohelp wanted P0
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
LinuxSuRen/tick-flow#16 ·
Todos los issues de LinuxSuRen/tick-flow
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
vetro-protocol/vetro-monorepo#1262 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ProyectoRespira/respira-webapp#334 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100