@yqg/permission 1.3.12 → 1.3.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yqg/permission",
3
- "version": "1.3.12",
3
+ "version": "1.3.13",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
package/src/App.vue CHANGED
@@ -8,11 +8,10 @@ type LocaleType = 'zh-CN' | 'en-US' | 'id-ID' | 'fil-PH';
8
8
  const color = ref<string>('#1677ff');
9
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']);
12
- const permissions = ref('TECH.SCHEDULER.JOB.VISIBLE,TECH.SCHEDULER.JOB.QUERY,TECH.SCHEDULER.JOB.MODIFY');
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');
13
12
  // const permissions = 'RECONCILIATION.DATA_INGESTION.RESOLVE_TASK.QUERY';
14
13
  //05615
15
- // const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
14
+ // const permissions = reactive(['CRANE.BUSINESS.QUERY', 'CRANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
16
15
  const changeColor = () => {
17
16
  color.value = color.value === '#f00' ? '#1677ff' : '#f00';
18
17
  }
@@ -20,6 +19,8 @@ const changeLocale = () => {
20
19
  locale.value = locale.value === 'id-ID' ? 'en-US' : 'id-ID';
21
20
  }
22
21
 
22
+ const permissions = ref('TECH.SCHEDULER.JOB.VISIBLE,TECH.SCHEDULER.JOB.QUERY,TECH.SCHEDULER.JOB.MODIFY');
23
+
23
24
  </script>
24
25
 
25
26
  <template>
@@ -32,7 +33,7 @@ const changeLocale = () => {
32
33
  <!-- 03541 -->
33
34
  <!-- 02124 -->
34
35
  <!-- 05184 -->
35
- <yqg-permission :omitCategoryIds="[]" :permissions="permissions" workNumber="03817" :color="color" :locale="locale"
36
+ <yqg-permission :omitCategoryIds="[]" :permissions="permissions" workNumber="03541" :color="color" :locale="locale"
36
37
  @onSuccess="() => {console.log('成功')}">
37
38
  </yqg-permission>
38
39
  </div>
@@ -39,9 +39,9 @@
39
39
  </Spin>
40
40
  </FormItem>
41
41
  <FormItem name="applyReason" :label="t('applyReason')" :rules="[{
42
- required: true, message: t('reasonPlaceholder'), trigger: ['change']
42
+ required: true, message: t('maxMinLengthTips', { maxLength: 300, minLength: 10 }), trigger: ['change']
43
43
  }, {
44
- max: 300, message: t('maxLengthTips', { length: 300 }), trigger: ['change', 'blur']
44
+ max: 300, min: 10, message: t('maxMinLengthTips', { maxLength: 300, minLength: 10 }), trigger: ['change', 'blur']
45
45
  }]">
46
46
  <Textarea v-model:value.trim="formState.applyReason" :placeholder="t('applyReasonPlaceholder')"
47
47
  :auto-size="{ minRows: 4, maxRows: 4 }" :disabled="isAllChecked || !permissionList.length">
