页面树结构

版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

对 Tab 进行增删改查https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg


Markdown
# V11【X 模块】二次开发扩展接口文档
V2.0.0

# 快速入门文档:

[自助仪表盘二次开发快速入门](https://smartbi.feishu.cn/docs/doccnY0Tuaqlq9WPLksPflegeUh)

# 场景示例文档

[V11X 模块扩展接口场景示例](https://smartbi.feishu.cn/docx/UNAxdxTo5ofZKdxnHP1cW0bln3e)

[仪表盘二开外部资源使用文档](https://smartbi.feishu.cn/docs/doccnrJuqVvUOZjpGhSooqGFkkb)

# BaseDashExtender 基类

仪表盘扩展点需继承此类,在自定义的 Extender 类中可通过 this 指针调用 BaseDashExtender 中的方法

|                       | <strong>名称</strong> | <strong>参数</strong>                                                                   | <strong>返回值</strong>                                                                                                                         | <strong>说明</strong> |
| --------------------- | --------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>方法</strong> | on                    | [接口名称](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#aDiesp),回调方法 | -                                                                                                                                               | 添加接口监听事件      |
|                       | getDashboard          |                                                                                         | [IDashboard](https://smartbi.feishu.cn/docs/https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Cb0rd8ZwUolbSvx0aCKcoAAKnzb#IgdqsE) | 获取仪表盘对象        |
|                       | getPage               |                                                                                         | [IPage](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#Rgp4hK)                                                                      | 获取页面对象          |

# install 初始化接口

<strong>触发时机:</strong>仪表盘创建时。

<strong>作用:</strong>此时仪表盘刚进行创建,此时开发者可以在此接口中通过 on 方法添加对仪表盘事件的监听,并进行一些数据准备等初始化操作。

<strong>示例代码</strong>

```javascript
import SmartBIExt from  'smartbi-ext'
let {
  DashModule: {
    DashEventEmum: {
      DASHBOARD_ON_READY,
    },
    BaseDashExtender
  },
  Utils: {
    ExtensionUtil: { rmi }
  }
} = SmartBIExt
class DashExtender extends BaseDashExtenter {
  install () {
    // 通过RMI获取当前用户信息,供后续使用
    let respPromise = rmi('UserService', 'getCurrentUser')
    this.on(DASHBOARD_ON_READY, (iDashboard) => {
      // 打开组件选择面板
      iDashboard.openWidgetPanel()
    })
  }
}
```

# 扩展接口

扩展接口是仪表盘中提供的外部对系统进行修改的接口,这些接口会在对应的生命周期执行。

开发者实现相关接口时,只需在 install 方法中,通过 on 方法监听对应的事件,并实现对应的回调方法,以下示例代码均在 install 方法中编写。

## Dashboard 仪表盘接口

### DASHBOARD_ON_READY

<strong>触发时机:</strong>仪表盘准备完成时,此时可以获取到其他接口对象进行操作。

<strong>作用:</strong>在仪表盘准备完成后进行一些系统操作,如打开弹窗等。

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                     | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iDashboard            | [IDashboard](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Cb0rd8ZwUolbSvx0aCKcoAAKnzb) | 仪表盘对象            |
| <strong>返回值</strong>   | -                     |                                                                                                           |                       |

### DASHBOARD_ON_TOOLBAR_INIT

<strong>触发时机:</strong>工具栏初始化时

<strong>作用:</strong>对工具栏按钮进行加减

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                       | <strong>说明</strong> |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iToolbar              | [IDashToolbar](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-ZwdFd5BHzo3dDAxY4JmcBF4WnAc) | 仪表盘工具栏对象      |
| <strong>返回值</strong>   | -                     |                                                                                                             |                       |

### DASHBOARD_WIDGET_PANEL_INIT

<strong>触发时机:</strong>组件选择面板初始化时

<strong>作用:</strong>对组件选择面板中的组件类型或组件进行过滤

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                       | <strong>说明</strong>  |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------- |
| <strong>输入参数</strong> | iWidgetPanel          | [IWidgetPanel](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-EDDUd1eweo67XBxgUp6c3tsMnAh) | 仪表盘组件选择面板对象 |
| <strong>返回值</strong>   | -                     |                                                                                                             |                        |

### DASHBOARD_ON_SAVE_DIALOG_INIT

<strong>触发时机:</strong>首次打开保存弹窗时

<strong>作用:</strong>指定用户的可保存的目录

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                      | <strong>说明</strong> |
| ------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iSaveDialog           | [ISaveDialog](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-W0yCdWtwUo1PNZxBU5ncnVTDnWy) | 保存弹窗对象          |
| <strong>返回值</strong>   | -                     |                                                                                                            |                       |

### DASHBOARD_ON_PAGE_THEME_PANEL_INIT

<strong>触发时机:</strong>主题面板初始化

<strong>作用:</strong>可以对主题面板进行操作,例如过滤

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                          | <strong>说明</strong> |
| ------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iPageThemePanel       | [iPageThemePanel](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-TqxTdj8ino8hJFxjfWZcQr8Tnxg) | 主题面板对象          |
| <strong>返回值</strong>   | -                     |                                                                                                                |                       |

### DASHBOARD_COMPONENT_SELECTION_AREA_INIT

### COMMON_SHRINKBAR_CHANGE

<strong>触发时机:</strong>折叠 tab 页切换时

<strong>作用:</strong>监听进行相关操作

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                     | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iShrinkbar            | [IShrinkbar](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-MSmrdHLIroGolRxuJxmc3nI4n3b) | 折叠面板对象          |
| <strong>返回值</strong>   | -                     |                                                                                                           |                       |

### COMMON_SHRINKBAR_INIT

<strong>触发时机:</strong>折叠面板初始化

<strong>作用:过滤、新增、移除 tab</strong>

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                     | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iShrinkbar            | [IShrinkbar](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-MSmrdHLIroGolRxuJxmc3nI4n3b) | 折叠面板对象          |
| <strong>返回值</strong>   | -                     |                                                                                                           |                       |

### COMMON_DATASET_PANEL_INIT

<strong>触发时机:数据面板初始化</strong>

<strong>作用:禁用选择数据集、禁用数据集编辑</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | iShrinkbar            | IDataSetPanel         | 数据面板对象          |
| <strong>返回值</strong>   | -                     |                       |                       |

### COMMON_SETTING_PANEL_INIT

<strong>触发时机:设置面板初始化</strong>

<strong>作用:隐藏设置面板 tab、添加设置面板 tab</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | iSettingPanel         | ISettingPanel         | 设置面板对象          |
| <strong>返回值</strong>   | -                     |                       |                       |

### COMMON_DATASET_SELECTOR_INIT

<strong>触发时机:数据选择面板初始化</strong>

<strong>作用:过滤数据、设置显示资源目录</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | iDatasetSeletor       | IDatasetSeletor       | 数据选择面板对象      |
| <strong>返回值</strong>   | -                     |                       |                       |

### PAGE_ON_INIT

<strong>触发时机:</strong>页面初始化时

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                | <strong>说明</strong> |
| ------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iPage                 | [IPage](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-FhZ2dC41poeqF6xOoLBcCYPrnef) | 页面对象              |
| <strong>返回值</strong>   | -                     |                                                                                                      |                       |

### PAGE_TOOLBAR_INIT

<strong>触发时机:</strong>浏览仪表盘左上角工具栏初始化时

<strong>作用:</strong>对工具栏按钮进行加减

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                       | <strong>说明</strong>    |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------ |
| <strong>输入参数</strong> | iPageToolbar          | [iPageToolbar](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-QTJrdtZBwoPtU3xzAzbcghh5nue) | 浏览态下仪表盘工具栏对象 |
| <strong>返回值</strong>   | -                     |                                                                                                             |                          |

### PAGE_ON_PORTLET_INIT

<strong>触发时机:</strong>仪表盘组件初始化时

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                   | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iPortlet              | [IPortlet](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5) | 组件对象              |
| <strong>返回值</strong>   | -                     |                                                                                                         |                       |

### PAGE_ON_PORTLET_TOOLBAR_INIT

<strong>触发时机:</strong>组件工具栏初始化时

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                          | <strong>说明</strong> |
| ------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iPortletToolbar       | [IPortletToolbar](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-YudDdQWwmoKGaAxQfNNcplFMnng) | 组件工具栏对象        |
|                           | iPortlet              | [IPortlet](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5)        | 组件对象              |
| <strong>返回值</strong>   | -                     |                                                                                                                |                       |

### PAGE_ON_PORTLET_MENU_SHOW

<strong>触发时机:</strong>组件菜单显示前

<strong>作用:</strong>对组件菜单进行加减

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                   | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iPopMenu              | [IPopMenu](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-MPUedOqk6ofDD3x6BAdcw7jonRb) | 组件工具栏对象        |
|                           | iPortlet              | [IPortlet](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5) | 组件对象              |
| <strong>返回值</strong>   | -                     |                                                                                                         |                       |

### PAGE_ON_BEFORE_EXPORT_DIALOG

<strong>触发时机</strong>:页面导出前

<strong>作用:</strong>在页面导出前实现自己逻辑,比如提示strong>预设导出弹窗里选项的默认值, 可编辑性, 可见性, 或阻止弹窗

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                               | <strong>说明</strong>       |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------- | --------------------------- |
| <strong>输入参数</strong> | iPage                 | [Page](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-FhZ2dC41poeqF6xOoLBcCYPrnef) | 页面对象                    |
|                           | paramsoptions                | objectObject                                                                                              | 导出需要的参数(类型和 id) 选项                        |
| <strong>返回值</strong>    | -                     | options.portletId     | String                                                                                           | 组件ID, 如果是页码导出, 则为空 |
|                           | options.props         | 
### PAGE_ON_PORTLET_BEFORE_EXPORT

<strong>触发时机</strong>:组件导出前

<strong>作用:</strong>在组件导出前实现自己逻辑,比如提示

|Object                                                                       | <strong>名称</strong>弹窗设置, props都是有值的, 开发时可console打印查看 |
| <strong>类型</strong>                        | options.props.openDialog | Boolean                                                                | <strong>说明</strong>             | 是否打开导出弹窗, 设置为false可阻止弹窗打开 |
| ------------------------- | ---                      | options.props.exportType | String                                                                                    | 导出类型, CSV或EXCEL或PDF, 不允许修改 |
|                          | options.props.visibles | Map<选项key, Boolean> | 配置选项的可见性, 选项key见[ExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd). 设为false就不显示在弹窗中 |
|                          | options.props.disables | Map<选项key, Boolean> | 配置选项的可编辑性, 选项key见[ExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd). 设为true就在弹窗中是不可编辑的 |
|                      | options.props.defaultValue | [ExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd) | 导出选项默认值 |
| <strong>返回值</strong>   | -                     |                                                                                                     |                             |

### PAGE_ON_BEFORE_EXPORT

<strong>触发时机</strong>:页码导出动作执行前, 比如点击EXCEL之后

<strong>作用:</strong>阻止系统默认的导出实现, 定制自己的导出

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                               | <strong>说明</strong>       |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------- | --------------------------- |
| <strong>输入参数</strong> | iPage                 | [Page](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-FhZ2dC41poeqF6xOoLBcCYPrnef) | 页面对象                    |
|                           | options               | Object                                                                                              | 选项                        |
|                           | options.exportType    | String                                                                                              | 导出类型, CSV或EXCEL或PDF   |
| <strong>返回值</strong>   | -                     |                                                                                                     |                             |

### PAGE_ON_PORTLET_BEFORE_EXPORT

<strong>触发时机</strong>:组件导出动作执行前, 比如点击EXCEL之后

<strong>作用:</strong>阻止系统默认的导出实现, 定制自己的导出

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                   | <strong>说明</strong>       |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | --------------------------- |
| <strong>输入参数</strong> | iPortlet              | [IPortlet](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5) | 组件对象                    |
|                           | options               | Object                                                                                                  | 选项                        |
|                           | options.exportType    | String                                                                                                  | 导出类型, CSV或EXCEL        |
|                           | options.portletId     | String                                                                                                  | 组件ID                      |
| <strong>返回值</strong>   | -                     |                                                                                                         |                             |

## AugmentedDataSet 数据模型接口

### AUGMENTEDDATASET_ON_SAVE_DIALOG_INIT

<strong>触发时机:</strong>首次打开保存弹窗时

<strong>作用:</strong>指定用户的可保存的目录

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                      | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------- | --------- | --------------------- |
| <strong>输入参数</strong> | iPortlet   iSaveDialog           | [IPortletISaveDialog](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5W0yCdWtwUo1PNZxBU5ncnVTDnWy) | 组件对象        保存弹窗对象            |
| <strong>返回值</strong>   | -                      | params                | object                                                                                                  | 导出需要的参数(类型和 id) | | <strong>返回值</strong>   | -                     |

<strong>示例代码</strong>

```javascript
this.on(AUGMENTEDDATASET_ON_SAVE_DIALOG_INIT, async (iSaveDialog) => {
  // 删除所有操作按钮
  iSaveDialog.setOperateButtonFilter(item => {
    return false
  })
  // 设置根节点为我的空间中的分析报表
  let                                                                       |                             |

## AugmentedDataSet 数据模型接口

### AUGMENTEDDATASET_ON_SAVE_DIALOG_INIT

<strong>触发时机:</strong>首次打开保存弹窗时

<strong>作用:</strong>指定用户的可保存的目录resp = await rmi('UserService', 'getCurrentUser')
  iSaveDialog.setRootNodeId(`SELF_ANALYSIS_${resp.result.id}`)
})
```

# 接口对象

## IDashboard

仪表盘接口对象,可获取仪表盘下的下层组件对象或进行打开组件选择面板等页面操作。

![](https://wiki.smartbi.com.cn/download/attachments/115002469/UoyQbMONWo5HDVxIssOcu4j3nUb.png)

### getToolbar

<strong>作用:</strong>获取仪表盘工具栏对象。

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                            | <strong>说明</strong> |
| ------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | iSaveDialog-           | [ISaveDialog](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-W0yCdWtwUo1PNZxBU5ncnVTDnWy) | 保存弹窗对象          |
| <strong>返回值</strong>   | -                     |                                                                                                            |                       |
| <strong>示例代码<<strong>返回值</strong>
 ```javascript
this.on(AUGMENTEDDATASET_ON_SAVE_DIALOG_INIT, async (iSaveDialog) => {
  // 删除所有操作按钮
  iSaveDialog.setOperateButtonFilter(item => {
    return false
  })
  // 设置根节点为我的空间中的分析报表
  let resp = await rmi('UserService', 'getCurrentUser')
  iSaveDialog.setRootNodeId(`SELF_ANALYSIS_${resp.result.id}`)
})
```

# 接口对象

## IDashboard

仪表盘接口对象,可获取仪表盘下的下层组件对象或进行打开组件选择面板等页面操作。

![ | iToolbar              | [IDashboardToolbar](https://wiki.smartbi.comfeishu.cn/download/attachments/115002469/UoyQbMONWo5HDVxIssOcu4j3nUb.png)

### getToolbardocx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-ZwdFd5BHzo3dDAxY4JmcBF4WnAc) | 工具栏对象            |

### getPage

<strong>作用:</strong>获取仪表盘工具栏对象。strong>获取仪表盘 page 对象

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                            | <strong>说明</strong> |
| ------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                      |                       |
| <strong>返回值</strong>   | iPage                 | [IPage](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-FhZ2dC41poeqF6xOoLBcCYPrnef) | 页面 page 对象        |

### getComponentSelectionArea

<strong>作用:获取组件选择对象</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>             |
| ------------------------- | --------------------- | --------------------- | --------------------------------- |
| <strong>返回值<<strong>输入参数</strong>   | iToolbar-              | [IDashboardToolbar](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-ZwdFd5BHzo3dDAxY4JmcBF4WnAc) | 工具栏对象    |        |  ### getPage  <strong>作用:</strong>获取仪表盘 page 对象  |      |                     | <strong>名称</strong> | <strong>类型</strong>           |
| <strong>返回值</strong>   | IComponentSeletorArea | IComponentSeletorArea | <strong>组件选择面板对象</strong> |

### switchTheme

<strong>作用:切换仪表盘主题</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                   | <strong>说明</strong> |
| ------------------------- |
--------------------- | ------------------------- | --------------------- | ------------------------ | ------------------------------ | --------------------- |
| <strong>输入参数</strong> | - themeId               | string                | 主题 id                                   |
|                           | warnHasChange         | boolean               | 若主题已修改,切换时进行提示,默认为 true |
| <strong>返回值</strong>   | -                     |                       | | <strong>返回值</strong>           | iPage                 | [IPage](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-FhZ2dC41poeqF6xOoLBcCYPrnef) | 页面 page 对象        |

### getComponentSelectionArea<strong>isNewDashboard</strong>

<strong>作用:获取组件选择对象<<strong>作用:判断当前仪表盘是否为新建仪表盘</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>             |
| ------------------------- | --------------------- | --------------------- | --------------------------------- |
| <strong>输入参数</strong> | -                     |                       |                       |
| <strong>返回值</strong>   | isNew      |
| <strong>返回值</strong>           | boolean               | IComponentSeletorArea是否为新建仪表盘  | IComponentSeletorArea | <strong>组件选择面板对象</strong> |

### switchTheme

<strong>作用:切换仪表盘主题< <strong>getPageDatasetIds</strong>

<strong>作用:获取页面数据 id 列表</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>         <strong>说明</strong>             |
| ------------------------- | --------------------- | --------------------- | ----------------------------------------- |
| <strong>输入参数</strong> | themeId                      |       string                |    主题 id                              |
| <strong>返回值</strong>   | |ids                   | Array                 | <strong>页面数据 warnHasChangeid 列表</strong> |

### saveAsCopy

<strong>作用:仪表盘另存</strong>

| boolean                        | 若主题已修改,切换时进行提示,默认为 true | <strong>名称</strong> | <strong>返回值<<strong>类型</strong>    | -                     |                       |                                  | <strong>说明</strong>        |  ### <strong>isNewDashboard</strong>  <strong>作用:判断当前仪表盘是否为新建仪表盘</strong>  |                           |
<strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| | ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | -pageInfo                     |                       |                       |
| <strong>返回值</strong>   | isNew| [PageInfo](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-LegDdrEePogZlHxIPo5cDXEUnyf) |                  | boolean               | 是否为新建仪表盘      |  ### <strong>getPageDatasetIds</strong>

<strong>作用:获取页面数据 id 列表</strong>  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>             |
| ------------------------- | --------------------- | --------------------- | ---------------------------------         |
| <strong>输入参数</strong>   |                       | folderId              | String                |                                   | | <strong>返回值</strong>   | ids                   | Array                 | <strong>页面数据 id 列表</strong> | 目录 id ### saveAsCopy  <strong>作用:仪表盘另存</strong>  |                           | <strong>名称</strong> | <strong>类型</strong>                    |
|                           | coverId               | String                  | <strong>说明</strong>                                          | | ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| <strong>输入参数</strong> | pageInfo                                | 需要被覆盖的资源 id (如果为 null 就是新建,如果有值就是覆盖) |
| <strong>返回值</strong>   | -                     | [PageInfo](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-LegDdrEePogZlHxIPo5cDXEUnyf) |                                                                             | |                           | folderId                          | String                                     |

## IShrinkBar

<strong>说明</strong>:折叠面板对象,可设置当前所选中的 tab,或获取数据面板或主题面板对象

![](https://wiki.smartbi.com.cn/download/attachments/115002469/DNE6b2nXGoKvf3xJQcrciMwPnTb.png)

### setActiveItems

<strong>作用:</strong>设置当前所选中的 tabs

|                           | <strong>名称</strong> | <strong>类型</strong>                   | 目录 id                                                        | |                           | coverId               | String                             | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | ActiveItems           | Array[[ActiveShrinkBarItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)](%5BActiveShrinkBarItem%5D(https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)) | 设置当前所选中的 tabs |
| <strong>返回值</strong>   | -                                | 需要被覆盖的资源 id (如果为 null 就是新建,如果有值就是覆盖) | | <strong>返回值</strong>   | -                     |                                                                                                         |                                      |                          |

## IShrinkBar

<strong>说明</strong>:折叠面板对象,可设置当前所选中的 tab,或获取数据面板或主题面板对象

![](https://wiki.smartbi.com.cn/download/attachments/115002469/DNE6b2nXGoKvf3xJQcrciMwPnTb.png)

### setActiveItemsgetActiveItems

<strong>作用:</strong>设置当前所选中的strong>获取当前所选中的 tabstab

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                                                                                       | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | ActiveItems           | Array[[ActiveShrinkBarItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)](%5BActiveShrinkBarItem%5D(https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)) | 设置当前所选中的 tabs |
| <strong>返回值</strong>- |
| <strong>输入参数</strong> | -                     | -                      |                                                                                                                                                      |                       |
| <strong>返回值</strong>   | ActiveItem            | Array[[ActiveShrinkBarItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)](%5BActiveShrinkBarItem%5D(https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)) | 设置当前所选中的 tabs |

### getActiveItemsgetItems

<strong>作用:</strong>获取当前所选中的 tabstrong>获取折叠面板数据项

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                                                                                       | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                                                                                             |                       |
| <strong>返回值</strong>   | ActiveItem  shrinkGroupItems          | Array[[ActiveShrinkBarItemShrinkGroupItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)](%5BActiveShrinkBarItem%5D%5BShrinkGroupItem%5D(https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)) | 设置当前所选中的返回折叠面板数据项   tabs |

### getItemsgetSettingPanel

<strong>作用:</strong>获取折叠面板数据项strong>获取数据面板接口对象

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                                                                               | <strong>说明</strong> |
| ------------------------- | ---------------------   | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                              |                       |
| <strong>返回值</strong>   | iDatasetPanel         | [IDatasetPanel](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-XZBOdwwxtonURkxf17Hc1FIUnJe) | 数据面板              |

## IDatasetPanel(数据面板)

说明:数据面板对象,可指定资源来源的目录或删除操作按钮

![](https://wiki.smartbi.com.cn/download/attachments/115002469/BSQ7b9ukQoo6tZxCQ89cOGg0nih.png)

### setDropDownBtnsFilter

<strong>作用:</strong>过滤下拉菜单的操作按钮

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>              |
| ------------------------- | --------------------- | --------------------- | ---------------------------------- |
| <strong>输入参数</strong> | filterFunc        |    | function              |   过滤方法,第一个参数为操作按钮信息 |
| <strong>返回值</strong>   | shrinkGroupItems-       | Array[[ShrinkGroupItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)](%5BShrinkGroupItem%5D(https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)) | 返回折叠面板数据项    |  ### getSettingPanel  <strong>作用:</strong>获取数据面板接口对象  |                           | <strong>名称</strong> | <strong>类型</strong>                                 |

### getCurrentDatasetId

<strong>作用:</strong>获取当前选中的数据集 id

      |                                         | <strong>说明<<strong>名称</strong> | | ------------------------- | ---------------------<strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | -------------------------------------------------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                       |                       |
| <strong>返回值</strong>   | datasetId             | string                | 当前选中的数据集 id   |

### setSelectDatasetDisabled

<strong>作用:</strong>设置禁用数据集选择

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | disabled              | boolean               | 是否禁用数据集选择    |
| <strong>返回值</strong>   | -                         |                       | | <strong>返回值</strong>   | iDatasetPanel         | [IDatasetPanel](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-XZBOdwwxtonURkxf17Hc1FIUnJe) | 数据面板              |

## IDatasetPanel(数据面板)

说明:数据面板对象,可指定资源来源的目录或删除操作按钮

![](https://wiki.smartbi.com.cn/download/attachments/115002469/BSQ7b9ukQoo6tZxCQ89cOGg0nih.png)

### setDropDownBtnsFilter

<strong>作用:</strong>过滤下拉菜单的操作按钮### openDatasetSeletor

<strong>作用:打开数据选择面板</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>              |
| ------------------------- | --------------------- | --------------------- | ------------------------------------- |
| <strong>输入参数</strong> | -                     |                       |                       |
| <strong>输入参数<<strong>返回值</strong>   | filterFunc -                     | function                       | 过滤方法,第一个参数为操作按钮信息 |
| <strong>返回值<                       |

### getDatasetSeletor

<strong>作用:获取数据选择面板接口对象</strong>

| | -                     |    | <strong>名称</strong> | <strong>类型</strong>                |                                    |  ### getCurrentDatasetId  <strong>作用:</strong>获取当前选中的数据集 id  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------- | | <strong>输入参数</strong>
| -                     <strong>输入参数</strong> |  -                     |                       | | <strong>返回值</strong>   | datasetId             | string                | 当前选中的数据集 id   |  ### setSelectDatasetDisabled  <strong>作用:</strong>设置禁用数据集选择  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> | | ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | disabled              | boolean               | 是否禁用数据集选择  
 | | <strong>返回值</strong>   | -IDatasetSelector                     | [IDatasetSelector](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-F641dAYJjoYymnxYkwBcPOc5nnO) |                       |

## IDatasetSelector(选择数据集弹窗)

                  |

### openDatasetSeletor

<strong>作用:打开数据选择面板</strong>

说明:数据选择面板接口对象

![](https://wiki.smartbi.com.cn/download/attachments/115002469/KpIdb5saRoHZG0xPqKTcguManXg.png)

### setRootNodeId

作用:设置根节点 id

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | id      -              | String      |          | 弹窗根节点            |
| <strong>返回值</strong>   |                     |   |   <strong>返回值</strong>   | -             |        |               |

### setNodeFilter

作用: 设置节点过滤方法

|                           | <strong>名称</strong> ###| getDatasetSeletor<strong>类型</strong> | <strong>作用:获取数据选择面板接口对象<<strong>说明</strong>                  |                           | <strong>名称</strong> | <strong>类型</strong>                                                                                           | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| <strong>输入参数</strong> | -filterFunc            | Function        |      | 自定义过滤节点方法,方法入参:item,结构如下 ``typescript[{    id: 资源id,    label: 资源名称,    type: 资源类型}]`` 方法返回 true 则保留,返回 false 则移除 |
| <strong>返回值</strong>   | -                     |                       |                                  |                       | | <strong>返回值</strong>   | IDatasetSelector      | [IDatasetSelector](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-F641dAYJjoYymnxYkwBcPOc5nnO) |                       |  ## IDatasetSelector(选择数据集弹窗) 
说明:数据选择面板接口对象  ![](https://wiki.smartbi.com.cn/download/attachments/115002469/KpIdb5saRoHZG0xPqKTcguManXg.png)  ### setRootNodeId  作用:设置根节点 id  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> | | ------------------------- | --------------------- | --------------------- | --------------------- | | <strong>输入参数</strong> | id             |

### setSearchNodeFilter

作用:设置搜索节点过滤方法

| String                | 弹窗根节点         | <strong>名称</strong> | |<strong>类型</strong> | <strong>返回值<<strong>说明</strong>   |                     |                       |                       |  ### setNodeFilter  作用: 设置节点过滤方法  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                                                                                                       |
| ------------------------- | ---------------------  |
| | --------------------- | -------------------------------------------------------------- | --------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <strong>输入参数</strong> | filterFunc            | Function              | 自定义过滤节点方法,方法入参:item,结构如下自定义过滤节点方法,方法入参:item,类型为数组,代表一个资源的全路径资源集合,结构如下 ``typescript[{    id: 资源id,    label: 资源名称,    type: 资源类型},{     id: 资源id,    label: 资源名称,    type: 资源类型}]`` 方法返回 true 则保留,返回 false 则移除 |
| <strong>返回值</strong>   | -                     |                       |                                                                                                                                                                   |  ### setSearchNodeFilter  作用:设置搜索节点过滤方法  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                                 |

## IPageThemePanel

主题面板设置对象

![](https://wiki.smartbi.com.cn/download/attachments/115002469/MDYWbkneaoQOQnxhzlec2xcInOf.png)

### filterSettingGroup

<strong>作用:</strong>根据自定义的白名单或黑名单对主题设置组进行过滤

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                                                                                                      | | ------------------------- | --------------------- | ---------------------      |
| ------------------------- | --------------------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <strong>输入参数</strong> | filterFunc            | Functionfunction              | 自定义过滤节点方法,方法入参:item,类型为数组,代表一个资源的全路径资源集合,结构如下 ``typescript[{    id: 资源id,    label: 资源名称,    type: 资源类型},{     id: 资源id,    label: 资源名称,    type: 资源类型}]`` 方法返回 true 则保留,返回 false 则移除 |
| <strong>返回值</strong>   | -                     |                       |                                                            过滤方法,第一个参数为组信息,数据结构为{ id, label },当前 5 个组 id 分别为 `dashboardSetting`、`portletSetting`、`chartSetting`、`tableSetting`、`filterSetting` |
| <strong>返回值</strong>   | -                     |                       |                                                                                                                                                                   |

## IPageThemePanelIDashToolbar

主题面板设置对象仪表盘工具栏对象,可对仪表盘工具栏按钮进行添加或删除。

![](https://wiki.smartbi.com.cn/download/attachments/115002469/MDYWbkneaoQOQnxhzlec2xcInOfK0DebXFRboa5DTxxzFGcHeKNni3.png)

### filterSettingGroupaddItem

<strong>作用:</strong>根据自定义的白名单或黑名单对主题设置组进行过滤strong>添加工具栏按钮

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                                                                                       | <strong>说明</strong>                      |
| ------------------------- | --------------------- | --------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| <strong>输入参数</strong> | filterFunc |
| <strong>输入参数</strong> | toolbarItem           | [ToolbarItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#Mg3VlQ) | 添加按钮的定义            |
|            | function              | 过滤方法,第一个参数为组信息,数据结构为{ id, label },当前 5 个组 id 分别为 `dashboardSetting`、`portletSetting`、`chartSetting`、`tableSetting`、`filterSetting` |
| <strong>返回值</strong>   | -groupIndex            | Int                         |                       |                              | 目标查询组序号,从 0 开始 |
| <strong>返回值</strong>   | -                     |                                                                                  |                    |  ## IDashToolbar  仪表盘工具栏对象,可对仪表盘工具栏按钮进行添加或删除。  ![](https://wiki.smartbi.com.cn/download/attachments/115002469/K0DebXFRboa5DTxxzFGcHeKNni3.png)|

### addIteminsertItem

<strong>作用:</strong>添加工具栏按钮strong>在工具栏插入按钮

|                           | <strong>名称</strong> | <strong>类型</strong>                                                            | <strong>说明</strong>     |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------- | ------------------------- |
| <strong>输入参数</strong>----- | ------------------------- |
| <strong>输入参数</strong> | index                 | number                                                                           | 插入位置                  |
|                           | toolbarItem           | [ToolbarItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#Mg3VlQ) | 添加按钮的定义            |
|                           | groupIndex            | Int                                                                              | 目标查询组序号,从 0 开始 |
| <strong>返回值</strong>   | -                     |                                                                                  |                           |

### insertItemgetItems

<strong>作用:</strong>在工具栏插入按钮strong>获取系统原有工具栏按钮定义数组

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                | <strong>说明</strong>     |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------ | ------------------------- |
| <strong>输入参数</strong> | index-                 | number   |                                                                        | 插入位置             |     | |                    |
| <strong>返回值</strong>     | toolbarItem           | [ [ToolbarItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#Mg3VlQ) | 添加按钮的定义            |
|   ] | 系统原有的工具栏按钮定义 |

### removeItem

<strong>作用:</strong>删除指定下标的工具栏按钮

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>     |
| ------------------------- | --------------------- | --------------------- | ------------------------- |
| <strong>输入参数</strong> | index                 |   number    | groupIndex            | Int所需删除按钮的下标        |
|                           | groupIndex                     | Int                    | 目标查询组序号,从 0 开始 |
| <strong>返回值</strong>   | -                     |                                |                                                  |

## IPageToolbar

                      |

### getItems浏览态仪表盘工具栏对象

![](https://wiki.smartbi.com.cn/download/attachments/115002469/KTMAbHlwxopbyTxfR5Icuth9nug.png)

### addItem

<strong>作用:</strong>获取系统原有工具栏按钮定义数组strong>添加工具栏按钮

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                | <strong>说明</strong>    |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------- | ----- | ---------------------------- |
| <strong>输入参数</strong> | flexMenuItem          | [FlexMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#x2C5rV) | 添加按钮的定义        |
| <strong>输入参数<<strong>返回值</strong>   | -                     |                                                                                   |                       |

### insertItem

<strong>作用:</strong>在工具栏插入按钮

|                           | <strong>名称</strong> | <strong>返回值<<strong>类型</strong>    |  toolbarItem           | [ [ToolbarItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#Mg3VlQ) ] | 系统原有的工具栏按钮定义 |  ### removeItem  <strong>作用:</strong>删除指定下标的工具栏按钮  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>     |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------- | ------------------------- |
| <strong>输入参数</strong> | index |
| <strong>输入参数</strong> | index                 | number                                                  | number                | 所需删除按钮的下标        | |插入位置              |
|            | groupIndex            | Int | flexMenuItem          | [FlexMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#x2C5rV) | 添加按钮的定义    | 目标查询组序号,从 0 开始 |
| <strong>返回值</strong>   | -                     |                                   |                                                |         ## IPageToolbar            浏览态仪表盘工具栏对象  ![](https://wiki.smartbi.com.cn/download/attachments/115002469/KTMAbHlwxopbyTxfR5Icuth9nug.png)|

### addItemgetItems

<strong>作用:</strong>添加工具栏按钮strong>获取系统原有工具栏按钮定义数组

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                 | <strong>说明</strong>    |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | flexMenuItem          | [FlexMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#x2C5rV) | 添加按钮的定义        |
| <strong>返回值</strong>   | -                     | ---- |
| <strong>输入参数</strong> | -                     |                                                             |                       |  ### insertItem

<strong>作用:</strong>在工具栏插入按钮
 |                           | <strong>名称</strong>
| <strong>类型<<strong>返回值</strong>   | flexMenuItem          | [ [FlexMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#x2C5rV) ] | 系统原有的工具栏按钮定义 |

### removeItem

<strong>作用:</strong>删除指定下标的工具栏按钮

|                           | <strong>名称</strong> | <strong>类型</strong>    | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | index                 | number                | 所需删除按钮的下标    |
| <strong>返回值</strong>             | -                                        | 插入位置              | |                           | flexMenuItem          | [FlexMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#x2C5rV) | 添加按钮的定义        | | <strong>返回值</strong>   |
-
##    IComponentSeletorArea

<strong>说明</strong>:组件选择区,可以对 Tab 进行增删改查,设置初始化默认 tab 

![](https://wiki.smartbi.com.cn/download/attachments/115002469/JCmobNTLwoD3xUx8n56ccfxmnLh.png)

### removeItem

<strong>作用:移除组件选择区 tab</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | index                 | Init                   |                       |
| ###<strong>返回值</strong> getItems  <strong>作用:</strong>获取系统原有工具栏按钮定义数组| - |                    |       | <strong>名称</strong> | <strong>类型</strong>             |                       |

### setActiveItem

<strong>作用:设置激活</strong><strong>tab</strong>

|                      | <strong>说明</strong>    | | ------------------------- | ---------------------<strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | ------------------------------- | ----------------------------- | ------------------------ |
| <strong>输入参数</strong> | -         ActiveItem            | String                |                       |
| <strong>返回值</strong>                        | -                     |                       |   | | <strong>返回值</strong>   | flexMenuItem          | [ [FlexMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#x2C5rV) ] |
系统原有的工具栏按钮定义 |

### removeItemgetActiveItem

<strong>作用:<<strong>作用:获取激活</strong><strong>tab</strong>删除指定下标的工具栏按钮strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | index                      |       number                | 所需删除按钮的下标                       |
| <strong>返回值</strong>   | -ActiveItem            | String                |                       |

### addItem

<strong>作用:添加组件选择区 Tab</strong>

|                           | <strong>名称</strong> ## IComponentSeletorArea | <strong>说明</strong>:组件选择区,可以对 Tab 进行增删改成,设置初始化默认 tab 等

![](https://wiki.smartbi.com.cn/download/attachments/115002469/JCmobNTLwoD3xUx8n56ccfxmnLh.png)

### removeItem

<strong>作用:移除组件选择区 tab</strong>

|<strong>类型</strong>                                                             | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | ----------------------- | ------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | indexcomponetSeletorAreaItem | [ComponetSeletorAreaItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg) |                       |
| <strong>返回值</strong>   | -     Init                  | -                                                                                     |                  | | <strong>返回值</strong>   |
-
### insertItem

<strong>作用:插入组件选择区 Tab</strong>

|              |             | <strong>名称</strong>   | <strong>类型</strong>     |                       |  ### setActiveItem 
<strong>作用:设置激活</strong><strong>tab</strong>  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | ----------------------- | ----------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | ActiveItem------------------- | --------------------- |
| <strong>输入参数</strong> | index                   | Int                                                                                   | String                       |
|                           | componetSeletorAreaItem | <strong>返回值</strong>   | -[ComponetSeletorAreaItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg) |                       |
| <strong>返回值</strong>   | -                   |    | -                  |  ### getActiveItem  <strong>作用:获取激活</strong><strong>tab</strong>  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> | | ------------------------- | --------------------- | --------------------- | --------------------- | | <strong>输入参数</strong> |               |        |               |

### getItems

作用:获取所有组件选择 Tab

|                        |   | <strong>返回值<<strong>名称</strong>   | ActiveItem<strong>类型</strong>              | String                |                       |  ### addItem  <strong>作用:添加组件选择区 Tab</strong>  |                           | <strong>名称</strong>   | <strong>类型</strong>                                                                 | <strong>说明</strong> |
| ------------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | componetSeletorAreaItem | [ComponetSeletorAreaItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg) |----------------------- | --------------------- |
| <strong>输入参数</strong> | -                       | -                                                                                       | | <strong>返回值</strong>   | -                       | -                                                              |                       |
| <strong>返回值</strong>   | componetSeletorAreaItem | Array[[ComponetSeletorAreaItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)](%5BComponetSeletorAreaItem%5D(https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)) |                       |

## IWidgetPanel

仪表盘组件选择面板对象,可对面板中显示的组件进行过滤

![](https://wiki.smartbi.com.cn/download/attachments/115002469/DNuYbCZhpoHiwSxJ5szcnO3CnXb.png)

### insertItemgetGroups

<strong>作用:插入组件选择区 Tab<<strong>作用:</strong>strong>获取组件类型分组信息

|                           | <strong>名称</strong>   | <strong>类型</strong>                                                                 | <strong>说明</strong> |
| ------------------------- | ----------------------- | ------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | indexstrong> | -                     |                                               | Int                                      |                       |
| <strong>返回值</strong>   | groups                | [ [WidgetGroup](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#YPZt48) ] | 组件类别信息          |

### getWidgetListByGroupId

<strong>作用:</strong>根据类型 id 获取该类型下的组件信息列表
|
|                           | componetSeletorAreaItem<strong>名称</strong> | [ComponetSeletorAreaItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg) |<strong>类型</strong>                                         | | <strong>返回值</strong>   | -                | <strong>说明</strong> |
    | -     | ------------------------- | --------------------- | ----------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | id                    |    string                                                        |                       | 类型 ###id getItems  作用:获取所有组件选择 Tab  |                          |
| <strong>名称<<strong>返回值</strong>   | <strong>类型</strong>infos                 | [ [WidgetInfo](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#d97BVN) ] | 组件信息              |

### setGroupWidget

<strong>作用:根据组件面板分类,添加分类内的组件</strong>

|                           | <strong>名称</strong>       | <strong>类型</strong>                                                                                 | <strong>说明</strong> |
| ------------------------- | ----------------------- | -------------------------             | <strong>说明</strong> |
| ------------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -Id                    | string  | -                                                                            | 类别 id               |
|                           | group                 | [ [WidgetGroup](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#YPZt48) ] | 组件类别信息          |
| <strong>返回值</strong>   | -                   |  |                     | | <strong>返回值</strong>   | componetSeletorAreaItem | Array[[ComponetSeletorAreaItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)](%5BComponetSeletorAreaItem%5D(https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)) |                       |  ## IWidgetPanel  仪表盘组件选择面板对象,可对面板中显示的组件进行过滤  ![](https://wiki.smartbi.com.cn/download/attachments/115002469/DNuYbCZhpoHiwSxJ5szcnO3CnXb.png)  ### getGroups  <strong>作用:</strong>获取组件类型分组信息  |                   |        | <strong>名称</strong> | <strong>类型</strong>            |

<strong>示例代码</strong>

```javascript
let list = iWidgetPanel.getWidgetListByGroupId("Chart")
 iWidgetPanel.setGroupWidget("test", list[0]) // 添加对应组组件
```

### removeGroup

<strong>作用:移除组件分类</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------ | --------------------- |
| <strong>输入参数</strong> | -Id                     | string                | 类别 id               |
|                            |                       |                       |  | <strong>返回值</strong>   | groups                |
[ [WidgetGroup](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#YPZt48) ]| <strong>返回值</strong>   | 组件类别信息-          |  ### getWidgetListByGroupId  <strong>作用:</strong>根据类型 id 获取该类型下的组件信息列表  |   |                        | <strong>名称</strong> | <strong>类型</strong>                    |

### removeWidget

<strong>作用:移除某个分类的某个组件</strong>

|                           | <strong>名称</strong>       | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | id                | Id     | string              | string                | 类别 id               |
|                           | type | 类型 id               | |string <strong>返回值</strong>   | infos           | 组件类型     | [ [WidgetInfo](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#d97BVN) ] | 组件信息    |
| <strong>返回值</strong>   | -    |  ### setGroupWidget  <strong>作用:根据组件面板分类,添加分类内的组件</strong>  |          |                 | <strong>名称</strong> | <strong>类型</strong>   |                       |

### swapGroup

<strong>作用:切换分类位置</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------ | --------------------- |
| <strong>输入参数</strong> | IdfromIndex                    | stringInt                   |                              |
|                              | 类别 idtoIndex               | |  Int                         | group                 | [ [WidgetGroup](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#YPZt48) ] | 组件类别信息                       |
| <strong>返回值</strong>   | -                     |                       |                       |

## IPage

仪表盘页面对象,对象中存放着仪表盘的所有组件,可通过该对象获取组件或进行打开菜单等页面操作。

![](https://wiki.smartbi.com.cn/download/attachments/115002469/BwGobS4G1oKnVgx7YF3cLIaGn0e.png)

### getActivePortlet

<strong>作用:</strong>获取当前选中的组件

|                           | <strong>名称</strong> | <strong>类型</strong>                          |       <strong>示例代码</strong>  ```javascript let list = iWidgetPanel.getWidgetListByGroupId("Chart")  iWidgetPanel.setGroupWidget("test", list[0]) // 添加对应组组件 ```  ### removeGroup  <strong>作用:移除组件分类</strong>  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     | | <strong>输入参数</strong> | Id                    | string                | 类别 id               | |                           |                   |    |                   |
| <strong>返回值</strong>   | activePortlet         | [IPortlet](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5) | 当前选中的组件对象    |

### getPortlets

<strong>作用:</strong>获取所有组件

|  |  <strong>返回值</strong>   | -                   | <strong>名称</strong> | <strong>类型</strong>                       |                          |  ### removeWidget  <strong>作用:移除某个分类的某个组件</strong>  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | Id------ |
| <strong>输入参数</strong> | -                     |                                               | string                | 类别 id               | |                           |      type                 |
| string <strong>返回值</strong>   | portlets              | 【[IPortlet](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5)】 | 组件类型所有组件              |

### |getPortletById

<strong>返回值<<strong>作用:</strong>strong>根据 id 获取对应组件

|        -                   | <strong>名称</strong> | <strong>类型</strong>                      |                           |  ### swapGroup  <strong>作用:切换分类位置</strong>  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | fromIndex--- |
| <strong>输入参数</strong> | id                    | String               | Int                   |                       | |                           | toIndex               | 组件 Intid               |
| <strong>返回值</strong>   | portlet               | 【[IPortlet](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5)】 | 组件对象              |
| <strong>返回值</strong>
### isMobileDevice

<strong>作用:</strong>获取当前是否为手机布局

 | -                     |     | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> |  -                     |  ## IPage  仪表盘页面对象,对象中存放着仪表盘的所有组件,可通过该对象获取组件或进行打开菜单等页面操作。  ![](https://wiki.smartbi.com.cn/download/attachments/115002469/BwGobS4G1oKnVgx7YF3cLIaGn0e.png)  ### getActivePortlet  <strong>作用:</strong>获取当前选中的组件  |         |                  | <strong>名称</strong> | <strong>类型</strong>  |
| <strong>返回值</strong>   | isMobile              | boolean               | 当前是否为手机布局    |

### getPageId

<strong>作用</strong>: 获取页面 ID

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                         |                       |
| <strong>返回值</strong>   | activePortlet         | [IPortlet](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5) | 当前选中的组件对象strong>   | id        |  ### getPortlets  <strong>作用:</strong>获取所有组件  |     | string                | 当前是否为手机布局    | <strong>名称</strong>

### getSettingPanel

<strong>作用:</strong>获取设置面板对象

| <strong>类型</strong>                          | <strong>名称</strong> | <strong>类型</strong>                                                              | <strong>说明</strong> |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                             |                       |
| <strong>返回值</strong>   | portletsiSettingPanel              | [IPortletISettingPanel](https://smartbi.feishu.cn/docxdocs/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5doccnd0RTRACnIwLJwmzRCX1d5d#FnZIcS) | 所有组件    设置面板对象          |

### getPortletByIdgetPageToolbar

<strong>作用:</strong>根据strong>获取浏览态页面工具栏对象
id
获取对应组件

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                       | <strong>说明</strong> |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | - id                    | String                                                                           |                           | 组件 id               |
| <strong>返回值</strong>   | portlet   | PageToolbar           | [IPortletIPageToolbar](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-Mig8dG7bKomvm3xM5jmcvOxDnA5WhyUdyHAcomRsAxTe3WcJbaDnQg) | 组件对象对象浏览态页面工具栏              |

### isMobileDevicedoRefresh

<strong>作用:<<strong>作用:刷新仪表盘</strong>获取当前是否为手机布局strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                       |                       |
| <strong>返回值</strong>   | isMobile                       | boolean                       | 当前是否为手机布局                       |

### getPageIdexecExport

<strong>作用</strong>:strong>:调用系统导出, 获取页面不提供exportSetting时会弹窗, ID提供了就不弹窗

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                      |
| ------------------------- | --------------------- | --------------------- | ------------------------------------------ |
| <strong>输入参数</strong> | options                | Object            | -                     |          | 选项 |
| | options.portletId | String | 组件ID, 当是页面导出时, portletId不需要提供 |
| | options.exportType | String | 导出类型, EXCEL或PNG或PDF |
| | options.exportSetting | [ExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd) | 导出选项默认值<br>所有选项都是可选的, 不提供时, 使用默认值, 如下是默认值<br>withDataFormat= EXCEL时是'true', 否则是'false'<br>mergeCells='true'<br>exportRows=-1 // 不限制, 以系统选项设置为准<br>exportMode='online'<br>fileName=资源别名_yyyyMMdd_HHmm |
| <strong>返回值</strong>   | -                 |    |  -                 | | <strong>返回值</strong>   | id-                    | string                | 当前是否为手机布局    |

### getSettingPanelexecExportWithSetting

<strong>作用:</strong>获取设置面板对象<strong>作用</strong>:根据导出设置导出组件或页面, 不会弹窗

|                           | <strong>名称</strong> | <strong>类型</strong>                         | <strong>说明</strong>                                     | <strong>说明</strong>
| | ------------------------- | --------------------- | ----------------------------------------------------- | ----------------------------- | --------------------- |
| <strong>输入参数</strong> | - options                | Object                | 选项 |
| | options.portletId | String | 组件ID, 当是页面导出时, portletId不需要提供 |
| | options.exportType | String | 导出类型, EXCEL或PNG或PDF |
| | options.setting | [ExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd) | 导出选项默认值<br>所有选项都是可选的, 不提供时, 使用默认值, 如下是默认值<br>withDataFormat= 'true'<br>mergeCells='true'<br>exportRows=-1 // 不限制, 以系统选项设置为准<br>exportMode='online'<br>fileName=资源别名 |
| <strong>返回值</strong>   | -                     |      -                     |       -                | | <strong>返回值</strong>   | iSettingPanel         | [ISettingPanel](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#FnZIcS) | 设置面板对象          |

### getPageToolbarexecGenerateExportSetting

<strong>作用:<<strong>作用</strong>获取浏览态页面工具栏对象strong>:生成导出设置项配置

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                    |
<strong>说明</strong> |
| ------------------------- | --------------------- | -------------------------------- | ------------------------------------------ |
--------------------- | | <strong>输入参数</strong> | -options                     | Object                | 选项 |
|                                                        |                      | options.portletId | String | 组件ID, 当是页面导出时, portletId不需要提供 |
| | options.exportType | String | 导出类型, EXCEL或PNG或PDF |
| | options.setting | [ExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd) | 导出选项默认值<br>所有选项都是可选的, 不提供时, 使用默认值, 如下是默认值<br>withDataFormat= EXCEL时是'true', 否则是'false'<br>mergeCells='true'<br>exportRows=-1 // 不限制, 以系统选项设置为准<br>exportMode='online'<br>fileName=资源别名_yyyyMMdd_HHmm |
| <strong>返回值</strong>   | PageToolbar           ExportSetting | [IPageToolbarExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQgWhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd) | 对象浏览态页面工具栏导出选项默认值  |

### doRefreshexecOpenExportSettingDialog

<strong>作用:刷新仪表盘<<strong>作用</strong>strong>:打开导出弹窗

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                      |
| ------------------------- | --------------------- | --------------------- | ------------------------------------------ |
| <strong>输入参数</strong> | -options                     | Object                | 选项 |
| | options.portletId | String | 组件ID, 当是页面导出时, portletId不需要提供                  |
| | <strong>返回值</strong>   |                       |                       |                       |

### execExport

<strong>作用</strong>:执行导出options.exportType | String | 导出类型, EXCEL或PNG或PDF |
| | options.setting | [ExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd) | 导出选项默认值<br>所有选项都是可选的, 不提供时, 使用默认值, 如下是默认值<br>withDataFormat= EXCEL时是'true', 否则是'false'<br>mergeCells='true'<br>exportRows=-1 // 不限制, 以系统选项设置为准<br>exportMode='online'<br>fileName=资源别名_yyyyMMdd_HHmm |
| | callback | Function | 弹窗回调, 输入是ExportSetting, 只有点击确认才会执行 |
| <strong>返回值</strong>   | -- | -- | -- |

### execGetExportSetting

<strong>作用</strong>:获取导出接口入参

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                      |
| ------------------------- | --------------------- | --------------------- | ------------------------------------------ |
| <strong>输入参数</strong> | parmasoptions                | objectObject                | parmas 由 exportType, portletId 组成的对象 选项 |
| | <strong>返回值</strong>  options.portletId | String | -组件ID, 当是页面导出时, portletId不需要提供 |
| | options.exportType | String | 导出类型, EXCEL或PNG或PDF |
| | options.setting     | [ExportSetting](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#doxcnxw2KlDpeGZpIoFql3Qv1sd) | -导出选项默认值<br>所有选项都是可选的, 不提供时, 使用默认值, 如下是默认值<br>withDataFormat= 'true'<br>mergeCells='true'<br>exportRows=-1 // 不限制, 以系统选项设置为准<br>exportMode='online'<br>fileName=资源别名              | -                                         |
| | callback | Function | 方法回调<br>入参可能是 false 或 { exportData, doAfterExport }<br>是false时, 即创建临时页面失败, 不能导出 (仅在线导出)<br>exportData是后端导出接口的入参, 详见[ExportOption](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#UUYGdlmPKoeZRxxOaxGcvEyRnuh)<br>doAfterExport用于删除临时页面, 请在导出完毕后确保调用 |
| <strong>返回值</strong>   | -- | -- | 无返回值, 通过callback形式使用 |

### getPageMode

<strong>作用:获取仪表盘状态,编辑态或者是预览态</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                       |                       |
| <strong>返回值</strong>   | mode                  | String                | view 或者是 edit      |

### getPageInfo

<strong>作用:获取仪表盘资源信息</strong>

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                   | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                         |                       |
| <strong>返回值</strong>   | pageInfo              | [PageInfo](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-MyIPdvNOKo7mRrxEjt0cbCLxnLf) |                       |

## ISaveDialog

资源保存弹窗对象,可删除操作按钮(上一级和创建文件夹)或指定可保存的目录

![](https://wiki.smartbi.com.cn/download/attachments/115002469/E5PWbHYiGojlLBxWypqcqyGynPf.png)

### setOperateButtonFilter

<strong>作用:</strong>过滤右上角的操作按钮

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>              |
| ------------------------- | --------------------- | --------------------- | ---------------------------------- |
| <strong>输入参数</strong> | filterFunc            | function              | 过滤方法,第一个参数为操作按钮信息 |
| <strong>返回值</strong>   | -                     |                       |                                    |

### setRootNodeId

<strong>作用:</strong>设置资源树中的根节点 id,设置后只可查看或查找该节点下的文件或资源

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | id                    | string                | 节点 id               |
| <strong>返回值</strong>   | -                     |                       |                       |

### setNodeFilter

<strong>作用:</strong>根据自定义的白名单或黑名单对显示节点进行过滤

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                                               |
| ------------------------- | --------------------- | --------------------- | --------------------------------------------------------------------------------------------------- |
| <strong>输入参数</strong> | filterFunc            | function              | 过滤方法,第一个参数为 [NodeItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#f5wbus) |
| <strong>返回值</strong>   | -                     |                       |                                                                                                     |

### setSearchNodeFilter

<strong>作用:</strong>根据自定义的白名单或黑名单对搜索节点进行过滤

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                                                     |
| ------------------------- | --------------------- | --------------------- | --------------------------------------------------------------------------------------------------------- |
| <strong>输入参数</strong> | filterFunc            | function              | 过滤方法,第一个参数为 [SearchNodeItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#DFWOZR) |
| <strong>返回值</strong>   | -                     |                       |                                                                                                           |

## ISettingPanel

组件设置面板对象,可对组件设置面板 tab,激活、添加、移除等操作

![](https://wiki.smartbi.com.cn/download/attachments/115002469/QD0Vb1PZkofbp2xLHXGc9iFFnNc.png)

### getItems

<strong>作用:</strong>获取所有设置面板项

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                                                                              | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                                                                                    |                       |
| <strong>返回值</strong>   | settingPanelItems     | Array[[SettingPanelItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)](SettingPanelItem%5D(https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg)) | 获取到所有设置面板项  |

### addItem

<strong>作用:</strong>添加设置面板项

|                           | <strong>名称</strong> | <strong>类型</strong>                                                          | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------ | --------------------- |
| <strong>输入参数</strong> | settingPanelItems     | [SettingPanelItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg) |                       |
| <strong>返回值</strong>   | -                     | -                                                                              |                       |

### insertItem

<strong>作用:</strong>添加设置面板项

|                           | <strong>名称</strong> | <strong>类型</strong>                                                          | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------ | ------------------------ |
| <strong>输入参数</strong> | 序号 |
| <strong>输入参数</strong> | 序号                  | Int                                                                            |                       |
|                           | settingPanelItems     | [SettingPanelItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg) |                       |
| Int<strong>返回值</strong>   | -                     | -                                                  |                       | |    |                       |
settingPanelItems
### setActiveItem

<strong>作用</strong>:激活设置面板 tab

| [SettingPanelItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg) |                           | <strong>名称</strong> | <strong>返回值<<strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | activeName            | - String                |                       |
| <strong>返回值</strong>   | -                     | -                     |                       |

### setActiveItemgetActiveItem

<strong>作用</strong>:激活设置面板strong>:获取激活设置面板 tab

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | - |
| <strong>输入参数</strong> | activeName                     |      | String                |                       |
| <strong>返回值</strong>   | -activeName            | String        | -       |              |         |

## IPortlet

         |

### getActiveItem

<strong>作用</strong>:获取激活设置面板 tab![](https://wiki.smartbi.com.cn/download/attachments/115002469/GSksbYiQxovJbVxat5Vc7M3in2f.png)

仪表盘组件对象,可获取组件工具栏、存储值等

### getStoreValue

<strong>作用:</strong>获取存储在组件中的值

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | -key                     | String                      |             存储值的 key          |
| <strong>返回值</strong>   | activeNamevalue            | String    | any           |        | 存储的值              |

##
IPortlet

![](https://wiki.smartbi.com.cn/download/attachments/115002469/GSksbYiQxovJbVxat5Vc7M3in2f.png)

仪表盘组件对象,可获取组件工具栏、存储值等

### getStoreValue### setStoreValue

<strong>作用:</strong>获取存储在组件中的值strong>存储值在组件中

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | key                   | String                | 存储值的 key          |
|                           | |value <strong>输入参数</strong> | key              | any    | String              | 存储的值 |  存储值的 key          |
| <strong>返回值</strong>   | -    value                 |   any                    | 存储的值                       |

### setStoreValueisAsFilter

<strong>作用:</strong>存储值在组件中strong>当前是否作为筛选器

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | key-                   | String |               | 存储值的 key      |    | |                  |
| <strong>返回值</strong>   | asFilter   | value          | Boolean      | any        | 是否作为筛选器        |

|### 存储的值getPortletToolbar

<strong>作用:</strong>获取组件工具栏

|          | | <strong>返回值</strong>   | -           | <strong>名称</strong> | <strong>类型</strong>       |                       |                       |  ### isAsFilter  <strong>作用:</strong>当前是否作为筛选器  |                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------- | ----------------------- |
| <strong>输入参数</strong> | ------ |
| <strong>输入参数</strong> | -                     |                              |                       |                       | | <strong>返回值</strong>   | asFilter              | Boolean               | 是否作为筛选器                 |  ### getPortletToolbar  <strong>作用:</strong>获取组件工具栏 |
| <strong>返回值</strong>   | iPortletToolbar       | [IPortletToolbar](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-YudDdQWwmoKGaAxQfNNcplFMnng) | 组件工具栏            |

### <strong>名称<<strong>getPortletState</strong>

<strong>作用</strong>:获取组件状态接口对象

| <strong>类型</strong>                          | <strong>名称</strong> | <strong>类型</strong>                                                              | <strong>说明</strong> |
| ------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                                |                       |
| <strong>返回值</strong>   | iPortletToolbariPortletState         | [IPortletToolbariPortletState](https://smartbi.feishu.cn/docxdocs/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-YudDdQWwmoKGaAxQfNNcplFMnngdoccnd0RTRACnIwLJwmzRCX1d5d#Lr6WbM) | 组件工具栏组件状态接口对象            |

### <strong>getPortletState<<strong>getType</strong>

<strong>作用</strong>:获取组件状态接口对象strong>:获取组件类型

|                           | <strong>名称</strong> | <strong>类型</strong>                                                              | <strong>说明</strong> |
| ------------------------- | --------------------- | ---------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                    |                       |
| <strong>返回值</strong>   | iPortletStatetype         | [iPortletState](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#Lr6WbM)String | 组件状态接口对象组件类型      |

## IPortletState

<strong>作用</strong>:获取组件的状态

### getFilterValues

作用:获取筛选值

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                       |                       |
| <strong>返回值</strong>   | filterValues          | Array                 | 筛选值                |

## IPortletToolbar

组件工具栏,可加载工具栏按钮

![](https://wiki.smartbi.com.cn/download/attachments/115002469/JlVebev30opwQxxXLr3cEZbtnug.png)

### addItem

<strong>作用:</strong>添加工具栏按钮

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | toolbarItem           | ToolbarItem           | 添加按钮的定义        |
| <strong>返回值</strong>   | -                     |                       |                       |

### insertItem

<strong>作用:</strong>在工具栏插入按钮

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | index                 | number                | 插入位置              |
|                           | toolbarItem           | ToolbarItem           | 添加按钮的定义        |
| <strong>返回值</strong>   | -                     |                       |                       |

### getItems

<strong>作用:</strong>获取系统原有工具栏按钮定义数组

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>    |
| ------------------------- | --------------------- | --------------------- | ------------------------ |
| <strong>输入参数</strong> | -                     |                       |                          |
| <strong>返回值</strong>   | toolbarItem           | [ ToolbarItem ]       | 系统原有的工具栏按钮定义 |

### removeItem

<strong>作用:</strong>删除指定下标的工具栏按钮

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | index                 | number                | 所需删除按钮的下标    |
| <strong>返回值</strong>   | -                     |                       |                       |

### removeItemById

<strong>作用</strong>:删除指定 id 工具栏按钮

|                           | Id | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --- | --------------------- | --------------------- |
| <strong>输入参数</strong> | id | String                | 所需删除按钮的 id     |
| <strong>返回值</strong>   | -  |                       |                       |

## IPopMenu

组件菜单,可加减组件菜单项

![](https://wiki.smartbi.com.cn/download/attachments/115002469/TonobTdcWo5tetxdKBocXOBRn0d.png)

### addItem

<strong>作用:</strong>添加组件菜单按钮

|                           | <strong>名称</strong> | <strong>类型</strong>                                                            | <strong>说明</strong> |
| ------------------------- | --------------------- | -------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | toolbarItem           | [PopMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#zN6taE) | 添加按钮的定义        |
| <strong>返回值</strong>   | -                     |                                                                                  |                       |

### insertItem

<strong>作用:</strong>在组件菜单插入按钮

|                           | <strong>名称</strong> | <strong>类型</strong>                                                            | <strong>说明</strong> |
| ------------------------- | --------------------- | -------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | index                 | number                                                                           | 插入位置              |
|                           | toolbarItem           | [PopMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#zN6taE) | 添加按钮的定义        |
| <strong>返回值</strong>   | -                     |                                                                                  |                       |

### getItems

<strong>作用:</strong>获取系统原有组件菜单按钮定义数组

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                | <strong>说明</strong>    |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------ | ------------------------ |
| <strong>输入参数</strong> | -                     |                                                                                      |                          |
| <strong>返回值</strong>   | toolbarItem           | [ [PopMenuItem](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#zN6taE) ] | 系统原有的工具栏按钮定义 |

### removeItem

<strong>作用:</strong>删除指定下标的组件菜单按钮

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | index                 | number                | 所需删除按钮的下标    |
| <strong>返回值</strong>   | -                     |                       |                       |

## IPageThemePanel

主题面板接口对象,可以过滤面板

### filterSettingGroup

<strong>作用</strong>:过滤主题面板内容

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                                                         |
| ------------------------- | --------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------- |
| <strong>输入参数</strong> | filterFunc            | function              | 过滤方法,第一个参数为 [FilterSettingGroup](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#zW8wjx) |
| <strong>返回值</strong>   | -                     |                       |                                                                                                               |

## IGlobal

二开全局接口对象,提供系统功能 如弹框

### getLayer

<strong>作用</strong>:获取系统弹窗功能

|                           | <strong>名称</strong>                                                       | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------------------------------------------------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> |                                                                             |                       |                       |
| <strong>返回值</strong>   | [ILayer](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#Wdz41K) |                       |                       |

## ILayer

<strong>详细接口文档</strong>:[SmartbiX-弹出框插件 Layer](https://smartbi.feishu.cn/wiki/wikcnZqsPjb3B5a2t9QEPXznuah)

### iframe

<strong>作用</strong>:打开弹窗组件

|                           | <strong>名称</strong>                                                       | <strong>类型</strong>                                                            | <strong>说明</strong> |
| ------------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | title                                                                       | string                                                                           | 弹窗标题              |
| <strong>输入参数</strong> | option                                                                      | [layerOPtion](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#YBqlwo) | 弹窗配置参数          |
|                           |                                                                             |                                                                                  |                       |
| <strong>返回值</strong>   | [ILayer](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#Wdz41K) |                                                                                  |                       |

# 实体对象

## <strong>PageInfo</strong>

```javascript
{
    id: String, //资源id
    name: String, //资源名称
    desc: String,//资源描述
    alia: String//资源别名
}
```

## ComponetSeletorAreaItem

```javascript
component: ƒ VueComponent(resolve) // vue组件
icon: "sx-icon-left-sidebar-components" // 图标
id: "COMPONENT" //id
label: "组件" //描述
```

## ActiveShrinkBarItem

```javascript
{
    groupId: 'SHRINK_DATA', //分类id
    active: 'DATA'//激活项
}
```

## ShrinkGroupItem

```javascript
{
    groupId: 'SHRINK_DATA'
    items: [
        id: 'ThEME',
        lable:"主题"
        component:String|Ojbect|Function //vue组件
    ]
}
```

## SettingPanelItem

```javascript
{
    id: 'ThEME',
    lable:"主题"
    component:String|Ojbect|Function //vue组件
}
```

## ToolbarItem

```javascript
{
  id, // 按钮id
  label, // 按钮提示
  icon, // 按钮图标
  handler, // 点击按钮时的回调方法
  children // 按钮的子菜单,配置后可弹出子项
}
```

## <strong>PortletToolbarItem</strong>

```javascript
{
   id: 'MOVE',
   label: // 图标标签,
   tip: //图标提示,
   itemClass: //图标类名
   icon: //图标
   click //点击按钮时的回调方法
}
```

## WidgetGroup

```javascript
{
  id, // 类型id
  title, // 类型标题
  icon // 类型图标
}
```

## FilterSettingGroup

```javascript
{
  id, // 类型id
  title, // 类型标题
}
```

## WidgetInfo

```javascript
{
  type, // 组件类型,也是组件的唯一id
  subType, // widgetGroup下的子类型id
  title, // 组件名称
  icon, // 组件图标
  class // 组件图片样式类
}
```

## NodeItem

```javascript
{
  id, // 节点id
  label, // 节点名称
  type // 节点类型
}
```

## SearchNodeItem

```javascript
{
  id, // 节点id
  label, // 节点名称
  type, // 节点类型
  lablePath, // label的路径,如["分析报表", "system", "分析报表"]
  idPath // id的路径,如["PUBLIC_ANALYSIS", "I8a8a4...", ""I8a8a4...""]
}
```

## PopMenuItem

```javascript
{
  id, // 菜单id
  label, // 菜单显示名
  closeOnClick, // 点击后是否关闭菜单
  handler // 点击按钮时回调方法
}
```

## LayerOption

```coffeescript
{
    content: {
      content:  xxx.vue //业务组件  ,
      parent: this,
      data: { // 组件接受的props
        apply: (result) => {
         
        },
        cancel: () => {
         
        }
      }
    },
    resize: true,
    area: ['800px','600px'],
    afterResize
   }
```

# 二开框架内置对象

## Utils:

作用:提供二开相关工具类 如添加 css js 等功能

场景用例:[仪表盘二开外部资源使用文档](https://smartbi.feishu.cn/docs/doccnrJuqVvUOZjpGhSooqGFkkb?from=space_search)

```cpp
{
    `ExtensionUtil`:ExtensionUtil: { // 二开相关工具
       [documentLoadResource](https://smartbi.feishu.cn/docs/doccnrJuqVvUOZjpGhSooqGFkkb?from=space_search) // 加载页面基础资源方法
    } 
}
```

## Lang

作用:国际化对象

```javascript
{
    $t:function //国际化
}
```

## Libs

作用:提供开发者一些常用工具

```javascript
`{`
    `LodashLodash,`
    `DebounceDebounce,`
    `Axios`Axios
}
```

## DashModule

作用:提供开发者仪表盘的扩展基础功能以及时间枚举

```javascript
`{`
    `BaseDashExtenderBaseDashExtender,` // 仪表盘基础扩展基类
    `DashEventEmum`DashEventEmum // 仪表盘事件枚举
}
```

## InterfaceObject

作用:二开全局的接口对象,提供获取弹窗接口对象等功能

```nginx
`{`
    `IGlobal`IGlobal // 包含获取弹窗功能
}
```

## Frameworks

作用:提供二开内部基础框架

```nginx
`{`
    `ECharts`ECharts // echart对象
}
```