@yqg/permission 1.3.0-alpha.2 → 1.3.0-alpha.4
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/dist/{apply-modal-DGX6gpHK.js → apply-modal-D9_2FmCa.js} +1873 -1867
- package/dist/{category-selector-C4wE2v-D.js → category-selector-D1G2Jo59.js} +4 -4
- package/dist/{index-EF-patVm.js → index-BeojUeOt.js} +1 -1
- package/dist/{index-C28x1Vhk.js → index-Du2KvF0g.js} +3 -3
- package/dist/index.js +2 -2
- package/dist/permission-item-C5rPuclI.js +1264 -0
- package/dist/{yqg-permission-DITcGx8T.js → yqg-permission-CFRz6J1H.js} +3 -3
- package/dist/yqg-permission.umd.js +56 -56
- package/package.json +1 -1
- package/src/App.vue +6 -8
- package/src/components/apply-modal.vue +12 -2
- package/src/components/permission-item.vue +3 -8
- package/src/hooks/useFormat.ts +2 -2
- package/src/main.ts +2 -2
- package/dist/permission-item-DcI9HD6q.js +0 -1266
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -9,13 +9,11 @@ const color = ref<string>('#1677ff');
|
|
|
9
9
|
const locale = ref<LocaleType>('zh-CN');
|
|
10
10
|
|
|
11
11
|
const permissions = reactive([
|
|
12
|
-
'CRANE.
|
|
13
|
-
'CRANE.
|
|
14
|
-
'CRANE.
|
|
15
|
-
'CRANE.
|
|
16
|
-
'CRANE.
|
|
17
|
-
'CRANE.PERMISSION.ROLE_ASSIGN',
|
|
18
|
-
'CRANE.PERMISSION.EXPORT',
|
|
12
|
+
'CRANE.EMPLOYEE.QUERY',
|
|
13
|
+
'CRANE.EMPLOYEE.DETAIL_QUERY',
|
|
14
|
+
'CRANE.EMPLOYEE.ATTRIBUTE_CREATE',
|
|
15
|
+
'CRANE.EMPLOYEE.ROLE_ASSIGN',
|
|
16
|
+
'CRANE.EMPLOYEE.DEPARTMENT_ROLE.ATTRIBUTE_ROLE_CREATE',
|
|
19
17
|
]);
|
|
20
18
|
// const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
|
|
21
19
|
const changeColor = () => {
|
|
@@ -39,7 +37,7 @@ const changeLocale = () => {
|
|
|
39
37
|
<!-- 05184 -->
|
|
40
38
|
<yqg-permission
|
|
41
39
|
:permissions="permissions"
|
|
42
|
-
workNumber="
|
|
40
|
+
workNumber="04701"
|
|
43
41
|
:color="color"
|
|
44
42
|
:locale="locale"
|
|
45
43
|
@onSuccess="() => {console.log('成功')}"
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
{{t('noPermissionTips')}}
|
|
10
10
|
</span>
|
|
11
11
|
|
|
12
|
-
<Tree checkable :default-expand-all="true" :tree-data="permissionList" :height="200"
|
|
13
|
-
:checkedKeys="formState.features" class="crane-permission-tree" @check="onCheck">
|
|
12
|
+
<Tree checkable :default-expand-all="true" :tree-data="permissionList" :height="200" :expandedKeys="expandedKeys"
|
|
13
|
+
:checkedKeys="formState.features" class="crane-permission-tree" @check="onCheck" @expand="expandedKeys = $event">
|
|
14
14
|
<template #title="item: PermissionType">
|
|
15
15
|
<div v-if="item.children && item.children.length">
|
|
16
16
|
{{ item.shortName }}
|
|
@@ -107,6 +107,7 @@ const categoryRef = ref();
|
|
|
107
107
|
let stepNodes = ref([]);
|
|
108
108
|
const categoryList = ref<CategoryType[]>([]);
|
|
109
109
|
const validTimeOptions = ref([]);
|
|
110
|
+
const expandedKeys = ref<any[]>([]);
|
|
110
111
|
const formState = reactive<formStateType>({
|
|
111
112
|
features: [],
|
|
112
113
|
roleVoList: [],
|
|
@@ -236,6 +237,15 @@ const onCheck = (checkedIds:any, info:any) => {
|
|
|
236
237
|
// 预览审批流程
|
|
237
238
|
}
|
|
238
239
|
|
|
240
|
+
watch(() => props.permissionList, (cur) => {
|
|
241
|
+
expandedKeys.value = [];
|
|
242
|
+
deepTree(cur, (item: any) => {
|
|
243
|
+
if (item.children && item.children.length) {
|
|
244
|
+
expandedKeys.value.push(item.feature);
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
|
|
239
249
|
watch(() => open.value, (cur) => {
|
|
240
250
|
if (cur) {
|
|
241
251
|
formRef.value?.resetFields();
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
<span v-if="checkedKeys.includes(item.feature)" class="crane-weak-color crane-margin-left-12">
|
|
71
71
|
{{ t('availableTime') }}:
|
|
72
72
|
<Select v-model:value="validTime" style="width: 100px"
|
|
73
|
-
:disabled="
|
|
74
|
-
:options="
|
|
73
|
+
:disabled="item.businessApplyType === OWNER_STATUS"
|
|
74
|
+
:options="item.businessApplyType === OWNER_STATUS ? validTimeOptions : tempTimeOptions"
|
|
75
75
|
@change="onChangeTimeHandler" size="small">
|
|
76
76
|
</Select>
|
|
77
77
|
</span>
|
|
@@ -87,8 +87,6 @@ import categoryImg from '@/assets/category.png';
|
|
|
87
87
|
import t from '../utils';
|
|
88
88
|
|
|
89
89
|
const OWNER_STATUS = 'OWNER';
|
|
90
|
-
const PENDING_STATUS = 'PENDING';
|
|
91
|
-
const DISABLED_STATUS = [OWNER_STATUS, PENDING_STATUS];
|
|
92
90
|
|
|
93
91
|
const levelMap:LevelMapType = {
|
|
94
92
|
L1: {
|
|
@@ -139,12 +137,9 @@ const tempTimeOptions = computed(() => {
|
|
|
139
137
|
//1登录人所在部门 = 权限适用范围,都默认90天,不需要区分等级和类型,
|
|
140
138
|
//2登录人所在部门 ≠ 权限适用范围,根据等级来,高(L3)默认给7天,中(L2)默认给30天,低(L1)默认给60天
|
|
141
139
|
const setDefaultTime = (item: PermissionType) => {
|
|
142
|
-
if (
|
|
140
|
+
if (item.businessApplyType === OWNER_STATUS) {
|
|
143
141
|
return item.virtualOwnState?.timeStatus
|
|
144
142
|
}
|
|
145
|
-
if (PENDING_STATUS.includes(item.businessApplyType)) {
|
|
146
|
-
return item.pendingValidTime
|
|
147
|
-
}
|
|
148
143
|
const validMap = {
|
|
149
144
|
L1: 'SIXTY_DAYS',
|
|
150
145
|
L2: 'THIRTY_DAYS',
|
package/src/hooks/useFormat.ts
CHANGED
|
@@ -20,11 +20,11 @@ export default function useFormat(tree: PermissionListType) {
|
|
|
20
20
|
if (!node.children || node.children.length === 0) {
|
|
21
21
|
node.categoryVOS = (node.categoryVOS || []).filter((item: any) => item.configWay !== Category.AUTO);
|
|
22
22
|
|
|
23
|
-
if ([StatusType.NO].includes(node.businessApplyType)) {
|
|
23
|
+
if ([StatusType.NO, StatusType.PENDING].includes(node.businessApplyType)) {
|
|
24
24
|
node.disabled = true;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
if ([StatusType.OWNER
|
|
27
|
+
if ([StatusType.OWNER].includes(node.businessApplyType) && !node.categoryVOS.length) {
|
|
28
28
|
node.disabled = true;
|
|
29
29
|
}
|
|
30
30
|
} else {
|
package/src/main.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createApp } from 'vue';
|
|
2
2
|
import App from './App.vue';
|
|
3
3
|
import './style.css';
|
|
4
|
-
|
|
5
|
-
import yqgPermission from '../dist';
|
|
4
|
+
import yqgPermission from './yqg-permission';
|
|
5
|
+
// import yqgPermission from '../dist';
|
|
6
6
|
yqgPermission.init();
|
|
7
7
|
|
|
8
8
|
const app = createApp(App);
|