当前位置: 首页 > news >正文

衡石科技技术手册--仪表盘过滤控件详解

过滤控件说明 

过滤控件 的定义 

过滤控件用于在仪表盘中过滤图表数据,分为仪表盘内过滤控件和全局过滤控件。

过滤控件结构说明 
字段类型描述
uidSTRING过滤控件唯一识别 id
appIdLONG过滤控件所属的应用 id
dataAppIdLONG字段来源是数据包时的数据包 id
dashboardIdLONG过滤控件所属的仪表盘 id
datasetIdLONG过滤控件所是用的字段所属的数据集 id
titleSTRING过滤控件标题
filterTypeSTRING过滤控类型,可选值为:FILTER(过滤控件),FILTER_BTN(过滤按钮),PARAM(参数控件),MULTIPLE_DATE_PARAM(日期多选过滤控件)
fieldNameSTRING过滤器所用的字段名称
fieldOBJECT过滤器所用的字段配置
useSTRING过滤器过滤样式,默认传"checkbox"即可
kindOBJECT过滤器表达式类型,默认传"formula"即可
opOBJECT过滤器表达式,默认传"1=1"即可
optionsOBJECT过滤控件样式相关配置
options.styleOBJECT过滤控件样式配置
options.titleStyleOBJECT过滤控件标题样式配置
childrenLIST子过滤控件集合,list中的值为子控件的uid
isGlobalFilterBOOLEAN过滤控件是否为全局控件
controllerMAP过滤按钮控制的过滤控件映射表,key为要控制的过滤控件uid,value为boolean值:true(控制)
byDashboardOBJECT全局过滤器在各仪表盘中的样式设置
childrenByDashboardOBJECT全局过滤器与各仪表盘中的过滤控件的父子关系

接口说明 

新增过滤控件 

新增过滤控件

请求URL 

http

POST /api/apps/${appId}/filter-controllers HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数 
URL 参数 
字段类型是否必须说明
appIdINTEGER过滤控件所在的应用 id
Request Body 参数 

过滤控件配置信息,见过滤控件结构

返回对象的格式说明 
字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT过滤控件的完整配置信息,见过滤控件结构
接口示例1: 新增仪表盘内过滤控件 

http

POST /api/apps/1/filter-controllers HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...// Request Body:
{"title": "新建过滤器","options": {"titleStyle": {"textAlign": "center","position": "left"},"style": {"method": "select","itemStyle": {"borderTopColor": "#dadada","borderRightColor": "#dadada","borderBottomColor": "#dadada","borderLeftColor": "#dadada","maxHeight": 28,"background": "#fff"}}},"filterType": "filter","fieldName": "director","field": {"datasetId": 1,"fieldName": "director","tags": {},"defaultAggrType": "count","comment": "","type": "string","config": {},"originType": "string","visible": true,"nativeType": "bpchar","hideValue": false,"detectedType": "string","suggestedTypes": ["string"],"basicType": "string","dataAppId": 130713,"_ukey": "director","labelOrigin": "director"},"use": "checkbox","kind": "formula","op": "1=1","appId": 1,"uid": "01HJ0TE602Z2VERDA4CMY4JR59","dataAppId": 1,"datasetId": 1,"dashboardId": 1,"dashboardOptions": {"layouts": {"1": {"static": false,"w": 4,"moved": false,"h": 4,"x": 1,"i": "1","y": 1,"type": "chart","zIndex": 902,"options": {}},"01HJ0TE602Z2VERDA4CMY4JR59": {"i": "01HJ0TE602Z2VERDA4CMY4JR59","x": 1,"y": 1,"w": 4,"h": 1,"moved": false,"static": false,"zIndex": 904,"type": "filter"}}}
}

说明

dashboardOptions.layouts为过滤控件在仪表盘内的样式配置,layouts为MAP类型,key是过滤控件uid或图表id,value为具体的样式配置,请注意,这里的options.layouts每次都需要传递完整的layouts而不是仅传当前新增的控件样式,如:仪表盘内已有一个图表和一个过滤控件,那么新增过滤控件时,layouts中应该有三个键值对,分别对应两个过滤控件和一个已有图表的样式。

接口示例2: 新增仪全局过滤控件 

http

