vsyswin-ui 0.2.88 → 0.2.90
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/lib/vsyswin-ui.common.js +17011 -16776
- package/lib/vsyswin-ui.common.js.map +1 -1
- package/lib/vsyswin-ui.umd.js +17011 -16776
- package/lib/vsyswin-ui.umd.js.map +1 -1
- package/lib/vsyswin-ui.umd.min.js +31 -31
- package/lib/vsyswin-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/packages/search-bar/src/search-bar.vue +81 -0
package/package.json
CHANGED
|
@@ -123,6 +123,12 @@
|
|
|
123
123
|
<el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
|
|
124
124
|
</el-select>
|
|
125
125
|
</template>
|
|
126
|
+
<template v-else-if="item.type === 'cascade'">
|
|
127
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
128
|
+
<el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
|
|
129
|
+
width: item.width ? item.width : '200px'
|
|
130
|
+
}" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index)"></el-cascader>
|
|
131
|
+
</template>
|
|
126
132
|
<template v-else-if="item.type === 'slot'">
|
|
127
133
|
<slot :name="item.slot" :item="item">内容为空</slot>
|
|
128
134
|
</template>
|
|
@@ -230,6 +236,12 @@
|
|
|
230
236
|
<el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
|
|
231
237
|
</el-select>
|
|
232
238
|
</template>
|
|
239
|
+
<template v-else-if="item.type === 'cascade'">
|
|
240
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
241
|
+
<el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
|
|
242
|
+
width: item.width ? item.width : '200px'
|
|
243
|
+
}" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index)"></el-cascader>
|
|
244
|
+
</template>
|
|
233
245
|
<template v-else-if="item.type === 'slot'">
|
|
234
246
|
<slot :name="item.slot" :item="item">内容为空</slot>
|
|
235
247
|
</template>
|
|
@@ -324,6 +336,12 @@
|
|
|
324
336
|
<el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
|
|
325
337
|
</el-select>
|
|
326
338
|
</template>
|
|
339
|
+
<template v-else-if="item.type === 'cascade'">
|
|
340
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
341
|
+
<el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
|
|
342
|
+
width: item.width ? item.width : '200px'
|
|
343
|
+
}" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index + maxConditionLength)"></el-cascader>
|
|
344
|
+
</template>
|
|
327
345
|
<template v-else-if="item.type === 'slot'">
|
|
328
346
|
<slot :name="item.slot" :item="item">内容为空</slot>
|
|
329
347
|
</template>
|
|
@@ -386,6 +404,31 @@ function deepCopyFunction(arr1, arr2) {
|
|
|
386
404
|
}
|
|
387
405
|
}
|
|
388
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
|
+
}
|
|
389
432
|
|
|
390
433
|
export default {
|
|
391
434
|
name: 'SySearchbar',
|
|
@@ -601,6 +644,25 @@ export default {
|
|
|
601
644
|
} else {
|
|
602
645
|
obj.name = item.options.find((x) => x.value === item.value).label
|
|
603
646
|
}
|
|
647
|
+
} else if (item.type === 'cascade') {
|
|
648
|
+
if (!item.value) return
|
|
649
|
+
if (item.multiple) {
|
|
650
|
+
if (!item.value.length) {
|
|
651
|
+
return
|
|
652
|
+
}
|
|
653
|
+
// const valueOptions = item.value.map((x) => item.options.find((f) => f.value === x))
|
|
654
|
+
const valueOptions = item.value.map((x) => {
|
|
655
|
+
// console.log('xxxxxxxxxxxxx', x) // 这里的x是个数组
|
|
656
|
+
const lastValue = x[x.length - 1]
|
|
657
|
+
const find = findTree(item.options, tItem => tItem.value === lastValue)
|
|
658
|
+
return find
|
|
659
|
+
})
|
|
660
|
+
obj.name = valueOptions.map((x) => x.nodes.map(y => y.label).join('/')).join(',')
|
|
661
|
+
} else {
|
|
662
|
+
const lastValue = item.value[item.value.length - 1]
|
|
663
|
+
const find = findTree(item.options, tItem => tItem.value === lastValue)
|
|
664
|
+
obj.name = find ? find.nodes.map(y => y.label).join('/') : ''
|
|
665
|
+
}
|
|
604
666
|
} else if (item.type === 'slot') {
|
|
605
667
|
if (!item.getValue) return
|
|
606
668
|
const info = item.getValue() // 这里不能直接调,因为是深拷贝过来的
|
|
@@ -687,6 +749,9 @@ export default {
|
|
|
687
749
|
if (item.type === 'select') {
|
|
688
750
|
item.value = item.multiple ? [] : null
|
|
689
751
|
}
|
|
752
|
+
if (item.type === 'cascade') {
|
|
753
|
+
item.value = item.multiple ? [] : null
|
|
754
|
+
}
|
|
690
755
|
if (item.type === 'slot') {
|
|
691
756
|
item.setValue({ name: '', value: '' })
|
|
692
757
|
}
|
|
@@ -719,6 +784,9 @@ export default {
|
|
|
719
784
|
if (item.type === 'select') {
|
|
720
785
|
item.value = item.multiple ? [] : null
|
|
721
786
|
}
|
|
787
|
+
if (item.type === 'cascade') {
|
|
788
|
+
item.value = item.multiple ? [] : null
|
|
789
|
+
}
|
|
722
790
|
if (item.type === 'slot') {
|
|
723
791
|
item.setValue({ name: '', value: '' })
|
|
724
792
|
}
|
|
@@ -758,6 +826,13 @@ export default {
|
|
|
758
826
|
item.value = null
|
|
759
827
|
}
|
|
760
828
|
}
|
|
829
|
+
if (item.type === 'cascade') {
|
|
830
|
+
if (item.multiple) {
|
|
831
|
+
item.value = []
|
|
832
|
+
} else {
|
|
833
|
+
item.value = null
|
|
834
|
+
}
|
|
835
|
+
}
|
|
761
836
|
item.type === 'slot' && item.setValue({ value: '', name: '' })
|
|
762
837
|
})
|
|
763
838
|
})
|
|
@@ -840,6 +915,9 @@ export default {
|
|
|
840
915
|
if (item.type === 'select') {
|
|
841
916
|
item.value = item.multiple ? [] : null
|
|
842
917
|
}
|
|
918
|
+
if (item.type === 'cascade') {
|
|
919
|
+
item.value = item.multiple ? [] : null
|
|
920
|
+
}
|
|
843
921
|
}
|
|
844
922
|
})
|
|
845
923
|
this.$set(this.currentSearchList, parentIndex, parentItem)
|
|
@@ -920,6 +998,9 @@ export default {
|
|
|
920
998
|
v.value = ele.value
|
|
921
999
|
}
|
|
922
1000
|
if (ele.value) v.isActive = true
|
|
1001
|
+
} else if (v.type === 'cascade') {
|
|
1002
|
+
v.value = ele.value
|
|
1003
|
+
if (ele.value) v.isActive = true
|
|
923
1004
|
} else if (v.type === 'month' || v.type === 'year') {
|
|
924
1005
|
v.value = ele.value
|
|
925
1006
|
if (ele.value) v.isActive = true
|