vue2-client 1.15.138 → 1.15.139

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": "vue2-client",
3
- "version": "1.15.138",
3
+ "version": "1.15.139",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'
3
- import { ref } from 'vue'
3
+ import { ref, computed } from 'vue'
4
4
 
5
- defineProps({
5
+ const props = defineProps({
6
6
  // HFormTable特有的属性
7
7
  tableStyle: {
8
8
  type: String,
@@ -18,6 +18,9 @@ defineExpose({
18
18
  // 为了兼容性,保留getXFormTableInstance方法
19
19
  getXFormTableInstance: () => xFormTableRef.value
20
20
  })
21
+
22
+ // 计算是否使用自定义分页
23
+ const isCustomPagination = computed(() => props.tableStyle === 'custom-pagination')
21
24
  </script>
22
25
 
23
26
  <template>
@@ -30,6 +33,7 @@ defineExpose({
30
33
  <x-form-table
31
34
  ref="xFormTableRef"
32
35
  v-bind="$attrs"
36
+ :customPagination="isCustomPagination"
33
37
  v-on="$listeners"
34
38
  >
35
39
  <template v-for="(_, name) in $slots" #[name]="slotData">
@@ -161,8 +165,10 @@ defineExpose({
161
165
  }
162
166
  }
163
167
  }
164
- // 底部分页居中
165
- &.h-form-table-bottom-center {
168
+
169
+ // 底部分页居中 & 自定义分页样式(共用样式)
170
+ &.h-form-table-bottom-center,
171
+ &.h-form-table-custom-pagination {
166
172
  :deep(.table-wrapper) {
167
173
  .ant-row-flex-start {
168
174
  position: relative;
@@ -182,15 +188,6 @@ defineExpose({
182
188
  transform: translateX(-50%);
183
189
  }
184
190
  }
185
-
186
- // 分页当前页配色
187
- .ant-pagination {
188
- .ant-pagination-item-active {
189
- background: #0057FE;
190
- border-color: #0057FE;
191
- a { color: #fff; }
192
- }
193
- }
194
191
  }
195
192
  }
196
193
  }
@@ -70,6 +70,7 @@
70
70
  :serviceName="serviceName"
71
71
  :pageMaxSize="realQueryConfig.queryPagesSize"
72
72
  :externalSelectedRowKeys="externalSelectedRowKeys"
73
+ :customPagination="customPagination"
73
74
  @add="add"
74
75
  @move="move"
75
76
  @edit="edit"
@@ -402,6 +403,11 @@ export default {
402
403
  default: () => {
403
404
  return {}
404
405
  }
406
+ },
407
+ // 是否使用自定义分页样式
408
+ customPagination: {
409
+ type: Boolean,
410
+ default: false
405
411
  }
406
412
  },
407
413
  watch: {
@@ -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"
@@ -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,113 @@ 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 === Math.ceil(this.localPagination.total / this.localPagination.pageSize) }]}
564
+ onClick={() => {
565
+ const totalPages = Math.ceil(this.localPagination.total / this.localPagination.pageSize)
566
+ if (this.localPagination.current < totalPages) {
567
+ this.pageSize = this.localPagination.pageSize
568
+ this.pageNum = this.localPagination.current + 1
569
+ this.loadData({
570
+ current: this.localPagination.current + 1,
571
+ pageSize: this.localPagination.pageSize
572
+ })
573
+ }
574
+ }}
575
+ >
576
+ &gt;
577
+ </div>
578
+
579
+ {/* 末页按钮 */}
580
+ <div
581
+ class={['custom-pagination-btn', { disabled: this.localPagination.current === Math.ceil(this.localPagination.total / this.localPagination.pageSize) }]}
582
+ onClick={() => {
583
+ const totalPages = Math.ceil(this.localPagination.total / this.localPagination.pageSize)
584
+ if (this.localPagination.current < totalPages) {
585
+ this.pageSize = this.localPagination.pageSize
586
+ this.pageNum = totalPages
587
+ this.loadData({
588
+ current: totalPages,
589
+ pageSize: this.localPagination.pageSize
590
+ })
591
+ }
592
+ }}
593
+ >
594
+ <span class="custom-pagination-icon icon-rotate-left">⌅</span>
595
+ </div>
596
+
597
+ {/* 分页信息 */}
598
+ <div class="custom-pagination-info">
599
+ 共{Math.ceil(this.localPagination.total / this.localPagination.pageSize)}页, {this.localPagination.total}条
600
+ </div>
601
+ </div>
602
+ ) : (
603
+ <a-pagination
604
+ total={this.localPagination.total}
605
+ onChange={(page, pageSize) => {
606
+ this.pageSize = pageSize
607
+ this.pageNum = page
608
+ this.loadData({
609
+ current: page,
610
+ pageSize: pageSize
611
+ })
612
+ }
613
+ }
614
+ onShowSizeChange={(page, pageSize) => {
615
+ this.pageSize = pageSize
616
+ this.pageNum = page
617
+ this.loadData({
618
+ current: page,
619
+ pageSize: pageSize
620
+ })
621
+ }
622
+ }
623
+ show-total={(total, range) => range[0] === range[1] ? `${range[0]} | 共 ${total} 项` : `${range[0]}-${range[1]} | 共 ${total} 项`}
624
+ default-current={this.localPagination.current}
625
+ showSizeChanger={this.localPagination.showSizeChanger}/>
626
+ )}
538
627
  </a-col>
539
628
  </a-row>
540
629
  )
@@ -553,3 +642,85 @@ export default {
553
642
  )
554
643
  }
555
644
  }
