vsyswin-ui 0.2.39 → 0.2.43

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.39",
3
+ "version": "0.2.43",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
@@ -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="suffix" name="suffix"></slot>
6
7
  </el-input>
7
8
  <el-button v-if="showFilter" type="text" size="small" class="syswin-searchbar-container__filter" @click="handleToggleFilterList">
8
9
  {{ shrinkFilterList ? '收起筛选' : '更多筛选' }}
@@ -261,6 +262,7 @@
261
262
  <el-button size="small" v-if="saveToLocalPosition === 'right'" class="syswin-footer__save" @click="handleSave">保存</el-button>
262
263
  </div> -->
263
264
  <save-local
265
+ v-if="saveToLocal"
264
266
  @handleSave="handleSave"
265
267
  @handleChangeCondition="handleChangeCondition"
266
268
  @handleEditCondition="handleEditCondition"
@@ -295,23 +297,23 @@ export default {
295
297
  function clickHandler(e) {
296
298
  // 这里判断点击的元素是否是本身,是本身,则返回
297
299
  if (el.contains(e.target)) {
298
- return false;
300
+ return false
299
301
  }
300
302
  // 判断指令中是否绑定了函数
301
303
  if (binding.expression) {
302
304
  // 如果绑定了函数 则调用那个函数,此处binding.value就是handleClose方法
303
- binding.value(e);
305
+ binding.value(e)
304
306
  }
305
307
  }
306
308
  // 给当前元素绑定个私有变量,方便在unbind中可以解除事件监听
307
- el.__vueClickOutside__ = clickHandler;
308
- document.addEventListener('click', clickHandler);
309
+ el.__vueClickOutside__ = clickHandler
310
+ document.addEventListener('click', clickHandler)
309
311
  },
310
- update() { },
312
+ update() {},
311
313
  unbind(el, binding) {
312
314
  // 解除事件监听
313
- document.removeEventListener('click', el.__vueClickOutside__);
314
- delete el.__vueClickOutside__;
315
+ document.removeEventListener('click', el.__vueClickOutside__)
316
+ delete el.__vueClickOutside__
315
317
  }
316
318
  }
317
319
  },
