| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568 |
- /* 模拟数据只存在于页面内存。内部下标从 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,含下级生效);客户只归属唯一运营商。
- shareMode 为档案级分成方式(按比例 / 按金额 / 按每账号,三选一),shareValue 随方式而定:
- 按比例时为 0-1 的比例(列表显示为百分比),按金额时为每月固定分成的人民币元(列表显示为金额/月),
- 按每账号时为每个账号的人民币金额(结算时分成金额 = 账号数 × 每账号金额)。在各自编辑界面配置。 */
- operators: [
- { name: "联通", region: "sh", reconcileDay: null, payCycle: "按月", notify: "notice@unicorn.example", shareMode: "按比例", shareValue: 0.2 },
- { name: "电信", region: "east", reconcileDay: null, payCycle: "按年", notify: "notice@ict-telecom.example", shareMode: "按比例", shareValue: 0.18 },
- { name: "移动", region: "east", reconcileDay: 8, payCycle: "按月", notify: "notice@mobile.example", shareMode: "按比例", shareValue: 0.15 },
- { name: "广东电信", region: "south", reconcileDay: null, payCycle: "按季度", notify: "notice@gd-ict.example", shareMode: "按金额", shareValue: 60 },
- { name: "苏州移动", region: "su", reconcileDay: 12, payCycle: "按季度", notify: "notice@sz-mobile.example", shareMode: "按每账号", shareValue: 3.5 },
- { name: "广州移动", region: "gz", reconcileDay: null, payCycle: "按月", notify: "notice@gz-mobile.example", shareMode: "按比例", shareValue: 0.12 },
- ],
- partners: [
- { name: "邹合", region: "east", title: "华东渠道", notify: "zouhe@example", scope: { regions: ["east"], enterprises: [] }, shareMode: "按比例", shareValue: 0.05 },
- { name: "何南", region: "gz", title: "华南渠道", notify: "henan@example", scope: { regions: ["th"], enterprises: [2] }, shareMode: "按每账号", shareValue: 6 },
- ],
- /* 运维团队按所属区域建档(region 为建档区域节点 id,列表显示全路径),负责范围另在「配置范围」里勾;
- type 为团队类型(常规 / 施工,各占一个 tab),mode 为团队内工单分派方式,
- shareMode 与 shareValue 为档案级分成配置,口径与运营商、合伙人、运营团队一致。 */
- teams: [
- { name: "华东常规运维", region: "east", type: "常规", mode: "手工", scope: { regions: ["sh", "su"], enterprises: [] }, shareMode: "按金额", shareValue: 50 },
- { name: "沪东施工", region: "sh", type: "施工", mode: "自动平均", scope: { regions: ["pd"], enterprises: [1] }, shareMode: "按每账号", shareValue: 4 },
- ],
- /* hq: true 为系统内置的总运营团队:不限所属区域(region 为空),负责范围覆盖全国,列表置顶且不可删除。
- 该团队的默认主账号即总运营账号(见 users 中 builtin: true 的一条),不再另设运营团队账号。 */
- regOpsTeams: [
- { name: "总运营团队", region: "", hq: true, scope: { regions: ["east", "south"], enterprises: [] }, desc: "总部平台级团队,不限所属区域,覆盖全国全部客户", shareMode: "按比例", shareValue: 0.1 },
- { name: "华东运营", region: "east", scope: { regions: ["east"], enterprises: [] }, desc: "覆盖华东大区全部下挂客户", shareMode: "按比例", shareValue: 0.08 },
- { name: "华南运营", region: "south", scope: { regions: ["south"], enterprises: [] }, desc: "覆盖华南大区全部下挂客户", shareMode: "按金额", shareValue: 30 },
- { name: "上海运营", region: "sh", scope: { regions: ["sh"], enterprises: [] }, desc: "覆盖上海市及其下级区域", shareMode: "按每账号", shareValue: 2.5 },
- ],
- 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", "oss://materials/KL-2026-0001/联通交接单.pdf"],
- contact: "沈澄",
- address: "上海市浦东新区金港路 300 号 6 号楼 3 层",
- 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", "oss://materials/KL-2026-0008/联通交接单.pdf"],
- contact: "陆港",
- address: "上海市浦东新区环湖西二路 800 号 A 座 11 层",
- 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"],
- contact: "陈阿福",
- address: "江苏省昆山市玉山镇中华园东路 58 号 2 单元 402",
- 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"],
- contact: "王敏",
- address: "上海市浦东新区张杨路 1200 弄 12 号 1802 室",
- 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"],
- contact: "周岚",
- address: "上海市闵行区申长路 988 号 3 号楼 5 层",
- 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: "周宁回填" },
- ],
- },
- ],
- /* 固定套餐口径取自 docs/原始文档/跨境网络报价单.pdf:
- 使用规模 10 人左右分「通用办公 / 直播高需求 / AI 应用」三组共 8 档,另设「单独境外 IP」按个叠加档;
- 使用规模 30 人及以上走定制化,报价单不列固定单价,由区域运营为具体客户配自定义套餐承接
- (跨境养号的云手机租赁同为按需报价,同样走自定义套餐)。
- cat 为用途分类,目录按它分组;desc 为报价单权益口径。
- 报价单按月报价,首期只做按年订阅,年订阅价格 = 月价 × 12。
- 分账号额度报价单未给出,按用途推定(办公档 10;直播 A 单链接单流 2、B 单链接多流 5、C 顶配 10;
- AI 5M 档 3、10M 档 5;按个叠加的增值项不占额度记 0),运营可在目录内直接改。
- costs 为该档位随附的成本项(按月计):名称取自「分成与成本」的成本项列表,金额默认沿用列表值、可在套餐档上改写。 */
- packages: [
- { name: "跨境办公 · 基础档", cat: "通用办公", yearPrice: 1080, monthPrice: 90, quota: 10, bw: "不承诺带宽", desc: "一般访问流量,无固定境外 IP,不承诺带宽", custom: null },
- { name: "跨境办公 · 标准档", cat: "通用办公", yearPrice: 1440, monthPrice: 120, quota: 10, bw: "下行 10M / 上行 1M", desc: "店铺管理、一般办公、视频会议、ERP 等,比基础档速度更快更稳定", custom: null },
- { name: "跨境办公 · 独立 IP 档", cat: "通用办公", yearPrice: 1920, monthPrice: 160, quota: 10, bw: "下行 5M / 上行 2M", desc: "单独境外 IP 配置,通过 CPE 组织网络管理平台", custom: null, costs: [{ name: "国家 IP 地址月摊销", amount: 50 }] },
- { name: "直播高需求 · A 类", cat: "直播高需求", yearPrice: 10800, monthPrice: 900, quota: 2, bw: "上下行 10M", desc: "单链接、单流;单独境外 IP 另购,80 元/个", custom: null },
- { name: "直播高需求 · B 类", cat: "直播高需求", yearPrice: 32400, monthPrice: 2700, quota: 5, bw: "上下行 30M", desc: "单链接、多流;团队内部运营如后台管理、看播等已包含", custom: null },
- { name: "直播高需求 · C 类", cat: "直播高需求", yearPrice: 62400, monthPrice: 5200, quota: 10, bw: "上下行 50M", desc: "直播高需求顶配档;链接数与流数按合同另定", custom: null },
- { name: "AI 应用 · 5M 档", cat: "AI 应用", yearPrice: 5760, monthPrice: 480, quota: 3, bw: "上下行 5M", desc: "面向 AI 应用访问的固定上下行带宽档", custom: null },
- { name: "AI 应用 · 10M 档", cat: "AI 应用", yearPrice: 10800, monthPrice: 900, quota: 5, bw: "上下行 10M", desc: "面向 AI 应用访问的固定上下行带宽档", custom: null },
- { name: "单独境外 IP(按个叠加)", cat: "叠加增值", yearPrice: 960, monthPrice: 80, quota: 0, bw: "按个计,不占带宽", desc: "80 元/个/月,与主档叠加订阅、各自计费;个数与单价在订阅上按合同改写", custom: null },
- { name: "临港 ICT 定制套餐", cat: "定制化", yearPrice: 24000, monthPrice: 2000, quota: 8, bw: "150Mbps", desc: "使用规模 30 人及以上,业务分析与需求摸排调研后定制;临港跨境贸易专项档", custom: 1, costs: [{ name: "国际出口带宽月摊销", amount: 80 }, { name: "国际云主机月摊销", amount: 30 }] },
- ],
- /* 订阅一律按名称引用「套餐目录」中的档位,签约时把目录价冻结到订阅上(目录改价不影响存量订阅)。
- 示例覆盖全部用途分类:通用办公(基础 / 标准 / 独立 IP 档)、直播高需求(A 类)、AI 应用(5M 档)、
- 叠加增值(单独境外 IP ×2 个:80 元/个/月 × 2 × 12)、定制化(临港 ICT 自定义档)。 */
- subs: [
- { 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"] },
- { 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"] },
- { 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: "直播高需求 · 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"] },
- { 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"] },
- { 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"] },
- { 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"] },
- { 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"] },
- /* 客户已在用时新增的叠加订阅:保存时自动生成「服务开通」工单(见 tickets 末条),实际开通日尚未回填 */
- { 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"] },
- ],
- /* 下属分账号:login 为账号名,规则是「客户主账号登录名-n」,n 为该客户的分账号序号,从 1 起,
- 正式与临时测试共用一个序号池;netLogin 为零信任客户端上的账号名,选填、可改、不校验唯一。
- 正式数量由套餐额度决定,示例里未建满的部分由启动时的 alignSubAccounts 按额度自动补齐。
- 分账号计费遵从合同:正式分账号只要客户合同在期就按合同期间计入外包运维费,未开通照计,到期停机后不计。 */
- accounts: [
- { enterprise: 0, name: "张敏", login: "clkj-1", status: "在用", usage: "正式", openedOn: "2026-03-20", netLogin: "zhangmin@clkj" },
- { enterprise: 0, name: "李航", login: "clkj-2", status: "在用", usage: "正式", openedOn: "2026-03-20", netLogin: "" },
- { enterprise: 0, name: "联调测试", login: "clkj-3", status: "在用", usage: "测试", openedOn: "2026-04-01", netLogin: "uat-liantiao@clkj" },
- { enterprise: 0, name: "待开通席位", login: "clkj-4", status: "未开通", usage: "正式", openedOn: null, netLogin: "" },
- { enterprise: 1, name: "临港-财务", login: "lgkjmy-1", status: "未开通", usage: "正式", openedOn: null, netLogin: "" },
- { enterprise: 1, name: "临港-关务", login: "lgkjmy-2", status: "未开通", usage: "正式", openedOn: null, netLogin: "customs-01@lingang" },
- { enterprise: 3, name: "王敏本人", login: "wm-1", status: "在用", usage: "正式", openedOn: "2026-06-01", netLogin: "wangmin@wm" },
- { enterprise: 4, name: "海岚-小王", login: "hlkjdssh-1", status: "在用", usage: "正式", openedOn: "2025-10-01", netLogin: "" },
- ],
- /* 开停记录与工单一一对应;状态:待执行 / 执行成功 / 执行失败 */
- 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)", "2026-10-07 林管登记联通交接单的开通准备资料(办公应用 6 个账号;中国香港 10 兆固定 IP 2 个)"], closeReason: null, materials: ["oss://materials/KL-2026-0008/联通交接单.pdf"],
- prep: {
- apps: { 浏览应用: 0, 办公应用: 6, 运营应用: 0, 直播应用: 0, 定制应用: 0 },
- ips: [{ country: "中国香港", bw: "10兆", count: 2 }],
- agent: "临港联通 · 张工", agentPhone: "13601700208", handoverOn: "2026-10-06",
- } },
- { 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: [] },
- /* 客户已在用时新增订阅 → 服务开通工单:不带开停记录、不改客户账户状态,按套餐带出的服务清单逐条核对,
- 全部核对后填实际开通日完成,实际开通日写回 sub 指向的订阅。创建满 7 个自然日仍未完成即进超期提醒。 */
- { type: "服务开通", enterprise: 3, account: null, team: 0, assignee: 1, status: "处理中", created: "2026-10-07", sub: 8, extendUntil: null,
- text: "HT-WM-20261008 新增叠加订阅「单独境外 IP(按个叠加)」,客户已在用,请在网络侧开通下列 3 项服务。",
- logs: ["2026-10-07 林管 新增叠加订阅,自动生成服务开通工单", "2026-10-08 吴队分派给李可"], closeReason: null, materials: [],
- svcItems: [
- { text: "网络带宽:按个计,不占带宽", done: false },
- { text: "单独境外 IP(按个叠加):个数与单价以合同为准(本条订阅年价 1920 元),不补建分账号档案", done: false },
- { text: "套餐权益:80 元/个/月,与主档叠加订阅、各自计费;个数与单价在订阅上按合同改写", done: false },
- ] },
- ],
- /* 分成规则挂在渠道与客户的关系上,两种方式二选一:按总金额比例(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: 120, amount: 46.45, tail: false, exact: 46.45,
- costs: [], base: 46.45,
- shares: [
- { who: "联通", mode: "按总金额比例", rate: 0.2, amount: 9.29 },
- { who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 5, amount: 112.90 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 2.32 },
- { who: "华东合伙人", mode: "按总金额比例", rate: 0.05, amount: 2.32 },
- ],
- opsFee: 180.65, acctDays: [{ name: "张敏", days: 14, fee: 36.13 }, { name: "李航", days: 14, fee: 36.13 }, { name: "未开通的正式分账号 × 3(按合同照计)", days: 14, fee: 108.39 }],
- attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工", batch: null,
- },
- {
- enterprise: 0, sub: 1, month: "2026-04", days: 30, monthDays: 30, partial: false, std: 120, amount: 120, tail: false, exact: 120,
- costs: [], base: 120,
- shares: [
- { who: "联通", mode: "按总金额比例", rate: 0.2, amount: 24 },
- { who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 5, amount: 250 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 6 },
- { who: "华东合伙人", mode: "按总金额比例", rate: 0.05, amount: 6 },
- ],
- opsFee: 400, acctDays: [{ name: "张敏", days: 30, fee: 80 }, { name: "李航", days: 30, fee: 80 }, { name: "未开通的正式分账号 × 3(按合同照计)", days: 30, fee: 240 }],
- attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工", batch: null,
- },
- {
- enterprise: 0, sub: 1, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 120, amount: 120, tail: false, exact: 120,
- costs: [], base: 120,
- shares: [
- { who: "联通", mode: "按总金额比例", rate: 0.2, amount: 24 },
- { who: "华东常规运维", mode: "按总客户账号数", per: 50, accounts: 5, amount: 250 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 6 },
- { who: "华东合伙人", mode: "按总金额比例", rate: 0.05, amount: 6 },
- ],
- opsFee: 400, acctDays: [{ name: "张敏", days: 30, fee: 80 }, { name: "李航", days: 30, fee: 80 }, { name: "未开通的正式分账号 × 3(按合同照计)", days: 30, fee: 240 }],
- attrs: "联通 / 邹合(华东) / 华东常规运维 / 沪东施工", batch: 0,
- },
- {
- enterprise: 3, sub: 4, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 480, amount: 480, tail: false, exact: 480,
- costs: [{ name: "国家 IP 地址月摊销", amount: 50 }], base: 430,
- shares: [
- { who: "移动", mode: "按总金额比例", rate: 0.15, amount: 64.5 },
- { who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 43 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 21.5 },
- { who: "华南合伙人", mode: "合同增补 · 比例", rate: 0.08, amount: 34.4 },
- ],
- opsFee: 160, acctDays: [{ name: "王敏本人", days: 30, fee: 80 }, { name: "未开通的正式分账号 × 1(按合同照计)", days: 30, fee: 80 }],
- attrs: "移动 / 何南(华南) / 华东常规运维 / 沪东施工", batch: 1,
- },
- {
- enterprise: 3, sub: 5, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 160, amount: 160, tail: false, exact: 160,
- costs: [{ name: "国际云主机月摊销", amount: 30 }], base: 130,
- shares: [
- { who: "移动", mode: "按总金额比例", rate: 0.15, amount: 19.5 },
- { who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 13 },
- { who: "沪东施工", mode: "按总金额比例", rate: 0.05, amount: 6.5 },
- { who: "华南合伙人", mode: "合同增补 · 比例", rate: 0.08, amount: 10.4 },
- ],
- opsFee: 0, acctDays: [],
- attrs: "移动 / 何南(华南) / 华东常规运维 / 沪东施工(叠加订阅各算各的;叠加增值不占分账号额度,外包运维费已随主档行计入)", batch: 1,
- },
- {
- enterprise: 4, sub: 6, month: "2026-09", days: 30, monthDays: 30, partial: false, std: 160, amount: 160, tail: true, exact: 160,
- costs: [{ name: "国家 IP 地址月摊销", amount: 40 }], base: 120,
- shares: [
- { who: "联通", mode: "按总金额比例", rate: 0.2, amount: 24 },
- { who: "华东常规运维", mode: "按总金额比例", rate: 0.1, amount: 12 },
- { who: "沪东施工(未配置,计 0)", mode: "—", rate: 0, amount: 0 },
- { who: "华东合伙人", mode: "按总金额比例", rate: 0.05, amount: 6 },
- ],
- opsFee: 160, acctDays: [{ name: "海岚-小王", days: 30, fee: 80 }, { name: "未开通的正式分账号 × 1(按合同照计)", 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: "出账任务异常中断,等待人工补跑" },
- ],
- /* 客户批量导入批次(见需求规格说明 4.8):一次上传一个文件生成一个批次,批次号贯穿行级结果、续传与按批次导出。
- rows 每行记 line 行编号、cells 模板 14 列原文、status 成功 / 失败、reason 失败原因、
- ent 导入生成的客户下标(未成功为 null)。行级明细持久保留,是续传与按批次导出的依据;批次不删除、不撤销。 */
- importBatches: [
- {
- no: "IMP-2026-0001", file: "闵行区客户建档-20261008.csv", by: "林管", at: "2026-10-08 10:05",
- status: "已完成",
- rows: [
- { line: "1", cells: ["1", "海岚跨境电商(上海)", "企业", "周岚", "021-54002023", "上海市闵行区申长路 988 号 3 号楼 5 层", "闵行区", "联通", "邹合", "华东常规运维", "", "跨境办公 · 独立 IP 档", "hlkjdssh", ""], status: "成功", reason: "", ent: 4 },
- ],
- },
- {
- no: "IMP-2026-0002", file: "临港与张江客户-20261012.csv", by: "周运营", at: "2026-10-12 09:40",
- status: "有失败待续传",
- rows: [
- { line: "1", cells: ["1", "临港跨境贸易", "企业", "陆港", "021-66002008", "上海市浦东新区环湖西二路 800 号 A 座 11 层", "临港新片区", "电信", "", "华东常规运维", "", "", "lgkjmy", ""], status: "成功", reason: "", ent: 1 },
- { line: "2", cells: ["2", "澄澜科技有限公司", "企业", "沈澄", "021-66001001", "上海市浦东新区金港路 300 号 6 号楼 3 层", "浦东新区", "联通", "邹合", "华东常规运维", "", "跨境办公 · 标准档", "", ""], status: "失败", reason: "客户名称与已有客户「澄澜科技有限公司」(KL-2026-0001)重复,不覆盖已有客户", ent: null },
- { line: "3", cells: ["3", "张江芯创半导体", "企业", "何工", "021-50003301", "上海市浦东新区祖冲之路 887 号 2 号楼", "张江区", "联通", "", "华东常规运维", "", "", "", "13900000331"], status: "失败", reason: "所挂区域「张江区」匹配不到,填区域名称原文且需在负责范围内", ent: null },
- { line: "4", cells: ["4", "陆家嘴外贸服务中心", "个体工商户", "王经理", "021-58002277", "上海市浦东新区世纪大道 100 号 18 层", "浦东新区", "联通", "", "华东常规运维", "", "", "clkj", ""], status: "失败", reason: "主账号登录名 clkj 已被占用,系统不自动加后缀,请改写后重新上传", ent: null },
- ],
- },
- ],
- 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 为绑定手机号:选填,可更换,但全站唯一(一个手机号至多绑定一个账号),
- 绑定后可用手机号代替登录名登录;未填时只能用登录名登录。
- 客户主账号不用初始密码,改用一次性激活码激活(acctOpenOn 开通日、claimOn 当前码生成日、
- claimExpireOn 有效期截止日:导出交付时才写,未交付为空、不判过期、claimStatus 未激活 / 已激活 /
- 已过期;已激活时 claimCode 置空)。 */
- 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: "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" },
- /* 客户主账号登录名取客户名称的拼音首字母(见《需求规格说明》3.2),不照抄中文客户名称。
- 激活状态只有三种,样例:未激活且已交付还在有效期内(临港)、已激活(澄澜)、
- 截止日已过按当天即时判为已过期(陈阿福、海岚,导出时会自动重置出新码)、
- 刚建档还没导出交付(王敏,没有截止日、不判过期) */
- { 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" },
- { 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" },
- { 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" },
- { name: "王敏", role: "enterprise", enterprise: 3, title: "客户主账号", login: "wm", acctStatus: "在用", mustChange: false, acctOpenOn: "2026-10-15", claimStatus: "未激活", claimCode: "PMXZ3RTV8H", claimOn: "2026-10-15", claimExpireOn: "" },
- { 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" },
- { 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;
- }
|