vsyswin-ui 0.2.48 → 0.2.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/lib/vsyswin-ui.common.js +446 -112
- package/lib/vsyswin-ui.common.js.map +1 -1
- package/lib/vsyswin-ui.umd.js +446 -112
- package/lib/vsyswin-ui.umd.js.map +1 -1
- package/lib/vsyswin-ui.umd.min.js +19 -19
- package/lib/vsyswin-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/packages/search-bar/src/search-bar.scss +5 -2
- package/packages/search-bar/src/search-bar.vue +140 -30
- package/packages/styles/common.scss +3 -0
- package/packages/table/src/table.vue +13 -7
package/package.json
CHANGED
|
@@ -120,13 +120,16 @@
|
|
|
120
120
|
border-left: $--border-base;
|
|
121
121
|
background-color: #fafafa;
|
|
122
122
|
overflow: hidden;
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-wrap: wrap;
|
|
123
125
|
.el-date-editor {
|
|
124
126
|
border-radius: $--border-radius-small;
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
@include e(li) {
|
|
129
|
-
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
130
133
|
padding: 0 12px;
|
|
131
134
|
line-height: 48px;
|
|
132
135
|
color: transparentize($--color-black, 0.35);
|
|
@@ -158,7 +161,7 @@
|
|
|
158
161
|
float: left;
|
|
159
162
|
margin: 0 8px 0 0;
|
|
160
163
|
font-size: $--font-size-base;
|
|
161
|
-
font-weight:
|
|
164
|
+
font-weight: 600;
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
@include e(subContent) {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
>
|
|
44
44
|
</template>
|
|
45
45
|
<template v-else-if="item.type === 'daterange'">
|
|
46
|
-
<span class="syswin-filter-item__name" v-if="item.name">{{ item.name }}</span>
|
|
46
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
47
47
|
<el-date-picker
|
|
48
48
|
type="daterange"
|
|
49
49
|
v-model="item.value"
|
|
@@ -58,8 +58,20 @@
|
|
|
58
58
|
>
|
|
59
59
|
</el-date-picker>
|
|
60
60
|
</template>
|
|
61
|
+
<template v-else-if="item.type === 'month' || item.type === 'year'">
|
|
62
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
63
|
+
<el-date-picker
|
|
64
|
+
:type="item.type"
|
|
65
|
+
v-model="item.value"
|
|
66
|
+
size="small"
|
|
67
|
+
:placeholder="`选择${item.type === 'month' ? '月' : '年'}`"
|
|
68
|
+
:value-format="`${item.type === 'month' ? 'yyyy-MM' : 'yyyy'}`"
|
|
69
|
+
@change="handleChangeDateragne(idx, index)"
|
|
70
|
+
>
|
|
71
|
+
</el-date-picker>
|
|
72
|
+
</template>
|
|
61
73
|
<template v-else-if="item.type === 'datetimerange'">
|
|
62
|
-
<span class="syswin-filter-item__name" v-if="item.name">{{ item.name }}</span>
|
|
74
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
63
75
|
<el-date-picker
|
|
64
76
|
type="datetimerange"
|
|
65
77
|
v-model="item.value"
|
|
@@ -77,7 +89,7 @@
|
|
|
77
89
|
</el-date-picker>
|
|
78
90
|
</template>
|
|
79
91
|
<template v-else-if="item.type === 'select'">
|
|
80
|
-
<span class="syswin-filter-item__name" v-if="item.name">{{ item.name }}</span>
|
|
92
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
81
93
|
<el-select
|
|
82
94
|
:multiple="!!item.multiple"
|
|
83
95
|
collapse-tags
|
|
@@ -134,6 +146,18 @@
|
|
|
134
146
|
>
|
|
135
147
|
</el-date-picker>
|
|
136
148
|
</template>
|
|
149
|
+
<template v-else-if="item.type === 'month' || item.type === 'year'">
|
|
150
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
151
|
+
<el-date-picker
|
|
152
|
+
:type="item.type"
|
|
153
|
+
v-model="item.value"
|
|
154
|
+
size="small"
|
|
155
|
+
:placeholder="`选择${item.type === 'month' ? '月' : '年'}`"
|
|
156
|
+
:value-format="`${item.type === 'month' ? 'yyyy-MM' : 'yyyy'}`"
|
|
157
|
+
@change="handleChangeDateragne(idx, index)"
|
|
158
|
+
>
|
|
159
|
+
</el-date-picker>
|
|
160
|
+
</template>
|
|
137
161
|
<template v-else-if="item.type === 'datetimerange'">
|
|
138
162
|
<span class="syswin-filter-item__name" v-if="item.name">{{ item.name }}</span>
|
|
139
163
|
<el-date-picker
|
|
@@ -153,7 +177,7 @@
|
|
|
153
177
|
</el-date-picker>
|
|
154
178
|
</template>
|
|
155
179
|
<template v-else-if="item.type === 'select'">
|
|
156
|
-
<span class="syswin-filter-item__name" v-if="item.name">{{ item.name }}</span>
|
|
180
|
+
<span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
|
|
157
181
|
<el-select
|
|
158
182
|
:multiple="!!item.multiple"
|
|
159
183
|
collapse-tags
|
|
@@ -275,7 +299,10 @@
|
|
|
275
299
|
</div>
|
|
276
300
|
</transition>
|
|
277
301
|
<div class="search-condition-list" v-if="tagList.length && !customTagList">
|
|
278
|
-
<el-tag v-for="tag in tagList" class="tags" :key="`${tag.pId}_${tag.id}`" size="small"
|
|
302
|
+
<el-tag v-for="tag in tagList" class="tags" :key="`${tag.pId}_${tag.id}`" size="small" closable @close="handleTagClose(tag)">
|
|
303
|
+
{{ tag.pName }}: {{ tag.name }}
|
|
304
|
+
</el-tag>
|
|
305
|
+
<el-tag size="small" class="tags clearall" v-if="tagList.length > 1" @click="handleClearAllTags">清除所有</el-tag>
|
|
279
306
|
</div>
|
|
280
307
|
</div>
|
|
281
308
|
</template>
|
|
@@ -352,7 +379,7 @@ export default {
|
|
|
352
379
|
saveToLocalPosition: {
|
|
353
380
|
type: String,
|
|
354
381
|
default: 'right',
|
|
355
|
-
validator: function
|
|
382
|
+
validator: function(value) {
|
|
356
383
|
return ['left', 'right'].indexOf(value) !== -1
|
|
357
384
|
}
|
|
358
385
|
},
|
|
@@ -408,8 +435,8 @@ export default {
|
|
|
408
435
|
createTagList() {
|
|
409
436
|
const list = []
|
|
410
437
|
this.currentSearchList.length &&
|
|
411
|
-
this.currentSearchList.forEach(
|
|
412
|
-
ele.itemList.forEach(
|
|
438
|
+
this.currentSearchList.forEach(ele => {
|
|
439
|
+
ele.itemList.forEach(item => {
|
|
413
440
|
if (item.isActive || item.type === 'slot') {
|
|
414
441
|
let obj = {
|
|
415
442
|
pId: ele.id,
|
|
@@ -422,6 +449,9 @@ export default {
|
|
|
422
449
|
}
|
|
423
450
|
if (item.type === 'text') {
|
|
424
451
|
obj.name = item.name
|
|
452
|
+
} else if (item.type === 'month' || item.type === 'year') {
|
|
453
|
+
if (!item.value) return
|
|
454
|
+
obj.name = item.value + (item.type === 'month' ? '月' : '年')
|
|
425
455
|
} else if (item.type === 'daterange') {
|
|
426
456
|
if (!item.value || !item.value[0]) {
|
|
427
457
|
return
|
|
@@ -439,10 +469,10 @@ export default {
|
|
|
439
469
|
} else if (item.type === 'select') {
|
|
440
470
|
if (!item.value) return
|
|
441
471
|
if (item.multiple) {
|
|
442
|
-
const valueOptions = item.value.map(
|
|
443
|
-
obj.name = valueOptions.map(
|
|
472
|
+
const valueOptions = item.value.map(x => item.options.find(f => f.value === x))
|
|
473
|
+
obj.name = valueOptions.map(x => x.label).join(',')
|
|
444
474
|
} else {
|
|
445
|
-
obj.name = item.options.find(
|
|
475
|
+
obj.name = item.options.find(x => x.value === item.value).label
|
|
446
476
|
}
|
|
447
477
|
} else if (item.type === 'slot') {
|
|
448
478
|
const info = item.getValue()
|
|
@@ -498,18 +528,90 @@ export default {
|
|
|
498
528
|
const filterList = this.createTagList()
|
|
499
529
|
this.$emit('on-search', { keyword: this.keyword, filterList })
|
|
500
530
|
},
|
|
531
|
+
handleTagClose(tag) {
|
|
532
|
+
const parentItem = this.currentSearchList.find(x => x.id === tag.pId)
|
|
533
|
+
const parentIndex = this.currentSearchList.findIndex(x => x.id === tag.pId)
|
|
534
|
+
const childIndex = parentItem.itemList.findIndex(x => x.id === tag.id)
|
|
535
|
+
parentItem.itemList.forEach((item, index) => {
|
|
536
|
+
if (parentItem.multiple) {
|
|
537
|
+
// 多选
|
|
538
|
+
index === childIndex && (item.isActive = false)
|
|
539
|
+
} else {
|
|
540
|
+
// 单选
|
|
541
|
+
if (index === childIndex) {
|
|
542
|
+
item.isActive = false
|
|
543
|
+
;(item.type === 'daterange' || item.type === 'datetimerange') && (item.value = null)
|
|
544
|
+
if (item.type === 'month' || item.type === 'year') {
|
|
545
|
+
item.value = ''
|
|
546
|
+
}
|
|
547
|
+
if (item.type === 'select') {
|
|
548
|
+
item.value = item.multiple ? [] : null
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
})
|
|
553
|
+
this.$set(this.currentSearchList, parentIndex, parentItem)
|
|
554
|
+
const filterList = this.createTagList()
|
|
555
|
+
this.tagList = filterList
|
|
556
|
+
this.$emit('on-search', { keyword: this.keyword, filterList })
|
|
557
|
+
},
|
|
558
|
+
// 关闭所有的标签
|
|
559
|
+
handleClearAllTags() {
|
|
560
|
+
this.tagList.forEach(tag => {
|
|
561
|
+
const parentItem = this.currentSearchList.find(x => x.id === tag.pId)
|
|
562
|
+
const parentIndex = this.currentSearchList.findIndex(x => x.id === tag.pId)
|
|
563
|
+
const childIndex = parentItem.itemList.findIndex(x => x.id === tag.id)
|
|
564
|
+
parentItem.itemList.forEach((item, index) => {
|
|
565
|
+
if (parentItem.multiple) {
|
|
566
|
+
// 多选
|
|
567
|
+
index === childIndex && (item.isActive = false)
|
|
568
|
+
} else {
|
|
569
|
+
// 单选
|
|
570
|
+
if (index === childIndex) {
|
|
571
|
+
item.isActive = false
|
|
572
|
+
;(item.type === 'daterange' || item.type === 'datetimerange') && (item.value = null)
|
|
573
|
+
if (item.type === 'month' || item.type === 'year') {
|
|
574
|
+
item.value = ''
|
|
575
|
+
}
|
|
576
|
+
if (item.type === 'select') {
|
|
577
|
+
item.value = item.multiple ? [] : null
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
})
|
|
582
|
+
this.$set(this.currentSearchList, parentIndex, parentItem)
|
|
583
|
+
})
|
|
584
|
+
const filterList = this.createTagList()
|
|
585
|
+
this.tagList = filterList
|
|
586
|
+
this.$emit('on-search', { keyword: this.keyword, filterList })
|
|
587
|
+
},
|
|
501
588
|
// 清除关键字/选中标签/选中条件
|
|
502
589
|
handleClearData() {
|
|
503
590
|
this.conditionValue = ''
|
|
504
591
|
this.keyword = ''
|
|
505
592
|
|
|
506
593
|
const currentSearchList = _.cloneDeep(this.currentSearchList)
|
|
507
|
-
currentSearchList.forEach(
|
|
508
|
-
ele.itemList.forEach(
|
|
594
|
+
currentSearchList.forEach(ele => {
|
|
595
|
+
ele.itemList.forEach(item => {
|
|
509
596
|
item.isActive = !!item.default
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
597
|
+
if (['month', 'year'].includes(item.type)) {
|
|
598
|
+
item.value = item.default && item.defaultValue ? item.defaultValue : ''
|
|
599
|
+
}
|
|
600
|
+
if (item.type === 'daterange' || item.type === 'datetimerange') {
|
|
601
|
+
item.value = item.default && item.defaultValue ? item.defaultValue : null
|
|
602
|
+
}
|
|
603
|
+
if (item.type === 'select') {
|
|
604
|
+
if (item.default && item.defaultValue) {
|
|
605
|
+
if (item.multiple) {
|
|
606
|
+
const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
|
|
607
|
+
item.value = valueOptions.map(x => x.value)
|
|
608
|
+
} else {
|
|
609
|
+
item.value = item.defaultValue
|
|
610
|
+
}
|
|
611
|
+
} else {
|
|
612
|
+
item.value = null
|
|
613
|
+
}
|
|
614
|
+
}
|
|
513
615
|
item.type === 'slot' && item.setValue({ value: '', name: '' })
|
|
514
616
|
})
|
|
515
617
|
})
|
|
@@ -519,8 +621,8 @@ export default {
|
|
|
519
621
|
setDefaultTagList() {
|
|
520
622
|
const list = []
|
|
521
623
|
if (this.currentSearchList) {
|
|
522
|
-
this.currentSearchList.forEach(
|
|
523
|
-
ele.itemList.forEach(
|
|
624
|
+
this.currentSearchList.forEach(ele => {
|
|
625
|
+
ele.itemList.forEach(item => {
|
|
524
626
|
if (item.default) {
|
|
525
627
|
// 如果是默认值
|
|
526
628
|
const obj = {
|
|
@@ -533,6 +635,9 @@ export default {
|
|
|
533
635
|
}
|
|
534
636
|
if (item.type === 'text') {
|
|
535
637
|
obj.name = item.name
|
|
638
|
+
} else if (item.type === 'month' || item.type === 'year') {
|
|
639
|
+
if (!item.defaultValue) return
|
|
640
|
+
obj.name = item.defaultValue + (item.type === 'month' ? '月' : '年')
|
|
536
641
|
} else if (item.type === 'daterange') {
|
|
537
642
|
if (!item.defaultValue || !item.defaultValue[0]) {
|
|
538
643
|
return
|
|
@@ -550,10 +655,12 @@ export default {
|
|
|
550
655
|
} else if (item.type === 'select') {
|
|
551
656
|
if (!item.defaultValue) return
|
|
552
657
|
if (item.multiple) {
|
|
553
|
-
const valueOptions = item.defaultValue.map(
|
|
554
|
-
obj.name = valueOptions.map(
|
|
658
|
+
const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
|
|
659
|
+
obj.name = valueOptions.map(x => x.label).join(',')
|
|
555
660
|
} else {
|
|
556
|
-
|
|
661
|
+
const defaultItem = item.options.find(x => x.value === item.defaultValue)
|
|
662
|
+
obj.name = defaultItem.label
|
|
663
|
+
obj.value = defaultItem
|
|
557
664
|
}
|
|
558
665
|
} else if (item.type === 'slot') {
|
|
559
666
|
// slot选项不设置默认值
|
|
@@ -576,6 +683,9 @@ export default {
|
|
|
576
683
|
// 单选
|
|
577
684
|
item.isActive = index === childIndex ? !childItem.isActive : false
|
|
578
685
|
;(item.type === 'daterange' || item.type === 'datetimerange') && (item.value = null)
|
|
686
|
+
if (item.type === 'month' || item.type === 'year') {
|
|
687
|
+
item.value = ''
|
|
688
|
+
}
|
|
579
689
|
if (item.type === 'select') {
|
|
580
690
|
item.value = item.multiple ? [] : null
|
|
581
691
|
}
|
|
@@ -607,7 +717,7 @@ export default {
|
|
|
607
717
|
this.$set(this.currentSearchList, parentIndex, parentItem)
|
|
608
718
|
}
|
|
609
719
|
} else {
|
|
610
|
-
item.value = null
|
|
720
|
+
item.value = item.type === 'month' || item.type === 'year' ? '' : null
|
|
611
721
|
item.isActive = false
|
|
612
722
|
this.$set(this.currentSearchList[parentIndex].itemList, childIndex, item)
|
|
613
723
|
}
|
|
@@ -620,15 +730,15 @@ export default {
|
|
|
620
730
|
// 切换保存过滤条件的下拉框
|
|
621
731
|
handleChangeCondition(value) {
|
|
622
732
|
this.conditionValue = value
|
|
623
|
-
const list = this.conditionList.filter(
|
|
733
|
+
const list = this.conditionList.filter(item => item.value === value)
|
|
624
734
|
if (list.length) {
|
|
625
735
|
const currentSearchList = _.cloneDeep(this.currentSearchList)
|
|
626
736
|
const { keyword = '', filterList = [] } = list[0]
|
|
627
737
|
this.keyword = keyword
|
|
628
738
|
|
|
629
739
|
// 先清空所有标签
|
|
630
|
-
currentSearchList.forEach(
|
|
631
|
-
ele.itemList.forEach(
|
|
740
|
+
currentSearchList.forEach(ele => {
|
|
741
|
+
ele.itemList.forEach(item => {
|
|
632
742
|
item.isActive = false
|
|
633
743
|
item.type === 'daterange' && (item.value = null)
|
|
634
744
|
})
|
|
@@ -636,10 +746,10 @@ export default {
|
|
|
636
746
|
|
|
637
747
|
// 设置选中的标签
|
|
638
748
|
if (filterList && filterList.length) {
|
|
639
|
-
filterList.forEach(
|
|
640
|
-
currentSearchList.forEach(
|
|
749
|
+
filterList.forEach(ele => {
|
|
750
|
+
currentSearchList.forEach(item => {
|
|
641
751
|
if (ele.pId === item.id) {
|
|
642
|
-
item.itemList.forEach(
|
|
752
|
+
item.itemList.forEach(v => {
|
|
643
753
|
if (v.type === 'slot') {
|
|
644
754
|
v.setValue({ value: ele.value, name: ele.name, ...ele })
|
|
645
755
|
}
|
|
@@ -676,7 +786,7 @@ export default {
|
|
|
676
786
|
let localList = localStorage.getItem(`syswin${this.storageName}`)
|
|
677
787
|
if (!['', undefined, null].includes(localList)) {
|
|
678
788
|
localList = JSON.parse(localList)
|
|
679
|
-
const idx = localList.findIndex(
|
|
789
|
+
const idx = localList.findIndex(ele => ele.value === item.value)
|
|
680
790
|
idx > -1 && localList.splice(idx, 1)
|
|
681
791
|
localList.length > 0
|
|
682
792
|
? localStorage.setItem(`syswin${this.storageName}`, JSON.stringify(localList))
|
|
@@ -697,7 +807,7 @@ export default {
|
|
|
697
807
|
this.conditionValue = momentValue
|
|
698
808
|
} else {
|
|
699
809
|
// 编辑
|
|
700
|
-
const index = this.conditionList.findIndex(
|
|
810
|
+
const index = this.conditionList.findIndex(ele => ele.value === this.currentData.value)
|
|
701
811
|
const item = this.conditionList[index]
|
|
702
812
|
item.label = label
|
|
703
813
|
this.$set(this.conditionList, index, item)
|
|
@@ -266,6 +266,11 @@ export default {
|
|
|
266
266
|
type: String,
|
|
267
267
|
default: () => ''
|
|
268
268
|
},
|
|
269
|
+
// 合计功能保留小数位
|
|
270
|
+
decimalNum: {
|
|
271
|
+
type: Number,
|
|
272
|
+
default: () => 2
|
|
273
|
+
},
|
|
269
274
|
virtual: Boolean
|
|
270
275
|
},
|
|
271
276
|
data () {
|
|
@@ -491,6 +496,7 @@ export default {
|
|
|
491
496
|
}
|
|
492
497
|
}, 0);
|
|
493
498
|
}
|
|
499
|
+
sums[index] = (+sums[index]).toFixed(this.decimalNum);
|
|
494
500
|
} else {
|
|
495
501
|
sums[index] = '';
|
|
496
502
|
}
|
|
@@ -550,13 +556,13 @@ export default {
|
|
|
550
556
|
border-color: #027AFF;
|
|
551
557
|
background: #027AFF;
|
|
552
558
|
}
|
|
553
|
-
.el-input__inner {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
559
|
+
// .el-input__inner {
|
|
560
|
+
// height: 32px !important;
|
|
561
|
+
// line-height: 32px !important;
|
|
562
|
+
// border-radius: 2px !important;
|
|
563
|
+
// box-sizing: border-box !important;
|
|
564
|
+
// border-color: #D9D9D9 !important;
|
|
565
|
+
// }
|
|
560
566
|
|
|
561
567
|
.el-input__inner:hover {
|
|
562
568
|
border-color: #D0D3D6!important;
|