@sy-common/organize-select-help 1.0.0-beta.50 → 1.0.0-beta.53

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": "@sy-common/organize-select-help",
3
- "version": "1.0.0-beta.50",
3
+ "version": "1.0.0-beta.53",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
package/src/index.vue CHANGED
@@ -126,15 +126,17 @@
126
126
  <div class="staff-left-panel">
127
127
  <div class="panel-title">组织选择</div>
128
128
  <div class="tree staff-org-tree">
129
- <organizeTree
130
- @handleChange="getStaffList"
131
- ref="staffTree"
132
- :treeList="staffTree"
133
- :showCheckbox="true"
134
- :checkStrictly="true"
135
- :autoExpandParent="true"
136
- :isSingleSelect="true"
137
- ></organizeTree>
129
+ <div class="tree-scroll-force">
130
+ <organizeTree
131
+ @handleChange="getStaffList"
132
+ ref="staffTree"
133
+ :treeList="staffTree"
134
+ :showCheckbox="true"
135
+ :checkStrictly="true"
136
+ :autoExpandParent="true"
137
+ :isSingleSelect="true"
138
+ ></organizeTree>
139
+ </div>
138
140
  </div>
139
141
  </div>
140
142
 
@@ -1573,81 +1575,195 @@ export default {
1573
1575
  }
1574
1576
  }
1575
1577
  }
