@bit-sun/business-component 1.1.21 → 1.1.24

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.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/src/components/Business/CommodityEntry/index.md +69 -0
  3. package/src/components/Business/CommodityEntry/index.tsx +75 -0
  4. package/src/components/Business/SearchSelect/BusinessUtils.ts +888 -0
  5. package/src/components/Business/SearchSelect/common.ts +34 -0
  6. package/src/components/Business/SearchSelect/index.md +906 -0
  7. package/src/components/{SearchSelect/business/BusinessSearchSelect.tsx → Business/SearchSelect/index.tsx} +3 -2
  8. package/src/components/Business/SearchSelect/utils.ts +71 -0
  9. package/src/components/{DataValidation → Functional/DataValidation}/index.less +0 -0
  10. package/src/components/{DataValidation → Functional/DataValidation}/index.md +3 -3
  11. package/src/components/{DataValidation → Functional/DataValidation}/index.tsx +1 -1
  12. package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.less +0 -0
  13. package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.md +3 -3
  14. package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.tsx +0 -0
  15. package/src/components/{SearchSelect → Functional/SearchSelect}/index.less +0 -0
  16. package/src/components/{SearchSelect → Functional/SearchSelect}/index.md +14 -11
  17. package/src/components/{SearchSelect → Functional/SearchSelect}/index.tsx +226 -106
  18. package/src/index.ts +5 -4
  19. package/dist/components/DataValidation/index.d.ts +0 -144
  20. package/dist/components/QueryMutipleInput/index.d.ts +0 -5
  21. package/dist/components/SearchSelect/business/BusinessSearchSelect.d.ts +0 -2
  22. package/dist/components/SearchSelect/business/BusinessUtils.d.ts +0 -22
  23. package/dist/components/SearchSelect/index.d.ts +0 -3
  24. package/dist/index.d.ts +0 -5
  25. package/dist/index.esm.js +0 -3723
  26. package/dist/index.js +0 -3738
  27. package/dist/utils/CheckOneUser/index.d.ts +0 -2
  28. package/src/components/SearchSelect/business/BusinessUtils.ts +0 -464
  29. package/src/components/SearchSelect/business/index.md +0 -181