POST /api/apps/1/filter-controllers HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...// Request Body:
{"title": "全局过滤器","options": {"titleStyle": {},"style": {"method": "select","itemStyle": {"borderTopColor": "#dadada","borderRightColor": "#dadada","borderBottomColor": "#dadada","borderLeftColor": "#dadada","maxHeight": 28,"background": "#fff"}}},"filterType": "filter","appId": 130713,"isGlobalFilter": true,"uid": "01HJ0V48VGN5M8XV4FQDW9BZ6D","fieldName": "director","field": {"datasetId": 1,"fieldName": "director","tags": {},"defaultAggrType": "count","type": "string","comment": "","originType": "string","config": {},"visible": true,"nativeType": "bpchar","hideValue": false,"detectedType": "string","suggestedTypes": ["string"],"basicType": "string","dataAppId": 130713,"_ukey": "director","labelOrigin": "director"},"byDashboard": {"1": {"style": {"method": "select","itemStyle": {"borderTopColor": "#dadada","borderRightColor": "#dadada","borderBottomColor": "#dadada","borderLeftColor": "#dadada","maxHeight": 28,"background": "#fff"}}}},"children": ["01HJ0TE602Z2VERDA4CMY4JR59"],"childrenByDashboard": {"1": ["01HJ0TE602Z2VERDA4CMY4JR59"]},"dataAppId": 130713,"datasetId": 1,"inside": true
}

说明

全局过滤控件不需要传递dashboardOptions

接口示例3: 新增参数控件 

http

POST /api/apps/1/filter-controllers HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...// Request Body:
{"uid": "01HJ0WYABBYAHBS8N33KVRHFJH","dashboardId": 1,"appId": 1,"options": {"style": {"method": "input"},"titleStyle": {"textAlign": "center","position": "left"},"mobileOptions": {"style": {"method": "input"},"titleStyle": {"textAlign": "center","position": "left"}},"enableAll": false},"datasetId": 1,"title": "参数控件","filterType": "param","field": {"id": 1,"name": "param","appId": 130713,"options": {"type": "string","subType": "ALL","allowAllValue": true,"defaultValue": null},"extendAppTitle": "过滤控件","uid": "1","isParam": true,"type": "string","datasetId": 1,"dataAppId": 130713,"labelOrigin": "param","label": "param"},"use": "paramInput","fieldName": "param","dashboardOptions": {"layouts": {"1": {"static": false,"w": 4,"moved": false,"h": 4,"x": 1,"options": {},"i": "1","y": 1,"type": "chart","zIndex": 902},"01HJ0WYABBYAHBS8N33KVRHFJH": {"i": "01HJ0WYABBYAHBS8N33KVRHFJH","x": 1,"y": 1,"w": 4,"h": 1,"moved": false,"static": false,"zIndex": 910,"type": "param"}}}
}

接口示例4: 新增过滤按钮 

http

POST /api/apps/1/filter-controllers HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...// Request Body:
{"version": 5000,"title": "查询","options": {},"filterType": "filterBtn","appId": 130713,"uid": "01HJ0X4WF0SR2MEND24V1J5BNE","dashboardId": 1,"dashboardOptions": {"layouts": {"1": {"static": false,"w": 4,"moved": false,"h": 4,"x": 1,"options": {},"i": "1","y": 1,"type": "chart","zIndex": 902},"01HJ0X4WF0SR2MEND24V1J5BNE": {"i": "01HJ0X4WF0SR2MEND24V1J5BNE","x": 1,"y": 1,"w": 4,"h": 1,"moved": false,"static": false,"zIndex": 912,"type": "filterBtn"}}}
}

说明

过滤按钮具体控制哪些过滤控件需要调用批量更新接口

更新过滤控件 

更新过滤控件

请求URL 

http

PUT /api/apps/${appId}/filter-controllers/{uid} HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数 
URL 参数 
字段类型是否必须说明
appIdINTEGER过滤控件所在的应用 id
uidINTEGER过滤控件唯一识别id
Request Body 参数 

过滤控件配置信息,见过滤控件结构

返回对象的格式说明 
字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT过滤控件的完整配置信息,见过滤控件结构
接口示例 

http

PUT /api/apps/1/filter-controllers/01HJ0TE602Z2VERDA4CMY4JR59 HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...// Request Body:
{"uid": "01HJ0TE602Z2VERDA4CMY4JR59","dashboardId": 1,"appId": 130713,"options": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"},"mobileOptions": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"}}},"datasetId": 1,"dataAppId": 130713,"title": "新建过滤器","filterType": "filter","version": 5000,"fieldName": "director","field": {"datasetId": 1,"fieldName": "director","tags": {},"defaultAggrType": "count","comment": "","type": "string","config": {},"originType": "string","visible": true,"nativeType": "bpchar","hideValue": false,"detectedType": "string","suggestedTypes": ["string"],"basicType": "string","dataAppId": 130713,"_ukey": "director","labelOrigin": "director"},"use": "checkbox","kind": "formula","op": "1=1"
}

说明

更新不需要再次传递dashboardOptions

批量更新过滤控件 

批量更新过滤控件

请求URL 

http

PUT /api/apps/${appId}/filter-controllers HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

1
2
3

请求参数 
URL 参数 
字段类型是否必须说明
appIdINTEGER过滤控件所在的应用 id
Request Body 参数 

