ticketRows.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. /**
  2. * 施工回填「一账号一通路」行模型与校验/提交适配。
  3. * 通路=客户侧接入(含接入口令)→ 路径/出口 → 境外出口资源;共享=挂靠前序境外资源(可选再共用口令)。
  4. */
  5. import type { BackfillInIp, BackfillInRoute, IpRow, RouteRow } from "./api/ticket";
  6. export const BANDWIDTH_TIERS = [5, 10, 30];
  7. export const IP_TYPES: { code: string; label: string }[] = [
  8. { code: "fixed_ip", label: "固定 IP" },
  9. { code: "nat_forward", label: "NAT 共享出口" },
  10. ];
  11. export const OVERSEAS_IP_MAX_ROWS = 4;
  12. export const ROUTE_MAX_ROWS = 12;
  13. export const PATH_MAX_ROWS = ROUTE_MAX_ROWS;
  14. export type PathDraft = {
  15. key: string;
  16. open_this_time: boolean;
  17. /** 空=独立境外资源;非空=挂靠主通路 key */
  18. share_egress_of: string;
  19. /** 与 share_egress_of 联用:同时共用主通路接入口令 */
  20. share_credential: boolean;
  21. require_cpid: boolean;
  22. tunnel_encap: "none" | "vxlan";
  23. sub_account_id: string;
  24. network_account_name: string;
  25. intranet_ip: string;
  26. subnet_mask: string;
  27. gateway: string;
  28. vlan: string;
  29. pin: string;
  30. cpid: string;
  31. proxy_host: string;
  32. proxy_port: string;
  33. vni: string;
  34. src_endpoint: string;
  35. dst_endpoint: string;
  36. egress_pop: string;
  37. down_mbps: string;
  38. up_mbps: string;
  39. overseas_ip: string;
  40. ip_type: string;
  41. bandwidth_mbps: string;
  42. pin_registered?: boolean;
  43. cpid_registered?: boolean;
  44. };
  45. /** @deprecated 兼容旧调用;新代码用 PathDraft */
  46. export type RouteRowDraft = PathDraft & { /* alias shape */ };
  47. export type BackfillIpRowDraft = {
  48. key: string;
  49. egress: string;
  50. overseas_ip: string;
  51. ip_type: string;
  52. bandwidth_mbps: string;
  53. pin: string;
  54. cpid: string;
  55. sub_account_ids?: string[];
  56. };
  57. let seq = 0;
  58. const key = (p: string) => `${p}-${(seq += 1)}`;
  59. export const newPathDraft = (): PathDraft => ({
  60. key: key("path"),
  61. open_this_time: true,
  62. share_egress_of: "",
  63. share_credential: false,
  64. require_cpid: false,
  65. tunnel_encap: "none",
  66. sub_account_id: "",
  67. network_account_name: "",
  68. intranet_ip: "",
  69. subnet_mask: "",
  70. gateway: "",
  71. vlan: "",
  72. pin: "",
  73. cpid: "",
  74. proxy_host: "",
  75. proxy_port: "",
  76. vni: "",
  77. src_endpoint: "",
  78. dst_endpoint: "",
  79. egress_pop: "",
  80. down_mbps: "",
  81. up_mbps: "",
  82. overseas_ip: "",
  83. ip_type: "fixed_ip",
  84. bandwidth_mbps: "5",
  85. });
  86. export const newRouteRow = newPathDraft;
  87. export const newBackfillIpRow = (ip_type = "fixed_ip", bandwidth_mbps = "5"): BackfillIpRowDraft => ({
  88. key: key("bip"),
  89. egress: "",
  90. overseas_ip: "",
  91. ip_type,
  92. bandwidth_mbps,
  93. pin: "",
  94. cpid: "",
  95. });
  96. export function exitNormKey(s: string): string {
  97. return s.replace(/\s+/g, "").toLowerCase();
  98. }
  99. const blank = (v: string | undefined | null) => !v || !v.trim();
  100. const posNum = (v: string) => /^\d+(\.\d+)?$/.test(v.trim()) && Number(v) > 0;
  101. function isIpLike(v: string): boolean {
  102. const raw = v.trim().replace(/\/\d+$/, "");
  103. if (raw.includes(":")) return true;
  104. const m = raw.split(".");
  105. return m.length === 4 && m.every((o) => /^\d{1,3}$/.test(o) && Number(o) <= 255);
  106. }
  107. function isVoidPath(r: PathDraft): boolean {
  108. return blank(r.sub_account_id) && blank(r.intranet_ip) && blank(r.overseas_ip) && blank(r.proxy_host);
  109. }
  110. /** 解析主通路:独立配置且本次开通。 */
  111. export function primaryPaths(paths: PathDraft[]): PathDraft[] {
  112. return paths.filter((p) => p.open_this_time && !p.share_egress_of.trim());
  113. }
  114. export function validatePathRows(
  115. paths: PathDraft[],
  116. require: boolean,
  117. allowedExits: string[] = [],
  118. involveOverseasIp = true,
  119. ): string | null {
  120. const kept = paths.filter((r) => !isVoidPath(r));
  121. if (kept.length > PATH_MAX_ROWS) return `网络通路最多 ${PATH_MAX_ROWS} 条。`;
  122. const allowKeys = new Set(allowedExits.map(exitNormKey));
  123. const byKey = new Map(paths.map((p) => [p.key, p]));
  124. const seenIp = new Set<string>();
  125. for (const r of kept) {
  126. if (!r.open_this_time) continue;
  127. const n = paths.indexOf(r) + 1;
  128. const shareKey = r.share_egress_of.trim();
  129. const primary = shareKey ? byKey.get(shareKey) : null;
  130. if (shareKey) {
  131. if (!primary || !primary.open_this_time || primary.share_egress_of.trim()) {
  132. return `第 ${n} 条通路的挂靠目标无效(须为本次开通的独立主通路)。`;
  133. }
  134. if (paths.indexOf(primary) >= paths.indexOf(r)) {
  135. return `第 ${n} 条通路只能挂靠更靠前的主通路。`;
  136. }
  137. }
  138. const miss: string[] = [];
  139. if (blank(r.sub_account_id)) miss.push("分账号编号");
  140. if (blank(r.network_account_name)) miss.push("网络接入账号");
  141. if (blank(r.intranet_ip)) miss.push("内网 IP");
  142. if (blank(r.subnet_mask)) miss.push("子网掩码");
  143. if (blank(r.gateway)) miss.push("默认网关");
  144. if (blank(r.vlan)) miss.push("接入 VLAN");
  145. if (blank(r.proxy_host)) miss.push("正向代理地址");
  146. if (blank(r.proxy_port)) miss.push("正向代理端口");
  147. if (blank(r.egress_pop)) miss.push("出口 PoP");
  148. if (blank(r.down_mbps)) miss.push("下行实测");
  149. if (blank(r.up_mbps)) miss.push("上行实测");
  150. if (!shareKey || !r.share_credential) {
  151. if (blank(r.pin) && !r.pin_registered) miss.push("接入口令(PIN)");
  152. }
  153. if (r.require_cpid && !shareKey && blank(r.cpid) && !r.cpid_registered) miss.push("CPID");
  154. if (r.tunnel_encap === "vxlan") {
  155. if (blank(r.vni)) miss.push("VNI");
  156. if (blank(r.src_endpoint)) miss.push("隧道本端");
  157. if (blank(r.dst_endpoint)) miss.push("隧道对端");
  158. }
  159. if (involveOverseasIp && !shareKey) {
  160. if (blank(r.overseas_ip)) miss.push("境外出口 IP");
  161. if (blank(r.ip_type)) miss.push("接入方式");
  162. if (blank(r.bandwidth_mbps)) miss.push("申报带宽档位");
  163. }
  164. if (miss.length) return `第 ${n} 条通路缺${miss.join("、")}。`;
  165. for (const f of ["intranet_ip", "subnet_mask", "gateway"] as const) {
  166. if (!isIpLike(r[f])) return `第 ${n} 条通路的${f}「${r[f]}」不是合法 IP。`;
  167. }
  168. const port = Number(r.proxy_port);
  169. if (!Number.isInteger(port) || port < 1 || port > 65535) {
  170. return `第 ${n} 条通路的代理端口「${r.proxy_port}」须在 1~65535。`;
  171. }
  172. if (!posNum(r.down_mbps) || !posNum(r.up_mbps)) {
  173. return `第 ${n} 条通路的上下行实测须为正数。`;
  174. }
  175. if (allowKeys.size && r.egress_pop.trim() && !allowKeys.has(exitNormKey(r.egress_pop))) {
  176. return `第 ${n} 条通路出口 PoP「${r.egress_pop}」不在本单订阅核定出口内(须为:${allowedExits.join("、")})。`;
  177. }
  178. if (involveOverseasIp && !shareKey) {
  179. if (!isIpLike(r.overseas_ip)) return `第 ${n} 条通路境外 IP「${r.overseas_ip}」不是合法 IP。`;
  180. if (seenIp.has(r.overseas_ip.trim())) return `境外 IP「${r.overseas_ip}」重复登记。`;
  181. seenIp.add(r.overseas_ip.trim());
  182. if (!BANDWIDTH_TIERS.includes(Number(r.bandwidth_mbps))) {
  183. return `第 ${n} 条通路带宽档位只能是 5/10/30 Mbps。`;
  184. }
  185. }
  186. }
  187. if (require && !kept.some((r) => r.open_this_time)) {
  188. return kept.length
  189. ? "勾选至少一条「本次开通」通路并填齐。"
  190. : "至少填写一条网络通路。";
  191. }
  192. return null;
  193. }
  194. /** 兼容旧名。 */
  195. export function validateRouteRows(
  196. rows: PathDraft[],
  197. require: boolean,
  198. allowedExits: string[] = [],
  199. ): string | null {
  200. return validatePathRows(rows, require, allowedExits, true);
  201. }
  202. export function validateBackfillIpRows(
  203. _rows: BackfillIpRowDraft[],
  204. _allowedExits: string[] = [],
  205. ): string | null {
  206. return null; // 境外资源已并入通路校验
  207. }
  208. export function normalizeBuilderUserId(raw: string | undefined | null): string | null {
  209. const v = (raw ?? "").trim();
  210. return /^\d+$/.test(v) ? v : null;
  211. }
  212. export function parseLineExits(raw: string | string[] | null | undefined): string[] {
  213. if (Array.isArray(raw)) return raw.map((x) => String(x).trim()).filter(Boolean);
  214. if (!raw || !String(raw).trim()) return [];
  215. try {
  216. const v = JSON.parse(String(raw));
  217. return Array.isArray(v) ? v.map((x) => String(x).trim()).filter(Boolean) : [];
  218. } catch {
  219. return [];
  220. }
  221. }
  222. export function resolveApprovedLineExits(detail: {
  223. order?: { line_exits?: string | string[] | null } | null;
  224. construction_guide?: {
  225. plan?: { line_exits?: string | string[] | null } | null;
  226. defaults?: { line_exits?: string[] | null } | null;
  227. } | null;
  228. }): string[] {
  229. const fromOrder = parseLineExits(detail.order?.line_exits);
  230. if (fromOrder.length) return fromOrder;
  231. const fromPlan = parseLineExits(detail.construction_guide?.plan?.line_exits);
  232. if (fromPlan.length) return fromPlan;
  233. return parseLineExits(detail.construction_guide?.defaults?.line_exits);
  234. }
  235. export function derivePinBindMode(paths: PathDraft[]): "shared" | "per_account" {
  236. return paths.some((p) => p.open_this_time && p.share_credential && p.share_egress_of.trim())
  237. ? "shared"
  238. : "per_account";
  239. }
  240. /** 通路 → 后端 route_rows + ip_rows + pin_bind_mode */
  241. export function buildPathSubmit(paths: PathDraft[]): {
  242. route_rows: BackfillInRoute[];
  243. ip_rows: Array<BackfillInIp & { sub_account_ids: string[] }>;
  244. pin_bind_mode: "shared" | "per_account";
  245. } {
  246. const opened = paths.filter((r) => !isVoidPath(r) && r.open_this_time);
  247. const byKey = new Map(opened.map((p) => [p.key, p]));
  248. const pin_bind_mode = derivePinBindMode(opened);
  249. const route_rows: BackfillInRoute[] = opened.map((r) => {
  250. const primary = r.share_egress_of.trim() ? byKey.get(r.share_egress_of.trim()) : null;
  251. const shareCredOf = r.share_credential && primary ? (primary.sub_account_id.trim() || null) : null;
  252. return {
  253. sub_account_id: r.sub_account_id.trim(),
  254. network_account_name: r.network_account_name.trim() || null,
  255. intranet_ip: r.intranet_ip.trim(),
  256. subnet_mask: r.subnet_mask.trim(),
  257. gateway: r.gateway.trim(),
  258. vlan: r.vlan.trim(),
  259. tunnel_encap: r.tunnel_encap,
  260. vni: r.tunnel_encap === "vxlan" ? r.vni.trim() : "",
  261. src_endpoint: r.tunnel_encap === "vxlan" ? r.src_endpoint.trim() : "",
  262. dst_endpoint: r.tunnel_encap === "vxlan" ? r.dst_endpoint.trim() : "",
  263. egress_pop: r.egress_pop.trim(),
  264. down_mbps: Number(r.down_mbps),
  265. up_mbps: Number(r.up_mbps),
  266. proxy_host: r.proxy_host.trim(),
  267. proxy_port: Number(r.proxy_port),
  268. pin: shareCredOf ? "" : r.pin,
  269. cpid: shareCredOf ? "" : r.cpid.trim(),
  270. require_cpid: r.require_cpid,
  271. share_credential_of: shareCredOf,
  272. open_this_time: true,
  273. };
  274. });
  275. /** 按境外 IP 聚合:独立通路各一条;挂靠行并入主通路 IP。 */
  276. type Acc = {
  277. egress: string;
  278. overseas_ip: string;
  279. ip_type: string;
  280. bandwidth_mbps: number;
  281. sub_account_ids: string[];
  282. pin: string;
  283. cpid: string;
  284. };
  285. const groups = new Map<string, Acc>();
  286. for (const r of opened) {
  287. const primary = r.share_egress_of.trim() ? byKey.get(r.share_egress_of.trim()) : r;
  288. if (!primary || blank(primary.overseas_ip)) continue;
  289. const ipKey = primary.overseas_ip.trim();
  290. let g = groups.get(ipKey);
  291. if (!g) {
  292. const multi = opened.some(
  293. (x) => x.share_egress_of && byKey.get(x.share_egress_of.trim())?.overseas_ip.trim() === ipKey,
  294. );
  295. g = {
  296. egress: primary.egress_pop.trim(),
  297. overseas_ip: ipKey,
  298. ip_type: multi || primary.ip_type === "nat_forward" ? "nat_forward" : (primary.ip_type || "fixed_ip"),
  299. bandwidth_mbps: Number(primary.bandwidth_mbps) || 5,
  300. sub_account_ids: [],
  301. pin: primary.pin,
  302. cpid: primary.cpid.trim(),
  303. };
  304. groups.set(ipKey, g);
  305. }
  306. const acc = r.sub_account_id.trim();
  307. if (acc && !g.sub_account_ids.includes(acc)) g.sub_account_ids.push(acc);
  308. }
  309. const ip_rows = [...groups.values()].map((g) => ({
  310. egress: g.egress,
  311. overseas_ip: g.overseas_ip,
  312. ip_type: g.sub_account_ids.length > 1 ? "nat_forward" : g.ip_type,
  313. bandwidth_mbps: g.bandwidth_mbps,
  314. pin: g.pin || undefined,
  315. cpid: g.cpid || undefined,
  316. action: "allocate" as const,
  317. sub_account_ids: g.sub_account_ids,
  318. }));
  319. return { route_rows, ip_rows, pin_bind_mode };
  320. }
  321. export function buildRouteRows(rows: PathDraft[]): BackfillInRoute[] {
  322. return buildPathSubmit(rows).route_rows;
  323. }
  324. export function buildBackfillIpRows(rows: BackfillIpRowDraft[]): BackfillInIp[] {
  325. return rows.filter((r) => !blank(r.overseas_ip)).map((r) => ({
  326. egress: r.egress.trim(),
  327. overseas_ip: r.overseas_ip.trim(),
  328. ip_type: r.ip_type,
  329. bandwidth_mbps: Number(r.bandwidth_mbps),
  330. pin: r.pin,
  331. cpid: r.cpid.trim(),
  332. }));
  333. }
  334. export function pathsFromDetail(
  335. routes: RouteRow[],
  336. ips: IpRow[],
  337. ): PathDraft[] {
  338. if (!routes.length) return [newPathDraft()];
  339. const ipByAcc = new Map<string, IpRow>();
  340. const multiOwners = new Map<string, string[]>();
  341. for (const ip of ips) {
  342. const accs = [...(ip.sub_account_ids ?? [])];
  343. if (!accs.length && routes.length === 1 && ips.length === 1) {
  344. const only = routes[0].sub_account_id ?? "";
  345. if (only) accs.push(only);
  346. }
  347. for (const a of accs) {
  348. if (a) ipByAcc.set(a, ip);
  349. }
  350. if (accs.length > 1 && ip.overseas_ip) {
  351. multiOwners.set(ip.overseas_ip, accs);
  352. }
  353. }
  354. const pathKeys = new Map<string, string>();
  355. const drafts: PathDraft[] = routes.map((r) => {
  356. const d = newPathDraft();
  357. pathKeys.set(r.sub_account_id ?? "", d.key);
  358. const ip = ipByAcc.get(r.sub_account_id ?? "");
  359. const owners = ip?.overseas_ip ? multiOwners.get(ip.overseas_ip) : undefined;
  360. const isPrimary = !owners || owners[0] === r.sub_account_id;
  361. const primaryAcc = owners?.[0];
  362. return {
  363. ...d,
  364. sub_account_id: r.sub_account_id ?? "",
  365. network_account_name: r.network_account_name ?? "",
  366. intranet_ip: r.intranet_ip ?? "",
  367. subnet_mask: r.subnet_mask ?? "",
  368. gateway: r.gateway ?? "",
  369. vlan: r.vlan ?? "",
  370. tunnel_encap: (r as RouteRow & { tunnel_encap?: string }).tunnel_encap === "vxlan" ? "vxlan" : "none",
  371. vni: r.vni ?? "",
  372. src_endpoint: r.src_endpoint ?? "",
  373. dst_endpoint: r.dst_endpoint ?? "",
  374. egress_pop: r.egress_pop ?? "",
  375. down_mbps: r.down_mbps ?? "",
  376. up_mbps: r.up_mbps ?? "",
  377. proxy_host: (r as RouteRow & { proxy_host?: string }).proxy_host ?? "",
  378. proxy_port: (r as RouteRow & { proxy_port?: string }).proxy_port ?? "",
  379. pin_registered: (r as RouteRow & { pin_registered?: string }).pin_registered === "true"
  380. || (r as RouteRow & { pin_registered?: string }).pin_registered === "1",
  381. cpid_registered: (r as RouteRow & { cpid_registered?: string }).cpid_registered === "true"
  382. || (r as RouteRow & { cpid_registered?: string }).cpid_registered === "1",
  383. overseas_ip: isPrimary ? (ip?.overseas_ip ?? "") : "",
  384. ip_type: ip?.ip_type || "fixed_ip",
  385. bandwidth_mbps: ip?.bandwidth_mbps || "5",
  386. share_egress_of: !isPrimary && primaryAcc ? (pathKeys.get(primaryAcc) || "") : "",
  387. share_credential: false,
  388. open_this_time: true,
  389. };
  390. });
  391. // 第二遍:挂靠 key(第一遍时 primary 的 key 可能尚未写入 map 顺序问题——按账号再补)
  392. for (const d of drafts) {
  393. if (!d.share_egress_of && d.overseas_ip === "") {
  394. const ip = ipByAcc.get(d.sub_account_id);
  395. const owners = ip?.overseas_ip ? multiOwners.get(ip.overseas_ip) : undefined;
  396. if (owners && owners[0] !== d.sub_account_id) {
  397. const pk = drafts.find((x) => x.sub_account_id === owners[0])?.key;
  398. if (pk) d.share_egress_of = pk;
  399. }
  400. }
  401. }
  402. return drafts;
  403. }
  404. export function routeRowsFromDetail(rows: RouteRow[]): PathDraft[] {
  405. return pathsFromDetail(rows, []);
  406. }
  407. export function backfillIpRowsFromDetail(rows: IpRow[]): BackfillIpRowDraft[] {
  408. return rows.map((r) => ({
  409. key: key("bip"),
  410. egress: r.egress ?? "",
  411. overseas_ip: r.overseas_ip ?? "",
  412. ip_type: r.ip_type || "fixed_ip",
  413. bandwidth_mbps: r.bandwidth_mbps || "5",
  414. pin: "",
  415. cpid: "",
  416. sub_account_ids: r.sub_account_ids,
  417. }));
  418. }
  419. /** 字段元数据(通路卡分段渲染)。 */
  420. export const PATH_CPE_FIELDS: { key: keyof PathDraft; label: string; ph?: string; hint?: string; scannable?: boolean; type?: string }[] = [
  421. { key: "sub_account_id", label: "分账号编号", ph: "ACC-0001", scannable: true, hint: "本系统分账号主键" },
  422. { key: "network_account_name", label: "网络接入账号", ph: "proxy-user-01", scannable: true, hint: "正向代理/网管侧认证用户名" },
  423. { key: "intranet_ip", label: "客户侧内网 IP", ph: "10.20.30.11", hint: "CPE/LAN 侧地址" },
  424. { key: "subnet_mask", label: "子网掩码", ph: "255.255.255.0" },
  425. { key: "gateway", label: "默认网关", ph: "10.20.30.1" },
  426. { key: "vlan", label: "接入 VLAN", ph: "120", hint: "客户侧 L2 分段,与 VNI 无包含关系" },
  427. { key: "pin", label: "接入口令(PIN)", ph: "只写不读", type: "password", hint: "与网络接入账号配对的口令;一账号一 PIN" },
  428. { key: "cpid", label: "CPID", ph: "选填", hint: "有则录;默认非必填" },
  429. { key: "proxy_host", label: "正向代理地址", ph: "proxy.example.com", hint: "客户侧接入点" },
  430. { key: "proxy_port", label: "正向代理端口", ph: "8080" },
  431. ];
  432. export const PATH_TUNNEL_FIELDS: { key: keyof PathDraft; label: string; ph?: string; hint?: string }[] = [
  433. { key: "vni", label: "隧道 VNI", ph: "50120", hint: "VXLAN 网络标识(与 VLAN 不同层)" },
  434. { key: "src_endpoint", label: "隧道本端(VTEP/PE)", hint: "客户侧隧道端点" },
  435. { key: "dst_endpoint", label: "隧道对端(VTEP/PE)", hint: "对端/PoP 侧隧道端点" },
  436. { key: "egress_pop", label: "出口 PoP", ph: "请选择核定出口", hint: "须∈订阅核定出口(KLT-G20406)" },
  437. { key: "down_mbps", label: "下行实测 Mbps", ph: "100", hint: "开通实测,非申报档位" },
  438. { key: "up_mbps", label: "上行实测 Mbps", ph: "50" },
  439. ];
  440. // 旧 ROUTE_FIELDS 兼容(部分页面可能仍引用)
  441. export type RouteFieldDef = {
  442. key: keyof PathDraft;
  443. label: string;
  444. ph?: string;
  445. group: "cpe" | "tunnel";
  446. scannable?: boolean;
  447. hint?: string;
  448. };
  449. export const ROUTE_FIELDS: RouteFieldDef[] = [
  450. ...PATH_CPE_FIELDS.filter((f) => !["pin", "cpid", "proxy_host", "proxy_port"].includes(f.key as string)).map((f) => ({ ...f, group: "cpe" as const })),
  451. ...PATH_TUNNEL_FIELDS.map((f) => ({ ...f, group: "tunnel" as const })),
  452. ];
  453. export const ROUTE_GROUP_LABELS = {
  454. cpe: "客户侧接入",
  455. tunnel: "路径与出口",
  456. };
  457. export const IP_ROW_FIELDS: { key: keyof BackfillIpRowDraft; label: string; ph?: string; hint?: string }[] = [
  458. { key: "overseas_ip", label: "境外出口 IP", ph: "203.0.113.7" },
  459. { key: "ip_type", label: "接入方式" },
  460. { key: "bandwidth_mbps", label: "申报带宽档位" },
  461. ];
  462. export const IP_TYPE_LABELS: Record<string, string> = {
  463. fixed_ip: "固定 IP",
  464. nat_forward: "NAT 共享出口",
  465. };