@bit-sun/business-component 1.1.26 → 1.1.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.1.26",
3
+ "version": "1.1.29",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -6,7 +6,7 @@ import { getDictionarySource, getDictionaryTextByValue, loadSelectSource } from
6
6
  const hasDictSharingType = getDictionarySource('UC000013')?.length;
7
7
  const sharingTypeDataList = hasDictSharingType && getDictionarySource('UC000013') || sharingType
8
8
 
9
- export function commonFun (type?: string, prefixUrl: any) {
9
+ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: any, modalTableBusProps?:any) {
10
10
  // 默认type === 'supplier' 供应商选择器
11
11
  let requestConfig = {
12
12
  url: `${prefixUrl.selectPrefix}/supplier`,
@@ -14,6 +14,7 @@ export function commonFun (type?: string, prefixUrl: any) {
14
14
  otherParams: {
15
15
  sorter: 'desc-id'
16
16
  }, // 默认参数
17
+ ...requestConfigProp
17
18
  }
18
19
 
19
20
  /*
@@ -155,29 +156,45 @@ export function commonFun (type?: string, prefixUrl: any) {
155
156
  dataIndex: 'sharingType',
156
157
  render: (text: number) => hasDictSharingType ? getDictionaryTextByValue('UC000013', text) : sharingType.find((i: any) => i.value === text)?.text
157
158
  },
158
- ]
159
+ ],
160
+ ...modalTableBusProps,
159
161
  }
160
162
  let needModalTable = true;
161
163
 
162
164
  // 商品选择器
163
165
  if(type === 'skuCommodity') {
164
166
  requestConfig = {
165
- url: `${prefixUrl.selectPrefix}/sku`,
166
- filter: 'qp-name,skuCode-orGroup,like', // 过滤参数
167
+ url: `${prefixUrl.selectPrefix}/sku/pager/v2`,
168
+ filter: 'skuCodeAndSkuName', // 过滤参数
167
169
  mappingTextField: 'name',
168
170
  mappingValueField: 'skuCode',
171
+ mappingTextShowTextField: ['name', 'propertyNameAndValue'],
169
172
  otherParams: {
170
- 'qp-approveStatus-eq':2,
173
+ 'qp-approveStatus-eq': 1,
174
+ 'qp-type-eq': 10, // 查唯一国际条码
171
175
  sorter: 'desc-id'
172
176
  }, // 默认参数
173
177
  sourceName: 'skuCode',
178
+ ...requestConfigProp,
174
179
  }
175
180
  tableSearchForm = [
176
- { name: 'qp-name-like', label: 'SKU名称' },
181
+ { name: 'qp-skuName-like', label: 'SKU名称' },
177
182
  { name: 'qp-skuCode-like', label: 'SKU编码' },
178
- { name: 'qp-barCode-like', label: '条形码' },
183
+ { name: 'qp-code-like', label: '国际条码' },
179
184
  { name: 'qp-itemName-like', label: '所属SPU名称' },
180
185
  { name: 'qp-itemCode-like', label: '所属SPU编码' },
186
+ { name: 'qp-externalCode-like', label: '外部编码' },
187
+ { name: 'qp-propertyValueCode-in', type: 'businessSearchSelect', label: '规格', field: {
188
+ type: 'businessSearchSelect',
189
+ props: {
190
+ selectBusinessType: 'skuPropertyValue',
191
+ selectProps: {
192
+ mode: 'multiple',
193
+ maxTagCount: 1,
194
+ }
195
+ },
196
+ }
197
+ },
181
198
  { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
182
199
  type: 'select',
183
200
  props: {
@@ -239,9 +256,9 @@ export function commonFun (type?: string, prefixUrl: any) {
239
256
  currentPage: 1,
240
257
  }),
241
258
  ]).then((x: any)=>{
242
- formatSource(x,0, 5, tableSearchForm,['id','name']);
243
- formatTreeDataSource(x,1, 6, tableSearchForm);
244
- formatSource(x,2, 7, tableSearchForm,['id','name']);
259
+ formatSource(x,0, 7, tableSearchForm,['id','name']);
260
+ formatTreeDataSource(x,1, 8, tableSearchForm);
261
+ formatSource(x,2, 9, tableSearchForm,['id','name']);
245
262
  })
246
263
  modalTableProps = {
247
264
  modalTableTitle: '选择SKU',
@@ -256,12 +273,24 @@ export function commonFun (type?: string, prefixUrl: any) {
256
273
  dataIndex: 'name',
257
274
  },
258
275
  {
259
- title: '所属SPU',
276
+ title: '国际条码',
277
+ dataIndex: 'barCode',
278
+ },
279
+ {
280
+ title: '所属SPU名称',
260
281
  dataIndex: 'itemName',
261
282
  },
283
+ {
284
+ title: '所属SPU编码',
285
+ dataIndex: 'itemCode',
286
+ },
287
+ {
288
+ title: '外部编码',
289
+ dataIndex: 'externalCode',
290
+ },
262
291
  {
263
292
  title: '规格',
264
- dataIndex: 'skuSpec',
293
+ dataIndex: 'propertyNameAndValue',
265
294
  },
266
295
  {
267
296
  title: '类目',
@@ -275,14 +304,28 @@ export function commonFun (type?: string, prefixUrl: any) {
275
304
  title: '品牌',
276
305
  dataIndex: 'brandName',
277
306
  },
278
- {
279
- title: '条形码',
280
- dataIndex: 'barCode',
281
- },
282
- ]
307
+ ],
308
+ ...modalTableBusProps
283
309
  }
284
310
  }
285
311
 
312
+ // 商品规格选择器(无弹窗)
313
+ if(type === 'skuPropertyValue') {
314
+ requestConfig = {
315
+ url: `${prefixUrl.selectPrefix}/skuPropertyValue/list`,
316
+ filter: 'qp-value-like', // 过滤参数
317
+ mappingTextField: 'value',
318
+ mappingTextShowKeyField: 'propertyValueCode',
319
+ mappingValueField: 'propertyValueCode',
320
+ otherParams: {
321
+ sorter: 'desc-id'
322
+ }, // 默认参数
323
+ sourceName: 'qp-propertyValueCode-in',
324
+ ...requestConfigProp,
325
+ }
326
+ needModalTable = false
327
+ }
328
+
286
329
  // 仓库选择器(物理、逻辑仓)
287
330
  if(type === 'physicalWarehouse') {
288
331
  requestConfig = {
@@ -296,6 +339,7 @@ export function commonFun (type?: string, prefixUrl: any) {
296
339
  sorter: 'desc-id'
297
340
  }, // 默认参数
298
341
  sourceName: 'warehouseIds',
342
+ ...requestConfigProp,
299
343
  }
300
344
  tableSearchForm = [
301
345
  { name: 'qp-physicalWarehouseName-like', label: '物理仓名称' },
@@ -346,7 +390,8 @@ export function commonFun (type?: string, prefixUrl: any) {
346
390
  title: '所属公司',
347
391
  dataIndex: 'companyName',
348
392
  },
349
- ]
393
+ ],
394
+ ...modalTableBusProps
350
395
  }
351
396
  }
352
397
  if(type === 'realWarehouse') {
@@ -361,6 +406,7 @@ export function commonFun (type?: string, prefixUrl: any) {
361
406
  sorter: 'desc-id'
362
407
  }, // 默认参数
363
408
  sourceName: 'warehouseIds',
409
+ ...requestConfigProp,
364
410
  }
365
411
  tableSearchForm = [
366
412
  { name: 'qp-realWarehouseName-like', label: '逻辑仓名称' },
@@ -384,7 +430,8 @@ export function commonFun (type?: string, prefixUrl: any) {
384
430
  dataIndex: 'realWarehouseType',
385
431
  render: (text: number) => getDictionaryTextByValue('SC00004', text),
386
432
  },
387
- ]
433
+ ],
434
+ ...modalTableBusProps,
388
435
  }
389
436
  }
390
437
 
@@ -401,6 +448,7 @@ export function commonFun (type?: string, prefixUrl: any) {
401
448
  sorter: 'desc-id'
402
449
  }, // 默认参数
403
450
  sourceName: 'warehouseIds',
451
+ ...requestConfigProp,
404
452
  }
405
453
  needModalTable = false
406
454
  }
@@ -416,6 +464,7 @@ export function commonFun (type?: string, prefixUrl: any) {
416
464
  sorter: 'desc-id'
417
465
  }, // 默认参数
418
466
  sourceName: 'warehouseIds',
467
+ ...requestConfigProp,
419
468
  }
420
469
  needModalTable = false
421
470
  }
@@ -431,6 +480,7 @@ export function commonFun (type?: string, prefixUrl: any) {
431
480
  sorter: 'desc-id'
432
481
  }, // 默认参数
433
482
  sourceName: 'customCode',
483
+ ...requestConfigProp,
434
484
  }
435
485
  tableSearchForm = [
436
486
  { name: 'qp-name-like', label: '客户名称' },
@@ -528,7 +578,8 @@ export function commonFun (type?: string, prefixUrl: any) {
528
578
  dataIndex: 'sharingType',
529
579
  render: (text: number) => hasDictSharingType ? getDictionaryTextByValue('UC000013', text) : sharingType.find((i: any) => i.value === text)?.text,
530
580
  },
531
- ]
581
+ ],
582
+ ...modalTableBusProps
532
583
  }
533
584
  }
534
585
 
@@ -543,6 +594,7 @@ export function commonFun (type?: string, prefixUrl: any) {
543
594
  sorter: 'desc-id'
544
595
  }, // 默认参数
545
596
  sourceName: 'code',
597
+ ...requestConfigProp,
546
598
  }
547
599
  tableSearchForm = [
548
600
  { name: 'qp-name-like', label: '店铺名称' },
@@ -664,7 +716,8 @@ export function commonFun (type?: string, prefixUrl: any) {
664
716
  title: '归属核算主体',
665
717
  dataIndex: 'accountingName',
666
718
  },
667
- ]
719
+ ],
720
+ ...modalTableBusProps
668
721
  }
669
722
  }
670
723
 
@@ -680,6 +733,7 @@ export function commonFun (type?: string, prefixUrl: any) {
680
733
  sorter: 'desc-id'
681
734
  }, // 默认参数
682
735
  sourceName: 'accountingSubjectCode',
736
+ ...requestConfigProp,
683
737
  }
684
738
  needModalTable = false
685
739
  }
@@ -695,6 +749,7 @@ export function commonFun (type?: string, prefixUrl: any) {
695
749
  sorter: 'desc-id'
696
750
  }, // 默认参数
697
751
  sourceName: 'inventoryOrgCode',
752
+ ...requestConfigProp,
698
753
  }
699
754
  needModalTable = false
700
755
  }
@@ -710,6 +765,7 @@ export function commonFun (type?: string, prefixUrl: any) {
710
765
  sorter: 'desc-id'
711
766
  }, // 默认参数
712
767
  sourceName: 'corporationCompany',
768
+ ...requestConfigProp,
713
769
  }
714
770
  needModalTable = false
715
771
  }
@@ -718,7 +774,7 @@ export function commonFun (type?: string, prefixUrl: any) {
718
774
  if(type === 'employee') {
719
775
  requestConfig = {
720
776
  url: `${prefixUrl.selectPrefix}/employee/v2`,
721
- filter: 'qp-name,employeeNumber-orGroup,like', // 过滤参数
777
+ filter: 'qp-employeeNumber,name-orGroup,like', // 过滤参数
722
778
  mappingTextField: 'name',
723
779
  mappingTextShowKeyField: 'employeeNumber',
724
780
  mappingValueField: 'employeeNumber',
@@ -727,6 +783,7 @@ export function commonFun (type?: string, prefixUrl: any) {
727
783
  sorter: 'desc-id'
728
784
  }, // 默认参数
729
785
  sourceName: 'employeeNumber',
786
+ ...requestConfigProp,
730
787
  }
731
788
  tableSearchForm = [
732
789
  { name: 'qp-name-like', label: '员工名称' },
@@ -781,7 +838,8 @@ export function commonFun (type?: string, prefixUrl: any) {
781
838
  title: '手机号',
782
839
  dataIndex: 'officeTelephone',
783
840
  },
784
- ]
841
+ ],
842
+ ...modalTableBusProps
785
843
  }
786
844
  }
787
845
 
@@ -797,6 +855,7 @@ export function commonFun (type?: string, prefixUrl: any) {
797
855
  sorter: 'desc-id'
798
856
  }, // 默认参数
799
857
  sourceName: 'deliveryModeCode',
858
+ ...requestConfigProp
800
859
  }
801
860
  tableSearchForm = [
802
861
  { name: 'qp-name-like', label: '配送方式名称' },
@@ -880,7 +939,8 @@ export function commonFun (type?: string, prefixUrl: any) {
880
939
  dataIndex: 'remark',
881
940
  title: '备注',
882
941
  },
883
- ]
942
+ ],
943
+ ...modalTableBusProps
884
944
  }
885
945
  }
886
946
 
@@ -110,8 +110,8 @@ export default () => {
110
110
  setValue(value)
111
111
  },
112
112
  // requestConfig: {
113
- // url: `/bop/api/sku`,
114
- // filter: 'qp-name,skuCode-orGroup,like',
113
+ // url: `/bop/api/sku/pager/v2`,
114
+ // filter: 'skuCodeAndSkuName',
115
115
  // mappingValueField: 'skuCode',
116
116
  // otherParams: {
117
117
  // sorter: 'desc-id'
@@ -147,6 +147,107 @@ export default () => {
147
147
  };
148
148
  ```
149
149
 
150
+ [comment]: <> (## 商品规格选择器 Select-SPGG-001)
151
+
152
+ [comment]: <> (```tsx)
153
+
154
+ [comment]: <> (import React, { useState } from 'react';)
155
+
156
+ [comment]: <> (import { Tabs } from 'antd';)
157
+
158
+ [comment]: <> (import {BusinessSearchSelect} from '../../../index.ts';)
159
+
160
+ [comment]: <> (const { TabPane } = Tabs;)
161
+
162
+ [comment]: <> (export default &#40;&#41; => {)
163
+
164
+ [comment]: <> ( const selectProps = {)
165
+
166
+ [comment]: <> ( // mode: 'multiple',)
167
+
168
+ [comment]: <> ( // maxTagCount: 1,)
169
+
170
+ [comment]: <> ( // disabled: true)
171
+
172
+ [comment]: <> ( })
173
+
174
+ [comment]: <> ( const selectPropsMultiple = {)
175
+
176
+ [comment]: <> ( mode: 'multiple',)
177
+
178
+ [comment]: <> ( maxTagCount: 1,)
179
+
180
+ [comment]: <> ( })
181
+
182
+ [comment]: <> ( const [ tabKey, setTabKey ] = useState&#40;'single'&#41;)
183
+
184
+ [comment]: <> ( const [value, setValue] = useState&#40;selectProps?.mode ? [] : null&#41;;)
185
+
186
+ [comment]: <> ( const props = {)
187
+
188
+ [comment]: <> ( value,)
189
+
190
+ [comment]: <> ( onChange: &#40;value: any&#41; => {)
191
+
192
+ [comment]: <> ( console.log&#40;value&#41;)
193
+
194
+ [comment]: <> ( setValue&#40;value&#41;)
195
+
196
+ [comment]: <> ( },)
197
+
198
+ [comment]: <> ( prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },)
199
+
200
+ [comment]: <> ( selectProps,)
201
+
202
+ [comment]: <> ( selectBusinessType: 'skuPropertyValue',)
203
+
204
+ [comment]: <> ( };)
205
+
206
+ [comment]: <> ( const onTabChange = &#40;key&#41; => {)
207
+
208
+ [comment]: <> ( setTabKey&#40;key&#41;)
209
+
210
+ [comment]: <> ( setValue&#40;key === 'single' ? null: []&#41;)
211
+
212
+ [comment]: <> ( })
213
+
214
+ [comment]: <> ( return &#40;)
215
+
216
+ [comment]: <> ( <div>)
217
+
218
+ [comment]: <> ( <Tabs onChange={onTabChange} activeKey={tabKey}>)
219
+
220
+ [comment]: <> ( <TabPane tab='单选' key='single'>)
221
+
222
+ [comment]: <> ( {tabKey === 'single' && &#40;)
223
+
224
+ [comment]: <> ( <BusinessSearchSelect {...props} />)
225
+
226
+ [comment]: <> ( &#41;})
227
+
228
+ [comment]: <> ( </TabPane>)
229
+
230
+ [comment]: <> ( <TabPane tab='多选' key='multiple'>)
231
+
232
+ [comment]: <> ( {tabKey === 'multiple' && &#40;)
233
+
234
+ [comment]: <> ( <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />)
235
+
236
+ [comment]: <> ( &#41;})
237
+
238
+ [comment]: <> ( </TabPane>)
239
+
240
+ [comment]: <> ( </Tabs>)
241
+
242
+ [comment]: <> ( </div>)
243
+
244
+ [comment]: <> ( &#41;;)
245
+
246
+ [comment]: <> (};)
247
+
248
+ [comment]: <> (```)
249
+
250
+
150
251
  ## 仓库选择器(物理仓) Select-Warehouse-001
151
252
 
152
253
  ```tsx
@@ -177,14 +278,11 @@ export default () => {
177
278
  setValue(value)
178
279
  },
179
280
  // requestConfig: {
180
- // url: `/bop/api/physicalWarehouse`,
181
- // filter: 'qp-physicalWarehouseName,physicalWarehouseCode-orGroup,like',
182
- // mappingTextField: 'physicalWarehouseName',
183
281
  // mappingValueField: 'physicalWarehouseCode',
184
- // otherParams: {
185
- // sorter: 'desc-id'
186
- // }, // 默认参数
187
- // sourceName: 'warehouseIds',
282
+ // sourceName: 'physicalWarehouseCode',
283
+ // },
284
+ // modalTableProps: {
285
+ // modalTableTitle: '选择物理仓-更改title测试',
188
286
  // },
189
287
  prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
190
288
  selectProps,
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @Description:
2
+ * @Description:
3
3
  * @Author: rodchen
4
4
  * @Date: 2022-05-07 15:17:28
5
5
  * @LastEditTime: 2022-05-08 21:01:21
@@ -15,15 +15,15 @@ const BusinessSearchSelect = (props: any) => {
15
15
  const businessType = props?.selectBusinessType || 'supplier';
16
16
  const prefixUrl = props?.prefixUrl || { selectPrefix: '/bop/api', formSelectFix: '/bop/api' };
17
17
 
18
- const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl);
18
+ const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl,props?.requestConfig || {}, props?.modalTableProps || {});
19
19
  const currentProps = useMemo(() => {
20
20
  return {
21
- requestConfig,
22
21
  ...props,
22
+ requestConfig,
23
23
  needModalTable,
24
24
  modalTableProps
25
25
  }
26
- }, [])
26
+ }, [props?.value])
27
27
 
28
28
  return (
29
29
  <div>
@@ -32,4 +32,12 @@ const BusinessSearchSelect = (props: any) => {
32
32
  );
33
33
  };
34
34
 
35
- export default React.memo(BusinessSearchSelect, () => true);
35
+ export default React.memo(BusinessSearchSelect, (props, nextProps) => {
36
+ if(props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
37
+ return false
38
+ }
39
+ if(props && props.value !== nextProps.value) {
40
+ return false
41
+ }
42
+ return true
43
+ });