过滤控件配置信息,见过滤控件结构

返回对象的格式说明 
字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT过滤控件的完整配置信息,见过滤控件结构
接口示例 

http

PUT /api/apps/1/filter-controllers/01HJ0TE602Z2VERDA4CMY4JR59 HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...// Request Body:
[{"op": "1=1","controller": {"01HJ0X4WF0SR2MEND24V1J5BNE": true},"fieldsChain": [{"field": "月份","keys": ["130145_datasetList_2"],"appId": 130145,"datasetId": 2,"label": "月份"}],"fieldName": "director","use": "checkbox","kind": "formula","datasetName": "A_IVT_MOVIE","title": "新建过滤器","version": 5000,"uid": "01HJ0TE602Z2VERDA4CMY4JR59","hasChain": true,"field": {"fieldName": "director","visible": true,"suggestedTypes": ["string"],"type": "string","detectedType": "string","tags": {},"basicType": "string","defaultAggrType": "count","originType": "string","hideValue": false,"appId": 130713,"nativeType": "bpchar","_ukey": "director","datasetId": 1,"comment": "","labelOrigin": "director","id": 125664649,"config": {}},"children": ["01HJ0TNJJFG2S7HGKA5B57A11S"],"dashboardId": 1,"appId": 130713,"options": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"},"mobileOptions": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"}}},"datasetId": 1,"fieldSiblings": [],"dataAppId": 130713,"filterType": "filter"},{"uid": "01HJ0WYABBYAHBS8N33KVRHFJH","controller": {"01HJ0X4WF0SR2MEND24V1J5BNE": true},"fieldName": "d","field": {"updatedBy": 8,"isParam": true,"isDelete": false,"label": "d","type": "string","tags": {},"createdAt": 1702984863536,"uid": "1","extendAppTitle": "过滤控件","createdBy": 8,"appId": 130713,"name": "d","options": {"allowAllValue": true,"subType": "ALL","type": "string"},"datasetId": 1,"labelOrigin": "d","id": 1,"dataAppId": 130713,"updatedAt": 1702984863536},"dashboardId": 1,"use": "paramInput","appId": 130713,"options": {"style": {"method": "input"},"titleStyle": {"textAlign": "center","position": "left"},"enableAll": false,"mobileOptions": {"style": {"method": "input"},"titleStyle": {"textAlign": "center","position": "left"}}},"datasetId": 1,"dataAppId": 130713,"title": "新建参数控件","filterType": "param"},{"uid": "01HJ0X4WF0SR2MEND24V1J5BNE","dashboardId": 1,"appId": 130713,"options": {},"dataAppId": 130713,"title": "查询","filterType": "filterBtn","version": 5000}
]

说明

该例为更新过滤按钮,需要将过滤按钮要控制的过滤控件的信息都放在list中并设置controller后传递,controller中为过滤按钮的uid

获取过滤控件列表 

获取过滤控件列表

请求URL 

http

GET /api/apps/${appId}/filter-controllers HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数 
URL 参数 
字段类型是否必须说明
appIdINTEGER过滤控件所在的应用 id
Request Body 参数 

过滤控件配置信息,见过滤控件结构

返回对象的格式说明 
字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT过滤控件的完整配置信息,见过滤控件结构
接口示例 

http

