vsyswin-ui 0.2.85 → 0.2.87

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": "vsyswin-ui",
3
- "version": "0.2.85",
3
+ "version": "0.2.87",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
@@ -389,7 +389,6 @@
389
389
  import _ from 'lodash'
390
390
  import moment from 'moment'
391
391
  import saveLocal from './save-local'
392
- import XEUtils from 'xe-utils'
393
392
 
394
393
  function deepCopyFunction(arr1, arr2) {
395
394
  for (let i = 0; i < arr1.length; i++) {
@@ -405,6 +404,31 @@ function deepCopyFunction(arr1, arr2) {
405
404
  }
406
405
  }
407
406
  }
407
+ function findTree(allData, fn) {
408
+ function loopFn(arr, pNode) {
409
+ for (let i = 0; i < arr.length; i++) {
410
+ // debugger
411
+ let result = null
412
+ const item = arr[i]
413
+ item.nodes = [item]
414
+ if (pNode) {
415
+ item.nodes = [...pNode.nodes, item]
416
+ }
417
+ // findTree(item.options, tItem => tItem.value === lastValue)
418
+ const flag = fn(item)
419
+ if (flag) {
420
+ result = item
421
+ if (result) return result
422
+ }
423
+ if (item.children) {
424
+ result = loopFn(item.children, item)
425
+ }
426
+ if (result) return result
427
+ }
428
+ }
429
+ const res = loopFn(allData)
430
+ return res
431
+ }
408
432
 
409
433
  export default {
410
434
  name: 'SySearchbar',
@@ -630,14 +654,14 @@ export default {
630
654
  const valueOptions = item.value.map((x) => {
631
655
  // console.log('xxxxxxxxxxxxx', x) // 这里的x是个数组
632
656
  const lastValue = x[x.length - 1]
633
- const find = XEUtils.findTree(item.options, tItem => tItem.value === lastValue)
657
+ const find = findTree(item.options, tItem => tItem.value === lastValue)
634
658
  return find
635
659
  })
636
660
  obj.name = valueOptions.map((x) => x.nodes.map(y => y.label).join('/')).join(',')
637
661
  } else {
638
662
  const lastValue = item.value[item.value.length - 1]
639
- const find = XEUtils.findTree(item.options, tItem => tItem.value === lastValue)
640
- obj.name = find.nodes.map(y => y.label).join('/')
663
+ const find = findTree(item.options, tItem => tItem.value === lastValue)
664
+ obj.name = find ? find.nodes.map(y => y.label).join('/') : ''
641
665
  }
642
666
  } else if (item.type === 'slot') {
643
667
  if (!item.getValue) return