vue2-client 1.22.2 → 1.22.3
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/.claude/settings.local.json +30 -30
- package/.env.his +19 -19
- package/.eslintrc.js +74 -74
- package/.history/.eslintrc_20260521171150.js +74 -0
- package/.history/.eslintrc_20260521171213.js +74 -0
- package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154443.vue +726 -0
- package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154700.vue +478 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260512175435.vue +706 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260512175450.vue +694 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260611152602.vue +755 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513145941.vue +524 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513153133.vue +731 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513160316.vue +525 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260601144150.vue +1046 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310142713.vue +512 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310145118.vue +511 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260311094834.vue +696 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260320143028.vue +693 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260409101450.vue +677 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508164645.vue +758 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508164714.vue +693 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508171651.vue +716 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260509133717.vue +695 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260509171115.vue +664 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513140637.vue +1455 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513140935.vue +1441 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513150818.vue +1441 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513153119.vue +1442 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513153126.vue +1486 -0
- package/.history/src/base-client/components/common/XForm/XFormItem_20260513140854.vue +1607 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140403.vue +643 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140829.vue +628 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519142824.vue +104 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519143155.vue +102 -0
- package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171231.vue +1241 -0
- package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171441.vue +1223 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260612174826.vue +472 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260612175839.vue +538 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260615103331.vue +650 -0
- package/.history/src/base-client/components/his/XHDescriptions/XHDescriptions_20260424134504.vue +1469 -0
- package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171133.vue +788 -0
- package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171151.vue +780 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511170841.vue +585 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511171138.vue +787 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260512141830.vue +739 -0
- package/.history/src/components/STable/index_20260409155138.js +806 -0
- package/.history/src/components/STable/index_20260409155218.js +814 -0
- package/.history/src/expression/core/Expression_20260305164427.js +1371 -0
- package/.history/src/expression/core/Expression_20260305170258.js +1358 -0
- package/.history/src/expression/core/Program_20260305111830.js +944 -0
- package/.history/src/expression/core/Program_20260305112041.js +931 -0
- package/.history/src/logic/LogicRunner_20260304154306.js +170 -0
- package/.history/src/logic/LogicRunner_20260304155553.js +112 -0
- package/.history/src/logic/LogicRunner_20260305105834.js +112 -0
- package/.history/src/logic/LogicRunner_20260305112718.js +129 -0
- package/.history/src/logic/LogicRunner_20260305182436.js +133 -0
- package/.history/src/logic/LogicRunner_20260306151301.js +213 -0
- package/.history/src/logic/LogicRunner_20260306152419.js +213 -0
- package/.history/src/logic/plugins/common/DateTools_20260305154159.js +61 -0
- package/.history/src/logic/plugins/common/DateTools_20260305154217.js +44 -0
- package/.history/src/logic/plugins/common/DateTools_20260305161014.js +44 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305164352.js +80 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305170258.js +75 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305171634.js +75 -0
- package/.history/src/logic/plugins/common/HttpTools_20260306152419.js +72 -0
- package/.history/src/services/api/restTools_20260427142149.js +245 -0
- package/.history/src/services/api/restTools_20260427142853.js +230 -0
- package/.history/src/services/api/restTools_20260519135558.js +230 -0
- package/.history/src/services/api/restTools_20260519140825.js +230 -0
- package/.history/src/services/api/restTools_20260519151223.js +230 -0
- package/.history/src/utils/indexedDB_20260306150918.js +593 -0
- package/.history/src/utils/indexedDB_20260306151301.js +586 -0
- package/.idea/af-vue2-client.iml +9 -0
- package/.idea/codeStyles/Project.xml +62 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +1 -1
- package/Components.md +60 -60
- package/index.js +31 -31
- package/jest-transform-stub.js +8 -8
- package/jest.setup.js +7 -7
- package/package.json +1 -1
- package/preview-input-box.html +180 -0
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/HIS/HButtons/HButtons.vue +55 -1
- package/src/base-client/components/common/HIS/HForm/HForm.vue +1186 -1186
- package/src/base-client/components/common/HIS/HTab/HTab.vue +88 -1
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Tree/index.js +2 -2
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
- package/src/base-client/components/common/XAddReport/XAddReport.vue +16 -1
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
- package/src/base-client/components/common/XDataDrawer/index.js +3 -3
- package/src/base-client/components/common/XDataDrawer/index.md +41 -41
- package/src/base-client/components/common/XDescriptions/index.js +3 -3
- package/src/base-client/components/common/XDescriptions/index.md +382 -382
- package/src/base-client/components/common/XForm/index.md +178 -178
- package/src/base-client/components/common/XInput/XInput.vue +32 -1
- package/src/base-client/components/common/XInspectionDetailDrawer/index.vue +1 -1
- package/src/base-client/components/common/XMarkdownViewer/demo.vue +102 -102
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/components/common/XStepView/index.js +3 -3
- package/src/base-client/components/common/XStepView/index.md +31 -31
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/his/HAi/HAi.vue +1177 -436
- package/src/base-client/components/his/XList/XList.vue +337 -58
- package/src/base-client/components/his/XSidebar/XSidebar.vue +36 -12
- package/src/base-client/components/his/XTransfer/index.md +327 -327
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/plugins/Config.js +19 -19
- package/src/base-client/plugins/tabs-page-plugin.js +39 -39
- package/src/components/Charts/Bar.vue +62 -62
- package/src/components/Charts/ChartCard.vue +134 -134
- package/src/components/Charts/Liquid.vue +67 -67
- package/src/components/Charts/MiniArea.vue +39 -39
- package/src/components/Charts/MiniBar.vue +39 -39
- package/src/components/Charts/MiniProgress.vue +75 -75
- package/src/components/Charts/MiniSmoothArea.vue +40 -40
- package/src/components/Charts/Radar.vue +68 -68
- package/src/components/Charts/RankList.vue +77 -77
- package/src/components/Charts/TagCloud.vue +113 -113
- package/src/components/Charts/TransferBar.vue +64 -64
- package/src/components/Charts/Trend.vue +82 -82
- package/src/components/Charts/chart.less +12 -12
- package/src/components/Charts/smooth.area.less +13 -13
- package/src/components/NumberInfo/NumberInfo.vue +54 -54
- package/src/components/NumberInfo/index.js +3 -3
- package/src/components/NumberInfo/index.less +54 -54
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/index.js +953 -953
- package/src/components/card/ChartCard.vue +79 -79
- package/src/components/chart/Bar.vue +60 -60
- package/src/components/chart/MiniArea.vue +67 -67
- package/src/components/chart/MiniBar.vue +59 -59
- package/src/components/chart/MiniProgress.vue +57 -57
- package/src/components/chart/Radar.vue +80 -80
- package/src/components/chart/RankingList.vue +60 -60
- package/src/components/chart/Trend.vue +79 -79
- package/src/components/chart/index.less +9 -9
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/input/IInput.vue +66 -66
- package/src/components/menu/SideMenu.vue +75 -75
- package/src/components/menu/menu.js +273 -273
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/layouts/CommonLayout.vue +56 -56
- package/src/lib.js +1 -1
- package/src/mock/extend/index.js +84 -84
- package/src/mock/goods/index.js +108 -108
- package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
- package/src/pages/system/dictionary/index.vue +44 -44
- package/src/pages/system/monitor/loginInfor/index.vue +37 -37
- package/src/pages/system/monitor/operLog/index.vue +37 -37
- package/src/services/api/cas.js +79 -79
- package/src/store/modules/setting.js +119 -119
- package/src/utils/errorCode.js +6 -6
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
- package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -7
- package/.idea/google-java-format.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -24
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/vue2-client.iml +0 -12
- package/.vscode/settings.json +0 -28
|
@@ -0,0 +1,806 @@
|
|
|
1
|
+
import T from 'ant-design-vue/es/table/Table'
|
|
2
|
+
import get from 'lodash.get'
|
|
3
|
+
import { mapState } from 'vuex'
|
|
4
|
+
import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
data () {
|
|
8
|
+
return {
|
|
9
|
+
clickedRowKey: null,
|
|
10
|
+
hoveredRowKey: null, // 跟踪鼠标悬浮的行
|
|
11
|
+
needTotalList: [],
|
|
12
|
+
|
|
13
|
+
selectedRows: [],
|
|
14
|
+
selectedRowKeys: [],
|
|
15
|
+
|
|
16
|
+
localLoading: false,
|
|
17
|
+
localDataSource: [],
|
|
18
|
+
localPagination: Object.assign({}, this.pagination),
|
|
19
|
+
|
|
20
|
+
sortField: undefined,
|
|
21
|
+
sortOrder: undefined,
|
|
22
|
+
pageNum: 1,
|
|
23
|
+
pageSize: 10,
|
|
24
|
+
pageSizeOptions: ['10', '20', '30', '40'],
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
props: Object.assign({}, T.props, {
|
|
28
|
+
rowKey: {
|
|
29
|
+
type: [String, Function],
|
|
30
|
+
default: 'key'
|
|
31
|
+
},
|
|
32
|
+
data: {
|
|
33
|
+
type: Function,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
setScrollYHeight: {
|
|
37
|
+
type: Function,
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
showSizeChanger: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: true
|
|
43
|
+
},
|
|
44
|
+
showSummary: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
selectRowMode: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'default'
|
|
51
|
+
},
|
|
52
|
+
size: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'default'
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* alert: {
|
|
58
|
+
* show: true,
|
|
59
|
+
* clear: Function
|
|
60
|
+
* }
|
|
61
|
+
*/
|
|
62
|
+
alert: {
|
|
63
|
+
type: [Object, Boolean],
|
|
64
|
+
default: null
|
|
65
|
+
},
|
|
66
|
+
rowSelection: {
|
|
67
|
+
type: Object,
|
|
68
|
+
default: null
|
|
69
|
+
},
|
|
70
|
+
/** @Deprecated */
|
|
71
|
+
showAlertInfo: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
showPagination: {
|
|
76
|
+
type: [String, Boolean],
|
|
77
|
+
default: 'auto'
|
|
78
|
+
},
|
|
79
|
+
// 是否隐藏翻页,如果隐藏,彻底不显示翻译
|
|
80
|
+
hidePagination: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: false
|
|
83
|
+
},
|
|
84
|
+
// 是否显示表头已选择部分
|
|
85
|
+
showSelected: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: true
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* enable page URI mode
|
|
91
|
+
*
|
|
92
|
+
* e.g:
|
|
93
|
+
* /users/1
|
|
94
|
+
* /users/2
|
|
95
|
+
* /users/3?queryParam=test
|
|
96
|
+
* ...
|
|
97
|
+
*/
|
|
98
|
+
pageURI: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false
|
|
101
|
+
},
|
|
102
|
+
// 最大分页大小,如果设置则使用该值作为分页大小并隐藏分页组件
|
|
103
|
+
pageMaxSize: {
|
|
104
|
+
type: Number,
|
|
105
|
+
default: null
|
|
106
|
+
},
|
|
107
|
+
// 是否使用自定义分页样式
|
|
108
|
+
customPagination: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: false
|
|
111
|
+
},
|
|
112
|
+
// 行样式函数,用于控制每行的样式类型
|
|
113
|
+
rowStyleFunction: {
|
|
114
|
+
type: [Function, String],
|
|
115
|
+
default: null
|
|
116
|
+
},
|
|
117
|
+
// 默认查询的当页行数
|
|
118
|
+
defaultPageSize: {
|
|
119
|
+
type: Number,
|
|
120
|
+
default: 10
|
|
121
|
+
},
|
|
122
|
+
pageSizeArray: {
|
|
123
|
+
type: Array,
|
|
124
|
+
default: () => ['10', '20', '30', '40']
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
computed: {
|
|
128
|
+
...mapState('setting', ['theme']), // 添加 theme 到计算属性
|
|
129
|
+
|
|
130
|
+
// 计算点击行的背景色,使用 10% 透明度
|
|
131
|
+
clickedRowColor () {
|
|
132
|
+
const themeColor = this.$store.state.setting.theme.color
|
|
133
|
+
return this.hexToRgba(themeColor || '#1890ff', 0.1)
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
watch: {
|
|
137
|
+
'localPagination.current' (val) {
|
|
138
|
+
this.pageURI && this.$router.push({
|
|
139
|
+
...this.$route,
|
|
140
|
+
name: this.$route.name,
|
|
141
|
+
params: Object.assign({}, this.$route.params, {
|
|
142
|
+
pageNo: val
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
// change pagination, reset total data
|
|
146
|
+
this.needTotalList = this.initTotalList(this.columns)
|
|
147
|
+
if (this.selectRowMode === 'default') {
|
|
148
|
+
this.selectedRowKeys = []
|
|
149
|
+
this.selectedRows = []
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
pageNum (val) {
|
|
153
|
+
Object.assign(this.localPagination, {
|
|
154
|
+
current: val
|
|
155
|
+
})
|
|
156
|
+
},
|
|
157
|
+
pageSize (val) {
|
|
158
|
+
Object.assign(this.localPagination, {
|
|
159
|
+
pageSize: val
|
|
160
|
+
})
|
|
161
|
+
},
|
|
162
|
+
showSizeChanger (val) {
|
|
163
|
+
Object.assign(this.localPagination, {
|
|
164
|
+
showSizeChanger: val
|
|
165
|
+
})
|
|
166
|
+
},
|
|
167
|
+
pageMaxSize: {
|
|
168
|
+
handler (val) {
|
|
169
|
+
if (val && !this.defaultPageSize) {
|
|
170
|
+
this.pageSize = val
|
|
171
|
+
// 更新 localPagination
|
|
172
|
+
if (this.localPagination) {
|
|
173
|
+
Object.assign(this.localPagination, {
|
|
174
|
+
pageSize: val
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
immediate: true
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
created () {
|
|
183
|
+
const { pageNo } = this.$route.params
|
|
184
|
+
const localPageNum = this.pageURI && (pageNo && parseInt(pageNo)) || this.pageNum
|
|
185
|
+
|
|
186
|
+
// 优先使用 defaultPageSize,其次才使用 pageMaxSize(向后兼容)
|
|
187
|
+
if (this.defaultPageSize) {
|
|
188
|
+
this.pageSize = this.defaultPageSize
|
|
189
|
+
}
|
|
190
|
+
// 即将删除的过期属性
|
|
191
|
+
if (this.pageMaxSize) {
|
|
192
|
+
this.pageSize = this.pageMaxSize
|
|
193
|
+
}
|
|
194
|
+
// 新增属性-分页选项
|
|
195
|
+
if (this.pageSizeArray && this.pageSizeArray.length) {
|
|
196
|
+
this.pageSizeOptions = this.pageSizeArray
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
this.localPagination = ['auto', true].includes(this.showPagination) && Object.assign({}, this.localPagination, {
|
|
200
|
+
current: localPageNum,
|
|
201
|
+
pageSize: this.pageSize,
|
|
202
|
+
showSizeChanger: this.showSizeChanger
|
|
203
|
+
}) || false
|
|
204
|
+
this.needTotalList = this.initTotalList(this.columns)
|
|
205
|
+
// this.loadData()
|
|
206
|
+
},
|
|
207
|
+
methods: {
|
|
208
|
+
/**
|
|
209
|
+
* 表格重新加载方法
|
|
210
|
+
* 如果参数为 true, 则强制刷新到第一页
|
|
211
|
+
* @param Boolean bool
|
|
212
|
+
*/
|
|
213
|
+
refresh (bool = false) {
|
|
214
|
+
bool && (this.localPagination = Object.assign({}, {
|
|
215
|
+
current: 1, pageSize: this.pageSize
|
|
216
|
+
}))
|
|
217
|
+
this.loadData()
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* 加载数据方法
|
|
221
|
+
* @param {Object} pagination 分页选项器
|
|
222
|
+
* @param {Object} filters 过滤条件
|
|
223
|
+
* @param {Object} sorter 排序条件
|
|
224
|
+
*/
|
|
225
|
+
loadData (pagination, filters, sorter) {
|
|
226
|
+
this.localLoading = true
|
|
227
|
+
// 暂存排序方式,避免 refresh 之后排序失效
|
|
228
|
+
if (sorter && sorter.field) {
|
|
229
|
+
this.sortField = sorter.field
|
|
230
|
+
}
|
|
231
|
+
if (sorter && sorter.order) {
|
|
232
|
+
this.sortOrder = sorter.order
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// 确定 pageSize
|
|
236
|
+
let finalPageSize = this.pageSize
|
|
237
|
+
if (this.showPagination === false) {
|
|
238
|
+
// 当 showPagination 为 false 时,优先使用传入的 pageSize
|
|
239
|
+
finalPageSize = this.defaultPageSize || pagination?.pageSize
|
|
240
|
+
} else if (pagination && pagination.pageSize) {
|
|
241
|
+
finalPageSize = pagination.pageSize
|
|
242
|
+
} else if (this.localPagination && this.localPagination.pageSize) {
|
|
243
|
+
finalPageSize = this.localPagination.pageSize
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const parameter = Object.assign({
|
|
247
|
+
querySummary: !pagination && this.showSummary, // 分页查询的情况不重新获取汇总数据
|
|
248
|
+
pageNo: (pagination && pagination.current) ||
|
|
249
|
+
this.showPagination && this.localPagination.current || this.pageNum,
|
|
250
|
+
pageSize: finalPageSize
|
|
251
|
+
},
|
|
252
|
+
(this.sortField && { sortField: this.sortField }) || {},
|
|
253
|
+
(this.sortOrder && { sortOrder: this.sortOrder }) || {},
|
|
254
|
+
{ ...filters }
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
// 在加载新数据前,将当前数据传递给父组件
|
|
258
|
+
if (this.localDataSource && this.localDataSource.length > 0) {
|
|
259
|
+
// 变化前的数据: oldData, 分页信息: pagination, 过滤条件: filters, 排序信息: sorter
|
|
260
|
+
this.$emit('beforeDataChange', {
|
|
261
|
+
oldData: this.localDataSource,
|
|
262
|
+
pagination: this.localPagination,
|
|
263
|
+
filters: filters,
|
|
264
|
+
sorter: sorter
|
|
265
|
+
})
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const result = this.data(parameter)
|
|
269
|
+
// 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.totalCount, r.data
|
|
270
|
+
// eslint-disable-next-line
|
|
271
|
+
if ((typeof result === 'object' || typeof result === 'function') && typeof result.then === 'function') {
|
|
272
|
+
result.then(r => {
|
|
273
|
+
this.localPagination = this.showPagination && Object.assign({}, this.localPagination, {
|
|
274
|
+
current: r.pageNo, // 返回结果中的当前分页数
|
|
275
|
+
total: r.totalCount, // 返回结果中的总记录数
|
|
276
|
+
showSizeChanger: this.showSizeChanger,
|
|
277
|
+
pageSize: finalPageSize
|
|
278
|
+
}) || false
|
|
279
|
+
// 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
|
|
280
|
+
if (r.data.length === 0 && this.showPagination && this.localPagination.current > 1) {
|
|
281
|
+
this.localPagination.current--
|
|
282
|
+
this.loadData()
|
|
283
|
+
return
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// 这里用于判断接口是否有返回 r.totalCount 且 this.showPagination = 'auto' 且 pageNo 和 pageSize 存在 且 totalCount 小于等于 pageNo * pageSize 的大小
|
|
287
|
+
// 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
|
|
288
|
+
try {
|
|
289
|
+
if ((['auto'].includes(this.showPagination) && r.totalCount <= (r.pageNo * this.localPagination.pageSize))) {
|
|
290
|
+
this.localPagination.hideOnSinglePage = true
|
|
291
|
+
}
|
|
292
|
+
} catch (e) {
|
|
293
|
+
this.localPagination = false
|
|
294
|
+
}
|
|
295
|
+
this.localDataSource = r.data // 返回结果中的数组数据
|
|
296
|
+
this.localLoading = false
|
|
297
|
+
// 清除选中行状态(翻页或重新查询时)
|
|
298
|
+
this.clickedRowKey = null
|
|
299
|
+
this.setScrollYHeight({ type: 'default' })
|
|
300
|
+
}, () => {
|
|
301
|
+
this.localLoading = false
|
|
302
|
+
this.setScrollYHeight({ type: 'default' })
|
|
303
|
+
})
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
setLocalDataSource (data) {
|
|
307
|
+
this.localDataSource = data
|
|
308
|
+
},
|
|
309
|
+
initTotalList (columns) {
|
|
310
|
+
const totalList = []
|
|
311
|
+
columns && columns instanceof Array && columns.forEach(column => {
|
|
312
|
+
if (column.needTotal) {
|
|
313
|
+
totalList.push({
|
|
314
|
+
...column,
|
|
315
|
+
total: 0
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
return totalList
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
* 用于更新已选中的列表数据 total 统计
|
|
323
|
+
* @param selectedRowKeys
|
|
324
|
+
* @param selectedRows
|
|
325
|
+
*/
|
|
326
|
+
updateSelect (selectedRowKeys, selectedRows) {
|
|
327
|
+
this.selectedRows = selectedRows
|
|
328
|
+
this.selectedRowKeys = selectedRowKeys
|
|
329
|
+
const list = this.needTotalList
|
|
330
|
+
this.needTotalList = list.map(item => {
|
|
331
|
+
return {
|
|
332
|
+
...item,
|
|
333
|
+
total: selectedRows.reduce((sum, val) => {
|
|
334
|
+
const total = sum + parseInt(get(val, item.dataIndex))
|
|
335
|
+
return isNaN(total) ? 0 : total
|
|
336
|
+
}, 0)
|
|
337
|
+
}
|
|
338
|
+
})
|
|
339
|
+
},
|
|
340
|
+
/**
|
|
341
|
+
* 清空 table 已选中项
|
|
342
|
+
*/
|
|
343
|
+
clearSelected () {
|
|
344
|
+
if (this.rowSelection) {
|
|
345
|
+
this.rowSelection.onChange([], [])
|
|
346
|
+
this.updateSelect([], [])
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
/**
|
|
350
|
+
* 处理交给 table 使用者去处理 clear 事件时,内部选中统计同时调用
|
|
351
|
+
* @param callback
|
|
352
|
+
* @returns {*}
|
|
353
|
+
*/
|
|
354
|
+
renderClear (callback) {
|
|
355
|
+
if (this.selectedRowKeys.length <= 0) return null
|
|
356
|
+
return (
|
|
357
|
+
<a style="margin-left: 24px" onClick={() => {
|
|
358
|
+
callback()
|
|
359
|
+
this.clearSelected()
|
|
360
|
+
}}>清空</a>
|
|
361
|
+
)
|
|
362
|
+
},
|
|
363
|
+
renderAlert () {
|
|
364
|
+
// 绘制统计列数据
|
|
365
|
+
const needTotalItems = this.needTotalList.map((item) => {
|
|
366
|
+
return (<span style="margin-right: 12px">
|
|
367
|
+
{item.title}总计 <a
|
|
368
|
+
style="font-weight: 600">{!item.customRender ? item.total : item.customRender(item.total)}</a>
|
|
369
|
+
</span>)
|
|
370
|
+
})
|
|
371
|
+
|
|
372
|
+
// 绘制 清空 按钮
|
|
373
|
+
const clearItem = (typeof this.alert.clear === 'boolean' && this.alert.clear) ? (
|
|
374
|
+
this.renderClear(this.clearSelected)
|
|
375
|
+
) : (typeof this.alert.clear === 'function') ? (
|
|
376
|
+
this.renderClear(this.alert.clear)
|
|
377
|
+
) : null
|
|
378
|
+
|
|
379
|
+
// 绘制 alert 组件
|
|
380
|
+
return (
|
|
381
|
+
<a-alert showIcon={true} style={{ marginBottom: '8px', fontSize: '14px' }}>
|
|
382
|
+
<template slot="message">
|
|
383
|
+
<span style="margin-right: 12px;">已选择: <a style="font-weight: 600">{this.selectedRows.length}</a></span>
|
|
384
|
+
{needTotalItems}
|
|
385
|
+
{clearItem}
|
|
386
|
+
</template>
|
|
387
|
+
</a-alert>
|
|
388
|
+
)
|
|
389
|
+
},
|
|
390
|
+
onExpand (expanded, record) {
|
|
391
|
+
this.$emit('expand', expanded, record)
|
|
392
|
+
},
|
|
393
|
+
handleRowClick (record, index, event, options = {}) {
|
|
394
|
+
const { forceSelect = false, emitRowClick = true } = options
|
|
395
|
+
const isRowKeySequence = this.rowKey === '序号'
|
|
396
|
+
const currentRowKey = isRowKeySequence ? index : record[this.rowKey]
|
|
397
|
+
const isDoubleClick = event && event.detail > 1
|
|
398
|
+
const isSameRow = this.clickedRowKey === currentRowKey
|
|
399
|
+
|
|
400
|
+
if (forceSelect || isDoubleClick) {
|
|
401
|
+
this.clickedRowKey = currentRowKey
|
|
402
|
+
emitRowClick && this.$emit('rowClick', record)
|
|
403
|
+
return
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// 如果点击的是已选中的行,则取消选中;否则选中该行
|
|
407
|
+
if (isSameRow) {
|
|
408
|
+
this.clickedRowKey = null
|
|
409
|
+
emitRowClick && this.$emit('rowClick', null) // 传递 null 表示取消选中
|
|
410
|
+
} else {
|
|
411
|
+
this.clickedRowKey = currentRowKey
|
|
412
|
+
emitRowClick && this.$emit('rowClick', record)
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
handleRowDoubleClick (record, index, event) {
|
|
416
|
+
this.handleRowClick(record, index, event, { forceSelect: true })
|
|
417
|
+
this.$emit('rowDblClick', record)
|
|
418
|
+
},
|
|
419
|
+
handleRowMouseEnter (record, index) {
|
|
420
|
+
if (this.rowKey === '序号') {
|
|
421
|
+
this.hoveredRowKey = index
|
|
422
|
+
} else {
|
|
423
|
+
this.hoveredRowKey = record[this.rowKey]
|
|
424
|
+
}
|
|
425
|
+
this.$emit('rowMouseEnter', record, index)
|
|
426
|
+
},
|
|
427
|
+
handleRowMouseLeave (record, index) {
|
|
428
|
+
this.hoveredRowKey = null
|
|
429
|
+
this.$emit('rowMouseLeave', record, index)
|
|
430
|
+
},
|
|
431
|
+
hexToRgba (hex, alpha = 1) {
|
|
432
|
+
try {
|
|
433
|
+
const r = parseInt(hex.slice(1, 3), 16)
|
|
434
|
+
const g = parseInt(hex.slice(3, 5), 16)
|
|
435
|
+
const b = parseInt(hex.slice(5, 7), 16)
|
|
436
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`
|
|
437
|
+
} catch (e) {
|
|
438
|
+
return '#e6f7ff'
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
// 获取行样式类型
|
|
442
|
+
getRowStyleType (record, index) {
|
|
443
|
+
if (this.rowStyleFunction) {
|
|
444
|
+
try {
|
|
445
|
+
// 如果是函数对象,直接执行
|
|
446
|
+
if (typeof this.rowStyleFunction === 'function') {
|
|
447
|
+
return this.rowStyleFunction(record, index)
|
|
448
|
+
}
|
|
449
|
+
// 如果是字符串函数,使用executeStrFunctionByContext执行
|
|
450
|
+
if (typeof this.rowStyleFunction === 'string') {
|
|
451
|
+
return executeStrFunctionByContext(this, this.rowStyleFunction, [record, index])
|
|
452
|
+
}
|
|
453
|
+
} catch (e) {
|
|
454
|
+
console.warn('Row style function error:', e)
|
|
455
|
+
return 'info'
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return 'info'
|
|
459
|
+
},
|
|
460
|
+
// 根据行样式类型和是否激活获取背景色
|
|
461
|
+
// isActive: 是否处于 hover 或 selected 状态
|
|
462
|
+
getRowBgColor (styleType, isActive = false) {
|
|
463
|
+
const colorMap = {
|
|
464
|
+
success: {
|
|
465
|
+
normal: 'rgba(82, 196, 26, 0.2)',
|
|
466
|
+
active: 'rgba(82, 196, 26, 0.2)'
|
|
467
|
+
},
|
|
468
|
+
warning: {
|
|
469
|
+
normal: 'rgba(250, 173, 20, 0.1)',
|
|
470
|
+
active: 'rgba(250, 173, 20, 0.2)'
|
|
471
|
+
},
|
|
472
|
+
error: {
|
|
473
|
+
normal: 'rgba(245, 34, 47, 0.1)',
|
|
474
|
+
active: 'rgba(245, 34, 47, 0.2)'
|
|
475
|
+
},
|
|
476
|
+
danger: {
|
|
477
|
+
normal: 'rgba(245, 34, 47, 0.1)',
|
|
478
|
+
active: 'rgba(245, 34, 47, 0.2)'
|
|
479
|
+
},
|
|
480
|
+
magic: {
|
|
481
|
+
normal: 'rgba(114, 46, 209, 0.1)',
|
|
482
|
+
active: 'rgba(114, 46, 209, 0.2)'
|
|
483
|
+
},
|
|
484
|
+
warn: {
|
|
485
|
+
normal: 'rgba(250, 173, 20, 0.1)',
|
|
486
|
+
active: 'rgba(250, 173, 20, 0.2)'
|
|
487
|
+
},
|
|
488
|
+
info: {
|
|
489
|
+
normal: '',
|
|
490
|
+
active: 'rgba(24, 144, 255, 0.2)'
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const colors = colorMap[styleType] || colorMap.info
|
|
495
|
+
return isActive ? colors.active : colors.normal
|
|
496
|
+
},
|
|
497
|
+
// 获取行样式颜色(根据当前行的 hover 和 selected 状态)
|
|
498
|
+
getRowStyleClass (record, index) {
|
|
499
|
+
const isRowKeySequence = this.rowKey === '序号'
|
|
500
|
+
const currentRowKey = isRowKeySequence ? index : record[this.rowKey]
|
|
501
|
+
|
|
502
|
+
// 判断是否是选中行或悬浮行
|
|
503
|
+
const isActive = this.clickedRowKey === currentRowKey || this.hoveredRowKey === currentRowKey
|
|
504
|
+
|
|
505
|
+
// 获取行样式类型
|
|
506
|
+
const styleType = this.getRowStyleType(record, index)
|
|
507
|
+
|
|
508
|
+
// 返回对应颜色
|
|
509
|
+
return this.getRowBgColor(styleType, isActive)
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
render () {
|
|
514
|
+
const props = {}
|
|
515
|
+
const localKeys = Object.keys(this.$data)
|
|
516
|
+
const showAlert = (typeof this.alert === 'object' && this.alert !== null && this.alert.show) && typeof this.rowSelection.selectedRowKeys !== 'undefined' || this.alert
|
|
517
|
+
|
|
518
|
+
Object.keys(T.props).forEach(k => {
|
|
519
|
+
const localKey = `local${k.substring(0, 1).toUpperCase()}${k.substring(1)}`
|
|
520
|
+
if (localKeys.includes(localKey)) {
|
|
521
|
+
props[k] = this[localKey]
|
|
522
|
+
return props[k]
|
|
523
|
+
}
|
|
524
|
+
if (k === 'rowSelection') {
|
|
525
|
+
if (showAlert && this.rowSelection) {
|
|
526
|
+
// 如果需要使用alert,则重新绑定 rowSelection 事件
|
|
527
|
+
props[k] = {
|
|
528
|
+
...this.rowSelection,
|
|
529
|
+
selectedRows: this.selectedRows,
|
|
530
|
+
selectedRowKeys: this.selectedRowKeys,
|
|
531
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
532
|
+
this.updateSelect(selectedRowKeys, selectedRows)
|
|
533
|
+
typeof this[k].onChange !== 'undefined' && this[k].onChange(selectedRowKeys, selectedRows)
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return props[k]
|
|
537
|
+
} else if (!this.rowSelection) {
|
|
538
|
+
// 如果没打算开启 rowSelection 则清空默认的选择项
|
|
539
|
+
props[k] = null
|
|
540
|
+
return props[k]
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
this[k] && (props[k] = this[k])
|
|
544
|
+
return props[k]
|
|
545
|
+
})
|
|
546
|
+
// 取消原有的分页组件 产品设计分页组件和汇总在一行 重新分页逻辑
|
|
547
|
+
props.pagination = false
|
|
548
|
+
|
|
549
|
+
// 使用 rowClassName 实现响应式行样式
|
|
550
|
+
props.rowClassName = (record, index) => {
|
|
551
|
+
const isRowKeySequence = this.rowKey === '序号'
|
|
552
|
+
const currentRowKey = isRowKeySequence ? index : record[this.rowKey]
|
|
553
|
+
|
|
554
|
+
const classes = []
|
|
555
|
+
|
|
556
|
+
// 判断是否是选中行(点击状态)
|
|
557
|
+
if (this.clickedRowKey === currentRowKey) {
|
|
558
|
+
classes.push('row-clicked')
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// 添加行样式类型(用于不同的颜色主题)
|
|
562
|
+
const styleType = this.getRowStyleType(record, index)
|
|
563
|
+
classes.push(`row-style-${styleType}`)
|
|
564
|
+
|
|
565
|
+
return classes.join(' ')
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// 在 props 中添加自定义行事件
|
|
569
|
+
props.customRow = (record, index) => {
|
|
570
|
+
return {
|
|
571
|
+
on: {
|
|
572
|
+
click: (event) => this.handleRowClick(record, index, event),
|
|
573
|
+
dblclick: (event) => this.handleRowDoubleClick(record, index, event),
|
|
574
|
+
mouseenter: () => this.handleRowMouseEnter(record, index),
|
|
575
|
+
mouseleave: () => this.handleRowMouseLeave(record, index)
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
// 自定义底部汇总插槽组件
|
|
580
|
+
const pagination = (
|
|
581
|
+
!!this.showPagination && <a-row type={'flex'} justify={'start'} style={{ marginTop: '8px' }}>
|
|
582
|
+
<a-col flex="1" style={{
|
|
583
|
+
alignItems: 'center',
|
|
584
|
+
display: 'flex',
|
|
585
|
+
justifyContent: 'start',
|
|
586
|
+
boxSizing: 'border-box',
|
|
587
|
+
paddingRight: '2rem'
|
|
588
|
+
}}>
|
|
589
|
+
{this.$slots.fixedfooter}
|
|
590
|
+
</a-col>
|
|
591
|
+
<a-col flex="0 0">
|
|
592
|
+
{this.customPagination ? (
|
|
593
|
+
<div class="custom-pagination-container">
|
|
594
|
+
{/* 首页按钮 */}
|
|
595
|
+
<div
|
|
596
|
+
class={['custom-pagination-btn', { disabled: this.localPagination.current === 1 }]}
|
|
597
|
+
onClick={() => {
|
|
598
|
+
if (this.localPagination.current > 1) {
|
|
599
|
+
this.pageSize = this.localPagination.pageSize
|
|
600
|
+
this.pageNum = 1
|
|
601
|
+
this.loadData({
|
|
602
|
+
current: 1,
|
|
603
|
+
pageSize: this.localPagination.pageSize
|
|
604
|
+
})
|
|
605
|
+
}
|
|
606
|
+
}}
|
|
607
|
+
>
|
|
608
|
+
<span class="custom-pagination-icon icon-rotate-right">⌅</span>
|
|
609
|
+
</div>
|
|
610
|
+
|
|
611
|
+
{/* 上一页按钮 */}
|
|
612
|
+
<div
|
|
613
|
+
class={['custom-pagination-btn', { disabled: this.localPagination.current === 1 }]}
|
|
614
|
+
onClick={() => {
|
|
615
|
+
if (this.localPagination.current > 1) {
|
|
616
|
+
this.pageSize = this.localPagination.pageSize
|
|
617
|
+
this.pageNum = this.localPagination.current - 1
|
|
618
|
+
this.loadData({
|
|
619
|
+
current: this.localPagination.current - 1,
|
|
620
|
+
pageSize: this.localPagination.pageSize
|
|
621
|
+
})
|
|
622
|
+
}
|
|
623
|
+
}}
|
|
624
|
+
>
|
|
625
|
+
<
|
|
626
|
+
</div>
|
|
627
|
+
|
|
628
|
+
{/* 当前页按钮 */}
|
|
629
|
+
<div class="custom-pagination-btn active">
|
|
630
|
+
{this.localPagination.current}
|
|
631
|
+
</div>
|
|
632
|
+
|
|
633
|
+
{/* 下一页按钮 */}
|
|
634
|
+
<div
|
|
635
|
+
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) }]}
|
|
636
|
+
onClick={() => {
|
|
637
|
+
const totalPages = (this.localPagination && this.localPagination.pageSize)
|
|
638
|
+
? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1)))
|
|
639
|
+
: 0
|
|
640
|
+
if (totalPages > 0 && this.localPagination.current < totalPages) {
|
|
641
|
+
this.pageSize = this.localPagination.pageSize
|
|
642
|
+
this.pageNum = this.localPagination.current + 1
|
|
643
|
+
this.loadData({
|
|
644
|
+
current: this.localPagination.current + 1,
|
|
645
|
+
pageSize: this.localPagination.pageSize
|
|
646
|
+
})
|
|
647
|
+
}
|
|
648
|
+
}}
|
|
649
|
+
>
|
|
650
|
+
>
|
|
651
|
+
</div>
|
|
652
|
+
|
|
653
|
+
{/* 末页按钮 */}
|
|
654
|
+
<div
|
|
655
|
+
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) }]}
|
|
656
|
+
onClick={() => {
|
|
657
|
+
const totalPages = (this.localPagination && this.localPagination.pageSize)
|
|
658
|
+
? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1)))
|
|
659
|
+
: 0
|
|
660
|
+
if (totalPages > 0 && this.localPagination.current < totalPages) {
|
|
661
|
+
this.pageSize = this.localPagination.pageSize
|
|
662
|
+
this.pageNum = totalPages
|
|
663
|
+
this.loadData({
|
|
664
|
+
current: totalPages,
|
|
665
|
+
pageSize: this.localPagination.pageSize
|
|
666
|
+
})
|
|
667
|
+
}
|
|
668
|
+
}}
|
|
669
|
+
>
|
|
670
|
+
<span class="custom-pagination-icon icon-rotate-left">⌅</span>
|
|
671
|
+
</div>
|
|
672
|
+
|
|
673
|
+
{/* 分页信息 */}
|
|
674
|
+
<div class="custom-pagination-info">
|
|
675
|
+
共{(this.localPagination && this.localPagination.pageSize)
|
|
676
|
+
? Math.ceil(((this.localPagination.total || 0) / (this.localPagination.pageSize || 1)))
|
|
677
|
+
: 0}页, {(this.localPagination && typeof this.localPagination.total !== 'undefined') ? this.localPagination.total : 0}条
|
|
678
|
+
</div>
|
|
679
|
+
</div>
|
|
680
|
+
) : (
|
|
681
|
+
<a-pagination
|
|
682
|
+
total={this.localPagination.total}
|
|
683
|
+
pageSize={this.localPagination.pageSize}
|
|
684
|
+
current={this.localPagination.current}
|
|
685
|
+
pageSizeOptions={this.pageSizeOptions}
|
|
686
|
+
onChange={(page, pageSize) => {
|
|
687
|
+
this.pageSize = pageSize
|
|
688
|
+
this.pageNum = page
|
|
689
|
+
this.loadData({
|
|
690
|
+
current: page,
|
|
691
|
+
pageSize: pageSize
|
|
692
|
+
})
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
onShowSizeChange={(page, pageSize) => {
|
|
696
|
+
this.pageSize = pageSize
|
|
697
|
+
this.pageNum = page
|
|
698
|
+
this.loadData({
|
|
699
|
+
current: page,
|
|
700
|
+
pageSize: pageSize
|
|
701
|
+
})
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
show-total={(total, range) => range[0] === range[1] ? `${range[0]} | 共 ${total} 项` : `${range[0]}-${range[1]} | 共 ${total} 项`}
|
|
705
|
+
showSizeChanger={this.localPagination.showSizeChanger}/>
|
|
706
|
+
)}
|
|
707
|
+
</a-col>
|
|
708
|
+
</a-row>
|
|
709
|
+
)
|
|
710
|
+
const table = (
|
|
711
|
+
<a-table {...{ props, scopedSlots: { ...this.$scopedSlots } }} onChange={this.loadData}
|
|
712
|
+
onExpand={(expanded, record) => this.onExpand(expanded, record)}>
|
|
713
|
+
{Object.keys(this.$slots).map(name => (<template slot={name}>{this.$slots[name]}</template>))}
|
|
714
|
+
</a-table>
|
|
715
|
+
)
|
|
716
|
+
return (
|
|
717
|
+
<div class="table-wrapper">
|
|
718
|
+
{showAlert && this.showSelected && this.selectRowMode === 'default' ? this.renderAlert() : null}
|
|
719
|
+
{table}
|
|
720
|
+
{!this.hidePagination ? pagination : null}
|
|
721
|
+
</div>
|
|
722
|
+
)
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// 添加自定义分页样式
|
|
727
|
+
const customPaginationStyles = `
|
|
728
|
+
<style>
|
|
729
|
+
.custom-pagination-container {
|
|
730
|
+
display: flex;
|
|
731
|
+
align-items: center;
|
|
732
|
+
gap: 8px;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
.custom-pagination-btn {
|
|
736
|
+
width: 32px;
|
|
737
|
+
height: 32px;
|
|
738
|
+
border: 1px solid #d9d9d9;
|
|
739
|
+
border-radius: 6px;
|
|
740
|
+
background: #fafafa;
|
|
741
|
+
color: #5D5C5C;
|
|
742
|
+
font-size: 14px;
|
|
743
|
+
font-weight: 500;
|
|
744
|
+
display: flex;
|
|
745
|
+
align-items: center;
|
|
746
|
+
justify-content: center;
|
|
747
|
+
cursor: pointer;
|
|
748
|
+
transition: all 0.3s;
|
|
749
|
+
user-select: none;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
.custom-pagination-btn:hover {
|
|
753
|
+
border-color: #0057FE;
|
|
754
|
+
color: #0057FE;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
.custom-pagination-btn.active {
|
|
758
|
+
background: #0057FE;
|
|
759
|
+
border-color: #0057FE;
|
|
760
|
+
color: #fff;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.custom-pagination-btn.disabled {
|
|
764
|
+
background: #f5f5f5;
|
|
765
|
+
border-color: #d9d9d9;
|
|
766
|
+
color: #bfbfbf;
|
|
767
|
+
cursor: not-allowed;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
.custom-pagination-btn.disabled:hover {
|
|
771
|
+
border-color: #d9d9d9;
|
|
772
|
+
color: #bfbfbf;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
.custom-pagination-info {
|
|
776
|
+
margin-left: 16px;
|
|
777
|
+
color: #666;
|
|
778
|
+
font-size: 14px;
|
|
779
|
+
white-space: nowrap;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/* 自定义图标与旋转方向 */
|
|
783
|
+
.custom-pagination-icon {
|
|
784
|
+
display: inline-block;
|
|
785
|
+
line-height: 1;
|
|
786
|
+
transform-origin: center;
|
|
787
|
+
}
|
|
788
|
+
.icon-rotate-left {
|
|
789
|
+
transform: rotate(90deg);
|
|
790
|
+
}
|
|
791
|
+
.icon-rotate-right {
|
|
792
|
+
transform: rotate(-90deg);
|
|
793
|
+
}
|
|
794
|
+
</style>
|
|
795
|
+
`
|
|
796
|
+
|
|
797
|
+
// 将样式注入到页面
|
|
798
|
+
if (typeof document !== 'undefined') {
|
|
799
|
+
const styleId = 'custom-pagination-styles'
|
|
800
|
+
if (!document.getElementById(styleId)) {
|
|
801
|
+
const styleElement = document.createElement('style')
|
|
802
|
+
styleElement.id = styleId
|
|
803
|
+
styleElement.textContent = customPaginationStyles.replace('<style>', '').replace('</style>', '')
|
|
804
|
+
document.head.appendChild(styleElement)
|
|
805
|
+
}
|
|
806
|
+
}
|