@yqg/permission 1.3.6 → 1.3.7

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.6",
3
+ "version": "1.3.7",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -21,19 +21,22 @@
21
21
  <span v-if="!permissionList.length">
22
22
  {{ t('noPermissionTips') }}
23
23
  </span>
24
-
25
- <Tree checkable :default-expand-all="true" :tree-data="permissionList" :height="200"
26
- :expandedKeys="expandedKeys" :checkedKeys="formState.features"
27
- @check="onCheck" @expand="expandedKeys = $event">
28
- <template #title="item: PermissionType">
29
- <div v-if="item.children && item.children.length">
30
- {{ item.shortName }}
31
- </div>
32
- <PermissionItem v-else :checkedKeys="formState.features" :item="item"
33
- @onChangeTime="onChangeTime" @updateTime="setDefaultTime"
34
- :validTimeOptions="validTimeOptions" />
35
- </template>
36
- </Tree>
24
+ <div v-else :class="{ 'yqg-permission-tree-list-wraper': showScrollBar }">
25
+
26
+
27
+ <Tree checkable :default-expand-all="true" :tree-data="permissionList" :height="200"
28
+ :expandedKeys="expandedKeys"
29
+ :checkedKeys="formState.features" @check="onCheck" @expand="expandedKeys = $event">
30
+ <template #title="item: PermissionType">
31
+ <div v-if="item.children && item.children.length">
32
+ {{ item.shortName }}
33
+ </div>
34
+ <PermissionItem v-else :checkedKeys="formState.features" :item="item"
35
+ @onChangeTime="onChangeTime" @updateTime="setDefaultTime"
36
+ :validTimeOptions="validTimeOptions" />
37
+ </template>
38
+ </Tree>
39
+ </div>
37
40
  <CategorySelector v-if="categoryList.length" :categoryList="categoryList" ref="categoryRef" />
38
41
  </Spin>
39
42
  </FormItem>
@@ -70,7 +73,8 @@ import {
70
73
  ref,
71
74
  watch,
72
75
  PropType,
73
- computed
76
+ computed,
77
+ nextTick
74
78
  } from 'vue';
75
79
  import Http from '../axios/index';
76
80
  import {
@@ -144,6 +148,7 @@ const successModal = ref<InstanceType<typeof SuccessModal>>();
144
148
  const formRef = ref();
145
149
  const categoryRef = ref();
146
150
  let stepNodes = ref([]);
151
+ const showScrollBar = ref(false);
147
152
  const categoryList = ref<CategoryType[]>([]);
148
153
  const validTimeOptions = ref([]);
149
154
  const expandedKeys = ref<any[]>([]);
@@ -288,6 +293,18 @@ const onCheck = (checkedIds: any, info: any) => {
288
293
  // 预览审批流程
289
294
  }
290
295
 
296
+ const initScrollBar = () => {
297
+ const treeHeight = document.querySelector('.yqg-permission-tree-list-holder')?.children?.[0]?.clientHeight || 0;
298
+ if (treeHeight > 200) {
299
+ // 设置树的高度
300
+ showScrollBar.value = true;
301
+ } else {
302
+ showScrollBar.value = false;
303
+ }
304
+ }
305
+
306
+
307
+
291
308
  watch(() => props.permissionList, (cur) => {
292
309
  expandedKeys.value = [];
293
310
  deepTree(cur, (item: any) => {
@@ -295,6 +312,10 @@ watch(() => props.permissionList, (cur) => {
295
312
  expandedKeys.value.push(item.feature);
296
313
  }
297
314
  })
315
+
316
+ nextTick(() => {
317
+ initScrollBar();
318
+ })
298
319
  })
299
320
 
300
321
  watch(() => props.defaultCheckedIds, (cur) => {
@@ -356,7 +377,11 @@ const getPopupContainer = ():HTMLElement => {
356
377
  width: 100% !important;
357
378
  }
358
379
 
359
- :deep(.yqg-permission-tree-list-scrollbar) {
380
+ .yqg-permission-tree-list-wraper :deep(.yqg-permission-tree-list-scrollbar) {
360
381
  display: block !important;
361
382
  }
383
+
384
+
385
+
386
+
362
387
  </style>