af-mobile-client-vue3 1.0.71 → 1.0.73
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 +1 -1
- package/src/components/core/XSelect/index.vue +39 -17
- package/src/components/data/XCellList/XCellList.md +275 -0
- package/src/components/data/XCellList/index.vue +542 -507
- package/src/components/data/XCellListFilter/index.vue +5 -3
- package/src/components/data/XForm/index.vue +1 -1
- package/src/components/data/XFormItem/index.vue +73 -2
- package/src/router/routes.ts +25 -0
- package/src/services/v3Api.ts +136 -0
- package/src/utils/http/index.ts +34 -0
- package/src/views/component/XCellListView/index.vue +3 -3
- package/src/views/component/XFormGroupView/index.vue +11 -9
- package/src/views/component/XFormView/index.vue +12 -48
|
@@ -1,507 +1,542 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, defineEmits, defineProps, ref, watch } from 'vue'
|
|
3
|
-
import {
|
|
4
|
-
BackTop as VanBackTop,
|
|
5
|
-
Button as VanButton,
|
|
6
|
-
Col as VanCol,
|
|
7
|
-
List as VanList,
|
|
8
|
-
Popover as VanPopover,
|
|
9
|
-
PullRefresh as VanPullRefresh,
|
|
10
|
-
Row as VanRow,
|
|
11
|
-
Search as VanSearch,
|
|
12
|
-
Space as VanSpace,
|
|
13
|
-
showConfirmDialog,
|
|
14
|
-
} from 'vant'
|
|
15
|
-
import XBadge from '@af-mobile-client-vue3/components/data/XBadge/index.vue'
|
|
16
|
-
import { getConfigByName, query } from '@af-mobile-client-vue3/services/api/common'
|
|
17
|
-
import LoadError from '@af-mobile-client-vue3/views/common/LoadError.vue'
|
|
18
|
-
import XCellListFilter from '@af-mobile-client-vue3/components/data/XCellListFilter/index.vue'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
//
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
//
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
//
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}).
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
<
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, defineEmits, defineProps, onBeforeMount, ref, watch } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
BackTop as VanBackTop,
|
|
5
|
+
Button as VanButton,
|
|
6
|
+
Col as VanCol,
|
|
7
|
+
List as VanList,
|
|
8
|
+
Popover as VanPopover,
|
|
9
|
+
PullRefresh as VanPullRefresh,
|
|
10
|
+
Row as VanRow,
|
|
11
|
+
Search as VanSearch,
|
|
12
|
+
Space as VanSpace,
|
|
13
|
+
showConfirmDialog,
|
|
14
|
+
} from 'vant'
|
|
15
|
+
import XBadge from '@af-mobile-client-vue3/components/data/XBadge/index.vue'
|
|
16
|
+
import { getConfigByName, query } from '@af-mobile-client-vue3/services/api/common'
|
|
17
|
+
import LoadError from '@af-mobile-client-vue3/views/common/LoadError.vue'
|
|
18
|
+
import XCellListFilter from '@af-mobile-client-vue3/components/data/XCellListFilter/index.vue'
|
|
19
|
+
import { useRouter } from 'vue-router'
|
|
20
|
+
|
|
21
|
+
const { configName, serviceName, fixQueryForm } = withDefaults(defineProps<{
|
|
22
|
+
configName?: string
|
|
23
|
+
fixQueryForm?: object
|
|
24
|
+
idKey?: string
|
|
25
|
+
serviceName?: string
|
|
26
|
+
}>(), {
|
|
27
|
+
configName: '',
|
|
28
|
+
fixQueryForm: null,
|
|
29
|
+
idKey: 'o_id',
|
|
30
|
+
serviceName: undefined,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const emit = defineEmits(['toDetail', 'addOption'])
|
|
34
|
+
|
|
35
|
+
const router = useRouter()
|
|
36
|
+
|
|
37
|
+
const orderVal = ref(undefined)
|
|
38
|
+
|
|
39
|
+
const sortordVal = ref(undefined)
|
|
40
|
+
|
|
41
|
+
// 配置内容
|
|
42
|
+
const configContent = ref({})
|
|
43
|
+
|
|
44
|
+
// 主列
|
|
45
|
+
const mainColumns = ref([])
|
|
46
|
+
|
|
47
|
+
// 副标题列
|
|
48
|
+
const subTitleColumns = ref([])
|
|
49
|
+
|
|
50
|
+
// 详情列
|
|
51
|
+
const detailColumns = ref([])
|
|
52
|
+
|
|
53
|
+
// 底部列
|
|
54
|
+
const footColumns = ref([])
|
|
55
|
+
|
|
56
|
+
// 所有的复杂操作列
|
|
57
|
+
const allActions = ref([])
|
|
58
|
+
|
|
59
|
+
// 复杂操作列前三项
|
|
60
|
+
const mainActions = ref([])
|
|
61
|
+
|
|
62
|
+
// 复杂操作列其余项
|
|
63
|
+
const otherActions = ref([])
|
|
64
|
+
|
|
65
|
+
// 数据集
|
|
66
|
+
const list = ref([])
|
|
67
|
+
|
|
68
|
+
// 每个 Popover 的显示状态
|
|
69
|
+
const showPopover = ref<boolean[]>(list.value.map(() => false))
|
|
70
|
+
|
|
71
|
+
// 排序集
|
|
72
|
+
const orderList = ref([])
|
|
73
|
+
|
|
74
|
+
// 表单查询数组
|
|
75
|
+
const formQueryList = ref([])
|
|
76
|
+
|
|
77
|
+
// 总数据
|
|
78
|
+
const totalCount = ref(0)
|
|
79
|
+
|
|
80
|
+
// 当前页数
|
|
81
|
+
const pageNo = ref(1)
|
|
82
|
+
|
|
83
|
+
// 每页数量
|
|
84
|
+
const pageSize = 20
|
|
85
|
+
|
|
86
|
+
const searchValue = ref('')
|
|
87
|
+
|
|
88
|
+
const inputSpan = ref(22)
|
|
89
|
+
|
|
90
|
+
// 数据加载状态
|
|
91
|
+
const loading = ref(false)
|
|
92
|
+
const refreshing = ref(false)
|
|
93
|
+
const finished = ref(false)
|
|
94
|
+
const isError = ref(false)
|
|
95
|
+
const finishedText = ref('加载完成')
|
|
96
|
+
// 避免查询多次
|
|
97
|
+
const isLastPage = ref(false)
|
|
98
|
+
|
|
99
|
+
const conditionParams = ref(undefined)
|
|
100
|
+
|
|
101
|
+
// 主要按钮的状态
|
|
102
|
+
const buttonState = ref(undefined)
|
|
103
|
+
|
|
104
|
+
// 新增or查询的表单配置
|
|
105
|
+
const groupFormItems = ref({})
|
|
106
|
+
const title = ref('')
|
|
107
|
+
|
|
108
|
+
onBeforeMount(() => {
|
|
109
|
+
initComponent()
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// 组件初始化
|
|
113
|
+
function initComponent() {
|
|
114
|
+
getConfigByName(configName, (result) => {
|
|
115
|
+
groupFormItems.value = result
|
|
116
|
+
title.value = result.title
|
|
117
|
+
for (let i = 0; i < result.columnJson.length; i++) {
|
|
118
|
+
const item = result.columnJson[i]
|
|
119
|
+
item.span = item.flexSpan
|
|
120
|
+
if (item.slotType === 'badge')
|
|
121
|
+
item.dictName = item.slotKeyMap
|
|
122
|
+
|
|
123
|
+
if (item.mobileColumnType === 'mobile_header_column') {
|
|
124
|
+
mainColumns.value.push(item)
|
|
125
|
+
}
|
|
126
|
+
else if (item.mobileColumnType === 'mobile_subtitle_column') {
|
|
127
|
+
subTitleColumns.value.push(item)
|
|
128
|
+
}
|
|
129
|
+
else if (item.mobileColumnType === 'mobile_details_column') {
|
|
130
|
+
detailColumns.value.push(item)
|
|
131
|
+
}
|
|
132
|
+
else if (item.mobileColumnType === 'mobile_footer_column') {
|
|
133
|
+
footColumns.value.push(item)
|
|
134
|
+
}
|
|
135
|
+
else if (item.slotType === 'action' && item.actionArr) {
|
|
136
|
+
for (let j = 0; j < item.actionArr.length; j++)
|
|
137
|
+
allActions.value.push({ text: item.actionArr[j].text, func: item.actionArr[j].func })
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (result.showSortIcon && item.sortable) {
|
|
141
|
+
orderList.value.push({
|
|
142
|
+
title: item.title,
|
|
143
|
+
value: item.dataIndex,
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
configContent.value = result
|
|
148
|
+
formQueryList.value = result.formJson
|
|
149
|
+
|
|
150
|
+
if (result.buttonState) {
|
|
151
|
+
buttonState.value = result.buttonState
|
|
152
|
+
if (buttonState.value.edit && buttonState.value.edit === true)
|
|
153
|
+
allActions.value.push({ text: '修改', func: 'updateRow' })
|
|
154
|
+
if (buttonState.value.delete && buttonState.value.delete === true)
|
|
155
|
+
allActions.value.push({ text: '删除', func: 'deleteRow' })
|
|
156
|
+
}
|
|
157
|
+
splitArrayAt(allActions.value, 3)
|
|
158
|
+
}, serviceName)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 刷新数据
|
|
162
|
+
function onRefresh() {
|
|
163
|
+
isError.value = false
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
// 重新加载数据
|
|
166
|
+
// 将 loading 设置为 true,表示处于加载状态
|
|
167
|
+
refreshing.value = true
|
|
168
|
+
finishedText.value = '加载完成'
|
|
169
|
+
finished.value = false
|
|
170
|
+
loading.value = true
|
|
171
|
+
onLoad()
|
|
172
|
+
}, 100)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// 加载数据
|
|
176
|
+
function onLoad() {
|
|
177
|
+
if (refreshing.value) {
|
|
178
|
+
list.value = []
|
|
179
|
+
pageNo.value = 1
|
|
180
|
+
isLastPage.value = false
|
|
181
|
+
}
|
|
182
|
+
if (!isLastPage.value) {
|
|
183
|
+
let searchVal = searchValue.value
|
|
184
|
+
if (searchVal === '')
|
|
185
|
+
searchVal = undefined
|
|
186
|
+
query({
|
|
187
|
+
queryParamsName: configName,
|
|
188
|
+
pageNo: pageNo.value,
|
|
189
|
+
pageSize,
|
|
190
|
+
conditionParams: {
|
|
191
|
+
$queryValue: searchVal,
|
|
192
|
+
...conditionParams.value,
|
|
193
|
+
},
|
|
194
|
+
sortField: orderVal?.value,
|
|
195
|
+
sortOrder: sortordVal?.value,
|
|
196
|
+
}, serviceName).then((res: any) => {
|
|
197
|
+
totalCount.value = res.totalCount
|
|
198
|
+
if (res.data.length === 0)
|
|
199
|
+
isLastPage.value = true
|
|
200
|
+
|
|
201
|
+
for (const item of res.data)
|
|
202
|
+
list.value.push(item)
|
|
203
|
+
if (list.value.length >= res.totalCount)
|
|
204
|
+
finished.value = true
|
|
205
|
+
else
|
|
206
|
+
pageNo.value = pageNo.value + 1
|
|
207
|
+
}).catch(() => {
|
|
208
|
+
finishedText.value = ''
|
|
209
|
+
finished.value = true
|
|
210
|
+
isError.value = true
|
|
211
|
+
}).finally(() => {
|
|
212
|
+
// 加载状态结束
|
|
213
|
+
loading.value = false
|
|
214
|
+
refreshing.value = false
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// 区分主要操作列与其他操作列
|
|
220
|
+
function splitArrayAt<T>(array: T[], index: number) {
|
|
221
|
+
mainActions.value = array.slice(0, index)
|
|
222
|
+
otherActions.value = array.slice(index)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
watch(() => searchValue.value, (newVal) => {
|
|
226
|
+
if (newVal === '')
|
|
227
|
+
onRefresh()
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
function handleFunctionStyle(funcString, param) {
|
|
231
|
+
try {
|
|
232
|
+
if (!funcString || funcString === '')
|
|
233
|
+
return {}
|
|
234
|
+
|
|
235
|
+
// 匹配参数名、函数体
|
|
236
|
+
const innerFuncRegex = /function\s+\w*\((\w+)\)\s*\{([\s\S]*)\}/
|
|
237
|
+
const matches = funcString.match(innerFuncRegex)
|
|
238
|
+
|
|
239
|
+
const paramName = matches[1] // 提取参数名
|
|
240
|
+
|
|
241
|
+
// eslint-disable-next-line no-new-func
|
|
242
|
+
const func = new Function(paramName, matches[2])
|
|
243
|
+
|
|
244
|
+
return func(param)
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
return {}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// 逆序排列主要按钮
|
|
252
|
+
const reversedMainActions = computed(() => {
|
|
253
|
+
return [...mainActions.value].reverse()
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
// 设置 Popover 的事件
|
|
257
|
+
function onSelectMenu(item: any, event: any) {
|
|
258
|
+
if (event.text === '删除') {
|
|
259
|
+
showConfirmDialog({
|
|
260
|
+
title: '删除',
|
|
261
|
+
message:
|
|
262
|
+
'请确认是否删除!!!',
|
|
263
|
+
}).then(() => {
|
|
264
|
+
emit(event.func, item)
|
|
265
|
+
}).catch(() => {
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
else if (event.text === '修改') {
|
|
269
|
+
router.push({
|
|
270
|
+
name: 'XForm',
|
|
271
|
+
// params: { id: item },
|
|
272
|
+
query: {
|
|
273
|
+
groupFormItems: JSON.stringify(groupFormItems.value),
|
|
274
|
+
serviceName,
|
|
275
|
+
formData: JSON.stringify(item),
|
|
276
|
+
mode: '修改',
|
|
277
|
+
},
|
|
278
|
+
})
|
|
279
|
+
// emit('addOption', totalCount.value)
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
emit(event.func, item)
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// 抛出新增按钮的事件
|
|
287
|
+
function addOption() {
|
|
288
|
+
router.push({
|
|
289
|
+
name: 'XForm',
|
|
290
|
+
// params: { id: totalCount.value },
|
|
291
|
+
query: {
|
|
292
|
+
groupFormItems: JSON.stringify(groupFormItems.value),
|
|
293
|
+
serviceName,
|
|
294
|
+
formData: JSON.stringify({}),
|
|
295
|
+
mode: '新增',
|
|
296
|
+
},
|
|
297
|
+
})
|
|
298
|
+
// emit('addOption', totalCount.value)
|
|
299
|
+
}
|
|
300
|
+
</script>
|
|
301
|
+
|
|
302
|
+
<template>
|
|
303
|
+
<div id="XCellList">
|
|
304
|
+
<VanRow class="filter-condition">
|
|
305
|
+
<VanCol :span="inputSpan">
|
|
306
|
+
<VanSearch
|
|
307
|
+
v-model="searchValue"
|
|
308
|
+
class="title-search"
|
|
309
|
+
clearable
|
|
310
|
+
@search="onRefresh"
|
|
311
|
+
/>
|
|
312
|
+
</VanCol>
|
|
313
|
+
<VanCol span="2" class="search-icon">
|
|
314
|
+
<XCellListFilter
|
|
315
|
+
v-model:sortord-val="sortordVal"
|
|
316
|
+
v-model:order-val="orderVal"
|
|
317
|
+
v-model:condition-params="conditionParams"
|
|
318
|
+
:fix-query-form="fixQueryForm"
|
|
319
|
+
:order-list="orderList"
|
|
320
|
+
:form-query="formQueryList"
|
|
321
|
+
:button-state="buttonState"
|
|
322
|
+
@on-refresh="onRefresh"
|
|
323
|
+
@add-option="addOption"
|
|
324
|
+
/>
|
|
325
|
+
</VanCol>
|
|
326
|
+
</VanRow>
|
|
327
|
+
<div class="main">
|
|
328
|
+
<VanPullRefresh v-model="refreshing" :success-text="finishedText" head-height="70" @refresh="onRefresh">
|
|
329
|
+
<template v-if="!isError">
|
|
330
|
+
<VanList
|
|
331
|
+
v-model:loading="loading"
|
|
332
|
+
class="list_main"
|
|
333
|
+
:finished="finished"
|
|
334
|
+
finished-text="本来无一物,何处惹尘埃"
|
|
335
|
+
@load="onLoad"
|
|
336
|
+
>
|
|
337
|
+
<div v-for="(item, index) in list" :key="`card_${index}`" class="card_item_main">
|
|
338
|
+
<VanRow gutter="20" class="card_item_header" align="center" @click="emit('toDetail', item)">
|
|
339
|
+
<VanCol v-for="(column) in mainColumns" :key="`main_${column.dataIndex}`" :span="18">
|
|
340
|
+
<p
|
|
341
|
+
class="card_item_title"
|
|
342
|
+
:style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
|
|
343
|
+
>
|
|
344
|
+
{{ item[column.dataIndex] ? item[column.dataIndex] : '--' }}
|
|
345
|
+
</p>
|
|
346
|
+
</VanCol>
|
|
347
|
+
<VanCol v-for="(column) in subTitleColumns" :key="`subtitle_${column.dataIndex}`" :span="6">
|
|
348
|
+
<p
|
|
349
|
+
class="card_item_subtitle"
|
|
350
|
+
:style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
|
|
351
|
+
>
|
|
352
|
+
<XBadge
|
|
353
|
+
:style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
|
|
354
|
+
:dict-name="column.dictName" :dict-value="item[column.dataIndex]"
|
|
355
|
+
/>
|
|
356
|
+
</p>
|
|
357
|
+
</VanCol>
|
|
358
|
+
</VanRow>
|
|
359
|
+
<VanRow gutter="20" class="card_item_details" @click="emit('toDetail', item)">
|
|
360
|
+
<VanCol v-for="column of detailColumns" :key="`details_${column.dataIndex}`" :span="column.span">
|
|
361
|
+
<p>
|
|
362
|
+
<span :style="handleFunctionStyle(column.styleFunctionForTitle, item[column.dataIndex])">{{
|
|
363
|
+
column.title
|
|
364
|
+
}}: </span>
|
|
365
|
+
<XBadge
|
|
366
|
+
:style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
|
|
367
|
+
:dict-name="column.dictName" :dict-value="item[column.dataIndex]"
|
|
368
|
+
/>
|
|
369
|
+
</p>
|
|
370
|
+
</VanCol>
|
|
371
|
+
</VanRow>
|
|
372
|
+
<VanRow gutter="20" class="card_item_footer" @click="emit('toDetail', item)">
|
|
373
|
+
<VanCol v-for="column of footColumns" :key="`foot_${column.dataIndex}`" :span="12">
|
|
374
|
+
<p>
|
|
375
|
+
<span :style="handleFunctionStyle(column.styleFunctionForTitle, item[column.dataIndex])">{{
|
|
376
|
+
column.title
|
|
377
|
+
}}: </span>
|
|
378
|
+
<XBadge
|
|
379
|
+
:style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
|
|
380
|
+
:dict-name="column.dictName" :dict-value="item[column.dataIndex]"
|
|
381
|
+
/>
|
|
382
|
+
</p>
|
|
383
|
+
</VanCol>
|
|
384
|
+
</VanRow>
|
|
385
|
+
<VanRow v-if="allActions.length > 0" gutter="20" class="card_item_bottom">
|
|
386
|
+
<VanCol span="4">
|
|
387
|
+
<VanPopover
|
|
388
|
+
v-model:show="showPopover[index]"
|
|
389
|
+
placement="bottom-start"
|
|
390
|
+
:actions="otherActions"
|
|
391
|
+
@select="onSelectMenu(item, $event)"
|
|
392
|
+
>
|
|
393
|
+
<template #reference>
|
|
394
|
+
<VanButton
|
|
395
|
+
v-show="otherActions && otherActions.length !== 0" class="custom-button" size="small"
|
|
396
|
+
icon="ellipsis" type="default"
|
|
397
|
+
/>
|
|
398
|
+
</template>
|
|
399
|
+
</VanPopover>
|
|
400
|
+
</VanCol>
|
|
401
|
+
<VanCol span="20">
|
|
402
|
+
<VanRow justify="end">
|
|
403
|
+
<VanSpace>
|
|
404
|
+
<VanButton
|
|
405
|
+
v-for="button in reversedMainActions"
|
|
406
|
+
:key="button.func"
|
|
407
|
+
type="primary"
|
|
408
|
+
size="small"
|
|
409
|
+
@click="onSelectMenu(item, button)"
|
|
410
|
+
>
|
|
411
|
+
{{ button.text }}
|
|
412
|
+
</VanButton>
|
|
413
|
+
</VanSpace>
|
|
414
|
+
</VanRow>
|
|
415
|
+
</VanCol>
|
|
416
|
+
</VanRow>
|
|
417
|
+
</div>
|
|
418
|
+
</VanList>
|
|
419
|
+
</template>
|
|
420
|
+
<template v-else>
|
|
421
|
+
<LoadError />
|
|
422
|
+
</template>
|
|
423
|
+
</VanPullRefresh>
|
|
424
|
+
<VanBackTop />
|
|
425
|
+
</div>
|
|
426
|
+
</div>
|
|
427
|
+
</template>
|
|
428
|
+
|
|
429
|
+
<style scoped lang="less">
|
|
430
|
+
#XCellList {
|
|
431
|
+
height: calc(94vh - var(--van-nav-bar-height) - 5px);
|
|
432
|
+
--van-search-padding:5px;
|
|
433
|
+
.main {
|
|
434
|
+
overflow-y: auto;
|
|
435
|
+
height: 100%;
|
|
436
|
+
background-color: var(--van-background);
|
|
437
|
+
padding: var(--van-padding-base) var(--van-padding-sm);
|
|
438
|
+
|
|
439
|
+
p {
|
|
440
|
+
white-space: nowrap;
|
|
441
|
+
overflow: hidden;
|
|
442
|
+
text-overflow: ellipsis;
|
|
443
|
+
margin: 0;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.card_item_main {
|
|
447
|
+
background-color: var(--van-background-2);
|
|
448
|
+
border-radius: var(--van-radius-lg);
|
|
449
|
+
margin: 0 0 var(--van-padding-xs) 0;
|
|
450
|
+
padding: var(--van-padding-sm);
|
|
451
|
+
|
|
452
|
+
.card_item_header {
|
|
453
|
+
margin-bottom: var(--van-padding-base);
|
|
454
|
+
|
|
455
|
+
.card_item_title {
|
|
456
|
+
font-size: var(--van-font-size-lg);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.card_item_subtitle {
|
|
460
|
+
font-size: var(--van-font-size-xs);
|
|
461
|
+
color: var(--van-text-color-2);
|
|
462
|
+
text-align: right;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.card_item_details {
|
|
467
|
+
margin-bottom: var(--van-padding-base);
|
|
468
|
+
font-size: var(--van-font-size-sm);
|
|
469
|
+
color: #666;
|
|
470
|
+
|
|
471
|
+
.van-col {
|
|
472
|
+
margin-bottom: 2px;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.card_item_footer {
|
|
477
|
+
font-size: var(--van-font-size-sm);
|
|
478
|
+
color: var(--van-text-color-2);
|
|
479
|
+
margin-bottom: 15px;
|
|
480
|
+
|
|
481
|
+
.van-col:last-child {
|
|
482
|
+
text-align: right;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.van-col:first-child {
|
|
486
|
+
text-align: left;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.filter-condition {
|
|
493
|
+
:deep(.van-search) {
|
|
494
|
+
padding: var(--van-search-padding);
|
|
495
|
+
}
|
|
496
|
+
.search-icon{
|
|
497
|
+
display: flex;
|
|
498
|
+
align-items: center;
|
|
499
|
+
justify-content: center;
|
|
500
|
+
}
|
|
501
|
+
:deep(.van-search__content) {
|
|
502
|
+
border-radius: 8px;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
//.title-search {
|
|
506
|
+
// height: 4vh;
|
|
507
|
+
//}
|
|
508
|
+
|
|
509
|
+
:deep(.van-dropdown-menu__bar) {
|
|
510
|
+
height: calc(4vh - 4px);
|
|
511
|
+
box-shadow: none;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
:deep(.van-dropdown-menu__title) {
|
|
515
|
+
padding: 0;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
:deep(.van-dropdown-menu__title--down:after) {
|
|
519
|
+
display: none;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
:deep(.van-dropdown-menu__title:after) {
|
|
523
|
+
display: none;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
:deep(.van-dropdown-item__content) {
|
|
527
|
+
position: absolute;
|
|
528
|
+
max-height: var(--van-dropdown-menu-content-max-height);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
:deep(.van-dropdown-menu__item) {
|
|
532
|
+
align-items: flex-start;
|
|
533
|
+
justify-content: flex-start;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.custom-button {
|
|
538
|
+
border: none !important;
|
|
539
|
+
box-shadow: none !important;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
</style>
|