@ebiz/designer-components 0.0.18-beta.1 → 0.0.18-beta.10

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,250 @@
1
+ <template>
2
+ <div class="container">
3
+ <h1>EbizEmployeeInfo 员工信息组件示例</h1>
4
+
5
+ <div class="section">
6
+ <h2>基础用法</h2>
7
+ <div class="example-block">
8
+ <ebiz-employee-info
9
+ :info="basicEmployee"
10
+ />
11
+ </div>
12
+ <div class="code-block">
13
+ <pre><code>&lt;ebiz-employee-info
14
+ :info="{
15
+ avatar: 'https://tdesign.tencent.com/vue-next/assets/avatar-1.jpg',
16
+ name: '张三',
17
+ id: 'EMP10086',
18
+ department: '研发部'
19
+ }"
20
+ /&gt;</code></pre>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="section">
25
+ <h2>不同头像尺寸</h2>
26
+ <div class="example-block">
27
+ <div class="avatar-size-container">
28
+ <div v-for="size in avatarSizes" :key="size" class="avatar-size-item">
29
+ <ebiz-employee-info
30
+ :info="basicEmployee"
31
+ :avatar-size="size"
32
+ />
33
+ <div class="size-label">size: {{ size }}</div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ <div class="code-block">
38
+ <pre><code>&lt;ebiz-employee-info
39
+ :info="employeeInfo"
40
+ avatar-size="large"
41
+ /&gt;</code></pre>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="section">
46
+ <h2>方形头像</h2>
47
+ <div class="example-block">
48
+ <ebiz-employee-info
49
+ :info="basicEmployee"
50
+ avatar-shape="round"
51
+ />
52
+ </div>
53
+ <div class="code-block">
54
+ <pre><code>&lt;ebiz-employee-info
55
+ :info="employeeInfo"
56
+ avatar-shape="round"
57
+ /&gt;</code></pre>
58
+ </div>
59
+ </div>
60
+
61
+ <div class="section">
62
+ <h2>无头像处理</h2>
63
+ <div class="example-block">
64
+ <ebiz-employee-info
65
+ :info="noAvatarEmployee"
66
+ />
67
+ </div>
68
+ <div class="code-block">
69
+ <pre><code>&lt;ebiz-employee-info
70
+ :info="{
71
+ name: '李四',
72
+ id: 'EMP10087',
73
+ department: '市场部'
74
+ }"
75
+ /&gt;</code></pre>
76
+ </div>
77
+ </div>
78
+
79
+ <div class="section">
80
+ <h2>自定义样式</h2>
81
+ <div class="example-block">
82
+ <ebiz-employee-info
83
+ :info="basicEmployee"
84
+ width="350px"
85
+ class="custom-employee-info"
86
+ />
87
+ </div>
88
+ <div class="code-block">
89
+ <pre><code>&lt;ebiz-employee-info
90
+ :info="employeeInfo"
91
+ width="350px"
92
+ class="custom-employee-info"
93
+ /&gt;
94
+
95
+ &lt;style&gt;
96
+ .custom-employee-info {
97
+ background-color: #f0f8ff;
98
+ border: 1px solid #d1e9ff;
99
+ }
100
+ &lt;/style&gt;</code></pre>
101
+ </div>
102
+ </div>
103
+
104
+ <div class="section">
105
+ <h2>多个员工信息</h2>
106
+ <div class="example-block">
107
+ <div class="employee-list">
108
+ <ebiz-employee-info
109
+ v-for="(employee, index) in employeeList"
110
+ :key="index"
111
+ :info="employee"
112
+ class="employee-list-item"
113
+ />
114
+ </div>
115
+ </div>
116
+ <div class="code-block">
117
+ <pre><code>&lt;div class="employee-list"&gt;
118
+ &lt;ebiz-employee-info
119
+ v-for="(employee, index) in employeeList"
120
+ :key="index"
121
+ :info="employee"
122
+ class="employee-list-item"
123
+ /&gt;
124
+ &lt;/div&gt;</code></pre>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ </template>
129
+
130
+ <script>
131
+ import { EbizEmployeeInfo } from '../index.js'
132
+
133
+ export default {
134
+ name: 'EbizEmployeeInfoDemo',
135
+ components: {
136
+ EbizEmployeeInfo
137
+ },
138
+ data() {
139
+ return {
140
+ basicEmployee: {
141
+ avatar: 'https://tdesign.tencent.com/vue-next/assets/avatar-1.jpg',
142
+ name: '张三',
143
+ id: 'EMP10086',
144
+ department: '研发部'
145
+ },
146
+ noAvatarEmployee: {
147
+ name: '李四',
148
+ id: 'EMP10087',
149
+ department: '市场部'
150
+ },
151
+ avatarSizes: ['small', 'medium', 'large'],
152
+ employeeList: [
153
+ {
154
+ avatar: 'https://tdesign.tencent.com/vue-next/assets/avatar-1.jpg',
155
+ name: '张三',
156
+ id: 'EMP10086',
157
+ department: '研发部'
158
+ },
159
+ {
160
+ avatar: 'https://tdesign.tencent.com/vue-next/assets/avatar-2.jpg',
161
+ name: '李四',
162
+ id: 'EMP10087',
163
+ department: '市场部'
164
+ },
165
+ {
166
+ avatar: 'https://tdesign.tencent.com/vue-next/assets/avatar-3.jpg',
167
+ name: '王五',
168
+ id: 'EMP10088',
169
+ department: '产品部'
170
+ },
171
+ {
172
+ name: '赵六',
173
+ id: 'EMP10089',
174
+ department: '设计部'
175
+ }
176
+ ]
177
+ }
178
+ }
179
+ }
180
+ </script>
181
+
182
+ <style lang="less" scoped>
183
+ .container {
184
+ padding: 20px;
185
+
186
+ h1 {
187
+ margin-bottom: 20px;
188
+ }
189
+
190
+ .section {
191
+ margin-bottom: 30px;
192
+
193
+ h2 {
194
+ margin-bottom: 15px;
195
+ }
196
+
197
+ .example-block {
198
+ margin-bottom: 15px;
199
+ padding: 20px;
200
+ border: 1px solid #eee;
201
+ border-radius: 4px;
202
+ }
203
+
204
+ .code-block {
205
+ background-color: #f5f5f5;
206
+ padding: 15px;
207
+ border-radius: 4px;
208
+
209
+ pre {
210
+ margin: 0;
211
+ white-space: pre-wrap;
212
+ }
213
+ }
214
+ }
215
+
216
+ .avatar-size-container {
217
+ display: flex;
218
+ flex-direction: column;
219
+ gap: 20px;
220
+ }
221
+
222
+ .avatar-size-item {
223
+ position: relative;
224
+
225
+ .size-label {
226
+ position: absolute;
227
+ right: 20px;
228
+ top: 50%;
229
+ transform: translateY(-50%);
230
+ font-size: 14px;
231
+ color: #666;
232
+ }
233
+ }
234
+
235
+ .employee-list {
236
+ display: flex;
237
+ flex-direction: column;
238
+ gap: 15px;
239
+ }
240
+
241
+ .employee-list-item {
242
+ border: 1px solid #eaeaea;
243
+ }
244
+
245
+ .custom-employee-info {
246
+ background-color: #f0f8ff;
247
+ border: 1px solid #d1e9ff;
248
+ }
249
+ }
250
+ </style>
@@ -45,7 +45,15 @@ export default {
45
45
  { path: '/switch', title: 'Ebiz开关组件示例' },
46
46
  { path: '/textarea', title: 'Ebiz多行文本框组件示例' },
47
47
  { path: '/upload', title: 'TDesign上传组件示例' },
48
- { path: '/grid', title: 'TDesign栅格组件示例' }
48
+ { path: '/grid', title: 'TDesign栅格组件示例' },
49
+ { path: '/tabs', title: 'Ebiz选项卡组件示例' },
50
+ { path: '/statistic', title: 'Ebiz统计数值组件示例' },
51
+ { path: '/timeline', title: 'Ebiz时间轴组件示例' },
52
+ { path: '/watermark', title: 'TDesign水印组件示例' },
53
+ { path: '/ebiz-avatar', title: 'Ebiz头像组件示例' },
54
+ { path: '/ebiz-employee-info', title: 'Ebiz员工信息组件示例' },
55
+ { path: '/tdesign-alert', title: 'TDesign提示组件示例' },
56
+ { path: '/tdesign-dialog', title: 'TDesign对话框组件示例' }
49
57
  ]