@@ -154,7 +154,7 @@ const expandedKeys = ref<any[]>([]);
154
154
  const formState = reactive<formStateType>({
155
155
  features: [],
156
156
  roleVoList: [],
157
- applyReason: '',
157
+ applyReason: t('applyReasonTips'),
158
158
  dataRule: {
159
159
  ruleItems: [],
160
160
  },
@@ -202,7 +202,7 @@ const getParams = () => {
202
202
  if (category.attributeValueIds_view.length) {
203
203
  ruleItems.push({
204
204
  attributeCategoryId: category.id,
205
- attributeValueIds: category.attributeValueIds_view
205
+ attributeValueIds: category.attributeValueIds_view,
206
206
  })
207
207
  };
208
208
 
@@ -22,6 +22,9 @@
22
22
  <span v-if="item.attributeValueIds_view?.includes(-1)" style="color: #ff4d4f; font-size: 12px;">
23
23
  {{ t('categoryChangeTips', { category: item.categoryName }) }}
24
24
  </span>
25
+ <span v-if="getDeleteAttributesNames(item)" style="color: #ff4d4f; font-size: 12px;">
26
+ {{ t('deleteCategoryTips', { categorys: getDeleteAttributesNames(item) }) }}
27
+ </span>
25
28
  </FormItem>
26
29
  </template>
27
30
  </Form>
@@ -45,6 +48,14 @@ const props = defineProps({
45
48
  },
46
49
  })
47
50
 
51
+
52
+ const formRef = ref();
53
+ const searchValue = ref('');
54
+ const {
55
+ categoryValuesMap,
56
+ getDeleteAttributesNames
57
+ } = useAttributesCache(props);
58
+
48
59
  const categoryInfo = computed(() => {
49
60
  return {
50
61
  categoryList: props.categoryList
@@ -54,9 +65,7 @@ const showForm = computed(() => {
54
65
  // 判断是否有数据
55
66
  return Object.values(categoryValuesMap).some(item => item.length > 0);
56
67
  });
57
- const formRef = ref();
58
- const searchValue = ref('');
59
- const { categoryValuesMap } = useAttributesCache(props);
68
+
60
69
 
61
70
  // 返回promise
62
71
  const validate = () => {
@@ -71,8 +80,7 @@ const validate = () => {
71
80
  reject(false);
72
81
  });
73
82
  });
74
- }
75
-
83
+ };
76
84
 
77
85
  defineExpose({
78
86
  validate
@@ -15,7 +15,29 @@ export default function useAttributesCache(props: any) {
15
15
 
16
16
  }, { immediate: true, deep: true });
17
17
 
18
+
19
+ const getCategoryName = (id: number, list: AttributeValueType[]): string => {
20
+ // 换成for 语句
21
+ for (let i = 0; i < list.length; i++) {
22
+ const item = list[i];
23
+ if (item.id === id) {
24
+ return item.attributeName;
25
+ }
26
+ if (item.children && item.children.length) {
27
+ return getCategoryName(id, item.children);
28
+ }
29
+ }
30
+ return '';
31
+ };
32
+
33
+ const getDeleteAttributesNames = (item: CategoryType) => {
34
+ return item.defaultValueIds?.filter(id => !item.attributeValueIds_view.includes(id))?.map(id => {
35
+ return getCategoryName(id, categoryValuesMap[item.id]);
36
+ }).join('、');
37
+ };
38
+
18
39
  return {
19
- categoryValuesMap
40
+ categoryValuesMap,
41
+ getDeleteAttributesNames
20
42
  }
21
43
  }
@@ -5,8 +5,9 @@ export default function useCategory(tree: PermissionType[], checkedIds: string[]
5
5
  const categoryList: CategoryType[] = [];
6
6
  deepTree(tree, (item) => {
7
7
  if (!item.children && checkedIds.includes(item.feature)) {
8
- item.categoryVOS?.forEach((category: any) => {
8
+ item.categoryVOS?.forEach((category: CategoryType) => {
9
9
  category.attributeValueIds_view = category?.attributeValueIds || [];
10
+ category.defaultValueIds = category?.attributeValueIds || [];
10
11
  categoryList.push(category);
11
12
  });
12
13
  }
package/src/i18n/en-US.ts CHANGED
@@ -5,7 +5,7 @@ export default {
5
5
  approvalProcess: 'Approval Process',
6
6
  isAllOwnTips: 'The current page already has permission or is under approval, no need to apply',
7
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!',
8
+ applyReasonTips: 'Template:Because of the project/work】, I need to view 【data】, and therefore require 【relevant permissions】. Other details that need to be noted: 【】',
9
9
  cancel: 'Cancel',
10
10
  submit: 'Confirm',
11
11
  close: 'Close',
@@ -26,10 +26,9 @@ export default {
26
26
  manager: 'System Administrator',
27
27
  availableTime: 'Validity Period',
28
28
  selectPlaceholder: 'Please select permission points',
29
- reasonPlaceholder: 'Please enter your reason for applying',
30
29
  pleaseChoose: 'Please select',
31
30
  maxCountTips: 'You can apply for up to {count} permissions at a time',
32
- maxLengthTips: 'Up to {length} characters',
31
+ maxMinLengthTips: 'Cannot be empty, and the reason must be between {minLength} and {maxLength} characters in length',
33
32
  today: 'Expires today',
34
33
  clickToApply: 'Click to apply for permission',
35
34
  noPermissionTips: 'There are no permission points under this menu, no need to apply',
package/src/i18n/in-ID.ts CHANGED
@@ -5,7 +5,7 @@ export default {
5
5
  approvalProcess: 'Proses Persetujuan',
6
6
  isAllOwnTips: 'Halaman ini sudah memiliki izin atau sedang dalam proses persetujuan, tidak perlu mengajukan permohonan',
7
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!',
8
+ applyReasonTips: 'Templat:Karena proyek/pekerjaan】, saya perlu melihat 【data】, dan oleh karena itu memerlukan 【izin yang relevan】. Hal lain yang perlu dicatat: 【】',
9
9
  cancel: 'Batal',
10
10
  submit: 'Konfirmasi',
11
11
  close: 'Tutup',
@@ -26,10 +26,9 @@ export default {
26
26
  manager: 'Administrator Sistem',
27
27
  availableTime: 'Masa Berlaku',
28
28
  selectPlaceholder: 'Silakan pilih titik izin',
29
- reasonPlaceholder: 'Silakan masukkan alasan permohonan Anda',
30
29
  pleaseChoose: 'Silakan pilih',
31
30
  maxCountTips: 'Anda dapat mengajukan hingga {count} izin sekaligus',
32
- maxLengthTips: 'Maksimal {length} karakter',
31
+ maxMinLengthTips: 'Tidak boleh kosong, dan alasannya harus antara {minLength} dan {maxLength} karakter',
33
32
  today: 'Kadaluarsa hari ini',
34
33
  clickToApply: 'Klik untuk mengajukan izin',
35
34
  noPermissionTips: 'Tidak ada titik izin di bawah menu ini, tidak perlu mengajukan permohonan',
package/src/i18n/zh-CH.ts CHANGED
@@ -5,7 +5,7 @@ export default {
5
5
  approvalProcess: '审批流程',
6
6
  isAllOwnTips: '当前页面权限已拥有或审批中,无需申请',
7
7
  applyReasonPlaceholder: '请尽可能详细说明申请原因和使用场景,不要只填写“工作需要”之类的理由,以免影响你获取权限的审批时间。',
8
- applyReasonTips: '示例:由于XX项目需要,需要查看/操作XXXX场景/问题,涉及到XXX权限的使用,因此提交申请!',
8
+ applyReasonTips: '模版:因为【】项目/工作,需要查看【】数据,需要【】相关权限。其他需要说明的情况【】',
9
9
  cancel: '取消',
10
10
  submit: '确定',
11
11
  close: '关闭',
@@ -29,7 +29,7 @@ export default {
29
29
  reasonPlaceholder: '请输入申请理由',
30
30
  pleaseChoose: '请选择',
31
31
  maxCountTips: '一次最多只可申请{count}个权限',
32
- maxLengthTips: '最多{length}个字符',
32
+ maxMinLengthTips: '不能为空,且理由长度在{minLength}~{maxLength}个字符之间',
33
33
  today: '今天到期',
34
34
  clickToApply: '点击申请权限',
35
35
  noPermissionTips: '该菜单下暂无权限点,无需申请',
@@ -39,6 +39,7 @@ export default {
39
39
  category: '数据权限',
40
40
  categotySelectTips: '上方选中的权限包含数据权限,请根据实际工作需要申请/更改数据范围。',
41
41
  categoryChangeTips: '提醒:您选择的数据权限范围较大!请确认实际工作场景是否需要全量「{category}」权限,并在申请理由中写明,避免审批不通过!',
42
+ deleteCategoryTips: '提醒:已有的数据权限「{categorys}」被删除,将失去该数据权限,请谨慎删除',
42
43
  levels: {
43
44
  L1: '低',
44
45
  L2: '中',
@@ -76,6 +76,13 @@ declare type CategoryType = {
76
76
  attributeValueIds?: number[],
77
77
  configWay: Category,
78
78
  attributeValueIds_view: number[],
79
+ defaultValueIds: number[],
80
+ }
81
+
82
+ declare type AttributeValueType = {
83
+ id: number,
84
+ attributeName: string,
85
+ children?: AttributeValueType[],
79
86
  }
80
87
 
81
88
  declare type OptionsType = {
File without changes