yxglServiceCategoryLabels.js 969 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * 运行管理 / 服务统计:服务类别 code → 中文(与后台返回的 type 字段对应)
  3. * 服务类
  4. */
  5. export const YXGL_SERVICE_CATEGORY_LABELS = {
  6. pro: "第三方公开服务",
  7. api: "一张图鉴权服务",
  8. icon: "地图符号服务",
  9. dms: "一张图数据中台服务",
  10. oauth: "一张图共享服务",
  11. proxy: "转发服务",
  12. /** 门户/业务侧常见 code,接口未统一命名时前端兜底展示 */
  13. qpyzt: "一张图门户服务",
  14. };
  15. /**
  16. * @param {string} type 后台返回的类别 code
  17. * @param {string} [unmappedAs='其它'] 未命中字典时的展示文案(表格可传入 type 以保留原 code)
  18. */
  19. export function formatYxglServiceCategory(type, unmappedAs = "其它") {
  20. if (type == null || type === "") {
  21. return "未知";
  22. }
  23. const raw = String(type).trim();
  24. if (raw === "未知") {
  25. return raw;
  26. }
  27. const key = raw.toLowerCase();
  28. return YXGL_SERVICE_CATEGORY_LABELS[key] ?? unmappedAs;
  29. }