50
58
 
51
59
  return {
@@ -1,20 +1,351 @@
1
1
  <template>
2
- <div>
2
+ <div class="remote-select-demo-container">
3
3
  <ebiz-route-breadcrumb />
4
- <ebiz-remote-select />
4
+
5
+ <div class="demo-section">
6
+ <h3>基础用法</h3>
7
+ <p>基础的远程搜索选择器,支持远程数据加载</p>
8
+ <div class="demo-block">
9
+ <ebiz-remote-select
10
+ v-model="selectedValue"
11
+ :apiConfig="apiConfig"
12
+ @change="handleChange"
13
+ />
14
+ <div class="selected-value">当前选中值: {{ selectedValue || '暂无选择' }}</div>
15
+ </div>
16
+ </div>
17
+
18
+ <div class="demo-section">
19
+ <h3>多选模式</h3>
20
+ <p>设置 multiple 属性启用多选模式</p>
21
+ <div class="demo-block">
22
+ <ebiz-remote-select
23
+ v-model="multipleSelectedValue"
24
+ :apiConfig="apiConfig"
25
+ multiple
26
+ @change="handleMultipleChange"
27
+ />
28
+ <div class="selected-value">当前选中值: {{ multipleSelectedValue?.length ? multipleSelectedValue.join(', ') : '暂无选择' }}</div>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="demo-section">
33
+ <h3>不同数据源</h3>
34
+ <p>可通过不同的API配置加载不同数据源</p>
35
+ <div class="demo-block">
36
+ <div class="data-source-row">
37
+ <span class="source-label">用户数据:</span>
38
+ <ebiz-remote-select
39
+ v-model="dataSourceValues.users"
40
+ :apiConfig="dataSourceConfigs.users"
41
+ placeholder="选择用户"
42
+ />
43
+ </div>
44
+ <div class="data-source-row">
45
+ <span class="source-label">产品数据:</span>
46
+ <ebiz-remote-select
47
+ v-model="dataSourceValues.products"
48
+ :apiConfig="dataSourceConfigs.products"
49
+ placeholder="选择产品"
50
+ />
51
+ </div>
52
+ <div class="data-source-row">
53
+ <span class="source-label">城市数据:</span>
54
+ <ebiz-remote-select
55
+ v-model="dataSourceValues.cities"
56
+ :apiConfig="dataSourceConfigs.cities"
57
+ placeholder="选择城市"
58
+ />
59
+ </div>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="demo-section">
64
+ <h3>不同尺寸</h3>
65
+ <p>提供三种不同尺寸的选择器</p>
66
+ <div class="demo-block">
67
+ <div class="size-row">
68
+ <span class="size-label">小尺寸:</span>
69
+ <ebiz-remote-select
70
+ v-model="sizeValues.small"
71
+ :apiConfig="apiConfig"
72
+ size="small"
73
+ placeholder="小尺寸选择器"
74
+ />
75
+ </div>
76
+ <div class="size-row">
77
+ <span class="size-label">中尺寸:</span>
78
+ <ebiz-remote-select
79
+ v-model="sizeValues.medium"
80
+ :apiConfig="apiConfig"
81
+ size="medium"
82
+ placeholder="中尺寸选择器"
83
+ />
84
+ </div>
85
+ <div class="size-row">
86
+ <span class="size-label">大尺寸:</span>
87
+ <ebiz-remote-select
88
+ v-model="sizeValues.large"
89
+ :apiConfig="apiConfig"
90
+ size="large"
91
+ placeholder="大尺寸选择器"
92
+ />
93
+ </div>
94
+ </div>
95
+ </div>
96
+
97
+ <div class="demo-section">
98
+ <h3>禁用状态</h3>
99
+ <p>设置 disabled 属性禁用选择器</p>
100
+ <div class="demo-block">
101
+ <ebiz-remote-select
102
+ v-model="disabledValue"
103
+ :apiConfig="apiConfig"
104
+ disabled
105
+ placeholder="禁用状态"
106
+ />
107
+ </div>
108
+ </div>
109
+
110
+ <div class="demo-section">
111
+ <h3>带前缀图标</h3>
112
+ <p>通过 slot 自定义前缀图标</p>
113
+ <div class="demo-block">
114
+ <ebiz-remote-select
115
+ v-model="prefixIconValue"
116
+ :apiConfig="apiConfig"
117
+ placeholder="带前缀图标的选择器"
118
+ >
119
+ <template #prefix>
120
+ <t-icon name="search" />
121
+ </template>
122
+ </ebiz-remote-select>
123
+ </div>
124
+ </div>
125
+
126
+ <div class="demo-section">
127
+ <h3>自定义查询参数</h3>
128
+ <p>通过 queryParams 自定义查询参数</p>
129
+ <div class="demo-block">
130
+ <div class="query-params-control">
131
+ <t-input v-model="customQueryParam" placeholder="输入过滤条件" />
132
+ <t-button theme="primary" style="margin-left: 8px;" @click="updateQueryParams">应用过滤</t-button>
133
+ </div>
134
+ <ebiz-remote-select
135
+ v-model="queryParamsValue"
136
+ :apiConfig="apiConfig"
137
+ :queryParams="queryParams"
138
+ placeholder="带自定义查询参数的选择器"
139
+ />
140
+ </div>
141
+ </div>
142
+
143
+ <div class="demo-section">
144
+ <h3>API 参考</h3>
145
+ <t-table :data="propsData" :columns="propsColumns" bordered size="small" stripe />
146
+ <h4 style="margin-top: 16px;">事件</h4>
147
+ <t-table :data="eventsData" :columns="eventsColumns" bordered size="small" stripe />
148
+ <h4 style="margin-top: 16px;">插槽</h4>
149
+ <t-table :data="slotsData" :columns="slotsColumns" bordered size="small" stripe />
150
+ </div>
5
151
  </div>
6
152
  </template>
7
153
 
8
154
  <script>
155
+ import { defineComponent } from 'vue'
9
156
  import { EbizRemoteSelect } from '@/index.js'
157
+ import { Icon, Button, Input, Table } from 'tdesign-vue-next'
10
158
 
11
- export default {
159
+ // 替换实际的数据服务 - 用于演示
160
+ import dataServiceModule from '../apiService/simpleDataService'
161
+ // 备份原始fetch方法
162
+ dataServiceModule.fetch = dataServiceModule.fetch
163
+
164
+ export default defineComponent({
12
165
  name: 'RemoteSelectDemo',
13
166
  components: {
14
- EbizRemoteSelect
167
+ EbizRemoteSelect,
168
+ TIcon: Icon,
169
+ TButton: Button,
170
+ TInput: Input,
171
+ TTable: Table
172
+ },
173
+ data() {
174
+ return {
175
+ // 基础示例的选中值
176
+ selectedValue: '',
177
+
178
+ // 多选示例的选中值
179
+ multipleSelectedValue: [],
180
+
181
+ // 不同数据源示例的选中值
182
+ dataSourceValues: {
183
+ users: '',
184
+ products: '',
185
+ cities: ''
186
+ },
187
+
188
+ // 不同数据源配置
189
+ dataSourceConfigs: {
190
+ users: {
191
+ key: 'user_options',
192
+ apiId: 'mockUserList',
193
+ apiType: 'MULTIPLE_DATA_SEARCH'
194
+ },
195
+ products: {
196
+ key: 'product_options',
197
+ apiId: 'mockProductList',
198
+ apiType: 'MULTIPLE_DATA_SEARCH'
199
+ },
200
+ cities: {
201
+ key: 'city_options',
202
+ apiId: 'mockCityList',
203
+ apiType: 'MULTIPLE_DATA_SEARCH'
204
+ }
205
+ },
206
+
207
+ // 不同尺寸示例的选中值
208
+ sizeValues: {
209
+ small: '',
210
+ medium: '',
211
+ large: ''
212
+ },
213
+
214
+ // 禁用状态示例的选中值
215
+ disabledValue: '',
216
+
217
+ // 带前缀图标示例的选中值
218
+ prefixIconValue: '',
219
+
220
+ // 自定义查询参数示例
221
+ queryParamsValue: '',
222
+ customQueryParam: '',
223
+ queryParams: {},
224
+
225
+ // API配置
226
+ apiConfig: {
227
+ key: 'user_options',
228
+ apiId: 123,
229
+ apiType: 'MULTIPLE_DATA_SEARCH'
230
+ },
231
+
232
+ // API参考数据
233
+ propsColumns: [
234
+ { colKey: 'name', title: '属性名', width: '15%' },
235
+ { colKey: 'type', title: '类型', width: '15%' },
236
+ { colKey: 'default', title: '默认值', width: '15%' },
237
+ { colKey: 'desc', title: '说明' }
238
+ ],
239
+ propsData: [
240
+ { name: 'apiConfig', type: 'Object', default: '{}', desc: 'API配置,包含 key, apiId, apiType 属性' },
241
+ { name: 'queryParams', type: 'Object', default: '{}', desc: '查询参数,用于传递给后端API的查询条件' },
242
+ { name: 'multiple', type: 'Boolean', default: 'false', desc: '是否支持多选' },
243
+ { name: 'placeholder', type: 'String', default: '请选择', desc: '输入框占位文本' },
244
+ { name: 'clearable', type: 'Boolean', default: 'true', desc: '是否可以清空选项' },
245
+ { name: 'disabled', type: 'Boolean', default: 'false', desc: '是否禁用' },
246
+ { name: 'modelValue', type: 'String / Number / Array', default: "''", desc: '选择器选中值' },
247
+ { name: 'optionsConfig', type: 'Object', default: '{}', desc: '选项配置,包含 labelField, valueField 属性' },
248
+ { name: 'size', type: 'String', default: 'medium', desc: '组件尺寸,可选值为 small / medium / large' },
249
+ { name: 'emptyText', type: 'String', default: '暂无数据', desc: '空数据提示文本' },
250
+ { name: 'popupProps', type: 'Object', default: '{}', desc: '下拉弹出层的配置选项' }
251
+ ],
252
+
253
+ eventsColumns: [
254
+ { colKey: 'name', title: '事件名', width: '15%' },
255
+ { colKey: 'params', title: '参数', width: '25%' },
256
+ { colKey: 'desc', title: '说明' }
257
+ ],
258
+ eventsData: [
259
+ { name: 'update:modelValue', params: '(value: String / Number / Array)', desc: '选中值变化时触发,用于 v-model 双向绑定' },
260
+ { name: 'change', params: '(value: String / Number / Array, context: Object)', desc: '选中值发生变化时触发' },
261
+ { name: 'focus', params: '(value: String / Number / Array, context: Object)', desc: '获得焦点时触发' },
262
+ { name: 'blur', params: '(value: String / Number / Array, context: Object)', desc: '失去焦点时触发' }
263
+ ],
264
+
265
+ slotsColumns: [
266
+ { colKey: 'name', title: '插槽名', width: '15%' },
267
+ { colKey: 'desc', title: '说明' }
268
+ ],
269
+ slotsData: [
270
+ { name: 'prefix', desc: '自定义选择器前缀图标内容' },
271
+ { name: 'suffix', desc: '自定义选择器后缀图标内容' }
272
+ ]
273
+ }
274
+ },
275
+ methods: {
276
+ // 基础示例的选中值变化处理
277
+ handleChange(value) {
278
+ console.log('基础示例选中值变化:', value)
279
+ },
280
+
281
+ // 多选示例的选中值变化处理
282
+ handleMultipleChange(value) {
283
+ console.log('多选示例选中值变化:', value)
284
+ },
285
+
286
+ // 更新自定义查询参数
287
+ updateQueryParams() {
288
+ this.queryParams = {
289
+ keyword: this.customQueryParam
290
+ }
291
+ }
292
+ },
293
+ // 在组件卸载时恢复原始的fetch方法
294
+ unmounted() {
295
+ dataServiceModule.fetch = originalFetch
15
296
  }
16
- }
297
+ })
17
298
  </script>
18
299
 
19
300
  <style scoped>
301
+ .remote-select-demo-container {
302
+ padding: 20px;
303
+ }
304
+
305
+ .demo-section {
306
+ margin-bottom: 30px;
307
+ border-bottom: 1px solid #eee;
308
+ padding-bottom: 20px;
309
+ }
310
+
311
+ .demo-section h3 {
312
+ font-size: 18px;
313
+ font-weight: 600;
314
+ margin-bottom: 8px;
315
+ }
316
+
317
+ .demo-section p {
318
+ color: #666;
319
+ margin-bottom: 16px;
320
+ }
321
+
322
+ .demo-block {
323
+ background: #f9f9f9;
324
+ padding: 20px;
325
+ border-radius: 6px;
326
+ margin-top: 10px;
327
+ }
328
+
329
+ .selected-value {
330
+ margin-top: 10px;
331
+ font-size: 14px;
332
+ color: #666;
333
+ }
334
+
335
+ .size-row, .data-source-row {
336
+ display: flex;
337
+ align-items: center;
338
+ margin-bottom: 16px;
339
+ }
340
+
341
+ .size-label, .source-label {
342
+ width: 70px;
343
+ text-align: right;
344
+ margin-right: 8px;
345
+ }
346
+
347
+ .query-params-control {
348
+ display: flex;
349
+ margin-bottom: 16px;
350
+ }
20
351
  </style>