vsyswin-ui 0.2.69 → 0.2.72

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.69",
3
+ "version": "0.2.72",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
package/packages/index.js CHANGED
@@ -14,11 +14,12 @@ import newSearchBar from './newSearchBar' // 高级筛选
14
14
  import table from './table' // 表格组件
15
15
  import dragSet from './drag-set'
16
16
  import buttonEllipsis from './button-ellipsis'
17
+ import topTabs from './top-tabs'
17
18
  export { default as Progress } from './progress';
18
19
  const { buttonList, buttonItem } = buttonEllipsis
19
20
 
20
21
  // 存储组件列表
21
- const components = [layout, searchTree, selectProject, selectTree, buttonItem, buttonList, SearchBar, simpleSearchBar, inputMore, paging, newSearchBar, table, dragSet]
22
+ const components = [layout, searchTree, selectProject, selectTree, buttonItem, buttonList, SearchBar, simpleSearchBar, inputMore, paging, newSearchBar, table, dragSet, topTabs]
22
23
 
23
24
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
24
25
  const install = function (Vue) {
@@ -49,5 +50,6 @@ export default {
49
50
  paging,
50
51
  newSearchBar,
51
52
  table,
53
+ topTabs,
52
54
  dragSet
53
55
  }
@@ -2,63 +2,92 @@ import NProgress from 'nprogress';
2
2
  import 'nprogress/nprogress.css';
3
3
 
4
4
  const ProgressBar = function (config = {}) {
5
+ // 构造函数配置
5
6
  this.options = Object.assign({
7
+ // 超时时长,超过时长无响应自动完成进度条
6
8
  timeout: 8000,
9
+ // 排除接口,接口路径包含数组中存在的字符串,则请求不启用进度条
7
10
  exclude: ['option/getOptions', 'basicsWebData/getTypeOptions', 'menuName/queryMenuName']
8
11
  }, config);
12
+ // 记录进度条状态
9
13
  this.state = 'done';
14
+ // 原计划用于合并请求时使用,暂时用不到
10
15
  this.isMerge = false;
16
+ // 记录调用start次数
11
17
  this.count = 0;
18
+ // 计计时器
12
19
  this.timer = null;
13
20
  const { timeout, exclude } = this.options;
21
+ // 启动方法,接收2个参数 opt(配置),url(请求路径,用于过滤不启用进度条的请求)
14
22
  this.start = function (opt = {}, url = '') {
15
- if (opt.noProgress) {
23
+ // 如果调用start方法时传入了 noProgress 为 true, 不执行任何操作
24
+ if (opt && opt.noProgress) {
16
25
  return;
17
26
  }
18
27
  this.count++;
28
+ // 过滤不启用进度条的请求
19
29
  const f = exclude.find(it => url.includes(it));
20
30
  if (!f) {
21
31
  if (this.state !== 'start') {
32
+ // 如果状态不是start,才启动进度条,并将状态置位start
22
33
  this.state = 'start';
23
34
  NProgress.start();
24
35
  } else {
36
+ // 如果状态是start,表示进度条已启动,则调用inc将进度条前进随机长度,但不会到100%
25
37
  NProgress.inc();
26
38
  }
27
39
  clearTimeout(this.timer);
40
+ // 如果超时,则自动完成进度条
28
41
  this.timer = setTimeout(() => {
29
42
  NProgress.done();
30
43
  }, timeout);
31
44
  }
32
45
  };
46
+ // 完成方法
33
47
  this.done = function (opt = {}) {
34
- if (opt.noProgress) {
48
+ // 如果调用 done 方法时传入了 noProgress 为 true, 不执行任何操作
49
+ if (opt && opt.noProgress) {
35
50
  return;
36
51
  }
37
52
  if (!this.isMerge) {
53
+ // 如果调用 done 方法时传入了 noEnd 为 true, 即当前done方法中不完成进度条
38
54
  if (opt.noEnd) {
55
+ // 计数减1
39
56
  this.count--;
57
+ // 如果状态是start,则调用inc将进度条前进随机长度,但不会到100%
40
58
  if (this.state === 'start') {
41
59
  NProgress.inc();
42
60
  }
43
61
  return;
44
62
  }
63
+ // 延迟200ms再执行操作
45
64
  setTimeout(() => {
65
+ // 计数减1
46
66
  this.count--;
47
67
  if (this.count <= 0) {
68
+ // 如果计数为0,则表示调用start和调用done方法次数相同,所有请求都已完成
69
+ // 则结束进度条
70
+ // state 置为 done
48
71
  this.state = 'done';
72
+ // 计数置为0
49
73
  this.count = 0;
50
74
  NProgress.done();
51
75
  } else if (this.state === 'start') {
76
+ // 如果计数 大于 0,则表示调用start次数 多余 调用done方法次数,
77
+ // 则表示仍有请求未结束
78
+ // 则调用inc将进度条前进随机长度,但不会到100%
52
79
  NProgress.inc();
53
80
  }
54
81
  }, 200);
55
82
  }
56
83
  };
84
+ // 原计划用于合并请求时使用,暂时用不到
57
85
  this.MStart = function () {
58
86
  this.isMerge = true;
59
87
  this.state = 'start';
60
88
  NProgress.start();
61
89
  };
90
+ // 原计划用于合并请求时使用,暂时用不到
62
91
  this.MDone = function () {
63
92
  this.isMerge = false;
64
93
  this.state = 'done';
@@ -391,7 +391,10 @@ export default {
391
391
  function clickHandler(e) {
392
392
  // 这里判断点击的元素是否是本身,是本身,则返回
393
393
  if (el.contains(e.target)) {
394
- return false
394
+ const btnsBox = el.querySelector('.syswin-searchbar-container__listBtns') // 点击右侧的按钮时也要隐藏所有条件面板
395
+ if (!btnsBox.contains(e.target)) {
396
+ return false
397
+ }
395
398
  }
396
399
  // 判断指令中是否绑定了函数
397
400
  if (binding.expression) {
@@ -415,7 +418,7 @@ export default {
415
418
  saveToLocal: {
416
419
  // 搜索条件保存到本地
417
420
  type: Boolean,
418
- default: true
421
+ default: false
419
422
  },
420
423
  searchList: {
421
424
  type: Array,
@@ -837,7 +840,7 @@ export default {
837
840
  // 先清空所有标签
838
841
  currentSearchList.forEach((ele) => {
839
842
  ele.itemList.forEach((item) => {
840
- item.isActive = false(['daterange', 'monthrange'].includes(item.type)) && (item.value = null)
843
+ item.isActive = ['daterange', 'monthrange'].includes(item.type) && (item.value = null)
841
844
  })
842
845
  })
843
846
 
@@ -854,7 +857,8 @@ export default {
854
857
  v.id === ele.id && ['daterange', 'monthrange'].includes(v.type) && (v.value = ele.value)
855
858
  } else {
856
859
  // 单选
857
- v.isActive = v.id === ele.id[('daterange', 'monthrange')].includes(v.type) && (v.value = v.id === ele.id ? ele.value : null)
860
+ v.isActive = v.id === ele.id
861
+ v.id === ele.id && [('daterange', 'monthrange')].includes(v.type) && (v.value = v.id === ele.id ? ele.value : null)
858
862
  }
859
863
  } else if (v.type === 'slot') {
860
864
  v.setValue && v.setValue({ value: ele.value, name: ele.name, ...ele })
@@ -864,10 +868,13 @@ export default {
864
868
  } else {
865
869
  v.value = ele.value
866
870
  }
871
+ if (ele.value) v.isActive = true
867
872
  } else if (v.type === 'month' || v.type === 'year') {
868
873
  v.value = ele.value
874
+ if (ele.value) v.isActive = true
869
875
  } else if (v.type === 'daterange' || v.type === 'monthrange' || v.type === 'datetimerange') {
870
876
  v.value = ele.value
877
+ if (ele.value.length && ele.value[0]) v.isActive = true
871
878
  }
872
879
  })
873
880
  }
@@ -876,6 +883,8 @@ export default {
876
883
  }
877
884
 
878
885
  this.currentSearchList = currentSearchList
886
+ const tList = this.createTagList()
887
+ this.tagList = tList
879
888
  }
880
889
  },
881
890
  // 编辑保存过滤条件的下拉框选项
@@ -474,3 +474,47 @@ $alien: left, center, right;
474
474
  border-top: 1px solid $borderColor;
475
475
  }
476
476
  }
477
+ .syswin-top-tabs {
478
+ display:inline-block;
479
+ .el-tabs__item {
480
+ color: #131414;
481
+ font-weight: 400 !important;
482
+ font-size: 16px;
483
+ padding: 0 16px !important;
484
+ font-family: PingFang SC-Regular, PingFang SC;
485
+ &:hover {
486
+ color: $primary-color;
487
+ }
488
+ }
489
+ .el-tabs__nav-wrap::after{
490
+ height: 0!important;
491
+ }
492
+ .el-tabs__item:nth-child(2) {
493
+ padding-left: 0px !important;
494
+ }
495
+ .el-tabs__item::after {
496
+ content: '';
497
+ display: inline-block;
498
+ width: 1px;
499
+ height: 20px;
500
+ background-color: #D8DDE5;
501
+ position: relative;
502
+ left: 16px;
503
+ top: 4px;
504
+ }
505
+ .el-tabs__item:last-child::after {
506
+ content: '';
507
+ display: none;
508
+ }
509
+ .is-active {
510
+ color: $primary-color;
511
+ font-weight: 600 !important;
512
+ }
513
+ .el-tabs__active-bar {
514
+ display: none;
515
+ }
516
+ .el-tabs__item:focus.is-active.is-focus:not(:active) {
517
+ -webkit-box-shadow: none!important;
518
+ box-shadow: none!important;
519
+ }
520
+ }
@@ -0,0 +1,10 @@
1
+ // 导入组件
2
+ import topTabs from './src/top-tabs.vue'
3
+
4
+ // 为组件提供 install 安装方法,供按需引入
5
+ topTabs.install = function (Vue) {
6
+ Vue.component(topTabs.name, topTabs)
7
+ }
8
+
9
+ // 默认导出组件
10
+ export default topTabs
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <el-tabs class="syswin-top-tabs" v-model="activeName" @tab-click="handleClick">
3
+ <el-tab-pane v-for="item in tabs" :key="item.name" :label="item.label" :name="item.name"></el-tab-pane>
4
+ </el-tabs>
5
+ </template>
6
+ <script>
7
+ export default {
8
+ name: 'SyTopTabs',
9
+ props: {
10
+ value: {
11
+ type: [Number, String],
12
+ default: ''
13
+ },
14
+ props: {
15
+ type: Object,
16
+ default() {
17
+ return {}
18
+ }
19
+ },
20
+ data: {
21
+ type: Array,
22
+ default() {
23
+ return []
24
+ }
25
+ }
26
+ },
27
+ data() {
28
+ return {
29
+ activeName: ''
30
+ }
31
+ },
32
+ computed: {
33
+ defaultProps() {
34
+ return Object.assign({
35
+ label: 'label',
36
+ name: 'name'
37
+ }, this.props)
38
+ },
39
+ tabs() {
40
+ const { name, label } = this.defaultProps
41
+ return this.data.map(item => {
42
+ return {
43
+ name: item[name],
44
+ label: item[label]
45
+ }
46
+ })
47
+ }
48
+ },
49
+ watch: {
50
+ value(name) {
51
+ this.updateValue(name)
52
+ }
53
+ },
54
+ created() {
55
+ this.updateValue(this.value)
56
+ },
57
+ methods: {
58
+ updateValue(name) {
59
+ if (name !== this.activeName) {
60
+ const tab = this.data.find(it => it.name === name)
61
+ if (tab) {
62
+ this.click(tab)
63
+ }
64
+ }
65
+ },
66
+ handleClick(tab) {
67
+ const { name } = this.defaultProps
68
+ const item = this.data.find(it => it[name] === tab.name)
69
+ this.click(item)
70
+ },
71
+ click(tab) {
72
+ this.activeName = tab.name
73
+ this.$emit('input', tab.name)
74
+ this.$emit('tab-click', tab)
75
+ }
76
+ }
77
+ }
78
+ </script>