adtec-core-package 0.7.6 → 0.7.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adtec-core-package",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -5,8 +5,8 @@ import { type dictDataMapVoType, dictStore } from '../stores/dictStore'
5
5
  import { storeToRefs } from 'pinia'
6
6
  import { userInfoStore } from '../stores/userInfoStore.ts'
7
7
 
8
- const userInfo = userInfoStore()
9
8
  export default function useDictHooks(dictTypes?: string[], orgId?: string) {
9
+ const userInfo = userInfoStore()
10
10
  const dictStores = dictStore()
11
11
  const { clearDictCache } = dictStores
12
12
  const { dictMap, dictDefaultValueMap, dictDataMap } = storeToRefs(dictStores)
@@ -15,16 +15,14 @@ export default function useDictHooks(dictTypes?: string[], orgId?: string) {
15
15
  if (!dictTypes || !dictTypes.length) return
16
16
  //判断是否存在缓存数据,如果存在则不请求接口
17
17
  const dictKeySet = new Set(Object.keys(dictMap.value))
18
- let uncachedDictTypes = dictTypes.filter((dictType) => !dictKeySet.has(dictType))
18
+ let uncachedDictTypes = []
19
19
  if (orgId) {
20
- uncachedDictTypes = uncachedDictTypes.concat(
21
- dictTypes.filter((dictType) => !dictKeySet.has(`${orgId}:${dictType}`)),
22
- )
20
+ uncachedDictTypes = dictTypes.filter((dictType) => !dictKeySet.has(`${orgId}:${dictType}`))
23
21
  } else {
24
- uncachedDictTypes = uncachedDictTypes.concat(
25
- dictTypes.filter(
26
- (dictType) => !dictKeySet.has(`${userInfo.getUserInfo.orgId}:${dictType}`),
27
- ),
22
+ uncachedDictTypes = dictTypes.filter(
23
+ (dictType) =>
24
+ !dictKeySet.has(`${userInfo.getUserInfo.orgId}:${dictType}`) &&
25
+ !dictKeySet.has(dictType),
28
26
  )
29
27
  }
30
28
  if (!uncachedDictTypes.length) return
@@ -86,19 +84,24 @@ export default function useDictHooks(dictTypes?: string[], orgId?: string) {
86
84
  key = `${userInfo.getUserInfo.orgId}:${dictType}`
87
85
  return dictDataMap.value[key!][value!]
88
86
  }
89
- const getDictDefaultValue = (dictType: string, orgId?: string): ISysDictDataCacheVo[]|undefined => {
87
+ const getDictDefaultValue = (
88
+ dictType: string,
89
+ orgId?: string,
90
+ ): ISysDictDataCacheVo[] => {
90
91
  //此处需要支持多租户
91
92
  let key = orgId ? `${orgId}:${dictType}` : dictType
92
93
  if (dictDefaultValueMap.value[key!]) return dictDefaultValueMap.value[key!]
93
94
  key = `${userInfo.getUserInfo.orgId}:${dictType}`
94
95
  if (dictDefaultValueMap.value[key!]) return dictDefaultValueMap.value[key!]
96
+ return []
95
97
  }
96
- const getDictTypeData = (dictType: string, orgId?: string): ISysDictDataCacheVo[]|undefined => {
98
+ const getDictTypeData = (dictType: string, orgId?: string): ISysDictDataCacheVo[] => {
97
99
  //此处需要支持多租户
98
100
  let key = orgId ? `${orgId}:${dictType}` : dictType
99
101
  if (dictMap.value[key!]) return dictMap.value[key!]
100
102
  key = `${userInfo.getUserInfo.orgId}:${dictType}`
101
103
  if (dictMap.value[key!]) return dictMap.value[key!]
104
+ return []
102
105
  }
103
106
  const clearDict = (dictType?: string[], orgId?: string, all?: Boolean) => {
104
107
  clearDictCache(dictType, userInfo.getUserInfo.orgId, orgId, all)