wui-components-v2 1.2.32 → 1.2.34
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.
|
@@ -33,10 +33,20 @@ const props = withDefaults(
|
|
|
33
33
|
* 标题旁标签是否展示,由父级读取控制,默认不展示。
|
|
34
34
|
*/
|
|
35
35
|
showLabel?: boolean
|
|
36
|
+
/**
|
|
37
|
+
* 是否显示详情弹窗(detailPopup),透传给 LabelValue。默认 true。
|
|
38
|
+
*/
|
|
39
|
+
showDetailPopup?: boolean
|
|
40
|
+
/**
|
|
41
|
+
* 自定义详情按钮回调,透传给 LabelValue。showDetailPopup 为 false 时优先使用
|
|
42
|
+
*/
|
|
43
|
+
detailButtonHandle?: (data: Entities) => void
|
|
36
44
|
}>(),
|
|
37
45
|
{
|
|
38
46
|
// 标题旁标签默认不展示
|
|
39
47
|
showLabel: false,
|
|
48
|
+
// 详情弹窗默认显示
|
|
49
|
+
showDetailPopup: true,
|
|
40
50
|
}
|
|
41
51
|
)
|
|
42
52
|
const { currentThemeColor } = useManualTheme()
|
|
@@ -176,12 +186,24 @@ function toggleCollapse(contentId: string) {
|
|
|
176
186
|
<view class="mb-3">
|
|
177
187
|
<!-- 订单信息 -->
|
|
178
188
|
<view class="text-sm space-y-3">
|
|
179
|
-
<LabelValue
|
|
189
|
+
<LabelValue
|
|
190
|
+
:exhibit-data="exhibitData"
|
|
191
|
+
:data="data"
|
|
192
|
+
:index="index"
|
|
193
|
+
:show-detail-popup="showDetailPopup"
|
|
194
|
+
:detail-button-handle="detailButtonHandle"
|
|
195
|
+
/>
|
|
180
196
|
|
|
181
197
|
<!-- 可折叠内容 -->
|
|
182
198
|
<view class="fold-collapse" :class="expanded ? 'is-expanded' : 'is-collapsed'">
|
|
183
199
|
<view class="space-y-3">
|
|
184
|
-
<LabelValue
|
|
200
|
+
<LabelValue
|
|
201
|
+
:exhibit-data="collapseData"
|
|
202
|
+
:data="data"
|
|
203
|
+
:index="index"
|
|
204
|
+
:show-detail-popup="showDetailPopup"
|
|
205
|
+
:detail-button-handle="detailButtonHandle"
|
|
206
|
+
/>
|
|
185
207
|
</view>
|
|
186
208
|
</view>
|
|
187
209
|
</view>
|
|
@@ -12,11 +12,26 @@ import detailPopup from '../detail-popup/detail-popup.vue'
|
|
|
12
12
|
defineOptions({
|
|
13
13
|
name: 'LabelValue',
|
|
14
14
|
})
|
|
15
|
-
const props =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const props = withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
exhibitData: Columns[]
|
|
18
|
+
data: Entities
|
|
19
|
+
index: number
|
|
20
|
+
/**
|
|
21
|
+
* 是否显示详情弹窗(detailPopup)。默认 true。
|
|
22
|
+
* 为 true 时:字段配置了 detail 按钮时显示可点击的 detailPopup 弹窗
|
|
23
|
+
* 为 false 时:字段配置了 detail 按钮时显示可点击的文字,点击跳转详情页面
|
|
24
|
+
*/
|
|
25
|
+
showDetailPopup?: boolean
|
|
26
|
+
/**
|
|
27
|
+
* 自定义详情按钮回调,showDetailPopup 为 false 时优先使用
|
|
28
|
+
*/
|
|
29
|
+
detailButtonHandle?: (data: Entities) => void
|
|
30
|
+
}>(),
|
|
31
|
+
{
|
|
32
|
+
showDetailPopup: true,
|
|
33
|
+
}
|
|
34
|
+
)
|
|
20
35
|
const { primary } = useManualTheme()
|
|
21
36
|
const clums = computed(() => {
|
|
22
37
|
return props.exhibitData.filter(item => !item.title?.includes('y'))
|
|
@@ -33,6 +48,31 @@ function isControlType(item: Columns): string {
|
|
|
33
48
|
props.data.fieldMap?.[item.sourceId] || ''
|
|
34
49
|
)
|
|
35
50
|
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 跳转详情页面(showDetailPopup 为 false 时触发)
|
|
54
|
+
* 参考 aldehyde-uniapp-template w-card.vue 的 goto('link', item, subItem) 逻辑
|
|
55
|
+
* 使用字段自身的 sourceId 和值的 code 进行跳转
|
|
56
|
+
*/
|
|
57
|
+
function goDetail(item: Columns) {
|
|
58
|
+
if (props.detailButtonHandle) {
|
|
59
|
+
props.detailButtonHandle(props.data)
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
const rawValue = props.data.fieldMap[item.sourceId]
|
|
63
|
+
// 参考 w-card.vue:code 取 @R@ 前面的部分,如果包含 @,@ 则取第一段
|
|
64
|
+
let code = rawValue
|
|
65
|
+
if (typeof rawValue === 'string' && rawValue.includes('@R@')) {
|
|
66
|
+
code = rawValue.split('@R@')[0]
|
|
67
|
+
}
|
|
68
|
+
if (typeof rawValue === 'string' && rawValue.includes('@,@')) {
|
|
69
|
+
code = rawValue.split('@,@')[0]?.split('@R@')[0]
|
|
70
|
+
}
|
|
71
|
+
// 使用字段自身的 sourceId(参考 w-card.vue goto('link'))
|
|
72
|
+
uni.navigateTo({
|
|
73
|
+
url: `/pages/details-page/index?sourceId=${item.sourceId}&id=${code}&title=${item.title || ''}`,
|
|
74
|
+
})
|
|
75
|
+
}
|
|
36
76
|
</script>
|
|
37
77
|
|
|
38
78
|
<template>
|
|
@@ -131,10 +171,14 @@ function isControlType(item: Columns): string {
|
|
|
131
171
|
</view>
|
|
132
172
|
<view v-else-if="item.buttons?.includes('detail')" class="flex flex-1 items-center text-gray-800 dark:text-white">
|
|
133
173
|
<detailPopup
|
|
174
|
+
v-if="props.showDetailPopup !== false"
|
|
134
175
|
:source="item"
|
|
135
176
|
:text="formatItemData(data.fieldMap[item.sourceId], isControlType(item))"
|
|
136
177
|
:code="data.fieldMap[item.sourceId]"
|
|
137
178
|
/>
|
|
179
|
+
<view v-else class="text-[#1c64fd]" @click="goDetail(item)">
|
|
180
|
+
{{ formatItemData(data.fieldMap[item.sourceId], isControlType(item)) }}
|
|
181
|
+
</view>
|
|
138
182
|
</view>
|
|
139
183
|
<openValueMore v-else :text="formatItemData(data.fieldMap[item.sourceId], isControlType(item))" />
|
|
140
184
|
</view>
|
|
@@ -3,7 +3,7 @@ import { defineOptions, defineProps, onMounted, onUnmounted, ref } from 'vue'
|
|
|
3
3
|
import { onLoad } from '@dcloudio/uni-app'
|
|
4
4
|
import { listData, pageConfig, pageKey } from '../../api/page'
|
|
5
5
|
import foldCard2 from '../fold-card2/fold-card2.vue'
|
|
6
|
-
import type { Config,
|
|
6
|
+
import type { Config, EditButtonConfig, Entities } from '../../type'
|
|
7
7
|
import Search from '../search/search.vue'
|
|
8
8
|
import ListTopButtons from '../list-top-buttons/list-top-buttons.vue'
|
|
9
9
|
import CardBotomButtons from '../card-botom-buttons/card-botom-buttons.vue'
|
|
@@ -38,15 +38,11 @@ withDefaults(
|
|
|
38
38
|
*/
|
|
39
39
|
editButtonConfig?: EditButtonConfig
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* 是否显示详情弹窗(detailPopup)。默认 true。
|
|
42
|
+
* 为 true 时:字段配置了 detail 按钮时显示可点击的 detailPopup 弹窗
|
|
43
|
+
* 为 false 时:字段配置了 detail 按钮时仅显示「详情」文字,不可点击
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 自定义详情按钮配置:动态文字 / 显隐 / 点击行为。
|
|
47
|
-
* 不传时走组件内置的「详情」按钮逻辑。
|
|
48
|
-
*/
|
|
49
|
-
detailButtonConfig?: DetailButtonConfig
|
|
45
|
+
showDetailPopup?: boolean
|
|
50
46
|
}>(),
|
|
51
47
|
{
|
|
52
48
|
// 操作按钮区域(编辑/删除/morebutns)默认显示
|
|
@@ -55,6 +51,8 @@ withDefaults(
|
|
|
55
51
|
showTopButtons: true,
|
|
56
52
|
// 标题旁标签默认不展示
|
|
57
53
|
showLabel: false,
|
|
54
|
+
// 详情弹窗默认显示
|
|
55
|
+
showDetailPopup: true,
|
|
58
56
|
}
|
|
59
57
|
)
|
|
60
58
|
|
|
@@ -282,8 +280,6 @@ function tabSearchClick(data: any) {
|
|
|
282
280
|
:is-show-action="isShowAction"
|
|
283
281
|
:copy-mode="config.copyMode"
|
|
284
282
|
:edit-button-config="editButtonConfig"
|
|
285
|
-
:delete-button-config="deleteButtonConfig"
|
|
286
|
-
:detail-button-config="detailButtonConfig"
|
|
287
283
|
/>
|
|
288
284
|
</template>
|
|
289
285
|
</productCard>
|
|
@@ -303,6 +299,8 @@ function tabSearchClick(data: any) {
|
|
|
303
299
|
:second-column="config.secondColumn"
|
|
304
300
|
:label-column="config.labelColumn"
|
|
305
301
|
:show-label="showLabel"
|
|
302
|
+
:show-detail-popup="showDetailPopup"
|
|
303
|
+
:detail-button-handle="detailButtonHandle"
|
|
306
304
|
model="complex"
|
|
307
305
|
>
|
|
308
306
|
<template #buttons>
|
|
@@ -326,8 +324,6 @@ function tabSearchClick(data: any) {
|
|
|
326
324
|
:is-show-action="isShowAction"
|
|
327
325
|
:copy-mode="config.copyMode"
|
|
328
326
|
:edit-button-config="editButtonConfig"
|
|
329
|
-
:delete-button-config="deleteButtonConfig"
|
|
330
|
-
:detail-button-config="detailButtonConfig"
|
|
331
327
|
/>
|
|
332
328
|
</template>
|
|
333
329
|
</foldCard2>
|