af-mobile-client-vue3 1.0.71 → 1.0.72

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