smartbi-toolkit 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +41 -0
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.js +99 -0
  4. package/dist/main.d.ts +0 -1
  5. package/dist/main.js +18 -0
  6. package/dist/methods/AnalysisReportService.d.ts +93 -0
  7. package/dist/methods/AnalysisReportService.js +126 -0
  8. package/dist/methods/BusinessThemeService.d.ts +8 -0
  9. package/dist/methods/BusinessThemeService.js +11 -0
  10. package/dist/methods/BusinessViewService.d.ts +94 -0
  11. package/dist/methods/BusinessViewService.js +120 -0
  12. package/dist/methods/CatalogService.d.ts +1 -89
  13. package/dist/methods/CatalogService.js +224 -0
  14. package/dist/methods/ClientCombinedReportService.d.ts +63 -0
  15. package/dist/methods/ClientCombinedReportService.js +82 -0
  16. package/dist/methods/ClientInsightService.d.ts +83 -0
  17. package/dist/methods/ClientInsightService.js +107 -0
  18. package/dist/methods/ClientReportService.d.ts +162 -0
  19. package/dist/methods/ClientReportService.js +206 -0
  20. package/dist/methods/CombinedReportService.d.ts +7 -0
  21. package/dist/methods/CombinedReportService.js +10 -0
  22. package/dist/methods/DataSourceService.d.ts +178 -0
  23. package/dist/methods/DataSourceService.js +220 -0
  24. package/dist/methods/GraphicReportService.d.ts +6 -0
  25. package/dist/methods/GraphicReportService.js +10 -0
  26. package/dist/methods/InsightReport.d.ts +71 -0
  27. package/dist/methods/InsightReport.js +98 -0
  28. package/dist/methods/MetadataService.d.ts +37 -0
  29. package/dist/methods/MetadataService.js +47 -0
  30. package/dist/methods/OfficeReport.d.ts +49 -0
  31. package/dist/methods/OfficeReport.js +65 -0
  32. package/dist/methods/OfficeReportService.d.ts +36 -0
  33. package/dist/methods/OfficeReportService.js +46 -0
  34. package/dist/methods/OltpMetadataService.d.ts +19 -0
  35. package/dist/methods/OltpMetadataService.js +25 -0
  36. package/dist/methods/ParameterService.d.ts +12 -0
  37. package/dist/methods/ParameterService.js +18 -0
  38. package/dist/methods/PoolService.d.ts +11 -0
  39. package/dist/methods/PoolService.js +17 -0
  40. package/dist/methods/PortalService.d.ts +66 -0
  41. package/dist/methods/PortalService.js +89 -0
  42. package/dist/methods/Report.d.ts +178 -0
  43. package/dist/methods/Report.js +230 -0
  44. package/dist/methods/SSReport.d.ts +86 -0
  45. package/dist/methods/SSReport.js +114 -0
  46. package/dist/methods/ScheduleTaskService.d.ts +12 -0
  47. package/dist/methods/ScheduleTaskService.js +18 -0
  48. package/dist/methods/SimpleReportService.d.ts +12 -0
  49. package/dist/methods/SimpleReportService.js +18 -0
  50. package/dist/methods/SpreadSheetReportService.d.ts +43 -0
  51. package/dist/methods/SpreadSheetReportService.js +55 -0
  52. package/dist/methods/SystemConfigService.d.ts +28 -0
  53. package/dist/methods/SystemConfigService.js +24 -0
  54. package/dist/methods/TimeConsuming.d.ts +6 -0
  55. package/dist/methods/TimeConsuming.js +9 -0
  56. package/dist/methods/TimeConsumingService.d.ts +5 -0
  57. package/dist/methods/TimeConsumingService.js +9 -0
  58. package/dist/methods/UserManagerService.d.ts +258 -0
  59. package/dist/methods/UserManagerService.js +332 -0
  60. package/dist/types.d.ts +442 -0
  61. package/dist/types.js +125 -0
  62. package/dist/vite-plugin-smartbi/index.d.ts +36 -0
  63. package/dist/vite-plugin-smartbi/index.js +107 -0
  64. package/package.json +129 -11
  65. package/dist/CatalogService.es.js +0 -112
  66. package/dist/SmartbiToolbox.es.js +0 -51
  67. package/dist/index.d.ts.map +0 -1
  68. package/dist/main.d.ts.map +0 -1
  69. package/dist/methods/CatalogService.d.ts.map +0 -1
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # 非官方smartbi开发工具包
2
+
3
+ * 可用于第三方系统上使用smartbi接口服务,封装了常用接口
4
+ * 扩展包构建工具封装 (todo)
5
+
6
+ ### 在smartbi-toolkit中封装了通用的请求方法
7
+
8
+ * smartbi方法,具体可以
9
+
10
+ ```javascript
11
+ smartbi('服务名', '方法名', ['参数1', '参数2', '...']).then(res => {
12
+ })
13
+ ```
14
+
15
+ * setSmartbiEnv 为开发环境设置smartbi变量,注意账号密码安全问题,不要直接把账号密码写入,在开发环境设置后可实现自动登录,生产环境需要自行实现登录,或者运行在smartbi下,无需登录
16
+
17
+ ```javascript
18
+ setSmartbiEnv({
19
+ dev: {
20
+ username: 'admin',
21
+ password: 'manager',
22
+ }
23
+ })
24
+ ```
25
+
26
+ ### 在smartbi-toolkit/xxxxService中,实现你官方文档定义的接口
27
+
28
+ * 该部分文档代码由AI生成,不保证正确性,如果遇到错误或者不可用,
29
+ * 具体方法参考文档https://wiki.smartbi.com.cn/api/javaapi/index.html或者jsdoc
30
+
31
+ ### 在smartbi-toolkit/CatalogService内,通过官方文档实现了“资源目录服务”接口
32
+ * 参考文档https://wiki.smartbi.com.cn/api/javaapi/index.html?smartbi/sdk/service/catalog/CatalogService.html
33
+
34
+
35
+ ### todo 开发中功能,后续实现
36
+ 1. 其他服务接口
37
+ * 未实现的接口,大部分来自官方api稳定,由于smartbi版本或者文档版本造成的使用过程中的偏差,部分接口来自Smartbi-SDK.jar提取
38
+ 2. 扩展包构建工具
39
+ * 提供基于vite插件的扩展包构建工具,可将前端单页面应用直接打包成ext扩展包功能
40
+
41
+
package/dist/index.d.ts CHANGED
@@ -2,9 +2,10 @@ export type SmartbiDev = {
2
2
  username: string;
3
3
  password: string;
4
4
  };
