@yqg/permission 1.3.1 → 1.3.2-alpha.1
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-HbSkqmaf.js → apply-modal-BNdUCpv3.js} +4 -4
- package/dist/{category-selector-Ca0cCF_f.js → category-selector-DN93T2dR.js} +4 -4
- package/dist/{index-BnoD8TDN.js → index-C8n_Swh6.js} +3 -3
- package/dist/{index-DmWk0BKA.js → index-wZrMoTve.js} +3 -3
- package/dist/index.js +2 -2
- package/dist/{permission-item-CugIQWwq.js → permission-item-BSOmY3P3.js} +4 -4
- package/dist/{yqg-permission-D8qW35n6.js → yqg-permission-80IS5NzA.js} +2431 -2377
- package/dist/yqg-permission.umd.js +55 -55
- package/package.json +1 -1
- package/src/axios/index.ts +1 -5
- package/src/components/yqg-permission.vue +4 -4
- 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 +17 -2
package/package.json
CHANGED
package/src/axios/index.ts
CHANGED
|
@@ -2,8 +2,6 @@ import axios from './axios';
|
|
|
2
2
|
|
|
3
3
|
const urlPrefix = '/crane';
|
|
4
4
|
|
|
5
|
-
export const controller = new AbortController();
|
|
6
|
-
|
|
7
5
|
type apiType = {
|
|
8
6
|
[key in string]: (params?: any) => Promise<{body: any}>
|
|
9
7
|
}
|
|
@@ -11,9 +9,7 @@ type apiType = {
|
|
|
11
9
|
export default {
|
|
12
10
|
getPermissions: (params: any) => axios.get(`${urlPrefix}/permission/apply`, {params}),
|
|
13
11
|
|
|
14
|
-
getFlowPreview: (params: any) => axios.post(`${urlPrefix}/permission/apply/oa/flow/submit/preview`, params,
|
|
15
|
-
signal: controller.signal // 关键配置
|
|
16
|
-
}),
|
|
12
|
+
getFlowPreview: (params: any) => axios.post(`${urlPrefix}/permission/apply/oa/flow/submit/preview`, params),
|
|
17
13
|
|
|
18
14
|
submitApply: (params: any) => axios.post(`${urlPrefix}/permission/apply/oa/flow/submit`, params),
|
|
19
15
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
colorPrimary: props.color,
|
|
5
5
|
}
|
|
6
6
|
}">
|
|
7
|
-
<div class="crane-wraper">
|
|
7
|
+
<div class="crane-wraper" :key="props.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';
|
|
@@ -112,7 +112,7 @@ const props = defineProps({
|
|
|
112
112
|
},
|
|
113
113
|
locale: {
|
|
114
114
|
type: String,
|
|
115
|
-
default: 'zh
|
|
115
|
+
default: 'zh'
|
|
116
116
|
},
|
|
117
117
|
color: {
|
|
118
118
|
type: String,
|
|
@@ -188,7 +188,7 @@ watchEffect(() => {
|
|
|
188
188
|
});
|
|
189
189
|
watch(() => props.locale, (cur, pre) => {
|
|
190
190
|
if (cur === pre) return;
|
|
191
|
-
|
|
191
|
+
setLocale(cur);
|
|
192
192
|
}, { immediate: true });
|
|
193
193
|
</script>
|
|
194
194
|
|
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 the reason for application and usage scenarios in as much detail as possible. Avoid simply stating "work requirements" to prevent delays in the approval process.',
|
|
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: 'Apply for Other Permissions',
|
|
14
|
+
successTips: 'Application submitted. Relevant permissions will be granted upon approval.',
|
|
15
|
+
resoultTitle: 'Operation Result Feedback',
|
|
16
|
+
start: 'Initiate',
|
|
17
|
+
end: 'End',
|
|
18
|
+
noNeed: 'No Approval Required',
|
|
19
|
+
adaptDepartment: 'Applicable Department',
|
|
20
|
+
noApprovalProcess: 'No Approval Process',
|
|
21
|
+
excessTips: 'Maximum {number} permissions can be applied for at once',
|
|
22
|
+
unavailableTips: 'You currently don\'t have permission to view/operate this page. Please click the button below to apply.',
|
|
23
|
+
appliedTips: 'Permission has been applied, currently {status}...',
|
|
24
|
+
unapplyTips: 'You don\'t have permission to view/operate this page, and there are no applicable permissions you can apply for in this page.',
|
|
25
|
+
callManager: 'If needed, please contact the system administrator',
|
|
26
|
+
manager: 'System Administrator',
|
|
27
|
+
availableTime: 'Validity Period',
|
|
28
|
+
selectPlaceholder: 'Please select permission point',
|
|
29
|
+
reasonPlaceholder: 'Please enter application reason',
|
|
30
|
+
pleaseChoose: 'Please select',
|
|
31
|
+
maxCountTips: 'Maximum {count} permissions can be applied for at once',
|
|
32
|
+
maxLengthTips: 'Maximum {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 is as follows:',
|
|
38
|
+
empty: 'Empty',
|
|
39
|
+
category: 'Data Permission',
|
|
40
|
+
categotySelectTips: 'The selected permission above includes data permissions. Please apply for/change the data scope according to actual work requirements.',
|
|
41
|
+
categoryChangeTips: 'Reminder: The data permission scope you selected is relatively large! Please confirm whether your actual work scenario requires full access to 「{category}」permission, and clearly state it in the application reason 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: 'Pending Approval',
|
|
49
|
+
NO: 'Not Applicable',
|
|
50
|
+
OWNER: 'Permanently Owned',
|
|
51
|
+
TEMP_OWNER: 'Temporarily Owned',
|
|
52
52
|
},
|
|
53
53
|
operationType: {
|
|
54
|
-
QUERY: '
|
|
55
|
-
MANAGE: '
|
|
54
|
+
QUERY: 'Query',
|
|
55
|
+
MANAGE: 'Operation',
|
|
56
56
|
}
|
|
57
|
-
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
permissionApply: 'Aplikasi Izin',
|
|
3
|
+
applyPermission: 'Ajukan Izin',
|
|
4
|
+
applyReason: 'Alasan Pengajuan',
|
|
5
|
+
approvalProcess: 'Proses Persetujuan',
|
|
6
|
+
isAllOwnTips: 'Halaman saat ini sudah memiliki izin atau sedang dalam proses persetujuan, tidak perlu mengajukan permohonan',
|
|
7
|
+
applyReasonPlaceholder: 'Harap jelaskan alasan pengajuan dan skenario penggunaan selengkap mungkin. Hindari hanya menyebutkan "kebutuhan kerja" untuk mencegah penundaan dalam proses 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: 'Ajukan Izin Lainnya',
|
|
14
|
+
successTips: 'Pengajuan telah dikirim. 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 Ada Proses Persetujuan',
|
|
21
|
+
excessTips: 'Maksimal {number} izin dapat diajukan sekaligus',
|
|
22
|
+
unavailableTips: 'Anda saat ini tidak memiliki izin untuk melihat/mengoperasikan halaman ini. Silakan klik tombol di bawah untuk mengajukan.',
|
|
23
|
+
appliedTips: 'Izin telah diajukan, saat ini {status}...',
|
|
24
|
+
unapplyTips: 'Anda tidak memiliki izin untuk melihat/mengoperasikan halaman ini, dan tidak ada izin yang dapat diajukan di halaman ini.',
|
|
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 pengajuan',
|
|
30
|
+
pleaseChoose: 'Silakan pilih',
|
|
31
|
+
maxCountTips: 'Maksimal {count} izin dapat diajukan sekaligus',
|
|
32
|
+
maxLengthTips: 'Maksimal {length} karakter',
|
|
33
|
+
today: 'Kadaluarsa hari ini',
|
|
34
|
+
clickToApply: 'Klik untuk mengajukan izin',
|
|
35
|
+
noPermissionTips: 'Tidak ada titik izin di menu ini, tidak perlu mengajukan permohonan',
|
|
36
|
+
lastDays: '{count} hari',
|
|
37
|
+
categoryTips: 'Cakupan data Anda saat ini adalah sebagai berikut:',
|
|
38
|
+
empty: 'Kosong',
|
|
39
|
+
category: 'Izin Data',
|
|
40
|
+
categotySelectTips: 'Izin yang dipilih di atas mencakup izin data. Silakan ajukan/ubah cakupan data sesuai kebutuhan kerja aktual.',
|
|
41
|
+
categoryChangeTips: 'Peringatan: Cakupan izin data yang Anda pilih relatif besar! Harap konfirmasi apakah skenario kerja aktual Anda memerlukan akses penuh ke izin 「{category}」, dan jelaskan secara jelas dalam alasan pengajuan untuk menghindari penolakan!',
|
|
42
|
+
levels: {
|
|
43
|
+
L1: 'Rendah',
|
|
44
|
+
L2: 'Sedang',
|
|
45
|
+
L3: 'Tinggi',
|
|
46
|
+
},
|
|
47
|
+
status: {
|
|
48
|
+
PENDING: 'Menunggu Persetujuan',
|
|
49
|
+
NO: 'Tidak Dapat Diajukan',
|
|
50
|
+
OWNER: 'Dimiliki Secara Permanen',
|
|
51
|
+
TEMP_OWNER: 'Dimiliki Sementara',
|
|
52
|
+
},
|
|
53
|
+
operationType: {
|
|
54
|
+
QUERY: 'Kueri',
|
|
55
|
+
MANAGE: 'Operasi',
|
|
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,16 @@
|
|
|
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';
|
|
11
|
+
console.log('en', localStorage.getItem(localkey));
|
|
9
12
|
const keys = key.split('.');
|
|
10
|
-
let result = language[en as string] || language['en
|
|
13
|
+
let result = language[en as string] || language['en'];
|
|
11
14
|
for (let i = 0; i < keys.length; i++) {
|
|
12
15
|
result = result[keys[i]];
|
|
13
16
|
}
|
|
@@ -54,3 +57,15 @@ export const deepTree = (tree: any[], fn: (item:any) => void) => {
|
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
export default t;
|
|
60
|
+
|
|
61
|
+
export const setLocale = (locale: string) => {
|
|
62
|
+
let finalLocale = '';
|
|
63
|
+
if (locale.startsWith('zh')) {
|
|
64
|
+
finalLocale = 'zh';
|
|
65
|
+
} else if (locale.startsWith('en')) {
|
|
66
|
+
finalLocale = 'en';
|
|
67
|
+
} else if (locale.startsWith('id') || locale.startsWith('in')) {
|
|
68
|
+
finalLocale = 'id';
|
|
69
|
+
}
|
|
70
|
+
localStorage.setItem(localkey, finalLocale);
|
|
71
|
+
}
|