vsyswin-ui 0.2.89 → 0.2.91
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 +56918 -61504
- package/lib/vsyswin-ui.common.js.map +1 -1
- package/lib/vsyswin-ui.umd.js +56918 -61504
- package/lib/vsyswin-ui.umd.js.map +1 -1
- package/lib/vsyswin-ui.umd.min.js +178 -178
- package/lib/vsyswin-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/packages/search-bar/src/search-bar.vue +82 -0
- package/packages/styles/common.scss +6 -0
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<div class="syswin-searchbar" v-clickoutside="handleClickOutside">
|
|
4
4
|
<div class="syswin-searchbar-container">
|
|
5
5
|
<el-input class="syswin-searchbar-container__input" v-model="keyword" :placeholder="placeholder" clearable size="small" @clear="handleClearInput">
|
|
6
|
+
<slot slot="prepend" name="prepend"></slot>
|
|
6
7
|
<slot slot="suffix" name="suffix"></slot>
|
|
7
8
|
</el-input>
|
|
8
9
|
<el-button v-if="showFilter" type="text" size="small" class="syswin-searchbar-container__filter" @click="handleToggleFilterList">
|
|
@@ -123,6 +124,12 @@
|
|
|
123
124
|
<el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
|
|
124
125
|
</el-select>
|
|
125
126
|
</template>
|
|
127
|
+
<template v-else-if="item.type === 'cascade'">
|
|
128
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
129
|
+
<el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
|
|
130
|
+
width: item.width ? item.width : '200px'
|
|
131
|
+
}" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index)"></el-cascader>
|
|
132
|
+
</template>
|
|
126
133
|
<template v-else-if="item.type === 'slot'">
|
|
127
134
|
<slot :name="item.slot" :item="item">内容为空</slot>
|
|
128
135
|
</template>
|
|
@@ -230,6 +237,12 @@
|
|
|
230
237
|
<el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
|
|
231
238
|
</el-select>
|
|
232
239
|
</template>
|
|
240
|
+
<template v-else-if="item.type === 'cascade'">
|
|
241
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
242
|
+
<el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
|
|
243
|
+
width: item.width ? item.width : '200px'
|
|
244
|
+
}" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index)"></el-cascader>
|
|
245
|
+
</template>
|
|
233
246
|
<template v-else-if="item.type === 'slot'">
|
|
234
247
|
<slot :name="item.slot" :item="item">内容为空</slot>
|
|
235
248
|
</template>
|
|
@@ -324,6 +337,12 @@
|
|
|
324
337
|
<el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
|
|
325
338
|
</el-select>
|
|
326
339
|
</template>
|
|
340
|
+
<template v-else-if="item.type === 'cascade'">
|
|
341
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
342
|
+
<el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
|
|
343
|
+
width: item.width ? item.width : '200px'
|
|
344
|
+
}" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index + maxConditionLength)"></el-cascader>
|
|
345
|
+
</template>
|
|
327
346
|
<template v-else-if="item.type === 'slot'">
|
|
328
347
|
<slot :name="item.slot" :item="item">内容为空</slot>
|
|
329
348
|
</template>
|
|
@@ -386,6 +405,31 @@ function deepCopyFunction(arr1, arr2) {
|
|
|
386
405
|
}
|
|
387
406
|
}
|
|
388
407
|
}
|
|
408
|
+
function findTree(allData, fn) {
|
|
409
|
+
function loopFn(arr, pNode) {
|
|
410
|
+
for (let i = 0; i < arr.length; i++) {
|
|
411
|
+
// debugger
|
|
412
|
+
let result = null
|
|
413
|
+
const item = arr[i]
|
|
414
|
+
item.nodes = [item]
|
|
415
|
+
if (pNode) {
|
|
416
|
+
item.nodes = [...pNode.nodes, item]
|
|
417
|
+
}
|
|
418
|
+
// findTree(item.options, tItem => tItem.value === lastValue)
|
|
419
|
+
const flag = fn(item)
|
|
420
|
+
if (flag) {
|
|
421
|
+
result = item
|
|
422
|
+
if (result) return result
|
|
423
|
+
}
|
|
424
|
+
if (item.children) {
|
|
425
|
+
result = loopFn(item.children, item)
|
|
426
|
+
}
|
|
427
|
+
if (result) return result
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const res = loopFn(allData)
|
|
431
|
+
return res
|
|
432
|
+
}
|
|
389
433
|
|
|
390
434
|
export default {
|
|
391
435
|
name: 'SySearchbar',
|
|
@@ -601,6 +645,25 @@ export default {
|
|
|
601
645
|
} else {
|
|
602
646
|
obj.name = item.options.find((x) => x.value === item.value).label
|
|
603
647
|
}
|
|
648
|
+
} else if (item.type === 'cascade') {
|
|
649
|
+
if (!item.value) return
|
|
650
|
+
if (item.multiple) {
|
|
651
|
+
if (!item.value.length) {
|
|
652
|
+
return
|
|
653
|
+
}
|
|
654
|
+
// const valueOptions = item.value.map((x) => item.options.find((f) => f.value === x))
|
|
655
|
+
const valueOptions = item.value.map((x) => {
|
|
656
|
+
// console.log('xxxxxxxxxxxxx', x) // 这里的x是个数组
|
|
657
|
+
const lastValue = x[x.length - 1]
|
|
658
|
+
const find = findTree(item.options, tItem => tItem.value === lastValue)
|
|
659
|
+
return find
|
|
660
|
+
})
|
|
661
|
+
obj.name = valueOptions.map((x) => x.nodes.map(y => y.label).join('/')).join(',')
|
|
662
|
+
} else {
|
|
663
|
+
const lastValue = item.value[item.value.length - 1]
|
|
664
|
+
const find = findTree(item.options, tItem => tItem.value === lastValue)
|
|
665
|
+
obj.name = find ? find.nodes.map(y => y.label).join('/') : ''
|
|
666
|
+
}
|
|
604
667
|
} else if (item.type === 'slot') {
|
|
605
668
|
if (!item.getValue) return
|
|
606
669
|
const info = item.getValue() // 这里不能直接调,因为是深拷贝过来的
|
|
@@ -687,6 +750,9 @@ export default {
|
|
|
687
750
|
if (item.type === 'select') {
|
|
688
751
|
item.value = item.multiple ? [] : null
|
|
689
752
|
}
|
|
753
|
+
if (item.type === 'cascade') {
|
|
754
|
+
item.value = item.multiple ? [] : null
|
|
755
|
+
}
|
|
690
756
|
if (item.type === 'slot') {
|
|
691
757
|
item.setValue({ name: '', value: '' })
|
|
692
758
|
}
|
|
@@ -719,6 +785,9 @@ export default {
|
|
|
719
785
|
if (item.type === 'select') {
|
|
720
786
|
item.value = item.multiple ? [] : null
|
|
721
787
|
}
|
|
788
|
+
if (item.type === 'cascade') {
|
|
789
|
+
item.value = item.multiple ? [] : null
|
|
790
|
+
}
|
|
722
791
|
if (item.type === 'slot') {
|
|
723
792
|
item.setValue({ name: '', value: '' })
|
|
724
793
|
}
|
|
@@ -758,6 +827,13 @@ export default {
|
|
|
758
827
|
item.value = null
|
|
759
828
|
}
|
|
760
829
|
}
|
|
830
|
+
if (item.type === 'cascade') {
|
|
831
|
+
if (item.multiple) {
|
|
832
|
+
item.value = []
|
|
833
|
+
} else {
|
|
834
|
+
item.value = null
|
|
835
|
+
}
|
|
836
|
+
}
|
|
761
837
|
item.type === 'slot' && item.setValue({ value: '', name: '' })
|
|
762
838
|
})
|
|
763
839
|
})
|
|
@@ -840,6 +916,9 @@ export default {
|
|
|
840
916
|
if (item.type === 'select') {
|
|
841
917
|
item.value = item.multiple ? [] : null
|
|
842
918
|
}
|
|
919
|
+
if (item.type === 'cascade') {
|
|
920
|
+
item.value = item.multiple ? [] : null
|
|
921
|
+
}
|
|
843
922
|
}
|
|
844
923
|
})
|
|
845
924
|
this.$set(this.currentSearchList, parentIndex, parentItem)
|
|
@@ -920,6 +999,9 @@ export default {
|
|
|
920
999
|
v.value = ele.value
|
|
921
1000
|
}
|
|
922
1001
|
if (ele.value) v.isActive = true
|
|
1002
|
+
} else if (v.type === 'cascade') {
|
|
1003
|
+
v.value = ele.value
|
|
1004
|
+
if (ele.value) v.isActive = true
|
|
923
1005
|
} else if (v.type === 'month' || v.type === 'year') {
|
|
924
1006
|
v.value = ele.value
|
|
925
1007
|
if (ele.value) v.isActive = true
|