@ebiz/designer-components 0.0.57 → 0.0.59
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 +4822 -4822
- 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 +297 -297
- 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 +332 -338
- 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 +144 -144
- package/src/components/EbizDescriptions.vue +340 -340
- package/src/components/EbizDescriptionsItem.vue +47 -47
- package/src/components/EbizDetailBlock.vue +81 -81
- package/src/components/EbizDialog.vue +260 -260
- package/src/components/EbizDiv.vue +32 -32
- package/src/components/EbizDivider.vue +96 -96
- package/src/components/EbizEmployeeInfo.vue +138 -138
- package/src/components/EbizEmployeeSelector.vue +1093 -1086
- package/src/components/EbizFileUpload.vue +238 -238
- package/src/components/EbizMap.vue +541 -541
- package/src/components/EbizOkrTree.vue +99 -99
- package/src/components/EbizPageHeader.vue +95 -95
- package/src/components/EbizPagination.vue +162 -162
- package/src/components/EbizPopconfirm.vue +47 -47
- package/src/components/EbizRadio.vue +86 -86
- package/src/components/EbizRadioGroup.vue +83 -83
- package/src/components/EbizRemoteSelect.vue +232 -232
- package/src/components/EbizRouteBreadcrumb.vue +46 -46
- 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 +152 -152
- package/src/components/EbizTreeMergeTable.vue +1414 -1414
- package/src/components/EbizTreeSelector.vue +418 -418
- package/src/components/EbizVxeTable.vue +290 -290
- package/src/components/Form.vue +28 -28
- package/src/components/Home.vue +7 -7
- 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 +444 -444
- 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 +388 -388
- 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/senior/EbizSData/index.vue +260 -260
- package/src/components/senior/EbizSDialog/index.vue +713 -712
- package/src/components/senior/EbizSForm/README.md +157 -157
- package/src/components/senior/EbizSForm/index.vue +668 -668
- package/src/components/senior/EbizSForm/item.vue +522 -522
- package/src/components/senior/EbizSForm/mItems/DateTimePicker.vue +51 -51
- package/src/components/senior/EbizSForm/mItems/Picker.vue +63 -63
- package/src/index.js +218 -218
- package/src/main.js +55 -55
- package/src/router/index.js +374 -374
- 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/upload.ts +126 -126
- 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 +76 -76
- 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/EbizEmployeeInfo.vue +249 -249
- package/src/views/EbizEmployeeSelector.vue +83 -83
- package/src/views/EbizMap.vue +201 -201
- package/src/views/EbizRadioDemo.vue +151 -151
- package/src/views/EbizSDataDemo.vue +136 -136
- package/src/views/EbizSDialogDemo.vue +301 -301
- package/src/views/EbizSForm/index.vue +359 -359
- 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 +146 -146
- 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/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 +121 -121
- package/src/views/VxeTableDemo.vue +279 -279
- package/src/views/WatermarkDemo.vue +85 -85
@@ -1,351 +1,351 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="remote-select-demo-container">
|
3
|
-
<ebiz-route-breadcrumb />
|
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>
|
151
|
-
</div>
|
152
|
-
</template>
|
153
|
-
|
154
|
-
<script>
|
155
|
-
import { defineComponent } from 'vue'
|
156
|
-
import { EbizRemoteSelect } from '@/index.js'
|
157
|
-
import { Icon, Button, Input, Table } from 'tdesign-vue-next'
|
158
|
-
|
159
|
-
// 替换实际的数据服务 - 用于演示
|
160
|
-
import dataServiceModule from '../apiService/simpleDataService'
|
161
|
-
// 备份原始fetch方法
|
162
|
-
dataServiceModule.fetch = dataServiceModule.fetch
|
163
|
-
|
164
|
-
export default defineComponent({
|
165
|
-
name: 'RemoteSelectDemo',
|
166
|
-
components: {
|
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
|
296
|
-
}
|
297
|
-
})
|
298
|
-
</script>
|
299
|
-
|
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
|
-
}
|
1
|
+
<template>
|
2
|
+
<div class="remote-select-demo-container">
|
3
|
+
<ebiz-route-breadcrumb />
|
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>
|
151
|
+
</div>
|
152
|
+
</template>
|
153
|
+
|
154
|
+
<script>
|
155
|
+
import { defineComponent } from 'vue'
|
156
|
+
import { EbizRemoteSelect } from '@/index.js'
|
157
|
+
import { Icon, Button, Input, Table } from 'tdesign-vue-next'
|
158
|
+
|
159
|
+
// 替换实际的数据服务 - 用于演示
|
160
|
+
import dataServiceModule from '../apiService/simpleDataService'
|
161
|
+
// 备份原始fetch方法
|
162
|
+
dataServiceModule.fetch = dataServiceModule.fetch
|
163
|
+
|
164
|
+
export default defineComponent({
|
165
|
+
name: 'RemoteSelectDemo',
|
166
|
+
components: {
|
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
|
296
|
+
}
|
297
|
+
})
|
298
|
+
</script>
|
299
|
+
|
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
|
+
}
|
351
351
|
</style>
|