smartbi-toolkit 1.1.4 → 1.2.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.
- package/README.md +59 -12
- package/dist/common-Cnq1SoER.d.ts +25 -0
- package/dist/console-BJttltN4.js +93 -0
- package/dist/index.d.ts +23 -14
- package/dist/index.js +97 -127
- package/dist/{methods → service}/AnalysisReportService.d.ts +18 -14
- package/dist/service/AnalysisReportService.js +138 -0
- package/dist/service/BusinessThemeService.d.ts +11 -0
- package/dist/service/BusinessThemeService.js +20 -0
- package/dist/{methods → service}/BusinessViewService.d.ts +18 -14
- package/dist/service/BusinessViewService.js +146 -0
- package/dist/{methods → service}/CatalogService.d.ts +26 -22
- package/dist/service/CatalogService.js +300 -0
- package/dist/{methods → service}/ClientCombinedReportService.d.ts +14 -10
- package/dist/service/ClientCombinedReportService.js +96 -0
- package/dist/{methods → service}/ClientInsightService.d.ts +17 -13
- package/dist/service/ClientInsightService.js +123 -0
- package/dist/{methods → service}/ClientReportService.d.ts +27 -23
- package/dist/service/ClientReportService.js +244 -0
- package/dist/service/CombinedReportService.d.ts +11 -0
- package/dist/service/CombinedReportService.js +14 -0
- package/dist/{methods → service}/DataSourceService.d.ts +26 -22
- package/dist/service/DataSourceService.js +306 -0
- package/dist/service/GraphicReportService.d.ts +11 -0
- package/dist/service/GraphicReportService.js +14 -0
- package/dist/service/InsightReport.d.ts +75 -0
- package/dist/service/InsightReport.js +118 -0
- package/dist/{methods → service}/MetadataService.d.ts +10 -6
- package/dist/service/MetadataService.js +60 -0
- package/dist/service/OfficeReport.d.ts +53 -0
- package/dist/service/OfficeReport.js +74 -0
- package/dist/{methods → service}/OfficeReportService.d.ts +10 -6
- package/dist/service/OfficeReportService.js +56 -0
- package/dist/service/OltpMetadataService.d.ts +23 -0
- package/dist/service/OltpMetadataService.js +30 -0
- package/dist/service/ParameterService.d.ts +15 -0
- package/dist/service/ParameterService.js +22 -0
- package/dist/service/PoolService.d.ts +14 -0
- package/dist/service/PoolService.js +21 -0
- package/dist/{methods → service}/PortalService.d.ts +14 -10
- package/dist/service/PortalService.js +106 -0
- package/dist/{methods → service}/Report.d.ts +31 -27
- package/dist/service/Report.js +275 -0
- package/dist/service/SSReport.d.ts +90 -0
- package/dist/service/SSReport.js +127 -0
- package/dist/service/ScheduleTaskService.d.ts +15 -0
- package/dist/service/ScheduleTaskService.js +22 -0
- package/dist/service/SimpleReportService.d.ts +15 -0
- package/dist/service/SimpleReportService.js +22 -0
- package/dist/service/SpreadSheetReportService.d.ts +47 -0
- package/dist/service/SpreadSheetReportService.js +65 -0
- package/dist/service/SystemConfigService.d.ts +21 -0
- package/dist/service/SystemConfigService.js +28 -0
- package/dist/service/TimeConsuming.d.ts +10 -0
- package/dist/service/TimeConsuming.js +13 -0
- package/dist/service/TimeConsumingService.d.ts +8 -0
- package/dist/service/TimeConsumingService.js +13 -0
- package/dist/{methods → service}/UserManagerService.d.ts +40 -36
- package/dist/service/UserManagerService.js +365 -0
- package/dist/types-DOYMZhxT.d.ts +409 -0
- package/dist/vite-plugin/vite-plugin-smartbi.d.ts +21 -0
- package/dist/vite-plugin/vite-plugin-smartbi.js +54 -0
- package/dist/vite-plugin/vite-plugin-smartbix.d.ts +17 -0
- package/dist/vite-plugin/vite-plugin-smartbix.js +101 -0
- package/package.json +59 -141
- package/dist/methods/AnalysisReportService.js +0 -126
- package/dist/methods/BusinessThemeService.d.ts +0 -8
- package/dist/methods/BusinessThemeService.js +0 -11
- package/dist/methods/BusinessViewService.js +0 -120
- package/dist/methods/CatalogService.js +0 -230
- package/dist/methods/ClientCombinedReportService.js +0 -82
- package/dist/methods/ClientInsightService.js +0 -107
- package/dist/methods/ClientReportService.js +0 -206
- package/dist/methods/CombinedReportService.d.ts +0 -7
- package/dist/methods/CombinedReportService.js +0 -10
- package/dist/methods/DataSourceService.js +0 -220
- package/dist/methods/GraphicReportService.d.ts +0 -7
- package/dist/methods/GraphicReportService.js +0 -10
- package/dist/methods/InsightReport.d.ts +0 -71
- package/dist/methods/InsightReport.js +0 -98
- package/dist/methods/MetadataService.js +0 -47
- package/dist/methods/OfficeReport.d.ts +0 -49
- package/dist/methods/OfficeReport.js +0 -65
- package/dist/methods/OfficeReportService.js +0 -46
- package/dist/methods/OltpMetadataService.d.ts +0 -19
- package/dist/methods/OltpMetadataService.js +0 -25
- package/dist/methods/ParameterService.d.ts +0 -12
- package/dist/methods/ParameterService.js +0 -18
- package/dist/methods/PoolService.d.ts +0 -11
- package/dist/methods/PoolService.js +0 -17
- package/dist/methods/PortalService.js +0 -89
- package/dist/methods/Report.js +0 -230
- package/dist/methods/SSReport.d.ts +0 -86
- package/dist/methods/SSReport.js +0 -114
- package/dist/methods/ScheduleTaskService.d.ts +0 -12
- package/dist/methods/ScheduleTaskService.js +0 -18
- package/dist/methods/SimpleReportService.d.ts +0 -12
- package/dist/methods/SimpleReportService.js +0 -18
- package/dist/methods/SpreadSheetReportService.d.ts +0 -43
- package/dist/methods/SpreadSheetReportService.js +0 -55
- package/dist/methods/SystemConfigService.d.ts +0 -17
- package/dist/methods/SystemConfigService.js +0 -23
- package/dist/methods/TimeConsuming.d.ts +0 -6
- package/dist/methods/TimeConsuming.js +0 -9
- package/dist/methods/TimeConsumingService.d.ts +0 -5
- package/dist/methods/TimeConsumingService.js +0 -9
- package/dist/methods/UserManagerService.js +0 -312
- package/dist/types.d.ts +0 -412
- package/dist/types.js +0 -61
- package/dist/vite-plugin-smartbi/index.d.ts +0 -36
- package/dist/vite-plugin-smartbi/index.js +0 -107
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ noop()
|
|
|
51
51
|
该工具为vite插件,可以一键生成ext扩展包,但需要有java和Apache Ant环境
|
|
52
52
|
|
|
53
53
|
```javascript
|
|
54
|
-
import vitePluginSmartbi from 'smartbi-toolkit/VitePluginSmartbi'
|
|
54
|
+
import vitePluginSmartbi from 'smartbi-toolkit/vite-plugin/VitePluginSmartbi'
|
|
55
55
|
|
|
56
56
|
export default defineConfig({
|
|
57
57
|
plugins: [
|
|
@@ -69,7 +69,7 @@ export type VitePluginSmartbiOptions = {
|
|
|
69
69
|
*/
|
|
70
70
|
name: string
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* 插件名称
|
|
73
73
|
*/
|
|
74
74
|
alias?: string
|
|
75
75
|
/**
|
|
@@ -80,6 +80,10 @@ export type VitePluginSmartbiOptions = {
|
|
|
80
80
|
* 优先级
|
|
81
81
|
*/
|
|
82
82
|
priority?: number
|
|
83
|
+
/**
|
|
84
|
+
* 插件版本
|
|
85
|
+
*/
|
|
86
|
+
version?: string
|
|
83
87
|
/**
|
|
84
88
|
* 输出目录
|
|
85
89
|
*/
|
|
@@ -92,19 +96,63 @@ export type VitePluginSmartbiOptions = {
|
|
|
92
96
|
* vision到html中间的路径
|
|
93
97
|
*/
|
|
94
98
|
appendPath?: string,
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### ext新扩展包构建工具,通过vite实现 对应smartbix那套的扩展包
|
|
104
|
+
环境同上,构建工具封装
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
import vitePluginSmartbi from 'smartbi-toolkit/vite-plugin/VitePluginSmartbix'
|
|
108
|
+
|
|
109
|
+
export default defineConfig({
|
|
110
|
+
plugins: [
|
|
111
|
+
VitePluginSmartbix({
|
|
112
|
+
name:'ext-test',
|
|
113
|
+
})
|
|
114
|
+
],
|
|
115
|
+
})
|
|
116
|
+
```
|
|
117
|
+
#### 参数说明
|
|
118
|
+
```typescript
|
|
119
|
+
export type VitePluginSmartbiOptions = {
|
|
120
|
+
/**
|
|
121
|
+
* 插件名称
|
|
122
|
+
*/
|
|
123
|
+
name: string
|
|
124
|
+
/**
|
|
125
|
+
* 插件名称
|
|
126
|
+
*/
|
|
127
|
+
alias?: string
|
|
128
|
+
/**
|
|
129
|
+
* 插件描述
|
|
130
|
+
*/
|
|
131
|
+
desc?: string
|
|
132
|
+
/**
|
|
133
|
+
* 优先级
|
|
134
|
+
*/
|
|
135
|
+
priority?: number
|
|
95
136
|
/**
|
|
96
137
|
* 插件版本
|
|
97
138
|
*/
|
|
98
139
|
version?: string
|
|
140
|
+
/**
|
|
141
|
+
* 扩展根目录
|
|
142
|
+
*/
|
|
143
|
+
libRoot?: string
|
|
144
|
+
/**
|
|
145
|
+
* 输出路径
|
|
146
|
+
*/
|
|
147
|
+
output?: string,
|
|
99
148
|
};
|
|
100
149
|
```
|
|
101
150
|
|
|
151
|
+
### 在smartbi-toolkit/service/xxxxService中,实现官方文档定义的接口
|
|
102
152
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
*
|
|
106
|
-
* 如遇到接口不可用,可以尝试使用smartbi()方法调用,如果依旧不可以,请查看官方文档,官方文档内也有相当大的一部分方法不可以
|
|
107
|
-
* 大部分接口均由AI通过官方文档生成JsDoc
|
|
153
|
+
* 代码大部分由AI通过官方文档生成,基本和官方保持一致,部分ts类型等可能存在错误。
|
|
154
|
+
* 如遇到接口不可用,可以尝试使用smartbi()方法调用,如果依旧不可以,请查看官方文档。(注:官方文档内也有相当大的一部分方法不可以)
|
|
155
|
+
* 大部分接口均由AI通过官方文档生成jsdoc
|
|
108
156
|
* 官方文档https://wiki.smartbi.com.cn/api/javaapi/index.html
|
|
109
157
|
|
|
110
158
|
|
|
@@ -112,11 +160,10 @@ export type VitePluginSmartbiOptions = {
|
|
|
112
160
|
|
|
113
161
|
### todo 开发中功能,后续实现
|
|
114
162
|
1. 其他服务接口
|
|
115
|
-
|
|
116
|
-
* 其他可通过rmi调用的接口
|
|
163
|
+
* Smartbi-SDK.jar中包含的,但官方文档没有的接口
|
|
117
164
|
2. TS类型优化
|
|
118
|
-
|
|
119
|
-
3. 封装参数
|
|
120
|
-
|
|
165
|
+
* TS类型没有完善,部分通过AI生成,后续需要从SDK中提取完整的类型信息
|
|
166
|
+
3. 封装参数(可能会做)
|
|
167
|
+
* 目前参数封装为数组,后续需要封装为对象
|
|
121
168
|
|
|
122
169
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/common/common.d.ts
|
|
2
|
+
type WebProjectConfig = {
|
|
3
|
+
/**
|
|
4
|
+
* 插件名称
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* 插件名称
|
|
9
|
+
*/
|
|
10
|
+
alias?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 插件描述
|
|
13
|
+
*/
|
|
14
|
+
desc?: string;
|
|
15
|
+
/**
|
|
16
|
+
* 优先级
|
|
17
|
+
*/
|
|
18
|
+
priority?: number;
|
|
19
|
+
/**
|
|
20
|
+
* 插件版本
|
|
21
|
+
*/
|
|
22
|
+
version?: string;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { WebProjectConfig as t };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ensureFile } from "fs-extra";
|
|
2
|
+
import { writeFile } from "fs/promises";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
|
|
6
|
+
//#region src/common/common.ts
|
|
7
|
+
const buildWebProject = ({ name, alias, desc, priority, version }, rootPath) => {
|
|
8
|
+
return {
|
|
9
|
+
web: `<web-app/>`,
|
|
10
|
+
applicationContext: `<?xml version="1.0" encoding="UTF-8"?>
|
|
11
|
+
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
|
12
|
+
<beans>
|
|
13
|
+
<bean id="framework" class="smartbi.framework.Framework" factory-method="getInstance">
|
|
14
|
+
<property name="modules">
|
|
15
|
+
<map>
|
|
16
|
+
</map>
|
|
17
|
+
</property>
|
|
18
|
+
</bean>
|
|
19
|
+
<bean id="rmi" class="smartbi.framework.rmi.RMIModule" factory-method="getInstance">
|
|
20
|
+
<property name="modules">
|
|
21
|
+
<map>
|
|
22
|
+
</map>
|
|
23
|
+
</property>
|
|
24
|
+
</bean>
|
|
25
|
+
</beans>
|
|
26
|
+
`,
|
|
27
|
+
extension: `<?xml version="1.0" encoding="UTF-8"?>
|
|
28
|
+
<!DOCTYPE extension SYSTEM "extension.dtd">
|
|
29
|
+
<extension name="${name}" alias="${alias || name}" desc="${desc || name}" :priority="${priority || 100}" version="${version || "1.0"}">
|
|
30
|
+
<enable-jsp-processor />
|
|
31
|
+
</extension>
|
|
32
|
+
`,
|
|
33
|
+
portlet: `<?xml version="1.0" encoding="UTF-8"?>
|
|
34
|
+
<portlet-app>
|
|
35
|
+
</portlet-app>
|
|
36
|
+
`,
|
|
37
|
+
build: `<?xml version="1.0" encoding="UTF-8"?>
|
|
38
|
+
<project name="${name}" default="dist">
|
|
39
|
+
<target name="dist" >
|
|
40
|
+
<tstamp>
|
|
41
|
+
<format property="today" pattern="yyyy-MM-dd HH:mm:ss"/>
|
|
42
|
+
</tstamp>
|
|
43
|
+
<echo file="${resolve(rootPath, "META-INF/version.txt")}" message="\${today}"/>
|
|
44
|
+
|
|
45
|
+
<jar destfile="${resolve(rootPath, `../${name}.ext`)}" duplicate="preserve">
|
|
46
|
+
<fileset dir="${rootPath}"/>
|
|
47
|
+
</jar>
|
|
48
|
+
</target>
|
|
49
|
+
</project>
|
|
50
|
+
`
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const makeWebDir = (rootPath, config) => {
|
|
54
|
+
return new Promise((r) => {
|
|
55
|
+
const { web, applicationContext, extension, portlet, build } = buildWebProject(config, rootPath);
|
|
56
|
+
const paths = {
|
|
57
|
+
"WEB-INF/web.xml": web,
|
|
58
|
+
"META-INF/applicationContext.xml": applicationContext,
|
|
59
|
+
"META-INF/extension.xml": extension,
|
|
60
|
+
"META-INF/portlet.xml": portlet
|
|
61
|
+
};
|
|
62
|
+
const plist = Object.keys(paths).map((_path) => {
|
|
63
|
+
return new Promise((r) => {
|
|
64
|
+
const filePath = resolve(rootPath, _path);
|
|
65
|
+
ensureFile(filePath).then(() => {
|
|
66
|
+
return writeFile(filePath, paths[_path]);
|
|
67
|
+
}).then(() => {
|
|
68
|
+
r();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
Promise.all(plist).then(() => {
|
|
73
|
+
writeFile(resolve(rootPath, "../build.xml"), build).then(() => {
|
|
74
|
+
r();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/common/console.ts
|
|
82
|
+
const info = (msg) => {
|
|
83
|
+
console.log(chalk.blue(msg));
|
|
84
|
+
};
|
|
85
|
+
const error = (msg) => {
|
|
86
|
+
console.log(chalk.red(msg));
|
|
87
|
+
};
|
|
88
|
+
const success = (msg) => {
|
|
89
|
+
console.log(chalk.green(msg));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export { makeWebDir as i, info as n, success as r, error as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as axios$1 from "axios";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
type SmartbiDev = {
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
4
7
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
declare const setSmartbiEnv: ({
|
|
9
|
+
path,
|
|
10
|
+
dev,
|
|
11
|
+
noop,
|
|
12
|
+
mode
|
|
13
|
+
}: {
|
|
14
|
+
path?: "/smartbi" | "" | string;
|
|
15
|
+
dev?: SmartbiDev;
|
|
16
|
+
mode?: "dev" | "prod";
|
|
17
|
+
noop?: number;
|
|
10
18
|
}) => void;
|
|
11
19
|
/**
|
|
12
20
|
* pending:登录中
|
|
@@ -15,16 +23,17 @@ export declare const setSmartbiEnv: ({ path, dev, noop, mode }: {
|
|
|
15
23
|
*/
|
|
16
24
|
type Status = 'pending' | 'online' | 'offline';
|
|
17
25
|
declare const setStatus: (value: Status) => void, startHeatBeat: () => void, stopHeatBeat: () => void;
|
|
18
|
-
|
|
19
|
-
export declare const smartbi: <T>(className: string, methodName: string, params: Array<string | number | boolean | null | undefined>, requireLogin?: boolean) => Promise<T>;
|
|
26
|
+
declare const smartbi: <T>(className: string, methodName: string, params: Array<string | number | boolean | null | undefined>, requireLogin?: boolean) => Promise<T>;
|
|
20
27
|
/**
|
|
21
28
|
* 登录smartbi服务
|
|
22
29
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
declare const login: (form?: {
|
|
31
|
+
username: string;
|
|
32
|
+
password: string;
|
|
26
33
|
}) => Promise<unknown>;
|
|
27
34
|
/**
|
|
28
35
|
* 心跳
|
|
29
36
|
*/
|
|
30
|
-
|
|
37
|
+
declare const noop: () => Promise<axios$1.AxiosResponse<any, any, {}>>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SmartbiDev, login, noop, setSmartbiEnv, setStatus, smartbi, startHeatBeat, stopHeatBeat };
|
package/dist/index.js
CHANGED
|
@@ -1,141 +1,111 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
//#region src/index.ts
|
|
2
4
|
const __smartbi_env = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
username: "",
|
|
6
|
+
password: "",
|
|
7
|
+
smartbiPath: "/smartbi",
|
|
8
|
+
mode: "prod",
|
|
9
|
+
noop: 3e4
|
|
8
10
|
};
|
|
9
11
|
const HEADERS = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
13
|
+
"X-Requested-With": "XMLHttpRequest"
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log("请勿将账号信息直接赋值到username和password中,避免暴露账号密码,如需要,可考虑从环境变量.env文件中获取");
|
|
21
|
-
}
|
|
15
|
+
const setSmartbiEnv = ({ path = "/smartbi", dev, noop = 3e4, mode = "prod" }) => {
|
|
16
|
+
__smartbi_env.username = dev?.username || "";
|
|
17
|
+
__smartbi_env.password = dev?.password || "";
|
|
18
|
+
__smartbi_env.smartbiPath = path;
|
|
19
|
+
__smartbi_env.mode = mode;
|
|
20
|
+
__smartbi_env.noop = noop;
|
|
21
|
+
if (dev) console.log("请勿将账号信息直接赋值到username和password中,避免暴露账号密码,如需要,可考虑从环境变量.env文件中获取");
|
|
22
22
|
};
|
|
23
23
|
const smartbiInit = () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (requireLogin) {
|
|
71
|
-
if (status === 'offline') {
|
|
72
|
-
status = 'pending';
|
|
73
|
-
login().then(() => {
|
|
74
|
-
emit();
|
|
75
|
-
resolve();
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
else if (status === 'online') {
|
|
79
|
-
resolve();
|
|
80
|
-
}
|
|
81
|
-
else if (status === 'pending') {
|
|
82
|
-
on(() => {
|
|
83
|
-
resolve();
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
resolve();
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
};
|
|
24
|
+
const postList = /* @__PURE__ */ new Set();
|
|
25
|
+
let timer = 0;
|
|
26
|
+
let status = "offline";
|
|
27
|
+
return {
|
|
28
|
+
stopHeatBeat() {
|
|
29
|
+
try {
|
|
30
|
+
clearInterval(timer);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.error(e);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
startHeatBeat() {
|
|
36
|
+
this.stopHeatBeat();
|
|
37
|
+
timer = setInterval(() => {
|
|
38
|
+
if (status === "online") noop().then(() => {});
|
|
39
|
+
}, __smartbi_env.noop);
|
|
40
|
+
},
|
|
41
|
+
setStatus(value) {
|
|
42
|
+
status = value;
|
|
43
|
+
},
|
|
44
|
+
emit() {
|
|
45
|
+
postList.forEach((call) => {
|
|
46
|
+
call();
|
|
47
|
+
});
|
|
48
|
+
postList.clear();
|
|
49
|
+
},
|
|
50
|
+
on(call) {
|
|
51
|
+
postList.add(call);
|
|
52
|
+
},
|
|
53
|
+
handler(requireLogin) {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
if (requireLogin) {
|
|
56
|
+
if (status === "offline") {
|
|
57
|
+
status = "pending";
|
|
58
|
+
login().then(() => {
|
|
59
|
+
emit();
|
|
60
|
+
resolve();
|
|
61
|
+
});
|
|
62
|
+
} else if (status === "online") resolve();
|
|
63
|
+
else if (status === "pending") on(() => {
|
|
64
|
+
resolve();
|
|
65
|
+
});
|
|
66
|
+
} else resolve();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
93
70
|
};
|
|
94
71
|
const { emit, on, handler, setStatus, startHeatBeat, stopHeatBeat } = smartbiInit();
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
console.error(res.data.stackTrace);
|
|
115
|
-
reject(new Error(res.data.stackTrace));
|
|
116
|
-
}
|
|
117
|
-
})
|
|
118
|
-
.catch(e => {
|
|
119
|
-
reject(e);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
72
|
+
const smartbi = (className, methodName, params, requireLogin = __smartbi_env.mode === "dev") => {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
handler(requireLogin).then(() => {
|
|
75
|
+
return axios.post(`${__smartbi_env.smartbiPath}/vision/RMIServlet`, {
|
|
76
|
+
className,
|
|
77
|
+
methodName,
|
|
78
|
+
params: JSON.stringify(params)
|
|
79
|
+
}, { headers: HEADERS });
|
|
80
|
+
}).then((res) => {
|
|
81
|
+
if (res.data.retCode === 0) resolve(res.data.result);
|
|
82
|
+
else {
|
|
83
|
+
console.error("smartbi返回状态错误");
|
|
84
|
+
console.error(res.data.stackTrace);
|
|
85
|
+
reject(new Error(res.data.stackTrace));
|
|
86
|
+
}
|
|
87
|
+
}).catch((e) => {
|
|
88
|
+
reject(e);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
122
91
|
};
|
|
123
92
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
93
|
+
* 登录smartbi服务
|
|
94
|
+
*/
|
|
95
|
+
const login = (form) => {
|
|
96
|
+
return new Promise((resolve) => {
|
|
97
|
+
smartbi("UserService", "login", [form?.username || __smartbi_env.username, form?.password || __smartbi_env.password], false).then((value) => {
|
|
98
|
+
setStatus("online");
|
|
99
|
+
resolve(value);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
133
102
|
};
|
|
134
103
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
headers: HEADERS
|
|
140
|
-
});
|
|
104
|
+
* 心跳
|
|
105
|
+
*/
|
|
106
|
+
const noop = () => {
|
|
107
|
+
return axios.get(__smartbi_env.smartbiPath + "/vision/noop.jsp", { headers: HEADERS });
|
|
141
108
|
};
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
111
|
+
export { login, noop, setSmartbiEnv, setStatus, smartbi, startHeatBeat, stopHeatBeat };
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { B as RunningInfo, C as IParameter, D as NameValuePair, j as Parameter, r as AllExportTypeMap, w as IResult } from "../types-DOYMZhxT.js";
|
|
2
|
+
|
|
3
|
+
//#region src/service/AnalysisReportService.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* 打开多维报表
|
|
4
6
|
* @param reportId 报表ID
|
|
5
7
|
* @returns 返回报表客户端ID
|
|
6
8
|
*/
|
|
7
|
-
|
|
9
|
+
declare const openAnalysisReport: (reportId: string) => Promise<string>;
|
|
8
10
|
/**
|
|
9
11
|
* 打开多维报表(不初始化)
|
|
10
12
|
* @param reportId 报表ID
|
|
11
13
|
* @returns 返回报表客户端ID
|
|
12
14
|
*/
|
|
13
|
-
|
|
15
|
+
declare const openOlapReportWithoutInit: (reportId: string) => Promise<string>;
|
|
14
16
|
/**
|
|
15
17
|
* 关闭多维报表
|
|
16
18
|
* @param clientId 客户端ID
|
|
17
19
|
* @returns 无返回值
|
|
18
20
|
*/
|
|
19
|
-
|
|
21
|
+
declare const closeAnalysisReport: (clientId: string) => Promise<void>;
|
|
20
22
|
/**
|
|
21
23
|
* 设置多维报表参数值
|
|
22
24
|
* @param clientId 客户端ID
|
|
@@ -25,13 +27,13 @@ export declare const closeAnalysisReport: (clientId: string) => Promise<void>;
|
|
|
25
27
|
* @param displayValue 参数显示值
|
|
26
28
|
* @returns 无返回值
|
|
27
29
|
*/
|
|
28
|
-
|
|
30
|
+
declare const setParamValue: (clientId: string, id: string, value: string, displayValue: string) => Promise<void>;
|
|
29
31
|
/**
|
|
30
32
|
* 执行多维查询
|
|
31
33
|
* @param clientId 客户端ID
|
|
32
34
|
* @returns 返回查询结果
|
|
33
35
|
*/
|
|
34
|
-
|
|
36
|
+
declare const executeQuery: (clientId: string) => Promise<IResult>;
|
|
35
37
|
/**
|
|
36
38
|
* 导出报表
|
|
37
39
|
* @param clientId 客户端ID
|
|
@@ -42,7 +44,7 @@ export declare const executeQuery: (clientId: string) => Promise<IResult>;
|
|
|
42
44
|
* @param valueType 值类型(可选)
|
|
43
45
|
* @returns 无返回值
|
|
44
46
|
*/
|
|
45
|
-
|
|
47
|
+
declare const doExport: (clientId: string, exportType: keyof AllExportTypeMap | string, delimiter: string, os: any, // 输出流
|
|
46
48
|
resourceBasePath?: string, valueType?: string) => Promise<void>;
|
|
47
49
|
/**
|
|
48
50
|
* 设置参数为默认值
|
|
@@ -50,44 +52,46 @@ resourceBasePath?: string, valueType?: string) => Promise<void>;
|
|
|
50
52
|
* @param paramId 参数ID
|
|
51
53
|
* @returns 无返回值
|
|
52
54
|
*/
|
|
53
|
-
|
|
55
|
+
declare const setParameterValueAsDefault: (clientId: string, paramId: string) => Promise<void>;
|
|
54
56
|
/**
|
|
55
57
|
* 获取参数
|
|
56
58
|
* @param clientId 客户端ID
|
|
57
59
|
* @param paramId 参数ID
|
|
58
60
|
* @returns 返回参数信息
|
|
59
61
|
*/
|
|
60
|
-
|
|
62
|
+
declare const getParameter: (clientId: string, paramId: string) => Promise<IParameter>;
|
|
61
63
|
/**
|
|
62
64
|
* 获取参数显示值
|
|
63
65
|
* @param clientId 客户端ID
|
|
64
66
|
* @param paramId 参数ID
|
|
65
67
|
* @returns 返回参数显示值
|
|
66
68
|
*/
|
|
67
|
-
|
|
69
|
+
declare const getParameterDisplayValue: (clientId: string, paramId: string) => Promise<string>;
|
|
68
70
|
/**
|
|
69
71
|
* 获取参数默认值
|
|
70
72
|
* @param clientId 客户端ID
|
|
71
73
|
* @param paramId 参数ID
|
|
72
74
|
* @returns 返回参数默认值列表
|
|
73
75
|
*/
|
|
74
|
-
|
|
76
|
+
declare const getParameterDefaultValue: (clientId: string, paramId: string) => Promise<string[]>;
|
|
75
77
|
/**
|
|
76
78
|
* 获取所有参数
|
|
77
79
|
* @param clientId 客户端ID
|
|
78
80
|
* @returns 返回参数列表
|
|
79
81
|
*/
|
|
80
|
-
|
|
82
|
+
declare const getParameters: (clientId: string) => Promise<Parameter[]>;
|
|
81
83
|
/**
|
|
82
84
|
* 获取参数候选值列表
|
|
83
85
|
* @param clientId 客户端ID
|
|
84
86
|
* @param paramId 参数ID
|
|
85
87
|
* @returns 返回候选值列表
|
|
86
88
|
*/
|
|
87
|
-
|
|
89
|
+
declare const getParamStandbyValue: (clientId: string, paramId: string) => Promise<NameValuePair[]>;
|
|
88
90
|
/**
|
|
89
91
|
* 获取执行状态
|
|
90
92
|
* @param clientId 客户端ID
|
|
91
93
|
* @returns 返回执行状态信息
|
|
92
94
|
*/
|
|
93
|
-
|
|
95
|
+
declare const getExecutingState: (clientId: string) => Promise<RunningInfo>;
|
|
96
|
+
//#endregion
|
|
97
|
+
export { closeAnalysisReport, doExport, executeQuery, getExecutingState, getParamStandbyValue, getParameter, getParameterDefaultValue, getParameterDisplayValue, getParameters, openAnalysisReport, openOlapReportWithoutInit, setParamValue, setParameterValueAsDefault };
|