vue2-client 1.14.40 → 1.14.41

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.
@@ -70,7 +70,7 @@ export default {
70
70
  default: false
71
71
  },
72
72
  showPagination: {
73
- type: String | Boolean,
73
+ type: [String, Boolean],
74
74
  default: 'auto'
75
75
  },
76
76
  // 是否隐藏翻页,如果隐藏,彻底不显示翻译
@@ -95,6 +95,11 @@ export default {
95
95
  pageURI: {
96
96
  type: Boolean,
97
97
  default: false
98
+ },
99
+ // 最大分页大小,如果设置则使用该值作为分页大小并隐藏分页组件
100
+ pageMaxSize: {
101
+ type: Number,
102
+ default: null
98
103
  }
99
104
  }),
100
105
  computed: {
@@ -136,11 +141,33 @@ export default {
136
141
  Object.assign(this.localPagination, {
137
142
  showSizeChanger: val
138
143
  })
144
+ },
145
+ pageMaxSize: {
146
+ handler (val) {
147
+ if (val) {
148
+ this.pageSize = val
149
+ this.hidePagination = true
150
+ // 更新 localPagination
151
+ if (this.localPagination) {
152
+ Object.assign(this.localPagination, {
153
+ pageSize: val
154
+ })
155
+ }
156
+ }
157
+ },
158
+ immediate: true
139
159
  }
140
160
  },
