@yqg/permission 1.3.4 → 1.3.5-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/dist/{apply-modal-BsokPhqu.js → apply-modal-DFVMxU4P.js} +5 -5
- package/dist/{category-selector-Bo1Upd0w.js → category-selector-D_8E2kwg.js} +4 -4
- package/dist/{index-Dl_VZBVk.js → index-C55cbXDC.js} +3 -3
- package/dist/{index-CTndgjy2.js → index-CJqbH2iQ.js} +3 -3
- package/dist/index.js +2 -2
- package/dist/{permission-item-Cc_fF08Z.js → permission-item-D5l8rvrV.js} +4 -4
- package/dist/{yqg-permission-ItXNxp6g.js → yqg-permission-CVFg15cm.js} +1557 -1557
- package/dist/yqg-permission.umd.js +51 -51
- package/package.json +1 -1
- package/src/App.vue +9 -5
- package/src/components/apply-modal.vue +1 -0
- package/src/components/yqg-permission.vue +6 -7
- package/src/i18n/en-US.ts +50 -50
- package/src/i18n/in-ID.ts +57 -0
- package/src/i18n/index.ts +5 -2
- package/src/i18n/zh-CH.ts +0 -8
- package/src/utils/index.ts +16 -2
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {ref} from 'vue';
|
|
2
|
+
import { ref, reactive } from 'vue';
|
|
3
3
|
import {Button} from 'ant-design-vue';
|
|
4
4
|
|
|
5
5
|
// 中英印尼菲律宾
|
|
6
6
|
type LocaleType = 'zh-CN' | 'en-US' | 'id-ID' | 'fil-PH';
|
|
7
7
|
|
|
8
8
|
const color = ref<string>('#1677ff');
|
|
9
|
-
const locale = ref<LocaleType>('
|
|
9
|
+
const locale = ref<LocaleType>('id-ID');
|
|
10
10
|
|
|
11
|
-
const permissions = ref('CALL_CENTER.DATA_BUSINESS.QUERY,CALL_CENTER.ENTER_ADMIN,CALL_CENTER.USER.QUERY,CALL_CENTER.USER.MANAGE,CALL_CENTER.BUSINESS.QUERY,CALL_CENTER.SKILL_GROUP.QUERY');
|
|
11
|
+
// const permissions = ref('CALL_CENTER.DATA_BUSINESS.QUERY,CALL_CENTER.ENTER_ADMIN,CALL_CENTER.USER.QUERY,CALL_CENTER.USER.MANAGE,CALL_CENTER.BUSINESS.QUERY,CALL_CENTER.SKILL_GROUP.QUERY');
|
|
12
|
+
const permissions = reactive([
|
|
13
|
+
'yewei0313.REAQS.DEPAWED_ANQ2.QUERY',
|
|
14
|
+
]);
|
|
15
|
+
//05615
|
|
12
16
|
// const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
|
|
13
17
|
const changeColor = () => {
|
|
14
18
|
color.value = color.value === '#f00' ? '#1677ff' : '#f00';
|
|
15
19
|
}
|
|
16
20
|
const changeLocale = () => {
|
|
17
|
-
locale.value = locale.value === '
|
|
21
|
+
locale.value = locale.value === 'id-ID' ? 'en-US' : 'id-ID';
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
</script>
|
|
@@ -29,7 +33,7 @@ const changeLocale = () => {
|
|
|
29
33
|
<!-- 03541 -->
|
|
30
34
|
<!-- 02124 -->
|
|
31
35
|
<!-- 05184 -->
|
|
32
|
-
<yqg-permission :permissions="permissions" workNumber="
|
|
36
|
+
<yqg-permission :permissions="permissions" workNumber="03817" :color="color" :locale="locale"
|
|
33
37
|
@onSuccess="() => {console.log('成功')}">
|
|
34
38
|
</yqg-permission>
|
|
35
39
|
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ConfigProvider prefixCls="yqg-permission" :theme="{
|
|
2
|
+
<ConfigProvider prefixCls="yqg-permission" :key="locale" :theme="{
|
|
3
3
|
token: {
|
|
4
|
-
colorPrimary:
|
|
4
|
+
colorPrimary: color,
|
|
5
5
|
}
|
|
6
6
|
}">
|
|
7
|
-
<div class="crane-wraper">
|
|
7
|
+
<div class="crane-wraper" :key="locale">
|
|
8
8
|
<template v-if="[COM_TYPE.FLOATBUTTON, COM_TYPE.TEXT].includes(type)">
|
|
9
9
|
<FloatButton ref="dragElement" type="primary" :tooltip="t('clickToApply')" :style="{
|
|
10
10
|
right: RIGHT_DEFAULT,
|
|
@@ -75,7 +75,7 @@ import { Button, ConfigProvider, Popover, message, FloatButton } from 'ant-desig
|
|
|
75
75
|
import applyIconUrl from '@/assets/applyicon.png';
|
|
76
76
|
import noauthority from '@/assets/noauthority.png';
|
|
77
77
|
import Http from '../axios/index';
|
|
78
|
-
import t from '../utils';
|
|
78
|
+
import t, { setLocale } from '../utils';
|
|
79
79
|
import useDraggable from '../hooks/useDragable';
|
|
80
80
|
import useStatus from '../hooks/useStatus';
|
|
81
81
|
import useFormat from '../hooks/useFormat';
|
|
@@ -113,7 +113,7 @@ const props = defineProps({
|
|
|
113
113
|
},
|
|
114
114
|
locale: {
|
|
115
115
|
type: String,
|
|
116
|
-
default: 'zh
|
|
116
|
+
default: 'zh'
|
|
117
117
|
},
|
|
118
118
|
color: {
|
|
119
119
|
type: String,
|
|
@@ -193,7 +193,7 @@ watchEffect(() => {
|
|
|
193
193
|
});
|
|
194
194
|
watch(() => props.locale, (cur, pre) => {
|
|
195
195
|
if (cur === pre) return;
|
|
196
|
-
|
|
196
|
+
setLocale(cur);
|
|
197
197
|
}, { immediate: true });
|
|
198
198
|
</script>
|
|
199
199
|
|
|
@@ -213,5 +213,4 @@ watch(() => props.locale, (cur, pre) => {
|
|
|
213
213
|
.crane-margin-right10 {
|
|
214
214
|
margin-right: 10px;
|
|
215
215
|
}
|
|
216
|
-
|
|
217
216
|
</style>
|
package/src/i18n/en-US.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
permissionApply: '
|
|
3
|
-
applyPermission: '
|
|
4
|
-
applyReason: '
|
|
5
|
-
approvalProcess: '
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
2
|
+
permissionApply: 'Permission Application',
|
|
3
|
+
applyPermission: 'Apply for Permission',
|
|
4
|
+
applyReason: 'Application Reason',
|
|
5
|
+
approvalProcess: 'Approval Process',
|
|
6
|
+
isAllOwnTips: 'The current page already has permission or is under approval, no need to apply',
|
|
7
|
+
applyReasonPlaceholder: 'Please describe your reason and usage scenario in detail. Avoid vague explanations like "work needs" to prevent delays in approval.',
|
|
8
|
+
applyReasonTips: 'Example: Due to requirements of XX project, need to view/operate XXXX scenario/issue, which involves the use of XXX permission, hence submitting this application!',
|
|
9
|
+
cancel: 'Cancel',
|
|
10
|
+
submit: 'Confirm',
|
|
11
|
+
close: 'Close',
|
|
12
|
+
viewApprovalDetail: 'View Approval Details',
|
|
13
|
+
applyMore: 'Continue applying for other permissions',
|
|
14
|
+
successTips: 'Application submitted. Relevant permissions will be granted upon approval.',
|
|
15
|
+
resoultTitle: 'Operation Result Feedback',
|
|
16
|
+
start: 'Start',
|
|
17
|
+
end: 'End',
|
|
18
|
+
noNeed: 'No Approval Required',
|
|
19
|
+
adaptDepartment: 'Applicable Department',
|
|
20
|
+
noApprovalProcess: 'No approval process required',
|
|
21
|
+
excessTips: 'You can apply for up to {number} permissions at a time',
|
|
22
|
+
unavailableTips: 'You currently don\'t have permission to view/operate this page. Please click the button below to apply.',
|
|
23
|
+
appliedTips: 'Permission request submitted, currently {status}...',
|
|
24
|
+
unapplyTips: 'You don’t have permission to view or operate this page. There are no available permissions to apply for.',
|
|
25
|
+
callManager: 'If needed, please contact the system administrator',
|
|
26
|
+
manager: 'System Administrator',
|
|
27
|
+
availableTime: 'Validity Period',
|
|
28
|
+
selectPlaceholder: 'Please select permission points',
|
|
29
|
+
reasonPlaceholder: 'Please enter your reason for applying',
|
|
30
|
+
pleaseChoose: 'Please select',
|
|
31
|
+
maxCountTips: 'You can apply for up to {count} permissions at a time',
|
|
32
|
+
maxLengthTips: 'Up to {length} characters',
|
|
33
|
+
today: 'Expires today',
|
|
34
|
+
clickToApply: 'Click to apply for permission',
|
|
35
|
+
noPermissionTips: 'There are no permission points under this menu, no need to apply',
|
|
36
|
+
lastDays: '{count} days',
|
|
37
|
+
categoryTips: 'Your current data scope:',
|
|
38
|
+
empty: 'None',
|
|
39
|
+
category: 'Data Permission',
|
|
40
|
+
categotySelectTips: 'The selected permissions include data scope settings. Please apply for or update the scope based on your actual needs.',
|
|
41
|
+
categoryChangeTips: 'Please verify whether full access to "{category}" is necessary for your role. Be sure to explain the use case clearly in your application to avoid rejection.',
|
|
42
42
|
levels: {
|
|
43
|
-
L1: '
|
|
44
|
-
L2: '
|
|
45
|
-
L3: '
|
|
43
|
+
L1: 'Low',
|
|
44
|
+
L2: 'Medium',
|
|
45
|
+
L3: 'High',
|
|
46
46
|
},
|
|
47
47
|
status: {
|
|
48
|
-
PENDING: '
|
|
49
|
-
NO: '
|
|
50
|
-
OWNER: '
|
|
51
|
-
TEMP_OWNER: '
|
|
48
|
+
PENDING: 'Under review',
|
|
49
|
+
NO: 'Not applicable for application',
|
|
50
|
+
OWNER: 'Permanent permission',
|
|
51
|
+
TEMP_OWNER: 'Temporary permission',
|
|
52
52
|
},
|
|
53
53
|
operationType: {
|
|
54
|
-
QUERY: '
|
|
55
|
-
MANAGE: '
|
|
54
|
+
QUERY: 'Query',
|
|
55
|
+
MANAGE: 'Action',
|
|
56
56
|
}
|
|
57
|
-
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
permissionApply: 'Aplikasi Izin',
|
|
3
|
+
applyPermission: 'Ajukan Permohonan Izin',
|
|
4
|
+
applyReason: 'Alasan Permohonan',
|
|
5
|
+
approvalProcess: 'Proses Persetujuan',
|
|
6
|
+
isAllOwnTips: 'Halaman ini sudah memiliki izin atau sedang dalam proses persetujuan, tidak perlu mengajukan permohonan',
|
|
7
|
+
applyReasonPlaceholder: 'Harap jelaskan alasan dan skenario penggunaan secara detail. Hindari penjelasan yang tidak jelas seperti "kebutuhan kerja" untuk mencegah penundaan persetujuan.',
|
|
8
|
+
applyReasonTips: 'Contoh: Karena kebutuhan proyek XX, perlu melihat/mengoperasikan skenario/masalah XXXX, yang melibatkan penggunaan izin XXX, oleh karena itu mengajukan permohonan ini!',
|
|
9
|
+
cancel: 'Batal',
|
|
10
|
+
submit: 'Konfirmasi',
|
|
11
|
+
close: 'Tutup',
|
|
12
|
+
viewApprovalDetail: 'Lihat Detail Persetujuan',
|
|
13
|
+
applyMore: 'Lanjutkan mengajukan izin lainnya',
|
|
14
|
+
successTips: 'Permohonan telah diajukan. Izin terkait akan diberikan setelah disetujui.',
|
|
15
|
+
resoultTitle: 'Umpan Balik Hasil Operasi',
|
|
16
|
+
start: 'Mulai',
|
|
17
|
+
end: 'Selesai',
|
|
18
|
+
noNeed: 'Tidak Perlu Persetujuan',
|
|
19
|
+
adaptDepartment: 'Departemen yang Berlaku',
|
|
20
|
+
noApprovalProcess: 'Tidak perlu proses persetujuan',
|
|
21
|
+
excessTips: 'Anda dapat mengajukan hingga {number} izin sekaligus',
|
|
22
|
+
unavailableTips: 'Anda saat ini tidak memiliki izin untuk melihat/mengoperasikan halaman ini. Silakan klik tombol di bawah untuk mengajukan permohonan.',
|
|
23
|
+
appliedTips: 'Permohonan izin telah diajukan, saat ini {status}...',
|
|
24
|
+
unapplyTips: 'Anda tidak memiliki izin untuk melihat atau mengoperasikan halaman ini. Tidak ada izin yang tersedia untuk diajukan.',
|
|
25
|
+
callManager: 'Jika diperlukan, silakan hubungi administrator sistem',
|
|
26
|
+
manager: 'Administrator Sistem',
|
|
27
|
+
availableTime: 'Masa Berlaku',
|
|
28
|
+
selectPlaceholder: 'Silakan pilih titik izin',
|
|
29
|
+
reasonPlaceholder: 'Silakan masukkan alasan permohonan Anda',
|
|
30
|
+
pleaseChoose: 'Silakan pilih',
|
|
31
|
+
maxCountTips: 'Anda dapat mengajukan hingga {count} izin sekaligus',
|
|
32
|
+
maxLengthTips: 'Maksimal {length} karakter',
|
|
33
|
+
today: 'Kadaluarsa hari ini',
|
|
34
|
+
clickToApply: 'Klik untuk mengajukan izin',
|
|
35
|
+
noPermissionTips: 'Tidak ada titik izin di bawah menu ini, tidak perlu mengajukan permohonan',
|
|
36
|
+
lastDays: '{count} hari',
|
|
37
|
+
categoryTips: 'Cakupan data Anda saat ini:',
|
|
38
|
+
empty: 'Tidak ada',
|
|
39
|
+
category: 'Izin Data',
|
|
40
|
+
categotySelectTips: 'Izin yang dipilih termasuk pengaturan cakupan data. Silakan ajukan atau perbarui cakupan berdasarkan kebutuhan aktual Anda.',
|
|
41
|
+
categoryChangeTips: 'Harap verifikasi apakah akses penuh ke "{category}" diperlukan untuk peran Anda. Pastikan untuk menjelaskan kasus penggunaan secara jelas dalam permohonan Anda untuk menghindari penolakan.',
|
|
42
|
+
levels: {
|
|
43
|
+
L1: 'Rendah',
|
|
44
|
+
L2: 'Sedang',
|
|
45
|
+
L3: 'Tinggi',
|
|
46
|
+
},
|
|
47
|
+
status: {
|
|
48
|
+
PENDING: 'Dalam tinjauan',
|
|
49
|
+
NO: 'Tidak berlaku untuk aplikasi',
|
|
50
|
+
OWNER: 'Izin permanen',
|
|
51
|
+
TEMP_OWNER: 'Izin sementara',
|
|
52
|
+
},
|
|
53
|
+
operationType: {
|
|
54
|
+
QUERY: 'Kueri',
|
|
55
|
+
MANAGE: 'Aksi',
|
|
56
|
+
}
|
|
57
|
+
};
|
package/src/i18n/index.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import enUS from './en-US';
|
|
2
2
|
import zhCH from './zh-CH';
|
|
3
|
+
// import inID from './in-ID';
|
|
3
4
|
|
|
4
5
|
const language: {
|
|
5
6
|
[key: string]: any;
|
|
6
7
|
} = {
|
|
7
|
-
'zh
|
|
8
|
-
'en
|
|
8
|
+
'zh': zhCH,
|
|
9
|
+
'en': enUS,
|
|
10
|
+
// 'id': inID,
|
|
9
11
|
};
|
|
10
12
|
|
|
13
|
+
|
|
11
14
|
export default language;
|
package/src/i18n/zh-CH.ts
CHANGED
|
@@ -39,14 +39,6 @@ export default {
|
|
|
39
39
|
category: '数据权限',
|
|
40
40
|
categotySelectTips: '上方选中的权限包含数据权限,请根据实际工作需要申请/更改数据范围。',
|
|
41
41
|
categoryChangeTips: '提醒:您选择的数据权限范围较大!请确认实际工作场景是否需要全量「{category}」权限,并在申请理由中写明,避免审批不通过!',
|
|
42
|
-
availiables: {
|
|
43
|
-
SEVEN_DAYS: '7天',
|
|
44
|
-
THIRTY_DAYS: '30天',
|
|
45
|
-
SIXTY_DAYS: '60天',
|
|
46
|
-
NINETY_DAYS: '90天',
|
|
47
|
-
ONE_YEARS: '1年',
|
|
48
|
-
FOREVER: '永久有效',
|
|
49
|
-
},
|
|
50
42
|
levels: {
|
|
51
43
|
L1: '低',
|
|
52
44
|
L2: '中',
|
package/src/utils/index.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import language from '../i18n';
|
|
2
2
|
|
|
3
|
+
const localkey = 'yqg_permission_sdk_locale';
|
|
4
|
+
|
|
3
5
|
type optionsType = {
|
|
4
6
|
[key: string]: any;
|
|
5
7
|
};
|
|
6
8
|
const t = (key: string, options?: optionsType) => {
|
|
7
9
|
// key的格式为:'xxx.xxx.xxx'//国际化todo
|
|
8
|
-
const en = localStorage.getItem(
|
|
10
|
+
const en = localStorage.getItem(localkey) || 'en';
|
|
9
11
|
const keys = key.split('.');
|
|
10
|
-
let result = language[en as string] || language['en
|
|
12
|
+
let result = language[en as string] || language['en'];
|
|
11
13
|
for (let i = 0; i < keys.length; i++) {
|
|
12
14
|
result = result[keys[i]];
|
|
13
15
|
}
|
|
@@ -54,3 +56,15 @@ export const deepTree = (tree: any[], fn: (item:any) => void) => {
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
export default t;
|
|
59
|
+
|
|
60
|
+
export const setLocale = (locale: string) => {
|
|
61
|
+
let finalLocale = '';
|
|
62
|
+
if (locale.startsWith('zh')) {
|
|
63
|
+
finalLocale = 'zh';
|
|
64
|
+
} else if (locale.startsWith('en')) {
|
|
65
|
+
finalLocale = 'en';
|
|
66
|
+
} else if (locale.startsWith('id') || locale.startsWith('in')) {
|
|
67
|
+
finalLocale = 'id';
|
|
68
|
+
}
|
|
69
|
+
localStorage.setItem(localkey, finalLocale);
|
|
70
|
+
}
|