ticket/wwwroot/my/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

95 lines
5.4 KiB
XML

{
"widgettype": "VBox",
"options": {"width": "100%", "height": "100%", "padding": "8px", "gap": "8px"},
"subwidgets": [
{
"widgettype": "InlineForm",
"id": "my_ticket_filter",
"options": {
"css": "card", "padding": "8px", "submit_label": "查询",
"fields": [
{"name": "status", "label": "状态", "uitype": "code", "cwidth": 10,
"data": [
{"value": "", "text": "全部"},
{"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": "已取消"}
]}
]
},
"binds": [{
"wid": "self", "event": "submit",
"actiontype": "script", "target": "my_ticket_table",
"script": "var tbl = bricks.getWidgetById('my_ticket_table', bricks.app.root); if(tbl) await tbl.render(params);"
}]
},
{
"widgettype": "Tabular",
"id": "my_ticket_table",
"options": {
"title": "我的工单",
"width": "100%", "css": "card",
"data_url": "{{entire_url('/ticket/api/my_tickets.dspy')}}",
"data_method": "GET", "page_rows": 20,
"toolbar": {
"tools": [
{"name": "new_ticket", "label": "提交新工单"},
{"name": "view_detail", "label": "查看详情", "selected_row": true}
]
},
"row_options": {
"browserfields": {
"exclouded": ["id", "customer_org_id", "followup_count"],
"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": "已取消"}]},
"close_reason": {"uitype": "code", "data": [
{"value": "resolved", "text": "已解决"}, {"value": "cancelled", "text": "客户取消"}]}
}
},
"fields": [
{"name": "ticket_no", "title": "工单号", "type": "str", "length": 32, "cwidth": 12},
{"name": "title", "title": "标题", "type": "str", "length": 200, "cwidth": 24},
{"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": "created_at", "title": "提交时间", "type": "timestamp", "cwidth": 14},
{"name": "updated_at", "title": "最后更新", "type": "timestamp", "cwidth": 14}
]
}
},
"binds": [
{
"wid": "self", "event": "new_ticket",
"actiontype": "urlwidget", "target": "PopupWindow",
"popup_options": {"title": "提交新工单", "width": "46%", "height": "72%",
"archor": "cc", "movable": true,
"dismiss_events": ["cancel", "submited"]},
"options": {"url": "{{entire_url('/ticket/my/new_ticket_form.ui')}}"}
},
{
"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}$"}
}
]
}
]
}