@sy-common/organize-select-help 1.0.0-beta.6 → 1.0.0-beta.63

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.
@@ -1,158 +1,627 @@
1
1
  <template>
2
2
  <div class="content">
3
3
  <Spin fix v-if="loading"></Spin>
4
- <Tree :data="data" ref="tree" :load-data="loadData" :render="renderContent" check-directly
5
- @on-select-change ="handleChange" multiple></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>
6
16
  </div>
7
17
  </template>
18
+
8
19
  <script>
9
- import ajax from '@lambo-design/shared/utils/ajax'
20
+ import { deepCopy } from '@lambo-design/core/src/utils/assist';
21
+ import ajax from '@lambo-design/shared/utils/ajax';
22
+
10
23
  export default {
11
- props:{
12
- disabled:{
24
+ props: {
25
+ disabled: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ treeList: {
30
+ type: Array,
31
+ default: () => []
32
+ },
33
+ isSingleSelect: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ // 新增1:接收父组件的 defaultOrgUnitId(自定义根节点ID)
38
+ defaultOrgUnitId: {
39
+ type: String,
40
+ default: ''
41
+ },
42
+ // 新增2:标记是否使用父组件构建的自定义树(禁用子组件自身的接口调用)
43
+ isCustomTree: {
44
+ type: Boolean,
45
+ default: false
46
+ },
47
+ // 新增3:禁用懒加载(避免触发子组件的旧接口)
48
+ disableLazyLoad: {
13
49
  type: Boolean,
14
50
  default: false
15
51
  }
16
52
  },
17
- data(){
53
+ data() {
18
54
  return {
19
- data:[],
20
- manageUnitId:'',
21
- loading:true
22
- }
55
+ data: [],
56
+ manageUnitId: '',
57
+ loading: true
58
+ };
23
59
  },
24
60
  mounted() {
25
- this.initData()
61
+ this.initData();
26
62
  },
27
- methods:{
28
- async initData(){
29
- let data = await this.getOrgChildren()
30
- this.loading = false
63
+ methods: {
64
+ safeDeepCopy(obj, hash = new WeakMap()) {
65
+ if (obj === null || typeof obj !== 'object') {
66
+ return obj;
67
+ }
68
+
69
+ // 检测循环引用,返回核心业务字段
70
+ if (hash.has(obj)) {
71
+ const safeObj = {
72
+ orgUnitId: obj.orgUnitId,
73
+ orgNodeName: obj.orgNodeName || obj.name || `未命名组织(${obj.orgUnitId || 'unknown'})`,
74
+ orgUnitName: obj.orgUnitName || obj.orgNodeName || obj.name || `未命名组织(${obj.orgUnitId || 'unknown'})`,
75
+ parentOrgUnitId: obj.parentOrgUnitId || obj.parentId || null
76
+ };
77
+ hash.set(obj, safeObj);
78
+ return safeObj;
79
+ }
80
+
81
+ let copy;
82
+ if (obj instanceof Array) {
83
+ copy = [];
84
+ hash.set(obj, copy);
85
+ for (let i = 0; i < obj.length; i++) {
86
+ copy[i] = this.safeDeepCopy(obj[i], hash);
87
+ }
88
+ } else if (obj instanceof Object) {
89
+ copy = {};
90
+ hash.set(obj, copy);
91
+ for (let key in obj) {
92
+ if (obj.hasOwnProperty(key)) {
93
+ // 过滤Vue内部无效字段,保留业务字段
94
+ if (['__vue__', '__ob__', '$parent', '$children'].includes(key)) {
95
+ continue;
96
+ }
97
+ // 子节点数组特殊处理
98
+ if (['orgChildrenList', 'children'].includes(key) && Array.isArray(obj[key])) {
99
+ copy[key] = obj[key].map(child => this.safeDeepCopy(child, hash));
100
+ } else {
101
+ copy[key] = this.safeDeepCopy(obj[key], hash);
102
+ }
103
+ }
104
+ }
105
+ } else {
106
+ copy = obj;
107
+ }
108
+ return copy;
109
+ },
110
+ async initData() {
111
+ if (this.isCustomTree) {
112
+ this.loading = false;
113
+ let tree = deepCopy(this.treeList);
114
+ this.initTree(tree);
115
+ this.data = tree;
116
+ return;
117
+ }
118
+ // 仅在非自定义树场景下生效
119
+ let data = await this.getOrgChildren();
120
+ this.loading = false;
31
121
  this.data = data;
32
122
  },
33
- handleChange(data){
34
- this.$emit('handleChange',data)
123
+
124
+ handleChange(data) {
125
+ // 仅处理复选框触发的选中数据,过滤空数据
126
+ if (!data || (Array.isArray(data) && data.length === 0)) {
127
+ this.$emit('handleChange', []);
128
+ return;
129
+ }
130
+
131
+ let checkedData = Array.isArray(data)
132
+ ? data.filter(item => item.checked)
133
+ : (data.checked ? [data] : []);
134
+
135
+ // 单选逻辑:仅保留最后一个选中的节点
136
+ if (this.isSingleSelect) {
137
+ checkedData = checkedData.length > 0 ? [checkedData[checkedData.length - 1]] : [];
138
+ // 清空其他节点的选中状态
139
+ this.clearOtherCheckedNodes(checkedData.map(item => item.orgUnitId));
140
+ }
141
+
142
+ this.syncAllNodeCheckedState(checkedData);
143
+ // 仅当有有效选中节点时才触发父组件事件
144
+ this.$emit('handleChange', checkedData);
35
145
  },
36
- async loadData(item, callback){
37
- // 模拟异步获取数据
38
- let children = await this.getOrgChildren(item.orgUnitId)
39
- callback(children); // 调用callback传入子节点数据
146
+ clearOtherCheckedNodes(keepIds) {
147
+ if (!Array.isArray(this.data) || !Array.isArray(keepIds)) return;
148
+
149
+ const clearNodeState = (nodeList) => {
150
+ nodeList.forEach(node => {
151
+ if (!keepIds.includes(node.orgUnitId) && node.checked) {
152
+ this.$set(node, 'checked', false);
153
+ }
154
+ // 递归处理子节点(单选时也需要清空子节点的选中状态)
155
+ const childNodes = node.children || node.orgChildrenList || [];
156
+ if (childNodes.length) {
157
+ clearNodeState(childNodes);
158
+ }
159
+ });
160
+ };
161
+
162
+ clearNodeState(this.data);
40
163
  },
41
- checkNode(data){
42
- // console.log(data,'data')
164
+
165
+ syncAllNodeCheckedState(checkedData) {
166
+ if (!Array.isArray(this.data) || !Array.isArray(checkedData)) return;
167
+
168
+ const checkedIds = checkedData.map(item => item.orgUnitId);
169
+ const updateNodeState = (nodeList) => {
170
+ nodeList.forEach(node => {
171
+ // 仅更新当前节点,跳过子节点
172
+ const shouldBeChecked = checkedIds.includes(node.orgUnitId);
173
+ if (node.checked !== shouldBeChecked) {
174
+ this.$set(node, 'checked', shouldBeChecked);
175
+ }
176
+ });
177
+ };
178
+ updateNodeState(this.data);
43
179
  },
44
- getOrgChildren(orgUnitId){
45
- return new Promise((resolve,reject)=>{
46
- ajax.get('/pub-manage-server/pub/personHelpBox/q/getOrgUnitList', { params:{
47
- containsCurLevel:true,
48
- orgUnitId:orgUnitId,
180
+
181
+ async loadData(item, callback) {
182
+ // 自定义树场景(defaultOrgUnitId 不为空):原有逻辑不变
183
+ if (this.isCustomTree) {
184
+ let children = item.orgChildrenList || item.children || [];
185
+ const formattedChildren = this.safeDeepCopy(children).map(child => ({
186
+ ...child,
187
+ title: child.orgUnitName || child.orgNodeName || child.name || `未命名组织(${child.orgUnitId || child.id || ''})`,
188
+ checked: false,
189
+ expand: false,
190
+ leafNode: child.leafNode || false,
191
+ orgChildrenList: child.orgChildrenList || [],
192
+ children: child.children || []
193
+ }));
194
+ if (formattedChildren.length === 0 && item.orgUnitId) {
195
+ try {
196
+ const res = await ajax.get('/pub-manage-server/pub/personHelpBox/q/getOrgUnitList', {
197
+ params: {
198
+ containsCurLevel: true,
199
+ orgUnitId: item.orgUnitId
200
+ }
201
+ });
202
+ if (res.data.code === 1) {
203
+ const apiChildren = res.data.data || [];
204
+ // 关键:对接口返回的二级节点进行 initTree 初始化
205
+ const initializedApiChildren = this.initTree(apiChildren);
206
+ const apiFormattedChildren = initializedApiChildren.map(child => ({
207
+ ...child,
208
+ title: child.orgUnitName || child.orgNodeName || child.name || `未命名组织(${child.orgUnitId || ''})`,
209
+ checked: false,
210
+ expand: false,
211
+ leafNode: child.leafNode || false,
212
+ orgChildrenList: [],
213
+ children: []
214
+ }));
215
+ item.orgChildrenList = apiFormattedChildren;
216
+ item.children = apiFormattedChildren;
217
+ callback(apiFormattedChildren);
218
+ return;
219
+ }
220
+ } catch (e) {
221
+ console.error("加载自定义树子节点失败:", e);
49
222
  }
50
- }).then((res)=>{
51
- if(res.data.code === 1){
52
- let treeList = res.data.data
53
- this.initTree(treeList)
54
- resolve(treeList)
55
- }else{
56
- resolve([])
223
+ }
224
+ callback(formattedChildren);
225
+ return;
226
+ }
227
+
228
+ // 非自定义树场景(defaultOrgUnitId 为空):补充子节点初始化
229
+ if (this.disableLazyLoad) {
230
+ callback([]);
231
+ return;
232
+ }
233
+ // 加载子节点后,先经过 initTree 处理再返回
234
+ let children = await this.getOrgChildren(item.orgUnitId);
235
+ const initializedChildren = this.initTree(children);
236
+ callback(initializedChildren);
237
+ },
238
+
239
+ getOrgChildren(orgUnitId = '') {
240
+ if (this.isCustomTree) {
241
+ return Promise.resolve([]);
242
+ }
243
+ return new Promise((resolve, reject) => {
244
+ ajax.get('/pub-manage-server/pub/personHelpBox/q/getOrgUnitList', {
245
+ params: {
246
+ containsCurLevel: true,
247
+ orgUnitId: orgUnitId
57
248
  }
58
- }).catch(err=>{
59
- console.log(err)
60
- })
61
- })
62
- },
63
- initTree(treeList){
64
- const defineTree = function(list){
65
- if(!list)return
66
- list.forEach((item) => {
67
- item.title=item.orgNodeName;
68
- item.loading = false;
69
- item.children = [];
70
- item.expand = false;
71
- item.checked = false;
72
- if(item.leafNode){
73
- delete item.loading;
74
- delete item.children;
249
+ }).then((res) => {
250
+ if (res.data.code === 1) {
251
+ let treeList = res.data.data || [];
252
+ // 关键修改:调用重构后的 initTree,递归初始化所有层级节点
253
+ const initializedTree = this.initTree(treeList);
254
+ resolve(initializedTree);
255
+ } else {
256
+ resolve([]);
75
257
  }
76
- })
77
- return list
258
+ }).catch(err => {
259
+ console.log(err);
260
+ resolve([]);
261
+ });
262
+ });
263
+ },
264
+
265
+ setCheckedNodes(targets) {
266
+ if (!this.$refs.tree || !Array.isArray(targets)) {
267
+ this.clearAllChecked(this.data);
268
+ this.$emit('handleChange', []);
269
+ this.$nextTick(() => this.$refs.tree.$forceUpdate());
270
+ return;
78
271
  }
79
- treeList.forEach(item=>{
80
- item.title=item.orgNodeName;
81
- item.loading = false;
82
- item.children = [];
83
- item.expand = false;
84
- item.checked = false;
85
- if(item.orgChildrenList && item.orgChildrenList.length){
86
- item.children = defineTree(item.orgChildrenList);
87
- item.expand = true;
88
- }
89
- if(this.disabled){
90
- item.disabled = true;
91
- }
92
- if(item.leafNode){
93
- delete item.loading;
94
- delete item.children;
95
- }
96
- })
97
- },
98
- renderContent(h, { root, node, data }){
272
+
273
+ // 单选逻辑强化:清空所有选中状态
274
+ this.clearAllChecked(this.data);
275
+
276
+ const targetList = this.isSingleSelect
277
+ ? (targets.length > 0 ? [targets[targets.length - 1]] : [])
278
+ : targets;
279
+
280
+ // 转换为有效orgUnitId数组
281
+ const targetIds = targetList.map(item => {
282
+ if (typeof item === 'string') return item.trim();
283
+ return (item.orgUnitId || item.id || '').trim();
284
+ }).filter(id => id); // 过滤空ID
285
+
286
+ // 查找并选中目标节点
287
+ const findAndCheckNode = (treeData, targetId) => {
288
+ for (const node of treeData) {
289
+ const nodeId = (node.orgUnitId || node.id || '').trim();
290
+ if (nodeId === targetId) {
291
+ this.$set(node, 'checked', true);
292
+ this.expandToNode(node);
293
+ return true;
294
+ }
295
+ const childNodes = node.children || node.orgChildrenList || [];
296
+ if (childNodes.length && findAndCheckNode(childNodes, targetId)) {
297
+ return true;
298
+ }
299
+ }
300
+ return false;
301
+ };
302
+
303
+ targetIds.forEach(id => findAndCheckNode(this.data, id));
304
+
305
+ // 传递过滤后的有效节点
306
+ const checkedNodes = this.collectCurrentCheckedNodes(this.data);
307
+ this.$nextTick(() => {
308
+ this.$refs.tree.$forceUpdate();
309
+ this.$emit('handleChange', checkedNodes);
310
+ });
311
+ },
312
+
313
+ expandToNode(node) {
314
+ let current = node;
315
+ while (current && current.parent) {
316
+ if (typeof current.parent === 'object' && !Array.isArray(current.parent)) {
317
+ this.$set(current.parent, 'expand', true);
318
+ }
319
+ current = current.parent.orgUnitId
320
+ ? this.findNodeInTree(this.data, current.parent.orgUnitId)
321
+ : null;
322
+ }
323
+ },
324
+
325
+ collectAllCheckedNodes(nodeList) {
326
+ let checkedNodes = [];
327
+ nodeList.forEach(node => {
328
+ if (node.checked) {
329
+ checkedNodes.push(node);
330
+ }
331
+ const childNodes = node.children || node.orgChildrenList || [];
332
+ if (childNodes.length) {
333
+ checkedNodes = [...checkedNodes, ...this.collectAllCheckedNodes(childNodes)];
334
+ }
335
+ });
336
+ return checkedNodes;
337
+ },
338
+
339
+ clearAllChecked(treeData) {
340
+ if (!Array.isArray(treeData)) return;
341
+ treeData.forEach(node => {
342
+ if (node.checked) {
343
+ this.$set(node, 'checked', false);
344
+ }
345
+ const childNodes = node.children || node.orgChildrenList || [];
346
+ if (childNodes.length) {
347
+ this.clearAllChecked(childNodes);
348
+ }
349
+ });
350
+ },
351
+
352
+ updateTreeData(newTreeData) {
353
+ if (!Array.isArray(newTreeData)) return;
354
+ const tree = deepCopy(newTreeData);
355
+ this.initTree(tree);
356
+ this.data = tree;
357
+ this.$nextTick(() => {
358
+ this.$refs.tree.$forceUpdate();
359
+ });
360
+ },
361
+
362
+ findNodeInTree(treeData, targetOrgUnitId) {
363
+ if (!treeData || !targetOrgUnitId) return null;
364
+
365
+ for (const node of treeData) {
366
+ if (!node.parent && treeData !== this.data) {
367
+ node.parent = treeData;
368
+ }
369
+
370
+ if (node.orgUnitId === targetOrgUnitId) return node;
371
+
372
+ const childNodes = node.children || node.orgChildrenList || [];
373
+ if (childNodes.length) {
374
+ const childNode = this.findNodeInTree(childNodes, targetOrgUnitId);
375
+ if (childNode) return childNode;
376
+ }
377
+ }
378
+ return null;
379
+ },
380
+ // organize-tree.vue - 重构 initTree 方法,确保递归处理所有层级
381
+ initTree(treeList) {
382
+ // 递归处理节点的内部方法
383
+ const recursiveInitNode = (node) => {
384
+ // 1. 统一节点标题(优先级:orgUnitName > orgNodeName > name > 兜底)
385
+ node.title = node.orgUnitName || node.orgNodeName || node.name || `未命名组织(${node.orgUnitId || node.id || ''})`;
386
+ // 2. 初始化基础字段
387
+ node.loading = false;
388
+ node.expand = false;
389
+ node.checked = false;
390
+ // 3. 关键:无论是否有子节点,先初始化 children 空数组(让 Tree 组件识别可懒加载)
391
+ node.children = node.children || [];
392
+ // 4. 同步 orgChildrenList 和 children(双向绑定,避免字段不一致)
393
+ node.orgChildrenList = node.orgChildrenList || node.children || [];
394
+ // 5. 禁用状态处理
395
+ if (this.disabled) {
396
+ node.disabled = true;
397
+ }
398
+ // 6. 叶子节点判断:如果明确标记为 leafNode,删除 loading 和 children(禁止展开)
399
+ if (node.leafNode) {
400
+ delete node.loading;
401
+ delete node.children;
402
+ delete node.orgChildrenList;
403
+ } else {
404
+ // 7. 非叶子节点:递归处理已有子节点(确保下级节点也完成初始化)
405
+ if (Array.isArray(node.orgChildrenList) && node.orgChildrenList.length > 0) {
406
+ node.children = node.orgChildrenList.map(child => recursiveInitNode(child));
407
+ node.expand = true; // 默认展开已有子节点的节点
408
+ }
409
+ }
410
+ return node;
411
+ };
412
+
413
+ // 处理根节点列表
414
+ if (Array.isArray(treeList)) {
415
+ return treeList.map(node => recursiveInitNode(node));
416
+ }
417
+ return treeList;
418
+ },
419
+
420
+ renderContent(h, {root, node, data}) {
421
+ const nodeText = data.orgUnitName || data.title || data.orgNodeName || data.name || `未命名组织(${data.orgUnitId || data.id || ''})`;
99
422
  return h('div', {
100
423
  style: {
101
424
  width: '100%',
102
- overflow:'hidden',
103
- display:'flex',
425
+ overflow: 'hidden',
426
+ display: 'flex',
104
427
  alignItems: 'center',
428
+ cursor: 'default'
429
+ },
430
+ on: {
431
+ click: (e) => {
432
+ const isCheckbox = e.target.closest('.ivu-checkbox') || e.target.closest('.ivu-checkbox-icon');
433
+ if (!isCheckbox) {
434
+ e.stopPropagation();
435
+ e.preventDefault();
436
+ }
437
+ }
105
438
  }
106
439
  }, [
107
- h('img', {
108
- attrs: {
109
- src: require('./assets/icon.png'),
110
- },
111
- style: {
112
- marginRight: '8px',
113
- width:'14px',
114
- height:'14px',
115
- }
116
- }),
117
- h('span',{
118
- style: {
119
- overflow: 'hidden',
120
- textOverflow:'ellipsis',
121
- flex:1
122
- },
123
- on:{
124
- click:()=>{
125
- this.checkNode(data)
440
+ h('Checkbox', {
441
+ props: {
442
+ value: data.checked,
443
+ disabled: data.disabled || this.disabled,
444
+ indeterminate: false
445
+ },
446
+ style: {
447
+ marginRight: '8px',
448
+ cursor: 'pointer'
449
+ },
450
+ on: {
451
+ 'on-change': (checked) => {
452
+ this.$set(data, 'checked', checked);
453
+ if (this.isSingleSelect && checked) {
454
+ this.clearOtherCheckedNodes([data.orgUnitId]);
126
455
  }
456
+ const checkedNodes = this.isSingleSelect
457
+ ? (checked ? [data] : [])
458
+ : this.collectCurrentCheckedNodes(this.data);
459
+ this.handleChange(checkedNodes);
127
460
  }
128
- }, data.title)
461
+ }
462
+ }),
463
+ h('img', {
464
+ attrs: { src: require('./assets/icon.png') },
465
+ style: {
466
+ marginRight: '8px',
467
+ width: '14px',
468
+ height: '14px',
469
+ pointerEvents: 'none'
470
+ }
471
+ }),
472
+ h('span', {
473
+ style: {
474
+ flex: 1,
475
+ pointerEvents: 'none',
476
+ userSelect: 'none',
477
+ // 新增:防止文字溢出导致的截断(可选,解决orgUnitId显示不全问题)
478
+ whiteSpace: 'normal',
479
+ wordWrap: 'break-word'
480
+ }
481
+ }, nodeText) // 使用调整优先级后的节点文字
129
482
  ]);
130
483
  },
131
- upDataTree(){
132
- const unCheck = (list)=>{
133
- list.forEach((item)=>{
134
- this.$set(item, 'selected', false);
135
- if(item.children && item.children.length){
136
- unCheck(item.children)
484
+ collectCurrentCheckedNodes(nodeList) {
485
+ let checkedNodes = [];
486
+ nodeList.forEach(node => {
487
+ if (node.checked) {
488
+ // 强制补全orgUnitId,过滤无效节点
489
+ const nodeId = node.orgUnitId || node.id || '';
490
+ if (nodeId && typeof nodeId === 'string' && nodeId.trim()) {
491
+ const validNode = {
492
+ ...node,
493
+ orgUnitId: nodeId.trim(),
494
+ orgNodeName: node.orgNodeName || node.title || node.name || `未命名组织(${nodeId.trim()})`
495
+ };
496
+ checkedNodes.push(validNode);
137
497
  }
138
- })
139
- }
140
- unCheck(this.data)
498
+ }
499
+ // 递归处理子节点
500
+ const childNodes = node.children || node.orgChildrenList || [];
501
+ if (childNodes.length) {
502
+ checkedNodes = [...checkedNodes, ...this.collectCurrentCheckedNodes(childNodes)];
503
+ }
504
+ });
505
+ return checkedNodes;
506
+ },
507
+ upDataTree() {
508
+ const unCheck = (list) => {
509
+ list.forEach((item) => {
510
+ this.$set(item, 'checked', false);
511
+ });
512
+ };
513
+ unCheck(this.data);
141
514
  }
142
515
  },
143
- }
516
+ watch: {
517
+ 'treeList': {
518
+ handler(val) {
519
+ // 自定义树场景:直接使用父组件传递的树数据,不初始化旧接口
520
+ if (this.isCustomTree) {
521
+ let tree = deepCopy(val);
522
+ this.initTree(tree);
523
+ this.data = tree;
524
+ return;
525
+ }
526
+ // 原有逻辑
527
+ let tree = deepCopy(val);
528
+ this.initTree(tree);
529
+ this.data = tree;
530
+ },
531
+ deep: true
532
+ }
533
+ }
534
+ };
144
535
  </script>
536
+
145
537
  <style lang="less" scoped>
146
- .content{
147
- width: 100%;
148
- height: 100%;
149
- overflow: auto;
538
+ .content {
539
+ width: 100% !important;
540
+ height: 100% !important;
541
+ overflow: visible !important; /* 完全放开溢出限制 */
542
+ box-sizing: border-box;
150
543
  }
151
- /deep/.ivu-tree ul li{
152
- overflow: hidden;
544
+
545
+ /* 子组件内层容器强制宽度自适应 */
546
+ .tree-inner {
547
+ width: fit-content !important;
548
+ min-width: 100% !important;
549
+ height: 100% !important;
550
+ white-space: nowrap !important;
551
+ overflow: visible !important;
153
552
  }
154
- /deep/.ivu-tree-title{
155
- width: calc(100% - 20px);
553
+
554
+ /deep/ .ivu-tree-node {
555
+ white-space: nowrap !important;
556
+ width: auto !important;
557
+ min-width: 100% !important;
558
+ box-sizing: border-box;
156
559
  }
157
560
 
158
- </style>
561
+ /deep/ .ivu-tree-node-content {
562
+ cursor: default !important;
563
+ pointer-events: none !important;
564
+ padding-left: 0 !important;
565
+ width: 100% !important; /* 关键:节点内容宽度100% */
566
+
567
+ .ivu-checkbox, .ivu-tree-switcher {
568
+ pointer-events: auto !important;
569
+ cursor: pointer !important;
570
+ }
571
+ }
572
+
573
+ /deep/ .ivu-tree {
574
+ white-space: nowrap !important;
575
+ display: inline-block !important;
576
+ width: auto !important;
577
+ min-width: 100% !important;
578
+ box-sizing: border-box;
579
+ height: 100% !important; /* 关键:树组件高度100% */
580
+ }
581
+
582
+
583
+ /deep/ .ivu-tree-node,
584
+ /deep/ .ivu-tree-node *,
585
+ /deep/ .ivu-tree-node-content,
586
+ /deep/ .ivu-tree-title {
587
+ box-shadow: none !important;
588
+ text-shadow: none !important;
589
+ outline: none !important;
590
+ border: none !important;
591
+ background: transparent !important;
592
+ }
593
+
594
+ /deep/ .ivu-tree-node-selected,
595
+ /deep/ .ivu-tree-node-selected *,
596
+ /deep/ .ivu-tree-node-focus,
597
+ /deep/ .ivu-tree-node-focus *,
598
+ /deep/ .ivu-tree-node-hover,
599
+ /deep/ .ivu-tree-node-hover * {
600
+ box-shadow: none !important;
601
+ text-shadow: none !important;
602
+ background: transparent !important;
603
+ color: inherit !important;
604
+ }
605
+
606
+ /deep/ .ivu-tree-node-content {
607
+ padding-left: 0 !important;
608
+ }
609
+
610
+ /deep/ .ivu-tree::-webkit-scrollbar {
611
+ display: block !important;
612
+ }
613
+
614
+ /deep/ .ivu-tree-indent {
615
+ margin-right: 4px;
616
+ display: inline-block !important;
617
+ }
618
+
619
+ /deep/ .ivu-tree-node::before,
620
+ /deep/ .ivu-tree-node::after,
621
+ /deep/ .ivu-tree-title::before,
622
+ /deep/ .ivu-tree-title::after {
623
+ box-shadow: none !important;
624
+ text-shadow: none !important;
625
+ background: none !important;
626
+ }
627
+ </style>