GET /api/apps/1/filter-controllers HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...// Request Body:
{"version": "version@9a5e106#6730f0d","code": 0,"msg": "success","data": [{"op": "1=1","fieldsChain": [{"field": "月份","keys": ["130145_datasetList_2"],"appId": 130145,"datasetId": 2,"label": "月份"}],"fieldName": "director","use": "checkbox","kind": "formula","datasetName": "A_IVT_MOVIE","title": "新建过滤器","version": 5000,"uid": "01HJ0TE602Z2VERDA4CMY4JR59","hasChain": true,"field": {"visible": true,"fieldName": "director","suggestedTypes": ["string"],"type": "string","detectedType": "string","tags": {},"basicType": "string","originType": "string","defaultAggrType": "count","hideValue": false,"appId": 130713,"nativeType": "bpchar","_ukey": "director","datasetId": 1,"comment": "","labelOrigin": "director","id": 125664649,"config": {}},"children": ["01HJ0TNJJFG2S7HGKA5B57A11S"],"dashboardId": 1,"appId": 130713,"options": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"},"mobileOptions": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"}}},"datasetId": 1,"fieldSiblings": [],"dataAppId": 130713,"filterType": "filter"},{"op": "1=1","fieldName": "stars","use": "checkbox","kind": "formula","datasetName": "A_IVT_MOVIE","title": "新建过滤器","version": 5000,"uid": "01HJ0TNJJFG2S7HGKA5B57A11S","field": {"visible": true,"fieldName": "stars","suggestedTypes": ["string"],"type": "string","detectedType": "string","tags": {},"basicType": "string","originType": "string","defaultAggrType": "count","hideValue": false,"appId": 130713,"nativeType": "varchar","_ukey": "stars","datasetId": 1,"comment": "","labelOrigin": "stars","id": 125664654,"config": {}},"children": ["01HJ0TRQ88JAJNHEQQK6NYE16F"],"dashboardId": 1,"appId": 130713,"options": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"},"mobileOptions": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"}}},"datasetId": 1,"fieldSiblings": [],"dataAppId": 130713,"filterType": "filter"},{"op": "1=1","fieldName": "zh_name","use": "checkbox","kind": "formula","datasetName": "A_IVT_MOVIE","title": "新建过滤器","version": 5000,"uid": "01HJ0TRQ88JAJNHEQQK6NYE16F","field": {"visible": true,"fieldName": "zh_name","suggestedTypes": ["string"],"type": "string","detectedType": "string","tags": {},"basicType": "string","originType": "string","defaultAggrType": "count","hideValue": false,"appId": 130713,"nativeType": "bpchar","_ukey": "zh_name","datasetId": 1,"comment": "","labelOrigin": "zh_name","id": 125664648,"config": {}},"dashboardId": 1,"appId": 130713,"options": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"},"mobileOptions": {"style": {"method": "select"},"titleStyle": {"textAlign": "center","position": "left"}}},"datasetId": 1,"fieldSiblings": [],"dataAppId": 130713,"filterType": "filter"},{"uid": "01HJ0WYABBYAHBS8N33KVRHFJH","fieldName": "d","field": {"isParam": true,"updatedBy": 8,"isDelete": false,"label": "d","type": "string","tags": {},"uid": "1","createdAt": "2023-12-19 19:21:03","extendAppTitle": "过滤控件","createdBy": 8,"appId": 130713,"name": "d","options": {"allowAllValue": true,"subType": "ALL","type": "string"},"datasetId": 1,"labelOrigin": "d","id": 1,"dataAppId": 130713,"updatedAt": "2023-12-19 19:21:03"},"dashboardId": 1,"use": "paramInput","appId": 130713,"options": {"enableAll": false,"style": {"method": "input"},"titleStyle": {"textAlign": "center","position": "left"},"mobileOptions": {"style": {"method": "input"},"titleStyle": {"textAlign": "center","position": "left"}}},"datasetId": 1,"dataAppId": 130713,"title": "新建参数控件","filterType": "param","version": 5000},{"uid": "01HJ0X4WF0SR2MEND24V1J5BNE","dashboardId": 1,"appId": 130713,"options": {},"dataAppId": 130713,"title": "查询","filterType": "filterBtn","version": 5000}],"chartDataStartTimeMillis": 0
}

http://www.dtcms.com/a/278952.html

相关文章:

  • SpringBoot集成SAP,本地IDEA启动和Windows服务器部署
  • 第八章排序 选择题
  • 【HarmonyOS】元服务入门详解 (一)
  • 从“直觉抢答”到“深度思考”:大模型的“慢思考”革命,思维链、树、图如何让AI越来越像人?
  • 生产者消费者问题,详解(操作系统os)
  • 扩散生成基础原理(二)——DDPM概率去噪扩散模型
  • 1.2.1 面向对象详解——AI教你学Django
  • git 下载报错:fetch-pack: unexpected disconnect while reading sideband packet
  • 139-CNN-BiLSTM-Selfattention-ABKDE预测模型!
  • 深度学习基础:损失函数(Loss Function)全面解析
  • 搭建k8s高可用集群,“Unable to register node with API server“
  • LINUX714 自动挂载/nfs;物理卷
  • 侧链的出现解决了主链哪些性能瓶颈?
  • Android系统的问题分析笔记 - Android上的调试方式 debuggerd
  • .NET 9 GUID v7 vs v4:时间有序性如何颠覆数据库索引性能
  • 如何快速去除latex表格中的加粗
  • 杨辉三角的认识与学习
  • 图像修复:深度学习GLCIC神经网络实现老照片划痕修复
  • 未来手机会自动充电吗
  • 计算机毕业设计Java医学生在线学习平台系统 基于 Java 的医学生在线学习平台设计与开发 Java 医学在线教育学习系统的设计与实现
  • React 和 Vue的自定义Hooks是如何实现的,如何创建自定义钩子
  • CSP-S 模拟赛 17
  • 单片机(STM32-串口通信)
  • IP相关
  • CSS `:root` 伪类深入讲解
  • Java final 关键字
  • iOS APP 上架流程:跨平台上架方案的协作实践记录
  • STM32F1_Hal库学习UART
  • 【脚本系列】如何使用 Python 脚本对同一文件夹中表头相同的 Excel 文件进行合并
  • 设计模式--工厂模式