adtec-core-package 3.2.7 → 3.2.9
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 +1 -1
- package/src/components/RichTextEditor/installUmoEditorApp.ts +4 -1
- package/src/components/workflow/components/ProcessInstanceStep.vue +2 -1
- package/src/hooks/useDictHooks.ts +36 -26
- package/src/hooks/workflowTodo2.ts +1 -1
- package/src/stores/userInfoStore.ts +24 -4
- package/src/utils/userSessionStorage.ts +28 -0
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, type App, type Component } from 'vue'
|
|
2
2
|
import TDesign from 'tdesign-vue-next'
|
|
3
|
+
import { ElLoading } from 'element-plus'
|
|
3
4
|
import { umoGlobalComponents } from '../../../prebuilt/umo-editor/umo-editor.js'
|
|
4
5
|
|
|
5
6
|
const registeredApps = new WeakSet<App>()
|
|
@@ -75,9 +76,11 @@ export function installUmoEditorApp(app?: App | null) {
|
|
|
75
76
|
} catch {
|
|
76
77
|
// 宿主或兄弟插件已安装 TDesign
|
|
77
78
|
}
|
|
78
|
-
// 运行时“删除”UMO 内置 loading:空组件 + 空 $loading
|
|
79
|
+
// 运行时“删除”UMO 内置 loading:空组件 + 空 $loading 服务
|
|
79
80
|
app.component('TLoading', UmoLoadingNoop)
|
|
80
81
|
app.config.globalProperties.$loading = umoLoadingServiceNoop
|
|
82
|
+
// 主应用先装 Element Plus、后懒装 TDesign 时,TDesign 会覆盖同名 v-loading 指令导致 EP 遮罩无法清除
|
|
83
|
+
app.directive('loading', ElLoading.directive)
|
|
81
84
|
tdesignApps.add(app)
|
|
82
85
|
}
|
|
83
86
|
|
|
@@ -219,7 +219,8 @@ const getStatus = (task: IWfTaskVo) => {
|
|
|
219
219
|
return ''
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
|
|
222
|
+
// 与 TaskOperation.handle 对齐:默认传 source=edit,业务页才能展示审核按钮;仅显式 view 保持只读
|
|
223
|
+
const compParam = ref([{ source: props.source === 'view' ? 'view' : 'edit' }])
|
|
223
224
|
const resolveReviewBatch = async (task: IWfTaskVo) => {
|
|
224
225
|
if (task.taskId) {
|
|
225
226
|
const byTask = await workflowcommentApi.getBatchInfoByTaskId(task.taskId)
|
|
@@ -12,25 +12,28 @@ export default function useDictHooks(dictTypes?: string[], orgId?: string) {
|
|
|
12
12
|
const dictStores = dictStore()
|
|
13
13
|
const { clearDictCache } = dictStores
|
|
14
14
|
const { dictMap, dictDefaultValueMap, dictDataMap } = storeToRefs(dictStores)
|
|
15
|
+
|
|
16
|
+
const resolveOrgId = (explicitOrgId?: string): string | undefined => {
|
|
17
|
+
if (explicitOrgId) return explicitOrgId
|
|
18
|
+
userInfo.hydrateFromRootSession()
|
|
19
|
+
return userInfo.user?.orgId
|
|
20
|
+
}
|
|
21
|
+
|
|
15
22
|
const getDict = async (dictTypes?: string[], orgId?: string): Promise<void> => {
|
|
16
23
|
try {
|
|
17
24
|
if (!dictTypes || !dictTypes.length) return
|
|
18
|
-
|
|
25
|
+
const tenantOrgId = resolveOrgId(orgId)
|
|
19
26
|
const dictKeySet = new Set(Object.keys(dictMap.value))
|
|
20
|
-
let uncachedDictTypes = []
|
|
21
|
-
if (orgId) {
|
|
22
|
-
|
|
27
|
+
let uncachedDictTypes: string[] = []
|
|
28
|
+
if (orgId || tenantOrgId) {
|
|
29
|
+
const oid = orgId ?? tenantOrgId!
|
|
30
|
+
uncachedDictTypes = dictTypes.filter((dictType) => !dictKeySet.has(`${oid}:${dictType}`))
|
|
23
31
|
} else {
|
|
24
|
-
uncachedDictTypes = dictTypes.filter(
|
|
25
|
-
(dictType) =>
|
|
26
|
-
!dictKeySet.has(`${userInfo.getUserInfo.orgId}:${dictType}`) &&
|
|
27
|
-
!dictKeySet.has(dictType)
|
|
28
|
-
)
|
|
32
|
+
uncachedDictTypes = dictTypes.filter((dictType) => !dictKeySet.has(dictType))
|
|
29
33
|
}
|
|
30
34
|
if (!uncachedDictTypes.length) return
|
|
31
|
-
const data = await SysDictCacheApi.batchGetSysDictDataCacheVo(uncachedDictTypes, orgId)
|
|
35
|
+
const data = await SysDictCacheApi.batchGetSysDictDataCacheVo(uncachedDictTypes, orgId ?? tenantOrgId)
|
|
32
36
|
dictMap.value = { ...dictMap.value, ...data }
|
|
33
|
-
// 获取默认值
|
|
34
37
|
const promises = Object.keys(data).map(async (item: string) => {
|
|
35
38
|
const dataMap: dictDataMapVoType = {}
|
|
36
39
|
const defaultList: ISysDictDataCacheVo[] = []
|
|
@@ -72,11 +75,13 @@ export default function useDictHooks(dictTypes?: string[], orgId?: string) {
|
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
const getDictName = (value?: string, dictType?: string, orgId?: string): string | undefined => {
|
|
75
|
-
//此处需要支持多租户
|
|
76
78
|
let key = orgId ? `${orgId}:${dictType}` : dictType
|
|
77
79
|
if (dictDataMap.value[key!]) return dictDataMap.value[key!][value!]?.label || value
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
+
const tenantOrgId = resolveOrgId()
|
|
81
|
+
if (tenantOrgId) {
|
|
82
|
+
key = `${tenantOrgId}:${dictType}`
|
|
83
|
+
if (dictDataMap.value[key!]) return dictDataMap.value[key!][value!]?.label || value
|
|
84
|
+
}
|
|
80
85
|
return value
|
|
81
86
|
}
|
|
82
87
|
|
|
@@ -85,38 +90,43 @@ export default function useDictHooks(dictTypes?: string[], orgId?: string) {
|
|
|
85
90
|
dictType: string,
|
|
86
91
|
orgId?: string,
|
|
87
92
|
): ISysDictDataCacheVo | {} => {
|
|
88
|
-
//此处需要支持多租户
|
|
89
93
|
let key = orgId ? `${orgId}:${dictType}` : dictType
|
|
90
94
|
if (dictDataMap.value[key!] && dictDataMap.value[key!][value!])
|
|
91
95
|
return dictDataMap.value[key!][value!]
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
|
|
96
|
+
const tenantOrgId = resolveOrgId()
|
|
97
|
+
if (tenantOrgId) {
|
|
98
|
+
key = `${tenantOrgId}:${dictType}`
|
|
99
|
+
if (dictDataMap.value[key!] && dictDataMap.value[key!][value!])
|
|
100
|
+
return dictDataMap.value[key!][value!]
|
|
101
|
+
}
|
|
95
102
|
return {}
|
|
96
103
|
}
|
|
97
104
|
const getDictDefaultValue = (
|
|
98
105
|
dictType: string,
|
|
99
106
|
orgId?: string
|
|
100
107
|
): ISysDictDataCacheVo[] => {
|
|
101
|
-
//此处需要支持多租户
|
|
102
108
|
let key = orgId ? `${orgId}:${dictType}` : dictType
|
|
103
109
|
if (dictDefaultValueMap.value[key!]) return dictDefaultValueMap.value[key!]
|
|
104
|
-
|
|
105
|
-
if (
|
|
110
|
+
const tenantOrgId = resolveOrgId()
|
|
111
|
+
if (tenantOrgId) {
|
|
112
|
+
key = `${tenantOrgId}:${dictType}`
|
|
113
|
+
if (dictDefaultValueMap.value[key!]) return dictDefaultValueMap.value[key!]
|
|
114
|
+
}
|
|
106
115
|
return []
|
|
107
116
|
}
|
|
108
117
|
const getDictTypeData = (dictType: string, orgId?: string): ISysDictDataCacheVo[] => {
|
|
109
|
-
//此处需要支持多租户
|
|
110
118
|
let key = orgId ? `${orgId}:${dictType}` : dictType
|
|
111
119
|
if (dictMap.value[key!]) return dictMap.value[key!]
|
|
112
|
-
|
|
113
|
-
if (
|
|
120
|
+
const tenantOrgId = resolveOrgId()
|
|
121
|
+
if (tenantOrgId) {
|
|
122
|
+
key = `${tenantOrgId}:${dictType}`
|
|
123
|
+
if (dictMap.value[key!]) return dictMap.value[key!]
|
|
124
|
+
}
|
|
114
125
|
return []
|
|
115
126
|
}
|
|
116
127
|
const clearDict = (dictType?: string[], orgId?: string, all?: Boolean) => {
|
|
117
|
-
clearDictCache(dictType,
|
|
128
|
+
clearDictCache(dictType, resolveOrgId(), orgId, all)
|
|
118
129
|
}
|
|
119
|
-
/** 构造函数传入的 dictTypes 是否已全部加载(缓存命中也会立即置 true) */
|
|
120
130
|
const dictReady = ref(!dictTypes?.length)
|
|
121
131
|
if (dictTypes?.length) {
|
|
122
132
|
getDict(dictTypes, orgId).finally(() => {
|
|
@@ -54,7 +54,7 @@ export async function showTodoDialog(
|
|
|
54
54
|
await WujieVue.bus.$emit('openMenu', menu, propertyList)
|
|
55
55
|
}
|
|
56
56
|
} else {
|
|
57
|
-
await WujieVue.bus.$emit('openMenu', menu)
|
|
57
|
+
await WujieVue.bus.$emit('openMenu', menu, propertyList)
|
|
58
58
|
}
|
|
59
59
|
//给子应用组件发送bus事件
|
|
60
60
|
setTimeout(() => {
|
|
@@ -6,19 +6,39 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { defineStore } from 'pinia'
|
|
8
8
|
import type { IUserPermissionVo } from '../interface/IUserPermissionVo'
|
|
9
|
+
import { readUserInfoFromSessionStorage } from '../utils/userSessionStorage'
|
|
9
10
|
|
|
10
11
|
export const userInfoStore = defineStore({
|
|
11
12
|
id: 'userInfoStore',
|
|
12
13
|
state: () => ({
|
|
13
14
|
//@ts-ignore
|
|
14
|
-
user: null as IUserPermissionVo
|
|
15
|
+
user: null as IUserPermissionVo | null,
|
|
15
16
|
}),
|
|
16
17
|
getters: {
|
|
17
18
|
getUserInfo(): IUserPermissionVo {
|
|
19
|
+
if (!this.user) {
|
|
20
|
+
const hydrated = readUserInfoFromSessionStorage()
|
|
21
|
+
if (hydrated) {
|
|
22
|
+
//@ts-ignore
|
|
23
|
+
this.user = hydrated
|
|
24
|
+
}
|
|
25
|
+
}
|
|
18
26
|
return this.user as IUserPermissionVo
|
|
19
|
-
}
|
|
27
|
+
},
|
|
20
28
|
},
|
|
21
29
|
actions: {
|
|
30
|
+
/** 无界子应用从宿主 sessionStorage 恢复登录态(与 dictStore 同源策略) */
|
|
31
|
+
hydrateFromRootSession(): IUserPermissionVo | null {
|
|
32
|
+
if (this.user) {
|
|
33
|
+
return this.user
|
|
34
|
+
}
|
|
35
|
+
const hydrated = readUserInfoFromSessionStorage()
|
|
36
|
+
if (hydrated) {
|
|
37
|
+
//@ts-ignore
|
|
38
|
+
this.user = hydrated
|
|
39
|
+
}
|
|
40
|
+
return this.user
|
|
41
|
+
},
|
|
22
42
|
setUserInfo(userInfo: IUserPermissionVo) {
|
|
23
43
|
//@ts-ignore
|
|
24
44
|
this.user = userInfo
|
|
@@ -26,6 +46,6 @@ export const userInfoStore = defineStore({
|
|
|
26
46
|
clear() {
|
|
27
47
|
//@ts-ignore
|
|
28
48
|
this.user = null
|
|
29
|
-
}
|
|
30
|
-
}
|
|
49
|
+
},
|
|
50
|
+
},
|
|
31
51
|
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Base64 from 'crypto-js/enc-base64'
|
|
2
|
+
import Utf8 from 'crypto-js/enc-utf8'
|
|
3
|
+
import type { IUserPermissionVo } from '../interface/IUserPermissionVo'
|
|
4
|
+
|
|
5
|
+
const USER_INFO_STORAGE_KEY = 'userInfoStore'
|
|
6
|
+
|
|
7
|
+
/** wujie 子应用读宿主 sessionStorage,独立运行读自身 */
|
|
8
|
+
export function getRootWindow(): Window {
|
|
9
|
+
if (typeof window === 'undefined') return window
|
|
10
|
+
const w = window as Window & { __POWERED_BY_WUJIE__?: boolean }
|
|
11
|
+
return w.__POWERED_BY_WUJIE__ ? window.parent : window
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** 从 pinia-plugin-store 持久化的 sessionStorage 恢复用户信息 */
|
|
15
|
+
export function readUserInfoFromSessionStorage(storage?: Storage): IUserPermissionVo | null {
|
|
16
|
+
if (typeof window === 'undefined') return null
|
|
17
|
+
const store = storage ?? getRootWindow().sessionStorage
|
|
18
|
+
const raw = store.getItem(USER_INFO_STORAGE_KEY)
|
|
19
|
+
if (!raw) return null
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(Base64.parse(raw).toString(Utf8)) as {
|
|
22
|
+
user?: IUserPermissionVo | null
|
|
23
|
+
}
|
|
24
|
+
return parsed?.user ?? null
|
|
25
|
+
} catch {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
}
|