@@ -350,11 +352,12 @@ export default {
350
352
  saveToLocalPosition: {
351
353
  type: String,
352
354
  default: 'right',
353
- validator: function(value) {
355
+ validator: function (value) {
354
356
  return ['left', 'right'].indexOf(value) !== -1
355
357
  }
356
358
  },
357
- customTagList: { // 自定义条件标签的显示
359
+ customTagList: {
360
+ // 自定义条件标签的显示
358
361
  type: Boolean,
359
362
  default: false
360
363
  }
@@ -405,8 +408,8 @@ export default {
405
408
  createTagList() {
406
409
  const list = []
407
410
  this.currentSearchList.length &&
408
- this.currentSearchList.forEach(ele => {
409
- ele.itemList.forEach(item => {
411
+ this.currentSearchList.forEach((ele) => {
412
+ ele.itemList.forEach((item) => {
410
413
  if (item.isActive || item.type === 'slot') {
411
414
  let obj = {
412
415
  pId: ele.id,
@@ -436,10 +439,10 @@ export default {
436
439
  } else if (item.type === 'select') {
437
440
  if (!item.value) return
438
441
  if (item.multiple) {
439
- const valueOptions = item.value.map(x => item.options.find(f => f.value === x))
440
- obj.name = valueOptions.map(x => x.label).join(',')
442
+ const valueOptions = item.value.map((x) => item.options.find((f) => f.value === x))
443
+ obj.name = valueOptions.map((x) => x.label).join(',')
441
444
  } else {
442
- obj.name = item.options.find(x => x.value === item.value).label
445
+ obj.name = item.options.find((x) => x.value === item.value).label
443
446
  }
444
447
  } else if (item.type === 'slot') {
445
448
  const info = item.getValue()
@@ -482,7 +485,8 @@ export default {
482
485
  if (this.shrinkFilterList) {
483
486
  const old = JSON.stringify(this.tagList)
484
487
  const now = JSON.stringify(this.createTagList())
485
- if (old !== now) { // 条件改变后才去执行查询
488
+ if (old !== now) {
489
+ // 条件改变后才去执行查询
486
490
  this.handleSearch(true)
487
491
  }
488
492
  }
@@ -500,8 +504,8 @@ export default {
500
504
  this.keyword = ''
501
505
 
502
506
  const currentSearchList = _.cloneDeep(this.currentSearchList)
503
- currentSearchList.forEach(ele => {
504
- ele.itemList.forEach(item => {
507
+ currentSearchList.forEach((ele) => {
508
+ ele.itemList.forEach((item) => {
505
509
  item.isActive = !!item.default
506
510
  item.type === 'daterange' && (item.value = null)
507
511
  item.type === 'datetimerange' && (item.value = null)
@@ -515,8 +519,8 @@ export default {
515
519
  setDefaultTagList() {
516
520
  const list = []
517
521
  if (this.currentSearchList) {
518
- this.currentSearchList.forEach(ele => {
519
- ele.itemList.forEach(item => {
522
+ this.currentSearchList.forEach((ele) => {
523
+ ele.itemList.forEach((item) => {
520
524
  if (item.default) {
521
525
  // 如果是默认值
522
526
  const obj = {
@@ -546,10 +550,10 @@ export default {
546
550
  } else if (item.type === 'select') {
547
551
  if (!item.defaultValue) return
548
552
  if (item.multiple) {
549
- const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
550
- obj.name = valueOptions.map(x => x.label).join(',')
553
+ const valueOptions = item.defaultValue.map((x) => item.options.find((f) => f.value === x))
554
+ obj.name = valueOptions.map((x) => x.label).join(',')
551
555
  } else {
552
- obj.name = item.options.find(x => x.value === item.defaultValue).label
556
+ obj.name = item.options.find((x) => x.value === item.defaultValue).label
553
557
  }
554
558
  } else if (item.type === 'slot') {
555
559
  // slot选项不设置默认值
@@ -570,7 +574,7 @@ export default {
570
574
  index === childIndex && (item.isActive = !childItem.isActive)
571
575
  } else {
572
576
  // 单选
573
- item.isActive = (index === childIndex ? !childItem.isActive : false)
577
+ item.isActive = index === childIndex ? !childItem.isActive : false
574
578
  ;(item.type === 'daterange' || item.type === 'datetimerange') && (item.value = null)
575
579
  if (item.type === 'select') {
576
580
  item.value = item.multiple ? [] : null
@@ -616,15 +620,15 @@ export default {
616
620
  // 切换保存过滤条件的下拉框
617
621
  handleChangeCondition(value) {
618
622
  this.conditionValue = value
619
- const list = this.conditionList.filter(item => item.value === value)
623
+ const list = this.conditionList.filter((item) => item.value === value)
620
624
  if (list.length) {
621
625
  const currentSearchList = _.cloneDeep(this.currentSearchList)
622
626
  const { keyword = '', filterList = [] } = list[0]
623
627
  this.keyword = keyword
624
628
 
625
629
  // 先清空所有标签
626
- currentSearchList.forEach(ele => {
627
- ele.itemList.forEach(item => {
630
+ currentSearchList.forEach((ele) => {
631
+ ele.itemList.forEach((item) => {
628
632
  item.isActive = false
629
633
  item.type === 'daterange' && (item.value = null)
630
634
  })
@@ -632,10 +636,10 @@ export default {
632
636
 
633
637
  // 设置选中的标签
634
638
  if (filterList && filterList.length) {
635
- filterList.forEach(ele => {
636
- currentSearchList.forEach(item => {
639
+ filterList.forEach((ele) => {
640
+ currentSearchList.forEach((item) => {
637
641
  if (ele.pId === item.id) {
638
- item.itemList.forEach(v => {
642
+ item.itemList.forEach((v) => {
639
643
  if (v.type === 'slot') {
640
644
  v.setValue({ value: ele.value, name: ele.name, ...ele })
641
645
  }
@@ -672,7 +676,7 @@ export default {
672
676
  let localList = localStorage.getItem(`syswin${this.storageName}`)
673
677
  if (!['', undefined, null].includes(localList)) {
674
678
  localList = JSON.parse(localList)
675
- const idx = localList.findIndex(ele => ele.value === item.value)
679
+ const idx = localList.findIndex((ele) => ele.value === item.value)
676
680
  idx > -1 && localList.splice(idx, 1)
677
681
  localList.length > 0
678
682
  ? localStorage.setItem(`syswin${this.storageName}`, JSON.stringify(localList))
@@ -693,7 +697,7 @@ export default {
693
697
  this.conditionValue = momentValue
694
698
  } else {
695
699
  // 编辑
696
- const index = this.conditionList.findIndex(ele => ele.value === this.currentData.value)
700
+ const index = this.conditionList.findIndex((ele) => ele.value === this.currentData.value)
697
701
  const item = this.conditionList[index]
698
702
  item.label = label
699
703
  this.$set(this.conditionList, index, item)
@@ -703,13 +707,14 @@ export default {
703
707
  handleClickOutside(e) {
704
708
  // console.log(e)
705
709
  const target = e.target
706
- if (target.classList.contains('el-dialog__wrapper')) { // 点击弹窗遮罩时不隐藏
710
+ if (target.classList.contains('el-dialog__wrapper')) {
711
+ // 点击弹窗遮罩时不隐藏
707
712
  return false
708
713
  }
709
714
  const conditionDialog = document.querySelector('.syswin-searchbar-dialog') // 条件设置的弹窗
710
715
  const deleteConfirm = document.querySelector('.el-message-box.syswin-searchbar-confirm') // 条件设置的删除弹窗
711
716
  if (conditionDialog && conditionDialog.contains(target)) {
712
- return false
717
+ return false
713
718
  }
714
719
  if (deleteConfirm && deleteConfirm.contains(target)) {
715
720
  return false
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="ztree-box">
3
- <div class="ztree-search" v-if="!searchable">
3
+ <div class="ztree-search" v-if="searchable">
4
4
  <div class="ztree-search-wrapper" :class="searchClass">
5
5
  <div class="icon"></div>
6
6
  <div class="input-box">
@@ -76,7 +76,7 @@ export default {
76
76
  searchable: {
77
77
  type: Boolean,
78
78
  required: false,
79
- default: false
79
+ default: true
80
80
  },
81
81
  placeholder: {
82
82
  type: String,