@bit-sun/business-component 2.4.19 → 3.0.0-alpha.1
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/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +3 -0
- package/dist/components/Business/BsLayouts/Components/ChooseStore/services.d.ts +1 -0
- package/dist/components/Business/BsLayouts/Components/RightContent/i18n.d.ts +9 -0
- package/dist/components/Business/BsLayouts/service.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -0
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +1 -0
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +1 -0
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -1
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +2 -1
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +2 -0
- package/dist/components/Solution/RuleComponent/services.d.ts +1 -1
- package/dist/index.esm.js +1563 -1070
- package/dist/index.js +1548 -1053
- package/dist/utils/request.d.ts +2 -0
- package/dist/utils/utils.d.ts +6 -0
- package/package.json +6 -4
- package/src/assets/arrow_top.svg +18 -0
- package/src/components/Business/AddSelectBusiness/index.tsx +38 -19
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.less +0 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.tsx +193 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +10 -0
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +7 -1
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +3 -3
- package/src/components/Business/BsLayouts/Components/RightContent/i18n.ts +9 -0
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +19 -2
- package/src/components/Business/BsLayouts/index.tsx +44 -34
- package/src/components/Business/BsLayouts/service.ts +2 -2
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +9 -9
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +5 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +346 -175
- package/src/components/Business/BsSulaQueryTable/setting.tsx +125 -87
- package/src/components/Business/BsSulaQueryTable/utils.tsx +57 -34
- package/src/components/Business/CommonGuideWrapper/index.tsx +11 -2
- package/src/components/Business/JsonQueryTable/index.tsx +10 -12
- package/src/components/Business/SearchSelect/utils.ts +3 -3
- package/src/components/Business/columnSettingTable/columnSetting.tsx +10 -8
- package/src/components/Business/columnSettingTable/utils.tsx +29 -29
- package/src/components/Functional/AddSelect/helps.ts +4 -3
- package/src/components/Functional/AddSelect/index.tsx +79 -33
- package/src/components/Functional/BillEntry/index.tsx +3 -3
- package/src/components/Functional/DataImport/index.tsx +3 -3
- package/src/components/Functional/DataValidation/index.tsx +3 -3
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +10 -5
- package/src/components/Functional/QueryMutipleInput/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/index.less +6 -0
- package/src/components/Functional/SearchSelect/index.tsx +152 -45
- package/src/components/Functional/TreeSearchSelect/index.tsx +24 -22
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +641 -0
- package/src/components/Solution/RuleComponent/index.js +7 -652
- package/src/components/Solution/RuleComponent/services.ts +2 -2
- package/src/plugin/TableColumnSetting/index.tsx +2 -2
- package/src/utils/request.ts +53 -0
- package/src/utils/utils.ts +37 -21
|
@@ -3,9 +3,9 @@ import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'rea
|
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
4
|
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
6
|
-
import
|
|
6
|
+
import request from '@/utils/request';
|
|
7
7
|
import { stringify } from 'querystring';
|
|
8
|
-
import _ from "lodash"
|
|
8
|
+
import _, { escapeRegExp, isNil } from "lodash"
|
|
9
9
|
import './index.less';
|
|
10
10
|
import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
|
|
11
11
|
import { handleSourceName } from './utils';
|
|
@@ -239,7 +239,17 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
241
|
delete params[key];
|
|
242
|
+
} else if (element && key.indexOf('*multiInput') >= 0) {
|
|
243
|
+
let name = '',
|
|
244
|
+
value = element['value'];
|
|
245
|
+
if (value.indexOf(',') >= 0) {
|
|
246
|
+
name = `qp-${element['name']}-in`;
|
|
247
|
+
} else {
|
|
248
|
+
name = `qp-${element['name']}-like`;
|
|
242
249
|
}
|
|
250
|
+
params[name] = value;
|
|
251
|
+
delete params[key];
|
|
252
|
+
}
|
|
243
253
|
else if (element && key.indexOf('*') >= 0) {
|
|
244
254
|
const dataParams = key.split('*');
|
|
245
255
|
dataParams.forEach((value, index) => {
|
|
@@ -273,9 +283,11 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
273
283
|
...otherParams, // 默认参数
|
|
274
284
|
...fixedParam,
|
|
275
285
|
...params,
|
|
286
|
+
};
|
|
287
|
+
if (isNil(queryParams[selectParamsKey])) {
|
|
288
|
+
queryParams[selectParamsKey] = searchValue;
|
|
276
289
|
}
|
|
277
|
-
|
|
278
|
-
axios
|
|
290
|
+
request
|
|
279
291
|
.get(
|
|
280
292
|
`${url}?${stringify(queryParams)}`,
|
|
281
293
|
{
|
|
@@ -436,6 +448,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
436
448
|
setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
|
|
437
449
|
setIndeterminate(!!value.length && value.length < itemsTotal);
|
|
438
450
|
setCheckedAll(itemsTotal && value.length === itemsTotal);
|
|
451
|
+
|
|
439
452
|
} else {
|
|
440
453
|
setSelectedRowKeys(labelInValue ? [value.key] : [value])
|
|
441
454
|
setSelectedRows(labelInValue ? [{ [mappingValueField]: value.key, value: value.key, text: value.label }] : [{ [mappingValueField]: value, value: value }])
|
|
@@ -547,6 +560,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
547
560
|
setSelectedRows(currentItemsData)
|
|
548
561
|
})
|
|
549
562
|
}
|
|
563
|
+
|
|
550
564
|
const onChangeCheckAll = (e) => {
|
|
551
565
|
if (e.target.checked) {
|
|
552
566
|
// 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
|
|
@@ -578,8 +592,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
578
592
|
if (heightTxt === '') {
|
|
579
593
|
return text
|
|
580
594
|
}
|
|
595
|
+
const searchString = escapeRegExp(heightTxt);
|
|
581
596
|
// 前面filterOption 不区分大小写,这里用i
|
|
582
|
-
const regexp = new RegExp(
|
|
597
|
+
const regexp = new RegExp(searchString, 'gi')
|
|
583
598
|
return text.replace(regexp, `<span style="color:red">${heightTxt}</span>`)
|
|
584
599
|
}
|
|
585
600
|
return (
|
|
@@ -762,29 +777,37 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
762
777
|
|
|
763
778
|
return (
|
|
764
779
|
<div className={'search_select'}>
|
|
765
|
-
{fieldComponent ?
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
780
|
+
{fieldComponent ? (
|
|
781
|
+
<div
|
|
782
|
+
onClick={() => {
|
|
783
|
+
fieldComponent.props?.onClick?.();
|
|
784
|
+
showModal();
|
|
785
|
+
}}
|
|
786
|
+
>
|
|
787
|
+
{fieldComponent}
|
|
788
|
+
</div>
|
|
789
|
+
) : (
|
|
790
|
+
<div
|
|
791
|
+
className="search_select_show"
|
|
792
|
+
id={`search_select_div_${uniqueValue}`}
|
|
793
|
+
>
|
|
771
794
|
<Select
|
|
772
795
|
virtual
|
|
773
796
|
labelInValue={labelInValue}
|
|
774
797
|
value={value}
|
|
775
798
|
onChange={onChange}
|
|
776
799
|
disabled={props.disabled}
|
|
777
|
-
dropdownRender={menu => (
|
|
800
|
+
dropdownRender={(menu) => (
|
|
778
801
|
<>
|
|
779
802
|
<Input
|
|
780
803
|
value={searchValue}
|
|
781
804
|
style={{ width: '98%', marginLeft: '1%' }}
|
|
782
805
|
placeholder="请输入"
|
|
783
|
-
onChange={e => onSearchChange(e)}
|
|
806
|
+
onChange={(e) => onSearchChange(e)}
|
|
784
807
|
onBlur={onSearchBlur}
|
|
785
808
|
onKeyDown={(e) => {
|
|
786
809
|
// 阻止多选的冒泡
|
|
787
|
-
e.stopPropagation()
|
|
810
|
+
e.stopPropagation();
|
|
788
811
|
}}
|
|
789
812
|
/>
|
|
790
813
|
<Divider style={{ margin: '8px 0' }} />
|
|
@@ -792,13 +815,16 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
792
815
|
</>
|
|
793
816
|
)}
|
|
794
817
|
notFoundContent={
|
|
795
|
-
fetching ?
|
|
818
|
+
fetching ? (
|
|
819
|
+
<Spin size="small" className='searchSelectSpin' />
|
|
820
|
+
) : (
|
|
796
821
|
<div style={{ textAlign: 'center' }}>
|
|
797
822
|
<div style={{ marginBottom: 16 }}>
|
|
798
823
|
<CopyOutlined style={{ fontSize: '50px' }} />
|
|
799
824
|
</div>
|
|
800
825
|
<div>无匹配结果,请更换其他内容再试</div>
|
|
801
826
|
</div>
|
|
827
|
+
)
|
|
802
828
|
}
|
|
803
829
|
onPopupScroll={SelectScroll}
|
|
804
830
|
style={{ width: needModalTable ? 'calc(100% - 30px)' : 'calc(100%)' }}
|
|
@@ -817,73 +843,154 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
817
843
|
))}
|
|
818
844
|
</Select>
|
|
819
845
|
{needModalTable && (
|
|
820
|
-
<Button
|
|
846
|
+
<Button
|
|
847
|
+
style={{ width: '30px', padding: '2px', height: 'auto' }}
|
|
848
|
+
onClick={showModal}
|
|
849
|
+
type="primary"
|
|
850
|
+
>
|
|
821
851
|
<SearchOutlined />
|
|
822
852
|
</Button>
|
|
823
853
|
)}
|
|
824
|
-
</div>
|
|
854
|
+
</div>
|
|
855
|
+
)}
|
|
825
856
|
{needModalTable && isModalVisible && (
|
|
826
857
|
<Modal
|
|
827
|
-
width=
|
|
858
|
+
width="80%"
|
|
828
859
|
title={modalTableProps?.modalTableTitle}
|
|
829
860
|
visible={isModalVisible}
|
|
830
861
|
onOk={handleOk}
|
|
831
862
|
onCancel={handleCancel}
|
|
832
|
-
footer={
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
863
|
+
footer={
|
|
864
|
+
selectMode || modalTableProps?.modalRadioNeedFooter
|
|
865
|
+
? [
|
|
866
|
+
<Button key="back" onClick={handleCancel}>
|
|
867
|
+
取消
|
|
868
|
+
</Button>,
|
|
869
|
+
<Button
|
|
870
|
+
key="submit"
|
|
871
|
+
type="primary"
|
|
872
|
+
onClick={handleOk}
|
|
873
|
+
disabled={
|
|
874
|
+
!tableData.length ||
|
|
875
|
+
selectProps?.disabled ||
|
|
876
|
+
props?.disabled
|
|
877
|
+
}
|
|
878
|
+
>
|
|
879
|
+
确定
|
|
880
|
+
</Button>,
|
|
881
|
+
]
|
|
882
|
+
: null
|
|
883
|
+
}
|
|
845
884
|
{...(modalTableProps?.modalProps || {})}
|
|
846
885
|
>
|
|
847
886
|
<div className={'search_select_wrapper'}>
|
|
848
|
-
<div
|
|
849
|
-
|
|
887
|
+
<div
|
|
888
|
+
className={'search_select_wrapper_click_flag'}
|
|
889
|
+
onClick={() => setCaretLeftFlag(!caretLeftFlag)}
|
|
890
|
+
>
|
|
891
|
+
<CaretLeftOutlined
|
|
892
|
+
className={
|
|
893
|
+
caretLeftFlag
|
|
894
|
+
? 'search_select_wrapper_click_flag_arrow'
|
|
895
|
+
: 'search_select_wrapper_click_flag_arrow_1'
|
|
896
|
+
}
|
|
897
|
+
/>
|
|
850
898
|
</div>
|
|
851
|
-
<div
|
|
899
|
+
<div
|
|
900
|
+
className={
|
|
901
|
+
caretLeftFlag
|
|
902
|
+
? 'search_select_wrapper_left'
|
|
903
|
+
: 'search_select_wrapper_left1'
|
|
904
|
+
}
|
|
905
|
+
>
|
|
852
906
|
<div className={'select_list_columns'}>
|
|
853
907
|
<div className={'select_list_columns_tips'}>搜索</div>
|
|
854
908
|
<div className={'select_list_columns_formItems'}>
|
|
855
|
-
<Form form={form} layout=
|
|
909
|
+
<Form form={form} layout="vertical" key="modalForm">
|
|
856
910
|
{formItem(modalTableProps?.tableSearchForm)}
|
|
857
911
|
</Form>
|
|
858
912
|
</div>
|
|
859
913
|
</div>
|
|
860
914
|
<div className={'select_list_searchButton'}>
|
|
861
|
-
<Button
|
|
862
|
-
|
|
915
|
+
<Button
|
|
916
|
+
key="reset"
|
|
917
|
+
className={'select_list_button_space'}
|
|
918
|
+
onClick={onResetTable}
|
|
919
|
+
>
|
|
920
|
+
重置
|
|
921
|
+
</Button>
|
|
922
|
+
<Button key="search" type="primary" onClick={onSearchTable}>
|
|
923
|
+
查询
|
|
924
|
+
</Button>
|
|
863
925
|
</div>
|
|
864
926
|
</div>
|
|
865
|
-
<div
|
|
927
|
+
<div
|
|
928
|
+
className={
|
|
929
|
+
caretLeftFlag
|
|
930
|
+
? 'search_select_wrapper_right'
|
|
931
|
+
: 'search_select_wrapper_right1'
|
|
932
|
+
}
|
|
933
|
+
>
|
|
866
934
|
<div>
|
|
867
935
|
<div className={'select_list_selectTips'}>
|
|
868
|
-
<div style={{ marginLeft: 8 }}
|
|
869
|
-
|
|
936
|
+
<div style={{ marginLeft: 8 }}>
|
|
937
|
+
搜索结果共
|
|
938
|
+
<span style={themeColor}>
|
|
939
|
+
{tablePagination?.total || 0}
|
|
940
|
+
</span>
|
|
941
|
+
项
|
|
942
|
+
{selectMode ? (
|
|
943
|
+
<span>
|
|
944
|
+
, 本次已选
|
|
945
|
+
<span style={themeColor}>
|
|
946
|
+
{selectedRowKeys?.length || 0}
|
|
947
|
+
</span>
|
|
948
|
+
项
|
|
949
|
+
</span>
|
|
950
|
+
) : (
|
|
951
|
+
''
|
|
952
|
+
)}
|
|
953
|
+
</div>
|
|
954
|
+
<div
|
|
955
|
+
style={{ color: 'rgba(127, 127, 127, 0.6470588235294118)' }}
|
|
956
|
+
>
|
|
957
|
+
{selectMode
|
|
958
|
+
? '勾选后点击确定按钮完成选择'
|
|
959
|
+
: '双击数据行或点击单选图标完成选择'}
|
|
960
|
+
</div>
|
|
870
961
|
</div>
|
|
871
962
|
<Table
|
|
872
|
-
size=
|
|
963
|
+
size="small"
|
|
873
964
|
rowSelection={rowSelection}
|
|
874
965
|
columns={modalTableProps?.tableColumns}
|
|
875
966
|
dataSource={tableData}
|
|
876
967
|
pagination={tablePagination}
|
|
877
968
|
onChange={handleTableChange}
|
|
878
969
|
rowKey={mappingValueField}
|
|
879
|
-
scroll={{
|
|
880
|
-
|
|
970
|
+
scroll={{
|
|
971
|
+
x: modalTableProps.overScrollX || 'max-content',
|
|
972
|
+
y: modalTableProps.overScrollY || null,
|
|
973
|
+
}}
|
|
974
|
+
onRow={(record) => {
|
|
881
975
|
return {
|
|
882
|
-
onDoubleClick: event =>
|
|
976
|
+
onDoubleClick: (event) =>
|
|
977
|
+
onDoubleClickSelect(event, record),
|
|
883
978
|
};
|
|
884
979
|
}}
|
|
885
980
|
/>
|
|
886
|
-
{selectMode ?
|
|
981
|
+
{selectMode ? (
|
|
982
|
+
<div className={'select_list_selectAll'}>
|
|
983
|
+
<Checkbox
|
|
984
|
+
indeterminate={indeterminate}
|
|
985
|
+
checked={checkedAll}
|
|
986
|
+
onChange={onChangeCheckAll}
|
|
987
|
+
disabled={selectProps?.disabled || props?.disabled}
|
|
988
|
+
/>{' '}
|
|
989
|
+
全选所有页面
|
|
990
|
+
</div>
|
|
991
|
+
) : (
|
|
992
|
+
''
|
|
993
|
+
)}
|
|
887
994
|
</div>
|
|
888
995
|
</div>
|
|
889
996
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { TreeSelect, Tooltip, Tag } from 'antd';
|
|
3
|
-
import
|
|
3
|
+
import request from '@/utils/request';
|
|
4
4
|
import { stringify } from 'querystring';
|
|
5
5
|
import _ from "lodash"
|
|
6
6
|
import { judgeIsRequestSuccess } from '@/utils/requestUtils';
|
|
@@ -77,7 +77,7 @@ const TreeSearchSelect = (props: any) => {
|
|
|
77
77
|
[`${paramsKey}`]: q,
|
|
78
78
|
...initialParams,
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
request.get(`${url}?${stringify(paramsData)}`, {headers}).then(async (res: any) => {
|
|
81
81
|
const resData = res?.data || [];
|
|
82
82
|
let coverData;
|
|
83
83
|
|
|
@@ -100,14 +100,15 @@ const TreeSearchSelect = (props: any) => {
|
|
|
100
100
|
|
|
101
101
|
const formatData = (value: any) => {
|
|
102
102
|
if (labelInValue) {
|
|
103
|
-
const formatResult = multiple
|
|
103
|
+
const formatResult = multiple||treeCheckable ? value.map((i: any) => ({...i, key: i.value})) : { ...value, key: value?.value };
|
|
104
104
|
return formatResult
|
|
105
105
|
} else {
|
|
106
|
-
const formatResult = multiple
|
|
106
|
+
const formatResult = multiple||treeCheckable ? value.map((i: any) => (i?.value || i)) : (_.get(value?.[0], 'value') || value)
|
|
107
107
|
return formatResult
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
|
|
111
|
+
const parallelData = (data: any,result: any) => {
|
|
111
112
|
data.forEach((i: any) => {
|
|
112
113
|
result.push(i);
|
|
113
114
|
if (i[treeChildrenRoom]) {
|
|
@@ -116,31 +117,32 @@ const TreeSearchSelect = (props: any) => {
|
|
|
116
117
|
});
|
|
117
118
|
return result;
|
|
118
119
|
}
|
|
119
|
-
const getSelectItem = (tData: any,
|
|
120
|
-
const handleList = tData
|
|
120
|
+
const getSelectItem = (tData: any,selectValue: any) => {
|
|
121
|
+
const handleList = tData||[];
|
|
121
122
|
let result = [];
|
|
122
|
-
if
|
|
123
|
-
result = multiple
|
|
124
|
-
if
|
|
123
|
+
if(labelInValue) {
|
|
124
|
+
result = multiple||treeCheckable ? (selectValue?.map((i: any) => {
|
|
125
|
+
if(handleList.some((s: any) => s.key == i.value)){
|
|
125
126
|
return handleList.find((s: any) => s.key == i.value)
|
|
126
127
|
}
|
|
127
|
-
}) || []) : (handleList?.find((s: any) => s.key == selectValue?.value)
|
|
128
|
+
}) || []) : (handleList?.find((s: any) => s.key == selectValue?.value)||{})
|
|
128
129
|
} else {
|
|
129
130
|
const cValue = _.get(selectValue?.[0], 'value', selectValue);
|
|
130
|
-
result = multiple
|
|
131
|
-
if
|
|
131
|
+
result = multiple||treeCheckable ? (selectValue?.map((i: any) => {
|
|
132
|
+
if(handleList.some((s: any) => s.key == i)){
|
|
132
133
|
return handleList.find((s: any) => s.key == i)
|
|
133
134
|
}
|
|
134
|
-
}) || []) : (handleList?.find((s: any) => s.key == cValue)
|
|
135
|
+
}) || []) : (handleList?.find((s: any) => s.key == cValue)||{})
|
|
135
136
|
}
|
|
136
137
|
return result;
|
|
137
138
|
}
|
|
139
|
+
|
|
138
140
|
const handleChange = (data: any, dataName: any) => {
|
|
139
141
|
const handleData = formatData(data);
|
|
140
142
|
// 获取选中树节点当条数据,并返回给调用业务
|
|
141
|
-
const parallelTreeData = parallelData(treeData,
|
|
142
|
-
const currentItem = getSelectItem(parallelTreeData,
|
|
143
|
-
onChange(handleData,
|
|
143
|
+
const parallelTreeData = parallelData(treeData,[])
|
|
144
|
+
const currentItem = getSelectItem(parallelTreeData,data)
|
|
145
|
+
onChange(handleData,data,currentItem,parallelTreeData);
|
|
144
146
|
onChangeName && onChangeName(dataName);
|
|
145
147
|
getTreeData && getTreeData(treeData); // 把树节点暴露出去
|
|
146
148
|
ctx?.form?.setFieldValue(ctx.name, handleData);
|
|
@@ -151,17 +153,17 @@ const TreeSearchSelect = (props: any) => {
|
|
|
151
153
|
}, []);
|
|
152
154
|
|
|
153
155
|
const maxTagPlaceholder = (selectedValues: any) => {
|
|
154
|
-
const onClose = (e: any,
|
|
156
|
+
const onClose = (e: any,item: any) => {
|
|
155
157
|
e.preventDefault();
|
|
156
|
-
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value)
|
|
157
|
-
const newValueName = labelInValue ? null
|
|
158
|
+
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value): JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
|
|
159
|
+
const newValueName = labelInValue ? null: JSON.parse(JSON.stringify(valueName)).filter((i: any) => i !== item.label)
|
|
158
160
|
handleChange(newValue, newValueName);
|
|
159
161
|
}
|
|
160
162
|
return (
|
|
161
163
|
<Tooltip title={selectedValues.map((i: any) => (
|
|
162
164
|
<Tag
|
|
163
165
|
closable={true}
|
|
164
|
-
onClose={(e) => onClose(e,
|
|
166
|
+
onClose={(e) => onClose(e,i)}
|
|
165
167
|
style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
166
168
|
>
|
|
167
169
|
{i.label}
|
|
@@ -193,7 +195,7 @@ const TreeSearchSelect = (props: any) => {
|
|
|
193
195
|
multiple={multiple} // 支持多选(当设置 treeCheckable 时自动变为 true)
|
|
194
196
|
maxTagPlaceholder={maxTagPlaceholder}
|
|
195
197
|
onChange={handleChange}
|
|
196
|
-
disabled={disabled || mode
|
|
198
|
+
disabled={disabled || mode==='view' || ctx?.mode === 'view'}
|
|
197
199
|
getPopupContainer={(triggerNode) => (getPopupContainer && getPopupContainer(triggerNode)) || document.body}
|
|
198
200
|
>
|
|
199
201
|
</TreeSelect>
|