1578
+
1576
1579
  .staff-left-right-layout {
1577
1580
  display: flex;
1578
- height: 600px;
1581
+ height: 550px !important;
1579
1582
  gap: 15px;
1580
1583
  padding: 0 5px;
1581
1584
  width: 100%;
1582
1585
  box-sizing: border-box;
1583
-
1584
- .staff-left-panel {
1585
- min-width: 300px;
1586
- max-width: 350px;
1587
- width: 320px;
1588
- display: flex;
1589
- flex-direction: column;
1590
- box-sizing: border-box;
1591
- flex-shrink: 0;
1592
-
1593
- .panel-title {
1594
- font-weight: 600;
1595
- font-size: 15px;
1596
- color: #1f2937;
1597
- margin-bottom: 10px;
1598
- height: 28px;
1599
- display: flex;
1600
- align-items: center;
1601
- position: relative;
1602
- padding-left: 18px; // 内边距同步加宽2px,保持视觉平衡
1603
- // 调整竖线宽度为6px,更醒目且仍符合整体简约风格
1586
+ flex-wrap: nowrap !important;
1587
+
1588
+ & > .staff-left-panel {
1589
+ width: 320px !important;
1590
+ min-width: 320px !important;
1591
+ max-width: 320px !important;
1592
+ display: flex !important;
1593
+ flex-direction: column !important;
1594
+ box-sizing: border-box !important;
1595
+ flex-shrink: 0 !important;
1596
+ flex-grow: 0 !important;
1597
+ height: 100% !important;
1598
+ position: relative !important; // 确保子元素 z-index 生效
1599
+
1600
+ ::v-deep(.panel-title) {
1601
+ all: unset !important;
1602
+ display: flex !important; // 改为flex,方便对齐竖条和文字
1603
+ align-items: center !important; // 文字垂直居中
1604
+ visibility: visible !important;
1605
+ opacity: 1 !important;
1606
+ height: 20px !important;
1607
+ line-height: 20px !important;
1608
+ font-size: 14px !important;
1609
+ font-weight: 500 !important;
1610
+ color: #333 !important;
1611
+ margin-bottom: 8px !important;
1612
+ background: #fff !important;
1613
+ z-index: 999 !important;
1614
+ padding: 0 !important;
1615
+ box-sizing: border-box !important;
1616
+ position: relative !important;
1617
+ width: 100% !important;
1618
+ // 左侧竖条核心样式
1604
1619
  &::before {
1605
- content: '';
1606
- position: absolute;
1607
- left: 0;
1608
- top: 50%;
1609
- transform: translateY(-50%);
1610
- width: 6px; // 从3px调整为6px,加宽竖线
1611
- height: 18px; // 高度同步微调至18px,比例更协调
1612
- background-color: var(--primary-color);
1613
- border-radius: 3px; // 圆角保持3px,视觉更柔和
1620
+ content: '' !important;
1621
+ display: inline-block !important;
1622
+ width: 5px !important; // 竖条宽度
1623
+ height: 16px !important; // 竖条高度(略小于文字行高)
1624
+ background-color: #1890ff !important; // 蓝色竖条(可改颜色)
1625
+ margin-right: 8px !important; // 竖条与文字间距
1626
+ //border-radius: 1.5px !important;
1614
1627
  }
1615
1628
  }
1616
1629
 
1617
1630
  .staff-org-tree {
1618
- height: calc(100% - 38px) !important; // 对应title高度+margin-bottom调整
1619
- overflow: auto;
1631
+ height: calc(100% - 28px) !important; /* 28 = 标题高度20 + 间距8 */
1620
1632
  border: 1px solid #EAECF0;
1621
1633
  border-radius: 4px;
1622
- padding: 8px;
1634
+ padding: 0 !important;
1623
1635
  box-sizing: border-box;
1624
- // 保持原有树节点样式
1625
- /deep/ .ivu-tree-node-content {
1626
- white-space: normal !important;
1627
- line-height: 1.4;
1628
- padding: 4px 0;
1629
- }
1630
- /deep/ .ivu-tree-node {
1631
- padding-left: 4px !important;
1636
+ width: 100% !important;
1637
+ overflow-x: auto !important;
1638
+ overflow-y: auto !important;
1639
+ position: relative;
1640
+ flex-shrink: 1;
1641
+ min-height: 0 !important;
1642
+
1643
+ &::-webkit-scrollbar {
1644
+ width: 8px !important;
1645
+ height: 8px !important;
1646
+ background: #f9f9f9 !important;
1632
1647
  }
1633
- /deep/ .ivu-tree-child-tree {
1634
- padding-left: 16px !important;
1648
+ &::-webkit-scrollbar-thumb {
1649
+ background: #ccc !important;
1650
+ border-radius: 4px !important;
1635
1651
  }
1652
+ scrollbar-width: thin !important;
1653
+ scrollbar-color: #ccc #f9f9f9 !important;
1654
+ }
1655
+
1656
+ .tree-scroll-force {
1657
+ width: 100% !important;
1658
+ height: 100% !important;
1659
+ margin: 0 !important;
1660
+ padding: 8px !important;
1661
+ box-sizing: border-box;
1662
+ overflow: visible !important;
1663
+ position: relative;
1636
1664
  }
1637
1665
  }
1638
1666
 
1639
1667
  .staff-right-panel {
1640
1668
  flex: 1 !important;
1641
- min-width: 350px;
1669
+ min-width: 0 !important;
1642
1670
  width: calc(100% - 335px) !important;
1643
1671
  display: flex;
1644
1672
  flex-direction: column;
1645
1673
  box-sizing: border-box;
1646
- gap: 8px;
1674
+ gap: 8px; /* 搜索框与列表、列表与底部选择栏的间距统一为8px */
1647
1675
  padding: 0 5px;
1648
- flex-shrink: 0;
1676
+ flex-shrink: 1 !important;
1677
+
1678
+ // 搜索框:固定高度
1679
+ .ivu-input-wrapper {
1680
+ height: 32px;
1681
+ flex-shrink: 0;
1682
+ }
1683
+
1684
+ // 右侧人员列表容器:高度 = 父容器高度 - 搜索框高度 - 底部选择栏高度 - 两次间距(8*2)
1685
+ .staff-content {
1686
+ height: calc(100% - 32px - 40px - 16px) !important; /* 40=底部选择栏高度,16=8*2间距 */
1687
+ border: 1px solid #EAECF0;
1688
+ border-radius: 4px;
1689
+ overflow-x: hidden !important;
1690
+ overflow-y: auto !important;
1691
+ flex-shrink: 1;
1692
+
1693
+ &::-webkit-scrollbar {
1694
+ width: 8px !important;
1695
+ height: 8px !important;
1696
+ background: #f9f9f9 !important;
1697
+ }
1698
+ &::-webkit-scrollbar-thumb {
1699
+ background: #ccc !important;
1700
+ border-radius: 4px !important;
1701
+ }
1702
+ scrollbar-width: thin !important;
1703
+ scrollbar-color: #ccc #f9f9f9 !important;
1704
+ }
1705
+
1706
+ // 底部选择栏:固定高度
1707
+ .bottom-select {
1708
+ height: 40px;
1709
+ flex-shrink: 0;
1710
+ display: flex;
1711
+ align-items: center;
1712
+ justify-content: space-between;
1713
+ padding: 8px 0;
1714
+ background: #fff !important;
1715
+ border-top: 1px solid #f0f0f0;
1649
1716
 
1650
- // 其他右侧样式保持不变...
1717
+ .num {
1718
+ color: var(--primary-color);
1719
+ }
1720
+ }
1721
+ }
1722
+ }
1723
+
1724
+ .tab-content-pro {
1725
+ .tab {
1726
+ .tree {
1727
+ height: 400px !important;
1728
+ max-height: 400px !important;
1729
+ margin-top:20px;
1730
+ overflow-y: auto !important;
1731
+ overflow-x: auto !important;
1732
+ border: 1px solid #EAECF0;
1733
+ border-radius: 4px;
1734
+ box-sizing: border-box;
1735
+
1736
+ &::-webkit-scrollbar {
1737
+ width: 8px !important;
1738
+ height: 8px !important;
1739
+ display: block !important;
1740
+ background: #f9f9f9 !important;
1741
+ }
1742
+ &::-webkit-scrollbar-thumb {
1743
+ background: #ccc !important;
1744
+ border-radius: 4px !important;
1745
+ }
1746
+ }
1747
+
1748
+ &.post .right .tree {
1749
+ height: 380px !important;
1750
+ max-height: 380px !important;
1751
+ }
1752
+
1753
+ .bottom-select {
1754
+ display:flex;
1755
+ align-items: center;
1756
+ justify-content: space-between;
1757
+ margin-top:15px !important;
1758
+ padding: 8px 0;
1759
+ background: #fff !important;
1760
+ position: relative;
1761
+ z-index: 10;
1762
+ border-top: 1px solid #f0f0f0;
1763
+ .num{
1764
+ color:var(--primary-color);
1765
+ }
1766
+ }
1651
1767
  }
1652
1768
  }
1653
1769
 
@@ -1852,9 +1968,30 @@ export default {
1852
1968
  display:flex;
1853
1969
  align-items: center;
1854
1970
  }
1855
- .tree{
1856
- height:450px;
1971
+ .tree {
1972
+ height: 400px !important; // 从450px下调,预留下方复选框空间
1973
+ max-height: 400px !important; // 强制最大高度,禁止超出
1857
1974
  margin-top:20px;
1975
+ overflow-y: auto !important; // 纵向溢出时滚动,而非超出
1976
+ overflow-x: auto !important; // 横向溢出时滚动
1977
+ border: 1px solid #EAECF0; // 明确容器边界(可选)
1978
+ border-radius: 4px;
1979
+ box-sizing: border-box; // 包含边框/内边距计算
1980
+ // 滚动条样式统一(与人员Tab保持一致)
1981
+ &::-webkit-scrollbar {
1982
+ width: 8px !important;
1983
+ height: 8px !important;
1984
+ display: block !important;
1985
+ background: #f9f9f9 !important;
1986
+ }
1987
+ &::-webkit-scrollbar-thumb {
1988
+ background: #ccc !important;
1989
+ border-radius: 4px !important;
1990
+ }
1991
+ }
1992
+ &.post .right .tree {
1993
+ height: 380px !important;
1994
+ max-height: 380px !important;
1858
1995
  }
1859
1996
  .staff-content{
1860
1997
  overflow:auto;
@@ -1863,7 +2000,12 @@ export default {
1863
2000
  display:flex;
1864
2001
  align-items: center;
1865
2002
  justify-content: space-between;
1866
- margin-top:20px;
2003
+ margin-top:15px !important; // 增加间距
2004
+ padding: 8px 0; // 内边距提升可读性
2005
+ background: #fff !important; // 白色背景覆盖树溢出内容
2006
+ position: relative;
2007
+ z-index: 10; // 层级高于树容器
2008
+ border-top: 1px solid #f0f0f0; // 视觉分隔(可选)
1867
2009
  .num{
1868
2010
  color:var(--primary-color);
1869
2011
  }
@@ -1,16 +1,18 @@
1
1
  <template>
2
2
  <div class="content">
3
3
  <Spin fix v-if="loading"></Spin>
4
- <Tree
5
- :data="data"
6
- ref="tree"
7
- :load-data="loadData"
8
- :render="renderContent"
9
- multiple
10
- :check-strictly="true"
11
- :cascade-check="false"
12
- @on-select-change="handleChange"
13
- ></Tree>
4
+ <div class="tree-inner">
5
+ <Tree
6
+ :data="data"
7
+ ref="tree"
8
+ :load-data="loadData"
9
+ :render="renderContent"
10
+ multiple
11
+ :check-strictly="true"
12
+ :cascade-check="false"
13
+ @on-select-change="handleChange"
14
+ ></Tree>
15
+ </div>
14
16
  </div>
15
17
  </template>
16
18
 
@@ -50,7 +52,14 @@ export default {
50
52
  this.data = data;
51
53
  },
52
54
 
55
+ // 树组件内的 handleChange 方法修改(仅保留核心逻辑,移除冗余触发)
53
56
  handleChange(data) {
57
+ // 仅处理复选框触发的选中数据,过滤空数据
58
+ if (!data || (Array.isArray(data) && data.length === 0)) {
59
+ this.$emit('handleChange', []);
60
+ return;
61
+ }
62
+
54
63
  let checkedData = Array.isArray(data)
55
64
  ? data.filter(item => item.checked)
56
65
  : (data.checked ? [data] : []);
@@ -63,6 +72,7 @@ export default {
63
72
  }
64
73
 
65
74
  this.syncAllNodeCheckedState(checkedData);
75
+ // 仅当有有效选中节点时才触发父组件事件
66
76
  this.$emit('handleChange', checkedData);
67
77
  },
68
78
  clearOtherCheckedNodes(keepIds) {
@@ -292,7 +302,18 @@ export default {
292
302
  overflow: 'hidden',
293
303
  display: 'flex',
294
304
  alignItems: 'center',
295
- cursor: 'pointer'
305
+ cursor: 'default' // 文本区域鼠标指针改为默认
306
+ },
307
+ // 阻断整个节点容器的点击事件(仅复选框除外)
308
+ on: {
309
+ click: (e) => {
310
+ // 仅当点击复选框时放行,其他区域阻断
311
+ const isCheckbox = e.target.closest('.ivu-checkbox') || e.target.closest('.ivu-checkbox-icon');
312
+ if (!isCheckbox) {
313
+ e.stopPropagation();
314
+ e.preventDefault();
315
+ }
316
+ }
296
317
  }
297
318
  }, [
298
319
  h('Checkbox', {
@@ -302,7 +323,8 @@ export default {
302
323
  indeterminate: false
303
324
  },
304
325
  style: {
305
- marginRight: '8px'
326
+ marginRight: '8px',
327
+ cursor: 'pointer' // 复选框保留点击指针
306
328
  },
307
329
  on: {
308
330
  'on-change': (checked) => {
@@ -324,10 +346,21 @@ export default {
324
346
  }),
325
347
  h('img', {
326
348
  attrs: { src: require('./assets/icon.png') },
327
- style: { marginRight: '8px', width: '14px', height: '14px' }
349
+ style: {
350
+ marginRight: '8px',
351
+ width: '14px',
352
+ height: '14px',
353
+ pointerEvents: 'none' // 图标禁用点击
354
+ }
328
355
  }),
329
356
  h('span', {
330
- style: { overflow: 'hidden', textOverflow: 'ellipsis', flex: 1 }
357
+ style: {
358
+ // overflow: 'hidden',
359
+ // textOverflow: 'ellipsis',
360
+ flex: 1,
361
+ pointerEvents: 'none', // 文本完全禁用点击
362
+ userSelect: 'none' // 禁止文本选中
363
+ }
331
364
  }, data.title)
332
365
  ]);
333
366
  },
@@ -378,11 +411,50 @@ export default {
378
411
 
379
412
  <style lang="less" scoped>
380
413
  .content {
381
- width: 100%;
382
- height: 100%;
383
- overflow: auto;
414
+ width: 100% !important;
415
+ height: 100% !important;
416
+ overflow: visible !important; /* 完全放开溢出限制 */
417
+ box-sizing: border-box;
384
418
  }
385
419
 
420
+ /* 子组件内层容器强制宽度自适应 */
421
+ .tree-inner {
422
+ width: fit-content !important;
423
+ min-width: 100% !important;
424
+ height: 100% !important;
425
+ white-space: nowrap !important;
426
+ overflow: visible !important;
427
+ }
428
+
429
+ /deep/ .ivu-tree-node {
430
+ white-space: nowrap !important;
431
+ width: auto !important;
432
+ min-width: 100% !important;
433
+ box-sizing: border-box;
434
+ }
435
+
436
+ /deep/ .ivu-tree-node-content {
437
+ cursor: default !important;
438
+ pointer-events: none !important;
439
+ padding-left: 0 !important;
440
+ width: 100% !important; /* 关键:节点内容宽度100% */
441
+
442
+ .ivu-checkbox, .ivu-tree-switcher {
443
+ pointer-events: auto !important;
444
+ cursor: pointer !important;
445
+ }
446
+ }
447
+
448
+ /deep/ .ivu-tree {
449
+ white-space: nowrap !important;
450
+ display: inline-block !important;
451
+ width: auto !important;
452
+ min-width: 100% !important;
453
+ box-sizing: border-box;
454
+ height: 100% !important; /* 关键:树组件高度100% */
455
+ }
456
+
457
+
386
458
  /deep/ .ivu-tree-node,
387
459
  /deep/ .ivu-tree-node *,
388
460
  /deep/ .ivu-tree-node-content,
@@ -410,8 +482,13 @@ export default {
410
482
  padding-left: 0 !important;
411
483
  }
412
484
 
485
+ /deep/ .ivu-tree::-webkit-scrollbar {
486
+ display: block !important;
487
+ }
488
+
413
489
  /deep/ .ivu-tree-indent {
414
490
  margin-right: 4px;
491
+ display: inline-block !important;
415
492
  }
416
493
 
417
494
  /deep/ .ivu-tree-node::before,