adtec-core-package 0.2.13 → 0.2.15
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 +3 -2
- package/src/api/DocumentApi.ts +9 -0
- package/src/components/OperationAuth/operationAuth.vue +1 -1
- package/src/components/Search/ElIconSearch.vue +36 -15
- package/src/components/Search/ElSearch.vue +3 -3
- package/src/components/upload/ElUploads.vue +9 -2
- package/src/hooks/useDictHooks.ts +24 -22
- package/src/stores/dictStore.ts +10 -3
- package/src/stores/permissionStore.ts +108 -0
- package/src/stores/storeConfig.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adtec-core-package",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"vue": "^3.5.13",
|
|
31
31
|
"vue-focus-lock": "^3.0.0",
|
|
32
32
|
"vue-img-viewr": "2.0.11",
|
|
33
|
-
"vue-router": "^4.5.0"
|
|
33
|
+
"vue-router": "^4.5.0",
|
|
34
|
+
"wujie-vue3": "^1.0.24"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@tsconfig/node22": "^22.0.0",
|
package/src/api/DocumentApi.ts
CHANGED
|
@@ -12,7 +12,16 @@ export default {
|
|
|
12
12
|
getUpLoadFilesVoById(id: string): Promise<ISysUploadFiles> {
|
|
13
13
|
return request.get(basePath + 'getUpLoadFilesVoById/' + id)
|
|
14
14
|
},
|
|
15
|
+
getUpLoadFilesByBussinessIds(bussinessIds: string[]): Promise<ISysUploadFiles[]> {
|
|
16
|
+
return request.post(basePath + 'getUpLoadFilesByBussinessIds', bussinessIds)
|
|
17
|
+
},
|
|
15
18
|
delSysUploadFile(id: string) {
|
|
16
19
|
return request.get(basePath + 'delSysUploadFile/' + id)
|
|
20
|
+
},
|
|
21
|
+
getBusinessDocuments(business: string, businessId: string): Promise<ISysUploadFiles[]> {
|
|
22
|
+
return request.get(basePath + 'getBusinessDocuments/' + business + '/' + businessId)
|
|
23
|
+
},
|
|
24
|
+
fileStatusConfirmation(ids: string[]): Promise<ISysUploadFiles[]> {
|
|
25
|
+
return request.post(basePath + 'fileStatusConfirmation', ids)
|
|
17
26
|
}
|
|
18
27
|
}
|
|
@@ -12,7 +12,7 @@ const route = useRoute()
|
|
|
12
12
|
|
|
13
13
|
const IsOperationAuth = () => {
|
|
14
14
|
const data: ISysMenuInfoVo = route.meta.sysMenuData as ISysMenuInfoVo
|
|
15
|
-
const o = data.operation
|
|
15
|
+
const o = data.operation?.find((c) => c.code === props.operCode)
|
|
16
16
|
if (o) {
|
|
17
17
|
return true
|
|
18
18
|
} else {
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
>
|
|
27
27
|
<template #reference>
|
|
28
28
|
<el-tooltip :content="tip" placement="top" style="cursor: pointer">
|
|
29
|
-
<el-button v-if="elementType === 'button'" style="padding: 8px 10px; margin-left: 4px">
|
|
29
|
+
<el-button v-if="elementType === 'button'" style="padding: 8px 10px; margin-left: 4px" @click="iconClick">
|
|
30
30
|
<el-icon
|
|
31
31
|
ref="buttonRef"
|
|
32
32
|
:model-value="iconName"
|
|
33
33
|
:style="style"
|
|
34
34
|
:tip="tip"
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
:class="getClass"
|
|
37
37
|
>
|
|
38
38
|
<svg v-if="selcomp" aria-hidden="true">
|
|
@@ -76,12 +76,7 @@
|
|
|
76
76
|
</el-flex>
|
|
77
77
|
</el-flex>
|
|
78
78
|
<slot></slot>
|
|
79
|
-
<el-flex
|
|
80
|
-
align="flex-end"
|
|
81
|
-
justify="flex-end"
|
|
82
|
-
height="40px"
|
|
83
|
-
style="border-top: var(--border)"
|
|
84
|
-
>
|
|
79
|
+
<el-flex align="flex-end" justify="flex-end" height="40px" style="border-top: var(--border)">
|
|
85
80
|
<el-button @click="reset">重置</el-button>
|
|
86
81
|
<el-button type="primary" @click="search">查询</el-button>
|
|
87
82
|
</el-flex>
|
|
@@ -90,24 +85,50 @@
|
|
|
90
85
|
</template>
|
|
91
86
|
<script setup lang="ts">
|
|
92
87
|
// 定义Props类型
|
|
93
|
-
import { useVModel } from '@vueuse/core'
|
|
94
|
-
import { computed, ref, unref } from 'vue'
|
|
95
|
-
|
|
96
|
-
import ElIcons from '../icon/ElIcons.vue'
|
|
97
|
-
|
|
88
|
+
import { useMousePressed, useVModel } from '@vueuse/core'
|
|
89
|
+
import { computed, ref, unref, watch } from 'vue'
|
|
90
|
+
const { pressed } = useMousePressed()
|
|
98
91
|
const iconClick = () => {
|
|
99
92
|
unref(popoverRef).popperRef?.delayHide?.()
|
|
100
93
|
visible.value = !visible.value
|
|
101
94
|
}
|
|
95
|
+
watch(pressed, () => {
|
|
96
|
+
if (pressed.value) {
|
|
97
|
+
//@ts-ignore
|
|
98
|
+
if (!hasParentWithStyle(event.target, 'el-popper')) {
|
|
99
|
+
visible.value = false
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
function hasParentWithStyle(element: any, styleSelector: string) {
|
|
104
|
+
let currentElement = element.parentNode
|
|
105
|
+
let i = 0
|
|
106
|
+
while (currentElement && i < 15) {
|
|
107
|
+
if (currentElement?.tagName !== 'BODY') {
|
|
108
|
+
if (currentElement.className?.indexOf(styleSelector) > -1) {
|
|
109
|
+
return true
|
|
110
|
+
}
|
|
111
|
+
currentElement = currentElement.parentNode
|
|
112
|
+
i++
|
|
113
|
+
} else {
|
|
114
|
+
return false
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return false
|
|
118
|
+
}
|
|
102
119
|
const keypress = (e: KeyboardEvent) => {
|
|
103
120
|
if (e.key === 'Enter') {
|
|
104
121
|
visible.value = false
|
|
105
|
-
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
emit('search')
|
|
124
|
+
}, 200)
|
|
106
125
|
}
|
|
107
126
|
}
|
|
108
127
|
const search = () => {
|
|
109
128
|
visible.value = false
|
|
110
|
-
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
emit('search')
|
|
131
|
+
}, 200)
|
|
111
132
|
}
|
|
112
133
|
const reset = () => {
|
|
113
134
|
emit('reset')
|
|
@@ -50,7 +50,7 @@ const collapsedSearch=ref<boolean>(false)
|
|
|
50
50
|
//@ts-expect-error
|
|
51
51
|
watch(collapsed, () => {
|
|
52
52
|
//@ts-ignore
|
|
53
|
-
collapsedSearch.value = collapsed
|
|
53
|
+
collapsedSearch.value = collapsed?.value
|
|
54
54
|
// calculation()
|
|
55
55
|
})
|
|
56
56
|
watch(collapsedSearch, () => {
|
|
@@ -63,7 +63,7 @@ watch(windowContent.width, () => {
|
|
|
63
63
|
const calculation = () => {
|
|
64
64
|
nextTick(()=>{
|
|
65
65
|
setTimeout(() => {
|
|
66
|
-
if(ref_div.value
|
|
66
|
+
if(ref_div.value?.children.length>0) {
|
|
67
67
|
if (!(ref_div.value.children[0].offsetHeight > 95)) {
|
|
68
68
|
if (ref_div.value.children[0].offsetHeight !== 0) {
|
|
69
69
|
is_retract.value = false
|
|
@@ -114,7 +114,7 @@ const emit = defineEmits<{
|
|
|
114
114
|
onMounted(() => {
|
|
115
115
|
//ts-ignore
|
|
116
116
|
//@ts-expect-error
|
|
117
|
-
collapsedSearch.value = collapsed
|
|
117
|
+
collapsedSearch.value = collapsed?.value
|
|
118
118
|
//@ts-ignore
|
|
119
119
|
window.$wujie?.bus.$on("collapsedChangeBus", (val:boolean) => {
|
|
120
120
|
collapsedSearch.value=val
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<!--创建时间: 2024/12/2 下午1:59-->
|
|
4
4
|
<!--修改时间: 2024/12/2 下午1:59-->
|
|
5
5
|
<template>
|
|
6
|
-
<el-flex v-if="!isEdlt">
|
|
6
|
+
<el-flex v-if="!isEdlt" :vertical="vertical">
|
|
7
7
|
<el-flex
|
|
8
8
|
v-for="item of uploadFilesList"
|
|
9
9
|
:key="item.id"
|
|
@@ -102,7 +102,14 @@ const props = defineProps({
|
|
|
102
102
|
type: Number,
|
|
103
103
|
default: 1,
|
|
104
104
|
},
|
|
105
|
-
|
|
105
|
+
/**
|
|
106
|
+
* @description 纵向排列
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
vertical: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false,
|
|
112
|
+
},
|
|
106
113
|
/**
|
|
107
114
|
* @description 上传文件类型
|
|
108
115
|
* @default ''
|
|
@@ -1,40 +1,35 @@
|
|
|
1
|
-
import { storeToRefs } from 'pinia'
|
|
2
1
|
import { ElMessage } from 'element-plus'
|
|
3
2
|
import SysDictCacheApi from '../api/SysDictCacheApi'
|
|
4
3
|
import type { ISysDictDataCacheVo } from '../interface/ISysDictDataCacheVo'
|
|
5
|
-
import { dictStore } from '../stores/dictStore'
|
|
4
|
+
import { type dictDataMapVoType, dictStore } from '../stores/dictStore'
|
|
6
5
|
|
|
7
6
|
export default function useDictHooks(dictTypes?: string[]) {
|
|
8
7
|
const dictStores = dictStore()
|
|
9
|
-
const
|
|
10
|
-
const getDict = async (dictTypes: string[]) => {
|
|
8
|
+
const getDict = async (dictTypes?: string[]) => {
|
|
11
9
|
try {
|
|
12
10
|
if (!dictTypes || !dictTypes.length) return
|
|
13
|
-
|
|
14
|
-
const dictKeySet = new Set(Object.keys(dictMap
|
|
11
|
+
//判断是否存在缓存数据,如果存在则不请求接口
|
|
12
|
+
const dictKeySet = new Set(Object.keys(dictStores.dictMap))
|
|
15
13
|
const uncachedDictTypes = dictTypes.filter((dictType) => !dictKeySet.has(dictType))
|
|
16
14
|
if (!uncachedDictTypes.length) return
|
|
17
|
-
const data = await SysDictCacheApi.batchGetSysDictDataCacheVo(
|
|
18
|
-
dictMap
|
|
15
|
+
const data = await SysDictCacheApi.batchGetSysDictDataCacheVo(dictTypes)
|
|
16
|
+
dictStores.dictMap = { ...dictStores.dictMap, ...data }
|
|
19
17
|
// 获取默认值
|
|
20
18
|
Object.keys(data).forEach((item: string) => {
|
|
21
19
|
findDefaultValue(data[item], item)
|
|
22
|
-
const dataMap =
|
|
20
|
+
const dataMap: dictDataMapVoType = {}
|
|
23
21
|
packageDictDataMap(dataMap, data[item])
|
|
24
|
-
dictDataMap
|
|
22
|
+
dictStores.dictDataMap[item] = dataMap
|
|
25
23
|
})
|
|
26
24
|
} catch (error: any) {
|
|
27
25
|
ElMessage.error(error.msg || error.message)
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
const packageDictDataMap = async (
|
|
32
|
-
map: Map<string, ISysDictDataCacheVo>,
|
|
33
|
-
list?: ISysDictDataCacheVo[],
|
|
34
|
-
) => {
|
|
29
|
+
const packageDictDataMap = async (map: dictDataMapVoType, list?: ISysDictDataCacheVo[]) => {
|
|
35
30
|
if (list && list.length) {
|
|
36
31
|
list.forEach((item: ISysDictDataCacheVo) => {
|
|
37
|
-
map
|
|
32
|
+
map[item.value] = { ...item, ...{ children: undefined } }
|
|
38
33
|
packageDictDataMap(map, item.children)
|
|
39
34
|
})
|
|
40
35
|
}
|
|
@@ -42,7 +37,9 @@ export default function useDictHooks(dictTypes?: string[]) {
|
|
|
42
37
|
|
|
43
38
|
const findDefaultValue = async (list: ISysDictDataCacheVo[], type: string) => {
|
|
44
39
|
const find = getDefaultValue(list)
|
|
45
|
-
|
|
40
|
+
if (find) {
|
|
41
|
+
dictStores.dictDefaultValueMap[type] = find
|
|
42
|
+
}
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
const getDefaultValue = (list?: ISysDictDataCacheVo[]): ISysDictDataCacheVo | undefined => {
|
|
@@ -57,20 +54,25 @@ export default function useDictHooks(dictTypes?: string[]) {
|
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
const getDictName = (value?: string, dictType?: string) => {
|
|
60
|
-
|
|
57
|
+
if (dictStores.dictDataMap[dictType!]) {
|
|
58
|
+
return dictStores.dictDataMap[dictType!][value!]?.label || value
|
|
59
|
+
}
|
|
60
|
+
return value
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const getDictData = (value: string, dictType: string) => {
|
|
64
|
-
return dictDataMap
|
|
64
|
+
return dictStores.dictDataMap[dictType!][value!]
|
|
65
65
|
}
|
|
66
66
|
if (dictTypes && dictTypes.length) {
|
|
67
|
-
getDict(dictTypes).then(() => {
|
|
67
|
+
getDict(dictTypes).then(() => {
|
|
68
|
+
})
|
|
68
69
|
}
|
|
70
|
+
|
|
69
71
|
return {
|
|
70
|
-
dictMap,
|
|
71
|
-
dictDefaultValueMap,
|
|
72
|
+
dictMap: dictStores.dictMap,
|
|
73
|
+
dictDefaultValueMap: dictStores.dictDefaultValueMap,
|
|
72
74
|
getDict,
|
|
73
75
|
getDictName,
|
|
74
|
-
getDictData
|
|
76
|
+
getDictData
|
|
75
77
|
}
|
|
76
78
|
}
|
package/src/stores/dictStore.ts
CHANGED
|
@@ -7,11 +7,18 @@ export interface dictMapType {
|
|
|
7
7
|
[key: string]: ISysDictDataCacheVo[]
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export interface dictDataMapVoType {
|
|
11
|
+
[key: string]: ISysDictDataCacheVo
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface dictDataMapType {
|
|
15
|
+
[key: string]: { [key: string]: ISysDictDataCacheVo }
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
export const dictStore = defineStore('dictStore', () => {
|
|
11
19
|
const dictMap = ref<dictMapType>({})
|
|
12
|
-
const dictDataMap = ref<
|
|
13
|
-
const dictDefaultValueMap = ref<
|
|
14
|
-
|
|
20
|
+
const dictDataMap = ref<dictDataMapType>({})
|
|
21
|
+
const dictDefaultValueMap = ref<dictDataMapVoType>({})
|
|
15
22
|
return {
|
|
16
23
|
dictMap,
|
|
17
24
|
dictDataMap,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import type { ISysMenuInfoVo } from '../interface/ISysMenuInfoVo'
|
|
3
|
+
import { useEventBus } from '@vueuse/core'
|
|
4
|
+
import WujieVue from 'wujie-vue3'
|
|
5
|
+
|
|
6
|
+
const bus = useEventBus<string>('ActiveMenuInfo')
|
|
7
|
+
export const permissionStore = defineStore({
|
|
8
|
+
id: 'permissionStore',
|
|
9
|
+
state: () => ({
|
|
10
|
+
/**
|
|
11
|
+
* 当前激活的一级菜单
|
|
12
|
+
*/
|
|
13
|
+
//@ts-ignore
|
|
14
|
+
activeMenuInfoLevel1: null as ISysMenuInfoVo,
|
|
15
|
+
/**
|
|
16
|
+
* 保存已经打开的菜单
|
|
17
|
+
*/
|
|
18
|
+
openMenuInfo: [] as ISysMenuInfoVo[],
|
|
19
|
+
/**
|
|
20
|
+
* 当前激活菜单信息
|
|
21
|
+
*/
|
|
22
|
+
//@ts-ignore
|
|
23
|
+
activeMenuInfo: null as ISysMenuInfoVo,
|
|
24
|
+
}),
|
|
25
|
+
getters: {
|
|
26
|
+
/**
|
|
27
|
+
* 获取当前选择一级菜单
|
|
28
|
+
*/
|
|
29
|
+
getActiveMenuInfoLevel1(): ISysMenuInfoVo {
|
|
30
|
+
return this.activeMenuInfoLevel1
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* 获取当前菜单
|
|
34
|
+
*/
|
|
35
|
+
getActiveMenuInfo(): ISysMenuInfoVo {
|
|
36
|
+
return this.activeMenuInfo
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* 获取已经打开的菜单
|
|
40
|
+
*/
|
|
41
|
+
getOpenMenuInfo(): ISysMenuInfoVo[] {
|
|
42
|
+
return this.openMenuInfo
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
actions: {
|
|
46
|
+
/**
|
|
47
|
+
* 判断是否有按钮权限
|
|
48
|
+
* @param operCode
|
|
49
|
+
* @constructor
|
|
50
|
+
*/
|
|
51
|
+
IsOperationAuth(operCode: string) {
|
|
52
|
+
if (this.getActiveMenuInfo.operation) {
|
|
53
|
+
const find = this.getActiveMenuInfo.operation.find((c) => c.code === operCode)
|
|
54
|
+
if (find) {
|
|
55
|
+
return true
|
|
56
|
+
} else {
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
return false
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* 设置选择的已经菜单
|
|
65
|
+
* @param menuInfo
|
|
66
|
+
*/
|
|
67
|
+
setActiveMenuInfoLevel1(menuInfo: ISysMenuInfoVo) {
|
|
68
|
+
this.activeMenuInfoLevel1 = menuInfo
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* 设置打开的菜单
|
|
72
|
+
* @param menuInfo
|
|
73
|
+
*/
|
|
74
|
+
setOpenMenuInfo(menuInfo: ISysMenuInfoVo) {
|
|
75
|
+
const find = this.openMenuInfo.find((c) => c.id === menuInfo.id)
|
|
76
|
+
if (!find) {
|
|
77
|
+
this.openMenuInfo.push(menuInfo)
|
|
78
|
+
}
|
|
79
|
+
this.activeMenuInfo = menuInfo
|
|
80
|
+
bus.emit()
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* 移除打开的菜单
|
|
84
|
+
* @param menuInfo
|
|
85
|
+
*/
|
|
86
|
+
removeOpenMenuInfo(menuInfo: ISysMenuInfoVo) {
|
|
87
|
+
this.openMenuInfo.splice(this.openMenuInfo.indexOf(menuInfo), 1)
|
|
88
|
+
if (menuInfo.applicationModule !== 'system' && menuInfo.isLink !== 1) {
|
|
89
|
+
//关闭子应用菜单
|
|
90
|
+
WujieVue.bus.$emit('wujie-router-close', menuInfo)
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* 移除所有打开的菜单
|
|
95
|
+
* @param menuInfo
|
|
96
|
+
*/
|
|
97
|
+
removeAllOpenMenuInfo(menuInfo: ISysMenuInfoVo) {
|
|
98
|
+
this.openMenuInfo = []
|
|
99
|
+
},
|
|
100
|
+
clear() {
|
|
101
|
+
this.openMenuInfo = []
|
|
102
|
+
//@ts-ignore
|
|
103
|
+
this.activeMenuInfoLevel1 = null
|
|
104
|
+
//@ts-ignore
|
|
105
|
+
this.activeMenuInfo = null
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
})
|
|
@@ -12,7 +12,7 @@ function decrypt(value: string): string {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const plugin = storePlugin({
|
|
15
|
-
stores: ['userInfoStore', 'messageStore', 'dictStore'],
|
|
15
|
+
stores: ['userInfoStore', 'messageStore', 'dictStore','permissionStore'],
|
|
16
16
|
// use alone storage
|
|
17
17
|
// stores: [{name:'theme_store',storage: localStorage}]
|
|
18
18
|
storage: sessionStorage, //default storage
|