data.js 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. /* 模拟数据只存在于页面内存。内部下标从 0 开始,页面上的序号从 1 开始。 */
  2. const TODAY = "2026-10-15";
  3. /* 区域三级:大区 / 市 / 区县。客户可挂在任一层,只能挂一个节点。 */
  4. const LEVEL_NAMES = ["大区", "市", "区县"];
  5. const SEED = {
  6. setting: { defaultReconcileDay: 5 },
  7. regions: [
  8. { id: "east", name: "华东大区", level: 0, parent: null },
  9. { id: "south", name: "华南大区", level: 0, parent: null },
  10. { id: "sh", name: "上海市", level: 1, parent: "east" },
  11. { id: "su", name: "苏州市", level: 1, parent: "east" },
  12. { id: "gz", name: "广州市", level: 1, parent: "south" },
  13. { id: "pd", name: "浦东新区", level: 2, parent: "sh" },
  14. { id: "lg", name: "临港新片区", level: 2, parent: "sh" },
  15. { id: "mh", name: "闵行区", level: 2, parent: "sh" },
  16. { id: "ks", name: "昆山市", level: 2, parent: "su" },
  17. { id: "th", name: "天河区", level: 2, parent: "gz" },
  18. ],
  19. /* 运营商按所属区域建档(region 为区域节点 id,含下级生效);客户只归属唯一运营商。
  20. shareMode 为档案级分成方式(按比例 / 按金额 / 按每账号,三选一),shareValue 随方式而定:
  21. 按比例时为 0-1 的比例(列表显示为百分比),按金额时为每月固定分成的人民币元(列表显示为金额/月),
  22. 按每账号时为每个账号的人民币金额(结算时分成金额 = 账号数 × 每账号金额)。在各自编辑界面配置。 */
  23. operators: [
  24. { name: "联通", region: "sh", reconcileDay: null, payCycle: "按月", notify: "notice@unicorn.example", shareMode: "按比例", shareValue: 0.2 },
  25. { name: "电信", region: "east", reconcileDay: null, payCycle: "按年", notify: "notice@ict-telecom.example", shareMode: "按比例", shareValue: 0.18 },
  26. { name: "移动", region: "east", reconcileDay: 8, payCycle: "按月", notify: "notice@mobile.example", shareMode: "按比例", shareValue: 0.15 },
  27. { name: "广东电信", region: "south", reconcileDay: null, payCycle: "按季度", notify: "notice@gd-ict.example", shareMode: "按金额", shareValue: 60 },
  28. { name: "苏州移动", region: "su", reconcileDay: 12, payCycle: "按季度", notify: "notice@sz-mobile.example", shareMode: "按每账号", shareValue: 3.5 },
  29. { name: "广州移动", region: "gz", reconcileDay: null, payCycle: "按月", notify: "notice@gz-mobile.example", shareMode: "按比例", shareValue: 0.12 },
  30. ],
  31. partners: [
  32. { name: "邹合", region: "east", title: "华东渠道", notify: "zouhe@example", scope: { regions: ["east"], enterprises: [] }, shareMode: "按比例", shareValue: 0.05 },
  33. { name: "何南", region: "gz", title: "华南渠道", notify: "henan@example", scope: { regions: ["th"], enterprises: [2] }, shareMode: "按每账号", shareValue: 6 },
  34. ],
  35. /* 运维团队按所属区域建档(region 为建档区域节点 id,列表显示全路径),负责范围另在「配置范围」里勾;
  36. type 为团队类型(常规 / 施工,各占一个 tab),mode 为团队内工单分派方式,
  37. shareMode 与 shareValue 为档案级分成配置,口径与运营商、合伙人、运营团队一致。 */
  38. teams: [
  39. { name: "华东常规运维", region: "east", type: "常规", mode: "手工", scope: { regions: ["sh", "su"], enterprises: [] }, shareMode: "按金额", shareValue: 50 },
  40. { name: "沪东施工", region: "sh", type: "施工", mode: "自动平均", scope: { regions: ["pd"], enterprises: [1] }, shareMode: "按每账号", shareValue: 4 },
  41. ],
  42. /* hq: true 为系统内置的总运营团队:不限所属区域(region 为空),负责范围覆盖全国,列表置顶且不可删除。
  43. 该团队的默认主账号即总运营账号(见 users 中 builtin: true 的一条),不再另设运营团队账号。 */
  44. regOpsTeams: [
  45. { name: "总运营团队", region: "", hq: true, scope: { regions: ["east", "south"], enterprises: [] }, desc: "总部平台级团队,不限所属区域,覆盖全国全部客户", shareMode: "按比例", shareValue: 0.1 },
  46. { name: "华东运营", region: "east", scope: { regions: ["east"], enterprises: [] }, desc: "覆盖华东大区全部下挂客户", shareMode: "按比例", shareValue: 0.08 },
  47. { name: "华南运营", region: "south", scope: { regions: ["south"], enterprises: [] }, desc: "覆盖华南大区全部下挂客户", shareMode: "按金额", shareValue: 30 },
  48. { name: "上海运营", region: "sh", scope: { regions: ["sh"], enterprises: [] }, desc: "覆盖上海市及其下级区域", shareMode: "按每账号", shareValue: 2.5 },
  49. ],
  50. members: [
  51. { name: "周宁", team: 0, type: "常规", scope: [0, 1, 2, 4] },
  52. { name: "李可", team: 0, type: "常规", scope: [0, 3, 4] },
  53. { name: "赵工", team: 1, type: "施工", scope: [0, 1, 3] },
  54. { name: "钱工", team: 1, type: "施工", scope: [0, 1, 3] },
  55. { name: "陈录", team: 0, type: "录入", scope: [0, 1, 2, 3, 4] },
  56. ],
  57. awards: [
  58. { member: 2, at: "2026-09-20", kind: "奖励", text: "浦东园区割接提前 1 天完成,客户零投诉", amount: 200 },
  59. { member: 2, at: "2026-10-11", kind: "扣罚", text: "临港上门未按约定时间到达,扣罚只作考核,费用在线下处理", amount: -100 },
  60. ],
  61. enterprises: [
  62. {
  63. no: "KL-2026-0001",
  64. name: "澄澜科技有限公司",
  65. subject: "企业",
  66. idNo: "91310115MA1K3XE71T",
  67. materials: "营业执照、客户名称、统一社会信用代码、经办联系人、地址、合同、电话",
  68. files: ["oss://materials/KL-2026-0001/营业执照.pdf", "oss://materials/KL-2026-0001/受理单.pdf", "oss://materials/KL-2026-0001/联通交接单.pdf"],
  69. contact: "沈澄",
  70. address: "上海市浦东新区金港路 300 号 6 号楼 3 层",
  71. phone: "021-66001001",
  72. region: "pd",
  73. operator: 0,
  74. partner: 0,
  75. teams: { 常规: 0, 施工: 1 },
  76. status: "在用",
  77. quota: 5,
  78. history: [
  79. { at: "2026-08-10 10:20", field: "挂载区域", before: "未挂载", after: "华东大区 / 上海市 / 浦东新区", by: "林管" },
  80. { at: "2026-03-20 16:40", field: "账户状态", before: "未开通", after: "在用(实际开通日 2026-03-20)", by: "周宁回填" },
  81. ],
  82. },
  83. {
  84. no: "KL-2026-0008",
  85. name: "临港跨境贸易",
  86. subject: "企业",
  87. idNo: "91310115MA1F9QB64P",
  88. materials: "营业执照、客户名称、统一社会信用代码、经办联系人、地址、合同、电话",
  89. files: ["oss://materials/KL-2026-0008/营业执照.pdf", "oss://materials/KL-2026-0008/ICT合同.pdf", "oss://materials/KL-2026-0008/联通交接单.pdf"],
  90. contact: "陆港",
  91. address: "上海市浦东新区环湖西二路 800 号 A 座 11 层",
  92. phone: "021-66002008",
  93. region: "lg",
  94. operator: 1,
  95. partner: null,
  96. teams: { 常规: 0 },
  97. status: "未开通",
  98. quota: 8,
  99. history: [
  100. { at: "2026-09-02 09:05", field: "挂载区域", before: "未挂载", after: "华东大区 / 上海市 / 临港新片区", by: "林管" },
  101. ],
  102. },
  103. {
  104. no: "KL-2026-0012",
  105. name: "陈阿福",
  106. subject: "个体工商户",
  107. idNo: "320583199003124517",
  108. materials: "身份证、姓名、身份证号、手机号、地址",
  109. files: ["oss://materials/KL-2026-0012/身份证.jpg"],
  110. contact: "陈阿福",
  111. address: "江苏省昆山市玉山镇中华园东路 58 号 2 单元 402",
  112. phone: "13800001112",
  113. region: "ks",
  114. operator: 2,
  115. partner: 1,
  116. teams: { 常规: 0 },
  117. status: "在用",
  118. quota: 1,
  119. history: [
  120. { at: "2026-08-28 14:10", field: "挂载区域", before: "未挂载", after: "华东大区 / 苏州市 / 昆山市", by: "林管" },
  121. ],
  122. },
  123. {
  124. no: "KL-2026-0019",
  125. name: "王敏",
  126. subject: "个人",
  127. idNo: "310115199208173024",
  128. materials: "身份证、姓名、身份证号、手机号、地址",
  129. files: ["oss://materials/KL-2026-0019/身份证.jpg"],
  130. contact: "王敏",
  131. address: "上海市浦东新区张杨路 1200 弄 12 号 1802 室",
  132. phone: "13900001019",
  133. region: "pd",
  134. operator: 2,
  135. partner: 1,
  136. teams: { 常规: 0, 施工: 1 },
  137. status: "在用",
  138. quota: 2,
  139. history: [
  140. { at: "2026-08-20 11:30", field: "挂载区域", before: "华东大区 / 苏州市 / 昆山市", after: "华东大区 / 上海市 / 浦东新区", by: "林管" },
  141. { at: "2026-08-20 11:32", field: "合伙人", before: "无", after: "何南(华南渠道,直接多选客户)", by: "林管" },
  142. ],
  143. },
  144. {
  145. no: "KL-2026-0023",
  146. name: "海岚跨境电商(上海)",
  147. subject: "企业",
  148. idNo: "91310112MA1G8YK45H",
  149. materials: "营业执照、客户名称、统一社会信用代码、经办联系人、地址、合同、电话",
  150. files: ["oss://materials/KL-2026-0023/营业执照.pdf", "oss://materials/KL-2026-0023/续约合同.pdf"],
  151. contact: "周岚",
  152. address: "上海市闵行区申长路 988 号 3 号楼 5 层",
  153. phone: "021-54002023",
  154. region: "mh",
  155. operator: 0,
  156. partner: 0,
  157. teams: { 常规: 0 },
  158. status: "在用",
  159. quota: 2,
  160. history: [
  161. { at: "2026-09-12 15:00", field: "挂载区域", before: "未挂载", after: "华东大区 / 上海市 / 闵行区", by: "林管" },
  162. { at: "2025-10-01 10:00", field: "账户状态", before: "未开通", after: "在用(实际开通日 2025-10-01)", by: "周宁回填" },
  163. ],
  164. },
  165. /* 与 KL-2026-0012 同名的个人客户:客户名称允许重名,建档与查重只看客户识别号 */
  166. {
  167. no: "KL-2026-0026",
  168. name: "陈阿福",
  169. subject: "个人",
  170. idNo: "330382198711260018",
  171. materials: "身份证、姓名、身份证号、手机号、地址",
  172. files: ["oss://materials/KL-2026-0026/身份证.jpg"],
  173. contact: "陈阿福",
  174. address: "上海市闵行区七莘路 1500 弄 8 号 501 室",
  175. phone: "13800002026",
  176. region: "mh",
  177. operator: 0,
  178. partner: 1,
  179. teams: { 常规: 0 },
  180. status: "未开通",
  181. quota: 1,
  182. history: [
  183. { at: "2026-10-15 09:40", field: "挂载区域", before: "未挂载", after: "华东大区 / 上海市 / 闵行区", by: "林管" },
  184. ],
  185. },
  186. ],
  187. /* 固定套餐口径取自 docs/原始文档/跨境网络报价单.pdf:
  188. 使用规模 10 人左右分「通用办公 / 直播高需求 / AI 应用」三组共 8 档,另设「单独境外 IP」按个叠加档;
  189. 使用规模 30 人及以上走定制化,报价单不列固定单价,由区域运营为具体客户配自定义套餐承接
  190. (跨境养号的云手机租赁同为按需报价,同样走自定义套餐)。
  191. cat 为用途分类,目录按它分组;desc 为报价单权益口径。
  192. 报价单按月报价,首期只做按年订阅,年订阅价格 = 月价 × 12。
  193. 分账号额度报价单未给出,按用途推定(办公档 10;直播 A 单链接单流 2、B 单链接多流 5、C 顶配 10;
  194. AI 5M 档 3、10M 档 5;按个叠加的增值项不占额度记 0),运营可在目录内直接改。
  195. costs 为该档位随附的成本项:名称取自「成本管理」里的全局应扣除成本项清单,金额默认沿用清单上的本期摊销额、可在档位上改写,
  196. 计算方式与周期取全局成本项上的口径,档位上不新建成本项。计算方式为「每份」的项再多一个 qty:本档位实际配了几份这项资源就摊几份
  197. (例如该档配了 2 台境外云主机记 qty: 2),不填按 1 份;「每客户」「每账号」的项不带 qty,也不按份数放大。
  198. 成本项本身是全局口径,不挂在客户或订阅上,客户本月计入哪几笔由其在用订阅引用的档位决定。 */
  199. packages: [
  200. { name: "跨境办公 · 基础档", cat: "通用办公", yearPrice: 1080, monthPrice: 90, quota: 10, bw: "不承诺带宽", desc: "一般访问流量,无固定境外 IP,不承诺带宽", custom: null },
  201. { name: "跨境办公 · 标准档", cat: "通用办公", yearPrice: 1440, monthPrice: 120, quota: 10, bw: "下行 10M / 上行 1M", desc: "店铺管理、一般办公、视频会议、ERP 等,比基础档速度更快更稳定", custom: null },
  202. { name: "跨境办公 · 独立 IP 档", cat: "通用办公", yearPrice: 1920, monthPrice: 160, quota: 10, bw: "下行 5M / 上行 2M", desc: "单独境外 IP 配置,通过 CPE 组织网络管理平台", custom: null, costs: [{ name: "国家 IP 地址月摊销", amount: 40, qty: 1 }] },
  203. { name: "直播高需求 · A 类", cat: "直播高需求", yearPrice: 10800, monthPrice: 900, quota: 2, bw: "上下行 10M", desc: "单链接、单流;单独境外 IP 另购,80 元/个", custom: null },
  204. { name: "直播高需求 · B 类", cat: "直播高需求", yearPrice: 32400, monthPrice: 2700, quota: 5, bw: "上下行 30M", desc: "单链接、多流;团队内部运营如后台管理、看播等已包含", custom: null },
  205. { name: "直播高需求 · C 类", cat: "直播高需求", yearPrice: 62400, monthPrice: 5200, quota: 10, bw: "上下行 50M", desc: "直播高需求顶配档;链接数与流数按合同另定", custom: null },
  206. { name: "AI 应用 · 5M 档", cat: "AI 应用", yearPrice: 5760, monthPrice: 480, quota: 3, bw: "上下行 5M", desc: "面向 AI 应用访问的固定上下行带宽档", custom: null, costs: [{ name: "国家 IP 地址月摊销", amount: 50, qty: 1 }] },
  207. { name: "AI 应用 · 10M 档", cat: "AI 应用", yearPrice: 10800, monthPrice: 900, quota: 5, bw: "上下行 10M", desc: "面向 AI 应用访问的固定上下行带宽档", custom: null },
  208. { name: "单独境外 IP(按个叠加)", cat: "叠加增值", yearPrice: 960, monthPrice: 80, quota: 0, bw: "按个计,不占带宽", desc: "80 元/个/月,与主档叠加订阅、各自计费;个数与单价在订阅上按合同改写", custom: null, costs: [{ name: "国际云主机月摊销", amount: 30, qty: 1 }] },
  209. { name: "临港 ICT 定制套餐", cat: "定制化", yearPrice: 24000, monthPrice: 2000, quota: 8, bw: "150Mbps", desc: "使用规模 30 人及以上,业务分析与需求摸排调研后定制;临港跨境贸易专项档", custom: 1, costs: [{ name: "国际出口带宽月摊销", amount: 80 }, { name: "国际云主机月摊销", amount: 30, qty: 2 }] }, /* 每份:该档配了 2 台境外云主机,按 30 × 2 = 60 摊 */
  210. ],
  211. /* 订阅一律按名称引用「套餐目录」中的档位,签约时把目录价冻结到订阅上(目录改价不影响存量订阅)。
  212. 示例覆盖全部用途分类:通用办公(基础 / 标准 / 独立 IP 档)、直播高需求(A 类)、AI 应用(5M 档)、
  213. 叠加增值(单独境外 IP ×2 个:80 元/个/月 × 2 × 12)、定制化(临港 ICT 自定义档)。 */
  214. subs: [
  215. { enterprise: 0, name: "跨境办公 · 基础档", kind: "升降配前", status: "已到期", start: "2025-03-18", end: "2026-03-17", yearPrice: 1080, monthPrice: 90, openedOn: "2025-03-20", contractNo: "HT-CL-20250318", files: ["oss://contracts/HT-CL-20250318.pdf"] },
  216. { enterprise: 0, name: "跨境办公 · 标准档", kind: "正式", status: "生效中", start: "2026-03-18", end: "2027-03-17", yearPrice: 1440, monthPrice: 120, openedOn: "2026-03-20", contractNo: "HT-CL-20260318", files: ["oss://contracts/HT-CL-20260318.pdf"] },
  217. { enterprise: 1, name: "临港 ICT 定制套餐", kind: "正式", status: "生效中", start: "2026-09-02", end: "2027-09-01", yearPrice: 24000, monthPrice: 2000, openedOn: null, contractNo: "ICT-LG-20260902", files: ["oss://contracts/ICT-LG-20260902.pdf"] },
  218. { enterprise: 2, name: "直播高需求 · A 类", kind: "正式", status: "生效中", start: "2026-09-01", end: "2026-10-31", yearPrice: 10800, monthPrice: 900, openedOn: "2026-09-01", contractNo: "HT-CFA-20260901", files: ["oss://contracts/HT-CFA-20260901.pdf"] },
  219. { enterprise: 3, name: "AI 应用 · 5M 档", kind: "正式", status: "生效中", start: "2026-06-01", end: "2027-05-31", yearPrice: 5760, monthPrice: 480, openedOn: "2026-06-01", contractNo: "HT-WM-20260601", files: ["oss://contracts/HT-WM-20260601.pdf"] },
  220. { enterprise: 3, name: "单独境外 IP(按个叠加)", kind: "叠加", status: "生效中", start: "2026-08-01", end: "2027-07-31", yearPrice: 1920, monthPrice: 160, openedOn: "2026-08-01", contractNo: "HT-WM-20260801", files: ["oss://contracts/HT-WM-20260801.pdf"] },
  221. { enterprise: 4, name: "跨境办公 · 独立 IP 档", kind: "正式", status: "已到期", start: "2025-10-01", end: "2026-09-30", yearPrice: 1920, monthPrice: 160, openedOn: "2025-10-01", contractNo: "HT-HL-20251001", files: ["oss://contracts/HT-HL-20251001.pdf"] },
  222. { enterprise: 4, name: "跨境办公 · 独立 IP 档", kind: "正式", status: "待生效", start: "2026-11-01", end: "2027-10-31", yearPrice: 1920, monthPrice: 160, openedOn: null, contractNo: "HT-HL-20261101", files: ["oss://contracts/HT-HL-20261101.pdf"] },
  223. /* 客户已在用时新增的叠加订阅:保存时自动生成「服务开通」工单(见 tickets 末条),实际开通日尚未回填 */
  224. { enterprise: 3, name: "单独境外 IP(按个叠加)", kind: "叠加", status: "生效中", start: "2026-10-08", end: "2027-10-07", yearPrice: 1920, monthPrice: 160, openedOn: null, contractNo: "HT-WM-20261008", files: ["oss://contracts/HT-WM-20261008.pdf"] },
  225. ],
  226. /* 下属分账号:login 为账号名,规则是「客户主账号登录名-n」,n 为该客户的分账号序号,从 1 起,
  227. 正式与临时测试共用一个序号池;netLogin 为零信任客户端上的账号名,选填、可改、不校验唯一。
  228. 正式数量由套餐额度决定,示例里未建满的部分由启动时的 alignSubAccounts 按额度自动补齐。 */
  229. accounts: [
  230. { enterprise: 0, name: "张敏", login: "clkj-1", status: "在用", usage: "正式", openedOn: "2026-03-20", netLogin: "zhangmin@clkj" },
  231. { enterprise: 0, name: "李航", login: "clkj-2", status: "在用", usage: "正式", openedOn: "2026-03-20", netLogin: "" },
  232. { enterprise: 0, name: "联调测试", login: "clkj-3", status: "在用", usage: "测试", openedOn: "2026-04-01", netLogin: "uat-liantiao@clkj" },
  233. { enterprise: 0, name: "待开通席位", login: "clkj-4", status: "未开通", usage: "正式", openedOn: null, netLogin: "" },
  234. { enterprise: 1, name: "临港-财务", login: "lgkjmy-1", status: "未开通", usage: "正式", openedOn: null, netLogin: "" },
  235. { enterprise: 1, name: "临港-关务", login: "lgkjmy-2", status: "未开通", usage: "正式", openedOn: null, netLogin: "customs-01@lingang" },
  236. { enterprise: 3, name: "王敏本人", login: "wm-1", status: "在用", usage: "正式", openedOn: "2026-06-01", netLogin: "wangmin@wm" },
  237. { enterprise: 4, name: "海岚-小王", login: "hlkjdssh-1", status: "在用", usage: "正式", openedOn: "2025-10-01", netLogin: "" },
  238. ],
  239. /* 开停记录与工单一一对应;状态:待执行 / 执行成功 / 执行失败 */
  240. actions: [
  241. { id: "A-20261007-08", enterprise: 1, type: "开户", status: "待执行", ticket: 0, created: "2026-10-07", doneOn: null, extendUntil: null, by: null },
  242. { id: "A-20261009-23", enterprise: 4, type: "到期停机", status: "待执行", ticket: 7, created: "2026-10-09", doneOn: null, extendUntil: null, by: null },
  243. ],
  244. tickets: [
  245. { type: "开户", enterprise: 1, account: null, team: 0, assignee: null, status: "待处理", created: "2026-10-07", text: "合同套餐已建立,网络侧尚未开通。本工单只开通客户本身,不含下属分账号;分账号在套餐订阅时按额度对齐开通。", logs: ["2026-10-07 生成待执行开户记录(A-20261007-08)", "2026-10-07 林管登记联通交接单的开通准备资料(办公应用 6 个账号;中国香港 10 兆固定 IP 2 个)"], closeReason: null, materials: ["oss://materials/KL-2026-0008/联通交接单.pdf"],
  246. prep: {
  247. apps: { 浏览应用: 0, 办公应用: 6, 运营应用: 0, 直播应用: 0, 定制应用: 0 },
  248. ips: [{ country: "中国香港", bw: "10兆", count: 2 }],
  249. agent: "临港联通 · 张工", agentPhone: "13601700208", handoverOn: "2026-10-06",
  250. } },
  251. { type: "故障", enterprise: 0, account: null, team: 0, assignee: 0, status: "处理中", created: "2026-10-12", text: "办公网晚高峰丢包,疑似国际出口拥塞。", logs: ["2026-10-12 客户主账号在系统内提交(文字)", "2026-10-12 吴队分派给周宁"], closeReason: null, materials: [] },
  252. { type: "故障", enterprise: 0, account: null, team: 1, assignee: null, status: "待处理", created: "2026-10-14", text: "机房侧线路需要现场复查(现场施工类)。", logs: ["2026-10-14 常规团队转施工团队,尚未分派"], closeReason: null, materials: [] },
  253. { type: "故障", enterprise: 0, account: null, team: 1, assignee: 2, status: "处理中", created: "2026-10-10", text: "园区弱电井跳纤,现场施工。", logs: ["2026-10-10 自动平均分派给赵工"], closeReason: null, materials: ["oss://tickets/T-1010/现场照片-1.jpg"] },
  254. { type: "故障", enterprise: 3, account: null, team: 1, assignee: 2, status: "待处理", created: "2026-10-13", text: "上门后用户不在,待再次上门。", logs: ["2026-10-13 分派给赵工"], closeReason: null, materials: [] },
  255. { type: "售后", enterprise: 0, account: null, team: 0, assignee: 1, status: "已完成", created: "2026-09-28", text: "补充开通说明并回传配置手册。", logs: ["2026-09-29 李可填写处理记录并完成"], closeReason: null, materials: [] },
  256. { type: "故障", enterprise: 0, account: 0, team: 0, assignee: 0, status: "处理中", created: "2026-10-14", text: "我的座位网络登不上。", logs: ["2026-10-14 下属分账号张敏在系统内提交", "2026-10-14 吴队分派给周宁"], closeReason: null, materials: [] },
  257. { type: "到期停机", enterprise: 4, account: null, team: 0, assignee: 0, status: "待处理", created: "2026-10-09", text: "订阅于 2026-09-30 到期,次日生成到期停机记录。停机不把计费延长过结束日。", logs: ["2026-10-09 日任务生成待执行到期停机记录(A-20261009-23)", "2026-10-09 吴队分派给周宁"], closeReason: null, materials: [] },
  258. { type: "故障", enterprise: 0, account: null, team: 0, assignee: 1, status: "已关闭", created: "2026-10-08", text: "重复报修:办公网丢包。", logs: ["2026-10-08 客户主账号在系统内提交", "2026-10-08 分派给李可", "2026-10-09 吴队关闭:与 10-12 晚高峰丢包工单重复,合并处理"], closeReason: "与同期晚高峰丢包工单重复,合并处理。", materials: [] },
  259. /* 客户已在用时新增订阅 → 服务开通工单:不带开停记录、不改客户账户状态,按套餐带出的服务清单逐条核对,
  260. 全部核对后填实际开通日完成,实际开通日写回 sub 指向的订阅。创建满 7 个自然日仍未完成即进超期提醒。 */
  261. { type: "服务开通", enterprise: 3, account: null, team: 0, assignee: 1, status: "处理中", created: "2026-10-07", sub: 8, extendUntil: null,
  262. text: "HT-WM-20261008 新增叠加订阅「单独境外 IP(按个叠加)」,客户已在用,请在网络侧开通下列 3 项服务。",
  263. logs: ["2026-10-07 林管 新增叠加订阅,自动生成服务开通工单", "2026-10-08 吴队分派给李可"], closeReason: null, materials: [],
  264. svcItems: [
  265. { text: "网络带宽:按个计,不占带宽", done: false },
  266. { text: "单独境外 IP(按个叠加):个数与单价以合同为准(本条订阅年价 1920 元),不补建分账号档案", done: false },
  267. { text: "套餐权益:80 元/个/月,与主档叠加订阅、各自计费;个数与单价在订阅上按合同改写", done: false },
  268. ] },
  269. ],
  270. /* 分成规则挂在渠道与客户的关系上,两种方式二选一:按总金额比例(rate,0-1)或按总客户账号数(per,每账号分成金额,精确到分)。
  271. mode 缺省为按总金额比例。两层都没有时分成计 0。合同增补优先于区域常规。 */
  272. rules: [
  273. { ch: "operator", ref: 0, ent: 0, layer: "区域常规", rate: 0.2 },
  274. { ch: "team", ref: 0, ent: 0, layer: "合同增补", mode: "按总客户账号数", per: 50 },
  275. { ch: "team", ref: 1, ent: 0, layer: "区域常规", rate: 0.05 },
  276. { ch: "partner", ref: 0, ent: 0, layer: "区域常规", rate: 0.05 },
  277. { ch: "operator", ref: 2, ent: 3, layer: "区域常规", rate: 0.15 },
  278. { ch: "team", ref: 0, ent: 3, layer: "区域常规", rate: 0.1 },
  279. { ch: "team", ref: 1, ent: 3, layer: "区域常规", rate: 0.05 },
  280. { ch: "partner", ref: 1, ent: 3, layer: "合同增补", rate: 0.08 },
  281. { ch: "operator", ref: 0, ent: 4, layer: "区域常规", rate: 0.2 },
  282. { ch: "team", ref: 0, ent: 4, layer: "区域常规", rate: 0.1 },
  283. { ch: "partner", ref: 0, ent: 4, layer: "区域常规", rate: 0.05 },
  284. ],
  285. /* 应扣除成本项是全局清单,不挂在客户或订阅名下:一条只描述这项成本本身,客户与订阅上不录入、不勾选。
  286. deduct 是是否从分成基数中扣除:勾选的按摊销额从基数中扣除;不勾选的本期只做登记,
  287. 设备采买与项目费用约定的固定金额直接记入分成结果属会议约定的口径,本期不实现。
  288. calc 是计算方式:每客户按客户整体计一次,每账号按该客户在期分账号数逐账号计,
  289. 每份按数量逐份摊销(amount 是单份的摊销额,份数取套餐档上这条随附成本项的 qty),用于成本随数量走的项目,
  290. 例如国家 IP 地址与国际云主机按每个 IP / 每台云主机摊一份。
  291. repeat 是周期:本期只有「每月」一个取值,逐月摊销计入;一次性取值待固定金额记入口径沟通确定后再加。
  292. 线路投入按约定比例分成、不扣基数,不登记为成本项;临时成本增补不建数据。
  293. 某客户本月计入哪几笔由其在用订阅引用的套餐档随附成本项决定(见 packages.costs),出账时冻结成该期的成本快照。 */
  294. costs: [
  295. { kind: "国际资源", name: "国家 IP 地址月摊销", amount: 50, repeat: "每月", calc: "每份", deduct: true },
  296. { kind: "国际资源", name: "国际云主机月摊销", amount: 30, repeat: "每月", calc: "每份", deduct: true },
  297. { kind: "国际资源", name: "国际出口带宽月摊销", amount: 80, repeat: "每月", calc: "每账号", deduct: true },
  298. { kind: "项目费用", name: "园区机房改造项目月摊销", amount: 1200, repeat: "每月", calc: "每客户", deduct: false },
  299. ],
  300. /* 客户应收结算记录:一条 = 一份生效订阅 × 一个自然月,是计费的原始依据。
  301. shares 每条带 ch / ref 标明该笔分成的分成方,对账明细与对账批次即按此围绕分成方展开;
  302. 「未配置,计 0」的占位行不带 ch / ref,不进对账。 */
  303. settlements: [
  304. {
  305. enterprise: 0, sub: 1, month: "2026-03", days: 12, monthDays: 31, partial: true, std: 120, amount: 46.45, tail: false, exact: 46.45,
  306. costs: [], base: 46.45,
  307. shares: [
  308. { ch: "operator", ref: 0, who: "联通", mode: "按总金额比例", rate: 0.2, amount: 9.29 },
  309. { ch: "team", ref: 0, who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 5, amount: 112.90 },
  310. { ch: "team", ref: 1, who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 2.32 },
  311. { ch: "partner", ref: 0, who: "邹合", mode: "按总金额比例", rate: 0.05, amount: 2.32 },
  312. ],
  313. attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工",
  314. },
  315. {
  316. enterprise: 0, sub: 1, month: "2026-04", days: 30, monthDays: 30, partial: false, std: 120, amount: 120, tail: false, exact: 120,
  317. costs: [], base: 120,
  318. shares: [
  319. { ch: "operator", ref: 0, who: "联通", mode: "按总金额比例", rate: 0.2, amount: 24 },
  320. { ch: "team", ref: 0, who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 5, amount: 250 },
  321. { ch: "team", ref: 1, who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 6 },
  322. { ch: "partner", ref: 0, who: "邹合", mode: "按总金额比例", rate: 0.05, amount: 6 },
  323. ],
  324. attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工",
  325. },
  326. {
  327. enterprise: 0, sub: 1, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 120, amount: 120, tail: false, exact: 120,
  328. costs: [], base: 120,
  329. shares: [
  330. { ch: "operator", ref: 0, who: "联通", mode: "按总金额比例", rate: 0.2, amount: 24 },
  331. { ch: "team", ref: 0, who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 5, amount: 250 },
  332. { ch: "team", ref: 1, who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 6 },
  333. { ch: "partner", ref: 0, who: "邹合", mode: "按总金额比例", rate: 0.05, amount: 6 },
  334. ],
  335. attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工",
  336. },
  337. {
  338. enterprise: 3, sub: 4, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 480, amount: 480, tail: false, exact: 480,
  339. costs: [{ name: "国家 IP 地址月摊销", amount: 50 }], base: 430,
  340. shares: [
  341. { ch: "operator", ref: 2, who: "移动", mode: "按总金额比例", rate: 0.15, amount: 64.5 },
  342. { ch: "team", ref: 0, who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 43 },
  343. { ch: "team", ref: 1, who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 21.5 },
  344. { ch: "partner", ref: 1, who: "何南", mode: "合同增补 · 比例", rate: 0.08, amount: 34.4 },
  345. ],
  346. attrs: "移动 / 何南(华南) / 华东常规运维 / 沪东施工",
  347. },
  348. {
  349. enterprise: 3, sub: 5, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 160, amount: 160, tail: false, exact: 160,
  350. costs: [{ name: "国际云主机月摊销", amount: 30 }], base: 130,
  351. shares: [
  352. { ch: "operator", ref: 2, who: "移动", mode: "按总金额比例", rate: 0.15, amount: 19.5 },
  353. { ch: "team", ref: 0, who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 13 },
  354. { ch: "team", ref: 1, who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 6.5 },
  355. { ch: "partner", ref: 1, who: "何南", mode: "合同增补 · 比例", rate: 0.08, amount: 10.4 },
  356. ],
  357. attrs: "移动 / 何南(华南) / 华东常规运维 / 沪东施工(叠加订阅各算各的;叠加增值不占分账号额度)",
  358. },
  359. {
  360. enterprise: 4, sub: 6, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 160, amount: 160, tail: true, exact: 160,
  361. costs: [{ name: "国家 IP 地址月摊销", amount: 40 }], base: 120,
  362. shares: [
  363. { ch: "operator", ref: 0, who: "联通", mode: "按总金额比例", rate: 0.2, amount: 24 },
  364. { ch: "team", ref: 0, who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 12 },
  365. { who: "沪东施工(未配置,计 0)", mode: "—", rate: 0, amount: 0 },
  366. { ch: "partner", ref: 0, who: "邹合", mode: "按总金额比例", rate: 0.05, amount: 6 },
  367. ],
  368. attrs: "联通 / 邹合(华东) / 华东常规运维 / 无施工团队",
  369. },
  370. ],
  371. /* 对账批次:一条 = 一个分成方 × 一个已结束自然月。对账是与分成方(运营商 / 合伙人 / 运维团队)进行的,
  372. 不是与客户,故批次只挂 ch / ref(分成方类型与档案下标),客户与该分成方的对应关系逐条落在 rows 指向的
  373. 应收结算记录里。同一个结算记录会同时进入多个分成方的批次(各算各的)。
  374. 运营商按档案上的对账日出批次(无覆盖时按系统默认对账日),合伙人与运维团队按系统默认对账日出批次。 */
  375. batches: [
  376. { no: "DZ-20261005-LT", day: "2026-10-05", month: "2026-09", ch: "operator", ref: 0, trigger: "自动", status: "已执行", by: "系统", at: "2026-10-05 06:00", rows: [2, 5], warning: "" },
  377. { no: "DZ-20261008-YD", day: "2026-10-08", month: "2026-09", ch: "operator", ref: 2, trigger: "自动", status: "已执行", by: "系统", at: "2026-10-08 06:00", rows: [3, 4], warning: "" },
  378. { no: "DZ-20261005-ZH", day: "2026-10-05", month: "2026-09", ch: "partner", ref: 0, trigger: "自动", status: "已执行", by: "系统", at: "2026-10-05 06:00", rows: [2, 5], warning: "" },
  379. { no: "DZ-20261005-YW0", day: "2026-10-05", month: "2026-09", ch: "team", ref: 0, trigger: "自动", status: "已执行", by: "系统", at: "2026-10-05 06:00", rows: [2, 3, 4, 5], warning: "" },
  380. { no: "DZ-20261005-SG1", day: "2026-10-05", month: "2026-09", ch: "team", ref: 1, trigger: "自动", status: "已执行", by: "系统", at: "2026-10-05 06:00", rows: [2, 3, 4], warning: "海岚跨境未挂施工团队,该分成方本月不计分成" },
  381. { no: "DZ-20260905-DX", day: "2026-09-05", month: "2026-08", ch: "operator", ref: 1, trigger: "自动", status: "已打回", by: "系统", at: "2026-09-05 06:00", rows: [], warning: "分成比例误录,运营商尚未付款" },
  382. { no: "DZ-20260912-DX-R", day: "2026-09-12", month: "2026-08", ch: "operator", ref: 1, trigger: "人工", status: "已执行", by: "林管", at: "2026-09-12 10:20", rows: [], warning: "打回后重做,新明细成为 8 月唯一有效分成" },
  383. { no: "DZ-20260605-LT", day: "2026-06-05", month: "2026-05", ch: "operator", ref: 0, trigger: "自动", status: "执行失败", by: "系统", at: "2026-06-05 06:00", rows: [], warning: "对账任务异常中断,等待人工补跑" },
  384. { no: "DZ-20260905-HN", day: "2026-09-05", month: "2026-08", ch: "partner", ref: 1, trigger: "自动", status: "已执行", by: "系统", at: "2026-09-05 06:00", rows: [], warning: "何南(华南渠道)8 月尚无生效分成规则,本批 0 条明细" },
  385. ],
  386. /* 客户批量导入批次(见需求规格说明 4.8):一次上传一个文件生成一个批次,批次号贯穿行级结果、续传与按批次导出。
  387. rows 每行记 line 行编号、cells 模板 14 列原文、status 成功 / 失败、reason 失败原因、
  388. ent 导入生成的客户下标(未成功为 null)。行级明细持久保留,是续传与按批次导出的依据;批次不删除、不撤销。 */
  389. importBatches: [
  390. {
  391. no: "IMP-2026-0001", file: "闵行区客户建档-20261008.csv", by: "林管", at: "2026-10-08 10:05",
  392. status: "已完成",
  393. rows: [
  394. { line: "1", cells: ["1", "海岚跨境电商(上海)", "企业", "周岚", "021-54002023", "上海市闵行区申长路 988 号 3 号楼 5 层", "闵行区", "联通", "邹合", "华东常规运维", "", "跨境办公 · 独立 IP 档", "hlkjdssh", ""], status: "成功", reason: "", ent: 4 },
  395. ],
  396. },
  397. {
  398. no: "IMP-2026-0002", file: "临港与张江客户-20261012.csv", by: "周运营", at: "2026-10-12 09:40",
  399. status: "有失败待续传",
  400. rows: [
  401. { line: "1", cells: ["1", "临港跨境贸易", "企业", "陆港", "021-66002008", "上海市浦东新区环湖西二路 800 号 A 座 11 层", "临港新片区", "电信", "", "华东常规运维", "", "", "lgkjmy", ""], status: "成功", reason: "", ent: 1 },
  402. { line: "2", cells: ["2", "澄澜科技有限公司", "企业", "沈澄", "021-66001001", "上海市浦东新区金港路 300 号 6 号楼 3 层", "浦东新区", "联通", "邹合", "华东常规运维", "", "跨境办公 · 标准档", "", ""], status: "失败", reason: "客户名称与已有客户「澄澜科技有限公司」(KL-2026-0001)重复,不覆盖已有客户", ent: null },
  403. { line: "3", cells: ["3", "张江芯创半导体", "企业", "何工", "021-50003301", "上海市浦东新区祖冲之路 887 号 2 号楼", "张江区", "联通", "", "华东常规运维", "", "", "", "13900000331"], status: "失败", reason: "所挂区域「张江区」匹配不到,填区域名称原文且需在负责范围内", ent: null },
  404. { line: "4", cells: ["4", "陆家嘴外贸服务中心", "个体工商户", "王经理", "021-58002277", "上海市浦东新区世纪大道 100 号 18 层", "浦东新区", "联通", "", "华东常规运维", "", "", "clkj", ""], status: "失败", reason: "主账号登录名 clkj 已被占用,系统不自动加后缀,请改写后重新上传", ent: null },
  405. ],
  406. },
  407. ],
  408. notes: [
  409. { level: "严重", bill: "澄澜科技 2026-03", text: "3 月比例曾按 0.18 录入,核验后从 4 月起改为 0.20。3 月账单已递交运营商,原明细保留不改。", by: "林管", at: "2026-04-06 09:30" },
  410. { level: "严重", bill: "电信 2026-08 对账批次(DZ-20260905-DX)", text: "批次分成比例误录,运营商尚未付款,批次打回重做;重做批次 DZ-20260912-DX-R 核验通过。", by: "林管", at: "2026-09-12 10:15" },
  411. ],
  412. feedback: [
  413. { no: "KL-UNKNOWN-3", action: "开户", date: "2026-10-11", state: "nomatch", result: "主体号匹配不到任何待执行记录,待人工处理。不自动创建客户,不改账户状态。", handled: false },
  414. { no: "KL-2026-0008", action: "开户", date: "2026-10-14", state: "pending", result: "匹配到待执行记录 A-20261007-08,反馈实际开通日 2026-10-14,可据此回填(与人工回填等效)。", handled: false, actionId: "A-20261007-08", fillDate: "2026-10-14" },
  415. { no: "KL-2026-0019", action: "开户", date: "2026-10-13", state: "conflict", result: "该客户开户记录已于 2026-06-01 回填成功,反馈与现状冲突,不覆盖,待人工确认。", handled: false },
  416. ],
  417. collections: [
  418. { partner: 0, enterprise: 0, amount: 8000, date: "2026-04-18", note: "运营商已收,仅作区域核对,不回写应收" },
  419. ],
  420. /* 审计日志只追加。区域树维护仅总运营可见。 */
  421. auditLogs: [
  422. { at: "2026-08-01 09:12", by: "林管", type: "新建区域", object: "华东大区 / 上海市 / 浦东新区", before: "", after: "新建三级节点" },
  423. { at: "2026-08-01 09:20", by: "林管", type: "新建区域", object: "华东大区 / 上海市 / 临港新片区", before: "", after: "新建区县节点" },
  424. { at: "2026-08-02 14:02", by: "林管", type: "新建区域", object: "华东大区 / 苏州市 / 昆山市", before: "", after: "新建区县节点" },
  425. { at: "2026-08-05 10:40", by: "林管", type: "重命名区域", object: "华东大区 / 上海市 / 临港新片区", before: "南汇新城区", after: "临港新片区" },
  426. { at: "2026-08-10 10:20", by: "林管", type: "客户挂载", object: "澄澜科技有限公司", before: "未挂载", after: "华东大区 / 上海市 / 浦东新区" },
  427. { at: "2026-08-20 11:30", by: "林管", type: "客户改挂区域", object: "王敏", before: "华东大区 / 苏州市 / 昆山市", after: "华东大区 / 上海市 / 浦东新区" },
  428. { at: "2026-08-21 16:00", by: "林管", type: "合伙人负责范围首次配置", object: "邹合(华东渠道)", before: "(空)", after: "澄澜科技、临港跨境、陈阿福、王敏、海岚跨境(选定华东大区,含其下级全部客户)" },
  429. { at: "2026-09-02 09:10", by: "林管", type: "运维团队负责范围调整", object: "沪东施工", before: "澄澜科技、王敏", after: "澄澜科技、临港跨境、王敏(新增直接多选客户:临港跨境)" },
  430. { at: "2026-10-05 15:20", by: "林管", type: "合伙人负责范围调整", object: "何南(华南渠道)", before: "(空)", after: "天河区(暂无直属客户);直接多选客户:陈阿福" },
  431. { at: "2026-10-05 15:25", by: "林管", type: "分成规则新建", object: "何南(华南渠道)× 王敏", before: "(无规则,分成计 0)", after: "合同增补 · 按总金额比例 0.08" },
  432. { at: "2026-10-05 06:00", by: "系统", type: "对账批次自动执行", object: "DZ-20261005-LT · 联通 · 2026-09", before: "待执行", after: "已执行(2 条明细)" },
  433. ],
  434. /* 登录账号:login 为登录名,acctStatus 在用 / 停用(停用的不出现在「换身份」列表),
  435. mustChange 为下次登录是否必须改密,pwdResetOn 为最近一次重置密码日期。
  436. role=operator 是运营商的对账查看账号(只读),与运营商档案一比一。
  437. builtin: true 为系统内置账号:总运营账号即总运营团队的默认主账号,必须存在、不能删除,主账号身份也不可转交。
  438. phone 为绑定手机号:选填,可更换,但全站唯一(一个手机号至多绑定一个账号),
  439. 绑定后可用手机号代替登录名登录;未填时只能用登录名登录。
  440. 客户主账号不用初始密码,改用一次性激活码激活(acctOpenOn 开通日、claimOn 当前码生成日、
  441. claimExpireOn 有效期截止日:导出交付时才写,未交付为空、不判过期、claimStatus 未激活 / 已激活 /
  442. 已过期;已激活时 claimCode 置空)。 */
  443. users: [
  444. { name: "林管", role: "admin", regTeam: 0, primary: true, builtin: true, title: "总运营团队主账号", phone: "13900000001", acctStatus: "在用", mustChange: false },
  445. { name: "周运营", role: "regAdmin", regTeam: 1, primary: true, title: "华东运营 · 团队主账号", login: "zhouyun@example", phone: "13900000101", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-20" },
  446. { name: "许芸", role: "regAdmin", regTeam: 1, title: "华东运营 · 子账号(客户建档)", login: "xuyun@example", acctStatus: "在用", mustChange: true, pwdResetOn: "2026-10-09" },
  447. { name: "吴队", role: "teamLead", team: 0, title: "华东常规运维 · 团队主账号", login: "wudui@example", phone: "13900000103", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-06" },
  448. { name: "周宁", role: "ops", member: 0, title: "常规运维 · 开停回填", login: "zhouning@example", phone: "13900000104", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-18" },
  449. { name: "孙队", role: "teamLead", team: 1, title: "沪东施工 · 团队主账号", login: "sundui@example", phone: "13900000105", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-02" },
  450. { name: "赵工", role: "worker", member: 2, title: "施工人员", login: "zhaogong@example", phone: "13900000106", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-21" },
  451. { name: "陈录", role: "entry", member: 4, title: "录入人员 · 电信/移动 ICT 代录", login: "chenlu@example", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-25" },
  452. /* 客户主账号登录名取客户名称的拼音首字母(见《需求规格说明》3.2),不照抄中文客户名称。
  453. 激活状态只有三种,样例:未激活且已交付还在有效期内(临港)、已激活(澄澜)、
  454. 截止日已过按当天即时判为已过期(陈阿福、海岚,导出时会自动重置出新码)、
  455. 刚建档还没导出交付(王敏,没有截止日、不判过期) */
  456. { name: "澄澜科技有限公司", role: "enterprise", enterprise: 0, title: "客户主账号", login: "clkj", phone: "13900000200", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-11", acctOpenOn: "2026-09-11", claimStatus: "已激活", claimCode: "", claimOn: "2026-09-11", claimExpireOn: "2026-09-25" },
  457. { name: "临港跨境贸易", role: "enterprise", enterprise: 1, title: "客户主账号", login: "lgkjmy", acctStatus: "在用", mustChange: false, acctOpenOn: "2026-10-12", claimStatus: "未激活", claimCode: "KQF7HRM2XW", claimOn: "2026-10-12", claimExpireOn: "2026-10-26" },
  458. { name: "陈阿福", role: "enterprise", enterprise: 2, title: "客户主账号", login: "caf", phone: "13900000212", acctStatus: "在用", mustChange: false, acctOpenOn: "2026-09-20", claimStatus: "未激活", claimCode: "TBW4KJN6QD", claimOn: "2026-09-20", claimExpireOn: "2026-10-04" },
  459. { name: "王敏", role: "enterprise", enterprise: 3, title: "客户主账号", login: "wm", acctStatus: "在用", mustChange: false, acctOpenOn: "2026-10-15", claimStatus: "未激活", claimCode: "PMXZ3RTV8H", claimOn: "2026-10-15", claimExpireOn: "" },
  460. { name: "海岚跨境电商(上海)", role: "enterprise", enterprise: 4, title: "客户主账号", login: "hlkjdssh", acctStatus: "在用", mustChange: false, acctOpenOn: "2026-10-08", claimStatus: "未激活", claimCode: "GHY2NQSC5F", claimOn: "2026-10-08", claimExpireOn: "2026-10-13" },
  461. { name: "张敏", role: "sub", enterprise: 0, account: 0, title: "下属分账号" },
  462. { name: "邹合", role: "partner", partner: 0, title: "华东渠道", login: "zouhe@example", phone: "13900000107", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-12" },
  463. { name: "何南", role: "partner", partner: 1, title: "华南渠道", login: "henan@example", phone: "13900000108", acctStatus: "停用", mustChange: false, pwdResetOn: "2026-08-05" },
  464. { name: "联通对账", role: "operator", operator: 0, title: "联通 · 对账查看账号", login: "unicom-dz@example", phone: "13900000109", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-26" },
  465. ],
  466. };
  467. function cloneSeed() {
  468. return JSON.parse(JSON.stringify(SEED));
  469. }
  470. function money(n) {
  471. return Number(n || 0).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
  472. }
  473. function pct(n) {
  474. const v = Math.round(Number(n || 0) * 10000) / 100;
  475. return String(v) + "%";
  476. }
  477. function daysBetween(start, end) {
  478. const a = new Date(start + "T00:00:00");
  479. const b = new Date(end + "T00:00:00");
  480. return Math.round((b - a) / 86400000) + 1;
  481. }
  482. function addDays(date, n) {
  483. const d = new Date(date + "T00:00:00");
  484. d.setDate(d.getDate() + n);
  485. const pad = (x) => String(x).padStart(2, "0");
  486. return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
  487. }
  488. function overdueAction(action) {
  489. if (!action || action.status !== "待执行") return false;
  490. const limit = action.extendUntil || addDays(action.created, 7);
  491. return TODAY > limit;
  492. }
  493. function unfinished(db, memberIndex) {
  494. return db.tickets.filter((t) => t.assignee === memberIndex && (t.status === "待处理" || t.status === "处理中")).length;
  495. }
  496. function ticketTypeOfTeam(team) {
  497. return team.type === "施工" ? "施工" : "常规";
  498. }
  499. function eligible(db, ticket) {
  500. const team = db.teams[ticket.team];
  501. const need = ticketTypeOfTeam(team);
  502. return db.members
  503. .map((m, index) => ({ ...m, index }))
  504. .filter((m) => m.team === ticket.team && m.type === need && m.scope.includes(ticket.enterprise));
  505. }
  506. function pickEven(db, ticket) {
  507. const list = eligible(db, ticket);
  508. if (!list.length) return null;
  509. list.sort((a, b) => unfinished(db, a.index) - unfinished(db, b.index) || a.index - b.index);
  510. return list[0].index;
  511. }
  512. /* ---- 区域与范围工具 ---- */
  513. function regionNode(db, id) {
  514. return db.regions.find((r) => r.id === id) || null;
  515. }
  516. function regionPath(db, id) {
  517. const names = [];
  518. let cur = regionNode(db, id);
  519. while (cur) {
  520. names.unshift(cur.name);
  521. cur = cur.parent ? regionNode(db, cur.parent) : null;
  522. }
  523. return names.join(" / ");
  524. }
  525. function descendantIds(db, id) {
  526. const out = [id];
  527. let added = true;
  528. while (added) {
  529. added = false;
  530. db.regions.forEach((r) => {
  531. if (r.parent && out.includes(r.parent) && !out.includes(r.id)) {
  532. out.push(r.id);
  533. added = true;
  534. }
  535. });
  536. }
  537. return out;
  538. }
  539. function enterprisesUnderRegion(db, id) {
  540. const ids = new Set(descendantIds(db, id));
  541. return db.enterprises.map((e, i) => i).filter((i) => ids.has(db.enterprises[i].region));
  542. }
  543. function scopeEnterpriseSet(db, scope) {
  544. const set = new Set();
  545. (scope.regions || []).forEach((rid) => enterprisesUnderRegion(db, rid).forEach((i) => set.add(i)));
  546. (scope.enterprises || []).forEach((i) => set.add(i));
  547. return set;
  548. }
  549. function scopeEnterprises(db, scope) {
  550. return Array.from(scopeEnterpriseSet(db, scope)).sort((a, b) => a - b);
  551. }
  552. function scopeSummary(db, scope) {
  553. const parts = [];
  554. (scope.regions || []).forEach((rid) => {
  555. const n = regionNode(db, rid);
  556. if (n) parts.push(`${n.name}(含下级 ${enterprisesUnderRegion(db, rid).length} 家客户)`);
  557. });
  558. const fromRegion = new Set();
  559. (scope.regions || []).forEach((rid) => enterprisesUnderRegion(db, rid).forEach((i) => fromRegion.add(i)));
  560. const extra = (scope.enterprises || []).filter((i) => !fromRegion.has(i));
  561. if (extra.length) parts.push(`直接多选:${extra.map((i) => db.enterprises[i].name).join("、")}`);
  562. return parts.length ? parts.join(";") : "(空)";
  563. }
  564. function regionReferenced(db, id) {
  565. const refs = [];
  566. db.teams.forEach((t, i) => { if ((t.scope.regions || []).includes(id)) refs.push(`运维团队「${t.name}」负责范围`); });
  567. db.partners.forEach((p, i) => {
  568. if (p.region === id) refs.push(`合伙人「${p.name}」所属区域`);
  569. if ((p.scope.regions || []).includes(id)) refs.push(`合伙人「${p.name}」负责范围`);
  570. });
  571. db.operators.forEach((o) => { if (o.region === id) refs.push(`运营商「${o.name}」所属区域`); });
  572. db.regOpsTeams.forEach((t) => { if (t.region === id) refs.push(`运营团队「${t.name}」所属区域`); });
  573. return refs;
  574. }