@indfnd/utils 0.1.32 → 0.1.33
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/CHANGELOG.md +14 -0
- package/dist/ind-utils.es.js +31 -9
- package/dist/ind-utils.umd.cjs +10 -10
- package/package.json +1 -1
- package/src/api/permission.ts +11 -2
- package/src/api/platform/config.js +22 -0
- package/src/api/platform/index.ts +1 -0
- package/src/api/user.ts +9 -2
- package/types/api/com.d.ts +4 -2
- package/types/api/index-desc.d.ts +4 -2
- package/types/api/index.d.ts +7 -7
- package/types/api/item.d.ts +6 -4
- package/types/api/permission.d.ts +2 -2
- package/types/api/permission.d.ts.map +1 -1
- package/types/api/platform/config.d.ts +2 -0
- package/types/api/platform/config.d.ts.map +1 -0
- package/types/api/platform/dict.d.ts +6 -4
- package/types/api/platform/index.d.ts +1 -0
- package/types/api/platform/index.d.ts.map +1 -1
- package/types/api/platform/menu.d.ts +21 -11
- package/types/api/platform/oss.d.ts +15 -7
- package/types/api/platform/user.d.ts +19 -12
- package/types/api/user.d.ts +2 -2
- package/types/api/user.d.ts.map +1 -1
package/package.json
CHANGED
package/src/api/permission.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { axios } from '@/utils'
|
|
2
2
|
import { config } from '@/config'
|
|
3
3
|
import { getLocalStorage, setLocalStorage } from '@/utils/storage'
|
|
4
|
+
import { getUserInfoCache } from '@/utils/cache'
|
|
5
|
+
import { getGlobalConfig } from '@/api/platform/config.js'
|
|
4
6
|
|
|
5
7
|
const UC_CONTEXT = config.ucExtServerContext
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
// TODO 调用platform的getGlobalConfig,如果未开启前端缓存enableTreeLocalCache == '1',改为原始逻辑
|
|
9
10
|
export async function getApplicationTreeApi(params) {
|
|
11
|
+
const DATAVERSION_KEY = 'ind-cache-dataVersion-applicationTree' + getUserInfoCache()?.manageUnitId
|
|
12
|
+
//0.读取全局配置,是否使用缓存
|
|
13
|
+
const globalConfigData = await getGlobalConfig()
|
|
14
|
+
if (!globalConfigData?.enableTreeLocalCache || globalConfigData?.enableTreeLocalCache !== '1') {
|
|
15
|
+
return axios.formPost(`${UC_CONTEXT}/tree/uc-application/getApplicationTree`, {
|
|
16
|
+
params,
|
|
17
|
+
})
|
|
18
|
+
}
|
|
10
19
|
//1.读取缓存,获得版本号
|
|
11
20
|
const cachedData = getLocalStorage(DATAVERSION_KEY)
|
|
12
21
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// 使用原生的axios,避免拦截器报无会话
|
|
2
|
+
import axios from 'axios'
|
|
3
|
+
import { getSessionStorage, removeSessionStorage, setSessionStorage } from '@/utils/storage'
|
|
4
|
+
|
|
5
|
+
const GLOBAL_CACHE_KEY = 'global-cache'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 获取云庭配置的global配置文件,取到以后放到sessionStorage,避免重复请求
|
|
9
|
+
*/
|
|
10
|
+
export const getGlobalConfig = async () => {
|
|
11
|
+
if (getSessionStorage(GLOBAL_CACHE_KEY)) {
|
|
12
|
+
return getSessionStorage(GLOBAL_CACHE_KEY)
|
|
13
|
+
} else {
|
|
14
|
+
// 加载global配置,当前只有系统配置,组件配置没在内
|
|
15
|
+
let url =
|
|
16
|
+
location.protocol + '//' + location.host + '/ibp-sc/manage/global?t=' + new Date().getTime()
|
|
17
|
+
return axios.get(url).then(({ data }) => {
|
|
18
|
+
setSessionStorage(GLOBAL_CACHE_KEY, data)
|
|
19
|
+
return data
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/api/user.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { axios } from '@/utils'
|
|
2
2
|
import { config } from '@/config'
|
|
3
3
|
import { getLocalStorage, setLocalStorage } from '@/utils/storage'
|
|
4
|
+
import { getUserInfoCache } from '@/utils/cache'
|
|
5
|
+
import { getGlobalConfig } from '@/api/platform/config.js'
|
|
4
6
|
|
|
5
7
|
const UC_CONTEXT = config.ucExtServerContext
|
|
6
8
|
|
|
7
|
-
const DATAVERSION_KEY = 'ind-cache-dataVersion-organTree'
|
|
8
|
-
|
|
9
9
|
export async function listUserTreeApi(params) {
|
|
10
|
+
const DATAVERSION_KEY = 'ind-cache-dataVersion-organTree' + getUserInfoCache()?.manageUnitId
|
|
11
|
+
|
|
12
|
+
//0.读取全局配置,是否使用缓存
|
|
13
|
+
const globalConfigData = await getGlobalConfig()
|
|
14
|
+
if (!globalConfigData?.enableTreeLocalCache || globalConfigData?.enableTreeLocalCache !== '1') {
|
|
15
|
+
return axios.get(`${UC_CONTEXT}/tree/uc-user/listUserTree`, { params })
|
|
16
|
+
}
|
|
10
17
|
//1.读取缓存,获得版本号
|
|
11
18
|
const cachedData = getLocalStorage(DATAVERSION_KEY)
|
|
12
19
|
|
package/types/api/com.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export declare function listComTreeApi(
|
|
2
|
-
|
|
1
|
+
export declare function listComTreeApi(
|
|
2
|
+
params: any,
|
|
3
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
4
|
+
//# sourceMappingURL=com.d.ts.map
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export declare function listIndexDescApi(
|
|
2
|
-
|
|
1
|
+
export declare function listIndexDescApi(
|
|
2
|
+
params: any,
|
|
3
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
4
|
+
//# sourceMappingURL=index-desc.d.ts.map
|
package/types/api/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './platform'
|
|
2
|
-
export * from './com'
|
|
3
|
-
export * from './index-desc'
|
|
4
|
-
export * from './item'
|
|
5
|
-
export * from './permission'
|
|
6
|
-
export * from './user'
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from './platform';
|
|
2
|
+
export * from './com';
|
|
3
|
+
export * from './index-desc';
|
|
4
|
+
export * from './item';
|
|
5
|
+
export * from './permission';
|
|
6
|
+
export * from './user';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
package/types/api/item.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare function listItemTreeApi(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare function listItemTreeApi(
|
|
2
|
+
params: any,
|
|
3
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
4
|
+
export declare function getPriceInfo(): Promise<import('axios').AxiosResponse<any, any>>
|
|
5
|
+
export declare function getItem(params: any): Promise<import('axios').AxiosResponse<any, any>>
|
|
6
|
+
//# sourceMappingURL=item.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getApplicationTreeApi(params: any): Promise<any
|
|
2
|
-
//# sourceMappingURL=permission.d.ts.map
|
|
1
|
+
export declare function getApplicationTreeApi(params: any): Promise<any>;
|
|
2
|
+
//# sourceMappingURL=permission.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../src/api/permission.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../src/api/permission.ts"],"names":[],"mappings":"AASA,wBAAsB,qBAAqB,CAAC,MAAM,KAAA,gBA8BjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/api/platform/config.js"],"names":[],"mappings":"AASO,gDAYN"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare function getDictsMapApi(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare function getDictsMapApi(
|
|
2
|
+
dictId: string,
|
|
3
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
4
|
+
export declare function getDictApi(dictId: string): Promise<any>
|
|
5
|
+
export declare function getDictMapApi(dictIdArr: string[]): Promise<{}>
|
|
6
|
+
//# sourceMappingURL=dict.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
export declare function getPermissionApi(): Promise<import(
|
|
2
|
-
export declare function getMenuHistoryApi(): Promise<import(
|
|
3
|
-
export declare function menuHistoryApi(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
1
|
+
export declare function getPermissionApi(): Promise<import('axios').AxiosResponse<any, any>>
|
|
2
|
+
export declare function getMenuHistoryApi(): Promise<import('axios').AxiosResponse<any, any>>
|
|
3
|
+
export declare function menuHistoryApi(
|
|
4
|
+
params: any,
|
|
5
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
6
|
+
export declare function deleteMenuHistoryApi(
|
|
7
|
+
historyId: any,
|
|
8
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
9
|
+
export declare function getMenuCollectApi(): Promise<import('axios').AxiosResponse<any, any>>
|
|
10
|
+
export declare function addMenuCollectApi(
|
|
11
|
+
params: any,
|
|
12
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
13
|
+
export declare function deleteMenuCollectApi(
|
|
14
|
+
collectId: any,
|
|
15
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
16
|
+
export declare function removeMenuCollectApi(
|
|
17
|
+
params: any,
|
|
18
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
19
|
+
export declare function getAppListApi(): Promise<import('axios').AxiosResponse<any, any>>
|
|
20
|
+
export declare function getMaxTabNumValueApi(): Promise<import('axios').AxiosResponse<any, any>>
|
|
21
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ResponseType } from 'axios'
|
|
1
|
+
import { ResponseType } from 'axios'
|
|
2
2
|
/**
|
|
3
3
|
* 文档中心下载文件的url,主要用于图片等直接写在 href 里
|
|
4
4
|
*
|
|
5
5
|
* @param fileId 文件Id
|
|
6
6
|
* @returns url
|
|
7
7
|
*/
|
|
8
|
-
export declare function getOssFileUrl(fileId?: string): string
|
|
8
|
+
export declare function getOssFileUrl(fileId?: string): string
|
|
9
9
|
/**
|
|
10
10
|
* 文档中心上传文件的url
|
|
11
11
|
*
|
|
12
12
|
* @returns url
|
|
13
13
|
*/
|
|
14
|
-
export declare function putOssFileUrl(): string
|
|
14
|
+
export declare function putOssFileUrl(): string
|
|
15
15
|
/**
|
|
16
16
|
* 获取文档中心文件
|
|
17
17
|
*
|
|
@@ -19,7 +19,10 @@ export declare function putOssFileUrl(): string;
|
|
|
19
19
|
* @param responseType 数据类型,支持 arraybuffer | blob | document | json | text | stream
|
|
20
20
|
* @returns 文件内容
|
|
21
21
|
*/
|
|
22
|
-
export declare function getOssFileApi(
|
|
22
|
+
export declare function getOssFileApi(
|
|
23
|
+
fileId: string,
|
|
24
|
+
responseType?: ResponseType,
|
|
25
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
23
26
|
/**
|
|
24
27
|
* 将文件上传到文档中心
|
|
25
28
|
*
|
|
@@ -27,12 +30,17 @@ export declare function getOssFileApi(fileId: string, responseType?: ResponseTyp
|
|
|
27
30
|
* @param blob 文件的Blob数据
|
|
28
31
|
* @returns 文件Id
|
|
29
32
|
*/
|
|
30
|
-
export declare function putOssFileApi(
|
|
33
|
+
export declare function putOssFileApi(
|
|
34
|
+
filename: string,
|
|
35
|
+
blob: Blob,
|
|
36
|
+
): import('axios').AxiosPromise<any>
|
|
31
37
|
/**
|
|
32
38
|
* 获取文档中心预览URL
|
|
33
39
|
*
|
|
34
40
|
* @param fileId 文件Id
|
|
35
41
|
* @returns 文件内容
|
|
36
42
|
*/
|
|
37
|
-
export declare function getPreviewUrlApi(
|
|
38
|
-
|
|
43
|
+
export declare function getPreviewUrlApi(
|
|
44
|
+
fileId: string,
|
|
45
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
46
|
+
//# sourceMappingURL=oss.d.ts.map
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
export declare function loginApi({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export declare function loginApi({
|
|
2
|
+
userName,
|
|
3
|
+
password,
|
|
4
|
+
validCodeId,
|
|
5
|
+
validCodeInput,
|
|
6
|
+
}: {
|
|
7
|
+
userName: any
|
|
8
|
+
password: any
|
|
9
|
+
validCodeId: any
|
|
10
|
+
validCodeInput: any
|
|
11
|
+
}): Promise<import('axios').AxiosResponse<any, any>>
|
|
12
|
+
export declare function getUserInfoApi(): Promise<import('axios').AxiosResponse<any, any>>
|
|
13
|
+
export declare function getGlobalPolicyApi(): Promise<import('axios').AxiosResponse<any, any>>
|
|
14
|
+
export declare function updatePasswordApi(
|
|
15
|
+
data: any,
|
|
16
|
+
): Promise<import('axios').AxiosResponse<any, any>>
|
|
17
|
+
export declare function getCaptchaURL(validCodeId: string): string
|
|
18
|
+
export declare function logoutApi(): Promise<import('axios').AxiosResponse<any, any>>
|
|
19
|
+
//# sourceMappingURL=user.d.ts.map
|
package/types/api/user.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function listUserTreeApi(params: any): Promise<any
|
|
2
|
-
//# sourceMappingURL=user.d.ts.map
|
|
1
|
+
export declare function listUserTreeApi(params: any): Promise<any>;
|
|
2
|
+
//# sourceMappingURL=user.d.ts.map
|
package/types/api/user.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/api/user.ts"],"names":[],"mappings":"AAQA,wBAAsB,eAAe,CAAC,MAAM,KAAA,
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/api/user.ts"],"names":[],"mappings":"AAQA,wBAAsB,eAAe,CAAC,MAAM,KAAA,gBA2B3C"}
|