vsyswin-ui 0.2.50 → 0.2.54
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 +50257 -49270
- package/lib/vsyswin-ui.common.js.map +1 -1
- package/lib/vsyswin-ui.umd.js +50257 -49270
- package/lib/vsyswin-ui.umd.js.map +1 -1
- package/lib/vsyswin-ui.umd.min.js +181 -181
- 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 +144 -28
- 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"
|
|
@@ -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
|
|
@@ -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,96 @@ 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
|
+
if (item.type === 'slot') {
|
|
551
|
+
item.setValue({ name: '', value: '' })
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
})
|
|
556
|
+
this.$set(this.currentSearchList, parentIndex, parentItem)
|
|
557
|
+
const filterList = this.createTagList()
|
|
558
|
+
this.tagList = filterList
|
|
559
|
+
this.$emit('on-search', { keyword: this.keyword, filterList })
|
|
560
|
+
},
|
|
561
|
+
// 关闭所有的标签
|
|
562
|
+
handleClearAllTags() {
|
|
563
|
+
this.tagList.forEach(tag => {
|
|
564
|
+
const parentItem = this.currentSearchList.find(x => x.id === tag.pId)
|
|
565
|
+
const parentIndex = this.currentSearchList.findIndex(x => x.id === tag.pId)
|
|
566
|
+
const childIndex = parentItem.itemList.findIndex(x => x.id === tag.id)
|
|
567
|
+
parentItem.itemList.forEach((item, index) => {
|
|
568
|
+
if (parentItem.multiple) {
|
|
569
|
+
// 多选
|
|
570
|
+
index === childIndex && (item.isActive = false)
|
|
571
|
+
} else {
|
|
572
|
+
// 单选
|
|
573
|
+
if (index === childIndex) {
|
|
574
|
+
item.isActive = false
|
|
575
|
+
;(item.type === 'daterange' || item.type === 'datetimerange') && (item.value = null)
|
|
576
|
+
if (item.type === 'month' || item.type === 'year') {
|
|
577
|
+
item.value = ''
|
|
578
|
+
}
|
|
579
|
+
if (item.type === 'select') {
|
|
580
|
+
item.value = item.multiple ? [] : null
|
|
581
|
+
}
|
|
582
|
+
if (item.type === 'slot') {
|
|
583
|
+
item.setValue({ name: '', value: '' })
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
})
|
|
588
|
+
this.$set(this.currentSearchList, parentIndex, parentItem)
|
|
589
|
+
})
|
|
590
|
+
const filterList = this.createTagList()
|
|
591
|
+
this.tagList = filterList
|
|
592
|
+
this.$emit('on-search', { keyword: this.keyword, filterList })
|
|
593
|
+
},
|
|
501
594
|
// 清除关键字/选中标签/选中条件
|
|
502
595
|
handleClearData() {
|
|
503
596
|
this.conditionValue = ''
|
|
504
597
|
this.keyword = ''
|
|
505
598
|
|
|
506
599
|
const currentSearchList = _.cloneDeep(this.currentSearchList)
|
|
507
|
-
currentSearchList.forEach(
|
|
508
|
-
ele.itemList.forEach(
|
|
600
|
+
currentSearchList.forEach(ele => {
|
|
601
|
+
ele.itemList.forEach(item => {
|
|
509
602
|
item.isActive = !!item.default
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
603
|
+
if (['month', 'year'].includes(item.type)) {
|
|
604
|
+
item.value = item.default && item.defaultValue ? item.defaultValue : ''
|
|
605
|
+
}
|
|
606
|
+
if (item.type === 'daterange' || item.type === 'datetimerange') {
|
|
607
|
+
item.value = item.default && item.defaultValue ? item.defaultValue : null
|
|
608
|
+
}
|
|
609
|
+
if (item.type === 'select') {
|
|
610
|
+
if (item.default && item.defaultValue) {
|
|
611
|
+
if (item.multiple) {
|
|
612
|
+
const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
|
|
613
|
+
item.value = valueOptions.map(x => x.value)
|
|
614
|
+
} else {
|
|
615
|
+
item.value = item.defaultValue
|
|
616
|
+
}
|
|
617
|
+
} else {
|
|
618
|
+
item.value = null
|
|
619
|
+
}
|
|
620
|
+
}
|
|
513
621
|
item.type === 'slot' && item.setValue({ value: '', name: '' })
|
|
514
622
|
})
|
|
515
623
|
})
|
|
@@ -519,8 +627,8 @@ export default {
|
|
|
519
627
|
setDefaultTagList() {
|
|
520
628
|
const list = []
|
|
521
629
|
if (this.currentSearchList) {
|
|
522
|
-
this.currentSearchList.forEach(
|
|
523
|
-
ele.itemList.forEach(
|
|
630
|
+
this.currentSearchList.forEach(ele => {
|
|
631
|
+
ele.itemList.forEach(item => {
|
|
524
632
|
if (item.default) {
|
|
525
633
|
// 如果是默认值
|
|
526
634
|
const obj = {
|
|
@@ -533,6 +641,9 @@ export default {
|
|
|
533
641
|
}
|
|
534
642
|
if (item.type === 'text') {
|
|
535
643
|
obj.name = item.name
|
|
644
|
+
} else if (item.type === 'month' || item.type === 'year') {
|
|
645
|
+
if (!item.defaultValue) return
|
|
646
|
+
obj.name = item.defaultValue + (item.type === 'month' ? '月' : '年')
|
|
536
647
|
} else if (item.type === 'daterange') {
|
|
537
648
|
if (!item.defaultValue || !item.defaultValue[0]) {
|
|
538
649
|
return
|
|
@@ -550,10 +661,12 @@ export default {
|
|
|
550
661
|
} else if (item.type === 'select') {
|
|
551
662
|
if (!item.defaultValue) return
|
|
552
663
|
if (item.multiple) {
|
|
553
|
-
const valueOptions = item.defaultValue.map(
|
|
554
|
-
obj.name = valueOptions.map(
|
|
664
|
+
const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
|
|
665
|
+
obj.name = valueOptions.map(x => x.label).join(',')
|
|
555
666
|
} else {
|
|
556
|
-
|
|
667
|
+
const defaultItem = item.options.find(x => x.value === item.defaultValue)
|
|
668
|
+
obj.name = defaultItem.label
|
|
669
|
+
obj.value = defaultItem
|
|
557
670
|
}
|
|
558
671
|
} else if (item.type === 'slot') {
|
|
559
672
|
// slot选项不设置默认值
|
|
@@ -576,6 +689,9 @@ export default {
|
|
|
576
689
|
// 单选
|
|
577
690
|
item.isActive = index === childIndex ? !childItem.isActive : false
|
|
578
691
|
;(item.type === 'daterange' || item.type === 'datetimerange') && (item.value = null)
|
|
692
|
+
if (item.type === 'month' || item.type === 'year') {
|
|
693
|
+
item.value = ''
|
|
694
|
+
}
|
|
579
695
|
if (item.type === 'select') {
|
|
580
696
|
item.value = item.multiple ? [] : null
|
|
581
697
|
}
|
|
@@ -607,7 +723,7 @@ export default {
|
|
|
607
723
|
this.$set(this.currentSearchList, parentIndex, parentItem)
|
|
608
724
|
}
|
|
609
725
|
} else {
|
|
610
|
-
item.value = null
|
|
726
|
+
item.value = item.type === 'month' || item.type === 'year' ? '' : null
|
|
611
727
|
item.isActive = false
|
|
612
728
|
this.$set(this.currentSearchList[parentIndex].itemList, childIndex, item)
|
|
613
729
|
}
|
|
@@ -620,15 +736,15 @@ export default {
|
|
|
620
736
|
// 切换保存过滤条件的下拉框
|
|
621
737
|
handleChangeCondition(value) {
|
|
622
738
|
this.conditionValue = value
|
|
623
|
-
const list = this.conditionList.filter(
|
|
739
|
+
const list = this.conditionList.filter(item => item.value === value)
|
|
624
740
|
if (list.length) {
|
|
625
741
|
const currentSearchList = _.cloneDeep(this.currentSearchList)
|
|
626
742
|
const { keyword = '', filterList = [] } = list[0]
|
|
627
743
|
this.keyword = keyword
|
|
628
744
|
|
|
629
745
|
// 先清空所有标签
|
|
630
|
-
currentSearchList.forEach(
|
|
631
|
-
ele.itemList.forEach(
|
|
746
|
+
currentSearchList.forEach(ele => {
|
|
747
|
+
ele.itemList.forEach(item => {
|
|
632
748
|
item.isActive = false
|
|
633
749
|
item.type === 'daterange' && (item.value = null)
|
|
634
750
|
})
|
|
@@ -636,10 +752,10 @@ export default {
|
|
|
636
752
|
|
|
637
753
|
// 设置选中的标签
|
|
638
754
|
if (filterList && filterList.length) {
|
|
639
|
-
filterList.forEach(
|
|
640
|
-
currentSearchList.forEach(
|
|
755
|
+
filterList.forEach(ele => {
|
|
756
|
+
currentSearchList.forEach(item => {
|
|
641
757
|
if (ele.pId === item.id) {
|
|
642
|
-
item.itemList.forEach(
|
|
758
|
+
item.itemList.forEach(v => {
|
|
643
759
|
if (v.type === 'slot') {
|
|
644
760
|
v.setValue({ value: ele.value, name: ele.name, ...ele })
|
|
645
761
|
}
|
|
@@ -676,7 +792,7 @@ export default {
|
|
|
676
792
|
let localList = localStorage.getItem(`syswin${this.storageName}`)
|
|
677
793
|
if (!['', undefined, null].includes(localList)) {
|
|
678
794
|
localList = JSON.parse(localList)
|
|
679
|
-
const idx = localList.findIndex(
|
|
795
|
+
const idx = localList.findIndex(ele => ele.value === item.value)
|
|
680
796
|
idx > -1 && localList.splice(idx, 1)
|
|
681
797
|
localList.length > 0
|
|
682
798
|
? localStorage.setItem(`syswin${this.storageName}`, JSON.stringify(localList))
|
|
@@ -697,7 +813,7 @@ export default {
|
|
|
697
813
|
this.conditionValue = momentValue
|
|
698
814
|
} else {
|
|
699
815
|
// 编辑
|
|
700
|
-
const index = this.conditionList.findIndex(
|
|
816
|
+
const index = this.conditionList.findIndex(ele => ele.value === this.currentData.value)
|
|
701
817
|
const item = this.conditionList[index]
|
|
702
818
|
item.label = label
|
|
703
819
|
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;
|