ticket/wwwroot/manage/index.ui
yumoqing 54f2f2d597 feat: 工单管理模块初版——客户提问→agent预处理→人工运维→转派,接入平台待办
- 3表: tk_tickets(状态机+受理角色/人+agent锁)/tk_messages(客户可见/内部备注)/tk_transfers(append-only流水)
- core.py: 8态13迁移状态机全乐观锁; 转派候选动态查owner角色+'0'机构用户(不硬编码);
  默认受理角色params可配(ticket_default_role=owner.maintainer)
- agent.py: 异步poller(bid_flow范式), RAG检索'0'机构KB+历史工单, llm_call(org_id=0)
  LLM裁决能否回答(严格JSON), 硬门禁reply<20字符转人工, 故障≠答不了(fail_rounds>=3转人工),
  stale回收10min; 追问回流(agent_processing+owner空)立即拾取不等stale
- todos.py: 平台待办provider, 状态派生(客户待确认/角色池待认领/受理人待处理)
- init.py: load_ticket注册env+provider+poller(PIPELINE_MODE=web不启动)
- wwwroot: 客户我的工单页+建单表单, 运维工单管理页(队列切换), 详情弹窗(正文与操作同屏,按视角出按钮)
- load_path.py: logined全部API(业务权限服务端按current_role动态校验)+管理页壳owner三角色
- init/data.json: 7组码表+owner.maintainer角色种子(app_audit先例)
2026-09-10 16:17:58 +08:00

81 lines
4.6 KiB
XML

{
"widgettype": "VBox",
"options": {"width": "100%", "height": "100%", "padding": "8px", "gap": "8px"},
"subwidgets": [
{
"widgettype": "InlineForm",
"id": "staff_ticket_filter",
"options": {
"css": "card", "padding": "8px", "submit_label": "查询",
"fields": [
{"name": "queue", "label": "队列", "uitype": "code", "value": "pending", "cwidth": 10,
"data": [
{"value": "pending", "text": "待认领(我的角色池)"},
{"value": "mine", "text": "我受理的"},
{"value": "all", "text": "全部工单"}
]}
]
},
"binds": [{
"wid": "self", "event": "submit",
"actiontype": "script", "target": "staff_ticket_table",
"script": "var tbl = bricks.getWidgetById('staff_ticket_table', bricks.app.root); if(tbl) await tbl.render(params);"
}]
},
{
"widgettype": "Tabular",
"id": "staff_ticket_table",
"options": {
"title": "工单管理",
"width": "100%", "css": "card",
"data_url": "{{entire_url('/ticket/api/staff_tickets.dspy')}}",
"data_method": "GET", "page_rows": 20,
"data_params": {"queue": "pending"},
"toolbar": {
"tools": [
{"name": "view_detail", "label": "查看详情/处理", "selected_row": true}
]
},
"row_options": {
"browserfields": {
"exclouded": ["id", "customer_org_id", "current_assignee"],
"alters": {
"category": {"uitype": "code", "data": [
{"value": "consult", "text": "使用咨询"}, {"value": "fault", "text": "故障报修"},
{"value": "billing", "text": "计费账务"}, {"value": "other", "text": "其他"}]},
"priority": {"uitype": "code", "data": [
{"value": "low", "text": "低"}, {"value": "normal", "text": "普通"},
{"value": "high", "text": "高"}, {"value": "urgent", "text": "紧急"}]},
"status": {"uitype": "code", "data": [
{"value": "new", "text": "已提交"}, {"value": "agent_processing", "text": "助手处理中"},
{"value": "agent_replied", "text": "助手已回复"}, {"value": "human_pending", "text": "待人工认领"},
{"value": "human_processing", "text": "人工处理中"}, {"value": "staff_replied", "text": "人工已回复"},
{"value": "closed", "text": "已关闭"}, {"value": "cancelled", "text": "已取消"}]}
}
},
"fields": [
{"name": "ticket_no", "title": "工单号", "type": "str", "length": 32, "cwidth": 12},
{"name": "title", "title": "标题", "type": "str", "length": 200, "cwidth": 20},
{"name": "category", "title": "分类", "type": "str", "length": 32, "cwidth": 8},
{"name": "priority", "title": "优先级", "type": "str", "length": 16, "cwidth": 6},
{"name": "status", "title": "状态", "type": "str", "length": 32, "cwidth": 10},
{"name": "customer_org_name", "title": "客户机构", "type": "str", "length": 100, "cwidth": 14},
{"name": "current_role", "title": "受理角色", "type": "str", "length": 64, "cwidth": 12},
{"name": "assignee_name", "title": "受理人", "type": "str", "length": 32, "cwidth": 8},
{"name": "updated_at", "title": "最后更新", "type": "timestamp", "cwidth": 14}
]
}
},
"binds": [
{
"wid": "self", "event": "view_detail",
"actiontype": "urlwidget", "target": "PopupWindow",
"popup_options": {"title": "工单处理", "width": "72%", "height": "82%",
"archor": "cc", "resizable": true},
"options": {"url": "{{entire_url('/ticket/api/ticket_detail_popup.dspy')}}?id=${id}$"}
}
]
}
]
}