feat(admin): Flowcharts.vue JSON 在线编辑 + 9 套排查模板种子数据

为管理后台'排查流程图'模块加 JSON 在线编辑能力 + 提供 9 套
办公 IT 常见故障排查模板种子数据(账号/系统/企微/VPN/邮箱/网络/
打印机/软件/硬件),管理员可基于此学习、筛选、修改、新增。

## 选型(按'优选开源'原则)
- @codemirror/lang-json / state / theme-one-dark / view
- codemirror(核心)
- vue-codemirror(Vue 3 集成)
- vue-json-pretty(JSON 树形预览)
全部为社区成熟开源组件,非自行开发

## 改动
- frontend-admin/package.json: 加 6 个 npm 依赖
- frontend-admin/src/api/troubleshooting.ts(新): TS 类型 +
  5 个 API client(listTemplates / getTemplate / createTemplate /
  updateTemplate / deleteTemplate) + formatJson/validateJson/
  countNodes/countDecisions 工具函数
- frontend-admin/src/components/flowchart/FlowchartEditorDialog.vue(新):
  双面板编辑器(左 CodeMirror + 右 vue-json-pretty),
  实时 JSON 校验 + 节点/决策统计 + 格式/复制/导出按钮
- frontend-admin/src/views/Flowcharts.vue(改): 列表 + 导入/导出/
  新建按钮 + EditorDialog 集成 + 文件上传 + 删除确认

## 9 套种子数据
- 01-account-password.json 账号密码
- 02-pc-system.json        电脑系统
- 03-wecom.json            企微问题
- 04-vpn.json              VPN 接入
- 05-email.json            邮箱
- 06-network.json          网络
- 07-printer.json          打印机
- 08-software.json         软件
- 09-hardware.json         硬件
每套 ~150-200 行,结构:name / category / description /
estimated_time / difficulty / tags / root_node(决策树)

## 工具脚本
- data/seed-templates/build_all.py: 合并 9 个 JSON 成 00-all.json
This commit is contained in:
Simon
2026-06-16 14:30:09 +08:00
parent caf9b7ed85
commit cec5607c45
14 changed files with 1824 additions and 156 deletions
+80
View File
@@ -0,0 +1,80 @@
{
"name": "硬件 / 桌面设备故障排查",
"category": "hardware",
"description": "员工显示器、键盘鼠标、耳机、视频会议摄像头、笔记本电池等",
"estimated_time": 10,
"difficulty": 2,
"tags": ["硬件", "显示器", "键盘", "鼠标", "耳机", "摄像头"],
"root_node": {
"id": "fc-hw-1",
"type": "step",
"label": "确认设备类型(显示器/键鼠/耳机/摄像头/其他)",
"status": "pending",
"children": [
{
"id": "fc-hw-2",
"type": "decision",
"label": "故障设备能换一台测试吗?",
"yes_branch": {
"id": "fc-hw-3",
"type": "step",
"label": "换设备测试,确认是设备本身问题:",
"children": [
{
"id": "fc-hw-4",
"type": "step",
"label": "【显示器】:换视频线(HDMI/DP/VGA) + 检查分辨率"
},
{
"id": "fc-hw-5",
"type": "step",
"label": "【键鼠】:换 USB 口 + 换电池 + 蓝牙重新配对"
},
{
"id": "fc-hw-6",
"type": "step",
"label": "【耳机/摄像头】:检查 USB/3.5mm + 隐私盖 + 系统权限"
},
{
"id": "fc-hw-7",
"type": "decision",
"label": "换设备后正常?",
"yes_branch": {
"id": "fc-hw-8",
"type": "step",
"label": "原设备故障:走 IT 资产报废/更换流程"
},
"no_branch": {
"id": "fc-hw-9",
"type": "step",
"label": "电脑端问题:检查驱动 + 系统设置"
}
}
]
},
"no_branch": {
"id": "fc-hw-10",
"type": "step",
"label": "【笔记本内嵌设备】:屏幕/键盘/电池/CPU 风扇",
"children": [
{
"id": "fc-hw-11",
"type": "step",
"label": "走送修流程(备份数据 → IT 出具送修单 → 厂商维修)"
},
{
"id": "fc-hw-12",
"type": "step",
"label": "需要备用机:走 IT 资产借用流程(最长 2 周)"
},
{
"id": "fc-hw-13",
"type": "step",
"label": "升级二线:硬件供应商(联系信息见公告)"
}
]
}
}
]
}
}