vue2-client 1.15.138 → 1.15.141

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.
@@ -523,6 +523,11 @@ export default {
523
523
  externalSelectedRowKeys: {
524
524
  type: Array,
525
525
  default: () => []
526
+ },
527
+ // 是否使用自定义分页样式
528
+ customPagination: {
529
+ type: Boolean,
530
+ default: false
526
531
  }
527
532
  },
528
533
  computed: {
@@ -150,6 +150,7 @@
150
150
  :scroll="{ x: tableContext.scrollXWidth, y: tableContext.scrollYHeight }"
151
151
  :showPagination="tableContext.showPagination"
152
152
  :hidePagination="tableContext.simpleMode"
153
+ :customPagination="tableContext.customPagination"
153
154
  :showSelected="!tableContext.simpleMode"
154
155
  :pageSize="tableContext.simpleMode ? 1000 : undefined"
155
156
  :pageMaxSize="tableContext.pageMaxSize"
@@ -1,119 +1,119 @@
1
- <template>
2
- <div class="table-container" :style="{ height: tableHeight }">
3
- <a-table
4
- :columns="processedColumns"
5
- :dataSource="tableData"
6
- :pagination="false"
7
- :bordered="false"
8
- :rowKey="rowKey"
9
- :scroll="{ y: scrollY }"
10
- />
11
- </div>
12
- </template>
13
-
14
- <script>
15
- import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
16
-
17
- export default {
18
- props: {
19
- queryParamsName: String,
20
- rowKey: {
21
- type: String,
22
- default: 'id'
23
- },
24
- parameter: {
25
- type: Object,
26
- default: () => ({})
27
- }
28
- },
29
- data () {
30
- return {
31
- columns: [],
32
- tableData: [],
33
- tableHeight: 'auto', // 默认高度
34
- scrollY: undefined
35
- }
36
- },
37
- watch: {
38
- queryParamsName: {
39
- immediate: true,
40
- handler (val) {
41
- val && this.init(val, this.parameter)
42
- }
43
- }
44
- },
45
- computed: {
46
- processedColumns () {
47
- return this.columns.map(column => ({
48
- ...column,
49
- customHeaderCell: column.headerStyle
50
- ? () => ({ style: column.headerStyle })
51
- : undefined
52
- }))
53
- }
54
- },
55
- methods: {
56
- init (config, parameterData) {
57
- getConfigByName(config, 'af-his', res => {
58
- // 从配置中获取表格高度
59
- this.tableHeight = res.tableHeight || '400px' // 默认400px
60
- this.columns = res.columns || []
61
-
62
- runLogic(res.logicName, parameterData, 'af-his').then(result => {
63
- this.tableData = result.map((item, index) => ({
64
- ...item,
65
- key: item[this.rowKey] || `row_${index}`
66
- }))
67
-
68
- this.$nextTick(() => {
69
- this.scrollY = this.tableHeight
70
- })
71
- })
72
- })
73
- }
74
- }
75
- }
76
- </script>
77
-
78
- <style scoped>
79
- /* 表格容器 */
80
- .table-container {
81
- overflow: hidden;
82
- display: flex;
83
- flex-direction: column;
84
- }
85
-
86
- /* 基础无边框样式 */
87
- /deep/ .ant-table {
88
- border: none !important;
89
- flex: 1;
90
- display: flex;
91
- flex-direction: column;
92
- }
93
-
94
- /deep/ .ant-table-content {
95
- flex: 1;
96
- display: flex;
97
- flex-direction: column;
98
- }
99
-
100
- /deep/ .ant-table-body {
101
- flex: 1;
102
- overflow-y: auto !important;
103
- }
104
-
105
- /deep/ .ant-table-tbody > tr > td {
106
- border-bottom: none !important;
107
- padding: 6px !important;
108
- }
109
-
110
- /deep/ .ant-table-thead > tr > th {
111
- border-bottom: none !important;
112
- background: none !important;
113
- padding: 8px 6px !important;
114
- position: sticky;
115
- top: 0;
116
- z-index: 1;
117
- background-color: white !important;
118
- }
119
- </style>
1
+ <template>
2
+ <div class="table-container" :style="{ height: tableHeight }">
3
+ <a-table
4
+ :columns="processedColumns"
5
+ :dataSource="tableData"
6
+ :pagination="false"
7
+ :bordered="false"
8
+ :rowKey="rowKey"
9
+ :scroll="{ y: scrollY }"
10
+ />
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
16
+
17
+ export default {
18
+ props: {
19
+ queryParamsName: String,
20
+ rowKey: {
21
+ type: String,
22
+ default: 'id'
23
+ },
24
+ parameter: {
25
+ type: Object,
26
+ default: () => ({})
27
+ }
28
+ },
29
+ data () {
30
+ return {
31
+ columns: [],
32
+ tableData: [],
33
+ tableHeight: 'auto', // 默认高度
34
+ scrollY: undefined
35
+ }
36
+ },
37
+ watch: {
38
+ queryParamsName: {
39
+ immediate: true,
40
+ handler (val) {
41
+ val && this.init(val, this.parameter)
42
+ }
43
+ }
44
+ },
45
+ computed: {
46
+ processedColumns () {
47
+ return this.columns.map(column => ({
48
+ ...column,
49
+ customHeaderCell: column.headerStyle
50
+ ? () => ({ style: column.headerStyle })
51
+ : undefined
52
+ }))
53
+ }
54
+ },
55
+ methods: {
56
+ init (config, parameterData) {
57
+ getConfigByName(config, 'af-his', res => {
58
+ // 从配置中获取表格高度
59
+ this.tableHeight = res.tableHeight || '400px' // 默认400px
60
+ this.columns = res.columns || []
61
+
62
+ runLogic(res.logicName, parameterData, 'af-his').then(result => {
63
+ this.tableData = result.map((item, index) => ({
64
+ ...item,
65
+ key: item[this.rowKey] || `row_${index}`
66
+ }))
67
+
68
+ this.$nextTick(() => {
69
+ this.scrollY = this.tableHeight
70
+ })
71
+ })
72
+ })
73
+ }
74
+ }
75
+ }
76
+ </script>
77
+
78
+ <style scoped>
79
+ /* 表格容器 */
80
+ .table-container {
81
+ overflow: hidden;
82
+ display: flex;
83
+ flex-direction: column;
84
+ }
85
+
86
+ /* 基础无边框样式 */
87
+ /deep/ .ant-table {
88
+ border: none !important;
89
+ flex: 1;
90
+ display: flex;
91
+ flex-direction: column;
92
+ }
93
+
94
+ /deep/ .ant-table-content {
95
+ flex: 1;
96
+ display: flex;
97
+ flex-direction: column;
98
+ }
99
+
100
+ /deep/ .ant-table-body {
101
+ flex: 1;
102
+ overflow-y: auto !important;
103
+ }
104
+
105
+ /deep/ .ant-table-tbody > tr > td {
106
+ border-bottom: none !important;
107
+ padding: 6px !important;
108
+ }
109
+
110
+ /deep/ .ant-table-thead > tr > th {
111
+ border-bottom: none !important;
112
+ background: none !important;
113
+ padding: 8px 6px !important;
114
+ position: sticky;
115
+ top: 0;
116
+ z-index: 1;
117
+ background-color: white !important;
118
+ }
119
+ </style>
@@ -102,6 +102,11 @@ export default {
102
102
  type: Number,
103
103
  default: null
104
104
  },
105
+ // 是否使用自定义分页样式
106
+ customPagination: {
107
+ type: Boolean,
108
+ default: false
109
+ },
105
110
  // 行样式函数,用于控制每行的样式类型
106
111
  rowStyleFunction: {
107
112
  type: [Function, String],
@@ -512,29 +517,119 @@ export default {
512
517
  {this.$slots.fixedfooter}
513
518
  </a-col>
514
519
  <a-col flex="0 0">
515
- <a-pagination
516
- total={this.localPagination.total}
517
- onChange={(page, pageSize) => {
518
- this.pageSize = pageSize
519
- this.pageNum = page
520
- this.loadData({
521
- current: page,
522
- pageSize: pageSize
523
- })
524
- }
525
- }
526
- onShowSizeChange={(page, pageSize) => {
527
- this.pageSize = pageSize
528
- this.pageNum = page
529
- this.loadData({
530
- current: page,
531
- pageSize: pageSize
532
- })
533
- }
534
- }
535
- show-total={(total, range) => range[0] === range[1] ? `${range[0]} | 共 ${total} 项` : `${range[0]}-${range[1]} | 共 ${total} 项`}
536
- default-current={this.localPagination.current}
537
- showSizeChanger={this.localPagination.showSizeChanger}/>
520
+ {this.customPagination ? (
521
+ <div class="custom-pagination-container">
522
+ {/* 首页按钮 */}
523
+ <div
524
+ class={['custom-pagination-btn', { disabled: this.localPagination.current === 1 }]}
525
+ onClick={() => {
526
+ if (this.localPagination.current > 1) {
527
+ this.pageSize = this.localPagination.pageSize
528
+ this.pageNum = 1
529
+ this.loadData({
530
+ current: 1,
531
+ pageSize: this.localPagination.pageSize
532
+ })
533
+ }
534
+ }}
535
+ >
536
+ <span class="custom-pagination-icon icon-rotate-right">⌅</span>
537
+ </div>
538
+
539
+ {/* 上一页按钮 */}
540
+ <div
541
+ class={['custom-pagination-btn', { disabled: this.localPagination.current === 1 }]}
542
+ onClick={() => {
543
+ if (this.localPagination.current > 1) {
544
+ this.pageSize = this.localPagination.pageSize
545
+ this.pageNum = this.localPagination.current - 1
546
+ this.loadData({
547
+ current: this.localPagination.current - 1,
548
+ pageSize: this.localPagination.pageSize
549
+ })
550
+ }
551
+ }}
552
+ >
553
+ &lt;
554
+ </div>
555
+
556
+ {/* 当前页按钮 */}
557
+ <div class="custom-pagination-btn active">
558
+ {this.localPagination.current}
559
+ </div>
560
+
561
+ {/* 下一页按钮 */}
562
+ <div
563
+ class={['custom-pagination-btn', { disabled: this.localPagination.current === ((this.localPagination && this.localPagination.pageSize) ? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1))) : 0) || !((this.localPagination && this.localPagination.pageSize) ? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1))) : 0) }]}
564
+ onClick={() => {
565
+ const totalPages = (this.localPagination && this.localPagination.pageSize)
566
+ ? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1)))
567
+ : 0
568
+ if (totalPages > 0 && this.localPagination.current < totalPages) {
569
+ this.pageSize = this.localPagination.pageSize
570
+ this.pageNum = this.localPagination.current + 1
571
+ this.loadData({
572
+ current: this.localPagination.current + 1,
573
+ pageSize: this.localPagination.pageSize
574
+ })
575
+ }
576
+ }}
577
+ >
578
+ &gt;
579
+ </div>
580
+
581
+ {/* 末页按钮 */}
582
+ <div
583
+ class={['custom-pagination-btn', { disabled: this.localPagination.current === ((this.localPagination && this.localPagination.pageSize) ? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1))) : 0) || !((this.localPagination && this.localPagination.pageSize) ? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1))) : 0) }]}
584
+ onClick={() => {
585
+ const totalPages = (this.localPagination && this.localPagination.pageSize)
586
+ ? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1)))
587
+ : 0
588
+ if (totalPages > 0 && this.localPagination.current < totalPages) {
589
+ this.pageSize = this.localPagination.pageSize
590
+ this.pageNum = totalPages
591
+ this.loadData({
592
+ current: totalPages,
593
+ pageSize: this.localPagination.pageSize
594
+ })
595
+ }
596
+ }}
597
+ >
598
+ <span class="custom-pagination-icon icon-rotate-left">⌅</span>
599
+ </div>
600
+
601
+ {/* 分页信息 */}
602
+ <div class="custom-pagination-info">
603
+ 共{(this.localPagination && this.localPagination.pageSize)
604
+ ? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1)))
605
+ : 0}页, {(this.localPagination && typeof this.localPagination.total !== 'undefined') ? this.localPagination.total : 0}条
606
+ </div>
607
+ </div>
608
+ ) : (
609
+ <a-pagination
610
+ total={this.localPagination.total}
611
+ onChange={(page, pageSize) => {
612
+ this.pageSize = pageSize
613
+ this.pageNum = page
614
+ this.loadData({
615
+ current: page,
616
+ pageSize: pageSize
617
+ })
618
+ }
619
+ }
620
+ onShowSizeChange={(page, pageSize) => {
621
+ this.pageSize = pageSize
622
+ this.pageNum = page
623
+ this.loadData({
624
+ current: page,
625
+ pageSize: pageSize
626
+ })
627
+ }
628
+ }
629
+ show-total={(total, range) => range[0] === range[1] ? `${range[0]} | 共 ${total} 项` : `${range[0]}-${range[1]} | 共 ${total} 项`}
630
+ default-current={this.localPagination.current}
631
+ showSizeChanger={this.localPagination.showSizeChanger}/>
632
+ )}
538
633
  </a-col>
