vsyswin-ui 0.2.51 → 0.2.55

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.51",
3
+ "version": "0.2.55",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
@@ -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
- float: left;
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: $--font-weight-normal;
164
+ font-weight: 600;
162
165
  }
163
166
 
164
167
  @include e(subContent) {
@@ -91,6 +91,7 @@
91
91
  <template v-else-if="item.type === 'select'">
92
92
  <span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
93
93
  <el-select
94
+ size="small"
94
95
  :multiple="!!item.multiple"
95
96
  collapse-tags
96
97
  clearable
@@ -132,15 +133,30 @@
132
133
  </template>
133
134
  <template v-else-if="item.type === 'daterange'">
134
135
  <span class="syswin-filter-item__name" v-if="item.name">{{ item.name }}</span>
135
- <el-date-picker type="daterange" v-model="item.value" size="small" range-separator="至" start-placeholder="开始日期"
136
- end-placeholder="结束日期" :editable="false" :unlink-panels="true" value-format="timestamp" @change="handleChangeDateragne(idx, index)"
136
+ <el-date-picker
137
+ type="daterange"
138
+ v-model="item.value"
139
+ size="small"
140
+ range-separator="至"
141
+ start-placeholder="开始日期"
142
+ end-placeholder="结束日期"
143
+ :editable="false"
144
+ :unlink-panels="true"
145
+ value-format="timestamp"
146
+ @change="handleChangeDateragne(idx, index)"
137
147
  >
138
148
  </el-date-picker>
139
149
  </template>
140
150
  <template v-else-if="item.type === 'month' || item.type === 'year'">
141
151
  <span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
142
- <el-date-picker :type="item.type" v-model="item.value" size="small" :placeholder="`选择${item.type === 'month' ? '月' : '年'}`" :value-format="`${item.type === 'month' ? 'yyyy-MM' : 'yyyy'}`"
143
- @change="handleChangeDateragne(idx, index)">
152
+ <el-date-picker
153
+ :type="item.type"
154
+ v-model="item.value"
155
+ size="small"
156
+ :placeholder="`选择${item.type === 'month' ? '月' : '年'}`"
157
+ :value-format="`${item.type === 'month' ? 'yyyy-MM' : 'yyyy'}`"
158
+ @change="handleChangeDateragne(idx, index)"
159
+ >
144
160
  </el-date-picker>
145
161
  </template>
146
162
  <template v-else-if="item.type === 'datetimerange'">
@@ -164,6 +180,7 @@
164
180
  <template v-else-if="item.type === 'select'">
165
181
  <span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
166
182
  <el-select
183
+ size="small"
167
184
  :multiple="!!item.multiple"
168
185
  collapse-tags
169
186
  clearable
@@ -236,6 +253,7 @@
236
253
  <template v-else-if="item.type === 'select'">
237
254
  <span class="syswin-filter-item__name" v-if="item.name">{{ item.name }}</span>
238
255
  <el-select
256
+ size="small"
239
257
  :multiple="!!item.multiple"
240
258
  collapse-tags
241
259
  clearable
@@ -284,7 +302,10 @@
284
302
  </div>
285
303
  </transition>
286
304
  <div class="search-condition-list" v-if="tagList.length && !customTagList">
287
- <el-tag v-for="tag in tagList" class="tags" :key="`${tag.pId}_${tag.id}`" size="small"> {{ tag.pName }}: {{ tag.name }} </el-tag>
305
+ <el-tag v-for="tag in tagList" class="tags" :key="`${tag.pId}_${tag.id}`" size="small" closable @close="handleTagClose(tag)">
306
+ {{ tag.pName }}: {{ tag.name }}
307
+ </el-tag>
308
+ <el-tag size="small" class="tags clearall" v-if="tagList.length > 1" @click="handleClearAllTags">清除所有</el-tag>
288
309
  </div>
289
310
  </div>
290
311
  </template>
@@ -361,7 +382,7 @@ export default {
361
382
  saveToLocalPosition: {
362
383
  type: String,
363
384
  default: 'right',
364
- validator: function(value) {
385
+ validator: function (value) {
365
386
  return ['left', 'right'].indexOf(value) !== -1
366
387
  }
367
388
  },
@@ -417,8 +438,8 @@ export default {
417
438
  createTagList() {
418
439
  const list = []
419
440
  this.currentSearchList.length &&
420
- this.currentSearchList.forEach(ele => {
421
- ele.itemList.forEach(item => {
441
+ this.currentSearchList.forEach((ele) => {
442
+ ele.itemList.forEach((item) => {
422
443
  if (item.isActive || item.type === 'slot') {
423
444
  let obj = {
424
445
  pId: ele.id,
@@ -451,10 +472,10 @@ export default {
451
472
  } else if (item.type === 'select') {
452
473
  if (!item.value) return
453
474
  if (item.multiple) {
454
- const valueOptions = item.value.map(x => item.options.find(f => f.value === x))
455
- obj.name = valueOptions.map(x => x.label).join(',')
475
+ const valueOptions = item.value.map((x) => item.options.find((f) => f.value === x))
476
+ obj.name = valueOptions.map((x) => x.label).join(',')
456
477
  } else {
457
- obj.name = item.options.find(x => x.value === item.value).label
478
+ obj.name = item.options.find((x) => x.value === item.value).label
458
479
  }
459
480
  } else if (item.type === 'slot') {
460
481
  const info = item.getValue()
@@ -510,29 +531,92 @@ export default {
510
531
  const filterList = this.createTagList()
511
532
  this.$emit('on-search', { keyword: this.keyword, filterList })
512
533
  },
534
+ handleTagClose(tag) {
535
+ const parentItem = this.currentSearchList.find((x) => x.id === tag.pId)
536
+ const parentIndex = this.currentSearchList.findIndex((x) => x.id === tag.pId)
537
+ const childIndex = parentItem.itemList.findIndex((x) => x.id === tag.id)
538
+ parentItem.itemList.forEach((item, index) => {
539
+ if (parentItem.multiple) {
540
+ // 多选
541
+ index === childIndex && (item.isActive = false)
542
+ } else {
543
+ // 单选
544
+ if (index === childIndex) {
545
+ item.isActive = false
546
+ ;(item.type === 'daterange' || item.type === 'datetimerange') && (item.value = null)
547
+ if (item.type === 'month' || item.type === 'year') {
548
+ item.value = ''
549
+ }
550
+ if (item.type === 'select') {
551
+ item.value = item.multiple ? [] : null
552
+ }
553
+ if (item.type === 'slot') {
554
+ item.setValue({ name: '', value: '' })
555
+ }
556
+ }
557
+ }
558
+ })
559
+ this.$set(this.currentSearchList, parentIndex, parentItem)
560
+ const filterList = this.createTagList()
561
+ this.tagList = filterList
562
+ this.$emit('on-search', { keyword: this.keyword, filterList })
563
+ },
564
+ // 关闭所有的标签
565
+ handleClearAllTags() {
566
+ this.tagList.forEach((tag) => {
567
+ const parentItem = this.currentSearchList.find((x) => x.id === tag.pId)
568
+ const parentIndex = this.currentSearchList.findIndex((x) => x.id === tag.pId)
569
+ const childIndex = parentItem.itemList.findIndex((x) => x.id === tag.id)
570
+ parentItem.itemList.forEach((item, index) => {
571
+ if (parentItem.multiple) {
572
+ // 多选
573
+ index === childIndex && (item.isActive = false)
574
+ } else {
575
+ // 单选
576
+ if (index === childIndex) {
577
+ item.isActive = false
578
+ ;(item.type === 'daterange' || item.type === 'datetimerange') && (item.value = null)
579
+ if (item.type === 'month' || item.type === 'year') {
580
+ item.value = ''
581
+ }
582
+ if (item.type === 'select') {
583
+ item.value = item.multiple ? [] : null
584
+ }
585
+ if (item.type === 'slot') {
586
+ item.setValue({ name: '', value: '' })
587
+ }
588
+ }
589
+ }
590
+ })
591
+ this.$set(this.currentSearchList, parentIndex, parentItem)
592
+ })
593
+ const filterList = this.createTagList()
594
+ this.tagList = filterList
595
+ this.$emit('on-search', { keyword: this.keyword, filterList })
596
+ },
513
597
  // 清除关键字/选中标签/选中条件
514
598
  handleClearData() {
515
599
  this.conditionValue = ''
516
600
  this.keyword = ''
517
601
 
518
602
  const currentSearchList = _.cloneDeep(this.currentSearchList)
519
- currentSearchList.forEach(ele => {
520
- ele.itemList.forEach(item => {
603
+ currentSearchList.forEach((ele) => {
604
+ ele.itemList.forEach((item) => {
521
605
  item.isActive = !!item.default
522
606
  if (['month', 'year'].includes(item.type)) {
523
- item.value = (item.default && item.defaultValue) ? item.defaultValue : ''
607
+ item.value = item.default && item.defaultValue ? item.defaultValue : ''
524
608
  }
525
609
  if (item.type === 'daterange' || item.type === 'datetimerange') {
526
- item.value = (item.default && item.defaultValue) ? item.defaultValue : null
610
+ item.value = item.default && item.defaultValue ? item.defaultValue : null
527
611
  }
528
612
  if (item.type === 'select') {
529
613
  if (item.default && item.defaultValue) {
530
614
  if (item.multiple) {
531
- const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
532
- item.value = valueOptions.map(x => x.value)
533
- } else {
534
- item.value = item.defaultValue
535
- }
615
+ const valueOptions = item.defaultValue.map((x) => item.options.find((f) => f.value === x))
616
+ item.value = valueOptions.map((x) => x.value)
617
+ } else {
618
+ item.value = item.defaultValue
619
+ }
536
620
  } else {
537
621
  item.value = null
538
622
  }
@@ -546,8 +630,8 @@ export default {
546
630
  setDefaultTagList() {
547
631
  const list = []
548
632
  if (this.currentSearchList) {
549
- this.currentSearchList.forEach(ele => {
550
- ele.itemList.forEach(item => {
633
+ this.currentSearchList.forEach((ele) => {
634
+ ele.itemList.forEach((item) => {
551
635
  if (item.default) {
552
636
  // 如果是默认值
553
637
  const obj = {
@@ -580,10 +664,10 @@ export default {
580
664
  } else if (item.type === 'select') {
581
665
  if (!item.defaultValue) return
582
666
  if (item.multiple) {
583
- const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
584
- obj.name = valueOptions.map(x => x.label).join(',')
667
+ const valueOptions = item.defaultValue.map((x) => item.options.find((f) => f.value === x))
668
+ obj.name = valueOptions.map((x) => x.label).join(',')
585
669
  } else {
586
- const defaultItem = item.options.find(x => x.value === item.defaultValue)
670
+ const defaultItem = item.options.find((x) => x.value === item.defaultValue)
587
671
  obj.name = defaultItem.label
588
672
  obj.value = defaultItem
589
673
  }
@@ -655,15 +739,15 @@ export default {
655
739
  // 切换保存过滤条件的下拉框
656
740
  handleChangeCondition(value) {
657
741
  this.conditionValue = value
658
- const list = this.conditionList.filter(item => item.value === value)
742
+ const list = this.conditionList.filter((item) => item.value === value)
659
743
  if (list.length) {
660
744
  const currentSearchList = _.cloneDeep(this.currentSearchList)
661
745
  const { keyword = '', filterList = [] } = list[0]
662
746
  this.keyword = keyword
663
747
 
664
748
  // 先清空所有标签
665
- currentSearchList.forEach(ele => {
666
- ele.itemList.forEach(item => {
749
+ currentSearchList.forEach((ele) => {
750
+ ele.itemList.forEach((item) => {
667
751
  item.isActive = false
668
752
  item.type === 'daterange' && (item.value = null)
669
753
  })
@@ -671,10 +755,10 @@ export default {
671
755
 
672
756
  // 设置选中的标签
673
757
  if (filterList && filterList.length) {
674
- filterList.forEach(ele => {
675
- currentSearchList.forEach(item => {
758
+ filterList.forEach((ele) => {
759
+ currentSearchList.forEach((item) => {
676
760
  if (ele.pId === item.id) {
677
- item.itemList.forEach(v => {
761
+ item.itemList.forEach((v) => {
678
762
  if (v.type === 'slot') {
679
763
  v.setValue({ value: ele.value, name: ele.name, ...ele })
680
764
  }
@@ -711,7 +795,7 @@ export default {
711
795
  let localList = localStorage.getItem(`syswin${this.storageName}`)
712
796
  if (!['', undefined, null].includes(localList)) {
713
797
  localList = JSON.parse(localList)
714
- const idx = localList.findIndex(ele => ele.value === item.value)
798
+ const idx = localList.findIndex((ele) => ele.value === item.value)
715
799
  idx > -1 && localList.splice(idx, 1)
716
800
  localList.length > 0
717
801
  ? localStorage.setItem(`syswin${this.storageName}`, JSON.stringify(localList))
@@ -732,7 +816,7 @@ export default {
732
816
  this.conditionValue = momentValue
733
817
  } else {
734
818
  // 编辑
735
- const index = this.conditionList.findIndex(ele => ele.value === this.currentData.value)
819
+ const index = this.conditionList.findIndex((ele) => ele.value === this.currentData.value)
736
820
  const item = this.conditionList[index]
737
821
  item.label = label
738
822
  this.$set(this.conditionList, index, item)
@@ -475,6 +475,9 @@ input:focus {
475
475
  .tags:not(:first-child) {
476
476
  margin-left: 6px;
477
477
  }
478
+ .tags.clearall {
479
+ cursor: pointer;
480
+ }
478
481
  }
479
482
 
480
483
  // 右上角的选择年份
@@ -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
- height: 32px !important;
555
- line-height: 32px !important;
556
- border-radius: 2px !important;
557
- box-sizing: border-box !important;
558
- border-color: #D9D9D9 !important;
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;