141
161
  created () {
142
162
  const { pageNo } = this.$route.params
143
163
  const localPageNum = this.pageURI && (pageNo && parseInt(pageNo)) || this.pageNum
164
+
165
+ // 如果设置了 pageMaxSize,则使用该值作为分页大小并隐藏分页
166
+ if (this.pageMaxSize) {
167
+ this.pageSize = this.pageMaxSize
168
+ this.hidePagination = true
169
+ }
170
+
144
171
  this.localPagination = ['auto', true].includes(this.showPagination) && Object.assign({}, this.localPagination, {
145
172
  current: localPageNum,
146
173
  pageSize: this.pageSize,
@@ -176,12 +203,23 @@ export default {
176
203
  if (sorter && sorter.order) {
177
204
  this.sortOrder = sorter.order
178
205
  }
206
+
207
+ // 确定 pageSize
208
+ let finalPageSize = this.pageSize
209
+ if (this.showPagination === false) {
210
+ // 当 showPagination 为 false 时,优先使用传入的 pageSize
211
+ finalPageSize = pagination?.pageSize || this.pageSize
212
+ } else if (pagination && pagination.pageSize) {
213
+ finalPageSize = pagination.pageSize
214
+ } else if (this.localPagination && this.localPagination.pageSize) {
215
+ finalPageSize = this.localPagination.pageSize
216
+ }
217
+
179
218
  const parameter = Object.assign({
180
219
  querySummary: !pagination && this.showSummary, // 分页查询的情况不重新获取汇总数据
181
220
  pageNo: (pagination && pagination.current) ||
182
221
  this.showPagination && this.localPagination.current || this.pageNum,
183
- pageSize: (pagination && pagination.pageSize) ||
184
- this.showPagination && this.localPagination.pageSize || this.pageSize
222
+ pageSize: finalPageSize
185
223
  },
186
224
  (this.sortField && { sortField: this.sortField }) || {},
187
225
  (this.sortOrder && { sortOrder: this.sortOrder }) || {},
@@ -208,7 +246,7 @@ export default {
208
246
  current: r.pageNo, // 返回结果中的当前分页数
209
247
  total: r.totalCount, // 返回结果中的总记录数
210
248
  showSizeChanger: this.showSizeChanger,
211
- pageSize: (pagination && pagination.pageSize) || this.localPagination.pageSize
249
+ pageSize: finalPageSize
212
250
  }) || false
213
251
  // 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
214
252
  if (r.data.length === 0 && this.showPagination && this.localPagination.current > 1) {
@@ -437,7 +475,6 @@ export default {
437
475
  {Object.keys(this.$slots).map(name => (<template slot={name}>{this.$slots[name]}</template>))}
438
476
  </a-table>
439
477
  )
440
-
441
478
  return (
442
479
  <div class="table-wrapper">
443
480
  {showAlert && this.showSelected && this.selectRowMode === 'default' ? this.renderAlert() : null}
@@ -1,47 +1,47 @@
1
- import AMapLoader from '@amap/amap-jsapi-loader'
2
- let Amap
3
- async function GetGDMap (secretKey, key) {
4
- if (!Amap) {
5
- window._AMapSecurityConfig = {
6
- securityJsCode: secretKey
7
- }
8
- // 解决高德地图加载报错 ---> 禁止多种API加载方式混用
9
- AMapLoader.reset()
10
- Amap = await AMapLoader.load({
11
- key: key, // 申请好的Web端开发者Key,首次调用 load 时必填
12
- version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
13
- plugins: ['AMap.IndexCluster', 'AMP.MarkerCluster', 'AMap.InfoWindow', 'AMap.HeatMap', 'AMap.HawkEye', 'AMap.DistrictSearch',
14
- 'AMap.ToolBar', 'AMap.Geolocation', 'AMap.MouseTool',
15
- 'AMap.Geocoder', 'AMap.MarkerClusterer', 'AMap.AutoComplete', 'AMap.Scale'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
16
- AMapUI: {
17
- version: '1.1', // AMapUI 缺省 1.1
18
- plugins: ['misc/PositionPicker'] // 需要加载的 AMapUI ui插件
19
- }
20
- })
21
- }
22
- return Amap
23
- }
24
-
25
- async function getGDMap (address) {
26
- new (await GetGDMap()).Geocoder({
27
- radius: 500 // 范围,默认:500
28
- }).getLocation(address, function (status, result) {
29
- if (status === 'complete' && result.geocodes.length) {
30
- return ({ lng: result.geocodes[0].location.lng, lat: result.geocodes[0].location.lat })
31
- } else {
32
- // eslint-disable-next-line prefer-promise-reject-errors
33
- throw new Error('根据经纬度查询地址失败')
34
- }
35
- })
36
- }
37
-
38
- async function GetLocation (address) {
39
- return new Promise((resolve, reject) => {
40
- try {
41
- resolve(getGDMap(address))
42
- } catch (e) {
43
- reject(e)
44
- }
45
- })
46
- }
47
- export { GetGDMap, GetLocation }
1
+ import AMapLoader from '@amap/amap-jsapi-loader'
2
+ let Amap
3
+ async function GetGDMap (secretKey, key) {
4
+ if (!Amap) {
5
+ window._AMapSecurityConfig = {
6
+ securityJsCode: secretKey
7
+ }
8
+ // 解决高德地图加载报错 ---> 禁止多种API加载方式混用
9
+ AMapLoader.reset()
10
+ Amap = await AMapLoader.load({
11
+ key: key, // 申请好的Web端开发者Key,首次调用 load 时必填
12
+ version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
13
+ plugins: ['AMap.IndexCluster', 'AMP.MarkerCluster', 'AMap.InfoWindow', 'AMap.HeatMap', 'AMap.HawkEye', 'AMap.DistrictSearch',
14
+ 'AMap.ToolBar', 'AMap.Geolocation', 'AMap.MouseTool',
15
+ 'AMap.Geocoder', 'AMap.MarkerClusterer', 'AMap.AutoComplete', 'AMap.Scale'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
16
+ AMapUI: {
17
+ version: '1.1', // AMapUI 缺省 1.1
18
+ plugins: ['misc/PositionPicker'] // 需要加载的 AMapUI ui插件
19
+ }
20
+ })
21
+ }
22
+ return Amap
23
+ }
24
+
25
+ async function getGDMap (address) {
26
+ new (await GetGDMap()).Geocoder({
27
+ radius: 500 // 范围,默认:500
28
+ }).getLocation(address, function (status, result) {
29
+ if (status === 'complete' && result.geocodes.length) {
30
+ return ({ lng: result.geocodes[0].location.lng, lat: result.geocodes[0].location.lat })
31
+ } else {
32
+ // eslint-disable-next-line prefer-promise-reject-errors
33
+ throw new Error('根据经纬度查询地址失败')
34
+ }
35
+ })
36
+ }
37
+
38
+ async function GetLocation (address) {
39
+ return new Promise((resolve, reject) => {
40
+ try {
41
+ resolve(getGDMap(address))
42
+ } catch (e) {
43
+ reject(e)
44
+ }
45
+ })
46
+ }
47
+ export { GetGDMap, GetLocation }