https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg


# 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

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

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

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                               | <strong>说明</strong>       |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------- | --------------------------- |
| <strong>输入参数</strong> | iPage                 | [Page](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-FhZ2dC41poeqF6xOoLBcCYPrnef) | 页面对象                    |
|                           | params                | object                                                                                              | 导出需要的参数(类型和 id) |
| <strong>返回值</strong>   | -                     |                                                                                                     |                             |

### PAGE_ON_PORTLET_BEFORE_EXPORT

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

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

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

## AugmentedDataSet 数据模型接口

### AUGMENTEDDATASET_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>   | -                     |                                                                                                            |                       |

<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

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

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

### getToolbar

<strong>作用:</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> |
| ------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------- | --------------------- |
| <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>返回值</strong>   | IComponentSeletorArea | IComponentSeletorArea | <strong>组件选择面板对象</strong> |

### switchTheme

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

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                     |
| ------------------------- | --------------------- | --------------------- | ----------------------------------------- |
| <strong>输入参数</strong> | themeId               | string                | 主题 id                                   |
|                           | warnHasChange         | boolean               | 若主题已修改,切换时进行提示,默认为 true |
| <strong>返回值</strong>   | -                     |                       |                                           |

### <strong>isNewDashboard</strong>

<strong>作用:判断当前仪表盘是否为新建仪表盘</strong>

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                       |                       |
| <strong>返回值</strong>   | isNew                 | boolean               | 是否为新建仪表盘      |

### <strong>getPageDatasetIds</strong>

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

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

### saveAsCopy

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

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                   | <strong>说明</strong>                                          |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| <strong>输入参数</strong> | pageInfo              | [PageInfo](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg#part-LegDdrEePogZlHxIPo5cDXEUnyf) |                                                                |
|                           | folderId              | String                                                                                                  | 目录 id                                                        |
|                           | coverId               | String                                                                                                  | 需要被覆盖的资源 id (如果为 null 就是新建,如果有值就是覆盖) |
| <strong>返回值</strong>   | -                     |                                                                                                         |                                                                |

## IShrinkBar

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

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

### setActiveItems

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

|                           | <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>   | -                     |                                                                                                                                                                             |                       |

### getActiveItems

<strong>作用:</strong>获取当前所选中的 tab

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

### getItems

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

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                                                                               | <strong>说明</strong> |
| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                                                                                                     |                       |
| <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>                                                                                        | <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>   | -                     |                       |                                    |

### getCurrentDatasetId

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

|                           | <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>   | -                     |                       |                       |

### openDatasetSeletor

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

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

### getDatasetSeletor

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

|                           | <strong>名称</strong> | <strong>类型</strong>                                                                                           | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------- |
| <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                    | String                | 弹窗根节点            |
| <strong>返回值</strong>   | 无                    |                       |                       |

### setNodeFilter

作用: 设置节点过滤方法

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                                                                                                                                             |
| ------------------------- | --------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <strong>输入参数</strong> | filterFunc            | Function              | 自定义过滤节点方法,方法入参:item,结构如下 ``typescript[{    id: 资源id,    label: 资源名称,    type: 资源类型}]`` 方法返回 true 则保留,返回 false 则移除 |
| <strong>返回值</strong>   | -                     |                       |                                                                                                                                                                   |

### setSearchNodeFilter

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

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

## IDashToolbar

仪表盘工具栏对象,可对仪表盘工具栏按钮进行添加或删除。

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

### addItem

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

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

### insertItem

<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>   | -                     |                                                                                  |                           |

### getItems

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

|                           | <strong>名称</strong> | <strong>类型</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                 | number                | 所需删除按钮的下标        |
|                           | groupIndex            | Int                   | 目标查询组序号,从 0 开始 |
| <strong>返回值</strong>   | -                     |                       |                           |

## IPageToolbar

浏览态仪表盘工具栏对象

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

### addItem

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

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

### insertItem

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

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

### getItems

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

|                           | <strong>名称</strong> | <strong>类型</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>   | -                     |                       |                       |

## 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>   | -                     |                       |                       |

### setActiveItem

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

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

### getActiveItem

<strong>作用:获取激活</strong><strong>tab</strong>

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

### addItem

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

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

### insertItem

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

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

### getItems

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

|                           | <strong>名称</strong>   | <strong>类型</strong>                                                                                                                                                               | <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)

### getGroups

<strong>作用:</strong>获取组件类型分组信息

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

### getWidgetListByGroupId

<strong>作用:</strong>根据类型 id 获取该类型下的组件信息列表

|                           | <strong>名称</strong> | <strong>类型</strong>                                                               | <strong>说明</strong> |
| ------------------------- | --------------------- | ----------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | id                    | string                                                                              | 类型 id               |
| <strong>返回值</strong>   | infos                 | [ [WidgetInfo](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#d97BVN) ] | 组件信息              |

### setGroupWidget

<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>

```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>   | -                     |                       |                       |

### removeWidget

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

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | Id                    | string                | 类别 id               |
|                           | type                  | string                | 组件类型              |
| <strong>返回值</strong>   | -                     |                       |                       |

### swapGroup

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

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | fromIndex             | Int                   |                       |
|                           | toIndex               | Int                   |                       |
| <strong>返回值</strong>   | -                     |                       |                       |

## IPage

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

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

### getActivePortlet

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

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

### getPortlets

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

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

### getPortletById

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

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

### isMobileDevice

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

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

### getPageId

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

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

### getSettingPanel

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

|                           | <strong>名称</strong> | <strong>类型</strong>                                                              | <strong>说明</strong> |
| ------------------------- | --------------------- | ---------------------------------------------------------------------------------- | --------------------- |
| <strong>输入参数</strong> | -                     |                                                                                    |                       |
| <strong>返回值</strong>   | iSettingPanel         | [ISettingPanel](https://smartbi.feishu.cn/docs/doccnd0RTRACnIwLJwmzRCX1d5d#FnZIcS) | 设置面板对象          |

### getPageToolbar

<strong>作用:</strong>获取浏览态页面工具栏对象

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

### doRefresh

<strong>作用:刷新仪表盘</strong>

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

### execExport

<strong>作用</strong>:执行导出

|                           | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong>                      |
| ------------------------- | --------------------- | --------------------- | ------------------------------------------ |
| <strong>输入参数</strong> | parmas                | object                | parmas 由 exportType, portletId 组成的对象 |
| <strong>返回值</strong>   | -                     | -                     | -                                          |

### 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> | 序号                  | Int                                                                            |                       |
|                           | settingPanelItems     | [SettingPanelItem](https://smartbi.feishu.cn/docx/WhyUdyHAcomRsAxTe3WcJbaDnQg) |                       |
| <strong>返回值</strong>   | -                     | -                                                                              |                       |

### setActiveItem

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

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

### getActiveItem

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

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

## IPortlet

![](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>   | value                 | any                   | 存储的值              |

### setStoreValue

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

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

### isAsFilter

<strong>作用:</strong>当前是否作为筛选器

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

### getPortletToolbar

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

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

### <strong>getPortletState</strong>

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

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

## 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`: { // 二开相关工具
       [documentLoadResource](https://smartbi.feishu.cn/docs/doccnrJuqVvUOZjpGhSooqGFkkb?from=space_search) // 加载页面基础资源方法
    } 
}
```

## Lang

作用:国际化对象

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

## Libs

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

```javascript
`{`
    `Lodash,`
    `Debounce,`
    `Axios`
}
```

## DashModule

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

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

## InterfaceObject

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

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

## Frameworks

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

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