5
- export declare const setSmartbiEnv: ({ path, dev, noop, }: {
5
+ export declare const setSmartbiEnv: ({ path, dev, noop, mode }: {
6
6
  path?: "/smartbi" | "" | string;
7
7
  dev?: SmartbiDev;
8
+ mode?: "dev" | "prod";
8
9
  noop?: number;
9
10
  }) => void;
10
11
  type Status = 'pending' | 'online' | 'offline';
@@ -19,4 +20,3 @@ export declare const login: (form?: {
19
20
  password: string;
20
21
  }) => Promise<unknown>;
21
22
  export {};
22
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,99 @@
1
+ import axios from "axios";
2
+ const __smartbi_env = {
3
+ username: '',
4
+ password: '',
5
+ smartbiPath: '/smartbi', mode: 'prod'
6
+ };
7
+ export const setSmartbiEnv = ({ path = '/smartbi', dev, noop = 3000, mode = 'prod' }) => {
8
+ console.log(path, dev, noop);
9
+ __smartbi_env.username = dev?.username || '';
10
+ __smartbi_env.username = dev?.username || '';
11
+ __smartbi_env.mode = mode;
12
+ if (dev) {
13
+ console.log("请勿将账号信息直接赋值到username和password中,避免暴露账号密码,如需要,可考虑从环境变量.env文件中获取");
14
+ }
15
+ };
16
+ const postStack = () => {
17
+ const postList = new Set();
18
+ let status = 'offline';
19
+ return {
20
+ setStatus(value) {
21
+ status = value;
22
+ },
23
+ emit() {
24
+ postList.forEach(call => {
25
+ call();
26
+ });
27
+ postList.clear();
28
+ },
29
+ on(call) {
30
+ postList.add(call);
31
+ },
32
+ handler(requireLogin) {
33
+ return new Promise(resolve => {
34
+ if (requireLogin) {
35
+ if (status === 'offline') {
36
+ status = 'pending';
37
+ login().then(() => {
38
+ emit();
39
+ resolve();
40
+ });
41
+ }
42
+ else if (status === 'online') {
43
+ resolve();
44
+ }
45
+ else if (status === 'pending') {
46
+ on(() => {
47
+ resolve();
48
+ });
49
+ }
50
+ }
51
+ else {
52
+ resolve();
53
+ }
54
+ });
55
+ }
56
+ };
57
+ };
58
+ export const { emit, on, handler, setStatus } = postStack();
59
+ export const smartbi = (className, methodName, params, requireLogin = __smartbi_env.mode === 'dev') => {
60
+ return new Promise((resolve, reject) => {
61
+ handler(requireLogin)
62
+ .then(() => {
63
+ return axios.post(`${__smartbi_env.smartbiPath}/vision/RMIServlet`, {
64
+ className,
65
+ methodName,
66
+ params: JSON.stringify(params),
67
+ }, {
68
+ headers: {
69
+ 'Content-Type': 'application/x-www-form-urlencoded',
70
+ 'X-Requested-With': 'XMLHttpRequest',
71
+ },
72
+ });
73
+ })
74
+ .then(res => {
75
+ if (res.data.retCode === 0) {
76
+ resolve(res.data.result);
77
+ }
78
+ else {
79
+ console.error('smartbi返回状态错误');
80
+ console.error(res.data.stackTrace);
81
+ reject(new Error(res.data.stackTrace));
82
+ }
83
+ })
84
+ .catch(e => {
85
+ reject(e);
86
+ });
87
+ });
88
+ };
89
+ /**
90
+ * 登录smartbi服务
91
+ */
92
+ export const login = (form) => {
93
+ return new Promise(resolve => {
94
+ smartbi('UserService', 'login', [form?.username || __smartbi_env.username, form?.password || __smartbi_env.password], false).then(value => {
95
+ setStatus('online');
96
+ resolve(value);
97
+ });
98
+ });
99
+ };
package/dist/main.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=main.d.ts.map
package/dist/main.js ADDED
@@ -0,0 +1,18 @@
1
+ import { setSmartbiEnv } from './index';
2
+ import { getRootElements } from './methods/CatalogService';
3
+ setSmartbiEnv({
4
+ dev: {
5
+ username: 'admin',
6
+ password: 'Bi@2024!!!!!!!!',
7
+ },
8
+ mode: 'dev'
9
+ });
10
+ // smartbi('x', 'x', [1, 2, 3]).then(value => {
11
+ // console.log(value)
12
+ // })
13
+ getRootElements().then(value => {
14
+ console.log(value);
15
+ value.forEach(item => {
16
+ console.log(item.fullPath);
17
+ });
18
+ });
@@ -0,0 +1,93 @@
1
+ import type { IResult, RunningInfo, IParameter, Parameter, NameValuePair, AllExportTypeMap } from '../types';
2
+ /**
3
+ * 打开多维报表
4
+ * @param reportId 报表ID
5
+ * @returns 返回报表客户端ID
6
+ */
7
+ export declare const openAnalysisReport: (reportId: string) => Promise<string>;
8
+ /**
9
+ * 打开多维报表(不初始化)
10
+ * @param reportId 报表ID
11
+ * @returns 返回报表客户端ID
12
+ */
13
+ export declare const openOlapReportWithoutInit: (reportId: string) => Promise<string>;
14
+ /**
15
+ * 关闭多维报表
16
+ * @param clientId 客户端ID
17
+ * @returns 无返回值
18
+ */
19
+ export declare const closeAnalysisReport: (clientId: string) => Promise<void>;
20
+ /**
21
+ * 设置多维报表参数值
22
+ * @param clientId 客户端ID
23
+ * @param id 参数ID
24
+ * @param value 参数值
25
+ * @param displayValue 参数显示值
26
+ * @returns 无返回值
27
+ */
28
+ export declare const setParamValue: (clientId: string, id: string, value: string, displayValue: string) => Promise<void>;
29
+ /**
30
+ * 执行多维查询
31
+ * @param clientId 客户端ID
32
+ * @returns 返回查询结果
33
+ */
34
+ export declare const executeQuery: (clientId: string) => Promise<IResult>;
35
+ /**
36
+ * 导出报表
37
+ * @param clientId 客户端ID
38
+ * @param exportType 导出类型
39
+ * @param delimiter 分割符
40
+ * @param os 输出流
41
+ * @param resourceBasePath 资源路径前缀(可选)
42
+ * @param valueType 值类型(可选)
43
+ * @returns 无返回值
44
+ */
45
+ export declare const doExport: (clientId: string, exportType: keyof AllExportTypeMap | string, delimiter: string, os: any, // 输出流
46
+ resourceBasePath?: string, valueType?: string) => Promise<void>;
47
+ /**
48
+ * 设置参数为默认值
49
+ * @param clientId 客户端ID
50
+ * @param paramId 参数ID
51
+ * @returns 无返回值
52
+ */
53
+ export declare const setParameterValueAsDefault: (clientId: string, paramId: string) => Promise<void>;
54
+ /**
55
+ * 获取参数
56
+ * @param clientId 客户端ID
57
+ * @param paramId 参数ID
58
+ * @returns 返回参数信息
59
+ */
60
+ export declare const getParameter: (clientId: string, paramId: string) => Promise<IParameter>;
61
+ /**
62
+ * 获取参数显示值
63
+ * @param clientId 客户端ID
64
+ * @param paramId 参数ID
65
+ * @returns 返回参数显示值
66
+ */
67
+ export declare const getParameterDisplayValue: (clientId: string, paramId: string) => Promise<string>;
68
+ /**
69
+ * 获取参数默认值
70
+ * @param clientId 客户端ID
71
+ * @param paramId 参数ID
72
+ * @returns 返回参数默认值列表
73
+ */
74
+ export declare const getParameterDefaultValue: (clientId: string, paramId: string) => Promise<string[]>;
75
+ /**
76
+ * 获取所有参数
77
+ * @param clientId 客户端ID
78
+ * @returns 返回参数列表
79
+ */
80
+ export declare const getParameters: (clientId: string) => Promise<Parameter[]>;
81
+ /**
82
+ * 获取参数候选值列表
83
+ * @param clientId 客户端ID
84
+ * @param paramId 参数ID
85
+ * @returns 返回候选值列表
86
+ */
87
+ export declare const getParamStandbyValue: (clientId: string, paramId: string) => Promise<NameValuePair[]>;
88
+ /**
89
+ * 获取执行状态
90
+ * @param clientId 客户端ID
91
+ * @returns 返回执行状态信息
92
+ */
93
+ export declare const getExecutingState: (clientId: string) => Promise<RunningInfo>;
@@ -0,0 +1,126 @@
1
+ /**
2
+ * 打开多维报表
3
+ * @param reportId 报表ID
4
+ * @returns 返回报表客户端ID
5
+ */
6
+ export const openAnalysisReport = (reportId) => {
7
+ return smartbi('AnalysisReportService', 'openAnalysisReport', [reportId]);
8
+ };
9
+ /**
10
+ * 打开多维报表(不初始化)
11
+ * @param reportId 报表ID
12
+ * @returns 返回报表客户端ID
13
+ */
14
+ export const openOlapReportWithoutInit = (reportId) => {
15
+ return smartbi('AnalysisReportService', 'openOlapReportWithoutInit', [reportId]);
16
+ };
17
+ /**
18
+ * 关闭多维报表
19
+ * @param clientId 客户端ID
20
+ * @returns 无返回值
21
+ */
22
+ export const closeAnalysisReport = (clientId) => {
23
+ return smartbi('AnalysisReportService', 'closeAnalysisReport', [clientId]);
24
+ };
25
+ /**
26
+ * 设置多维报表参数值
27
+ * @param clientId 客户端ID
28
+ * @param id 参数ID
29
+ * @param value 参数值
30
+ * @param displayValue 参数显示值
31
+ * @returns 无返回值
32
+ */
33
+ export const setParamValue = (clientId, id, value, displayValue) => {
34
+ return smartbi('AnalysisReportService', 'setParamValue', [clientId, id, value, displayValue]);
35
+ };
36
+ /**
37
+ * 执行多维查询
38
+ * @param clientId 客户端ID
39
+ * @returns 返回查询结果
40
+ */
41
+ export const executeQuery = (clientId) => {
42
+ return smartbi('AnalysisReportService', 'executeQuery', [clientId]);
43
+ };
44
+ /**
45
+ * 导出报表
46
+ * @param clientId 客户端ID
47
+ * @param exportType 导出类型
48
+ * @param delimiter 分割符
49
+ * @param os 输出流
50
+ * @param resourceBasePath 资源路径前缀(可选)
51
+ * @param valueType 值类型(可选)
52
+ * @returns 无返回值
53
+ */
54
+ export const doExport = (clientId, exportType, delimiter, os, // 输出流
55
+ resourceBasePath, valueType) => {
56
+ const params = [clientId, exportType, delimiter, os];
57
+ if (resourceBasePath !== undefined) {
58
+ params.push(resourceBasePath);
59
+ if (valueType !== undefined) {
60
+ params.push(valueType);
61
+ }
62
+ }
63
+ return smartbi('AnalysisReportService', 'doExport', params);
64
+ };
65
+ /**
66
+ * 设置参数为默认值
67
+ * @param clientId 客户端ID
68
+ * @param paramId 参数ID
69
+ * @returns 无返回值
70
+ */
71
+ export const setParameterValueAsDefault = (clientId, paramId) => {
72
+ return smartbi('AnalysisReportService', 'setParameterValueAsDefault', [clientId, paramId]);
73
+ };
74
+ /**
75
+ * 获取参数
76
+ * @param clientId 客户端ID
77
+ * @param paramId 参数ID
78
+ * @returns 返回参数信息
79
+ */
80
+ export const getParameter = (clientId, paramId) => {
81
+ return smartbi('AnalysisReportService', 'getParameter', [clientId, paramId]);
82
+ };
83
+ /**
84
+ * 获取参数显示值
85
+ * @param clientId 客户端ID
86
+ * @param paramId 参数ID
87
+ * @returns 返回参数显示值
88
+ */
89
+ export const getParameterDisplayValue = (clientId, paramId) => {
90
+ return smartbi('AnalysisReportService', 'getParameterDisplayValue', [clientId, paramId]);
91
+ };
92
+ /**
93
+ * 获取参数默认值
94
+ * @param clientId 客户端ID
95
+ * @param paramId 参数ID
96
+ * @returns 返回参数默认值列表
97
+ */
98
+ export const getParameterDefaultValue = (clientId, paramId) => {
99
+ return smartbi('AnalysisReportService', 'getParameterDefaultValue', [clientId, paramId]);
100
+ };
101
+ /**
102
+ * 获取所有参数
103
+ * @param clientId 客户端ID
104
+ * @returns 返回参数列表
105
+ */
106
+ export const getParameters = (clientId) => {
107
+ return smartbi('AnalysisReportService', 'getParameters', [clientId]);
108
+ };
109
+ /**
110
+ * 获取参数候选值列表
111
+ * @param clientId 客户端ID
112
+ * @param paramId 参数ID
113
+ * @returns 返回候选值列表
114
+ */
115
+ export const getParamStandbyValue = (clientId, paramId) => {
116
+ return smartbi('AnalysisReportService', 'getParamStandbyValue', [clientId, paramId]);
117
+ };
118
+ /**
119
+ * 获取执行状态
120
+ * @param clientId 客户端ID
121
+ * @returns 返回执行状态信息
122
+ */
123
+ export const getExecutingState = (clientId) => {
124
+ return smartbi('AnalysisReportService', 'getExecutingState', [clientId]);
125
+ };
126
+ import { smartbi } from "../index";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 创建业务对象
3
+ * @param businessThemeId 业务主题ID
4
+ * @param parentId 业务对象父ID
5
+ * @param tableId 表ID
6
+ * @returns 无返回值
7
+ */
8
+ export declare const createBusinessThemeObject: (businessThemeId: string, parentId: string, tableId: string) => Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { smartbi } from '../index';
2
+ /**
3
+ * 创建业务对象
4
+ * @param businessThemeId 业务主题ID
5
+ * @param parentId 业务对象父ID
6
+ * @param tableId 表ID
7
+ * @returns 无返回值
8
+ */
9
+ export const createBusinessThemeObject = (businessThemeId, parentId, tableId) => {
10
+ return smartbi('BusinessThemeService', 'createBusinessThemeObject', [businessThemeId, parentId, tableId]);
11
+ };
@@ -0,0 +1,94 @@
1
+ import type { FieldProperty, ViewMetaData } from '../types';
2
+ /**
3
+ * 根据数据集(可视化查询、原生SQL查询、SQL查询)的ID查询其SQL语句
4
+ * @param bizViewId (可视化查询、原生SQL查询、SQL查询)的ID
5
+ * @returns 返回其SQL语句
6
+ */
7
+ export declare const getSqlString: (bizViewId: string) => Promise<string>;
8
+ /**
9
+ * 打开业务查询以备读取结果集数据
10
+ * @param bizViewId 业务查询ID
11
+ * @param paramsJsonArrStr 报表的参数信息
12
+ * @param rowsPerPage 加载数据时每页返回的行数
13
+ * @param getTotalRows 是否获取总行数
14
+ * @returns 返回查询基本元数据信息
15
+ */
16
+ export declare const openLoadDataView: (bizViewId: string, paramsJsonArrStr: string, rowsPerPage: number, getTotalRows: boolean) => Promise<ViewMetaData>;
17
+ /**
18
+ * 按页读取结果集数据
19
+ * @param loadDataClientId 打开查询后的客户端标识
20
+ * @param pageNum 页码(第1页的页码为0,第2页的页码为1,如此类推)
21
+ * @returns 返回原始报表数据
22
+ */
23
+ export declare const loadViewData: (loadDataClientId: string, pageNum: number) => Promise<string[][]>;
24
+ /**
25
+ * 按页读取结果集数据
26
+ * @param loadDataClientId 打开查询后的客户端标识
27
+ * @param pageNum 页码(第1页的页码为0,第2页的页码为1,如此类推)
28
+ * @param dataFormatMap 数据格式映射,如:"DOUBLE", "<浮点型-默认值>",目前仅支持double
29
+ * @returns 返回原始报表数据
30
+ */
31
+ export declare const loadViewDataWithDataformat: (loadDataClientId: string, pageNum: number, dataFormatMap: Map<string, string>) => Promise<string[][]>;
32
+ /**
33
+ * 关闭业务查询
34
+ * @param loadDataClientId 打开查询后的客户端标识
35
+ * @returns 无返回值
36
+ */
37
+ export declare const closeLoadDataView: (loadDataClientId: string) => Promise<void>;
38
+ /**
39
+ * 打开业务查询
40
+ * @param bizViewId 打开业务查询ID
41
+ * @returns 返回业务查询结果
42
+ */
43
+ export declare const openBusinessView: (bizViewId: string) => Promise<any[]>;
44
+ /**
45
+ * 关闭业务查询
46
+ * @param bizViewClientId 打开查询后的客户端标识
47
+ * @returns 无返回值
48
+ */
49
+ export declare const closeBusinessView: (bizViewClientId: string) => Promise<void>;
50
+ /**
51
+ * 检测输出字段
52
+ * @param bizViewClientId 打开查询后的客户端标识
53
+ * @returns 无返回值
54
+ */
55
+ export declare const getRawSqlOutputField: (bizViewClientId: string) => Promise<void>;
56
+ /**
57
+ * 检测输出字段
58
+ * @param clientId 客户端ID
59
+ * @returns 返回输出字段
60
+ */
61
+ export declare const detectOutputFields: (clientId: string) => Promise<any[]>;
62
+ /**
63
+ * 覆盖业务视图
64
+ * @param bizViewClientId 业务视图ID
65
+ * @returns 无返回值
66
+ */
67
+ export declare const overwriteBusinessView: (bizViewClientId: string) => Promise<void>;
68
+ /**
69
+ * 创建"原生SQL查询"数据集,并保存到指定目录下
70
+ * @param datasourceId 数据源ID
71
+ * @param sql "原生SQL查询"的SQL语句
72
+ * @param name 数据集的名称
73
+ * @param alias 数据集的别名
74
+ * @param desc 数据集的描述
75
+ * @param folderId 用来保存数据集的指定目录ID
76
+ * @returns 返回所创建的"原生SQL查询"数据集ID
77
+ */
78
+ export declare const createRawSqlQueryBusinessViewAndSave: (datasourceId: string, sql: string, name: string, alias: string, desc: string, folderId: string) => Promise<string>;
79
+ /**
80
+ * 更新指定的"原生SQL查询"数据集的SQL语句,并自动检测输出字段
81
+ * @param businessViewId "原生SQL查询"数据集ID
82
+ * @param sql 新的SQL语句
83
+ * @returns 返回数据集ID
84
+ */
85
+ export declare const updateRawSqlQueryBusinessView: (businessViewId: string, sql: string) => Promise<string>;
86
+ /**
87
+ * 设置输出字段信息
88
+ * @param businessViewClientId clientId
89
+ * @param fieldId 字段信息
90
+ * @param propertyName 属性名,如alias,desc,dataType,dataFormat,orderby,transformRule
91
+ * @param propertyValue 属性值
92
+ * @returns 无返回值
93
+ */
94
+ export declare const setOutputFieldInfo: (businessViewClientId: string, fieldId: string, propertyName: FieldProperty, propertyValue: string) => Promise<void>;
@@ -0,0 +1,120 @@
1
+ import { smartbi } from "../index";
2
+ /**
3
+ * 根据数据集(可视化查询、原生SQL查询、SQL查询)的ID查询其SQL语句
4
+ * @param bizViewId (可视化查询、原生SQL查询、SQL查询)的ID
5
+ * @returns 返回其SQL语句
6
+ */
7
+ export const getSqlString = (bizViewId) => {
8
+ return smartbi('BusinessViewService', 'getSqlString', [bizViewId]);
9
+ };
10
+ /**
11
+ * 打开业务查询以备读取结果集数据
12
+ * @param bizViewId 业务查询ID
13
+ * @param paramsJsonArrStr 报表的参数信息
14
+ * @param rowsPerPage 加载数据时每页返回的行数
15
+ * @param getTotalRows 是否获取总行数
16
+ * @returns 返回查询基本元数据信息
17
+ */
18
+ export const openLoadDataView = (bizViewId, paramsJsonArrStr, rowsPerPage, getTotalRows) => {
19
+ return smartbi('BusinessViewService', 'openLoadDataView', [bizViewId, paramsJsonArrStr, rowsPerPage, getTotalRows]);
20
+ };
21
+ /**
22
+ * 按页读取结果集数据
23
+ * @param loadDataClientId 打开查询后的客户端标识
24
+ * @param pageNum 页码(第1页的页码为0,第2页的页码为1,如此类推)
25
+ * @returns 返回原始报表数据
26
+ */
27
+ export const loadViewData = (loadDataClientId, pageNum) => {
28
+ return smartbi('BusinessViewService', 'loadViewData', [loadDataClientId, pageNum]);
29
+ };
30
+ /**
31
+ * 按页读取结果集数据
32
+ * @param loadDataClientId 打开查询后的客户端标识
33
+ * @param pageNum 页码(第1页的页码为0,第2页的页码为1,如此类推)
34
+ * @param dataFormatMap 数据格式映射,如:"DOUBLE", "<浮点型-默认值>",目前仅支持double
35
+ * @returns 返回原始报表数据
36
+ */
37
+ export const loadViewDataWithDataformat = (loadDataClientId, pageNum, dataFormatMap) => {
38
+ return smartbi('BusinessViewService', 'loadViewDataWithDataformat', [loadDataClientId, pageNum, dataFormatMap.toString()]);
39
+ };
40
+ /**
41
+ * 关闭业务查询
42
+ * @param loadDataClientId 打开查询后的客户端标识
43
+ * @returns 无返回值
44
+ */
45
+ export const closeLoadDataView = (loadDataClientId) => {
46
+ return smartbi('BusinessViewService', 'closeLoadDataView', [loadDataClientId]);
47
+ };
48
+ /**
49
+ * 打开业务查询
50
+ * @param bizViewId 打开业务查询ID
51
+ * @returns 返回业务查询结果
52
+ */
53
+ export const openBusinessView = (bizViewId) => {
54
+ return smartbi('BusinessViewService', 'openBusinessView', [bizViewId]);
55
+ };
56
+ /**
57
+ * 关闭业务查询
58
+ * @param bizViewClientId 打开查询后的客户端标识
59
+ * @returns 无返回值
60
+ */
61
+ export const closeBusinessView = (bizViewClientId) => {
62
+ return smartbi('BusinessViewService', 'closeBusinessView', [bizViewClientId]);
63
+ };
64
+ /**
65
+ * 检测输出字段
66
+ * @param bizViewClientId 打开查询后的客户端标识
67
+ * @returns 无返回值
68
+ */
69
+ export const getRawSqlOutputField = (bizViewClientId) => {
70
+ return smartbi('BusinessViewService', 'getRawSqlOutputField', [bizViewClientId]);
71
+ };
72
+ /**
73
+ * 检测输出字段
74
+ * @param clientId 客户端ID
75
+ * @returns 返回输出字段
76
+ */
77
+ export const detectOutputFields = (clientId) => {
78
+ return smartbi('BusinessViewService', 'detectOutputFields', [clientId]);
79
+ };
80
+ /**
81
+ * 覆盖业务视图
82
+ * @param bizViewClientId 业务视图ID
83
+ * @returns 无返回值
84
+ */
85
+ export const overwriteBusinessView = (bizViewClientId) => {
86
+ return smartbi('BusinessViewService', 'overwriteBusinessView', [bizViewClientId]);
87
+ };
88
+ /**
89
+ * 创建"原生SQL查询"数据集,并保存到指定目录下
90
+ * @param datasourceId 数据源ID
91
+ * @param sql "原生SQL查询"的SQL语句
92
+ * @param name 数据集的名称
93
+ * @param alias 数据集的别名
94
+ * @param desc 数据集的描述
95
+ * @param folderId 用来保存数据集的指定目录ID
96
+ * @returns 返回所创建的"原生SQL查询"数据集ID
97
+ */
98
+ export const createRawSqlQueryBusinessViewAndSave = (datasourceId, sql, name, alias, desc, folderId) => {
99
+ return smartbi('BusinessViewService', 'createRawSqlQueryBusinessViewAndSave', [datasourceId, sql, name, alias, desc, folderId]);
100
+ };
101
+ /**
102
+ * 更新指定的"原生SQL查询"数据集的SQL语句,并自动检测输出字段
103
+ * @param businessViewId "原生SQL查询"数据集ID
104
+ * @param sql 新的SQL语句
105
+ * @returns 返回数据集ID
106
+ */
107
+ export const updateRawSqlQueryBusinessView = (businessViewId, sql) => {
108
+ return smartbi('BusinessViewService', 'updateRawSqlQueryBusinessView', [businessViewId, sql]);
109
+ };
110
+ /**
111
+ * 设置输出字段信息
112
+ * @param businessViewClientId clientId
113
+ * @param fieldId 字段信息
114
+ * @param propertyName 属性名,如alias,desc,dataType,dataFormat,orderby,transformRule
115
+ * @param propertyValue 属性值
116
+ * @returns 无返回值
117
+ */
118
+ export const setOutputFieldInfo = (businessViewClientId, fieldId, propertyName, propertyValue) => {
119
+ return smartbi('BusinessViewService', 'setOutputFieldInfo', [businessViewClientId, fieldId, propertyName, propertyValue]);
120
+ };