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