vsyswin-ui 0.2.40 → 0.2.44

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.40",
3
+ "version": "0.2.44",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
package/packages/index.js CHANGED
@@ -7,19 +7,20 @@ import selectProject from './select-project' // 项目选择组件
7
7
  import selectTree from './select-tree' // 表单树选择器
8
8
  import SearchBar from './search-bar' // 搜索工具栏
9
9
  import simpleSearchBar from './simple-search-bar' // 简单搜索栏组件
10
+ import paging from './paging'
10
11
  import newSearchBar from './newSearchBar' // 高级筛选
11
12
  import table from './table' // 表格组件
12
13
  import dragSet from './drag-set'
13
14
 
14
15
  // 存储组件列表
15
- const components = [layout, searchTree, selectProject, selectTree, SearchBar, simpleSearchBar, newSearchBar, table, dragSet]
16
+ const components = [layout, searchTree, selectProject, selectTree, SearchBar, simpleSearchBar, paging, newSearchBar, table, dragSet]
16
17
 
17
18
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
18
- const install = function(Vue) {
19
+ const install = function (Vue) {
19
20
  // 判断是否可以安装
20
21
  if (install.installed) return
21
22
  // 遍历注册全局组件
22
- components.map(component => Vue.component(component.name, component))
23
+ components.map((component) => Vue.component(component.name, component))
23
24
  }
24
25
 
25
26
  // 判断是否是直接引入文件
@@ -37,6 +38,7 @@ export default {
37
38
  selectTree,
38
39
  SearchBar,
39
40
  simpleSearchBar,
41
+ paging,
40
42
  newSearchBar,
41
43
  table,
42
44
  dragSet
@@ -0,0 +1,10 @@
1
+ // 导入组件
2
+ import paging from './src/paging.vue'
3
+
4
+ // 为组件提供 install 安装方法,供按需引入
5
+ paging.install = function (Vue) {
6
+ Vue.component(paging.name, paging)
7
+ }
8
+
9
+ // 默认导出组件
10
+ export default paging
@@ -0,0 +1,86 @@
1
+ <!-- 分页组件 -->
2
+ <template>
3
+ <div :style="alignStyle">
4
+ <el-pagination
5
+ class="cus-pagination"
6
+ background
7
+ prev-text="上一页"
8
+ next-text="下一页"
9
+ size="small"
10
+ @size-change="handleSizeChange"
11
+ @current-change="handlePageChange"
12
+ :current-page="pagination.currentPage"
13
+ :page-sizes="pageSizes"
14
+ :page-size="pagination.pageSize"
15
+ :layout="layout"
16
+ :total="pagination.totals"
17
+ >
18
+ <slot>
19
+ <span class="el-pagination__total">总共 {{ pagination.totals }} 条,{{ Math.ceil(pagination.totals / pagination.pageSize) }} 页</span>
20
+ </slot>
21
+ </el-pagination>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ /*
27
+ pagination: {
28
+ currentPage: 1,
29
+ pageSize: 20,
30
+ totals: 0
31
+ }
32
+ */
33
+ export default {
34
+ name: 'SyPaging',
35
+ props: {
36
+ align: {
37
+ type: String,
38
+ default: 'right',
39
+ validator: function (value) {
40
+ return ['left', 'center', 'right'].indexOf(value) !== -1
41
+ }
42
+ },
43
+ layout: {
44
+ type: String,
45
+ default: 'slot, prev, pager, next, sizes, jumper'
46
+ },
47
+ pagination: {
48
+ type: Object,
49
+ required: true
50
+ },
51
+ pageSizes: {
52
+ type: Array,
53
+ default() {
54
+ return [10, 20, 50, 100, 200]
55
+ }
56
+ }
57
+ },
58
+ computed: {
59
+ alignStyle() {
60
+ return {
61
+ 'text-align': this.align
62
+ }
63
+ }
64
+ },
65
+ methods: {
66
+ // 每页数量发生改变
67
+ handleSizeChange(val) {
68
+ const { currentPage, totals } = this.pagination
69
+ const maxNum = Math.ceil(totals / val)
70
+ this.pagination.currentPage = maxNum < currentPage ? maxNum : currentPage
71
+ this.pagination.pageSize = val
72
+ this.handleChange('pageSize')
73
+ },
74
+ // 页码发生改变
75
+ handlePageChange(val) {
76
+ this.pagination.currentPage = val
77
+ this.handleChange('currentPage')
78
+ },
79
+
80
+ handleChange(type) {
81
+ const { currentPage, pageSize } = this.pagination
82
+ this.$emit('change', { currentPage, pageSize }, type)
83
+ }
84
+ }
85
+ }
86
+ </script>
@@ -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 ? '收起筛选' : '更多筛选' }}
@@ -351,7 +352,7 @@ export default {
351
352
  saveToLocalPosition: {
352
353
  type: String,
353
354
  default: 'right',
354
- validator: function(value) {
355
+ validator: function (value) {
355
356
  return ['left', 'right'].indexOf(value) !== -1
356
357
  }
357
358
  },
@@ -407,8 +408,8 @@ export default {
407
408
  createTagList() {
408
409
  const list = []
409
410
  this.currentSearchList.length &&
410
- this.currentSearchList.forEach(ele => {
411
- ele.itemList.forEach(item => {
411
+ this.currentSearchList.forEach((ele) => {
412
+ ele.itemList.forEach((item) => {
412
413
  if (item.isActive || item.type === 'slot') {
413
414
  let obj = {
414
415
  pId: ele.id,
@@ -438,10 +439,10 @@ export default {
438
439
  } else if (item.type === 'select') {
439
440
  if (!item.value) return
440
441
  if (item.multiple) {
441
- const valueOptions = item.value.map(x => item.options.find(f => f.value === x))
442
- 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(',')
443
444
  } else {
444
- obj.name = item.options.find(x => x.value === item.value).label
445
+ obj.name = item.options.find((x) => x.value === item.value).label
445
446
  }
446
447
  } else if (item.type === 'slot') {
447
448
  const info = item.getValue()
@@ -503,8 +504,8 @@ export default {
503
504
  this.keyword = ''
504
505
 
505
506
  const currentSearchList = _.cloneDeep(this.currentSearchList)
506
- currentSearchList.forEach(ele => {
507
- ele.itemList.forEach(item => {
507
+ currentSearchList.forEach((ele) => {
508
+ ele.itemList.forEach((item) => {
508
509
  item.isActive = !!item.default
509
510
  item.type === 'daterange' && (item.value = null)
510
511
  item.type === 'datetimerange' && (item.value = null)
@@ -518,8 +519,8 @@ export default {
518
519
  setDefaultTagList() {
519
520
  const list = []
520
521
  if (this.currentSearchList) {
521
- this.currentSearchList.forEach(ele => {
522
- ele.itemList.forEach(item => {
522
+ this.currentSearchList.forEach((ele) => {
523
+ ele.itemList.forEach((item) => {
523
524
  if (item.default) {
524
525
  // 如果是默认值
525
526
  const obj = {
@@ -549,10 +550,10 @@ export default {
549
550
  } else if (item.type === 'select') {
550
551
  if (!item.defaultValue) return
551
552
  if (item.multiple) {
552
- const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
553
- 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(',')
554
555
  } else {
555
- obj.name = item.options.find(x => x.value === item.defaultValue).label
556
+ obj.name = item.options.find((x) => x.value === item.defaultValue).label
556
557
  }
557
558
  } else if (item.type === 'slot') {
558
559
  // slot选项不设置默认值
@@ -619,15 +620,15 @@ export default {
619
620
  // 切换保存过滤条件的下拉框
620
621
  handleChangeCondition(value) {
621
622
  this.conditionValue = value
622
- const list = this.conditionList.filter(item => item.value === value)
623
+ const list = this.conditionList.filter((item) => item.value === value)
623
624
  if (list.length) {
624
625
  const currentSearchList = _.cloneDeep(this.currentSearchList)
625
626
  const { keyword = '', filterList = [] } = list[0]
626
627
  this.keyword = keyword
627
628
 
628
629
  // 先清空所有标签
629
- currentSearchList.forEach(ele => {
630
- ele.itemList.forEach(item => {
630
+ currentSearchList.forEach((ele) => {
631
+ ele.itemList.forEach((item) => {
631
632
  item.isActive = false
632
633
  item.type === 'daterange' && (item.value = null)
633
634
  })
@@ -635,10 +636,10 @@ export default {
635
636
 
636
637
  // 设置选中的标签
637
638
  if (filterList && filterList.length) {
638
- filterList.forEach(ele => {
639
- currentSearchList.forEach(item => {
639
+ filterList.forEach((ele) => {
640
+ currentSearchList.forEach((item) => {
640
641
  if (ele.pId === item.id) {
641
- item.itemList.forEach(v => {
642
+ item.itemList.forEach((v) => {
642
643
  if (v.type === 'slot') {
643
644
  v.setValue({ value: ele.value, name: ele.name, ...ele })
644
645
  }
@@ -675,7 +676,7 @@ export default {
675
676
  let localList = localStorage.getItem(`syswin${this.storageName}`)
676
677
  if (!['', undefined, null].includes(localList)) {
677
678
  localList = JSON.parse(localList)
678
- const idx = localList.findIndex(ele => ele.value === item.value)
679
+ const idx = localList.findIndex((ele) => ele.value === item.value)
679
680
  idx > -1 && localList.splice(idx, 1)
680
681
  localList.length > 0
681
682
  ? localStorage.setItem(`syswin${this.storageName}`, JSON.stringify(localList))
@@ -696,7 +697,7 @@ export default {
696
697
  this.conditionValue = momentValue
697
698
  } else {
698
699
  // 编辑
699
- const index = this.conditionList.findIndex(ele => ele.value === this.currentData.value)
700
+ const index = this.conditionList.findIndex((ele) => ele.value === this.currentData.value)
700
701
  const item = this.conditionList[index]
701
702
  item.label = label
702
703
  this.$set(this.conditionList, index, item)
@@ -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,