@bit-sun/business-component 2.2.9 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.2.9",
3
+ "version": "2.2.10",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -5,12 +5,11 @@ nav:
5
5
  group:
6
6
  title: 业务组件
7
7
  order: 1
8
- title: 业务档录入器
8
+ title: 商品档案录入器
9
9
  order: 1
10
10
  ---
11
11
 
12
- # BusinessSearchSelect
13
-
12
+ # AddSkuSelect
14
13
 
15
14
  ## 商品选择录入器
16
15
 
@@ -61,3 +60,34 @@ export default () => {
61
60
  );
62
61
  };
63
62
  ```
63
+
64
+ # AddSkcSelect
65
+
66
+ ## SKC选择录入器
67
+
68
+ ```tsx
69
+ import React, { useState } from 'react';
70
+ import { Tabs } from 'antd';
71
+ import { AddSkcSelect } from '../../../index.ts';
72
+
73
+ export default () => {
74
+ const config = {
75
+ buttonText: 'context',
76
+ buttonProps: { disabled: false },
77
+ beforeShowModal: () => {
78
+ return Promise.resolve(true);
79
+ // return Promise.reject('校验有误');
80
+ },
81
+ onSaveCallback: (rows) => {
82
+ console.log('save call', rows);
83
+ return Promise.resolve(true);
84
+ // return Promise.reject('FAILE')
85
+ }
86
+ }
87
+ return (
88
+ <div>
89
+ <AddSkcSelect {...config} />
90
+ </div>
91
+ );
92
+ };
93
+ ```
@@ -5,8 +5,9 @@
5
5
  * @LastEditTime: 2022-05-08 21:01:21
6
6
  * @LastEditors: rodchen
7
7
  */
8
- import React, { useState } from 'react';
9
- import { Tooltip, Select } from 'antd';
8
+ import React, { useState, useEffect } from 'react';
9
+ import { Tooltip, Select, message } from 'antd';
10
+ import axios from 'axios';
10
11
  import { AddSelect } from '../../../index';
11
12
  import { tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
12
13
  import { getSkuImg } from '@/utils/TableUtils';
@@ -146,7 +147,8 @@ export const AddSkuSelect = (parProps: any) => {
146
147
  setValue(value)
147
148
  },
148
149
  beforeShowModal: parProps?.beforeShowModal,
149
- onSaveCallback: parProps.onSaveCallback
150
+ onSaveCallback: parProps.onSaveCallback,
151
+ businessType: 'sku'
150
152
  // onSaveCallback: (rows) => {
151
153
  // console.log('save call', rows);
152
154
  // // return Promise.resolve(true);
@@ -342,3 +344,258 @@ export const AddSkuSelect = (parProps: any) => {
342
344
  </div>
343
345
  );
344
346
  };
347
+
348
+ export const AddSkcSelect = (parProps: any) => {
349
+ const selectProps = {
350
+ mode: 'multiple',
351
+ }
352
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
353
+ const [propertyList, setPropertyList] = useState([]);
354
+
355
+ useEffect(() => {
356
+ axios.get(`/items/itemPropertyValueGroup/listNoPage`).then((result: any) => {
357
+ result = result.data;
358
+ if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
359
+ message.error(result.msg);
360
+ return;
361
+ }
362
+ const data = result.data || [];
363
+ setPropertyList(data)
364
+ }).catch((err) => {});
365
+ },[])
366
+
367
+ const initialSelectColumn = [
368
+ {
369
+ title: 'SKC编码',
370
+ width: 150,
371
+ dataIndex: 'code',
372
+ },
373
+ {
374
+ title: 'SKC名称',
375
+ width: 200,
376
+ ellipsis: {
377
+ showTitle: false,
378
+ },
379
+ render: (text: any) => (
380
+ <Tooltip placement="topLeft" title={text}>
381
+ {text}
382
+ </Tooltip>
383
+ ),
384
+ dataIndex: 'name',
385
+ },
386
+ {
387
+ title: '颜色',
388
+ width: 200,
389
+ ellipsis: {
390
+ showTitle: false,
391
+ },
392
+ render: (text: any) => (
393
+ <Tooltip placement="topLeft" title={text}>
394
+ {text}
395
+ </Tooltip>
396
+ ),
397
+ dataIndex: 'colorName',
398
+ },
399
+ {
400
+ title: '配码',
401
+ dataIndex: 'selectPropertyGroupCode',
402
+ width: 160,
403
+ isSelectItem: true,
404
+ dataSource: propertyList,
405
+ },
406
+ {
407
+ title: '数量',
408
+ width: 100,
409
+ isInputItem: true,
410
+ dataIndex: 'count',
411
+ },
412
+ ]
413
+ const mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps)
414
+ const props = {
415
+ buttonText: parProps.buttonText || '新增',
416
+ buttonProps: parProps.buttonProps || {},
417
+ tableCodeList: parProps.tableCodeList || ['skcSelect-tableOptionsToChoosePartCode','skcSelect-tableSelectedItemPartCode'],
418
+ value,
419
+ // labelInValue: true, // 非必填 默认为false
420
+ requestConfig: {
421
+ url: `/items/skc/skcSelect`,
422
+ filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
423
+ otherParams: {}, // 默认参数
424
+ mappingTextField: 'name',
425
+ mappingValueField: 'code',
426
+ ...parProps.requestConfig
427
+ },
428
+ selectProps,
429
+ onChange: (value: any) => {
430
+ console.log(value)
431
+ setValue(value)
432
+ },
433
+ beforeShowModal: parProps?.beforeShowModal,
434
+ onSaveCallback: parProps.onSaveCallback,
435
+ businessType: 'skc',
436
+ isAllowRepeatedSelect: true
437
+ };
438
+ const modalTableProps = {
439
+ modalTableTitle: '选择商品',
440
+ tableSearchForm: [
441
+ { name: 'qp-code-like', label: 'SKC编码' },
442
+ { name: 'qp-skcName-like', label: 'SKC名称' },
443
+ { name: 'qp-itemName-like', label: '商品名称' },
444
+ { name: 'qp-colorName-in', type: 'select', label: '颜色', field: {
445
+ type: 'select',
446
+ props: {
447
+ mode: 'multiple',
448
+ notFoundContent: '暂无数据',
449
+ allowClear: true,
450
+ showSearch: true,
451
+ showArrow: true,
452
+ maxTagCount: 1,
453
+ optionFilterProp: 'children',
454
+ filterOption: (input: string, option: { props: { children: string } }) =>
455
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
456
+ },
457
+ } },
458
+ { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
459
+ type: 'treeSelect',
460
+ props: {
461
+ treeData: [],
462
+ treeCheckable: true,
463
+ showSearch: true,
464
+ allowClear: true,
465
+ showArrow: true,
466
+ treeNodeFilterProp: 'title',
467
+ treeDefaultExpandAll: true,
468
+ maxTagCount: 1,
469
+ placeholder: '请选择',
470
+ style: {
471
+ width: '100%',
472
+ },
473
+ dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
474
+ },
475
+ } },
476
+ { name: 'qp-classId-in', type: 'select', label: '品类', field: {
477
+ type: 'select',
478
+ props: {
479
+ mode: 'multiple',
480
+ notFoundContent: '暂无数据',
481
+ allowClear: true,
482
+ showSearch: true,
483
+ showArrow: true,
484
+ maxTagCount: 1,
485
+ optionFilterProp: 'children',
486
+ filterOption: (input: string, option: { props: { children: string } }) =>
487
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
488
+ },
489
+ } },
490
+ { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
491
+ type: 'select',
492
+ props: {
493
+ mode: 'multiple',
494
+ notFoundContent: '暂无数据',
495
+ allowClear: true,
496
+ showSearch: true,
497
+ showArrow: true,
498
+ maxTagCount: 1,
499
+ optionFilterProp: 'children',
500
+ filterOption: (input: string, option: { props: { children: string } }) =>
501
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
502
+ },
503
+ } },
504
+ ],
505
+ tableColumns: [
506
+ {
507
+ title: 'SKC编码',
508
+ width: 150,
509
+ dataIndex: 'code',
510
+ },
511
+ {
512
+ title: 'SKC名称',
513
+ width: 200,
514
+ ellipsis: {
515
+ showTitle: false,
516
+ },
517
+ render: (text: any) => (
518
+ <Tooltip placement="topLeft" title={text}>
519
+ {text}
520
+ </Tooltip>
521
+ ),
522
+ dataIndex: 'name',
523
+ },
524
+ {
525
+ title: '商品名称',
526
+ width: 100,
527
+ ellipsis: {
528
+ showTitle: false,
529
+ },
530
+ dataIndex: 'itemName',
531
+ render: (text: any) => (
532
+ <Tooltip placement="topLeft" title={text}>
533
+ {text}
534
+ </Tooltip>
535
+ ),
536
+ },
537
+ {
538
+ title: '颜色',
539
+ width: 100,
540
+ ellipsis: {
541
+ showTitle: false,
542
+ },
543
+ render: (text: any) => (
544
+ <Tooltip placement="topLeft" title={text}>
545
+ {text}
546
+ </Tooltip>
547
+ ),
548
+ dataIndex: 'colorName',
549
+ },
550
+ {
551
+ title: '类目',
552
+ width: 100,
553
+ ellipsis: {
554
+ showTitle: false,
555
+ },
556
+ render: (text: any) => (
557
+ <Tooltip placement="topLeft" title={text}>
558
+ {text}
559
+ </Tooltip>
560
+ ),
561
+ dataIndex: 'categoryName',
562
+ },
563
+ {
564
+ title: '品类',
565
+ width: 100,
566
+ ellipsis: {
567
+ showTitle: false,
568
+ },
569
+ render: (text: any) => (
570
+ <Tooltip placement="topLeft" title={text}>
571
+ {text}
572
+ </Tooltip>
573
+ ),
574
+ dataIndex: 'className',
575
+ },
576
+ {
577
+ title: '品牌',
578
+ width: 100,
579
+ ellipsis: {
580
+ showTitle: false,
581
+ },
582
+ render: (text: any) => (
583
+ <Tooltip placement="topLeft" title={text}>
584
+ {text}
585
+ </Tooltip>
586
+ ),
587
+ dataIndex: 'brandName',
588
+ },
589
+ ],
590
+ selectColumn: mTpSelectColumn,
591
+ }
592
+
593
+ return (
594
+ <div>
595
+ <AddSelect
596
+ {...props}
597
+ modalTableProps={modalTableProps}
598
+ />
599
+ </div>
600
+ );
601
+ };
@@ -5,7 +5,7 @@ nav:
5
5
  group:
6
6
  title: 业务组件
7
7
  order: 1
8
- title: 商品录入器
8
+ title: 商品导入录入器
9
9
  order: 0
10
10
  ---
11
11
 
@@ -609,6 +609,143 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
609
609
  }
610
610
  }
611
611
 
612
+ // 商品选择器skc
613
+ if(type === 'skcCommodity') {
614
+ requestConfig = {
615
+ url: `${prefixUrl.selectPrefix}/skc/skcSelect`,
616
+ filter: 'qp-code,name-orGroup,like', // 过滤参数
617
+ mappingTextField: 'name',
618
+ mappingValueField: 'code',
619
+ sourceName: 'qp-skcCode-eq',
620
+ ...requestConfigProp,
621
+ }
622
+ tableSearchForm = [
623
+ { name: 'qp-code-like', label: 'SKC编码' },
624
+ { name: 'qp-skcName-like', label: 'SKC名称' },
625
+ { name: 'qp-itemName-like', label: '商品名称' },
626
+ { name: 'qp-colorName-in', type: 'select', label: '颜色', field: {
627
+ type: 'select',
628
+ props: {
629
+ mode: 'multiple',
630
+ notFoundContent: '暂无数据',
631
+ allowClear: true,
632
+ showSearch: true,
633
+ showArrow: true,
634
+ maxTagCount: 1,
635
+ optionFilterProp: 'children',
636
+ filterOption: (input: string, option: { props: { children: string } }) =>
637
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
638
+ },
639
+ } },
640
+ { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
641
+ type: 'treeSelect',
642
+ props: {
643
+ treeData: [],
644
+ treeCheckable: true,
645
+ showSearch: true,
646
+ allowClear: true,
647
+ showArrow: true,
648
+ treeNodeFilterProp: 'title',
649
+ treeDefaultExpandAll: true,
650
+ maxTagCount: 1,
651
+ placeholder: '请选择',
652
+ style: {
653
+ width: '100%',
654
+ },
655
+ dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
656
+ },
657
+ } },
658
+ { name: 'qp-classId-in', type: 'select', label: '品类', field: {
659
+ type: 'select',
660
+ props: {
661
+ mode: 'multiple',
662
+ notFoundContent: '暂无数据',
663
+ allowClear: true,
664
+ showSearch: true,
665
+ showArrow: true,
666
+ maxTagCount: 1,
667
+ optionFilterProp: 'children',
668
+ filterOption: (input: string, option: { props: { children: string } }) =>
669
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
670
+ },
671
+ } },
672
+ { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
673
+ type: 'select',
674
+ props: {
675
+ mode: 'multiple',
676
+ notFoundContent: '暂无数据',
677
+ allowClear: true,
678
+ showSearch: true,
679
+ showArrow: true,
680
+ maxTagCount: 1,
681
+ optionFilterProp: 'children',
682
+ filterOption: (input: string, option: { props: { children: string } }) =>
683
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
684
+ },
685
+ } },
686
+ ]
687
+ Promise.all([
688
+ loadSelectSource(`${prefixUrl.formSelectFix}/item/propertyValue`, {
689
+ pageSize: 5000,
690
+ currentPage: 1,
691
+ 'qp-propertyId-eq': '1467042217951883265'
692
+ }),
693
+ loadSelectSource(`${prefixUrl.formSelectFix}/category/queryCategoryTree`, {
694
+ pageSize: 5000,
695
+ currentPage: 1,
696
+ }),
697
+ loadSelectSource(`${prefixUrl.formSelectFix}/class/withProperty`, {
698
+ pageSize: 5000,
699
+ currentPage: 1,
700
+ }),
701
+ loadSelectSource(`${prefixUrl.formSelectFix}/brand/queryBrandList`, {
702
+ pageSize: 5000,
703
+ currentPage: 1,
704
+ 'ctl-withAuth': true
705
+ }),
706
+ ]).then((x: any)=>{
707
+ formatSource(x,0, 3, tableSearchForm,['value','value']);
708
+ formatTreeDataSource(x,1, 4, tableSearchForm);
709
+ formatSource(x,2, 5, tableSearchForm,['id','name']);
710
+ formatSource(x,3, 6, tableSearchForm,['id','name']);
711
+ })
712
+ modalTableProps = {
713
+ modalTableTitle: '选择SKC',
714
+ tableSearchForm,
715
+ tableColumns: [
716
+ {
717
+ title: 'SKC编码',
718
+ dataIndex: 'code',
719
+ },
720
+ {
721
+ title: 'SKC名称',
722
+ dataIndex: 'name',
723
+ },
724
+ {
725
+ title: '商品名称',
726
+ dataIndex: 'itemName',
727
+ },
728
+ {
729
+ title: '颜色',
730
+ dataIndex: 'colorName',
731
+ },
732
+ {
733
+ title: '类目',
734
+ dataIndex: 'categoryText',
735
+ },
736
+ {
737
+ title: '品类',
738
+ dataIndex: 'className',
739
+ },
740
+ {
741
+ title: '品牌',
742
+ dataIndex: 'brandName',
743
+ },
744
+ ],
745
+ ...modalTableBusProps
746
+ }
747
+ }
748
+
612
749
  // 商品规格选择器(无弹窗)
613
750
  if(type === 'skuPropertyValue') {
614
751
  requestConfig = {
@@ -321,6 +321,62 @@ export default () => {
321
321
  };
322
322
  ```
