@etsoo/smarterp-core 1.1.59 → 1.1.61
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/__tests__/OrgApi.ts +48 -7
- package/__tests__/tsconfig.json +1 -1
- package/lib/cjs/CoreApp.d.ts +43 -0
- package/lib/cjs/CoreApp.js +34 -0
- package/lib/cjs/OrgApi.d.ts +9 -0
- package/lib/cjs/OrgApi.js +9 -0
- package/lib/cjs/PublicApi.d.ts +9 -0
- package/lib/cjs/PublicApi.js +10 -1
- package/lib/cjs/components/index.d.ts +1 -0
- package/lib/cjs/components/index.js +1 -0
- package/lib/cjs/components/public/TimeZoneList.d.ts +33 -0
- package/lib/cjs/components/public/TimeZoneList.js +27 -0
- package/lib/cjs/dto/org/OrgReportData.d.ts +38 -0
- package/lib/cjs/dto/org/OrgReportData.js +2 -0
- package/lib/cjs/dto/public/TimeZoneItem.d.ts +22 -0
- package/lib/cjs/dto/public/TimeZoneItem.js +2 -0
- package/lib/cjs/i18n/en.json +5 -1
- package/lib/cjs/i18n/zh-Hans.json +5 -1
- package/lib/cjs/i18n/zh-Hant.json +5 -1
- package/lib/cjs/index.d.ts +4 -0
- package/lib/cjs/index.js +4 -0
- package/lib/cjs/rq/org/OrgUsageReportRQ.d.ts +21 -0
- package/lib/cjs/rq/org/OrgUsageReportRQ.js +2 -0
- package/lib/cjs/rq/public/TimeZoneRQ.d.ts +14 -0
- package/lib/cjs/rq/public/TimeZoneRQ.js +2 -0
- package/lib/mjs/CoreApp.d.ts +43 -0
- package/lib/mjs/CoreApp.js +36 -2
- package/lib/mjs/OrgApi.d.ts +9 -0
- package/lib/mjs/OrgApi.js +9 -0
- package/lib/mjs/PublicApi.d.ts +9 -0
- package/lib/mjs/PublicApi.js +10 -1
- package/lib/mjs/components/index.d.ts +1 -0
- package/lib/mjs/components/index.js +1 -0
- package/lib/mjs/components/public/TimeZoneList.d.ts +33 -0
- package/lib/mjs/components/public/TimeZoneList.js +24 -0
- package/lib/mjs/dto/org/OrgReportData.d.ts +38 -0
- package/lib/mjs/dto/org/OrgReportData.js +1 -0
- package/lib/mjs/dto/public/TimeZoneItem.d.ts +22 -0
- package/lib/mjs/dto/public/TimeZoneItem.js +1 -0
- package/lib/mjs/i18n/en.json +5 -1
- package/lib/mjs/i18n/zh-Hans.json +5 -1
- package/lib/mjs/i18n/zh-Hant.json +5 -1
- package/lib/mjs/index.d.ts +4 -0
- package/lib/mjs/index.js +4 -0
- package/lib/mjs/rq/org/OrgUsageReportRQ.d.ts +21 -0
- package/lib/mjs/rq/org/OrgUsageReportRQ.js +1 -0
- package/lib/mjs/rq/public/TimeZoneRQ.d.ts +14 -0
- package/lib/mjs/rq/public/TimeZoneRQ.js +1 -0
- package/package.json +8 -8
- package/src/CoreApp.ts +78 -1
- package/src/OrgApi.ts +12 -0
- package/src/PublicApi.ts +15 -3
- package/src/components/index.ts +1 -0
- package/src/components/public/TimeZoneList.tsx +82 -0
- package/src/dto/org/OrgReportData.ts +41 -0
- package/src/dto/public/TimeZoneItem.ts +25 -0
- package/src/i18n/en.json +5 -1
- package/src/i18n/zh-Hans.json +5 -1
- package/src/i18n/zh-Hant.json +5 -1
- package/src/index.ts +4 -0
- package/src/rq/org/OrgUsageReportRQ.ts +23 -0
- package/src/rq/public/TimeZoneRQ.ts +16 -0
package/__tests__/OrgApi.ts
CHANGED
|
@@ -3,11 +3,56 @@ import { isLocalTest, TestApp } from "./app/TestApp";
|
|
|
3
3
|
import { EntityStatus } from "@etsoo/appscript";
|
|
4
4
|
import { OrgApi } from "../src/OrgApi";
|
|
5
5
|
import { OrgCreateRQ } from "../src/rq/org/OrgCreateRQ";
|
|
6
|
+
import { CoreApp } from "../src";
|
|
7
|
+
|
|
8
|
+
const app = new TestApp();
|
|
9
|
+
await app.changeCulture(app.settings.cultures[0]);
|
|
10
|
+
|
|
11
|
+
test("Test SysResourceKeyPrefix", () => {
|
|
12
|
+
const source = [
|
|
13
|
+
{
|
|
14
|
+
period: 202601,
|
|
15
|
+
qty: 236
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
period: 202602,
|
|
19
|
+
qty: 99
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
period: 202603,
|
|
23
|
+
qty: 120
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
period: 202604,
|
|
27
|
+
qty: 199
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
period: 202605,
|
|
31
|
+
qty: 230
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
period: 202606,
|
|
35
|
+
qty: 3
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
period: 202505,
|
|
39
|
+
qty: 215
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const core = new CoreApp(app, app.api);
|
|
44
|
+
const result = core.transformReportData(source, true, 2026);
|
|
45
|
+
|
|
46
|
+
expect(result.labels.length).toBe(12);
|
|
47
|
+
expect(result.currentYearData[5]).toBe(3);
|
|
48
|
+
expect(result.lastYearData[4]).toBe(215);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("Test SysResourceKeyPrefix", () => {
|
|
52
|
+
expect(OrgApi.SysResourceKeyPrefix).toBe("etsoo");
|
|
53
|
+
});
|
|
6
54
|
|
|
7
55
|
if (isLocalTest) {
|
|
8
|
-
const app = new TestApp();
|
|
9
|
-
await app.changeCulture(app.settings.cultures[0]);
|
|
10
|
-
|
|
11
56
|
// Simulate logined
|
|
12
57
|
app.authorize(
|
|
13
58
|
"eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGVuYyNrdy1hZXMyNTYiLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIiwidHlwIjoiSldUIiwiY3R5IjoiSldUIn0.dtsirpxAaX-pHgFrSRp9bTEvkFkphcihoOC9Mj-hgNEY9fvgSrb4-NkaQxiw1KIIXdct_2wXeHe4-vcWOrkpABANtf6LHdJo.vk9wrjb6DIw0f9xLAj-3AQ.CwEV20n7LhwalIx3a3WDQkJjMAHW1Bn6VJGMjfckNVBZv0G_xcWZbo5Gg2CF4vdUjH6pqAH5IhuMmRqlkeCYwuF5d_rQVI_kLtmvgpAJoqYhU3-J_XqPrLpdWXPQ-V84lzngTAJlIX4On6JP_ZRTWLZDGxiiC1Tg_6GlWU3EUX2kcMBb03NWGczHaPS5-ivp4L9CntqaEOOK35cWQx6oZyp0KmwM6KjoY3ard5SLUofF10DqBwto6KqNAeZnLjBnJV_j9dX-si5FalrGrTV09KtjSMeXd7Rp3VfC5BRge5zSx5CecEzk_yt50GdYjvDRYj31whyVx0bVLKH9Pyz1OsHLDfolVpSRRIk-1UuaZz-5WfKcUrE6EWB-Mykn5Mxiyo7CxlhHOnEkUAJ5wdYGiRdVkk04HA8YdOxBRHUZzB44nrUVIWEYtWu8KddQTkWhYOCNc4OdCBweuiO_TEt2haxEsUmyuRZ0PgoVg-B8ZUXz0ot79GNQcd8ZYoaaap8WYhvMod8lw-e-HH7fABlCoAsIx8xt4aMGOD1iVgXFTnJ4qD9x5suZczHqj4BoeoKkgg1Lil_jG_3cADxIRPmReWqeOrrA6f54PjBd5kdSNNv72axxW3AfbZaOYQ-n7zzQjWUgKZnMnu4N2NXCkis8JvHCfVi3jgUO3jeGp6vVlPoaCbFXXMiKKL1bkhRXZT47uglPi4zD2tRqKOEzGMPpB4d0X_tZVt_lPRvbLFjUNUVikQGA3nD_9c5B5QfI4olFjA6H4eUN7b74R4HcVIr6hNBvDKGXeTJBmoopu4fGMAysCJ_ybUcJxWXldoy6nFTZjJ2QllbLLqdYuCvxYlTo3Z4nODna6NW18QcSXIIHj3U6H6VIDkXBnjArkvsgj_0uvqW_zyZNj_JIONAuwZYfDC6gsjbzV7llp53d3o3-xFhOBvxUibFTPvY39E-X_-crww6flp_tDyndlzBoVYMhybhnRLQy-PpO4dZQhzr2sdHpsF57Fj7SecXwbAtcQdKp.C6VZunr9ohscx6vVMVmRQnG37pWumGCHMLO0jJmLQXo"
|
|
@@ -58,10 +103,6 @@ if (isLocalTest) {
|
|
|
58
103
|
});
|
|
59
104
|
*/
|
|
60
105
|
|
|
61
|
-
test("Test SysResourceKeyPrefix", () => {
|
|
62
|
-
expect(OrgApi.SysResourceKeyPrefix).toBe("etsoo");
|
|
63
|
-
});
|
|
64
|
-
|
|
65
106
|
test("Test for query zero return", async () => {
|
|
66
107
|
const result = await api.query({
|
|
67
108
|
keyword: "亿速",
|
package/__tests__/tsconfig.json
CHANGED
package/lib/cjs/CoreApp.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ListType, ListType1 } from "@etsoo/shared";
|
|
|
10
10
|
import { CoreApiService } from "./dto/org/CoreApiService";
|
|
11
11
|
import { DocumentApi } from "./DocumentApi";
|
|
12
12
|
import { DocumentKind } from "./dto/document/DocumentKind";
|
|
13
|
+
import { OrgReportData } from "./dto/org/OrgReportData";
|
|
13
14
|
type AppData = {
|
|
14
15
|
id: number;
|
|
15
16
|
appId?: number;
|
|
@@ -123,6 +124,27 @@ export interface ICoreApp {
|
|
|
123
124
|
* @returns List
|
|
124
125
|
*/
|
|
125
126
|
getIdentityFlags(identity?: number | true): ListType[];
|
|
127
|
+
/**
|
|
128
|
+
* Get report data
|
|
129
|
+
* 获取报告数据
|
|
130
|
+
* @param data Input data
|
|
131
|
+
* @param year Year to calculate
|
|
132
|
+
* @returns Result
|
|
133
|
+
*/
|
|
134
|
+
getReportData(data: OrgReportData[], year: number): number[];
|
|
135
|
+
/**
|
|
136
|
+
* Transform report data for chart
|
|
137
|
+
* 转换报告数据用于图表
|
|
138
|
+
* @param data Input data
|
|
139
|
+
* @param hasLastYear Has last year data
|
|
140
|
+
* @param year Year to calculate, default is current year
|
|
141
|
+
* @returns Transformed report data
|
|
142
|
+
*/
|
|
143
|
+
transformReportData(data: OrgReportData[], hasLastYear?: boolean, year?: number): {
|
|
144
|
+
labels: string[];
|
|
145
|
+
currentYearData: number[];
|
|
146
|
+
lastYearData: number[];
|
|
147
|
+
};
|
|
126
148
|
}
|
|
127
149
|
/**
|
|
128
150
|
* Core application
|
|
@@ -256,5 +278,26 @@ export declare class CoreApp implements ICoreApp {
|
|
|
256
278
|
* @returns List
|
|
257
279
|
*/
|
|
258
280
|
getIdentityFlags(identity?: number | true): ListType[];
|
|
281
|
+
/**
|
|
282
|
+
* Get report data
|
|
283
|
+
* 获取报告数据
|
|
284
|
+
* @param data Input data
|
|
285
|
+
* @param year Year to calculate
|
|
286
|
+
* @returns Result
|
|
287
|
+
*/
|
|
288
|
+
getReportData(data: OrgReportData[], year: number): number[];
|
|
289
|
+
/**
|
|
290
|
+
* Transform report data for chart
|
|
291
|
+
* 转换报告数据用于图表
|
|
292
|
+
* @param data Input data
|
|
293
|
+
* @param hasLastYear Has last year data
|
|
294
|
+
* @param year Year to calculate, default is current year
|
|
295
|
+
* @returns Transformed report data
|
|
296
|
+
*/
|
|
297
|
+
transformReportData(data: OrgReportData[], hasLastYear?: boolean, year?: number): {
|
|
298
|
+
labels: string[];
|
|
299
|
+
currentYearData: number[];
|
|
300
|
+
lastYearData: number[];
|
|
301
|
+
};
|
|
259
302
|
}
|
|
260
303
|
export {};
|
package/lib/cjs/CoreApp.js
CHANGED
|
@@ -220,5 +220,39 @@ class CoreApp {
|
|
|
220
220
|
return id;
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Get report data
|
|
225
|
+
* 获取报告数据
|
|
226
|
+
* @param data Input data
|
|
227
|
+
* @param year Year to calculate
|
|
228
|
+
* @returns Result
|
|
229
|
+
*/
|
|
230
|
+
getReportData(data, year) {
|
|
231
|
+
const [start, end] = shared_1.NumberUtils.getMonthPeriodRange(year);
|
|
232
|
+
const items = [];
|
|
233
|
+
for (let i = start; i <= end; i++) {
|
|
234
|
+
const item = data.find((d) => d.period === i);
|
|
235
|
+
items.push(item ? ("qty" in item ? item.qty : item.amount) : 0);
|
|
236
|
+
}
|
|
237
|
+
return items;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Transform report data for chart
|
|
241
|
+
* 转换报告数据用于图表
|
|
242
|
+
* @param data Input data
|
|
243
|
+
* @param hasLastYear Has last year data
|
|
244
|
+
* @param year Year to calculate, default is current year
|
|
245
|
+
* @returns Transformed report data
|
|
246
|
+
*/
|
|
247
|
+
transformReportData(data, hasLastYear, year) {
|
|
248
|
+
year ??= new Date().getFullYear();
|
|
249
|
+
const months = appscript_1.BusinessUtils.getMonths(this.app.get("months") ?? []);
|
|
250
|
+
const labels = months.map((m) => m.label);
|
|
251
|
+
const currentYearData = this.getReportData(data, year);
|
|
252
|
+
const lastYearData = hasLastYear == null || hasLastYear
|
|
253
|
+
? this.getReportData(data, year - 1)
|
|
254
|
+
: [];
|
|
255
|
+
return { labels, currentYearData, lastYearData };
|
|
256
|
+
}
|
|
223
257
|
}
|
|
224
258
|
exports.CoreApp = CoreApp;
|
package/lib/cjs/OrgApi.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ import { OrgQueryApiData } from "./dto/org/OrgQueryApiData";
|
|
|
26
26
|
import { CoreApiService } from "./dto/org/CoreApiService";
|
|
27
27
|
import { UploadFilesResult } from "./dto/org/UploadFilesResult";
|
|
28
28
|
import { OrgOwnsRQ } from "./rq/org/OrgOwnsRQ";
|
|
29
|
+
import { OrgUsageReportRQ } from "./rq/org/OrgUsageReportRQ";
|
|
30
|
+
import { OrgReportData } from "./dto/org/OrgReportData";
|
|
29
31
|
/**
|
|
30
32
|
* Organization API
|
|
31
33
|
* 机构接口
|
|
@@ -247,4 +249,11 @@ export declare class OrgApi extends EntityApi {
|
|
|
247
249
|
* @returns Result
|
|
248
250
|
*/
|
|
249
251
|
updateResourceRead(id: number, payload?: IApiPayload<OrgUpdateResourceReadData>): Promise<OrgUpdateResourceReadData | undefined>;
|
|
252
|
+
/**
|
|
253
|
+
* Get usage report
|
|
254
|
+
* @param rq Request data
|
|
255
|
+
* @param payload Payload
|
|
256
|
+
* @returns Result
|
|
257
|
+
*/
|
|
258
|
+
usageReport(rq: OrgUsageReportRQ, payload?: IApiPayload<OrgReportData[]>): Promise<OrgReportData[] | undefined>;
|
|
250
259
|
}
|
package/lib/cjs/OrgApi.js
CHANGED
|
@@ -305,5 +305,14 @@ class OrgApi extends appscript_1.EntityApi {
|
|
|
305
305
|
updateResourceRead(id, payload) {
|
|
306
306
|
return this.api.get(`${this.flag}/UpdateResourceRead/${id}`, undefined, payload);
|
|
307
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* Get usage report
|
|
310
|
+
* @param rq Request data
|
|
311
|
+
* @param payload Payload
|
|
312
|
+
* @returns Result
|
|
313
|
+
*/
|
|
314
|
+
usageReport(rq, payload) {
|
|
315
|
+
return this.api.post(`${this.flag}/UsageReport`, rq, payload);
|
|
316
|
+
}
|
|
308
317
|
}
|
|
309
318
|
exports.OrgApi = OrgApi;
|
package/lib/cjs/PublicApi.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { AcceptInvitationRQ } from "./rq/public/AcceptInvitationRQ";
|
|
|
12
12
|
import { ChinaPinData } from "./dto/public/ChinaPinData";
|
|
13
13
|
import { ParseNameRQ } from "./rq/public/ParseNameRQ";
|
|
14
14
|
import { NameData } from "./dto/public/NameData";
|
|
15
|
+
import { TimeZoneItem } from "./dto/public/TimeZoneItem";
|
|
16
|
+
import { TimeZoneRQ } from "./rq/public/TimeZoneRQ";
|
|
15
17
|
/**
|
|
16
18
|
* Public API
|
|
17
19
|
* 公共接口
|
|
@@ -78,6 +80,13 @@ export declare class PublicApi extends BaseApi {
|
|
|
78
80
|
* @returns Result
|
|
79
81
|
*/
|
|
80
82
|
getRegions(ids?: string[], payload?: IApiPayload<RegionData[]>): Promise<RegionData[] | undefined>;
|
|
83
|
+
/**
|
|
84
|
+
* Get time zones
|
|
85
|
+
* @param rq Request data
|
|
86
|
+
* @param payload Payload
|
|
87
|
+
* @returns Result
|
|
88
|
+
*/
|
|
89
|
+
getTimeZones(rq?: TimeZoneRQ, payload?: IApiPayload<TimeZoneItem[]>): Promise<TimeZoneItem[] | undefined>;
|
|
81
90
|
/**
|
|
82
91
|
* Get product unit's label
|
|
83
92
|
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
package/lib/cjs/PublicApi.js
CHANGED
|
@@ -98,6 +98,15 @@ class PublicApi extends appscript_1.BaseApi {
|
|
|
98
98
|
contentType: "application/json"
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Get time zones
|
|
103
|
+
* @param rq Request data
|
|
104
|
+
* @param payload Payload
|
|
105
|
+
* @returns Result
|
|
106
|
+
*/
|
|
107
|
+
getTimeZones(rq, payload) {
|
|
108
|
+
return this.api.post("Public/GetTimeZones", rq, payload);
|
|
109
|
+
}
|
|
101
110
|
/**
|
|
102
111
|
* Get product unit's label
|
|
103
112
|
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
@@ -116,7 +125,7 @@ class PublicApi extends appscript_1.BaseApi {
|
|
|
116
125
|
}
|
|
117
126
|
getUnitJoin(isJoined) {
|
|
118
127
|
return typeof isJoined === "string"
|
|
119
|
-
? this.app.get(isJoined) ?? isJoined
|
|
128
|
+
? (this.app.get(isJoined) ?? isJoined)
|
|
120
129
|
: isJoined
|
|
121
130
|
? this.app.get("unitJoin")
|
|
122
131
|
: undefined;
|
|
@@ -39,5 +39,6 @@ __exportStar(require("./public/ButtonRadioRegions"), exports);
|
|
|
39
39
|
__exportStar(require("./public/ButtonRegions"), exports);
|
|
40
40
|
__exportStar(require("./public/CultureList"), exports);
|
|
41
41
|
__exportStar(require("./public/ProductBaseUnits"), exports);
|
|
42
|
+
__exportStar(require("./public/TimeZoneList"), exports);
|
|
42
43
|
// user
|
|
43
44
|
__exportStar(require("./user/UserTiplist"), exports);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TiplistProps } from "@etsoo/materialui";
|
|
2
|
+
import { TimeZoneItem } from "../../dto/public/TimeZoneItem";
|
|
3
|
+
import { TimeZoneRQ } from "../../rq/public/TimeZoneRQ";
|
|
4
|
+
/**
|
|
5
|
+
* Time zone tiplist properties
|
|
6
|
+
* 时区提示列表属性
|
|
7
|
+
*/
|
|
8
|
+
export type TimeZoneTiplistProps = Omit<TiplistProps<TimeZoneItem, "id">, "loadData" | "label" | "name"> & {
|
|
9
|
+
/**
|
|
10
|
+
* Label
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Name
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Default request data
|
|
19
|
+
*/
|
|
20
|
+
rq?: Partial<TimeZoneRQ>;
|
|
21
|
+
/**
|
|
22
|
+
* Load data handler
|
|
23
|
+
* @param rq Request data
|
|
24
|
+
*/
|
|
25
|
+
onLoadData?: (rq: TimeZoneRQ) => TimeZoneRQ;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Time zone tiplist
|
|
29
|
+
* 时区提示列表
|
|
30
|
+
* @param props Properties
|
|
31
|
+
* @returns Component
|
|
32
|
+
*/
|
|
33
|
+
export declare function TimeZoneTiplist(props: TimeZoneTiplistProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimeZoneTiplist = TimeZoneTiplist;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const materialui_1 = require("@etsoo/materialui");
|
|
6
|
+
const ICoreServiceApp_1 = require("../../ICoreServiceApp");
|
|
7
|
+
/**
|
|
8
|
+
* Time zone tiplist
|
|
9
|
+
* 时区提示列表
|
|
10
|
+
* @param props Properties
|
|
11
|
+
* @returns Component
|
|
12
|
+
*/
|
|
13
|
+
function TimeZoneTiplist(props) {
|
|
14
|
+
// App
|
|
15
|
+
const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
|
|
16
|
+
// Destruct
|
|
17
|
+
const { fullWidth = true, label = app.get("timeZone"), maxItems = 10, getOptionLabel = (data) => data.displayName, onLoadData = (rq) => rq, name = "timeZone", rq = { enabled: true }, ...rest } = props;
|
|
18
|
+
// Layout
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.publicApi.getTimeZones(onLoadData({
|
|
20
|
+
...rq,
|
|
21
|
+
keyword,
|
|
22
|
+
id,
|
|
23
|
+
queryPaging: {
|
|
24
|
+
batchSize: maxItems
|
|
25
|
+
}
|
|
26
|
+
}), { showLoading: false, defaultValue: [] }), ...rest }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization usage report data
|
|
3
|
+
* 机构使用报告数据
|
|
4
|
+
*/
|
|
5
|
+
type OrgUsageReportData = {
|
|
6
|
+
/**
|
|
7
|
+
* Period
|
|
8
|
+
* 周期
|
|
9
|
+
*/
|
|
10
|
+
period: number;
|
|
11
|
+
/**
|
|
12
|
+
* Qty.
|
|
13
|
+
* 数量
|
|
14
|
+
*/
|
|
15
|
+
qty: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Organization amount report data
|
|
19
|
+
* 机构金额报告数据
|
|
20
|
+
*/
|
|
21
|
+
type OrgAmountReportData = {
|
|
22
|
+
/**
|
|
23
|
+
* Period
|
|
24
|
+
* 周期
|
|
25
|
+
*/
|
|
26
|
+
period: number;
|
|
27
|
+
/**
|
|
28
|
+
* Amount
|
|
29
|
+
* 金额
|
|
30
|
+
*/
|
|
31
|
+
amount: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Organization report data
|
|
35
|
+
* 机构报告数据
|
|
36
|
+
*/
|
|
37
|
+
export type OrgReportData = OrgUsageReportData | OrgAmountReportData;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type TimeZoneItem = {
|
|
2
|
+
/**
|
|
3
|
+
* IANA Id
|
|
4
|
+
* IANA 编号
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* Display name
|
|
9
|
+
* 显示名称
|
|
10
|
+
*/
|
|
11
|
+
displayName: string;
|
|
12
|
+
/**
|
|
13
|
+
* Standard name
|
|
14
|
+
* 标准名称
|
|
15
|
+
*/
|
|
16
|
+
standardName: string;
|
|
17
|
+
/**
|
|
18
|
+
* UTC offset
|
|
19
|
+
* UTC偏移
|
|
20
|
+
*/
|
|
21
|
+
utcOffset: string;
|
|
22
|
+
};
|
package/lib/cjs/i18n/en.json
CHANGED
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"roleOperator": "Operator",
|
|
107
107
|
"rolePartner": "Channel Partner",
|
|
108
108
|
"roleUser": "User",
|
|
109
|
+
"samePeriodLastYear": "Same period last year",
|
|
109
110
|
"slogan": "Slogan",
|
|
110
111
|
"smarterp": "SmartERP Cloud",
|
|
111
112
|
"signin": "Sign in",
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
"templateCMSPODATA": "CMS PO data",
|
|
133
134
|
"templateCMSSTOCKDATA": "CMS stock data",
|
|
134
135
|
"templateKind": "Template kind",
|
|
136
|
+
"timeZone": "Time zone",
|
|
135
137
|
"years5": ["1 year", "2 years", "3 years", "4 years", "5 years"],
|
|
136
138
|
"uiTypeEmail": "Email",
|
|
137
139
|
"uiTypeMobile": "Mobile",
|
|
@@ -139,5 +141,7 @@
|
|
|
139
141
|
"uiTypeAlipay": "Alipay",
|
|
140
142
|
"uiTypeGoogle": "Google",
|
|
141
143
|
"uiTypeMicrosoft": "Microsoft",
|
|
142
|
-
"updatedAt": "Updated at"
|
|
144
|
+
"updatedAt": "Updated at",
|
|
145
|
+
"usage": "Usage",
|
|
146
|
+
"usageReport": "Usage report"
|
|
143
147
|
}
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"roleOperator": "操作员",
|
|
107
107
|
"rolePartner": "渠道伙伴",
|
|
108
108
|
"roleUser": "用户",
|
|
109
|
+
"samePeriodLastYear": "去年同期",
|
|
109
110
|
"slogan": "标语",
|
|
110
111
|
"smarterp": "司友®云ERP",
|
|
111
112
|
"signin": "登录",
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
"templateCMSPODATA": "CMS采购数据",
|
|
133
134
|
"templateCMSSTOCKDATA": "CMS库存数据",
|
|
134
135
|
"templateKind": "模板类型",
|
|
136
|
+
"timeZone": "时区",
|
|
135
137
|
"years5": ["1年", "2年", "3年", "4年", "5年"],
|
|
136
138
|
"uiTypeEmail": "电子邮箱",
|
|
137
139
|
"uiTypeMobile": "手机号",
|
|
@@ -139,5 +141,7 @@
|
|
|
139
141
|
"uiTypeAlipay": "支付宝",
|
|
140
142
|
"uiTypeGoogle": "谷歌",
|
|
141
143
|
"uiTypeMicrosoft": "微软",
|
|
142
|
-
"updatedAt": "更新时间"
|
|
144
|
+
"updatedAt": "更新时间",
|
|
145
|
+
"usage": "使用量",
|
|
146
|
+
"usageReport": "使用情况报告"
|
|
143
147
|
}
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"roleOperator": "操作員",
|
|
107
107
|
"rolePartner": "渠道夥伴",
|
|
108
108
|
"roleUser": "用戶",
|
|
109
|
+
"samePeriodLastYear": "去年同期",
|
|
109
110
|
"signin": "登入",
|
|
110
111
|
"signout": "登出",
|
|
111
112
|
"slogan": "標語",
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
"templateCMSPODATA": "CMS採購數據",
|
|
133
134
|
"templateCMSSTOCKDATA": "CMS庫存數據",
|
|
134
135
|
"templateKind": "模板類型",
|
|
136
|
+
"timeZone": "時區",
|
|
135
137
|
"years5": ["1年", "2年", "3年", "4年", "5年"],
|
|
136
138
|
"uiTypeEmail": "電子郵件",
|
|
137
139
|
"uiTypeMobile": "手機號碼",
|
|
@@ -139,5 +141,7 @@
|
|
|
139
141
|
"uiTypeAlipay": "支付寶",
|
|
140
142
|
"uiTypeGoogle": "谷歌",
|
|
141
143
|
"uiTypeMicrosoft": "微軟",
|
|
142
|
-
"updatedAt": "更新時間"
|
|
144
|
+
"updatedAt": "更新時間",
|
|
145
|
+
"usage": "使用量",
|
|
146
|
+
"usageReport": "使用情況報告"
|
|
143
147
|
}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from "./dto/org/OrgQueryApiData";
|
|
|
22
22
|
export * from "./dto/org/OrgQueryDto";
|
|
23
23
|
export * from "./dto/org/OrgQueryResourceData";
|
|
24
24
|
export * from "./dto/org/OrgReadDto";
|
|
25
|
+
export * from "./dto/org/OrgReportData";
|
|
25
26
|
export * from "./dto/org/OrgResourceItem";
|
|
26
27
|
export * from "./dto/org/OrgUpdateApiReadDto";
|
|
27
28
|
export * from "./dto/org/OrgUpdateReadDto";
|
|
@@ -33,6 +34,7 @@ export * from "./dto/public/MemberInvitationDto";
|
|
|
33
34
|
export * from "./dto/public/NameData";
|
|
34
35
|
export * from "./dto/public/PlaceCommon";
|
|
35
36
|
export * from "./dto/public/RegionData";
|
|
37
|
+
export * from "./dto/public/TimeZoneItem";
|
|
36
38
|
export * from "./dto/user/AuditHistoryDto";
|
|
37
39
|
export * from "./dto/user/DeviceListDto";
|
|
38
40
|
export * from "./dto/user/UserIdentifierData";
|
|
@@ -68,6 +70,7 @@ export * from "./rq/org/OrgQueryApiRQ";
|
|
|
68
70
|
export * from "./rq/org/OrgQueryResourceRQ";
|
|
69
71
|
export * from "./rq/org/OrgQueryRQ";
|
|
70
72
|
export * from "./rq/org/OrgUpdateApiRQ";
|
|
73
|
+
export * from "./rq/org/OrgUsageReportRQ";
|
|
71
74
|
export * from "./rq/org/OrgUpdateRQ";
|
|
72
75
|
export * from "./rq/org/SendEmailMessage";
|
|
73
76
|
export * from "./rq/org/SendProfileEmailRQ";
|
|
@@ -77,6 +80,7 @@ export * from "./rq/public/CreateBarcodeRQ";
|
|
|
77
80
|
export * from "./rq/public/ParseNameRQ";
|
|
78
81
|
export * from "./rq/public/PinyinRQ";
|
|
79
82
|
export * from "./rq/public/PlaceQueryRQ";
|
|
83
|
+
export * from "./rq/public/TimeZoneRQ";
|
|
80
84
|
export * from "./rq/user/AuditHistoryRQ";
|
|
81
85
|
export * from "./rq/user/UserUpdateRQ";
|
|
82
86
|
export * from "./AppApi";
|
package/lib/cjs/index.js
CHANGED
|
@@ -39,6 +39,7 @@ __exportStar(require("./dto/org/OrgQueryApiData"), exports);
|
|
|
39
39
|
__exportStar(require("./dto/org/OrgQueryDto"), exports);
|
|
40
40
|
__exportStar(require("./dto/org/OrgQueryResourceData"), exports);
|
|
41
41
|
__exportStar(require("./dto/org/OrgReadDto"), exports);
|
|
42
|
+
__exportStar(require("./dto/org/OrgReportData"), exports);
|
|
42
43
|
__exportStar(require("./dto/org/OrgResourceItem"), exports);
|
|
43
44
|
__exportStar(require("./dto/org/OrgUpdateApiReadDto"), exports);
|
|
44
45
|
__exportStar(require("./dto/org/OrgUpdateReadDto"), exports);
|
|
@@ -50,6 +51,7 @@ __exportStar(require("./dto/public/MemberInvitationDto"), exports);
|
|
|
50
51
|
__exportStar(require("./dto/public/NameData"), exports);
|
|
51
52
|
__exportStar(require("./dto/public/PlaceCommon"), exports);
|
|
52
53
|
__exportStar(require("./dto/public/RegionData"), exports);
|
|
54
|
+
__exportStar(require("./dto/public/TimeZoneItem"), exports);
|
|
53
55
|
__exportStar(require("./dto/user/AuditHistoryDto"), exports);
|
|
54
56
|
__exportStar(require("./dto/user/DeviceListDto"), exports);
|
|
55
57
|
__exportStar(require("./dto/user/UserIdentifierData"), exports);
|
|
@@ -87,6 +89,7 @@ __exportStar(require("./rq/org/OrgQueryApiRQ"), exports);
|
|
|
87
89
|
__exportStar(require("./rq/org/OrgQueryResourceRQ"), exports);
|
|
88
90
|
__exportStar(require("./rq/org/OrgQueryRQ"), exports);
|
|
89
91
|
__exportStar(require("./rq/org/OrgUpdateApiRQ"), exports);
|
|
92
|
+
__exportStar(require("./rq/org/OrgUsageReportRQ"), exports);
|
|
90
93
|
__exportStar(require("./rq/org/OrgUpdateRQ"), exports);
|
|
91
94
|
__exportStar(require("./rq/org/SendEmailMessage"), exports);
|
|
92
95
|
__exportStar(require("./rq/org/SendProfileEmailRQ"), exports);
|
|
@@ -96,6 +99,7 @@ __exportStar(require("./rq/public/CreateBarcodeRQ"), exports);
|
|
|
96
99
|
__exportStar(require("./rq/public/ParseNameRQ"), exports);
|
|
97
100
|
__exportStar(require("./rq/public/PinyinRQ"), exports);
|
|
98
101
|
__exportStar(require("./rq/public/PlaceQueryRQ"), exports);
|
|
102
|
+
__exportStar(require("./rq/public/TimeZoneRQ"), exports);
|
|
99
103
|
__exportStar(require("./rq/user/AuditHistoryRQ"), exports);
|
|
100
104
|
__exportStar(require("./rq/user/UserUpdateRQ"), exports);
|
|
101
105
|
// APIs
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization usage report request data
|
|
3
|
+
* 机构使用报告请求数据
|
|
4
|
+
*/
|
|
5
|
+
export type OrgUsageReportRQ = {
|
|
6
|
+
/**
|
|
7
|
+
* Organization id
|
|
8
|
+
* 机构编号
|
|
9
|
+
*/
|
|
10
|
+
orgId?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Year
|
|
13
|
+
* 年
|
|
14
|
+
*/
|
|
15
|
+
year?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to include last year data
|
|
18
|
+
* 是否包含去年数据
|
|
19
|
+
*/
|
|
20
|
+
hasLastYear?: boolean;
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { QueryRQ } from "@etsoo/appscript";
|
|
2
|
+
export type TimeZoneRQ = QueryRQ<string> & {
|
|
3
|
+
/**
|
|
4
|
+
* Culture, like "en-US", "zh-CN", etc.
|
|
5
|
+
* If not specified, the current culture will be used.
|
|
6
|
+
* 文化
|
|
7
|
+
*/
|
|
8
|
+
culture?: string;
|
|
9
|
+
/**
|
|
10
|
+
* All system timezones
|
|
11
|
+
* 所有系统时区
|
|
12
|
+
*/
|
|
13
|
+
all?: boolean;
|
|
14
|
+
};
|
package/lib/mjs/CoreApp.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ListType, ListType1 } from "@etsoo/shared";
|
|
|
10
10
|
import { CoreApiService } from "./dto/org/CoreApiService";
|
|
11
11
|
import { DocumentApi } from "./DocumentApi";
|
|
12
12
|
import { DocumentKind } from "./dto/document/DocumentKind";
|
|
13
|
+
import { OrgReportData } from "./dto/org/OrgReportData";
|
|
13
14
|
type AppData = {
|
|
14
15
|
id: number;
|
|
15
16
|
appId?: number;
|
|
@@ -123,6 +124,27 @@ export interface ICoreApp {
|
|
|
123
124
|
* @returns List
|
|
124
125
|
*/
|
|
125
126
|
getIdentityFlags(identity?: number | true): ListType[];
|
|
127
|
+
/**
|
|
128
|
+
* Get report data
|
|
129
|
+
* 获取报告数据
|
|
130
|
+
* @param data Input data
|
|
131
|
+
* @param year Year to calculate
|
|
132
|
+
* @returns Result
|
|
133
|
+
*/
|
|
134
|
+
getReportData(data: OrgReportData[], year: number): number[];
|
|
135
|
+
/**
|
|
136
|
+
* Transform report data for chart
|
|
137
|
+
* 转换报告数据用于图表
|
|
138
|
+
* @param data Input data
|
|
139
|
+
* @param hasLastYear Has last year data
|
|
140
|
+
* @param year Year to calculate, default is current year
|
|
141
|
+
* @returns Transformed report data
|
|
142
|
+
*/
|
|
143
|
+
transformReportData(data: OrgReportData[], hasLastYear?: boolean, year?: number): {
|
|
144
|
+
labels: string[];
|
|
145
|
+
currentYearData: number[];
|
|
146
|
+
lastYearData: number[];
|
|
147
|
+
};
|
|
126
148
|
}
|
|
127
149
|
/**
|
|
128
150
|
* Core application
|
|
@@ -256,5 +278,26 @@ export declare class CoreApp implements ICoreApp {
|
|
|
256
278
|
* @returns List
|
|
257
279
|
*/
|
|
258
280
|
getIdentityFlags(identity?: number | true): ListType[];
|
|
281
|
+
/**
|
|
282
|
+
* Get report data
|
|
283
|
+
* 获取报告数据
|
|
284
|
+
* @param data Input data
|
|
285
|
+
* @param year Year to calculate
|
|
286
|
+
* @returns Result
|
|
287
|
+
*/
|
|
288
|
+
getReportData(data: OrgReportData[], year: number): number[];
|
|
289
|
+
/**
|
|
290
|
+
* Transform report data for chart
|
|
291
|
+
* 转换报告数据用于图表
|
|
292
|
+
* @param data Input data
|
|
293
|
+
* @param hasLastYear Has last year data
|
|
294
|
+
* @param year Year to calculate, default is current year
|
|
295
|
+
* @returns Transformed report data
|
|
296
|
+
*/
|
|
297
|
+
transformReportData(data: OrgReportData[], hasLastYear?: boolean, year?: number): {
|
|
298
|
+
labels: string[];
|
|
299
|
+
currentYearData: number[];
|
|
300
|
+
lastYearData: number[];
|
|
301
|
+
};
|
|
259
302
|
}
|
|
260
303
|
export {};
|