@ebiz/designer-components 0.1.124 → 0.1.126
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/README.md +29 -29
- package/dist/designer-components.css +1 -1
- package/dist/index.mjs +35548 -33511
- package/dist/{pdf-C9oIcL2N.js → pdf-KomaE0u5.js} +891 -891
- package/package.json +1 -1
- package/src/App.vue +26 -26
- package/src/apiService/SIMPLE_DATA_SERVICE.md +284 -284
- package/src/apiService/mockDataService.js +115 -115
- package/src/apiService/simpleDataService.js +312 -312
- package/src/assets/base.css +86 -86
- package/src/assets/logo.svg +1 -1
- package/src/components/Button.vue +149 -149
- package/src/components/DataContainer.vue +40 -40
- package/src/components/EbizApproval.vue +366 -366
- package/src/components/EbizApprovalDetail.vue +169 -169
- package/src/components/EbizApprovalForm.vue +534 -534
- package/src/components/EbizApprovalV2.vue +713 -713
- package/src/components/EbizAutoForm.vue +596 -596
- package/src/components/EbizAvatar.vue +115 -115
- package/src/components/EbizCheckbox.vue +93 -93
- package/src/components/EbizCheckboxGroup.vue +69 -69
- package/src/components/EbizDepartmentSelector.vue +148 -148
- package/src/components/EbizDescriptions.vue +340 -340
- package/src/components/EbizDescriptionsItem.vue +47 -47
- package/src/components/EbizDetailBlock.vue +81 -81
- package/src/components/EbizDetailItem.vue +559 -559
- package/src/components/EbizDetailView.md +438 -438
- package/src/components/EbizDetailView.vue +355 -355
- package/src/components/EbizDialog.vue +260 -260
- package/src/components/EbizDictionarySelect.vue +229 -229
- package/src/components/EbizDiv.vue +40 -40
- package/src/components/EbizDivider.vue +96 -96
- package/src/components/EbizDormDashboard.vue +314 -314
- package/src/components/EbizDropdown.vue +135 -135
- package/src/components/EbizDropdownItem.vue +85 -85
- package/src/components/EbizEmployeeInfo.vue +144 -144
- package/src/components/EbizEmployeeSelector.vue +1160 -1160
- package/src/components/EbizFileList.vue +502 -502
- package/src/components/EbizMap.vue +541 -541
- package/src/components/EbizMeetingRoomSelector.vue +1149 -1149
- package/src/components/EbizMobileMeetingRoomSelector.vue +727 -727
- package/src/components/EbizOkrTree.vue +99 -99
- package/src/components/EbizPageHeader.vue +98 -98
- package/src/components/EbizPagination.vue +162 -162
- package/src/components/EbizParkingDashboard.vue +152 -152
- package/src/components/EbizPdfViewer.vue +540 -540
- package/src/components/EbizPopconfirm.vue +47 -47
- package/src/components/EbizQrCode.vue +167 -167
- package/src/components/EbizRadio.vue +86 -86
- package/src/components/EbizRadioGroup.vue +83 -83
- package/src/components/EbizRemoteSelect.vue +232 -232
- package/src/components/EbizRichTextEditor.vue +338 -338
- package/src/components/EbizRouteBreadcrumb.vue +46 -46
- package/src/components/EbizSApprovalProcess.vue +1456 -1426
- package/src/components/EbizSelect.vue +85 -85
- package/src/components/EbizSpace.vue +100 -100
- package/src/components/EbizStatistic.vue +149 -149
- package/src/components/EbizStatsCard.vue +113 -113
- package/src/components/EbizSwiper.vue +113 -113
- package/src/components/EbizSwiperItem.vue +13 -13
- package/src/components/EbizSwitch.vue +85 -85
- package/src/components/EbizTabHeader.vue +132 -132
- package/src/components/EbizTabPanel.vue +22 -22
- package/src/components/EbizTable.vue +469 -469
- package/src/components/EbizTableColumn.vue +116 -116
- package/src/components/EbizTableSort.vue +179 -179
- package/src/components/EbizTabs.vue +142 -142
- package/src/components/EbizTdesignButtonDialog.vue +332 -332
- package/src/components/EbizTdesignLoading.vue +107 -107
- package/src/components/EbizTimePicker.vue +143 -143
- package/src/components/EbizTitle.vue +91 -91
- package/src/components/EbizTree.vue +141 -141
- package/src/components/EbizTreeMergeTable.vue +1494 -1494
- package/src/components/EbizTreeSelector.vue +469 -469
- package/src/components/EbizVideo.vue +553 -553
- package/src/components/EbizVxeTable.vue +290 -290
- package/src/components/Form.vue +28 -28
- package/src/components/Home.vue +7 -7
- package/src/components/LaunchInterview.vue +526 -526
- package/src/components/MyComponent.vue +39 -39
- package/src/components/Table.vue +45 -45
- package/src/components/TdesignAlert.vue +115 -115
- package/src/components/TdesignButton.vue +135 -135
- package/src/components/TdesignCalendar/index.vue +145 -145
- package/src/components/TdesignCard.vue +195 -195
- package/src/components/TdesignCol.vue +101 -101
- package/src/components/TdesignCollapse.vue +142 -142
- package/src/components/TdesignCollapsePanel.vue +79 -79
- package/src/components/TdesignDatePicker.vue +124 -124
- package/src/components/TdesignDescriptions.vue +74 -74
- package/src/components/TdesignDescriptionsItem.vue +50 -50
- package/src/components/TdesignDialog.vue +225 -225
- package/src/components/TdesignForm.vue +138 -138
- package/src/components/TdesignFormItem.vue +105 -105
- package/src/components/TdesignGrid.vue +55 -55
- package/src/components/TdesignIcon.vue +67 -67
- package/src/components/TdesignImage.vue +162 -162
- package/src/components/TdesignImageViewer.vue +200 -200
- package/src/components/TdesignInput.vue +242 -242
- package/src/components/TdesignSelect.vue +446 -446
- package/src/components/TdesignTag.vue +117 -117
- package/src/components/TdesignTextarea.vue +142 -142
- package/src/components/TdesignTimeline.vue +58 -58
- package/src/components/TdesignTimelineItem.vue +71 -71
- package/src/components/TdesignUpload.vue +414 -414
- package/src/components/TdesignWatermark.vue +107 -107
- package/src/components/ebiz-form/components/cascader.vue +61 -61
- package/src/components/ebiz-form/components/checkbox.vue +37 -37
- package/src/components/ebiz-form/components/city.vue +137 -137
- package/src/components/ebiz-form/components/date-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range.vue +56 -56
- package/src/components/ebiz-form/components/date.vue +52 -52
- package/src/components/ebiz-form/components/editor-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/editor.vue +78 -78
- package/src/components/ebiz-form/components/file-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/file.vue +149 -149
- package/src/components/ebiz-form/components/images-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/images.vue +129 -129
- package/src/components/ebiz-form/components/img-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/img.vue +129 -129
- package/src/components/ebiz-form/components/number.vue +50 -50
- package/src/components/ebiz-form/components/radio.vue +28 -28
- package/src/components/ebiz-form/components/select.vue +119 -119
- package/src/components/ebiz-form/components/switch.vue +23 -23
- package/src/components/ebiz-form/components/text-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/text.vue +52 -52
- package/src/components/ebiz-form/components/textarea-multi-language.vue +48 -48
- package/src/components/ebiz-form/components/textarea.vue +29 -29
- package/src/components/ebiz-form/components/video-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/video.vue +97 -97
- package/src/components/ebiz-form/index.vue +157 -157
- package/src/components/examples/PopconfirmExample.vue +149 -149
- package/src/components/icons/IconCommunity.vue +7 -7
- package/src/components/icons/IconDocumentation.vue +7 -7
- package/src/components/icons/IconEcosystem.vue +7 -7
- package/src/components/icons/IconSupport.vue +7 -7
- package/src/components/icons/IconTooling.vue +19 -19
- package/src/components/mItems/UserInfo.vue +349 -349
- package/src/components/senior/EbizApprovalList/ApprovalList.vue +127 -127
- package/src/components/senior/EbizSData/index.vue +280 -280
- package/src/components/senior/EbizSDialog/index.vue +776 -776
- package/src/components/senior/EbizSForm/README.md +157 -157
- package/src/components/senior/EbizSForm/index.vue +667 -667
- package/src/components/senior/EbizSForm/item.vue +1011 -1011
- package/src/components/senior/EbizSForm/mItems/DateTimePicker.vue +51 -51
- package/src/components/senior/EbizSForm/mItems/Picker.vue +63 -63
- package/src/index.js +327 -327
- package/src/main.js +55 -55
- package/src/router/index.js +436 -436
- package/src/utils/formatCode.js +24 -24
- package/src/utils/generateImportStatement.js +52 -52
- package/src/utils/hasJsx.js +25 -25
- package/src/utils/index.js +166 -166
- package/src/utils/mergeOptions.js +29 -29
- package/src/utils/parseRequiredBlocks.js +18 -18
- package/src/utils/vue-sfc-validator.js +155 -155
- package/src/views/Button.vue +23 -23
- package/src/views/CheckboxDemo.vue +104 -104
- package/src/views/DataContainer.vue +19 -19
- package/src/views/DialogDemo.vue +125 -125
- package/src/views/EbizApprovalDemo.vue +87 -87
- package/src/views/EbizApprovalFormDemo.vue +207 -207
- package/src/views/EbizAutoFormDemo.vue +129 -129
- package/src/views/EbizAvatar.vue +223 -223
- package/src/views/EbizDepartmentSelectorDemo.vue +169 -169
- package/src/views/EbizDetailBlockDemo.vue +30 -30
- package/src/views/EbizDetailViewDemo.vue +412 -412
- package/src/views/EbizDormDashboardDemo.vue +87 -87
- package/src/views/EbizEmployeeInfo.vue +249 -249
- package/src/views/EbizEmployeeSelector.vue +85 -85
- package/src/views/EbizFileListDemo.vue +339 -339
- package/src/views/EbizMap.vue +201 -201
- package/src/views/EbizMeetingRoomSelectorDemo.vue +293 -293
- package/src/views/EbizMobileMeetingRoomSelectorDemo.vue +566 -566
- package/src/views/EbizParkingDashboardDemo.vue +28 -28
- package/src/views/EbizRadioDemo.vue +151 -151
- package/src/views/EbizSDataDemo.vue +136 -136
- package/src/views/EbizSDialogDemo.vue +303 -303
- package/src/views/EbizSForm/index.vue +352 -352
- package/src/views/EbizSFormDemo.vue +420 -420
- package/src/views/EbizSpace.vue +185 -185
- package/src/views/EbizSwiper.vue +157 -157
- package/src/views/EbizTdesignButtonDialogExample.vue +437 -437
- package/src/views/Form.vue +19 -19
- package/src/views/GridDemo.vue +238 -238
- package/src/views/Home.vue +156 -156
- package/src/views/LaunchInterviewDemo.vue +111 -111
- package/src/views/Mindmap.vue +17 -17
- package/src/views/MyComponent.vue +19 -19
- package/src/views/OkrTree.vue +19 -19
- package/src/views/PageHeaderDemo.vue +104 -104
- package/src/views/PaginationDemo.vue +96 -96
- package/src/views/PdfViewerDemo.vue +433 -433
- package/src/views/PermissionBoxDemo.vue +85 -85
- package/src/views/PopconfirmDemo.vue +80 -80
- package/src/views/RemoteSelect.vue +350 -350
- package/src/views/StatisticDemo.vue +190 -190
- package/src/views/SwitchDemo.vue +79 -79
- package/src/views/Table.vue +19 -19
- package/src/views/TableDemo.vue +334 -334
- package/src/views/TableSortDemo.vue +143 -143
- package/src/views/TableView.vue +68 -68
- package/src/views/TabsDemo.vue +282 -282
- package/src/views/TagDemo.vue +101 -101
- package/src/views/TdesignAlert.vue +98 -98
- package/src/views/TdesignButton.vue +190 -190
- package/src/views/TdesignCalendar.vue +94 -94
- package/src/views/TdesignCard.vue +296 -296
- package/src/views/TdesignCollapse.vue +293 -293
- package/src/views/TdesignDatePicker.vue +187 -187
- package/src/views/TdesignDescriptions.vue +101 -101
- package/src/views/TdesignForm.vue +248 -248
- package/src/views/TdesignIcon.vue +203 -203
- package/src/views/TdesignImage.vue +215 -215
- package/src/views/TdesignImageViewer.vue +198 -198
- package/src/views/TdesignInput.vue +252 -252
- package/src/views/TdesignSelect.vue +473 -473
- package/src/views/TdesignSwiper.vue +157 -157
- package/src/views/TextareaDemo.vue +93 -93
- package/src/views/TimePickerDemo.vue +146 -146
- package/src/views/TimelineDemo.vue +160 -160
- package/src/views/Title.vue +19 -19
- package/src/views/TreeDemo.vue +254 -254
- package/src/views/TreeMergeTableDemo.vue +239 -239
- package/src/views/TreeSelectorDemo.vue +245 -245
- package/src/views/UploadDemo.vue +128 -128
- package/src/views/VideoDemo.vue +245 -245
- package/src/views/VxeTableDemo.vue +279 -279
- package/src/views/WatermarkDemo.vue +85 -85
|
@@ -1,560 +1,560 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<t-col :span="finalSpan" :xs="finalXs" :sm="finalSm" :md="finalMd" :lg="finalLg" :xl="finalXl" :xxl="finalXxl">
|
|
3
|
-
<div class="ebiz-detail-item" :class="{
|
|
4
|
-
'vertical-layout': finalLayout === 'vertical',
|
|
5
|
-
'horizontal-layout': finalLayout === 'horizontal',
|
|
6
|
-
}">
|
|
7
|
-
<!-- 标签部分 -->
|
|
8
|
-
<div class="detail-label" :style="{
|
|
9
|
-
width: finalLayout === 'horizontal' ? `${finalLabelWidth}px` : 'auto',
|
|
10
|
-
color: finalLabelColor
|
|
11
|
-
}">
|
|
12
|
-
{{ label }}
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<!-- 值部分 -->
|
|
16
|
-
<div class="detail-value">
|
|
17
|
-
<slot name="default" :data="value">
|
|
18
|
-
<!-- 文本类型 -->
|
|
19
|
-
<span v-if="type === 'text'">{{ value || '-' }}</span>
|
|
20
|
-
|
|
21
|
-
<!-- 数字类型 -->
|
|
22
|
-
<span v-else-if="type === 'number'">{{ formatNumber(value) }}</span>
|
|
23
|
-
|
|
24
|
-
<!-- 货币类型 -->
|
|
25
|
-
<span v-else-if="type === 'currency'" class="currency-value">
|
|
26
|
-
{{ formatCurrency(value) }}
|
|
27
|
-
</span>
|
|
28
|
-
|
|
29
|
-
<!-- 用户类型 -->
|
|
30
|
-
<div v-else-if="type === 'user'" class="user-value">
|
|
31
|
-
<div class="user-list">
|
|
32
|
-
<div v-for="user in userList" :key="user.id" class="user-item" @click="handleUserClick(user)">
|
|
33
|
-
<div class="user-avatar">
|
|
34
|
-
<img v-if="user.avatar" :src="user.avatar" />
|
|
35
|
-
<div v-else class="user-avatar-default">{{ user.name?.[0] || 'U' }}</div>
|
|
36
|
-
</div>
|
|
37
|
-
<div class="user-info">
|
|
38
|
-
<div class="user-name">{{ user.name }}</div>
|
|
39
|
-
<div class="user-dept">{{ user.department }}</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<!-- 文件类型 -->
|
|
46
|
-
<div v-else-if="type === 'file'" class="file-value">
|
|
47
|
-
<EbizFileList :files="fileList" :mode="fileMode" :showDownload="showDownload"
|
|
48
|
-
@download="handleDownloadFile" />
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<!-- 日期类型 -->
|
|
52
|
-
<span v-else-if="type === 'date'">{{ formatDate(value) }}</span>
|
|
53
|
-
|
|
54
|
-
<!-- 时间类型 -->
|
|
55
|
-
<span v-else-if="type === 'time'">{{ formatTime(value) }}</span>
|
|
56
|
-
|
|
57
|
-
<!-- 日期时间类型 -->
|
|
58
|
-
<span v-else-if="type === 'datetime'">{{ formatDateTime(value) }}</span>
|
|
59
|
-
|
|
60
|
-
<!-- 状态类型 -->
|
|
61
|
-
<t-tag v-else-if="type === 'status'" :theme="getStatusTheme(value)">
|
|
62
|
-
{{ getStatusText(value) }}
|
|
63
|
-
</t-tag>
|
|
64
|
-
|
|
65
|
-
<!-- 标签类型 -->
|
|
66
|
-
<div v-else-if="type === 'tags'" class="tags-value">
|
|
67
|
-
<template v-if="Array.isArray(value) && value.length > 0">
|
|
68
|
-
<t-tag v-for="tag in value" :key="tag.id || tag" size="small" class="tag-item">
|
|
69
|
-
{{ typeof tag === 'object' ? tag.name : tag }}
|
|
70
|
-
</t-tag>
|
|
71
|
-
</template>
|
|
72
|
-
<span v-else>{{ value || '-' }}</span>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<!-- 链接类型 -->
|
|
76
|
-
<a v-else-if="type === 'link'" :href="getLinkUrl(value)" class="link-value" @click="handleLinkClick">
|
|
77
|
-
{{ getLinkText(value) }}
|
|
78
|
-
</a>
|
|
79
|
-
|
|
80
|
-
<!-- HTML类型 -->
|
|
81
|
-
<div v-else-if="type === 'html'" class="html-value" v-html="value"></div>
|
|
82
|
-
|
|
83
|
-
<!-- 默认文本 -->
|
|
84
|
-
<span v-else>{{ value || '-' }}</span>
|
|
85
|
-
|
|
86
|
-
<!-- 描述信息 -->
|
|
87
|
-
<div v-if="description" class="description">{{ description }}</div>
|
|
88
|
-
</slot>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
</t-col>
|
|
92
|
-
</template>
|
|
93
|
-
|
|
94
|
-
<script setup>
|
|
95
|
-
import { computed, defineProps, defineEmits, inject } from 'vue'
|
|
96
|
-
import { Tag as TTag, Button as TButton, Icon as TIcon, Avatar as TAvatar, Col as TCol } from 'tdesign-vue-next'
|
|
97
|
-
import EbizFileList from './EbizFileList.vue'
|
|
98
|
-
|
|
99
|
-
const props = defineProps({
|
|
100
|
-
// 字段配置
|
|
101
|
-
label: {
|
|
102
|
-
type: String,
|
|
103
|
-
required: true
|
|
104
|
-
},
|
|
105
|
-
type: {
|
|
106
|
-
type: String,
|
|
107
|
-
default: 'text',
|
|
108
|
-
validator: (value) => [
|
|
109
|
-
'text', 'user', 'file', 'date', 'time', 'datetime', 'status',
|
|
110
|
-
'tags', 'link', 'html', 'number', 'currency'
|
|
111
|
-
].includes(value)
|
|
112
|
-
},
|
|
113
|
-
value: {
|
|
114
|
-
type: [String, Number, Array, Object],
|
|
115
|
-
default: ''
|
|
116
|
-
},
|
|
117
|
-
description: {
|
|
118
|
-
type: String,
|
|
119
|
-
default: ''
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
// 栅格布局配置
|
|
123
|
-
span: {
|
|
124
|
-
type: Number,
|
|
125
|
-
default: 12,
|
|
126
|
-
validator: (value) => value >= 1 && value <= 24
|
|
127
|
-
},
|
|
128
|
-
xs: {
|
|
129
|
-
type: Number,
|
|
130
|
-
default: undefined
|
|
131
|
-
},
|
|
132
|
-
sm: {
|
|
133
|
-
type: Number,
|
|
134
|
-
default: undefined
|
|
135
|
-
},
|
|
136
|
-
md: {
|
|
137
|
-
type: Number,
|
|
138
|
-
default: undefined
|
|
139
|
-
},
|
|
140
|
-
lg: {
|
|
141
|
-
type: Number,
|
|
142
|
-
default: undefined
|
|
143
|
-
},
|
|
144
|
-
xl: {
|
|
145
|
-
type: Number,
|
|
146
|
-
default: undefined
|
|
147
|
-
},
|
|
148
|
-
xxl: {
|
|
149
|
-
type: Number,
|
|
150
|
-
default: undefined
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
// 布局配置
|
|
154
|
-
layout: {
|
|
155
|
-
type: String,
|
|
156
|
-
default: 'horizontal',
|
|
157
|
-
validator: (value) => ['horizontal', 'vertical'].includes(value)
|
|
158
|
-
},
|
|
159
|
-
labelWidth: {
|
|
160
|
-
type: Number,
|
|
161
|
-
default: 120
|
|
162
|
-
},
|
|
163
|
-
labelColor: {
|
|
164
|
-
type: String,
|
|
165
|
-
default: '#999999'
|
|
166
|
-
},
|
|
167
|
-
gap: {
|
|
168
|
-
type: Number,
|
|
169
|
-
default: 16
|
|
170
|
-
},
|
|
171
|
-
minHeight: {
|
|
172
|
-
type: Number,
|
|
173
|
-
default: 32
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
// 文件组件配置
|
|
177
|
-
fileMode: {
|
|
178
|
-
type: String,
|
|
179
|
-
default: 'list'
|
|
180
|
-
},
|
|
181
|
-
showDownload: {
|
|
182
|
-
type: Boolean,
|
|
183
|
-
default: true
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
const emits = defineEmits(['download-file', 'user-click', 'link-click'])
|
|
188
|
-
|
|
189
|
-
// 注入父组件配置
|
|
190
|
-
const detailViewConfig = inject('detailViewConfig', null)
|
|
191
|
-
|
|
192
|
-
// 合并配置
|
|
193
|
-
const finalLayout = computed(() => props.layout || detailViewConfig?.layout || 'horizontal')
|
|
194
|
-
const finalLabelWidth = computed(() => props.labelWidth || detailViewConfig?.labelWidth || 120)
|
|
195
|
-
const finalLabelColor = computed(() => props.labelColor || detailViewConfig?.labelColor || '#999999')
|
|
196
|
-
const finalGap = computed(() => props.gap !== undefined ? props.gap : (detailViewConfig?.gap ?? 16))
|
|
197
|
-
|
|
198
|
-
// 栅格配置
|
|
199
|
-
const finalSpan = computed(() => props.span)
|
|
200
|
-
const finalXs = computed(() => props.xs)
|
|
201
|
-
const finalSm = computed(() => props.sm)
|
|
202
|
-
const finalMd = computed(() => props.md)
|
|
203
|
-
const finalLg = computed(() => props.lg)
|
|
204
|
-
const finalXl = computed(() => props.xl)
|
|
205
|
-
const finalXxl = computed(() => props.xxl)
|
|
206
|
-
|
|
207
|
-
// 暴露栅格配置给父组件
|
|
208
|
-
defineExpose({
|
|
209
|
-
gridConfig: computed(() => ({
|
|
210
|
-
span: finalSpan.value,
|
|
211
|
-
xs: finalXs.value,
|
|
212
|
-
sm: finalSm.value,
|
|
213
|
-
md: finalMd.value,
|
|
214
|
-
lg: finalLg.value,
|
|
215
|
-
xl: finalXl.value,
|
|
216
|
-
xxl: finalXxl.value
|
|
217
|
-
}))
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
// 显示值
|
|
221
|
-
const displayValue = computed(() => {
|
|
222
|
-
return props.value !== undefined && props.value !== null ? props.value : ''
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
// 用户列表
|
|
226
|
-
const userList = computed(() => {
|
|
227
|
-
if (props.type !== 'user') return []
|
|
228
|
-
return Array.isArray(props.value) ? props.value : (props.value ? [props.value] : [])
|
|
229
|
-
})
|
|
230
|
-
|
|
231
|
-
// 文件列表
|
|
232
|
-
const fileList = computed(() => {
|
|
233
|
-
if (props.type !== 'file') return []
|
|
234
|
-
return Array.isArray(props.value) ? props.value : (props.value ? [props.value] : [])
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
// 状态值
|
|
238
|
-
const statusValue = computed(() => {
|
|
239
|
-
if (props.type !== 'status') return null
|
|
240
|
-
return typeof props.value === 'object' ? props.value : { text: props.value, status: 'default' }
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
// 标签列表
|
|
244
|
-
const tagList = computed(() => {
|
|
245
|
-
if (props.type !== 'tags') return []
|
|
246
|
-
return Array.isArray(props.value) ? props.value : (props.value ? [props.value] : [])
|
|
247
|
-
})
|
|
248
|
-
|
|
249
|
-
// 链接值
|
|
250
|
-
const linkValue = computed(() => {
|
|
251
|
-
if (props.type !== 'link') return null
|
|
252
|
-
return typeof props.value === 'object' ? props.value : { url: props.value, text: props.value }
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
// 格式化日期
|
|
256
|
-
const formatDate = (date) => {
|
|
257
|
-
if (!date) return ''
|
|
258
|
-
const d = new Date(date)
|
|
259
|
-
return d.toLocaleDateString('zh-CN', {
|
|
260
|
-
year: 'numeric',
|
|
261
|
-
month: '2-digit',
|
|
262
|
-
day: '2-digit'
|
|
263
|
-
})
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// 格式化时间
|
|
267
|
-
const formatTime = (time) => {
|
|
268
|
-
if (!time) return ''
|
|
269
|
-
const d = new Date(time)
|
|
270
|
-
return d.toLocaleTimeString('zh-CN', {
|
|
271
|
-
hour: '2-digit',
|
|
272
|
-
minute: '2-digit',
|
|
273
|
-
second: '2-digit'
|
|
274
|
-
})
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// 格式化日期时间
|
|
278
|
-
const formatDateTime = (datetime) => {
|
|
279
|
-
if (!datetime) return ''
|
|
280
|
-
const d = new Date(datetime)
|
|
281
|
-
return d.toLocaleString('zh-CN', {
|
|
282
|
-
year: 'numeric',
|
|
283
|
-
month: '2-digit',
|
|
284
|
-
day: '2-digit',
|
|
285
|
-
hour: '2-digit',
|
|
286
|
-
minute: '2-digit',
|
|
287
|
-
second: '2-digit'
|
|
288
|
-
})
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// 格式化数字
|
|
292
|
-
const formatNumber = (num) => {
|
|
293
|
-
if (num === null || num === undefined || num === '') return ''
|
|
294
|
-
return Number(num).toLocaleString()
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// 格式化货币
|
|
298
|
-
const formatCurrency = (amount) => {
|
|
299
|
-
if (amount === null || amount === undefined || amount === '') return ''
|
|
300
|
-
return `¥${Number(amount).toLocaleString()}`
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// 获取状态主题
|
|
304
|
-
const getStatusTheme = (status) => {
|
|
305
|
-
const statusMap = {
|
|
306
|
-
'success': 'success',
|
|
307
|
-
'warning': 'warning',
|
|
308
|
-
'error': 'danger',
|
|
309
|
-
'info': 'primary'
|
|
310
|
-
}
|
|
311
|
-
return statusMap[status] || 'default'
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// 获取状态文本
|
|
315
|
-
const getStatusText = (status) => {
|
|
316
|
-
if (typeof status === 'object' && status !== null) {
|
|
317
|
-
return status.text || status.status || status
|
|
318
|
-
}
|
|
319
|
-
return status
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// 获取用户头像
|
|
323
|
-
const getUserAvatar = (user) => {
|
|
324
|
-
if (typeof user === 'object' && user !== null && user.avatar) {
|
|
325
|
-
return user.avatar
|
|
326
|
-
}
|
|
327
|
-
return null
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// 获取用户初始
|
|
331
|
-
const getUserInitial = (user) => {
|
|
332
|
-
if (typeof user === 'object' && user !== null && user.name) {
|
|
333
|
-
return user.name.charAt(0)
|
|
334
|
-
}
|
|
335
|
-
return 'U'
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// 获取用户名称
|
|
339
|
-
const getUserName = (user) => {
|
|
340
|
-
if (typeof user === 'object' && user !== null && user.name) {
|
|
341
|
-
return user.name
|
|
342
|
-
}
|
|
343
|
-
return user
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// 获取链接 URL
|
|
347
|
-
const getLinkUrl = (link) => {
|
|
348
|
-
if (typeof link === 'object' && link !== null && link.url) {
|
|
349
|
-
return link.url
|
|
350
|
-
}
|
|
351
|
-
return link
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// 获取链接文本
|
|
355
|
-
const getLinkText = (link) => {
|
|
356
|
-
if (typeof link === 'object' && link !== null && link.text) {
|
|
357
|
-
return link.text
|
|
358
|
-
}
|
|
359
|
-
return link
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// 事件处理
|
|
363
|
-
const handleDownloadFile = (file) => {
|
|
364
|
-
emits('download-file', file)
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
const handleUserClick = () => {
|
|
368
|
-
emits('user-click', userList.value[0]) // Assuming userList is an array of users
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const handleLinkClick = () => {
|
|
372
|
-
emits('link-click', linkValue.value)
|
|
373
|
-
}
|
|
374
|
-
</script>
|
|
375
|
-
|
|
376
|
-
<style scoped>
|
|
377
|
-
.ebiz-detail-item {
|
|
378
|
-
display: flex;
|
|
379
|
-
align-items: flex-start;
|
|
380
|
-
padding: 8px 0;
|
|
381
|
-
border-bottom: 1px solid #f0f0f0;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.ebiz-detail-item:last-child {
|
|
385
|
-
border-bottom: none;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
.ebiz-detail-item.vertical-layout {
|
|
389
|
-
flex-direction: column;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
.ebiz-detail-item.horizontal-layout {
|
|
393
|
-
flex-direction: row;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
.detail-label {
|
|
397
|
-
font-size: 14px;
|
|
398
|
-
line-height: 1.5;
|
|
399
|
-
font-weight: 500;
|
|
400
|
-
margin-right: 12px;
|
|
401
|
-
flex-shrink: 0;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.ebiz-detail-item.vertical .field-label {
|
|
405
|
-
margin-right: 0;
|
|
406
|
-
margin-bottom: 8px;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
.required-mark {
|
|
410
|
-
color: #e34d59;
|
|
411
|
-
margin-left: 2px;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
.field-value {
|
|
415
|
-
flex: 1;
|
|
416
|
-
font-size: 14px;
|
|
417
|
-
color: #333333;
|
|
418
|
-
line-height: 1.5;
|
|
419
|
-
word-break: break-all;
|
|
420
|
-
min-width: 0;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
.description {
|
|
424
|
-
font-size: 12px;
|
|
425
|
-
color: #999999;
|
|
426
|
-
margin-top: 4px;
|
|
427
|
-
line-height: 1.4;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/* 用户信息样式 */
|
|
431
|
-
.user-list {
|
|
432
|
-
display: flex;
|
|
433
|
-
flex-wrap: wrap;
|
|
434
|
-
gap: 8px;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
.user-item {
|
|
438
|
-
display: flex;
|
|
439
|
-
align-items: center;
|
|
440
|
-
padding: 6px 8px;
|
|
441
|
-
background: #f8f9fa;
|
|
442
|
-
border-radius: 4px;
|
|
443
|
-
cursor: pointer;
|
|
444
|
-
transition: background-color 0.2s;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
.user-item:hover {
|
|
448
|
-
background: #e9ecef;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
.user-avatar {
|
|
452
|
-
width: 24px;
|
|
453
|
-
height: 24px;
|
|
454
|
-
margin-right: 8px;
|
|
455
|
-
border-radius: 50%;
|
|
456
|
-
overflow: hidden;
|
|
457
|
-
flex-shrink: 0;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.user-avatar img {
|
|
461
|
-
width: 100%;
|
|
462
|
-
height: 100%;
|
|
463
|
-
object-fit: cover;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
.user-avatar-default {
|
|
467
|
-
width: 100%;
|
|
468
|
-
height: 100%;
|
|
469
|
-
background: #0052d9;
|
|
470
|
-
color: white;
|
|
471
|
-
display: flex;
|
|
472
|
-
align-items: center;
|
|
473
|
-
justify-content: center;
|
|
474
|
-
font-size: 12px;
|
|
475
|
-
font-weight: bold;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
.user-info {
|
|
479
|
-
flex: 1;
|
|
480
|
-
min-width: 0;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
.user-name {
|
|
484
|
-
font-size: 13px;
|
|
485
|
-
color: #333333;
|
|
486
|
-
font-weight: 500;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
.user-dept {
|
|
490
|
-
font-size: 12px;
|
|
491
|
-
color: #999999;
|
|
492
|
-
margin-top: 2px;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/* 文件值样式 */
|
|
496
|
-
.file-value {
|
|
497
|
-
width: 100%;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
/* 状态值样式 */
|
|
501
|
-
.status-value {
|
|
502
|
-
display: inline-block;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/* 标签值样式 */
|
|
506
|
-
.tags-value {
|
|
507
|
-
display: flex;
|
|
508
|
-
flex-wrap: wrap;
|
|
509
|
-
gap: 6px;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
.tag-item {
|
|
513
|
-
margin: 0;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/* 链接样式 */
|
|
517
|
-
.link-value {
|
|
518
|
-
color: #0052d9;
|
|
519
|
-
cursor: pointer;
|
|
520
|
-
text-decoration: underline;
|
|
521
|
-
word-break: break-all;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
.link-value:hover {
|
|
525
|
-
color: #003a9b;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
/* 富文本样式 */
|
|
529
|
-
.html-value {
|
|
530
|
-
line-height: 1.6;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
.html-value :deep(p) {
|
|
534
|
-
margin: 0 0 8px 0;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
.html-value :deep(p:last-child) {
|
|
538
|
-
margin-bottom: 0;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/* 数字和货币样式 */
|
|
542
|
-
.number-value,
|
|
543
|
-
.currency-value {
|
|
544
|
-
font-weight: 500;
|
|
545
|
-
font-variant-numeric: tabular-nums;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
.currency-value {
|
|
549
|
-
color: #e34d59;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
/* 空值样式 */
|
|
553
|
-
.text-value:empty::before,
|
|
554
|
-
.number-value:empty::before,
|
|
555
|
-
.currency-value:empty::before,
|
|
556
|
-
.date-value:empty::before {
|
|
557
|
-
content: '--';
|
|
558
|
-
color: #c8c9cc;
|
|
559
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<t-col :span="finalSpan" :xs="finalXs" :sm="finalSm" :md="finalMd" :lg="finalLg" :xl="finalXl" :xxl="finalXxl">
|
|
3
|
+
<div class="ebiz-detail-item" :class="{
|
|
4
|
+
'vertical-layout': finalLayout === 'vertical',
|
|
5
|
+
'horizontal-layout': finalLayout === 'horizontal',
|
|
6
|
+
}">
|
|
7
|
+
<!-- 标签部分 -->
|
|
8
|
+
<div class="detail-label" :style="{
|
|
9
|
+
width: finalLayout === 'horizontal' ? `${finalLabelWidth}px` : 'auto',
|
|
10
|
+
color: finalLabelColor
|
|
11
|
+
}">
|
|
12
|
+
{{ label }}
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<!-- 值部分 -->
|
|
16
|
+
<div class="detail-value">
|
|
17
|
+
<slot name="default" :data="value">
|
|
18
|
+
<!-- 文本类型 -->
|
|
19
|
+
<span v-if="type === 'text'">{{ value || '-' }}</span>
|
|
20
|
+
|
|
21
|
+
<!-- 数字类型 -->
|
|
22
|
+
<span v-else-if="type === 'number'">{{ formatNumber(value) }}</span>
|
|
23
|
+
|
|
24
|
+
<!-- 货币类型 -->
|
|
25
|
+
<span v-else-if="type === 'currency'" class="currency-value">
|
|
26
|
+
{{ formatCurrency(value) }}
|
|
27
|
+
</span>
|
|
28
|
+
|
|
29
|
+
<!-- 用户类型 -->
|
|
30
|
+
<div v-else-if="type === 'user'" class="user-value">
|
|
31
|
+
<div class="user-list">
|
|
32
|
+
<div v-for="user in userList" :key="user.id" class="user-item" @click="handleUserClick(user)">
|
|
33
|
+
<div class="user-avatar">
|
|
34
|
+
<img v-if="user.avatar" :src="user.avatar" />
|
|
35
|
+
<div v-else class="user-avatar-default">{{ user.name?.[0] || 'U' }}</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="user-info">
|
|
38
|
+
<div class="user-name">{{ user.name }}</div>
|
|
39
|
+
<div class="user-dept">{{ user.department }}</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<!-- 文件类型 -->
|
|
46
|
+
<div v-else-if="type === 'file'" class="file-value">
|
|
47
|
+
<EbizFileList :files="fileList" :mode="fileMode" :showDownload="showDownload"
|
|
48
|
+
@download="handleDownloadFile" />
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<!-- 日期类型 -->
|
|
52
|
+
<span v-else-if="type === 'date'">{{ formatDate(value) }}</span>
|
|
53
|
+
|
|
54
|
+
<!-- 时间类型 -->
|
|
55
|
+
<span v-else-if="type === 'time'">{{ formatTime(value) }}</span>
|
|
56
|
+
|
|
57
|
+
<!-- 日期时间类型 -->
|
|
58
|
+
<span v-else-if="type === 'datetime'">{{ formatDateTime(value) }}</span>
|
|
59
|
+
|
|
60
|
+
<!-- 状态类型 -->
|
|
61
|
+
<t-tag v-else-if="type === 'status'" :theme="getStatusTheme(value)">
|
|
62
|
+
{{ getStatusText(value) }}
|
|
63
|
+
</t-tag>
|
|
64
|
+
|
|
65
|
+
<!-- 标签类型 -->
|
|
66
|
+
<div v-else-if="type === 'tags'" class="tags-value">
|
|
67
|
+
<template v-if="Array.isArray(value) && value.length > 0">
|
|
68
|
+
<t-tag v-for="tag in value" :key="tag.id || tag" size="small" class="tag-item">
|
|
69
|
+
{{ typeof tag === 'object' ? tag.name : tag }}
|
|
70
|
+
</t-tag>
|
|
71
|
+
</template>
|
|
72
|
+
<span v-else>{{ value || '-' }}</span>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<!-- 链接类型 -->
|
|
76
|
+
<a v-else-if="type === 'link'" :href="getLinkUrl(value)" class="link-value" @click="handleLinkClick">
|
|
77
|
+
{{ getLinkText(value) }}
|
|
78
|
+
</a>
|
|
79
|
+
|
|
80
|
+
<!-- HTML类型 -->
|
|
81
|
+
<div v-else-if="type === 'html'" class="html-value" v-html="value"></div>
|
|
82
|
+
|
|
83
|
+
<!-- 默认文本 -->
|
|
84
|
+
<span v-else>{{ value || '-' }}</span>
|
|
85
|
+
|
|
86
|
+
<!-- 描述信息 -->
|
|
87
|
+
<div v-if="description" class="description">{{ description }}</div>
|
|
88
|
+
</slot>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</t-col>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<script setup>
|
|
95
|
+
import { computed, defineProps, defineEmits, inject } from 'vue'
|
|
96
|
+
import { Tag as TTag, Button as TButton, Icon as TIcon, Avatar as TAvatar, Col as TCol } from 'tdesign-vue-next'
|
|
97
|
+
import EbizFileList from './EbizFileList.vue'
|
|
98
|
+
|
|
99
|
+
const props = defineProps({
|
|
100
|
+
// 字段配置
|
|
101
|
+
label: {
|
|
102
|
+
type: String,
|
|
103
|
+
required: true
|
|
104
|
+
},
|
|
105
|
+
type: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: 'text',
|
|
108
|
+
validator: (value) => [
|
|
109
|
+
'text', 'user', 'file', 'date', 'time', 'datetime', 'status',
|
|
110
|
+
'tags', 'link', 'html', 'number', 'currency'
|
|
111
|
+
].includes(value)
|
|
112
|
+
},
|
|
113
|
+
value: {
|
|
114
|
+
type: [String, Number, Array, Object],
|
|
115
|
+
default: ''
|
|
116
|
+
},
|
|
117
|
+
description: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: ''
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
// 栅格布局配置
|
|
123
|
+
span: {
|
|
124
|
+
type: Number,
|
|
125
|
+
default: 12,
|
|
126
|
+
validator: (value) => value >= 1 && value <= 24
|
|
127
|
+
},
|
|
128
|
+
xs: {
|
|
129
|
+
type: Number,
|
|
130
|
+
default: undefined
|
|
131
|
+
},
|
|
132
|
+
sm: {
|
|
133
|
+
type: Number,
|
|
134
|
+
default: undefined
|
|
135
|
+
},
|
|
136
|
+
md: {
|
|
137
|
+
type: Number,
|
|
138
|
+
default: undefined
|
|
139
|
+
},
|
|
140
|
+
lg: {
|
|
141
|
+
type: Number,
|
|
142
|
+
default: undefined
|
|
143
|
+
},
|
|
144
|
+
xl: {
|
|
145
|
+
type: Number,
|
|
146
|
+
default: undefined
|
|
147
|
+
},
|
|
148
|
+
xxl: {
|
|
149
|
+
type: Number,
|
|
150
|
+
default: undefined
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
// 布局配置
|
|
154
|
+
layout: {
|
|
155
|
+
type: String,
|
|
156
|
+
default: 'horizontal',
|
|
157
|
+
validator: (value) => ['horizontal', 'vertical'].includes(value)
|
|
158
|
+
},
|
|
159
|
+
labelWidth: {
|
|
160
|
+
type: Number,
|
|
161
|
+
default: 120
|
|
162
|
+
},
|
|
163
|
+
labelColor: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: '#999999'
|
|
166
|
+
},
|
|
167
|
+
gap: {
|
|
168
|
+
type: Number,
|
|
169
|
+
default: 16
|
|
170
|
+
},
|
|
171
|
+
minHeight: {
|
|
172
|
+
type: Number,
|
|
173
|
+
default: 32
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
// 文件组件配置
|
|
177
|
+
fileMode: {
|
|
178
|
+
type: String,
|
|
179
|
+
default: 'list'
|
|
180
|
+
},
|
|
181
|
+
showDownload: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
default: true
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
const emits = defineEmits(['download-file', 'user-click', 'link-click'])
|
|
188
|
+
|
|
189
|
+
// 注入父组件配置
|
|
190
|
+
const detailViewConfig = inject('detailViewConfig', null)
|
|
191
|
+
|
|
192
|
+
// 合并配置
|
|
193
|
+
const finalLayout = computed(() => props.layout || detailViewConfig?.layout || 'horizontal')
|
|
194
|
+
const finalLabelWidth = computed(() => props.labelWidth || detailViewConfig?.labelWidth || 120)
|
|
195
|
+
const finalLabelColor = computed(() => props.labelColor || detailViewConfig?.labelColor || '#999999')
|
|
196
|
+
const finalGap = computed(() => props.gap !== undefined ? props.gap : (detailViewConfig?.gap ?? 16))
|
|
197
|
+
|
|
198
|
+
// 栅格配置
|
|
199
|
+
const finalSpan = computed(() => props.span)
|
|
200
|
+
const finalXs = computed(() => props.xs)
|
|
201
|
+
const finalSm = computed(() => props.sm)
|
|
202
|
+
const finalMd = computed(() => props.md)
|
|
203
|
+
const finalLg = computed(() => props.lg)
|
|
204
|
+
const finalXl = computed(() => props.xl)
|
|
205
|
+
const finalXxl = computed(() => props.xxl)
|
|
206
|
+
|
|
207
|
+
// 暴露栅格配置给父组件
|
|
208
|
+
defineExpose({
|
|
209
|
+
gridConfig: computed(() => ({
|
|
210
|
+
span: finalSpan.value,
|
|
211
|
+
xs: finalXs.value,
|
|
212
|
+
sm: finalSm.value,
|
|
213
|
+
md: finalMd.value,
|
|
214
|
+
lg: finalLg.value,
|
|
215
|
+
xl: finalXl.value,
|
|
216
|
+
xxl: finalXxl.value
|
|
217
|
+
}))
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
// 显示值
|
|
221
|
+
const displayValue = computed(() => {
|
|
222
|
+
return props.value !== undefined && props.value !== null ? props.value : ''
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
// 用户列表
|
|
226
|
+
const userList = computed(() => {
|
|
227
|
+
if (props.type !== 'user') return []
|
|
228
|
+
return Array.isArray(props.value) ? props.value : (props.value ? [props.value] : [])
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
// 文件列表
|
|
232
|
+
const fileList = computed(() => {
|
|
233
|
+
if (props.type !== 'file') return []
|
|
234
|
+
return Array.isArray(props.value) ? props.value : (props.value ? [props.value] : [])
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
// 状态值
|
|
238
|
+
const statusValue = computed(() => {
|
|
239
|
+
if (props.type !== 'status') return null
|
|
240
|
+
return typeof props.value === 'object' ? props.value : { text: props.value, status: 'default' }
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
// 标签列表
|
|
244
|
+
const tagList = computed(() => {
|
|
245
|
+
if (props.type !== 'tags') return []
|
|
246
|
+
return Array.isArray(props.value) ? props.value : (props.value ? [props.value] : [])
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
// 链接值
|
|
250
|
+
const linkValue = computed(() => {
|
|
251
|
+
if (props.type !== 'link') return null
|
|
252
|
+
return typeof props.value === 'object' ? props.value : { url: props.value, text: props.value }
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
// 格式化日期
|
|
256
|
+
const formatDate = (date) => {
|
|
257
|
+
if (!date) return ''
|
|
258
|
+
const d = new Date(date)
|
|
259
|
+
return d.toLocaleDateString('zh-CN', {
|
|
260
|
+
year: 'numeric',
|
|
261
|
+
month: '2-digit',
|
|
262
|
+
day: '2-digit'
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 格式化时间
|
|
267
|
+
const formatTime = (time) => {
|
|
268
|
+
if (!time) return ''
|
|
269
|
+
const d = new Date(time)
|
|
270
|
+
return d.toLocaleTimeString('zh-CN', {
|
|
271
|
+
hour: '2-digit',
|
|
272
|
+
minute: '2-digit',
|
|
273
|
+
second: '2-digit'
|
|
274
|
+
})
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// 格式化日期时间
|
|
278
|
+
const formatDateTime = (datetime) => {
|
|
279
|
+
if (!datetime) return ''
|
|
280
|
+
const d = new Date(datetime)
|
|
281
|
+
return d.toLocaleString('zh-CN', {
|
|
282
|
+
year: 'numeric',
|
|
283
|
+
month: '2-digit',
|
|
284
|
+
day: '2-digit',
|
|
285
|
+
hour: '2-digit',
|
|
286
|
+
minute: '2-digit',
|
|
287
|
+
second: '2-digit'
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// 格式化数字
|
|
292
|
+
const formatNumber = (num) => {
|
|
293
|
+
if (num === null || num === undefined || num === '') return ''
|
|
294
|
+
return Number(num).toLocaleString()
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// 格式化货币
|
|
298
|
+
const formatCurrency = (amount) => {
|
|
299
|
+
if (amount === null || amount === undefined || amount === '') return ''
|
|
300
|
+
return `¥${Number(amount).toLocaleString()}`
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// 获取状态主题
|
|
304
|
+
const getStatusTheme = (status) => {
|
|
305
|
+
const statusMap = {
|
|
306
|
+
'success': 'success',
|
|
307
|
+
'warning': 'warning',
|
|
308
|
+
'error': 'danger',
|
|
309
|
+
'info': 'primary'
|
|
310
|
+
}
|
|
311
|
+
return statusMap[status] || 'default'
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// 获取状态文本
|
|
315
|
+
const getStatusText = (status) => {
|
|
316
|
+
if (typeof status === 'object' && status !== null) {
|
|
317
|
+
return status.text || status.status || status
|
|
318
|
+
}
|
|
319
|
+
return status
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 获取用户头像
|
|
323
|
+
const getUserAvatar = (user) => {
|
|
324
|
+
if (typeof user === 'object' && user !== null && user.avatar) {
|
|
325
|
+
return user.avatar
|
|
326
|
+
}
|
|
327
|
+
return null
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// 获取用户初始
|
|
331
|
+
const getUserInitial = (user) => {
|
|
332
|
+
if (typeof user === 'object' && user !== null && user.name) {
|
|
333
|
+
return user.name.charAt(0)
|
|
334
|
+
}
|
|
335
|
+
return 'U'
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// 获取用户名称
|
|
339
|
+
const getUserName = (user) => {
|
|
340
|
+
if (typeof user === 'object' && user !== null && user.name) {
|
|
341
|
+
return user.name
|
|
342
|
+
}
|
|
343
|
+
return user
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// 获取链接 URL
|
|
347
|
+
const getLinkUrl = (link) => {
|
|
348
|
+
if (typeof link === 'object' && link !== null && link.url) {
|
|
349
|
+
return link.url
|
|
350
|
+
}
|
|
351
|
+
return link
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// 获取链接文本
|
|
355
|
+
const getLinkText = (link) => {
|
|
356
|
+
if (typeof link === 'object' && link !== null && link.text) {
|
|
357
|
+
return link.text
|
|
358
|
+
}
|
|
359
|
+
return link
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// 事件处理
|
|
363
|
+
const handleDownloadFile = (file) => {
|
|
364
|
+
emits('download-file', file)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const handleUserClick = () => {
|
|
368
|
+
emits('user-click', userList.value[0]) // Assuming userList is an array of users
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const handleLinkClick = () => {
|
|
372
|
+
emits('link-click', linkValue.value)
|
|
373
|
+
}
|
|
374
|
+
</script>
|
|
375
|
+
|
|
376
|
+
<style scoped>
|
|
377
|
+
.ebiz-detail-item {
|
|
378
|
+
display: flex;
|
|
379
|
+
align-items: flex-start;
|
|
380
|
+
padding: 8px 0;
|
|
381
|
+
border-bottom: 1px solid #f0f0f0;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.ebiz-detail-item:last-child {
|
|
385
|
+
border-bottom: none;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.ebiz-detail-item.vertical-layout {
|
|
389
|
+
flex-direction: column;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.ebiz-detail-item.horizontal-layout {
|
|
393
|
+
flex-direction: row;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.detail-label {
|
|
397
|
+
font-size: 14px;
|
|
398
|
+
line-height: 1.5;
|
|
399
|
+
font-weight: 500;
|
|
400
|
+
margin-right: 12px;
|
|
401
|
+
flex-shrink: 0;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.ebiz-detail-item.vertical .field-label {
|
|
405
|
+
margin-right: 0;
|
|
406
|
+
margin-bottom: 8px;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.required-mark {
|
|
410
|
+
color: #e34d59;
|
|
411
|
+
margin-left: 2px;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.field-value {
|
|
415
|
+
flex: 1;
|
|
416
|
+
font-size: 14px;
|
|
417
|
+
color: #333333;
|
|
418
|
+
line-height: 1.5;
|
|
419
|
+
word-break: break-all;
|
|
420
|
+
min-width: 0;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.description {
|
|
424
|
+
font-size: 12px;
|
|
425
|
+
color: #999999;
|
|
426
|
+
margin-top: 4px;
|
|
427
|
+
line-height: 1.4;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/* 用户信息样式 */
|
|
431
|
+
.user-list {
|
|
432
|
+
display: flex;
|
|
433
|
+
flex-wrap: wrap;
|
|
434
|
+
gap: 8px;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.user-item {
|
|
438
|
+
display: flex;
|
|
439
|
+
align-items: center;
|
|
440
|
+
padding: 6px 8px;
|
|
441
|
+
background: #f8f9fa;
|
|
442
|
+
border-radius: 4px;
|
|
443
|
+
cursor: pointer;
|
|
444
|
+
transition: background-color 0.2s;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.user-item:hover {
|
|
448
|
+
background: #e9ecef;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.user-avatar {
|
|
452
|
+
width: 24px;
|
|
453
|
+
height: 24px;
|
|
454
|
+
margin-right: 8px;
|
|
455
|
+
border-radius: 50%;
|
|
456
|
+
overflow: hidden;
|
|
457
|
+
flex-shrink: 0;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.user-avatar img {
|
|
461
|
+
width: 100%;
|
|
462
|
+
height: 100%;
|
|
463
|
+
object-fit: cover;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.user-avatar-default {
|
|
467
|
+
width: 100%;
|
|
468
|
+
height: 100%;
|
|
469
|
+
background: #0052d9;
|
|
470
|
+
color: white;
|
|
471
|
+
display: flex;
|
|
472
|
+
align-items: center;
|
|
473
|
+
justify-content: center;
|
|
474
|
+
font-size: 12px;
|
|
475
|
+
font-weight: bold;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.user-info {
|
|
479
|
+
flex: 1;
|
|
480
|
+
min-width: 0;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.user-name {
|
|
484
|
+
font-size: 13px;
|
|
485
|
+
color: #333333;
|
|
486
|
+
font-weight: 500;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.user-dept {
|
|
490
|
+
font-size: 12px;
|
|
491
|
+
color: #999999;
|
|
492
|
+
margin-top: 2px;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/* 文件值样式 */
|
|
496
|
+
.file-value {
|
|
497
|
+
width: 100%;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/* 状态值样式 */
|
|
501
|
+
.status-value {
|
|
502
|
+
display: inline-block;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/* 标签值样式 */
|
|
506
|
+
.tags-value {
|
|
507
|
+
display: flex;
|
|
508
|
+
flex-wrap: wrap;
|
|
509
|
+
gap: 6px;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.tag-item {
|
|
513
|
+
margin: 0;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/* 链接样式 */
|
|
517
|
+
.link-value {
|
|
518
|
+
color: #0052d9;
|
|
519
|
+
cursor: pointer;
|
|
520
|
+
text-decoration: underline;
|
|
521
|
+
word-break: break-all;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.link-value:hover {
|
|
525
|
+
color: #003a9b;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* 富文本样式 */
|
|
529
|
+
.html-value {
|
|
530
|
+
line-height: 1.6;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.html-value :deep(p) {
|
|
534
|
+
margin: 0 0 8px 0;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.html-value :deep(p:last-child) {
|
|
538
|
+
margin-bottom: 0;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/* 数字和货币样式 */
|
|
542
|
+
.number-value,
|
|
543
|
+
.currency-value {
|
|
544
|
+
font-weight: 500;
|
|
545
|
+
font-variant-numeric: tabular-nums;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.currency-value {
|
|
549
|
+
color: #e34d59;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/* 空值样式 */
|
|
553
|
+
.text-value:empty::before,
|
|
554
|
+
.number-value:empty::before,
|
|
555
|
+
.currency-value:empty::before,
|
|
556
|
+
.date-value:empty::before {
|
|
557
|
+
content: '--';
|
|
558
|
+
color: #c8c9cc;
|
|
559
|
+
}
|
|
560
560
|
</style>
|