vsyswin-ui 0.2.51 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vsyswin-ui",
3
- "version": "0.2.51",
3
+ "version": "0.2.53",
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) {
@@ -132,15 +132,30 @@
132
132
  </template>
133
133
  <template v-else-if="item.type === 'daterange'">
134
134
  <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)"
135
+ <el-date-picker
136
+ type="daterange"
137
+ v-model="item.value"
138
+ size="small"
139
+ range-separator="至"
140
+ start-placeholder="开始日期"
141
+ end-placeholder="结束日期"
142
+ :editable="false"
143
+ :unlink-panels="true"
144
+ value-format="timestamp"
145
+ @change="handleChangeDateragne(idx, index)"
137
146
  >
138
147
  </el-date-picker>
139
148
  </template>
140
149
  <template v-else-if="item.type === 'month' || item.type === 'year'">
141
150
  <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)">
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
+ >
144
159
  </el-date-picker>
145
160
  </template>
146
161
  <template v-else-if="item.type === 'datetimerange'">
@@ -284,7 +299,10 @@
284
299
  </div>
285
300
  </transition>
286
301
  <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>
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>
288
306
  </div>
289
307
  </div>
290
308
  </template>
@@ -510,6 +528,63 @@ export default {
510
528
  const filterList = this.createTagList()
511
529
  this.$emit('on-search', { keyword: this.keyword, filterList })
512
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
+ },
513
588
  // 清除关键字/选中标签/选中条件
514
589
  handleClearData() {
515
590
  this.conditionValue = ''
@@ -520,19 +595,19 @@ export default {
520
595
  ele.itemList.forEach(item => {
521
596
  item.isActive = !!item.default
522
597
  if (['month', 'year'].includes(item.type)) {
523
- item.value = (item.default && item.defaultValue) ? item.defaultValue : ''
598
+ item.value = item.default && item.defaultValue ? item.defaultValue : ''
524
599
  }
525
600
  if (item.type === 'daterange' || item.type === 'datetimerange') {
526
- item.value = (item.default && item.defaultValue) ? item.defaultValue : null
601
+ item.value = item.default && item.defaultValue ? item.defaultValue : null
527
602
  }
528
603
  if (item.type === 'select') {
529
604
  if (item.default && item.defaultValue) {
530
605
  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
- }
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
+ }
536
611
  } else {
537
612
  item.value = null
538
613
  }
@@ -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;