@ebiz/designer-components 0.1.21 → 0.1.22

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.
@@ -0,0 +1,296 @@
1
+ <template>
2
+ <div class="demo-container">
3
+ <h1>详情视图演示</h1>
4
+
5
+ <div class="demo-section">
6
+ <h2>基础用法 - 静态数据</h2>
7
+ <EbizDetailView
8
+ :data="staticData"
9
+ :columns="2"
10
+ layout="horizontal"
11
+ :gap="16"
12
+ :labelWidth="120"
13
+ labelColor="#666666"
14
+ >
15
+ <EbizDetailItem
16
+ label="姓名"
17
+ type="text"
18
+ :value="staticData.name"
19
+ :required="true"
20
+ />
21
+ <EbizDetailItem
22
+ label="邮箱"
23
+ type="text"
24
+ :value="staticData.email"
25
+ />
26
+ <EbizDetailItem
27
+ label="部门"
28
+ type="text"
29
+ :value="staticData.department"
30
+ />
31
+ <EbizDetailItem
32
+ label="状态"
33
+ type="status"
34
+ :value="staticData.status"
35
+ />
36
+ <EbizDetailItem
37
+ label="负责人"
38
+ type="user"
39
+ :value="staticData.manager"
40
+ @user-click="handleUserClick"
41
+ />
42
+ <EbizDetailItem
43
+ label="标签"
44
+ type="tags"
45
+ :value="staticData.tags"
46
+ />
47
+ <EbizDetailItem
48
+ label="入职日期"
49
+ type="date"
50
+ :value="staticData.joinDate"
51
+ />
52
+ <EbizDetailItem
53
+ label="薪资"
54
+ type="currency"
55
+ :value="staticData.salary"
56
+ />
57
+ <EbizDetailItem
58
+ label="附件"
59
+ type="file"
60
+ :value="staticData.files"
61
+ @download-file="handleDownloadFile"
62
+ />
63
+ <EbizDetailItem
64
+ label="个人主页"
65
+ type="link"
66
+ :value="staticData.website"
67
+ @link-click="handleLinkClick"
68
+ />
69
+ </EbizDetailView>
70
+ </div>
71
+
72
+ <div class="demo-section">
73
+ <h2>API数据源</h2>
74
+ <EbizDetailView
75
+ apiUrl="/api/user/detail"
76
+ apiMethod="GET"
77
+ :apiParams="{ id: 123 }"
78
+ :autoLoad="true"
79
+ :columns="3"
80
+ layout="vertical"
81
+ @data-loaded="handleDataLoaded"
82
+ @error="handleError"
83
+ >
84
+ <EbizDetailItem
85
+ label="用户ID"
86
+ type="number"
87
+ :value="apiData.id"
88
+ />
89
+ <EbizDetailItem
90
+ label="用户名"
91
+ type="text"
92
+ :value="apiData.username"
93
+ />
94
+ <EbizDetailItem
95
+ label="创建时间"
96
+ type="date"
97
+ :value="apiData.createTime"
98
+ />
99
+ <EbizDetailItem
100
+ label="最后登录"
101
+ type="date"
102
+ :value="apiData.lastLogin"
103
+ />
104
+ <EbizDetailItem
105
+ label="权限"
106
+ type="tags"
107
+ :value="apiData.permissions"
108
+ />
109
+ <EbizDetailItem
110
+ label="账户状态"
111
+ type="status"
112
+ :value="apiData.accountStatus"
113
+ />
114
+ </EbizDetailView>
115
+ </div>
116
+
117
+ <div class="demo-section">
118
+ <h2>垂直布局 - 单列显示</h2>
119
+ <EbizDetailView
120
+ :data="staticData"
121
+ :columns="1"
122
+ layout="vertical"
123
+ :gap="20"
124
+ labelColor="#333333"
125
+ >
126
+ <EbizDetailItem
127
+ label="详细描述"
128
+ type="html"
129
+ :value="staticData.description"
130
+ description="这是一个富文本字段"
131
+ />
132
+ <EbizDetailItem
133
+ label="工作经历"
134
+ type="text"
135
+ :value="staticData.experience"
136
+ description="工作经历详情"
137
+ />
138
+ <EbizDetailItem
139
+ label="技能评分"
140
+ type="number"
141
+ :value="staticData.skillScore"
142
+ description="技能综合评分"
143
+ />
144
+ </EbizDetailView>
145
+ </div>
146
+
147
+ <div class="demo-section">
148
+ <h2>事件演示</h2>
149
+ <div class="event-log">
150
+ <h3>事件日志:</h3>
151
+ <ul>
152
+ <li v-for="(log, index) in eventLogs" :key="index">
153
+ {{ log }}
154
+ </li>
155
+ </ul>
156
+ </div>
157
+ </div>
158
+ </div>
159
+ </template>
160
+
161
+ <script setup>
162
+ import { ref } from 'vue'
163
+ import EbizDetailView from '../components/EbizDetailView.vue'
164
+ import EbizDetailItem from '../components/EbizDetailItem.vue'
165
+
166
+ // 静态数据
167
+ const staticData = ref({
168
+ name: '张三',
169
+ email: 'zhangsan@example.com',
170
+ department: '技术部',
171
+ status: {
172
+ text: '在职',
173
+ status: 'success'
174
+ },
175
+ manager: {
176
+ id: 1,
177
+ name: '李四',
178
+ department: '技术部',
179
+ avatar: 'https://avatars.githubusercontent.com/u/1?v=4'
180
+ },
181
+ tags: ['前端开发', 'Vue.js', 'React'],
182
+ joinDate: '2022-01-15',
183
+ salary: 15000,
184
+ files: [
185
+ {
186
+ id: 1,
187
+ name: '简历.pdf',
188
+ url: 'https://example.com/resume.pdf',
189
+ size: 1024000
190
+ },
191
+ {
192
+ id: 2,
193
+ name: '头像.jpg',
194
+ url: 'https://avatars.githubusercontent.com/u/1?v=4',
195
+ size: 256000
196
+ }
197
+ ],
198
+ website: {
199
+ text: '个人博客',
200
+ url: 'https://blog.example.com'
201
+ },
202
+ description: '<p>这是一个<strong>优秀</strong>的前端开发工程师,具有丰富的项目经验。</p><ul><li>精通Vue.js</li><li>熟悉React</li><li>了解Node.js</li></ul>',
203
+ experience: '拥有5年前端开发经验,参与过多个大型项目的开发和维护。',
204
+ skillScore: 95
205
+ })
206
+
207
+ // API数据
208
+ const apiData = ref({})
209
+
210
+ // 事件日志
211
+ const eventLogs = ref([])
212
+
213
+ // 事件处理函数
214
+ const handleUserClick = (user) => {
215
+ eventLogs.value.unshift(`用户点击: ${user.name} (${user.department})`)
216
+ }
217
+
218
+ const handleDownloadFile = (file) => {
219
+ eventLogs.value.unshift(`文件下载: ${file.name}`)
220
+ // 实际下载逻辑
221
+ window.open(file.url, '_blank')
222
+ }
223
+
224
+ const handleLinkClick = (link) => {
225
+ eventLogs.value.unshift(`链接点击: ${link.text} -> ${link.url}`)
226
+ window.open(link.url, '_blank')
227
+ }
228
+
229
+ const handleDataLoaded = (data) => {
230
+ apiData.value = data
231
+ eventLogs.value.unshift(`API数据加载成功: ${JSON.stringify(data)}`)
232
+ }
233
+
234
+ const handleError = (error) => {
235
+ eventLogs.value.unshift(`API加载错误: ${error.message}`)
236
+ }
237
+ </script>
238
+
239
+ <style scoped>
240
+ .demo-container {
241
+ padding: 20px;
242
+ max-width: 1200px;
243
+ margin: 0 auto;
244
+ }
245
+
246
+ h1 {
247
+ color: #333;
248
+ margin-bottom: 30px;
249
+ text-align: center;
250
+ }
251
+
252
+ .demo-section {
253
+ margin-bottom: 40px;
254
+ padding: 20px;
255
+ border: 1px solid #e8e8e8;
256
+ border-radius: 8px;
257
+ background: #fafafa;
258
+ }
259
+
260
+ .demo-section h2 {
261
+ color: #666;
262
+ margin-bottom: 20px;
263
+ font-size: 18px;
264
+ }
265
+
266
+ .event-log {
267
+ margin-top: 20px;
268
+ padding: 15px;
269
+ background: #f5f5f5;
270
+ border-radius: 6px;
271
+ }
272
+
273
+ .event-log h3 {
274
+ margin-bottom: 10px;
275
+ color: #333;
276
+ }
277
+
278
+ .event-log ul {
279
+ list-style: none;
280
+ padding: 0;
281
+ margin: 0;
282
+ max-height: 200px;
283
+ overflow-y: auto;
284
+ }
285
+
286
+ .event-log li {
287
+ padding: 5px 0;
288
+ border-bottom: 1px solid #e0e0e0;
289
+ font-size: 14px;
290
+ color: #666;
291
+ }
292
+
293
+ .event-log li:last-child {
294
+ border-bottom: none;
295
+ }
296
+ </style>
@@ -95,7 +95,8 @@ export default {
95
95
  { path: '/vxe-table', title: 'EbizVxeTable示例' },
96
96
  { path: '/meeting-room-selector', title: 'Ebiz会议室选择器组件示例' },
97
97
  { path: '/mobile-meeting-room-selector', title: 'Ebiz移动端会议室选择器组件示例' },
98
- { path: '/file-list-demo', title: '文件列表demo' }
98
+ { path: '/file-list-demo', title: '文件列表demo' },
99
+ { path: '/detail-view-demo', title: 'Ebiz详情页组件示例' }
99
100
  ]
100
101
 
101
102
  return {