323
323
 
324
+ ## 商品SKC选择器 Select-SKC-001
325
+
326
+ ```tsx
327
+ import React, { useState } from 'react';
328
+ import { Tabs } from 'antd';
329
+ import {BusinessSearchSelect} from '../../../index.ts';
330
+
331
+ const { TabPane } = Tabs;
332
+ export default () => {
333
+ const selectProps = {
334
+ // mode: 'multiple',
335
+ // maxTagCount: 1,
336
+ // disabled: true
337
+ }
338
+ const selectPropsMultiple = {
339
+ mode: 'multiple',
340
+ maxTagCount: 6,
341
+ }
342
+
343
+ const [ tabKey, setTabKey ] = useState('single')
344
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
345
+
346
+ const props = {
347
+ value,
348
+ onChange: (value: any) => {
349
+ console.log(value)
350
+ setValue(value)
351
+ },
352
+ // prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },
353
+ selectProps,
354
+ selectBusinessType: 'skcCommodity',
355
+ };
356
+
357
+ const onTabChange = (key) => {
358
+ setTabKey(key)
359
+ setValue(key === 'single' ? null: [])
360
+ }
361
+
362
+ return (
363
+ <div>
364
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
365
+ <TabPane tab='单选' key='single'>
366
+ {tabKey === 'single' && (
367
+ <BusinessSearchSelect {...props} />
368
+ )}
369
+ </TabPane>
370
+ <TabPane tab='多选' key='multiple'>
371
+ {tabKey === 'multiple' && (
372
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
373
+ )}
374
+ </TabPane>
375
+ </Tabs>
376
+ </div>
377
+ );
378
+ };
379
+ ```
324
380
 
325
381
  ## 仓库选择器(物理仓) Select-Warehouse-001
326
382
 
@@ -78,7 +78,7 @@ const handleDefaultPrefixUrl = (type: string) => {
78
78
  case 'supplier2': case 'customer2': case 'shopFile2':
79
79
  result = '/channel-manage';
80
80
  break;
81
- case 'skuCommodity': case 'skuPropertyValue': case 'spuCommodity':
81
+ case 'skuCommodity': case 'skuPropertyValue': case 'spuCommodity': case 'skcCommodity':
82
82
  result = '/items';
83
83
  break;
84
84
  case 'physicalWarehouse': case 'realWarehouse': case 'virtualWarehouse': case 'channelWarehouse': case 'ownerWarehouse':