af-mobile-client-vue3 1.0.70 → 1.0.71
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/.cursorrules +61 -0
- package/package.json +1 -1
- package/src/components/core/XGridDropOption/index.vue +151 -132
- package/src/components/core/XMultiSelect/index.vue +183 -185
- package/src/components/core/XSelect/index.vue +122 -122
- package/src/components/data/XCellList/index.vue +116 -57
- package/src/components/data/XCellListFilter/index.vue +240 -230
- package/src/components/data/XForm/index.vue +27 -21
- package/src/components/data/XFormGroup/index.vue +96 -78
- package/src/components/data/XFormItem/index.vue +638 -595
- package/src/components/data/XReportForm/index.vue +19 -0
- package/src/components/data/XSignature/index.vue +285 -0
- package/src/router/routes.ts +12 -0
- package/src/utils/authority-utils.ts +0 -1
- package/src/utils/runEvalFunction.ts +13 -0
- package/src/views/component/XCellListView/index.vue +96 -57
- package/src/views/component/XFormGroupView/index.vue +54 -0
- package/src/views/component/XFormView/index.vue +170 -55
- package/src/views/component/XReportFormView/index.vue +2 -284
- package/src/views/component/XSignatureView/index.vue +50 -0
- package/src/views/component/index.vue +9 -1
- package/vite.config.ts +1 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {computed, defineEmits, defineProps, ref, watch} from 'vue'
|
|
2
|
+
import { computed, defineEmits, defineProps, ref, watch } from 'vue'
|
|
3
3
|
import {
|
|
4
4
|
BackTop as VanBackTop,
|
|
5
|
+
Button as VanButton,
|
|
5
6
|
Col as VanCol,
|
|
6
7
|
List as VanList,
|
|
8
|
+
Popover as VanPopover,
|
|
7
9
|
PullRefresh as VanPullRefresh,
|
|
8
10
|
Row as VanRow,
|
|
9
11
|
Search as VanSearch,
|
|
10
|
-
Button as VanButton,
|
|
11
12
|
Space as VanSpace,
|
|
12
|
-
|
|
13
|
+
showConfirmDialog,
|
|
13
14
|
} from 'vant'
|
|
14
15
|
import XBadge from '@af-mobile-client-vue3/components/data/XBadge/index.vue'
|
|
15
|
-
import {getConfigByName, query} from '@af-mobile-client-vue3/services/api/common'
|
|
16
|
+
import { getConfigByName, query } from '@af-mobile-client-vue3/services/api/common'
|
|
16
17
|
import LoadError from '@af-mobile-client-vue3/views/common/LoadError.vue'
|
|
17
18
|
import XCellListFilter from '@af-mobile-client-vue3/components/data/XCellListFilter/index.vue'
|
|
18
19
|
|
|
19
|
-
const {configName, serviceName} = withDefaults(defineProps<{
|
|
20
|
+
const { configName, serviceName } = withDefaults(defineProps<{
|
|
20
21
|
configName?: string
|
|
21
22
|
fixQueryForm?: object
|
|
22
23
|
idKey?: string
|
|
@@ -28,7 +29,7 @@ const {configName, serviceName} = withDefaults(defineProps<{
|
|
|
28
29
|
serviceName: undefined,
|
|
29
30
|
})
|
|
30
31
|
|
|
31
|
-
const emit = defineEmits(['toDetail'])
|
|
32
|
+
const emit = defineEmits(['toDetail', 'addOption'])
|
|
32
33
|
|
|
33
34
|
const orderVal = ref(undefined)
|
|
34
35
|
|
|
@@ -49,6 +50,9 @@ const detailColumns = ref([])
|
|
|
49
50
|
// 底部列
|
|
50
51
|
const footColumns = ref([])
|
|
51
52
|
|
|
53
|
+
// 所有的复杂操作列
|
|
54
|
+
const allActions = ref([])
|
|
55
|
+
|
|
52
56
|
// 复杂操作列前三项
|
|
53
57
|
const mainActions = ref([])
|
|
54
58
|
|
|
@@ -91,6 +95,9 @@ const isLastPage = ref(false)
|
|
|
91
95
|
|
|
92
96
|
const conditionParams = ref(undefined)
|
|
93
97
|
|
|
98
|
+
// 主要按钮的状态
|
|
99
|
+
const buttonState = ref(undefined)
|
|
100
|
+
|
|
94
101
|
initComponent()
|
|
95
102
|
|
|
96
103
|
// 组件初始化
|
|
@@ -102,28 +109,21 @@ function initComponent() {
|
|
|
102
109
|
if (item.slotType === 'badge')
|
|
103
110
|
item.dictName = item.slotKeyMap
|
|
104
111
|
|
|
105
|
-
if (item.mobileColumnType === 'mobile_header_column')
|
|
112
|
+
if (item.mobileColumnType === 'mobile_header_column') {
|
|
106
113
|
mainColumns.value.push(item)
|
|
107
|
-
|
|
108
|
-
else if (item.mobileColumnType === 'mobile_subtitle_column')
|
|
114
|
+
}
|
|
115
|
+
else if (item.mobileColumnType === 'mobile_subtitle_column') {
|
|
109
116
|
subTitleColumns.value.push(item)
|
|
110
|
-
|
|
111
|
-
else if (item.mobileColumnType === 'mobile_details_column')
|
|
117
|
+
}
|
|
118
|
+
else if (item.mobileColumnType === 'mobile_details_column') {
|
|
112
119
|
detailColumns.value.push(item)
|
|
113
|
-
|
|
114
|
-
else if (item.mobileColumnType === 'mobile_footer_column')
|
|
120
|
+
}
|
|
121
|
+
else if (item.mobileColumnType === 'mobile_footer_column') {
|
|
115
122
|
footColumns.value.push(item)
|
|
116
|
-
|
|
117
|
-
else if (item.slotType === 'action') {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (j < 3){
|
|
121
|
-
mainActions.value.push({text: item.actionArr[j].text, func: item.actionArr[j].func})
|
|
122
|
-
}else {
|
|
123
|
-
otherActions.value.push({text: item.actionArr[j].text, func: item.actionArr[j].func})
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
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
127
|
}
|
|
128
128
|
|
|
129
129
|
if (result.showSortIcon && item.sortable) {
|
|
@@ -135,7 +135,16 @@ function initComponent() {
|
|
|
135
135
|
}
|
|
136
136
|
configContent.value = result
|
|
137
137
|
formQueryList.value = result.formJson
|
|
138
|
-
|
|
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)
|
|
139
148
|
}
|
|
140
149
|
|
|
141
150
|
// 刷新数据
|
|
@@ -178,7 +187,6 @@ function onLoad() {
|
|
|
178
187
|
if (res.data.length === 0)
|
|
179
188
|
isLastPage.value = true
|
|
180
189
|
|
|
181
|
-
|
|
182
190
|
for (const item of res.data)
|
|
183
191
|
list.value.push(item)
|
|
184
192
|
if (list.value.length >= res.totalCount)
|
|
@@ -197,6 +205,12 @@ function onLoad() {
|
|
|
197
205
|
}
|
|
198
206
|
}
|
|
199
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
|
+
|
|
200
214
|
watch(() => searchValue.value, (newVal) => {
|
|
201
215
|
if (newVal === '')
|
|
202
216
|
onRefresh()
|
|
@@ -217,19 +231,37 @@ function handleFunctionStyle(funcString, param) {
|
|
|
217
231
|
const func = new Function(paramName, matches[2])
|
|
218
232
|
|
|
219
233
|
return func(param)
|
|
220
|
-
}
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
221
236
|
return {}
|
|
222
237
|
}
|
|
223
238
|
}
|
|
224
239
|
|
|
225
240
|
// 逆序排列主要按钮
|
|
226
|
-
const reversedMainActions = computed(()=>{
|
|
241
|
+
const reversedMainActions = computed(() => {
|
|
227
242
|
return [...mainActions.value].reverse()
|
|
228
243
|
})
|
|
229
244
|
|
|
230
245
|
// 设置 Popover 的事件
|
|
231
|
-
|
|
232
|
-
|
|
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)
|
|
233
265
|
}
|
|
234
266
|
</script>
|
|
235
267
|
|
|
@@ -244,14 +276,16 @@ const onSelectMenu = (item:any,event:any) => {
|
|
|
244
276
|
@search="onRefresh"
|
|
245
277
|
/>
|
|
246
278
|
</VanCol>
|
|
247
|
-
<VanCol span="2">
|
|
279
|
+
<VanCol span="2" class = "search-icon">
|
|
248
280
|
<XCellListFilter
|
|
249
281
|
v-model:sortord-val="sortordVal"
|
|
250
282
|
v-model:order-val="orderVal"
|
|
251
283
|
v-model:condition-params="conditionParams"
|
|
252
284
|
:order-list="orderList"
|
|
253
285
|
:form-query="formQueryList"
|
|
286
|
+
:button-state="buttonState"
|
|
254
287
|
@on-refresh="onRefresh"
|
|
288
|
+
@add-option="addOption"
|
|
255
289
|
/>
|
|
256
290
|
</VanCol>
|
|
257
291
|
</VanRow>
|
|
@@ -268,16 +302,22 @@ const onSelectMenu = (item:any,event:any) => {
|
|
|
268
302
|
<div v-for="(item, index) in list" :key="`card_${index}`" class="card_item_main">
|
|
269
303
|
<VanRow gutter="20" class="card_item_header" align="center" @click="emit('toDetail', item)">
|
|
270
304
|
<VanCol v-for="(column) in mainColumns" :key="`main_${column.dataIndex}`" :span="18">
|
|
271
|
-
<p
|
|
272
|
-
|
|
305
|
+
<p
|
|
306
|
+
class="card_item_title"
|
|
307
|
+
:style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
|
|
308
|
+
>
|
|
273
309
|
{{ item[column.dataIndex] ? item[column.dataIndex] : '--' }}
|
|
274
310
|
</p>
|
|
275
311
|
</VanCol>
|
|
276
312
|
<VanCol v-for="(column) in subTitleColumns" :key="`subtitle_${column.dataIndex}`" :span="6">
|
|
277
|
-
<p
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
+
/>
|
|
281
321
|
</p>
|
|
282
322
|
</VanCol>
|
|
283
323
|
</VanRow>
|
|
@@ -285,10 +325,12 @@ const onSelectMenu = (item:any,event:any) => {
|
|
|
285
325
|
<VanCol v-for="column of detailColumns" :key="`details_${column.dataIndex}`" :span="column.span">
|
|
286
326
|
<p>
|
|
287
327
|
<span :style="handleFunctionStyle(column.styleFunctionForTitle, item[column.dataIndex])">{{
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
<XBadge
|
|
291
|
-
|
|
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
|
+
/>
|
|
292
334
|
</p>
|
|
293
335
|
</VanCol>
|
|
294
336
|
</VanRow>
|
|
@@ -296,30 +338,41 @@ const onSelectMenu = (item:any,event:any) => {
|
|
|
296
338
|
<VanCol v-for="column of footColumns" :key="`foot_${column.dataIndex}`" :span="12">
|
|
297
339
|
<p>
|
|
298
340
|
<span :style="handleFunctionStyle(column.styleFunctionForTitle, item[column.dataIndex])">{{
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
<XBadge
|
|
302
|
-
|
|
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
|
+
/>
|
|
303
347
|
</p>
|
|
304
348
|
</VanCol>
|
|
305
349
|
</VanRow>
|
|
306
|
-
<VanRow gutter="20" class="card_item_bottom">
|
|
350
|
+
<VanRow v-if="allActions.length > 0" gutter="20" class="card_item_bottom">
|
|
307
351
|
<VanCol span="4">
|
|
308
352
|
<VanPopover
|
|
309
353
|
v-model:show="showPopover[index]"
|
|
310
354
|
placement="bottom-start"
|
|
311
355
|
:actions="otherActions"
|
|
312
|
-
@select="onSelectMenu(item
|
|
356
|
+
@select="onSelectMenu(item, $event)"
|
|
313
357
|
>
|
|
314
358
|
<template #reference>
|
|
315
|
-
<VanButton
|
|
359
|
+
<VanButton
|
|
360
|
+
v-show="otherActions && otherActions.length !== 0" class="custom-button" size="small"
|
|
361
|
+
icon="ellipsis" type="default"
|
|
362
|
+
/>
|
|
316
363
|
</template>
|
|
317
364
|
</VanPopover>
|
|
318
365
|
</VanCol>
|
|
319
366
|
<VanCol span="20">
|
|
320
367
|
<VanRow justify="end">
|
|
321
368
|
<VanSpace>
|
|
322
|
-
<VanButton
|
|
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
|
+
>
|
|
323
376
|
{{ button.text }}
|
|
324
377
|
</VanButton>
|
|
325
378
|
</VanSpace>
|
|
@@ -330,10 +383,10 @@ const onSelectMenu = (item:any,event:any) => {
|
|
|
330
383
|
</VanList>
|
|
331
384
|
</template>
|
|
332
385
|
<template v-else>
|
|
333
|
-
<LoadError/>
|
|
386
|
+
<LoadError />
|
|
334
387
|
</template>
|
|
335
388
|
</VanPullRefresh>
|
|
336
|
-
<VanBackTop/>
|
|
389
|
+
<VanBackTop />
|
|
337
390
|
</div>
|
|
338
391
|
</div>
|
|
339
392
|
</template>
|
|
@@ -341,7 +394,7 @@ const onSelectMenu = (item:any,event:any) => {
|
|
|
341
394
|
<style scoped lang="less">
|
|
342
395
|
#XCellList {
|
|
343
396
|
height: calc(94vh - var(--van-nav-bar-height) - 5px);
|
|
344
|
-
|
|
397
|
+
--van-search-padding:5px;
|
|
345
398
|
.main {
|
|
346
399
|
overflow-y: auto;
|
|
347
400
|
height: 100%;
|
|
@@ -403,15 +456,21 @@ const onSelectMenu = (item:any,event:any) => {
|
|
|
403
456
|
|
|
404
457
|
.filter-condition {
|
|
405
458
|
:deep(.van-search) {
|
|
406
|
-
padding:
|
|
459
|
+
padding: var(--van-search-padding);
|
|
460
|
+
}
|
|
461
|
+
.search-icon{
|
|
462
|
+
display: flex;
|
|
463
|
+
align-items: center;
|
|
464
|
+
justify-content: center;
|
|
407
465
|
}
|
|
408
|
-
|
|
409
466
|
:deep(.van-search__content) {
|
|
410
467
|
border-radius: 8px;
|
|
411
468
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
469
|
+
|
|
470
|
+
//.title-search {
|
|
471
|
+
// height: 4vh;
|
|
472
|
+
//}
|
|
473
|
+
|
|
415
474
|
:deep(.van-dropdown-menu__bar) {
|
|
416
475
|
height: calc(4vh - 4px);
|
|
417
476
|
box-shadow: none;
|