vsyswin-ui 0.2.68 → 0.2.71

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.68",
3
+ "version": "0.2.71",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
@@ -22,6 +22,7 @@
22
22
  "jquery": "^3.5.1",
23
23
  "lodash": "^4.17.20",
24
24
  "moment": "^2.29.1",
25
+ "nprogress": "^0.2.0",
25
26
  "throttle-debounce": "^3.0.1",
26
27
  "vue": "^2.6.12",
27
28
  "vuedraggable": "^2.23.2"
@@ -44,4 +45,4 @@
44
45
  "vue-template-compiler": "^2.6.11",
45
46
  "xe-utils": "^3.0.4"
46
47
  }
47
- }
48
+ }
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
-
17
+ import topTabs from './top-tabs'
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
  }
@@ -0,0 +1,98 @@
1
+ import NProgress from 'nprogress';
2
+ import 'nprogress/nprogress.css';
3
+
4
+ const ProgressBar = function (config = {}) {
5
+ // 构造函数配置
6
+ this.options = Object.assign({
7
+ // 超时时长,超过时长无响应自动完成进度条
8
+ timeout: 8000,
9
+ // 排除接口,接口路径包含数组中存在的字符串,则请求不启用进度条
10
+ exclude: ['option/getOptions', 'basicsWebData/getTypeOptions', 'menuName/queryMenuName']
11
+ }, config);
12
+ // 记录进度条状态
13
+ this.state = 'done';
14
+ // 原计划用于合并请求时使用,暂时用不到
15
+ this.isMerge = false;
16
+ // 记录调用start次数
17
+ this.count = 0;
18
+ // 计计时器
19
+ this.timer = null;
20
+ const { timeout, exclude } = this.options;
21
+ // 启动方法,接收2个参数 opt(配置),url(请求路径,用于过滤不启用进度条的请求)
22
+ this.start = function (opt = {}, url = '') {
23
+ // 如果调用start方法时传入了 noProgress 为 true, 不执行任何操作
24
+ if (opt && opt.noProgress) {
25
+ return;
26
+ }
27
+ this.count++;
28
+ // 过滤不启用进度条的请求
29
+ const f = exclude.find(it => url.includes(it));
30
+ if (!f) {
31
+ if (this.state !== 'start') {
32
+ // 如果状态不是start,才启动进度条,并将状态置位start
33
+ this.state = 'start';
34
+ NProgress.start();
35
+ } else {
36
+ // 如果状态是start,表示进度条已启动,则调用inc将进度条前进随机长度,但不会到100%
37
+ NProgress.inc();
38
+ }
39
+ clearTimeout(this.timer);
40
+ // 如果超时,则自动完成进度条
41
+ this.timer = setTimeout(() => {
42
+ NProgress.done();
43
+ }, timeout);
44
+ }
45
+ };
46
+ // 完成方法
47
+ this.done = function (opt = {}) {
48
+ // 如果调用 done 方法时传入了 noProgress 为 true, 不执行任何操作
49
+ if (opt && opt.noProgress) {
50
+ return;
51
+ }
52
+ if (!this.isMerge) {
53
+ // 如果调用 done 方法时传入了 noEnd 为 true, 即当前done方法中不完成进度条
54
+ if (opt.noEnd) {
55
+ // 计数减1
56
+ this.count--;
57
+ // 如果状态是start,则调用inc将进度条前进随机长度,但不会到100%
58
+ if (this.state === 'start') {
59
+ NProgress.inc();
60
+ }
61
+ return;
62
+ }
63
+ // 延迟200ms再执行操作
64
+ setTimeout(() => {
65
+ // 计数减1
66
+ this.count--;
67
+ if (this.count <= 0) {
68
+ // 如果计数为0,则表示调用start和调用done方法次数相同,所有请求都已完成
69
+ // 则结束进度条
70
+ // state 置为 done
71
+ this.state = 'done';
72
+ // 计数置为0
73
+ this.count = 0;
74
+ NProgress.done();
75
+ } else if (this.state === 'start') {
76
+ // 如果计数 大于 0,则表示调用start次数 多余 调用done方法次数,
77
+ // 则表示仍有请求未结束
78
+ // 则调用inc将进度条前进随机长度,但不会到100%
79
+ NProgress.inc();
80
+ }
81
+ }, 200);
82
+ }
83
+ };
84
+ // 原计划用于合并请求时使用,暂时用不到
85
+ this.MStart = function () {
86
+ this.isMerge = true;
87
+ this.state = 'start';
88
+ NProgress.start();
89
+ };
90
+ // 原计划用于合并请求时使用,暂时用不到
91
+ this.MDone = function () {
92
+ this.isMerge = false;
93
+ this.state = 'done';
94
+ NProgress.done();
95
+ };
96
+ };
97
+
98
+ export default ProgressBar
@@ -837,7 +837,7 @@ export default {
837
837
  // 先清空所有标签
838
838
  currentSearchList.forEach((ele) => {
839
839
  ele.itemList.forEach((item) => {
840
- item.isActive = false(['daterange', 'monthrange'].includes(item.type)) && (item.value = null)
840
+ item.isActive = (['daterange', 'monthrange'].includes(item.type)) && (item.value = null)
841
841
  })
842
842
  })
843
843
 
@@ -854,7 +854,7 @@ export default {
854
854
  v.id === ele.id && ['daterange', 'monthrange'].includes(v.type) && (v.value = ele.value)
855
855
  } else {
856
856
  // 单选
857
- v.isActive = v.id === ele.id[('daterange', 'monthrange')].includes(v.type) && (v.value = v.id === ele.id ? ele.value : null)
857
+ v.isActive = v.id === ele.id && [('daterange', 'monthrange')].includes(v.type) && (v.value = v.id === ele.id ? ele.value : null)
858
858
  }
859
859
  } else if (v.type === 'slot') {
860
860
  v.setValue && v.setValue({ value: ele.value, name: ele.name, ...ele })
@@ -864,10 +864,13 @@ export default {
864
864
  } else {
865
865
  v.value = ele.value
866
866
  }
867
+ if (ele.value) v.isActive = true
867
868
  } else if (v.type === 'month' || v.type === 'year') {
868
869
  v.value = ele.value
870
+ if (ele.value) v.isActive = true
869
871
  } else if (v.type === 'daterange' || v.type === 'monthrange' || v.type === 'datetimerange') {
870
872
  v.value = ele.value
873
+ if (ele.value.length && ele.value[0]) v.isActive = true
871
874
  }
872
875
  })
873
876
  }
@@ -876,6 +879,8 @@ export default {
876
879
  }
877
880
 
878
881
  this.currentSearchList = currentSearchList
882
+ const tList = this.createTagList()
883
+ this.tagList = tList
879
884
  }
880
885
  },
881
886
  // 编辑保存过滤条件的下拉框选项
@@ -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>