vue2-client 1.16.39 → 1.16.40
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
CHANGED
@@ -1,25 +1,42 @@
|
|
1
|
-
<script setup
|
1
|
+
<script setup>
|
2
2
|
import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'
|
3
|
-
import { ref, computed } from 'vue'
|
3
|
+
import { ref, computed, useAttrs } from 'vue'
|
4
4
|
|
5
5
|
const props = defineProps({
|
6
6
|
// HFormTable特有的属性
|
7
7
|
tableStyle: {
|
8
8
|
type: String,
|
9
9
|
default: 'formtable-col1'
|
10
|
-
},
|
11
|
-
// 顶部
|
12
|
-
topStyle: {
|
13
|
-
type: String,
|
14
|
-
default: ''
|
15
|
-
},
|
16
|
-
// 分页
|
17
|
-
paginationStyle: {
|
18
|
-
type: String,
|
19
|
-
default: ''
|
20
10
|
}
|
21
11
|
})
|
22
12
|
|
13
|
+
// 兼容多种样式配置
|
14
|
+
const attrs = useAttrs()
|
15
|
+
const wrapperClassObject = computed(() => {
|
16
|
+
const a = attrs
|
17
|
+
const classes = {}
|
18
|
+
|
19
|
+
// 通用布尔样式开关(以存在/空字符串/'true' 为真)
|
20
|
+
const booleanStyleKeys = [
|
21
|
+
'button-row-0margin',
|
22
|
+
'top-hidden'
|
23
|
+
]
|
24
|
+
for (const key of booleanStyleKeys) {
|
25
|
+
const val = a[key]
|
26
|
+
const truthy = val === true || val === '' || val === 'true'
|
27
|
+
if (truthy) classes[`h-form-table-${key}`] = true
|
28
|
+
}
|
29
|
+
|
30
|
+
// 兼容通过 attrs 透传的分页样式:将值映射为当前样式中存在的类名
|
31
|
+
const paginationAttr = a && a.paginationStyle
|
32
|
+
if (paginationAttr && ['pagination-center', 'custom-pagination'].includes(paginationAttr)) {
|
33
|
+
classes[`h-form-table-${paginationAttr}`] = true
|
34
|
+
}
|
35
|
+
return classes
|
36
|
+
})
|
37
|
+
|
38
|
+
// 通过暴露的实例访问 $slots,避免直接依赖 Composition API 的 useSlots
|
39
|
+
// 在模板中使用 `$slots` 遍历以保持与 Vue2 兼容
|
23
40
|
// 创建对XFormTable组件的引用
|
24
41
|
const xFormTableRef = ref()
|
25
42
|
|
@@ -29,8 +46,12 @@ defineExpose({
|
|
29
46
|
getXFormTableInstance: () => xFormTableRef.value
|
30
47
|
})
|
31
48
|
|
32
|
-
//
|
33
|
-
const isCustomPagination = computed(() =>
|
49
|
+
// 计算是否使用自定义分页(兼容 attrs 透传与 tableStyle 配置)
|
50
|
+
const isCustomPagination = computed(() => {
|
51
|
+
const a = attrs
|
52
|
+
const paginationAttr = (a && a.paginationStyle) || ''
|
53
|
+
return props.tableStyle === 'custom-pagination' || paginationAttr === 'custom-pagination'
|
54
|
+
})
|
34
55
|
</script>
|
35
56
|
|
36
57
|
<template>
|
@@ -38,10 +59,7 @@ const isCustomPagination = computed(() => props.tableStyle === 'custom-paginatio
|
|
38
59
|
class="h-form-table-wrapper"
|
39
60
|
:class="[
|
40
61
|
`h-form-table-${tableStyle}`,
|
41
|
-
|
42
|
-
[`h-form-table-${topStyle}`]: ['top-hidden'].includes(topStyle),
|
43
|
-
[`h-form-table-${paginationStyle}`]: ['pagination-center','custom-pagination'].includes(paginationStyle)
|
44
|
-
}
|
62
|
+
wrapperClassObject
|
45
63
|
]"
|
46
64
|
>
|
47
65
|
<x-form-table
|
@@ -215,5 +233,12 @@ const isCustomPagination = computed(() => props.tableStyle === 'custom-paginatio
|
|
215
233
|
}
|
216
234
|
}
|
217
235
|
}
|
236
|
+
|
237
|
+
// 按钮行0margin
|
238
|
+
&.h-form-table-button-row-0margin {
|
239
|
+
:deep(.ant-row) {
|
240
|
+
margin: 0px;
|
241
|
+
}
|
242
|
+
}
|
218
243
|
}
|
219
244
|
</style>
|
@@ -22,11 +22,10 @@
|
|
22
22
|
<template v-if="data">
|
23
23
|
<!-- 显示前N个标签 -->
|
24
24
|
<a-descriptions-item
|
25
|
-
v-for="(item) in
|
25
|
+
v-for="(item) in visibleItemsFiltered"
|
26
26
|
:key="item.field"
|
27
27
|
:colon="item.colon !== false"
|
28
|
-
:class="{ 'with-divider': item.isLine }"
|
29
|
-
v-if="data[item.field] !== null && data[item.field] !== undefined && (!showAllItems || showAllItems && !hiddenItems.some(i => i.field === item.field))">
|
28
|
+
:class="{ 'with-divider': item.isLine }">
|
30
29
|
<template #label>
|
31
30
|
<div :class="['label-wrapper', { 'with-avatar': item.showAvatar }]">
|
32
31
|
<a-avatar
|
@@ -46,10 +45,9 @@
|
|
46
45
|
<!-- 展开后显示剩余标签 -->
|
47
46
|
<template v-if="showAllItems">
|
48
47
|
<a-descriptions-item
|
49
|
-
v-for="item in
|
48
|
+
v-for="item in hiddenItemsFiltered"
|
50
49
|
:key="item.field"
|
51
|
-
:colon="item.colon !== false"
|
52
|
-
v-if="data[item.field] !== null && data[item.field] !== undefined">
|
50
|
+
:colon="item.colon !== false">
|
53
51
|
<template #label>
|
54
52
|
<div :class="['label-wrapper', { 'with-avatar': item.showAvatar }]">
|
55
53
|
<a-avatar
|
@@ -76,10 +74,9 @@
|
|
76
74
|
<template v-if="data">
|
77
75
|
<!-- 显示可见的标签 -->
|
78
76
|
<div
|
79
|
-
v-for="(item) in
|
77
|
+
v-for="(item) in visibleItemsFiltered"
|
80
78
|
:key="item.field"
|
81
79
|
:class="['description-item', { 'with-divider': item.isLine }]"
|
82
|
-
v-if="data[item.field] !== null && data[item.field] !== undefined"
|
83
80
|
>
|
84
81
|
<div :class="['label-wrapper', { 'with-avatar': item.showAvatar }]">
|
85
82
|
<a-avatar
|
@@ -98,10 +95,9 @@
|
|
98
95
|
<!-- 展开后显示的内容 -->
|
99
96
|
<template v-if="showAllItems">
|
100
97
|
<div
|
101
|
-
v-for="item in
|
98
|
+
v-for="item in hiddenItemsFiltered"
|
102
99
|
:key="item.field"
|
103
100
|
class="description-item"
|
104
|
-
v-if="data[item.field] !== null && data[item.field] !== undefined"
|
105
101
|
>
|
106
102
|
<div :class="['label-wrapper', { 'with-avatar': item.showAvatar }]">
|
107
103
|
<a-avatar
|
@@ -157,9 +153,6 @@ export default {
|
|
157
153
|
const classes = {}
|
158
154
|
|
159
155
|
const booleanStyleKeys = [
|
160
|
-
'query-conditions',
|
161
|
-
'padding-50',
|
162
|
-
'label-text-horizontal',
|
163
156
|
'description'
|
164
157
|
]
|
165
158
|
booleanStyleKeys.forEach(key => {
|
@@ -201,6 +194,21 @@ export default {
|
|
201
194
|
if (!(this.config && this.config.items)) return []
|
202
195
|
if (!(this.config && this.config.detailsConfig)) return []
|
203
196
|
return this.config.items.slice(this.detailsAfterIndex)
|
197
|
+
},
|
198
|
+
// 过滤后可直接渲染的可见项
|
199
|
+
visibleItemsFiltered () {
|
200
|
+
const list = this.visibleItems || []
|
201
|
+
if (!this.data) return []
|
202
|
+
const res = list.filter(item => this.data[item.field] !== null && this.data[item.field] !== undefined)
|
203
|
+
if (!this.showAllItems) return res
|
204
|
+
const hiddenFields = new Set((this.hiddenItems || []).map(i => i.field))
|
205
|
+
return res.filter(item => !hiddenFields.has(item.field))
|
206
|
+
},
|
207
|
+
// 过滤后可直接渲染的隐藏项(仅展开时使用)
|
208
|
+
hiddenItemsFiltered () {
|
209
|
+
const list = this.hiddenItems || []
|
210
|
+
if (!this.data) return []
|
211
|
+
return list.filter(item => this.data[item.field] !== null && this.data[item.field] !== undefined)
|
204
212
|
}
|
205
213
|
},
|
206
214
|
created () {
|
@@ -250,7 +258,7 @@ export default {
|
|
250
258
|
}
|
251
259
|
</script>
|
252
260
|
|
253
|
-
<style scoped>
|
261
|
+
<style scoped lang="less">
|
254
262
|
.patient-info-descriptions {
|
255
263
|
background: #fff;
|
256
264
|
padding: 12px;
|