539
634
  </a-row>
540
635
  )
@@ -553,3 +648,85 @@ export default {
553
648
  )
554
649
  }
555
650
  }
651
+
652
+ // 添加自定义分页样式
653
+ const customPaginationStyles = `
654
+ <style>
655
+ .custom-pagination-container {
656
+ display: flex;
657
+ align-items: center;
658
+ gap: 8px;
659
+ }
660
+
661
+ .custom-pagination-btn {
662
+ width: 32px;
663
+ height: 32px;
664
+ border: 1px solid #d9d9d9;
665
+ border-radius: 6px;
666
+ background: #fafafa;
667
+ color: #5D5C5C;
668
+ font-size: 14px;
669
+ font-weight: 500;
670
+ display: flex;
671
+ align-items: center;
672
+ justify-content: center;
673
+ cursor: pointer;
674
+ transition: all 0.3s;
675
+ user-select: none;
676
+ }
677
+
678
+ .custom-pagination-btn:hover {
679
+ border-color: #0057FE;
680
+ color: #0057FE;
681
+ }
682
+
683
+ .custom-pagination-btn.active {
684
+ background: #0057FE;
685
+ border-color: #0057FE;
686
+ color: #fff;
687
+ }
688
+
689
+ .custom-pagination-btn.disabled {
690
+ background: #f5f5f5;
691
+ border-color: #d9d9d9;
692
+ color: #bfbfbf;
693
+ cursor: not-allowed;
694
+ }
695
+
696
+ .custom-pagination-btn.disabled:hover {
697
+ border-color: #d9d9d9;
698
+ color: #bfbfbf;
699
+ }
700
+
701
+ .custom-pagination-info {
702
+ margin-left: 16px;
703
+ color: #666;
704
+ font-size: 14px;
705
+ white-space: nowrap;
706
+ }
707
+
708
+ /* 自定义图标与旋转方向 */
709
+ .custom-pagination-icon {
710
+ display: inline-block;
711
+ line-height: 1;
712
+ transform-origin: center;
713
+ }
714
+ .icon-rotate-left {
715
+ transform: rotate(90deg);
716
+ }
717
+ .icon-rotate-right {
718
+ transform: rotate(-90deg);
719
+ }
720
+ </style>
721
+ `
722
+
723
+ // 将样式注入到页面
724
+ if (typeof document !== 'undefined') {
725
+ const styleId = 'custom-pagination-styles'
726
+ if (!document.getElementById(styleId)) {
727
+ const styleElement = document.createElement('style')
728
+ styleElement.id = styleId
729
+ styleElement.textContent = customPaginationStyles.replace('<style>', '').replace('</style>', '')
730
+ document.head.appendChild(styleElement)
731
+ }
732
+ }