| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482 |
- /* 模拟数据只存在于页面内存。内部下标从 0 开始,页面上的序号从 1 开始。 */
- const TODAY = "2026-10-15";
- /* 区域三级:大区 / 市 / 区县。客户可挂在任一层,只能挂一个节点。 */
- const LEVEL_NAMES = ["大区", "市", "区县"];
- const SEED = {
- setting: { defaultReconcileDay: 5, perAccountFee: 80 },
- regions: [
- { id: "east", name: "华东大区", level: 0, parent: null },
- { id: "south", name: "华南大区", level: 0, parent: null },
- { id: "sh", name: "上海市", level: 1, parent: "east" },
- { id: "su", name: "苏州市", level: 1, parent: "east" },
- { id: "gz", name: "广州市", level: 1, parent: "south" },
- { id: "pd", name: "浦东新区", level: 2, parent: "sh" },
- { id: "lg", name: "临港新片区", level: 2, parent: "sh" },
- { id: "mh", name: "闵行区", level: 2, parent: "sh" },
- { id: "ks", name: "昆山市", level: 2, parent: "su" },
- { id: "th", name: "天河区", level: 2, parent: "gz" },
- ],
- /* 运营商按所属区域建档(region 为区域节点 id,含下级生效);客户只归属唯一运营商。 */
- operators: [
- { name: "联通", region: "sh", reconcileDay: null, payCycle: "按月", notify: "notice@unicorn.example" },
- { name: "电信", region: "east", reconcileDay: null, payCycle: "按年", notify: "notice@ict-telecom.example" },
- { name: "移动", region: "east", reconcileDay: 8, payCycle: "按月", notify: "notice@mobile.example" },
- { name: "广东电信", region: "south", reconcileDay: null, payCycle: "按季度", notify: "notice@gd-ict.example" },
- { name: "苏州移动", region: "su", reconcileDay: 12, payCycle: "按季度", notify: "notice@sz-mobile.example" },
- { name: "广州移动", region: "gz", reconcileDay: null, payCycle: "按月", notify: "notice@gz-mobile.example" },
- ],
- partners: [
- { name: "邹合", region: "east", title: "华东渠道", notify: "zouhe@example", scope: { regions: ["east"], enterprises: [] } },
- { name: "何南", region: "gz", title: "华南渠道", notify: "henan@example", scope: { regions: ["th"], enterprises: [2] } },
- ],
- teams: [
- { name: "华东常规运维", type: "常规", mode: "手工", scope: { regions: ["sh", "su"], enterprises: [] } },
- { name: "沪东施工", type: "施工", mode: "自动平均", scope: { regions: ["pd"], enterprises: [1] } },
- ],
- /* hq: true 为系统内置的总运营团队:不限所属区域(region 为空),负责范围覆盖全国,列表置顶且不可删除。
- 该团队的默认主账号即总运营账号(见 users 中 builtin: true 的一条),不再另设运营团队账号。 */
- regOpsTeams: [
- { name: "总运营团队", region: "", hq: true, scope: { regions: ["east", "south"], enterprises: [] }, desc: "总部平台级团队,不限所属区域,覆盖全国全部客户" },
- { name: "华东运营", region: "east", scope: { regions: ["east"], enterprises: [] }, desc: "覆盖华东大区全部下挂客户" },
- { name: "华南运营", region: "south", scope: { regions: ["south"], enterprises: [] }, desc: "覆盖华南大区全部下挂客户" },
- { name: "上海运营", region: "sh", scope: { regions: ["sh"], enterprises: [] }, desc: "覆盖上海市及其下级区域" },
- ],
- members: [
- { name: "周宁", team: 0, type: "常规", scope: [0, 1, 2, 4] },
- { name: "李可", team: 0, type: "常规", scope: [0, 3, 4] },
- { name: "赵工", team: 1, type: "施工", scope: [0, 1, 3] },
- { name: "钱工", team: 1, type: "施工", scope: [0, 1, 3] },
- { name: "陈录", team: 0, type: "录入", scope: [0, 1, 2, 3, 4] },
- ],
- awards: [
- { member: 2, at: "2026-09-20", kind: "奖励", text: "浦东园区割接提前 1 天完成,客户零投诉", amount: 200 },
- { member: 2, at: "2026-10-11", kind: "扣罚", text: "临港上门未按约定时间到达,扣罚只作考核,费用在线下处理", amount: -100 },
- ],
- enterprises: [
- {
- no: "KL-2026-0001",
- name: "澄澜科技有限公司",
- subject: "企业",
- materials: "营业执照、客户名称、合同、电话",
- files: ["oss://materials/KL-2026-0001/营业执照.pdf", "oss://materials/KL-2026-0001/受理单.pdf"],
- phone: "021-66001001",
- region: "pd",
- operator: 0,
- partner: 0,
- teams: { 常规: 0, 施工: 1 },
- status: "在用",
- quota: 5,
- costSel: [],
- history: [
- { at: "2026-08-10 10:20", field: "挂载区域", before: "未挂载", after: "华东大区 / 上海市 / 浦东新区", by: "林管" },
- { at: "2026-03-20 16:40", field: "账户状态", before: "未开通", after: "在用(实际开通日 2026-03-20)", by: "周宁回填" },
- ],
- },
- {
- no: "KL-2026-0008",
- name: "临港跨境贸易",
- subject: "企业",
- materials: "营业执照、客户名称、合同、电话",
- files: ["oss://materials/KL-2026-0008/营业执照.pdf", "oss://materials/KL-2026-0008/ICT合同.pdf"],
- phone: "021-66002008",
- region: "lg",
- operator: 1,
- partner: null,
- teams: { 常规: 0 },
- status: "未开通",
- quota: 8,
- costSel: [],
- history: [
- { at: "2026-09-02 09:05", field: "挂载区域", before: "未挂载", after: "华东大区 / 上海市 / 临港新片区", by: "林管" },
- ],
- },
- {
- no: "KL-2026-0012",
- name: "陈阿福",
- subject: "个体工商户",
- materials: "身份证、手机号",
- files: ["oss://materials/KL-2026-0012/身份证.jpg"],
- phone: "13800001112",
- region: "ks",
- operator: 2,
- partner: 1,
- teams: { 常规: 0 },
- status: "在用",
- quota: 1,
- costSel: [],
- history: [
- { at: "2026-08-28 14:10", field: "挂载区域", before: "未挂载", after: "华东大区 / 苏州市 / 昆山市", by: "林管" },
- ],
- },
- {
- no: "KL-2026-0019",
- name: "王敏",
- subject: "个人",
- materials: "身份证、手机号",
- files: ["oss://materials/KL-2026-0019/身份证.jpg"],
- phone: "13900001019",
- region: "pd",
- operator: 2,
- partner: 1,
- teams: { 常规: 0, 施工: 1 },
- status: "在用",
- quota: 2,
- costSel: [1, 2],
- history: [
- { at: "2026-08-20 11:30", field: "挂载区域", before: "华东大区 / 苏州市 / 昆山市", after: "华东大区 / 上海市 / 浦东新区", by: "林管" },
- { at: "2026-08-20 11:32", field: "合伙人", before: "无", after: "何南(华南渠道,直接多选客户)", by: "林管" },
- ],
- },
- {
- no: "KL-2026-0023",
- name: "海岚跨境电商(上海)",
- subject: "企业",
- materials: "营业执照、客户名称、合同、电话",
- files: ["oss://materials/KL-2026-0023/营业执照.pdf", "oss://materials/KL-2026-0023/续约合同.pdf"],
- phone: "021-54002023",
- region: "mh",
- operator: 0,
- partner: 0,
- teams: { 常规: 0 },
- status: "在用",
- quota: 2,
- costSel: [3],
- history: [
- { at: "2026-09-12 15:00", field: "挂载区域", before: "未挂载", after: "华东大区 / 上海市 / 闵行区", by: "林管" },
- { at: "2025-10-01 10:00", field: "账户状态", before: "未开通", after: "在用(实际开通日 2025-10-01)", by: "周宁回填" },
- ],
- },
- ],
- packages: [
- { name: "跨境带宽基础版", yearPrice: 9600, monthPrice: 800, quota: 3, bw: "50Mbps", custom: null },
- { name: "跨境带宽标准版", yearPrice: 12000, monthPrice: 1000, quota: 5, bw: "100Mbps", custom: null },
- { name: "跨境带宽尊享版", yearPrice: 24000, monthPrice: 2000, quota: 10, bw: "200Mbps", custom: null },
- { name: "国际资源叠加包", yearPrice: 3600, monthPrice: 300, quota: 0, bw: "30Mbps", custom: null },
- { name: "临港 ICT 定制套餐", yearPrice: 24000, monthPrice: 2000, quota: 8, bw: "150Mbps", custom: 1 },
- ],
- subs: [
- { enterprise: 0, name: "跨境带宽基础版", kind: "升级前", status: "已到期", start: "2025-03-18", end: "2026-03-17", yearPrice: 9600, monthPrice: 800, openedOn: "2025-03-20", contractNo: "HT-CL-20250318", files: ["oss://contracts/HT-CL-20250318.pdf"] },
- { enterprise: 0, name: "跨境带宽标准版", kind: "正式", status: "生效中", start: "2026-03-18", end: "2027-03-17", yearPrice: 12000, monthPrice: 1000, openedOn: "2026-03-20", contractNo: "HT-CL-20260318", files: ["oss://contracts/HT-CL-20260318.pdf"] },
- { 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"] },
- { enterprise: 2, name: "跨境带宽基础版", kind: "正式", status: "生效中", start: "2026-09-01", end: "2026-10-31", yearPrice: 9600, monthPrice: 800, openedOn: "2026-09-01", contractNo: "HT-CFA-20260901", files: ["oss://contracts/HT-CFA-20260901.pdf"] },
- { enterprise: 3, name: "跨境带宽标准版", kind: "正式", status: "生效中", start: "2026-06-01", end: "2027-05-31", yearPrice: 12000, monthPrice: 1000, openedOn: "2026-06-01", contractNo: "HT-WM-20260601", files: ["oss://contracts/HT-WM-20260601.pdf"] },
- { enterprise: 3, name: "国际资源叠加包", kind: "叠加", status: "生效中", start: "2026-08-01", end: "2027-07-31", yearPrice: 3600, monthPrice: 300, openedOn: "2026-08-01", contractNo: "HT-WM-20260801", files: ["oss://contracts/HT-WM-20260801.pdf"] },
- { enterprise: 4, name: "跨境带宽标准版", kind: "正式", status: "已到期", start: "2025-10-01", end: "2026-09-30", yearPrice: 12000, monthPrice: 1000, openedOn: "2025-10-01", contractNo: "HT-HL-20251001", files: ["oss://contracts/HT-HL-20251001.pdf"] },
- { enterprise: 4, name: "跨境带宽标准版(续订)", kind: "正式", status: "待生效", start: "2026-11-01", end: "2027-10-31", yearPrice: 12000, monthPrice: 1000, openedOn: null, contractNo: "HT-HL-20261101", files: ["oss://contracts/HT-HL-20261101.pdf"] },
- ],
- accounts: [
- { enterprise: 0, name: "张敏", status: "在用", usage: "正式", openedOn: "2026-03-20" },
- { enterprise: 0, name: "李航", status: "在用", usage: "正式", openedOn: "2026-03-20" },
- { enterprise: 0, name: "联调测试", status: "在用", usage: "测试", openedOn: "2026-04-01" },
- { enterprise: 0, name: "待开通席位", status: "未开通", usage: "正式", openedOn: null },
- { enterprise: 1, name: "临港-财务", status: "未开通", usage: "正式", openedOn: null },
- { enterprise: 1, name: "临港-关务", status: "未开通", usage: "正式", openedOn: null },
- { enterprise: 3, name: "王敏本人", status: "在用", usage: "正式", openedOn: "2026-06-01" },
- { enterprise: 4, name: "海岚-小王", status: "在用", usage: "正式", openedOn: "2025-10-01" },
- ],
- /* 开停记录与工单一一对应;状态:待执行 / 执行成功 / 执行失败 */
- actions: [
- { id: "A-20261007-08", enterprise: 1, type: "开户", status: "待执行", ticket: 0, created: "2026-10-07", doneOn: null, extendUntil: null, by: null },
- { id: "A-20261009-23", enterprise: 4, type: "到期停机", status: "待执行", ticket: 7, created: "2026-10-09", doneOn: null, extendUntil: null, by: null },
- ],
- tickets: [
- { type: "开户", enterprise: 1, account: null, team: 0, assignee: null, status: "待处理", created: "2026-10-07", text: "合同套餐已建立,网络侧尚未开通。本工单只开通客户本身,不含下属分账号;分账号在套餐订阅时按额度对齐开通。", logs: ["2026-10-07 生成待执行开户记录(A-20261007-08)"], closeReason: null, materials: [] },
- { 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: [] },
- { type: "故障", enterprise: 0, account: null, team: 1, assignee: null, status: "待处理", created: "2026-10-14", text: "机房侧线路需要现场复查(现场施工类)。", logs: ["2026-10-14 常规团队转施工团队,尚未分派"], closeReason: null, materials: [] },
- { 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"] },
- { type: "故障", enterprise: 3, account: null, team: 1, assignee: 2, status: "待处理", created: "2026-10-13", text: "上门后用户不在,待再次上门。", logs: ["2026-10-13 分派给赵工"], closeReason: null, materials: [] },
- { type: "售后", enterprise: 0, account: null, team: 0, assignee: 1, status: "已完成", created: "2026-09-28", text: "补充开通说明并回传配置手册。", logs: ["2026-09-29 李可填写处理记录并完成"], closeReason: null, materials: [] },
- { 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: [] },
- { 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: [] },
- { 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: [] },
- ],
- /* 分成规则挂在渠道与客户的关系上,两种方式二选一:按总金额比例(rate,0-1)或按总客户账号数(per,每账号分成金额,精确到分)。
- mode 缺省为按总金额比例。两层都没有时分成计 0。合同增补优先于区域常规。 */
- rules: [
- { ch: "operator", ref: 0, ent: 0, layer: "区域常规", rate: 0.2 },
- { ch: "team", ref: 0, ent: 0, layer: "合同增补", mode: "按总客户账号数", per: 50 },
- { ch: "team", ref: 1, ent: 0, layer: "区域常规", rate: 0.05 },
- { ch: "partner", ref: 0, ent: 0, layer: "区域常规", rate: 0.05 },
- { ch: "operator", ref: 2, ent: 3, layer: "区域常规", rate: 0.15 },
- { ch: "team", ref: 0, ent: 3, layer: "区域常规", rate: 0.1 },
- { ch: "team", ref: 1, ent: 3, layer: "区域常规", rate: 0.05 },
- { ch: "partner", ref: 1, ent: 3, layer: "合同增补", rate: 0.08 },
- { ch: "operator", ref: 0, ent: 4, layer: "区域常规", rate: 0.2 },
- { ch: "team", ref: 0, ent: 4, layer: "区域常规", rate: 0.1 },
- { ch: "partner", ref: 0, ent: 4, layer: "区域常规", rate: 0.05 },
- ],
- /* 应扣除成本:线路投入不扣基数;国际资源按摊销扣;项目费用一次性。设备同一项目只选比例或固定金额之一。
- costSel 记该客户勾选要计入分成基数扣除的成本项下标;未勾选的成本项本月不扣。 */
- costs: [
- { ent: 0, sub: 1, kind: "国际资源", name: "国际出口带宽月摊销", amount: 80, repeat: "每月" },
- { ent: 3, sub: 4, kind: "国际资源", name: "国家 IP 地址月摊销", amount: 50, repeat: "每月" },
- { ent: 3, sub: 5, kind: "国际资源", name: "国际云主机月摊销", amount: 30, repeat: "每月" },
- { ent: 4, sub: 6, kind: "国际资源", name: "国家 IP 地址月摊销", amount: 40, repeat: "每月" },
- ],
- settlements: [
- {
- enterprise: 0, sub: 1, month: "2026-03", days: 12, monthDays: 31, partial: true, std: 1000, amount: 387.1, tail: false, exact: 387.1,
- costs: [], base: 387.1,
- shares: [
- { who: "联通", mode: "按总金额比例", rate: 0.2, amount: 77.42 },
- { who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 2, amount: 38.71 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 19.36 },
- { who: "华东合伙人", mode: "按总金额比例", rate: 0.05, amount: 19.36 },
- ],
- opsFee: 61.94, acctDays: [{ name: "张敏", days: 12, fee: 30.97 }, { name: "李航", days: 12, fee: 30.97 }],
- attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工", batch: null,
- },
- {
- enterprise: 0, sub: 1, month: "2026-04", days: 30, monthDays: 30, partial: false, std: 1000, amount: 1000, tail: false, exact: 1000,
- costs: [], base: 1000,
- shares: [
- { who: "联通", mode: "按总金额比例", rate: 0.2, amount: 200 },
- { who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 2, amount: 100 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 50 },
- { who: "华东合伙人", mode: "按总金额比例", rate: 0.05, amount: 50 },
- ],
- opsFee: 160, acctDays: [{ name: "张敏", days: 30, fee: 80 }, { name: "李航", days: 30, fee: 80 }],
- attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工", batch: null,
- },
- {
- enterprise: 0, sub: 1, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 1000, amount: 1000, tail: false, exact: 1000,
- costs: [], base: 1000,
- shares: [
- { who: "联通", mode: "按总金额比例", rate: 0.2, amount: 200 },
- { who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 2, amount: 100 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 50 },
- { who: "华东合伙人", mode: "按总金额比例", rate: 0.05, amount: 50 },
- ],
- opsFee: 160, acctDays: [{ name: "张敏", days: 30, fee: 80 }, { name: "李航", days: 30, fee: 80 }],
- attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工", batch: 0,
- },
- {
- enterprise: 3, sub: 4, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 1000, amount: 1000, tail: false, exact: 1000,
- costs: [{ name: "国家 IP 地址月摊销", amount: 50 }], base: 950,
- shares: [
- { who: "移动", mode: "按总金额比例", rate: 0.15, amount: 142.5 },
- { who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 95 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 47.5 },
- { who: "华南合伙人", mode: "合同增补 · 比例", rate: 0.08, amount: 76 },
- ],
- opsFee: 80, acctDays: [{ name: "王敏本人", days: 30, fee: 80 }],
- attrs: "移动 / 何南(华南) / 华东常规运维 / 沪东施工", batch: 1,
- },
- {
- enterprise: 3, sub: 5, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 300, amount: 300, tail: false, exact: 300,
- costs: [{ name: "国际云主机月摊销", amount: 30 }], base: 270,
- shares: [
- { who: "移动", mode: "按总金额比例", rate: 0.15, amount: 40.5 },
- { who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 27 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 13.5 },
- { who: "华南合伙人", mode: "合同增补 · 比例", rate: 0.08, amount: 21.6 },
- ],
- opsFee: 0, acctDays: [],
- attrs: "移动 / 何南(华南) / 华东常规运维 / 沪东施工(叠加订阅各算各的)", batch: 1,
- },
- {
- enterprise: 4, sub: 6, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 1000, amount: 1000, tail: true, exact: 1000,
- costs: [{ name: "国家 IP 地址月摊销", amount: 40 }], base: 960,
- shares: [
- { who: "联通", mode: "按总金额比例", rate: 0.2, amount: 192 },
- { who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 96 },
- { who: "沪东施工(未配置,计 0)", mode: "—", rate: 0, amount: 0 },
- { who: "华东合伙人", mode: "按总金额比例", rate: 0.05, amount: 48 },
- ],
- opsFee: 80, acctDays: [{ name: "海岚-小王", days: 30, fee: 80 }],
- attrs: "联通 / 邹合(华东) / 华东常规运维 / 无施工团队", batch: 0,
- },
- ],
- scopes: [
- { kind: "运营商", ref: 0, enabled: true },
- { kind: "运营商", ref: 1, enabled: true },
- { kind: "运营商", ref: 2, enabled: true },
- { kind: "合伙人", ref: 0, enabled: true },
- { kind: "合伙人", ref: 1, enabled: false },
- { kind: "运维", ref: 0, enabled: true },
- { kind: "运维", ref: 1, enabled: false },
- ],
- batches: [
- { no: "PC-20261005-LT", day: "2026-10-05", month: "2026-09", scope: "联通 · 运营商范围", trigger: "自动", status: "已执行", by: "系统", at: "2026-10-05 06:00", rows: [2, 5], warning: "" },
- { no: "PC-20261008-YD", day: "2026-10-08", month: "2026-09", scope: "移动 · 运营商范围", trigger: "自动", status: "已执行", by: "系统", at: "2026-10-08 06:00", rows: [3, 4], warning: "" },
- { no: "PC-20260905-DX", day: "2026-09-05", month: "2026-08", scope: "电信 · 运营商范围", trigger: "自动", status: "已打回", by: "系统", at: "2026-09-05 06:00", rows: [], warning: "分成比例误录,运营商尚未付款" },
- { no: "PC-20260912-DX-R", day: "2026-09-12", month: "2026-08", scope: "电信 · 运营商范围", trigger: "人工", status: "已执行", by: "林管", at: "2026-09-12 10:20", rows: [], warning: "打回后重做,新明细成为 8 月唯一有效应收" },
- { no: "PC-20260605-LT", day: "2026-06-05", month: "2026-05", scope: "联通 · 运营商范围", trigger: "自动", status: "执行失败", by: "系统", at: "2026-06-05 06:00", rows: [], warning: "出账任务异常中断,等待人工补跑" },
- ],
- notes: [
- { level: "严重", bill: "澄澜科技 2026-03", text: "3 月比例曾按 0.18 录入,核验后从 4 月起改为 0.20。3 月账单已递交运营商,原明细保留不改。", by: "林管", at: "2026-04-06 09:30" },
- { level: "严重", bill: "电信范围 2026-08(PC-20260905-DX)", text: "批次分成比例误录,运营商尚未付款,批次打回重做;重做批次 PC-20260912-DX-R 核验通过。", by: "林管", at: "2026-09-12 10:15" },
- ],
- feedback: [
- { no: "KL-UNKNOWN-3", action: "开户", date: "2026-10-11", state: "nomatch", result: "主体号匹配不到任何待执行记录,待人工处理。不自动创建客户,不改账户状态。", handled: false },
- { 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" },
- { no: "KL-2026-0019", action: "开户", date: "2026-10-13", state: "conflict", result: "该客户开户记录已于 2026-06-01 回填成功,反馈与现状冲突,不覆盖,待人工确认。", handled: false },
- ],
- collections: [
- { partner: 0, enterprise: 0, amount: 8000, date: "2026-04-18", note: "运营商已收,仅作区域核对,不回写应收" },
- ],
- /* 审计日志只追加。区域树维护仅总运营可见。 */
- auditLogs: [
- { at: "2026-08-01 09:12", by: "林管", type: "新建区域", object: "华东大区 / 上海市 / 浦东新区", before: "", after: "新建三级节点" },
- { at: "2026-08-01 09:20", by: "林管", type: "新建区域", object: "华东大区 / 上海市 / 临港新片区", before: "", after: "新建区县节点" },
- { at: "2026-08-02 14:02", by: "林管", type: "新建区域", object: "华东大区 / 苏州市 / 昆山市", before: "", after: "新建区县节点" },
- { at: "2026-08-05 10:40", by: "林管", type: "重命名区域", object: "华东大区 / 上海市 / 临港新片区", before: "南汇新城区", after: "临港新片区" },
- { at: "2026-08-10 10:20", by: "林管", type: "客户挂载", object: "澄澜科技有限公司", before: "未挂载", after: "华东大区 / 上海市 / 浦东新区" },
- { at: "2026-08-20 11:30", by: "林管", type: "客户改挂区域", object: "王敏", before: "华东大区 / 苏州市 / 昆山市", after: "华东大区 / 上海市 / 浦东新区" },
- { at: "2026-08-21 16:00", by: "林管", type: "合伙人负责范围首次配置", object: "邹合(华东渠道)", before: "(空)", after: "澄澜科技、临港跨境、陈阿福、王敏、海岚跨境(选定华东大区,含其下级全部客户)" },
- { at: "2026-09-02 09:10", by: "林管", type: "运维团队负责范围调整", object: "沪东施工", before: "澄澜科技、王敏", after: "澄澜科技、临港跨境、王敏(新增直接多选客户:临港跨境)" },
- { at: "2026-10-05 15:20", by: "林管", type: "合伙人负责范围调整", object: "何南(华南渠道)", before: "(空)", after: "天河区(暂无直属客户);直接多选客户:陈阿福" },
- { at: "2026-10-05 15:25", by: "林管", type: "结算范围启用", object: "合伙人范围 · 何南(华南渠道)", before: "未启用", after: "未启用(拟首次应收后再启用)" },
- ],
- /* 登录账号:login 为登录名,acctStatus 在用 / 停用(停用的不出现在「换身份」列表),
- mustChange 为下次登录是否必须改密,pwdResetOn 为最近一次重置密码日期。
- role=operator 是运营商的对账查看账号(只读),与运营商档案一比一。
- builtin: true 为系统内置账号:总运营账号即总运营团队的默认主账号,必须存在、不能删除,主账号身份也不可转交。
- phone 为绑定手机号:选填,可更换,但全站唯一(一个手机号至多绑定一个账号),
- 绑定后可用手机号代替登录名登录;未填时只能用登录名登录。 */
- users: [
- { name: "林管", role: "admin", regTeam: 0, primary: true, builtin: true, title: "总运营团队主账号", phone: "13900000001", acctStatus: "在用", mustChange: false },
- { name: "周运营", role: "regAdmin", regTeam: 1, primary: true, title: "华东运营 · 团队主账号", login: "zhouyun@example", phone: "13900000101", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-20" },
- { name: "许芸", role: "regAdmin", regTeam: 1, title: "华东运营 · 子账号(客户建档)", login: "xuyun@example", acctStatus: "在用", mustChange: true, pwdResetOn: "2026-10-09" },
- { name: "郑南", role: "regAdmin", regTeam: 2, primary: true, title: "华南运营 · 团队主账号", login: "zhengnan@example", phone: "13900000102", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-08-28" },
- { name: "吴队", role: "teamLead", team: 0, title: "华东常规运维 · 团队主账号", login: "wudui@example", phone: "13900000103", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-06" },
- { name: "周宁", role: "ops", member: 0, title: "常规运维 · 开停回填", login: "zhouning@example", phone: "13900000104", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-18" },
- { name: "孙队", role: "teamLead", team: 1, title: "沪东施工 · 团队主账号", login: "sundui@example", phone: "13900000105", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-02" },
- { name: "赵工", role: "worker", member: 2, title: "施工人员", login: "zhaogong@example", phone: "13900000106", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-21" },
- { name: "陈录", role: "entry", member: 4, title: "录入人员 · 电信/移动 ICT 代录", login: "chenlu@example", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-25" },
- { name: "澄澜科技", role: "enterprise", enterprise: 0, title: "客户主账号", phone: "13900000200" },
- { name: "张敏", role: "sub", enterprise: 0, account: 0, title: "下属分账号" },
- { name: "邹合", role: "partner", partner: 0, title: "华东渠道", login: "zouhe@example", phone: "13900000107", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-12" },
- { name: "何南", role: "partner", partner: 1, title: "华南渠道", login: "henan@example", phone: "13900000108", acctStatus: "停用", mustChange: false, pwdResetOn: "2026-08-05" },
- { name: "联通对账", role: "operator", operator: 0, title: "联通 · 对账查看账号", login: "unicom-dz@example", phone: "13900000109", acctStatus: "在用", mustChange: false, pwdResetOn: "2026-09-26" },
- ],
- };
- function cloneSeed() {
- return JSON.parse(JSON.stringify(SEED));
- }
- function money(n) {
- return Number(n || 0).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
- }
- function pct(n) {
- const v = Math.round(Number(n || 0) * 10000) / 100;
- return String(v) + "%";
- }
- function daysBetween(start, end) {
- const a = new Date(start + "T00:00:00");
- const b = new Date(end + "T00:00:00");
- return Math.round((b - a) / 86400000) + 1;
- }
- function addDays(date, n) {
- const d = new Date(date + "T00:00:00");
- d.setDate(d.getDate() + n);
- const pad = (x) => String(x).padStart(2, "0");
- return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
- }
- function overdueAction(action) {
- if (!action || action.status !== "待执行") return false;
- const limit = action.extendUntil || addDays(action.created, 7);
- return TODAY > limit;
- }
- function unfinished(db, memberIndex) {
- return db.tickets.filter((t) => t.assignee === memberIndex && (t.status === "待处理" || t.status === "处理中")).length;
- }
- function ticketTypeOfTeam(team) {
- return team.type === "施工" ? "施工" : "常规";
- }
- function eligible(db, ticket) {
- const team = db.teams[ticket.team];
- const need = ticketTypeOfTeam(team);
- return db.members
- .map((m, index) => ({ ...m, index }))
- .filter((m) => m.team === ticket.team && m.type === need && m.scope.includes(ticket.enterprise));
- }
- function pickEven(db, ticket) {
- const list = eligible(db, ticket);
- if (!list.length) return null;
- list.sort((a, b) => unfinished(db, a.index) - unfinished(db, b.index) || a.index - b.index);
- return list[0].index;
- }
- /* ---- 区域与范围工具 ---- */
- function regionNode(db, id) {
- return db.regions.find((r) => r.id === id) || null;
- }
- function regionPath(db, id) {
- const names = [];
- let cur = regionNode(db, id);
- while (cur) {
- names.unshift(cur.name);
- cur = cur.parent ? regionNode(db, cur.parent) : null;
- }
- return names.join(" / ");
- }
- function descendantIds(db, id) {
- const out = [id];
- let added = true;
- while (added) {
- added = false;
- db.regions.forEach((r) => {
- if (r.parent && out.includes(r.parent) && !out.includes(r.id)) {
- out.push(r.id);
- added = true;
- }
- });
- }
- return out;
- }
- function enterprisesUnderRegion(db, id) {
- const ids = new Set(descendantIds(db, id));
- return db.enterprises.map((e, i) => i).filter((i) => ids.has(db.enterprises[i].region));
- }
- function scopeEnterpriseSet(db, scope) {
- const set = new Set();
- (scope.regions || []).forEach((rid) => enterprisesUnderRegion(db, rid).forEach((i) => set.add(i)));
- (scope.enterprises || []).forEach((i) => set.add(i));
- return set;
- }
- function scopeEnterprises(db, scope) {
- return Array.from(scopeEnterpriseSet(db, scope)).sort((a, b) => a - b);
- }
- function scopeSummary(db, scope) {
- const parts = [];
- (scope.regions || []).forEach((rid) => {
- const n = regionNode(db, rid);
- if (n) parts.push(`${n.name}(含下级 ${enterprisesUnderRegion(db, rid).length} 家客户)`);
- });
- const fromRegion = new Set();
- (scope.regions || []).forEach((rid) => enterprisesUnderRegion(db, rid).forEach((i) => fromRegion.add(i)));
- const extra = (scope.enterprises || []).filter((i) => !fromRegion.has(i));
- if (extra.length) parts.push(`直接多选:${extra.map((i) => db.enterprises[i].name).join("、")}`);
- return parts.length ? parts.join(";") : "(空)";
- }
- function regionReferenced(db, id) {
- const refs = [];
- db.teams.forEach((t, i) => { if ((t.scope.regions || []).includes(id)) refs.push(`运维团队「${t.name}」负责范围`); });
- db.partners.forEach((p, i) => {
- if (p.region === id) refs.push(`合伙人「${p.name}」所属区域`);
- if ((p.scope.regions || []).includes(id)) refs.push(`合伙人「${p.name}」负责范围`);
- });
- db.operators.forEach((o) => { if (o.region === id) refs.push(`运营商「${o.name}」所属区域`); });
- db.regOpsTeams.forEach((t) => { if (t.region === id) refs.push(`运营团队「${t.name}」所属区域`); });
- return refs;
- }
|