vue2-client 1.15.137 → 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.
@@ -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,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
+ }
@@ -60,7 +60,7 @@ path: 'example',
60
60
  // component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),
61
61
  // component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
62
62
  // component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
63
- component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
63
+ // component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
64
64
  // component: () => import('@vue2-client/base-client/components/common/XDatePicker/demo.vue'),
65
65
  // component: () => import('@vue2-client/base-client/components/common/XTab/XTabDemo.vue'),
66
66
  // component: () => import('@vue2-client/base-client/components/common/XRate/demo.vue'),
@@ -79,7 +79,7 @@ path: 'example',
79
79
  // component: () => import('@vue2-client/pages/LogicCallExample/index.vue'),
80
80
  // component: () => import('@vue2-client/components/FilePreview/FilePreviewDemo.vue'),
81
81
  // component: () => import('@vue2-client/pages/ReportGrid/index.vue'),
82
- // component: () => import('@vue2-client/base-client/components/common/HIS/demo.vue'),
82
+ component: () => import('@vue2-client/base-client/components/common/HIS/demo.vue'),
83
83
  }
84
84
  // routerResource.example = () =>
85
85
  // import('@vue2-client/pages/Example')