lu-lowcode-package-form 0.11.41 → 0.11.43

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/src/App.jsx CHANGED
@@ -368,7 +368,7 @@ function App() {
368
368
 
369
369
  ]} label="子表填充数据源" __id="fill_datasource1" />
370
370
  <Layout.FormRow layout={'1'}>
371
- <Field.Table label="测试主子表填充" __id="table_fill" isAllowAdd={true} isAllowCopy={false} >
371
+ <Field.Table label="测试主子表填充" __id="table_fill" isAllowAdd={true} isAllowCopy={true} >
372
372
 
373
373
  <Field.WithSingleSelect
374
374
  ref={testRef}
@@ -400,6 +400,7 @@ function App() {
400
400
  <Field.WithSingleSelect
401
401
  ref={testRef}
402
402
  request={async (params) => {
403
+ console.log("测试填充2 reqeust",params)
403
404
  if (!params?.value) return { code: 0, data: { list: [{ label: '选项1', value: '1', }] } }
404
405
  await new Promise(resolve => setTimeout(resolve, 200))
405
406
  return { code: 0, data: { list: [{ label: '选项1', value: '1', }, { label: '选项2', value: '2', fill_tcinput1: "8989", fill_tcinput2: "2222" }, { label: '选项3', value: '3' }] } }
@@ -459,476 +460,7 @@ function App() {
459
460
 
460
461
  </Field.Table>
461
462
  </Layout.FormRow>
462
- <Field.MultipleSelect mode="multiple" option_label={"label"} option_value={"value"} label="测试过滤条件" __id="selecta1" request={async (params) => {
463
- return { code: 0, data: { list: [{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }] } }
464
- }}></Field.MultipleSelect>
465
- <Layout.FormRow layout={'1'}>
466
-
467
- <Show.WithTable label="测试关联子表" __id="withtable1"
468
- filterRules={[
469
- {
470
- "value": {
471
- "parent": "",
472
- "field_key": "aa2",
473
- "group_key": "fieldsValue",
474
- "field_name": "当前表单.测试"
475
- },
476
- "valueType": "variable",
477
- "column": {
478
- "label": "库存表.所在仓库",
479
- "value": "node_ocm009lpxt2",
480
- "column_name": "node_ocm009lpxt2",
481
- "column_type": ""
482
- }
483
- }
484
- ]} />
485
- </Layout.FormRow>
486
- <Field.Number label="测试" __id="aa2" isRequired={true} />
487
- <Field.Number label="测试" __id="aa3" value={123} readonly={readonly} />
488
- <Field.Number label="测试" __id="aa1" calcHidden={true} readonly={readonly} />
489
- <Field.Number label="测试" __id="aa4" readonly={readonly} />
490
- <Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} readonly={readonly} />
491
- <Layout.FormGroupTitle title={"基本信息"} />
492
- <Field.WithSingleSelect
493
- rightIconRender={({ form, fieldName }) => {
494
- // console.log("rightIconRender form", form,)
495
- // console.log("rightIconRender fieldName", fieldName)
496
- return <><PrinterOutlined /></>
497
- }}
498
- ref={testRef} fillRules={[
499
- {
500
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
501
- "type": 0,
502
- "source": "shuilv",
503
- "target": "shuilv",
504
- "subRules": [
505
- ]
506
- },
507
-
508
- ]} label="发票类型" options={[{ label: '选项1', value: '1', shuilv: 15, }, { label: '选项2', value: '2', shuilv: 50 }, { label: '选项3', value: '3', shuilv: 2 }]} __id="fapiaoleixing" />
509
-
510
- <Field.Number label="税率(%)" __id="shuilv" />
511
-
512
- <Field.WithSingleSelect ref={testRef} fillRules={[
513
- {
514
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
515
- "type": 0,
516
- "source": "name",
517
- "target": "name",
518
- "subRules": [
519
-
520
- ]
521
- },
522
- {
523
- "id": "93401e38-60a4-4acf-84a6-8958785a4a30",
524
- "type": 1,
525
- "source": "table",
526
- "target": "table",
527
- "subRules": [
528
- {
529
- "id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
530
- "type": 0,
531
- "source": "price",
532
- "target": "product_price1"
533
- },
534
-
535
- {
536
- "id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
537
- "type": 0,
538
- "source": "num",
539
- "target": "product_num1"
540
- },
541
- ]
542
- }
543
- ]} label="测试关联单选" options={[{ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]" }, { label: '选项2', value: '2' }]} __id="remark11" />
544
- <Layout.FormRow layout={'1'}>
545
- <Field.Number label="测试规则" __id="ceshi_rule1" />
546
- </Layout.FormRow>
547
- <Layout.FormRow layout={'1'}>
548
- <Field.Table label="子表格" __id="table2" isAllowCopy={true} >
549
- <Field.Number label="测试规则2" __id="ceshi_rule2" />
550
- </Field.Table>
551
- </Layout.FormRow>
552
-
553
- <Field.WithSingleSelect
554
- ref={testRef}
555
- request={async (params) => {
556
- console.log("request params", params);
557
- const { page = 1, pageSize = 10 } = params; // 获取当前页码,默认为1
558
-
559
-
560
- // 模拟数据集
561
- const allData = [
562
- { label: '选项1', value: '1' },
563
- { label: '选项2', value: '2' },
564
- { label: '选项3', value: '3' },
565
- { label: '选项4', value: '4' },
566
- { label: '选项5', value: '5' },
567
- { label: '选项6', value: '6' },
568
- { label: '选项7', value: '7' },
569
- { label: '选项8', value: '8' },
570
- { label: '选项9', value: '9' },
571
- { label: '选项10', value: '10' },
572
- { label: '选项11', value: '11' },
573
- { label: '选项12', value: '12' },
574
- { label: '选项13', value: '13' },
575
- { label: '选项14', value: '14' },
576
- { label: '选项15', value: '15' },
577
- { label: '选项16', value: '16' },
578
- { label: '选项17', value: '17' },
579
- { label: '选项18', value: '18' },
580
- { label: '选项19', value: '19' },
581
- { label: '选项20', value: '20' },
582
- { label: '选项21', value: '21' },
583
- { label: '选项22', value: '22' },
584
- { label: '选项23', value: '23' },
585
- { label: '选项24', value: '24' }
586
- ];
587
-
588
- // 根据页码和每页数据量计算当前页的数据
589
- const startIndex = (page - 1) * pageSize;
590
- const endIndex = startIndex + pageSize;
591
- let pageData = []
592
- if (startIndex < allData.length) {
593
- pageData = allData.slice(startIndex, endIndex);
594
- }
595
-
596
- let result = { code: 0, data: { list: pageData } };
597
- console.log("request result", result)
598
- await new Promise(resolve => setTimeout(resolve, 200))
599
- return result
600
- }}
601
- option_label="label"
602
- option_value="value"
603
- label="测试请求" __id="ceshirequest" />
604
-
605
- <Layout.FormRow layout={'1'}>
606
- <Field.Table label="子表格" __id="table" isAllowAdd={true} isAllowCopy={false} >
607
-
608
- <Field.Number label="税率(%)" __id="shuilv_table" withIds={[
609
- "shuilv"
610
- ]}
611
- withFill={{
612
- "value": [
613
- {
614
- "insert": {
615
- "span": true
616
- },
617
- "attributes": {
618
- "id": "shuilv",
619
- "color": "blue",
620
- "tagKey": "fieldsValue",
621
- "content": "当前表单.税率(%)"
622
- }
623
- },
624
-
625
- ],
626
- "version": 1723016911807,
627
- "withData": [
628
-
629
- ]
630
- }} />
631
- <Field.DatePicker defaultNow={true} label="日期时间" prompt="" datetype="date" __id="datetime2" />
632
-
633
- <Field.WithSingleSelect ref={testRef}
634
- request={async (params, ruleParams, fieldName) => {
635
- console.log("request params", params, ruleParams, fieldName)
636
- if (params?.ruleParams?.node_ocm009lpxt2 == 111)
637
- return { code: 0, data: { list: [{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' }, { label: '选项3', value: '3' }] } }
638
- else return { code: 0, data: { list: [{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' },] } }
639
- }}
640
- option_label="label"
641
- option_value="value"
642
- filterRules={[
643
- {
644
- "value": {
645
- "parent": "",
646
- "field_key": "shuilv",
647
- "group_key": "fieldsValue",
648
- "field_name": "当前表单.税率"
649
- },
650
- "valueType": "variable",
651
- "column": {
652
- "label": "库存表.所在仓库",
653
- "value": "node_ocm009lpxt2",
654
- "column_name": "node_ocm009lpxt2",
655
- "column_type": ""
656
- }
657
- }
658
- ]}
659
-
660
- fillRules={[
661
- {
662
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
663
- "type": 0,
664
- "source": "product_price11",
665
- "target": "product_price11",
666
- "subRules": [
667
-
668
- ]
669
- },
670
- {
671
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
672
- "type": 0,
673
- "source": "product_price1",
674
- "target": "product_price1",
675
- "subRules": [
676
-
677
- ]
678
- },
679
-
680
- ]} label="测试关联单选" __id="remark11" />
681
-
682
- <Field.Switch label="开关" __id="switch_table"></Field.Switch>
683
- <Field.Input defaultValue={3} label="含税单价" __id="product_price11" />
684
- <Field.Input label="未税单价" __id="product_price12"
685
- withIds={[
686
- "table.product_price11",
687
- "shuilv"
688
- ]}
689
- withFill={{
690
- "value": [
691
- {
692
- "insert": "("
693
- },
694
- {
695
- "insert": {
696
- "span": true
697
- },
698
- "attributes": {
699
- "id": "table.product_price11",
700
- "color": "blue",
701
- "tagKey": "fieldsValue",
702
- "content": "当前表单.产品列表.含税单价"
703
- }
704
- },
705
- {
706
- "insert": "/(1+"
707
- },
708
- {
709
- "insert": {
710
- "span": true
711
- },
712
- "attributes": {
713
- "id": "shuilv",
714
- "color": "blue",
715
- "tagKey": "fieldsValue",
716
- "content": "当前表单.税率(%)"
717
- }
718
- },
719
- {
720
- "insert": "/ 100)).toFixed(2)\n\n\n"
721
- }
722
- ],
723
- "version": 1723016911807,
724
- "withData": [
725
-
726
- ]
727
- }}
728
- />
729
- <Field.Input defaultValue={1} label="商品价格" __id="product_price13" />
730
- <Field.Input defaultValue={2} label="商品价格" __id="product_price14" />
731
- <Field.Input label="商品价格" __id="product_price1" />
732
- <Field.Input label="商品个数" __id="product_num1" />
733
- <Field.Input disabled={true} label="商品总价" __id="product_sum1"
734
- withIds={["table.product_price1", "table.product_num1"]}
735
- withFill={{
736
- "value": [
737
- {
738
- "insert": {
739
- "span": true
740
- },
741
- "attributes": {
742
- "id": "table.product_price1",
743
- "color": "blue",
744
- "tagKey": "fieldsValue",
745
- "content": "当前表单.商品价格"
746
- }
747
- },
748
- {
749
- "insert": "*"
750
- },
751
- {
752
- "insert": {
753
- "span": true
754
- },
755
- "attributes": {
756
- "id": "table.product_num1",
757
- "color": "blue",
758
- "tagKey": "fieldsValue",
759
- "content": "当前表单.商品个数"
760
- }
761
- },
762
- {
763
- "insert": "\n\n"
764
- }
765
- ],
766
- "version": 1719296886283,
767
- "withData": [
768
-
769
- ]
770
- }} />
771
- <Field.Input label="分组名" __id="node_oclxmzswzti" />
772
- <Field.MultipleSelect mode="multiple" label="测多选" __id="select2" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.MultipleSelect>
773
-
774
- </Field.Table>
775
- </Layout.FormRow>
776
- <Field.Input label="总价" disabled={true} __id="product_total_price" withIds={[
777
- "table.product_sum1"
778
- ]}
779
- withFill={{
780
- "value": [
781
- {
782
- "insert": {
783
- "span": true
784
- },
785
- "attributes": {
786
- "id": "table.product_sum1",
787
- "color": "blue",
788
- "tagKey": "fieldsValue",
789
- "content": "当前表单.标签.小计"
790
- }
791
- },
792
- {
793
- "insert": ".reduce((acc, curr) => parseFloat(acc||0) + parseFloat(curr||0), 0).toFixed(2)"
794
- },
795
- {
796
- "insert": "\n"
797
- }
798
- ],
799
- "version": 1719383786677,
800
- "withData": [
801
-
802
- ]
803
- }}
804
- />
805
- <Field.UserSelect label="选择用户" __id="userselect" customComponent={Input} />
806
- <Field.DeptSelect label="DeptSelect" __id="DeptSelect" treeData={[{
807
- value: 'parent 1-1',
808
- title: 'parent 1-1',
809
- children: [
810
- {
811
- value: 'leaf11',
812
- title: <b style={{ color: '#08c' }}>leaf11</b>,
813
- },
814
- ],
815
- },]}></Field.DeptSelect>
816
- <Field.PostSelect multiple={true} label="PostSelect" __id="PostSelect" treeData={[{
817
- value: 'parent 1-1',
818
- title: 'parent 1-1',
819
- children: [
820
- {
821
- value: 'leaf11',
822
- title: <b style={{ color: '#08c' }}>leaf11</b>,
823
- },
824
- ],
825
- },]}></Field.PostSelect>
826
- <Field.SearchSelect mode='multiple' label="搜组件" __id="searchuser" request={searchSelectRequest} option_search={"name"} option_label="name" option_value="id"></Field.SearchSelect>
827
- <Field.Input label="商品价格" __id="product_price" defaultValue={"12"} readonly={true} />
828
- <Field.Input label="商品数量" __id="product_num" rules={"^(1[3-9]\\d{9})$"} />
829
- <Field.NumberRange label="数量范围" __id="product_num_range" />
830
- <Field.Input rules={["^(1[3-9]\\d{9})$", "^\\d+$"]} label="商品总价" __id="product_sum"
831
- withIds={["product_price", "product_num"]}
832
- withFill={{
833
- "value": [
834
- {
835
- "insert": {
836
- "span": true
837
- },
838
- "attributes": {
839
- "id": "product_price",
840
- "color": "blue",
841
- "tagKey": "fieldsValue",
842
- "content": "当前表单.商品价格"
843
- }
844
- },
845
- {
846
- "insert": "* "
847
- },
848
- {
849
- "insert": {
850
- "span": true
851
- },
852
- "attributes": {
853
- "id": "product_num",
854
- "color": "blue",
855
- "tagKey": "fieldsValue",
856
- "content": "当前表单.商品个数"
857
- }
858
- },
859
- {
860
- "insert": "\n\n"
861
- }
862
- ],
863
- "version": 1719296886283,
864
- "withData": [
865
-
866
- ]
867
- }} />
868
-
869
- <Field.SingleSelect mode="single" option_value={"id"} label="测试单选" __id="select1" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.SingleSelect>
870
- <Field.MultipleSelect mode="multiple" label="测多选" __id="select2" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.MultipleSelect>
871
- <Field.MultipleSelect mode="multiple" option_label={"label"} option_value={"value"} label="测多选2" __id="select2222" request={async (params) => {
872
- return { code: 0, data: { list: [{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }] } }
873
- }}></Field.MultipleSelect>
874
- <Field.TreeSelect label="分组名" __id="title11"></Field.TreeSelect>
875
- <Field.Switch label="开关" __id="switch"></Field.Switch>
876
- <Layout.FormGroupTitle title={"嘟嘟嘟嘟嘟"} />
877
- <Field.CodeMachine label="角色编号" prompt="" __id="code"
878
- withIds={["switch"]}
879
- withVisibleFunc={(fieldsValue) => {
880
- return fieldsValue?.switch ? true : false
881
- }}
882
- />
883
-
884
- <div className=' fh-10 fw-full fbg-green-300' __id="div1111"
885
- _componentName="Field.div"
886
- withIds={["switch"]}
887
- withVisibleFunc={(fieldsValue) => {
888
- return fieldsValue?.switch ? true : false
889
- }}>1111</div>
890
- <Field.DatePicker defaultNow={true} label="datetime" prompt="" datetype="month" value='2022-10-22' __id="datetime" />
891
- <Field.DatePicker label="datetime2" prompt="" datetype="date" __id="datetime2" />
892
- <Field.DatePicker readonly={true} defaultNow={true} label="datetime3" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
893
- <Field.DatePicker defaultNow={true} label="datetime4" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
894
- <Field.Input label="角色名称" __id="name" />
895
- <Layout.FormRow layout={'1,1'}>
896
- <Field.Input label="角色名称布局" __id="name1" />
897
- <Field.Input label="角色名称布局2" __id="name2" />
898
- </Layout.FormRow>
899
- <Field.CheckboxTree label="角色权限" __id="permissions" addRoot={false} treeData={treeData} />
900
- <Layout.FormGroupTitle title={"关联信息"} />
901
- <Field.WithMultipleSelect disabled={true} label="测试关联多选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark12" />
902
- <Layout.FormRow > <Field.TextArea label="备注" __id="remark" /></Layout.FormRow>
903
-
904
- <Layout.FormRow layout={'1'}>
905
- <Field.RadioGroup withIds={["remark11"]}
906
- withFill={{
907
- "value": [
908
- {
909
- "insert": {
910
- "span": true
911
- },
912
- "attributes": {
913
- "id": "remark11",
914
- "color": "blue",
915
- "tagKey": "fieldsValue",
916
- "content": "测试关联单选"
917
- }
918
- },
919
- ],
920
- "version": 1719296886283,
921
- "withData": [
922
-
923
- ]
924
- }} options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} label="单选框" __id="radio" ></Field.RadioGroup>
925
- </Layout.FormRow>
926
- <Layout.FormRow layout={'1'}>
927
- <Field.CheckboxGroup options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} label="多选框" __id="CheckboxGroup" ></Field.CheckboxGroup>
928
- </Layout.FormRow>
929
- <Field.UploadFile label="上传文件" __id="UploadFile" ></Field.UploadFile>
930
- <Field.UploadImage label="上传图片" __id="UploadImage" ></Field.UploadImage>
931
-
463
+
932
464
  </FormContainerWrapper>
933
465
  <div className="fgroup">11111
934
466
  <div className="fbg-red-500 group-hover:fbg-blue-500">
@@ -6,7 +6,7 @@ import { createPromiseWrapper } from "../../../utils"
6
6
  import { useCreation } from 'ahooks';
7
7
 
8
8
 
9
- const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsValue, shouldUpdateKey, value, type, defaultValue, onChange, option_label, option_value, option_search, options, request, requestParams, callError, subRequest, sub_option_label = "label", mode = "single", sub_option_value = "id", rightIconRender, rightIcon, rightIconClick, recordFieldsChange, getAllWithIds,removeLastFieldsValues, ...props }, ref) => {
9
+ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsValue, shouldUpdateKey, value, type, defaultValue, onChange, option_label, option_value, option_search, options, request, requestParams, callError, subRequest, sub_option_label = "label", mode = "single", sub_option_value = "id", rightIconRender, rightIcon, rightIconClick, recordFieldsChange, getAllWithIds, removeLastFieldsValues, ...props }, ref) => {
10
10
  const [nOptions, setNOptions] = React.useState([])
11
11
  const [fetching, setFetching] = useState(false);
12
12
 
@@ -18,11 +18,13 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
18
18
  return createPromiseWrapper();
19
19
  }, []);
20
20
  const callbackQueue = useRef([]);
21
+ const debounceFetchOptionsRef = useRef(null);
22
+
21
23
 
22
24
  useEffect(() => {
23
25
  // console.log("SearchSelect useEffect props", props)
24
- if (value) {
25
- // console.log(`SearchSelect ${fieldName} value`, value)
26
+ if (value && value?.value) {
27
+ console.log(`SearchSelect ${fieldName} value`, value)
26
28
  let item = null
27
29
  if (Array.isArray(nOptions) && nOptions.length > 0) {
28
30
  item = nOptions.find(item => item.value == value?.value || item.value == value)
@@ -70,17 +72,29 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
70
72
  const loadSelectOptions = async (loadValue) => {
71
73
  if (request && option_value) {
72
74
  // console.log(`[${props?.label}]loadSelectOptions loadValue`, loadValue);
73
- // console.log(`[${props?.label}]loadSelectOptions loadValue2`, loadValue);
74
- callbackQueue.current.push((selectOptions) => {
75
+ console.log(`[${props?.label}]loadSelectOptions loadValue2`, loadValue);
76
+ // callbackQueue.current.push((selectOptions) => {
77
+ // if (selectOptions && selectOptions.length > 0) {
78
+ // console.log("callback selectOptions", selectOptions)
79
+ // console.log("callback loadValue", loadValue)
80
+ // let item = selectOptions.find(item => item.value == loadValue?.value || item.value == loadValue);
81
+ // if (item && !isEqual(item, loadValue)) {
82
+ // console.log(`[${props?.label}]debounceFetchOptions new value /////`, item);
83
+ // typeof onChange === 'function' && onChange(item);
84
+ // }
85
+ // }
86
+ // });
87
+ debounceFetchOptions({ ...requestParams, [option_value]: loadValue?.value }, null, (selectOptions) => {
75
88
  if (selectOptions && selectOptions.length > 0) {
89
+ console.log("callback selectOptions", selectOptions)
90
+ console.log("callback loadValue", loadValue)
76
91
  let item = selectOptions.find(item => item.value == loadValue?.value || item.value == loadValue);
77
92
  if (item && !isEqual(item, loadValue)) {
78
- // console.log(`[${props?.label}]debounceFetchOptions new value /////`, item);
93
+ console.log(`[${props?.label}]debounceFetchOptions new value /////`, item);
79
94
  typeof onChange === 'function' && onChange(item);
80
95
  }
81
96
  }
82
97
  });
83
- debounceFetchOptions({ ...requestParams, [option_value]: loadValue?.value });
84
98
  }
85
99
  };
86
100
 
@@ -105,17 +119,41 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
105
119
  await debounceFetchOptions(params)
106
120
  }
107
121
 
108
- const debounceFetchOptions = useCallback(debounce((params, ruleParams) => {
109
- fetchOptions(params, ruleParams, fieldName).then(result => {
110
- // console.log(`[${props?.label}]debounceFetchOptions result`, result);
111
- while (callbackQueue.current.length > 0) {
112
- const callback = callbackQueue.current.shift();
113
- if (typeof callback === 'function') {
114
- callback(result);
115
- }
116
- }
117
- });
118
- }, 200), [fieldName]);
122
+ const debounceFetchOptions = (params, ruleParams, callback) => {
123
+ if (typeof callback == "function") callbackQueue.current.push(callback);
124
+ if (debounceFetchOptionsRef.current) clearTimeout(debounceFetchOptionsRef.current);
125
+ debounceFetchOptionsRef.current = setTimeout(() => {
126
+ const callbacks = callbackQueue.current;
127
+ console.log(`[${props?.label}]debounceFetchOptions callbackQueue`, JSON.parse(JSON.stringify(callbacks)));
128
+ callbackQueue.current = [];
129
+ fetchOptions(params, ruleParams, fieldName).then(result => {
130
+ console.log(`[${props?.label}]debounceFetchOptions result`, result);
131
+ while (callbacks.length > 0) {
132
+ const callback = callbacks.shift();
133
+ if (typeof callback === 'function') {
134
+ callback(result);
135
+ }
136
+ }
137
+ });
138
+ }, 200);
139
+ }
140
+
141
+ // const debounceFetchOptions = useCallback(debounce((params, ruleParams) => {
142
+ // console.log(`[${props?.label}]debounceFetchOptions params`, params);
143
+ // // 取出callbackQueue.current中的callback
144
+ // const callbacks = callbackQueue.current;
145
+ // console.log(`[${props?.label}]debounceFetchOptions callbackQueue`, JSON.parse(JSON.stringify(callbacks)));
146
+ // callbackQueue.current = [];
147
+ // fetchOptions(params, ruleParams, fieldName).then(result => {
148
+ // console.log(`[${props?.label}]debounceFetchOptions result`, result);
149
+ // while (callbacks.length > 0) {
150
+ // const callback = callbacks.shift();
151
+ // if (typeof callback === 'function') {
152
+ // callback(result);
153
+ // }
154
+ // }
155
+ // });
156
+ // }, 200), [fieldName]);
119
157
 
120
158
  const fetchList = async (params, ruleParams, newFieldName) => {
121
159
  let list = []
@@ -226,7 +264,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
226
264
 
227
265
  </OriginalSelect>
228
266
  {!props?.disabled && rightIcon}
229
- {!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName, recordFieldsChange,getAllWithIds ,removeLastFieldsValues})}
267
+ {!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName, recordFieldsChange, getAllWithIds, removeLastFieldsValues })}
230
268
  </BaseWrapper>
231
269
  ) : (<>
232
270
  <OriginalSelect
@@ -245,7 +283,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
245
283
 
246
284
  </OriginalSelect>
247
285
  {!props?.disabled && rightIcon}
248
- {!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName, recordFieldsChange,getAllWithIds,removeLastFieldsValues })}
286
+ {!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName, recordFieldsChange, getAllWithIds, removeLastFieldsValues })}
249
287
  </>
250
288
  )
251
289