645
+
646
+ // 添加自定义分页样式
647
+ const customPaginationStyles = `
648
+ <style>
649
+ .custom-pagination-container {
650
+ display: flex;
651
+ align-items: center;
652
+ gap: 8px;
653
+ }
654
+
655
+ .custom-pagination-btn {
656
+ width: 32px;
657
+ height: 32px;
658
+ border: 1px solid #d9d9d9;
659
+ border-radius: 6px;
660
+ background: #fafafa;
661
+ color: #5D5C5C;
662
+ font-size: 14px;
663
+ font-weight: 500;
664
+ display: flex;
665
+ align-items: center;
666
+ justify-content: center;
667
+ cursor: pointer;
668
+ transition: all 0.3s;
669
+ user-select: none;
670
+ }
671
+
672
+ .custom-pagination-btn:hover {
673
+ border-color: #0057FE;
674
+ color: #0057FE;
675
+ }
676
+
677
+ .custom-pagination-btn.active {
678
+ background: #0057FE;
679
+ border-color: #0057FE;
680
+ color: #fff;
681
+ }
682
+
683
+ .custom-pagination-btn.disabled {
684
+ background: #f5f5f5;
685
+ border-color: #d9d9d9;
686
+ color: #bfbfbf;
687
+ cursor: not-allowed;
688
+ }
689
+
690
+ .custom-pagination-btn.disabled:hover {
691
+ border-color: #d9d9d9;
692
+ color: #bfbfbf;
693
+ }
694
+
695
+ .custom-pagination-info {
696
+ margin-left: 16px;
697
+ color: #666;
698
+ font-size: 14px;
699
+ white-space: nowrap;
700
+ }
701
+
702
+ /* 自定义图标与旋转方向 */
703
+ .custom-pagination-icon {
704
+ display: inline-block;
705
+ line-height: 1;
706
+ transform-origin: center;
707
+ }
708
+ .icon-rotate-left {
709
+ transform: rotate(90deg);
710
+ }
711
+ .icon-rotate-right {
712
+ transform: rotate(-90deg);
713
+ }
714
+ </style>
715
+ `
716
+
717
+ // 将样式注入到页面
718
+ if (typeof document !== 'undefined') {
719
+ const styleId = 'custom-pagination-styles'
720
+ if (!document.getElementById(styleId)) {
721
+ const styleElement = document.createElement('style')
722
+ styleElement.id = styleId
723
+ styleElement.textContent = customPaginationStyles.replace('<style>', '').replace('</style>', '')
724
+ document.head.appendChild(styleElement)
725
+ }
726
+ }