Files
aibridge/docs/portal/01-overview.md
T
2026-05-18 09:28:15 +08:00

4.2 KiB
Raw Blame History

门户概述与核心概念

核心实体

PortalEntity (base_portal)

门户主表,存储门户的基本信息和配置。

字段 类型 说明
id string 门户ID(雪花算法)
fullName string 门户名称
enCode string 门户编码(唯一)
category string 分类(数据字典维护)
type int 类型: 0=页面设计, 1=自定义路径
customUrl string 静态页面路径(type=1时)
linkType int 链接类型: 0=页面, 1=外链
state int 状态: 0=禁用, 1=启用
enabledLock int 移动锁定: 0=未锁定, 1=锁定
platformRelease string 发布平台配置 JSON: {"pc":1,"app":1}
systemId string 所属系统ID
formData string 门户配置JSON(base_portal_data)

PortalDataEntity (base_portal_data)

门户数据表,存储门户的组件配置。

字段 类型 说明
id string 数据ID
portalId string 所属门户ID
platform string 平台: Web=网页端, App=手机端
formData string 表单配置JSON(组件布局)
systemId string 系统ID
type string 类型: mod=模型, custom=自定义, release=发布

三种数据模式

1. model (模板模式)

  • 用途: 门户设计的草稿状态
  • 创建: client.portal.create({"type": "model", ...})
  • 更新: client.portal.update(data)
  • 特点: 完整的组件配置,可反复修改

2. custom (自定义模式)

  • 用途: 用户个性化定制
  • 触发: 用户拖拽调整门户布局后自动保存
  • 更新: client.portal.update_custom_portal(portal_id, data)
  • 特点: 仅保存用户自定义部分,与 model 合并渲染

3. release (发布模式)

  • 用途: 正式发布的生产版本
  • 触发: 调用 client.portal.release(portal_id)
  • 特点: 只读,供最终用户访问

组件通用属性

每个组件都包含以下基础结构:

{
  "i": 1,
  "x": 0,
  "y": 0,
  "jnpfKey": "组件标识",
  "title": "组件标题",
  "visibility": ["pc", "app"],
  "card": {
    "titleFontSize": 14,
    "titleFontWeight": false,
    "titleFontColor": "#303133",
    "titleLeft": "left",
    "titleBgColor": "",
    "cardIcon": "icon-ym icon-ym-xxx",
    "cardIconColor": "#606266",
    "linkType": "",
    "moduleId": "",
    "urlAddress": "",
    "linkTarget": "_self"
  },
  "w": 6,
  "h": 4,
  "minW": 1,
  "minH": 3,
  "maxW": 12,
  "maxH": 20,
  "dataType": "static",
  "propsApi": "",
  "option": {},
  "refresh": {
    "autoRefresh": false,
    "autoRefreshTime": 5
  }
}

通用属性说明

属性 类型 说明
jnpfKey string 组件唯一标识
title string 组件显示标题
visibility array 显示平台: ["pc"], ["app"], ["pc", "app"]
card object 卡片配置(标题、图标、链接等)
w int 宽度(1-12 栅格)
h int 高度
minW/minH int 最小宽/高度
maxW/maxH int 最大宽/高度
dataType string 数据类型: static(静态), dynamic(动态接口)
propsApi string 数据接口ID(dynamic模式)
option object 组件特定配置
refresh object 自动刷新配置

布局配置

门户的完整配置结构:

{
  "layoutId": 100,
  "layout": [
    {
      "i": 1,
      "x": 0,
      "y": 0,
      "w": 6,
      "h": 4,
      "jnpfKey": "dataBoard",
      "title": "关键指标"
    }
  ],
  "refresh": {
    "autoRefresh": false,
    "autoRefreshTime": "5"
  }
}

链接配置

组件的卡片支持链接跳转:

{
  "linkType": "",
  "type": "",
  "moduleId": "",
  "urlAddress": "",
  "linkTarget": "_self",
  "appLinkType": "",
  "appType": "",
  "appModuleId": "",
  "appUrlAddress": ""
}
属性 说明
linkType PC端链接类型: 空=无, 1=菜单, 2=外链
moduleId 菜单ID(linkType=1时)
urlAddress 跳转地址
linkTarget 打开方式: _self(本页), _blank(新页)
appLinkType APP端链接类型
appModuleId APP端菜单ID
appUrlAddress APP端跳转地址