@@ -1,2 +0,0 @@
1
- declare const _default: (storageKeyString: string, seconds?: number, tipsCallFunction?: (() => {}) | undefined) => void;
2
- export default _default;
@@ -1,464 +0,0 @@
1
- // 此文件用于 处理业务组件 所用到的公共方法
2
- // @ts-nocheck
3
- import axios from 'axios';
4
- import { message } from 'antd';
5
- import { stringify } from 'querystring';
6
-
7
- const getDicData = (dicCode: string) => {
8
- let dicData = {};
9
- let dictionaryData;
10
- if (!dictionaryData) {
11
- let storageDic = localStorage.getItem('dicData')
12
- ? JSON.parse(localStorage.getItem('dicData') || '{}')
13
- : {};
14
- dicData = storageDic[dicCode];
15
- } else {
16
- dicData = dictionaryData[dicCode];
17
- }
18
- if (!dicData || !dicData.length) {
19
- // throw new Error(`当前没有${dicCode}字典值`);
20
- }
21
- return dicData
22
- }
23
-
24
- const getDictionarySource = (dicCode: string, needConvertInterger = false) => {
25
- let dicData = getDicData(dicCode);
26
-
27
- try {
28
- if (needConvertInterger) {
29
- dicData = dicData.map((item: { text: string; value: string }) => ({
30
- ...item,
31
- value: parseFloat(item.value),
32
- }));
33
- }
34
- } catch (e) {}
35
- return dicData;
36
- };
37
-
38
- const getDictionaryTextByValue = (dicCode: string, value: string | number) => {
39
- let dicData = getDicData(dicCode);
40
-
41
- if (value === undefined) return '';
42
-
43
- const dicItemArray = dicData?.filter(
44
- (item: { value: string }) => item.value === value.toString(),
45
- );
46
-
47
- if (!dicItemArray?.length) {
48
- // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
49
- return value;
50
- }
51
-
52
- return dicItemArray[0].text;
53
- };
54
-
55
- const loadSelectSource = (url: string, params?: any) => {
56
- return new Promise((resolve, reject) => {
57
- axios
58
- .get(`${url}?${stringify(params)}`)
59
- .then((result: any) => {
60
- result = result.data;
61
- if (result.status !== '0') {
62
- message.error(result.msg);
63
- return;
64
- }
65
- resolve(result);
66
- })
67
- .catch((err) => {
68
- reject(err);
69
- });
70
- })
71
- };
72
-
73
- export function commonFun (type?: string, prefixUrl: any) {
74
- // 默认type === 'supplier' 供应商选择器
75
- let requestConfig = {
76
- url: `${prefixUrl.selectPrefix}/supplier`,
77
- filter: 'qp-nameAndCode-like', // 过滤参数
78
- otherParams: {
79
- sorter: 'desc-id'
80
- }, // 默认参数
81
- }
82
-
83
- /*
84
- * 处理 格式化下拉框数据源
85
- * reData 必传 promise返回响应的数据 格式为[{},{},{},...] Promise.all第一个参数数组有多少个数组长度就是多少,其中每个对象为每次请求的结果数据
86
- * 每个结果数据格式为{ status: '0', msg: 'success', data: { items: [], total: 1, size: 1, page: 1 }, traceId: 'baba..'}
87
- * position 必传 为获取Promise.all请求结果的位置
88
- * changePosition 必传 为搜索表单Form中需要更改数据源的Item项的位置
89
- * changeSearchForm 必传 为搜索表单Form数据
90
- * */
91
- const formatSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['code', 'name']) => {
92
- const data = reData && reData[position]?.data;
93
- const list = Array.isArray(data) ? data :(data?.items || data?.list || []);
94
- const formatData = list?.length ? list.map((v: any) => ({ text: v[resKeyValue[1]], value: v[resKeyValue[0]] })) : [];
95
- changeSearchForm[changePosition] = {...changeSearchForm[changePosition], initialSource: formatData}
96
- }
97
-
98
- // 格式化树选择器数据源
99
- const mapSearchTree = (treeDataItem: any, resKeyValue: any) => {
100
- const haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
101
- return {
102
- title: treeDataItem[resKeyValue[1]],
103
- key: treeDataItem[resKeyValue[0]],
104
- parentId: treeDataItem.parent,
105
- data: { ...treeDataItem },
106
- isLeaf: !haveChildren,
107
- disabled: haveChildren,
108
- children: haveChildren ? treeDataItem.children.map((i: any) => mapSearchTree(i, resKeyValue)) : [],
109
- };
110
- };
111
- const formatTreeDataSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['id', 'name']) => {
112
- const data = reData && reData[position]?.data;
113
- const formatData = (data &&
114
- Array.isArray(data) &&
115
- data.length &&
116
- data.map((ites: any) => mapSearchTree(ites, resKeyValue))) ||
117
- []
118
- changeSearchForm[changePosition].field.props.treeData = formatData;
119
- }
120
-
121
-
122
- let tableSearchForm: any [] = [];
123
- if(type === 'supplier') {
124
- tableSearchForm = [
125
- { name: 'qp-name-like', label: '客户名称' }, // field: { type: 'input', props: { placeholder: '请输入'}}
126
- { name: 'qp-code-like', label: '客户编码' },
127
- { name: 'qp-conglomerateCode-in', type: 'select', label: '归属集团', field: {
128
- type: 'select',
129
- props: {
130
- mode: 'multiple',
131
- notFoundContent: '暂无数据',
132
- allowClear: true,
133
- showSearch: true,
134
- showArrow: true,
135
- maxTagCount: 1,
136
- optionFilterProp: 'children',
137
- filterOption: (input: string, option: { props: { children: string } }) =>
138
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
139
- },
140
- } },
141
- { name: 'qp-accountingCode-in', type: 'select', label: '归属核算主体', field: {
142
- type: 'select',
143
- props: {
144
- mode: 'multiple',
145
- notFoundContent: '暂无数据',
146
- allowClear: true,
147
- showSearch: true,
148
- showArrow: true,
149
- maxTagCount: 1,
150
- optionFilterProp: 'children',
151
- filterOption: (input: string, option: { props: { children: string } }) =>
152
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
153
- },
154
- } },
155
- { name: 'qp-companyCode-in', type: 'select', label: '归属法人公司', field: {
156
- type: 'select',
157
- props: {
158
- mode: 'multiple',
159
- notFoundContent: '暂无数据',
160
- allowClear: true,
161
- showSearch: true,
162
- showArrow: true,
163
- maxTagCount: 1,
164
- optionFilterProp: 'children',
165
- filterOption: (input: string, option: { props: { children: string } }) =>
166
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
167
- },
168
- } },
169
- { name: 'qp-sharingType-eq', type: 'select', label: '共享类型', initialSource: getDictionarySource('UC000013') },
170
- ]
171
- Promise.all([
172
- loadSelectSource(`${prefixUrl.formSelectFix}/company`, {
173
- pageSize: 5000,
174
- currentPage: 1,
175
- 'qp-companyType-eq': '30',
176
- }),
177
- loadSelectSource(`${prefixUrl.formSelectFix}/accountingSubject`, {
178
- pageSize: 5000,
179
- currentPage: 1,
180
- }),
181
- loadSelectSource(`${prefixUrl.formSelectFix}/company`, {
182
- pageSize: 5000,
183
- currentPage: 1,
184
- 'qp-companyType-eq': '20',
185
- })
186
- ]).then((x: any)=>{
187
- formatSource(x,0, 2, tableSearchForm);
188
- formatSource(x,1, 3, tableSearchForm);
189
- formatSource(x,2, 4, tableSearchForm);
190
- })
191
- }
192
- let modalTableProps = {
193
- modalTableTitle: '选择供应商',
194
- tableSearchForm,
195
- tableColumns: [
196
- {
197
- title: '客户编码',
198
- dataIndex: 'code',
199
- },
200
- {
201
- title: '客户名称',
202
- dataIndex: 'name',
203
- },
204
- {
205
- title: '归属集团',
206
- dataIndex: 'conglomerateName',
207
- },
208
- {
209
- title: '归属法人公司',
210
- dataIndex: 'legalCompanyName',
211
- },
212
- {
213
- title: '归属核算主体',
214
- dataIndex: 'accountingName',
215
- },
216
- {
217
- title: '共享类型',
218
- dataIndex: 'sharingType',
219
- render: (text: number) => getDictionaryTextByValue('UC000013', text),
220
- },
221
- ]
222
- }
223
-
224
- // 商品选择器
225
- if(type === 'skuCommodity') {
226
- requestConfig = {
227
- url: `${prefixUrl.selectPrefix}/sku`,
228
- filter: 'qp-nameAndCode-like', // 过滤参数
229
- mappingTextField: 'name',
230
- mappingValueField: 'skuCode',
231
- otherParams: {
232
- 'qp-approveStatus-eq':2,
233
- sorter: 'desc-id'
234
- }, // 默认参数
235
- sourceName: 'skuCode',
236
- }
237
- tableSearchForm = [
238
- { name: 'qp-name-like', label: 'SKU名称' },
239
- { name: 'qp-skuCode-like', label: 'SKU编码' },
240
- { name: 'qp-barCode-like', label: '条形码' },
241
- { name: 'qp-itemName-like', label: '所属SPU名称' },
242
- { name: 'qp-itemCode-like', label: '所属SPU编码' },
243
- { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
244
- type: 'select',
245
- props: {
246
- mode: 'multiple',
247
- notFoundContent: '暂无数据',
248
- allowClear: true,
249
- showSearch: true,
250
- showArrow: true,
251
- maxTagCount: 1,
252
- optionFilterProp: 'children',
253
- filterOption: (input: string, option: { props: { children: string } }) =>
254
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
255
- },
256
- } },
257
- { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
258
- type: 'treeSelect',
259
- props: {
260
- treeData: [],
261
- treeCheckable: true,
262
- showSearch: true,
263
- allowClear: true,
264
- showArrow: true,
265
- treeNodeFilterProp: 'title',
266
- treeDefaultExpandAll: true,
267
- maxTagCount: 1,
268
- placeholder: '请选择',
269
- style: {
270
- width: '100%',
271
- },
272
- dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
273
- },
274
- } },
275
- { name: 'qp-classId-in', type: 'select', label: '品类', field: {
276
- type: 'select',
277
- props: {
278
- mode: 'multiple',
279
- notFoundContent: '暂无数据',
280
- allowClear: true,
281
- showSearch: true,
282
- showArrow: true,
283
- maxTagCount: 1,
284
- optionFilterProp: 'children',
285
- filterOption: (input: string, option: { props: { children: string } }) =>
286
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
287
- },
288
- } },
289
- ]
290
- Promise.all([
291
- loadSelectSource(`${prefixUrl.formSelectFix}/brand/queryBrandList`, {
292
- pageSize: 5000,
293
- currentPage: 1,
294
- }),
295
- loadSelectSource(`${prefixUrl.formSelectFix}/category/queryCategoryTree`, {
296
- pageSize: 5000,
297
- currentPage: 1,
298
- }),
299
- loadSelectSource(`${prefixUrl.formSelectFix}/class/withProperty`, {
300
- pageSize: 5000,
301
- currentPage: 1,
302
- }),
303
- ]).then((x: any)=>{
304
- formatSource(x,0, 5, tableSearchForm,['id','name']);
305
- formatTreeDataSource(x,1, 6, tableSearchForm);
306
- formatSource(x,2, 7, tableSearchForm,['id','name']);
307
- })
308
- modalTableProps = {
309
- modalTableTitle: '选择SKU',
310
- tableSearchForm,
311
- tableColumns: [
312
- {
313
- title: 'SKU编码',
314
- dataIndex: 'skuCode',
315
- },
316
- {
317
- title: 'SKU名称',
318
- dataIndex: 'name',
319
- },
320
- {
321
- title: '所属SPU',
322
- dataIndex: 'itemName',
323
- },
324
- {
325
- title: '规格',
326
- dataIndex: 'skuSpec',
327
- },
328
- {
329
- title: '类目',
330
- dataIndex: 'categoryName',
331
- },
332
- {
333
- title: '品类',
334
- dataIndex: 'className',
335
- },
336
- {
337
- title: '品牌',
338
- dataIndex: 'brandName',
339
- },
340
- {
341
- title: '条形码',
342
- dataIndex: 'barCode',
343
- },
344
- ]
345
- }
346
- }
347
-
348
- // 仓库选择器
349
- if(type === 'physicalWarehouse') {
350
- requestConfig = {
351
- url: `${prefixUrl.selectPrefix}/physicalWarehouse`,
352
- filter: 'qp-nameAndCode-like', // 过滤参数
353
- mappingTextField: 'physicalWarehouseName',
354
- mappingTextShowKeyField: 'physicalWarehouseCode',
355
- mappingValueField: 'id',
356
- otherParams: {
357
- sorter: 'desc-id'
358
- }, // 默认参数
359
- sourceName: 'warehouseIds',
360
- }
361
- tableSearchForm = [
362
- { name: 'qp-physicalWarehouseName-like', label: '物理仓名称' },
363
- { name: 'qp-physicalWarehouseCode-like', label: '物理仓编码' },
364
- { name: 'qp-physicalWarehouseType-eq', type: 'select', label: '物理仓类型', initialSource: getDictionarySource('SC00002') },
365
- { name: 'qp-companyCode-eq', type: 'select', label: '所属公司', field: {
366
- type: 'select',
367
- props: {
368
- mode: 'multiple',
369
- notFoundContent: '暂无数据',
370
- allowClear: true,
371
- showSearch: true,
372
- showArrow: true,
373
- maxTagCount: 1,
374
- optionFilterProp: 'children',
375
- filterOption: (input: string, option: { props: { children: string } }) =>
376
- option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
377
- },
378
- } },
379
- { name: 'qp-isEnable-eq', type: 'select', label: '物理仓状态', initialSource: getDictionarySource('SC00001') },
380
- ]
381
- Promise.all([
382
- loadSelectSource(`${prefixUrl.formSelectFix}/company`, {
383
- pageSize: 5000,
384
- currentPage: 1,
385
- 'qp-companyType-eq': 20,
386
- }),
387
- ]).then((x: any)=>{
388
- formatSource(x,0, 3, tableSearchForm);
389
- })
390
- modalTableProps = {
391
- modalTableTitle: '选择物理仓',
392
- tableSearchForm,
393
- tableColumns: [
394
- {
395
- title: '物理仓编码',
396
- dataIndex: 'physicalWarehouseCode',
397
- },
398
- {
399
- title: '物理仓名称',
400
- dataIndex: 'physicalWarehouseName',
401
- },
402
- {
403
- title: '物理仓类型',
404
- dataIndex: 'physicalWarehouseType',
405
- render: (text: number) => getDictionaryTextByValue('SC00002', text),
406
- },
407
- {
408
- title: '物理仓状态',
409
- dataIndex: 'isEnable',
410
- render: (text: number) => getDictionaryTextByValue('SC00001', text),
411
- },
412
- {
413
- title: '所属公司',
414
- dataIndex: 'companyName',
415
- },
416
- ]
417
- }
418
- }
419
- if(type === 'realWarehouse') {
420
- requestConfig = {
421
- url: `${prefixUrl.selectPrefix}/realWarehouse`,
422
- filter: 'qp-nameAndCode-like', // 过滤参数
423
- mappingTextField: 'realWarehouseName',
424
- mappingTextShowKeyField: 'realWarehouseCode',
425
- mappingValueField: 'id',
426
- otherParams: {
427
- sorter: 'desc-id'
428
- }, // 默认参数
429
- sourceName: 'warehouseIds',
430
- }
431
- tableSearchForm = [
432
- { name: 'qp-realWarehouseName-like', label: '逻辑仓名称' },
433
- { name: 'qp-realWarehouseCode-like', label: '逻辑仓编码' },
434
- { name: 'qp-realWarehouseType-eq', type: 'select', label: '逻辑仓类型', initialSource: getDictionarySource('SC00004') },
435
- { name: 'qp-isEnable-eq', type: 'select', label: '逻辑仓状态', initialSource: getDictionarySource('SC00001') },
436
- ]
437
- modalTableProps = {
438
- modalTableTitle: '选择逻辑仓',
439
- tableSearchForm,
440
- tableColumns: [
441
- {
442
- title: '逻辑仓编码',
443
- dataIndex: 'realWarehouseCode',
444
- },
445
- {
446
- title: '逻辑仓名称',
447
- dataIndex: 'realWarehouseName',
448
- },
449
- {
450
- title: '逻辑仓类型',
451
- dataIndex: 'realWarehouseType',
452
- render: (text: number) => getDictionaryTextByValue('SC00004', text),
453
- },
454
- {
455
- title: '逻辑仓状态',
456
- dataIndex: 'isEnable',
457
- render: (text: number) => getDictionaryTextByValue('SC00001', text),
458
- },
459
- ]
460
- }
461
- }
462
-
463
- return { modalTableProps, requestConfig };
464
- }
@@ -1,181 +0,0 @@
1
- ---
2
- nav:
3
- title: '组件'
4
- order: 1
5
- group:
6
- title: 业务组件
7
- order: 4
8
- title: 业务档案选择器
9
- order: 0
10
- ---
11
-
12
- ## BusinessSearchSelect
13
-
14
- 供应商选择器 Select-GYS-001:
15
-
16
- ```tsx
17
- import React, { useState } from 'react';
18
- import {BusinessSearchSelect} from '../../../index.ts';
19
-
20
- export default () => {
21
- // selectBusinessType 必传(不传默认为供应商选择器)
22
-
23
- const selectProps = {
24
- // mode: 'multiple',
25
- // maxTagCount: 1,
26
- // disabled: true
27
- }
28
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
29
- const props = {
30
- value,
31
- // labelInValue: true, // 非必填 默认为false
32
- // requestConfig: {
33
- // url: `http://test.i-baby.net/bop/api/supplier`,
34
- // filter: 'qp-name-like', // 过滤参数
35
- // otherParams: {}, // 默认参数
36
- // mappingTextField: 'name',
37
- // mappingValueField: 'code',
38
- // }, // 非必传,业务字段已根据业务默认默认
39
- prefixUrl: { selectPrefix: 'http://test.i-baby.net/bop/api', formSelectFix: 'http://test.i-baby.net/bop/api' }, // 非必传,下拉框和tableForm下拉框接口前缀,默认为bop的接口
40
- selectProps, // 非必传
41
- onChange: (value: any) => {
42
- console.log(value)
43
- setValue(value)
44
- },
45
- selectBusinessType: 'supplier',
46
- };
47
-
48
- return (
49
- <div>
50
- <BusinessSearchSelect {...props} />
51
- </div>
52
- );
53
- };
54
- ```
55
-
56
-
57
- 商品选择器 Select-SKU-001:
58
-
59
- ```tsx
60
- import React, { useState } from 'react';
61
- import {BusinessSearchSelect} from '../../../index.ts';
62
-
63
- export default () => {
64
- const selectProps = {
65
- // mode: 'multiple',
66
- // maxTagCount: 1,
67
- // disabled: true
68
- }
69
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
70
- const props = {
71
- value,
72
- onChange: (value: any) => {
73
- console.log(value)
74
- setValue(value)
75
- },
76
- // requestConfig: {
77
- // url: `http://test.i-baby.net/bop/api/sku`,
78
- // filter: 'qp-nameAndCode-like',
79
- // mappingValueField: 'skuCode',
80
- // otherParams: {
81
- // sorter: 'desc-id'
82
- // }, // 默认参数
83
- // sourceName: 'skuCode',
84
- // },
85
- prefixUrl: { selectPrefix: 'http://test.i-baby.net/bop/api', formSelectFix: 'http://test.i-baby.net/bop/api' },
86
- selectProps,
87
- selectBusinessType: 'skuCommodity',
88
- };
89
-
90
- return (
91
- <div>
92
- <BusinessSearchSelect {...props} />
93
- </div>
94
- );
95
- };
96
- ```
97
-
98
- 仓库选择器(物理仓) Select-Warehouse-001:
99
-
100
- ```tsx
101
- import React, { useState } from 'react';
102
- import {BusinessSearchSelect} from '../../../index.ts';
103
-
104
- export default () => {
105
- const selectProps = {
106
- mode: 'multiple',
107
- maxTagCount: 1,
108
- // disabled: true
109
- }
110
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
111
- const props = {
112
- value,
113
- onChange: (value: any) => {
114
- console.log(value)
115
- setValue(value)
116
- },
117
- // requestConfig: {
118
- // url: `http://test.i-baby.net/bop/api/physicalWarehouse`,
119
- // filter: 'qp-nameAndCode-like',
120
- // mappingTextField: 'physicalWarehouseName',
121
- // mappingValueField: 'physicalWarehouseCode',
122
- // otherParams: {
123
- // sorter: 'desc-id'
124
- // }, // 默认参数
125
- // sourceName: 'warehouseIds',
126
- // },
127
- prefixUrl: { selectPrefix: 'http://test.i-baby.net/bop/api', formSelectFix: 'http://test.i-baby.net/bop/api' },
128
- selectProps,
129
- selectBusinessType: 'physicalWarehouse',
130
- };
131
-
132
- return (
133
- <div>
134
- <BusinessSearchSelect {...props} />
135
- </div>
136
- );
137
- };
138
- ```
139
-
140
- 仓库选择器(逻辑仓) Select-Warehouse-002:
141
-
142
- ```tsx
143
- import React, { useState } from 'react';
144
- import {BusinessSearchSelect} from '../../../index.ts';
145
-
146
- export default () => {
147
- const selectProps = {
148
- mode: 'multiple',
149
- maxTagCount: 1,
150
- // disabled: true
151
- }
152
- const [value, setValue] = useState(selectProps?.mode ? [] : null);
153
- const props = {
154
- value,
155
- onChange: (value: any) => {
156
- console.log(value)
157
- setValue(value)
158
- },
159
- // requestConfig: {
160
- // url: `http://test.i-baby.net/bop/api/realWarehouse`,
161
- // filter: 'qp-nameAndCode-like',
162
- // mappingTextField: 'realWarehouseName',
163
- // mappingValueField: 'realWarehouseCode',
164
- // otherParams: {
165
- // sorter: 'desc-id'
166
- // }, // 默认参数
167
- // sourceName: 'warehouseIds',
168
- // },
169
- prefixUrl: { selectPrefix: 'http://test.i-baby.net/bop/api', formSelectFix: 'http://test.i-baby.net/bop/api' },
170
- selectProps,
171
- selectBusinessType: 'realWarehouse',
172
- };
173
-
174
- return (
175
- <div>
176
- <BusinessSearchSelect {...props} />
177
- </div>
178
- );
179
- };
180
- ```
181
- More skills for writing demo: https://d.umijs.org/guide/demo-principle