@yqg/permission 1.2.0 → 1.3.0-alpha.0
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/README.md +50 -38
- package/dist/apply-modal-CpmDDWWV.js +12865 -0
- package/dist/category-selector-BQ0-kg3o.js +1275 -0
- package/dist/index-D_0ZQip-.js +2972 -0
- package/dist/index-wLkVeDMW.js +5040 -0
- package/dist/index.js +2 -2
- package/dist/permission-item-Df_aagL1.js +1266 -0
- package/dist/{yqg-permission-Bxzu3bMl.js → yqg-permission-BjVCs5lN.js} +3483 -3538
- package/dist/yqg-permission.umd.js +250 -0
- package/package.json +13 -3
- package/plugins/alioss.ts +237 -0
- package/src/App.vue +7 -8
- package/src/assets/category.png +0 -0
- package/src/axios/index.ts +6 -1
- package/src/components/apply-modal.vue +254 -157
- package/src/components/category-selector.vue +130 -0
- package/src/components/permission-item.vue +230 -0
- package/src/components/success-modal.vue +4 -4
- package/src/components/yqg-permission.vue +23 -110
- package/src/hooks/useAttributesCache.ts +21 -0
- package/src/hooks/useCategory.ts +21 -0
- package/src/hooks/useDragable.ts +9 -10
- package/src/hooks/useFormat.ts +50 -0
- package/src/hooks/useStatus.ts +82 -0
- package/src/i18n/zh-CH.ts +9 -2
- package/src/main.ts +2 -0
- package/src/typings/index.d.ts +40 -7
- package/src/utils/index.ts +9 -0
- package/src/yqg-permission/index.ts +13 -1
- package/vite.config.ts +18 -2
- package/dist/apply-modal-BBqMmKS2.js +0 -8742
- package/dist/checkbox-item-CFWhXmMU.js +0 -4991
- package/dist/index-BAGvIeoy.js +0 -6164
- package/dist/index.umd.cjs +0 -259
- package/dist_/345/211/257/346/234/254/apply-modal-Bgd3UWf-.js +0 -8739
- package/dist_/345/211/257/346/234/254/card.png +0 -0
- package/dist_/345/211/257/346/234/254/checkbox-item-DiIgFuBE.js +0 -4988
- package/dist_/345/211/257/346/234/254/dialog.png +0 -0
- package/dist_/345/211/257/346/234/254/image.png +0 -0
- package/dist_/345/211/257/346/234/254/index-CUS1Jydp.js +0 -6164
- package/dist_/345/211/257/346/234/254/index.js +0 -5
- package/dist_/345/211/257/346/234/254/index.umd.cjs +0 -259
- package/dist_/345/211/257/346/234/254/yqg-permission-ChMRXqi6.js +0 -14944
- package/src/assets/apply.png +0 -0
- package/src/components/checkbox-item.vue +0 -201
package/src/assets/apply.png
DELETED
|
Binary file
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="crane-checkbox-line">
|
|
3
|
-
<Checkbox
|
|
4
|
-
:value="item.roleId"
|
|
5
|
-
:disabled="['OWNER', 'PENDING', 'NO'].includes(props.item.businessApplyType)"
|
|
6
|
-
@change="onCheck">
|
|
7
|
-
<div class="crane-flex-center crane-checkbox-label">
|
|
8
|
-
<Tag
|
|
9
|
-
v-if="item.securityLevel"
|
|
10
|
-
:bordered="false"
|
|
11
|
-
:style="{color: levelMap[item.securityLevel].color, background: levelMap[item.securityLevel].background}"
|
|
12
|
-
class="crane-tag-position">
|
|
13
|
-
{{ levelMap[item.securityLevel].text }}
|
|
14
|
-
</Tag>
|
|
15
|
-
|
|
16
|
-
<span>{{t(`operationType.${item.operationType}`)}}|
|
|
17
|
-
</span>
|
|
18
|
-
<Popover>
|
|
19
|
-
<template #content>
|
|
20
|
-
<div style="max-width: 400px;">{{ item.name }}</div>
|
|
21
|
-
</template>
|
|
22
|
-
<span class="crane-text-overflow">{{ item.name }}</span>
|
|
23
|
-
</Popover>
|
|
24
|
-
<Tag
|
|
25
|
-
v-if="item.businessApplyType && item.businessApplyType !== 'TEMP_OWNER'"
|
|
26
|
-
:bordered="false"
|
|
27
|
-
class="crane-tag-position crane-margin-left-4 crane-margin-right-0"
|
|
28
|
-
:class="['PENDING', 'TEMP_OWNER'].includes(item.businessApplyType) ? '' : 'crane-disabled-color'">
|
|
29
|
-
{{ statusMap[item.businessApplyType] }}
|
|
30
|
-
</Tag>
|
|
31
|
-
<Popover>
|
|
32
|
-
<template #content>
|
|
33
|
-
<span v-if="item?.ownStatusVO?.dayDiff>0">{{t('lastDays', {count: item?.ownStatusVO?.dayDiff})}}</span>
|
|
34
|
-
<span v-else>{{ t('taday') }}</span>
|
|
35
|
-
</template>
|
|
36
|
-
<Tag
|
|
37
|
-
v-if="item.businessApplyType === 'TEMP_OWNER'"
|
|
38
|
-
:bordered="false"
|
|
39
|
-
class="crane-tag-position crane-margin-left-4 crane-margin-right-0"
|
|
40
|
-
:class="['PENDING'].includes(item.businessApplyType) ? '' : 'crane-disabled-color'">
|
|
41
|
-
{{ statusMap[item.businessApplyType] }}
|
|
42
|
-
</Tag>
|
|
43
|
-
</Popover>
|
|
44
|
-
|
|
45
|
-
</div>
|
|
46
|
-
</Checkbox>
|
|
47
|
-
|
|
48
|
-
<Popover v-if="item.desc">
|
|
49
|
-
<template #content>
|
|
50
|
-
<div style="max-width: 400px;">{{ item.desc }}</div>
|
|
51
|
-
</template>
|
|
52
|
-
<QuestionCircleOutlined class=" crane-week-color"/>
|
|
53
|
-
</Popover>
|
|
54
|
-
|
|
55
|
-
<Popover v-if="item.relatedCompleteNames?.length">
|
|
56
|
-
<template #content>
|
|
57
|
-
<div style="max-width: 400px;">
|
|
58
|
-
{{t('adaptDepartment')}}:{{ item.relatedCompleteNames.map((item: any) => {
|
|
59
|
-
return item;
|
|
60
|
-
}).join('、') }}
|
|
61
|
-
</div>
|
|
62
|
-
</template>
|
|
63
|
-
<span class="crane-flex-center crane-margin-left-4">
|
|
64
|
-
<img :src="departmentImg" height="14" width="14">
|
|
65
|
-
<span class="crane-week-color crane-margin-left-4">{{ item.relatedCompleteNames.length }}</span>
|
|
66
|
-
</span>
|
|
67
|
-
</Popover>
|
|
68
|
-
|
|
69
|
-
<span v-if="checkedIds.includes(item.roleId)" class="crane-week-color crane-margin-left-12">
|
|
70
|
-
{{t('availableTime')}}:
|
|
71
|
-
<Select
|
|
72
|
-
v-model:value="validTime"
|
|
73
|
-
style="width: 100px"
|
|
74
|
-
:options="timeStatusOptions"
|
|
75
|
-
@change="onChangeTimeHandler"
|
|
76
|
-
size="small"
|
|
77
|
-
>
|
|
78
|
-
</Select>
|
|
79
|
-
</span>
|
|
80
|
-
</div>
|
|
81
|
-
</template>
|
|
82
|
-
<script lang="ts" setup>
|
|
83
|
-
import { PropType, ref} from 'vue';
|
|
84
|
-
import {Checkbox, Tag, Popover, Select } from 'ant-design-vue';
|
|
85
|
-
import { QuestionCircleOutlined } from '@ant-design/icons-vue';
|
|
86
|
-
import departmentImg from '@/assets/department.png';
|
|
87
|
-
import t, {formatOptions} from '../utils';
|
|
88
|
-
|
|
89
|
-
const levelMap:LevelMapType = {
|
|
90
|
-
L1: {
|
|
91
|
-
color: '#1AA83B',
|
|
92
|
-
text: t('levels.L1'),
|
|
93
|
-
background: '#E3F9E9',
|
|
94
|
-
},
|
|
95
|
-
L2: {
|
|
96
|
-
color: '#F37D1C',
|
|
97
|
-
text: t('levels.L2'),
|
|
98
|
-
background: '#FFE4BA'
|
|
99
|
-
},
|
|
100
|
-
L3: {
|
|
101
|
-
color: '#F2494B',
|
|
102
|
-
text: t('levels.L3'),
|
|
103
|
-
background: '#FDCDC5'
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
let props = defineProps({
|
|
108
|
-
item: {
|
|
109
|
-
type: Object as PropType<PermissionType>,
|
|
110
|
-
default: () => {}
|
|
111
|
-
},
|
|
112
|
-
checkedIds: {
|
|
113
|
-
type: Array as PropType<number[]>,
|
|
114
|
-
default: []
|
|
115
|
-
},
|
|
116
|
-
onChangeTime: {
|
|
117
|
-
type: Function as PropType<() => void>,
|
|
118
|
-
default: () => {}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const timeStatusOptions = formatOptions('availiables');
|
|
122
|
-
const statusMap = t('status');
|
|
123
|
-
const validTime = ref('');
|
|
124
|
-
|
|
125
|
-
//1登录人所在部门 = 权限适用范围,都默认90天,不需要区分等级和类型,
|
|
126
|
-
//2登录人所在部门 ≠ 权限适用范围,根据等级来,高(L3)默认给7天,中(L2)默认给30天,低(L1)默认给60天
|
|
127
|
-
const setDefaultTime = (item: PermissionType) => {
|
|
128
|
-
const validMap = {
|
|
129
|
-
L1: 'SIXTY_DAYS',
|
|
130
|
-
L2: 'THIRTY_DAYS',
|
|
131
|
-
L3: 'SEVEN_DAYS',
|
|
132
|
-
};
|
|
133
|
-
const { relatedDepartmentIds = [], curDepartmentId = 0, securityLevel } = item;
|
|
134
|
-
if (relatedDepartmentIds.includes(curDepartmentId as number)) {
|
|
135
|
-
item.validTime = 'NINETY_DAYS';
|
|
136
|
-
} else {
|
|
137
|
-
item.validTime = validMap[securityLevel];
|
|
138
|
-
}
|
|
139
|
-
return item.validTime;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const onChangeTimeHandler = (value: any) => {
|
|
143
|
-
props.item.validTime = value;
|
|
144
|
-
props.onChangeTime();
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const onCheck = (e: any) => {
|
|
148
|
-
if (e.target.checked) {
|
|
149
|
-
validTime.value = setDefaultTime(props.item);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
</script>
|
|
154
|
-
<style scoped>
|
|
155
|
-
.crane-flex-center {
|
|
156
|
-
display: flex;
|
|
157
|
-
align-items: center;
|
|
158
|
-
}
|
|
159
|
-
.crane-checkbox-line {
|
|
160
|
-
margin-bottom: 12px;
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
}
|
|
164
|
-
.crane-checkbox-line:last-child {
|
|
165
|
-
margin-bottom: 0;
|
|
166
|
-
}
|
|
167
|
-
.crane-checkbox-label {
|
|
168
|
-
max-width: 346px;
|
|
169
|
-
}
|
|
170
|
-
.crane-tag-position {
|
|
171
|
-
margin-right: 4px;
|
|
172
|
-
font-size: 10px;
|
|
173
|
-
padding: 2px 4px;
|
|
174
|
-
line-height: 12px;
|
|
175
|
-
font-weight: 500;
|
|
176
|
-
}
|
|
177
|
-
.crane-margin-right-0 {
|
|
178
|
-
margin-right: 0;
|
|
179
|
-
}
|
|
180
|
-
.crane-margin-left-4 {
|
|
181
|
-
margin-left: 4px;
|
|
182
|
-
}
|
|
183
|
-
.crane-margin-right-4 {
|
|
184
|
-
margin-right: 4px;
|
|
185
|
-
}
|
|
186
|
-
.crane-margin-left-12 {
|
|
187
|
-
margin-left: 12px;
|
|
188
|
-
}
|
|
189
|
-
.crane-disabled-color {
|
|
190
|
-
color: #C9CDD4;
|
|
191
|
-
}
|
|
192
|
-
.crane-week-color {
|
|
193
|
-
color: #86909C;
|
|
194
|
-
}
|
|
195
|
-
.crane-text-overflow {
|
|
196
|
-
flex: 1;
|
|
197
|
-
overflow: hidden;
|
|
198
|
-
text-overflow: ellipsis
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
</style>
|