@bit-sun/business-component 4.0.13-alpha.9 → 4.2.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/.umirc.ts +21 -10
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +5 -2
- package/dist/components/Business/DetailPageWrapper/index.d.ts +6 -0
- package/dist/components/Business/ItemPropertySelector/index.d.ts +3 -0
- package/dist/components/Business/ModalUtils/index.d.ts +8 -0
- package/dist/components/Business/SearchSelect/utils.d.ts +4 -2
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +3 -2
- package/dist/components/Business/columnSettingTable/index.d.ts +19 -2
- package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +20 -3
- package/dist/components/Functional/DataValidation/index.d.ts +11 -1
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +2 -1
- package/dist/components/Functional/SearchSelect/utils.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +2233 -1001
- package/dist/index.js +2233 -1000
- package/dist/plugin/TableColumnSetting/index.d.ts +1 -0
- package/package.json +16 -14
- package/src/assets/btn-cancel.svg +3 -0
- package/src/assets/btn-copy.svg +3 -0
- package/src/assets/btn-delete.svg +2 -29
- package/src/assets/btn-edit.svg +2 -19
- package/src/assets/btn-hangUp.svg +3 -0
- package/src/assets/btn-print.svg +3 -0
- package/src/assets/btn-refresh.svg +3 -0
- package/src/assets/btn-unhook.svg +3 -0
- package/src/components/Business/AddSelectBusiness/index.md +8 -2
- package/src/components/Business/AddSelectBusiness/index.tsx +3 -0
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +1 -1
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +1 -1
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +2 -2
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +6 -4
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +0 -4
- package/src/components/Business/BsSulaQueryTable/index.less +5 -3
- package/src/components/Business/BsSulaQueryTable/index.md +45 -32
- package/src/components/Business/BsSulaQueryTable/index.tsx +153 -76
- package/src/components/Business/BsSulaQueryTable/setting.tsx +40 -10
- package/src/components/Business/BsSulaQueryTable/utils.less +1 -1
- package/src/components/Business/BsSulaQueryTable/utils.tsx +15 -12
- package/src/components/Business/CommodityEntry/index.md +1 -1
- package/src/components/Business/CommodityEntry/index.tsx +11 -9
- package/src/components/Business/DetailPageWrapper/index.less +1 -1
- package/src/components/Business/DetailPageWrapper/index.tsx +24 -5
- package/src/components/Business/DetailPageWrapper/utils.tsx +7 -2
- package/src/components/Business/HomePageWrapper/index.less +1 -1
- package/src/components/Business/ItemPropertySelector/index.tsx +88 -0
- package/src/components/Business/JsonQueryTable/function.ts +1 -1
- package/src/components/Business/ModalUtils/index.tsx +45 -0
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +284 -57
- package/src/components/Business/SearchSelect/index.md +4 -4
- package/src/components/Business/SearchSelect/utils.ts +26 -4
- package/src/components/Business/columnSettingTable/columnSetting.tsx +27 -11
- package/src/components/Business/columnSettingTable/index.less +5 -3
- package/src/components/Business/columnSettingTable/index.md +200 -136
- package/src/components/Business/columnSettingTable/index.tsx +167 -39
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +178 -47
- package/src/components/Functional/AddSelect/index.tsx +39 -12
- package/src/components/Functional/BillEntry/index.less +3 -0
- package/src/components/Functional/DataValidation/index.md +1 -0
- package/src/components/Functional/DataValidation/index.tsx +138 -23
- package/src/components/Functional/QueryMutipleInput/index.tsx +11 -2
- package/src/components/Functional/QueryMutipleSelect/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/index.less +4 -0
- package/src/components/Functional/SearchSelect/index.tsx +61 -20
- package/src/components/Functional/SearchSelect/utils.tsx +13 -10
- package/src/components/Functional/TreeSearchSelect/index.tsx +2 -1
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +1 -0
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +2 -1
- package/src/components/Solution/RuleComponent/index.js +74 -4
- package/src/components/Solution/RuleComponent/ruleFiled.js +1 -1
- package/src/index.ts +1 -0
- package/src/plugin/TableColumnSetting/index.less +5 -3
- package/src/plugin/TableColumnSetting/index.tsx +79 -12
- package/src/styles/bsDefault.less +9 -3
- package/src/utils/TableUtils.less +1 -1
- package/src/utils/request.ts +8 -4
- package/src/utils/utils.ts +11 -15
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from '@ant-design/icons';
|
|
29
29
|
import request from '@/utils/request';
|
|
30
30
|
import './index.less';
|
|
31
|
-
import _ from "lodash"
|
|
31
|
+
import _, { ceil, isNumber } from "lodash"
|
|
32
32
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
33
33
|
import { readerXlsxToList } from '@/utils/xlsxUtil';
|
|
34
34
|
|
|
@@ -179,10 +179,26 @@ class DataValidation extends React.Component {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
getCount = () => {
|
|
182
|
-
const { resultData } = this.state;
|
|
182
|
+
const { resultData = [] } = this.state;
|
|
183
|
+
const totalQuantity = resultData.reduce((total, item) => {
|
|
184
|
+
total += Number(item.quantity || 0);
|
|
185
|
+
return total;
|
|
186
|
+
}, 0);
|
|
187
|
+
const totalSuccessQuantity = resultData.filter(item => item.flag).reduce((total, item) => {
|
|
188
|
+
total += Number(item.quantity || 0);
|
|
189
|
+
return total;
|
|
190
|
+
}, 0);
|
|
191
|
+
const totalErrorQuantity = resultData.filter(item => !item.flag).reduce((total, item) => {
|
|
192
|
+
total += Number(item.quantity || 0);
|
|
193
|
+
return total;
|
|
194
|
+
}, 0);
|
|
183
195
|
return {
|
|
184
196
|
total: resultData.length,
|
|
197
|
+
totalQuantity,
|
|
198
|
+
totalSuccessQuantity,
|
|
199
|
+
totalErrorQuantity,
|
|
185
200
|
error: resultData.filter((item) => !item.flag).length,
|
|
201
|
+
success: resultData.filter((item) => item.flag).length,
|
|
186
202
|
};
|
|
187
203
|
};
|
|
188
204
|
|
|
@@ -191,7 +207,7 @@ class DataValidation extends React.Component {
|
|
|
191
207
|
const { notValid } = this.props;
|
|
192
208
|
return {
|
|
193
209
|
container: 'luckysheet',
|
|
194
|
-
showtoolbar: false,
|
|
210
|
+
// showtoolbar: false,
|
|
195
211
|
hook: {
|
|
196
212
|
columnTitleCellRenderBefore: function (columnAbc, postion, ctx) {
|
|
197
213
|
if (columnAbc.name) {
|
|
@@ -233,18 +249,9 @@ class DataValidation extends React.Component {
|
|
|
233
249
|
// console.info(data,sheetFile,ctx)
|
|
234
250
|
},
|
|
235
251
|
},
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
// currencyFormat: false, //货币格式
|
|
240
|
-
// percentageFormat: false, //百分比格式
|
|
241
|
-
// numberDecrease: false, // '减少小数位数'
|
|
242
|
-
// numberIncrease: false, // '增加小数位数
|
|
243
|
-
// moreFormats: false, // '更多格式'
|
|
244
|
-
// font: true, // '字体'
|
|
245
|
-
// fontSize: true, // '字号大小'
|
|
246
|
-
|
|
247
|
-
// },
|
|
252
|
+
showtoolbarConfig: {
|
|
253
|
+
sortAndFilter: true,
|
|
254
|
+
},
|
|
248
255
|
data: [
|
|
249
256
|
{
|
|
250
257
|
name: 'Cell', //工作表名称
|
|
@@ -365,7 +372,7 @@ class DataValidation extends React.Component {
|
|
|
365
372
|
showsheetbar: false,
|
|
366
373
|
optionstate: false,
|
|
367
374
|
showstatisticBarConfig: {
|
|
368
|
-
count:
|
|
375
|
+
count: true, // 计数栏
|
|
369
376
|
view: false, // 打印视图
|
|
370
377
|
zoom: false, // 缩放
|
|
371
378
|
},
|
|
@@ -422,6 +429,54 @@ class DataValidation extends React.Component {
|
|
|
422
429
|
return data.filter(d => _.compact(Object.values(d)).length);
|
|
423
430
|
};
|
|
424
431
|
|
|
432
|
+
naturalCompare = (a, b) => {
|
|
433
|
+
const checkNumber = (value) => {
|
|
434
|
+
return /^[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$/.test(value.trim())
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
if (checkNumber(a) && checkNumber(b)) {
|
|
438
|
+
return Number(a) - Number(b);
|
|
439
|
+
}
|
|
440
|
+
// 优先处理 "通过" 的情况
|
|
441
|
+
if (a === "通过" && b !== "通过") return -1;
|
|
442
|
+
if (b === "通过" && a !== "通过") return 1;
|
|
443
|
+
|
|
444
|
+
return a.localeCompare(b);
|
|
445
|
+
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
customSort = (a, b) => {
|
|
449
|
+
|
|
450
|
+
// 处理空值
|
|
451
|
+
const aEmpty = !a;
|
|
452
|
+
|
|
453
|
+
const bEmpty = !b;
|
|
454
|
+
|
|
455
|
+
if (aEmpty && bEmpty) return 0;
|
|
456
|
+
|
|
457
|
+
if (aEmpty) return 1; // a空,排后面
|
|
458
|
+
|
|
459
|
+
if (bEmpty) return -1; // b空,a排前面
|
|
460
|
+
|
|
461
|
+
return this.naturalCompare(a, b);
|
|
462
|
+
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
sortData = (sorterKey: string) => {
|
|
466
|
+
let sheetData = luckysheet.getSheetData();
|
|
467
|
+
let newData = JSON.parse(JSON.stringify(sheetData)).sort((cur, prev) => {
|
|
468
|
+
let cellIndex = itemsTemp.findIndex(item => item.code === sorterKey);
|
|
469
|
+
if (sorterKey === 'checkresult') {
|
|
470
|
+
cellIndex = itemsTemp.length;
|
|
471
|
+
}
|
|
472
|
+
return this.customSort(cur[cellIndex]?.v, prev[cellIndex]?.v);
|
|
473
|
+
})
|
|
474
|
+
luckysheet.create(this.setConfig(luckysheet.transToCellData(newData)));
|
|
475
|
+
this.setState({
|
|
476
|
+
data: luckysheet.transToCellData(newData),
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
|
|
425
480
|
resetData = () => {
|
|
426
481
|
const { validDataUrl, validDataParams, updateData, columns, isBrandAuth, isCheckStockNum = true, customerColumnsMapping } = this.props;
|
|
427
482
|
const resultData = this.getData().filter(d => {
|
|
@@ -523,7 +578,6 @@ class DataValidation extends React.Component {
|
|
|
523
578
|
|
|
524
579
|
toggleData = () => {
|
|
525
580
|
const { showErrorData, data } = this.state;
|
|
526
|
-
|
|
527
581
|
if (showErrorData) {
|
|
528
582
|
luckysheet.create(this.setConfig(data));
|
|
529
583
|
} else {
|
|
@@ -615,6 +669,44 @@ class DataValidation extends React.Component {
|
|
|
615
669
|
</div>
|
|
616
670
|
</Menu>
|
|
617
671
|
);
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
getSortList = () => {
|
|
675
|
+
let sortList = []
|
|
676
|
+
if (this.props?.customerColumnsMapping?.length) {
|
|
677
|
+
sortList = this.props?.customerColumnsMapping?.map((item, index) => {
|
|
678
|
+
return createItem('item-0', index, item.title, item.name, this.format);
|
|
679
|
+
})||[]
|
|
680
|
+
} else {
|
|
681
|
+
sortList = this.props?.columns?.map((item, index) => {
|
|
682
|
+
if (!mapping.get(item))
|
|
683
|
+
throw Error(
|
|
684
|
+
`${item} is not in DataValidation component, please fix this error`,
|
|
685
|
+
);
|
|
686
|
+
return createItem('item-0', index, mapping.get(item), item, this.format);
|
|
687
|
+
})||[];
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
return (
|
|
691
|
+
<Menu>
|
|
692
|
+
{
|
|
693
|
+
(sortList || []).map((item, index) =>{
|
|
694
|
+
return (
|
|
695
|
+
<>
|
|
696
|
+
<Menu.Item key={index} className="sheet_table-menu_item_text">
|
|
697
|
+
<a onClick={() => this.sortData(item.code)}>{item.content}</a>
|
|
698
|
+
</Menu.Item>
|
|
699
|
+
<Menu.Divider />
|
|
700
|
+
</>
|
|
701
|
+
)
|
|
702
|
+
})
|
|
703
|
+
}
|
|
704
|
+
<Menu.Item key="checkresult" className="sheet_table-menu_item_text">
|
|
705
|
+
<a onClick={() => this.sortData('checkresult')}>校验结果</a>
|
|
706
|
+
</Menu.Item>
|
|
707
|
+
</Menu>
|
|
708
|
+
)
|
|
709
|
+
}
|
|
618
710
|
|
|
619
711
|
getSheetMap = () => {
|
|
620
712
|
const { customerColumnsMapping, columns } = this.props;
|
|
@@ -653,7 +745,7 @@ class DataValidation extends React.Component {
|
|
|
653
745
|
|
|
654
746
|
render() {
|
|
655
747
|
const { errorListCheck } = this.state;
|
|
656
|
-
const { title, notValid, notExcelImport, excelImportConfig } = this.props;
|
|
748
|
+
const { title, notValid, notExcelImport, excelImportConfig, getTemplate } = this.props;
|
|
657
749
|
const { size, accept, suffixRule } = excelImportConfig || {}
|
|
658
750
|
|
|
659
751
|
let totalSummary = this.getCount();
|
|
@@ -708,6 +800,8 @@ class DataValidation extends React.Component {
|
|
|
708
800
|
left: '0px',
|
|
709
801
|
top: '0px',
|
|
710
802
|
};
|
|
803
|
+
|
|
804
|
+
console.log('itemsTemp', itemsTemp)
|
|
711
805
|
return (
|
|
712
806
|
<>
|
|
713
807
|
<div className="sheet_table_top">
|
|
@@ -745,9 +839,16 @@ class DataValidation extends React.Component {
|
|
|
745
839
|
</Space>
|
|
746
840
|
<Space>
|
|
747
841
|
{!notExcelImport && (
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
842
|
+
<>
|
|
843
|
+
{
|
|
844
|
+
getTemplate && (
|
|
845
|
+
<Button onClick={getTemplate}>下载模板</Button>
|
|
846
|
+
)
|
|
847
|
+
}
|
|
848
|
+
<Upload {...uploadProps}>
|
|
849
|
+
<Button>导入</Button>
|
|
850
|
+
</Upload>
|
|
851
|
+
</>
|
|
751
852
|
)}
|
|
752
853
|
<Dropdown
|
|
753
854
|
trigger={['click']}
|
|
@@ -759,6 +860,16 @@ class DataValidation extends React.Component {
|
|
|
759
860
|
<DownOutlined />
|
|
760
861
|
</Button>
|
|
761
862
|
</Dropdown>
|
|
863
|
+
<Dropdown
|
|
864
|
+
trigger={['click']}
|
|
865
|
+
overlay={this.getSortList()}
|
|
866
|
+
placement="bottomRight"
|
|
867
|
+
>
|
|
868
|
+
<Button>
|
|
869
|
+
排序
|
|
870
|
+
<DownOutlined />
|
|
871
|
+
</Button>
|
|
872
|
+
</Dropdown>
|
|
762
873
|
|
|
763
874
|
{!notValid && <Button type="primary" onClick={this.resetData}>
|
|
764
875
|
识别
|
|
@@ -769,9 +880,13 @@ class DataValidation extends React.Component {
|
|
|
769
880
|
<div style={{ position: 'relative', height: '400px' }}>
|
|
770
881
|
<div id="luckysheet" style={luckyCss}></div>
|
|
771
882
|
</div>
|
|
772
|
-
{!this.props.notValid && <div className="sheet_table_footer">
|
|
883
|
+
{!this.props.notValid && !!totalSummary.total && <div className="sheet_table_footer">
|
|
773
884
|
<span className="sheet_table_footer_l">
|
|
774
|
-
共 {totalSummary.total}
|
|
885
|
+
共 {totalSummary.total} 条数据:
|
|
886
|
+
<span style={{color: 'green', marginLeft: '5px'}}> 成功条数:</span>{totalSummary.success}
|
|
887
|
+
<span style={{color: 'green', marginLeft: '5px'}}> 成功数量:</span>{totalSummary.totalSuccessQuantity || 0}
|
|
888
|
+
<span style={{color: 'red', marginLeft: '5px'}}> 失败条数:</span>{totalSummary.error || 0}
|
|
889
|
+
<span style={{color: 'red', marginLeft: '5px'}}> 失败数量:</span>{totalSummary.totalErrorQuantity || 0}
|
|
775
890
|
</span>
|
|
776
891
|
{!notValid && <Space className="sheet_table_footer_r">
|
|
777
892
|
<Checkbox
|
|
@@ -11,9 +11,9 @@ import { useDebounceFn } from 'ahooks';
|
|
|
11
11
|
import { Input, Button, Modal, ConfigProvider } from 'antd';
|
|
12
12
|
import './index.less';
|
|
13
13
|
|
|
14
|
-
const QueryMutipleInput = ({ onValueChange,onPressEnter }) => {
|
|
14
|
+
const QueryMutipleInput = ({ onValueChange,onPressEnter, value: initialValue }) => {
|
|
15
15
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
16
|
-
const [value, setValue] = useState(
|
|
16
|
+
const [value, setValue] = useState(initialValue);
|
|
17
17
|
const [popvalue, setPopValue] = useState('');
|
|
18
18
|
const { run } = useDebounceFn(
|
|
19
19
|
() => {
|
|
@@ -24,6 +24,14 @@ const QueryMutipleInput = ({ onValueChange,onPressEnter }) => {
|
|
|
24
24
|
},
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* 初始化参数
|
|
29
|
+
* 处理参数不展示和清空不同步的问题
|
|
30
|
+
*/
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
setValue(initialValue);
|
|
33
|
+
}, [initialValue]);
|
|
34
|
+
|
|
27
35
|
useEffect(() => {
|
|
28
36
|
setPopValue(value);
|
|
29
37
|
onValueChange(value);
|
|
@@ -67,6 +75,7 @@ const QueryMutipleInput = ({ onValueChange,onPressEnter }) => {
|
|
|
67
75
|
<Input
|
|
68
76
|
value={value}
|
|
69
77
|
onChange={outerChange}
|
|
78
|
+
allowClear
|
|
70
79
|
onBlur={(e) => {
|
|
71
80
|
formaData(e.target.value);
|
|
72
81
|
}}
|
|
@@ -91,6 +91,7 @@ const QueryMutipleSearchSelect = ({ onValueChange, requestConfig={}, selectProps
|
|
|
91
91
|
const getData = (params: any = {}, callback?: any) => {
|
|
92
92
|
if (!requestConfig) return;
|
|
93
93
|
if (!url) return;
|
|
94
|
+
if(!searchValue?.length) return; // 空值默认不查询
|
|
94
95
|
|
|
95
96
|
setFetching(true)
|
|
96
97
|
|
|
@@ -105,7 +106,7 @@ const QueryMutipleSearchSelect = ({ onValueChange, requestConfig={}, selectProps
|
|
|
105
106
|
let getRequest;
|
|
106
107
|
const methodName = method?.toLocaleLowerCase();
|
|
107
108
|
if(['post','patch','put'].includes(methodName)) {
|
|
108
|
-
getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
|
|
109
|
+
getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams),{headers: { ...extralHeaders }})
|
|
109
110
|
} else {
|
|
110
111
|
getRequest = request.get( `${url}${convertUrlQueryParams(queryParams)}`,{headers: { ...extralHeaders }})
|
|
111
112
|
}
|
|
@@ -249,6 +249,10 @@
|
|
|
249
249
|
&_wrapLeft1, &_wrapLeft2, &_wrapRight{
|
|
250
250
|
background: #fff;
|
|
251
251
|
width: calc(50% - 5px);
|
|
252
|
+
// 解决全选按钮位置偏左问题
|
|
253
|
+
.ant-table.ant-table-bordered > .ant-table-container > .ant-table-header > table .ant-table-thead .ant-table-selection .ant-checkbox-wrapper {
|
|
254
|
+
justify-content: center;
|
|
255
|
+
}
|
|
252
256
|
}
|
|
253
257
|
&_wrapLeft1 {
|
|
254
258
|
width: 100%;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
|
-
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag, Row, Col, Space, Tabs } from 'antd';
|
|
4
|
+
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag, Row, Col, Space, Tabs, Empty, DatePicker } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
6
6
|
import request from '@/utils/request';
|
|
7
7
|
import _, { escapeRegExp, isNil, values } from "lodash"
|
|
8
8
|
import './index.less';
|
|
9
9
|
import { BusinessSearchSelect, QueryMutipleInput, QueryMutipleSearchSelect } from '@/index';
|
|
10
|
-
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr,
|
|
10
|
+
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder, getShowStr, handleTableColumns } from './utils';
|
|
11
11
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
12
12
|
import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
|
|
13
13
|
import PropertySelector from '@/components/Business/PropertyModal';
|
|
14
|
+
import ItemPropertySelector from '@/components/Business/ItemPropertySelector';
|
|
14
15
|
|
|
15
16
|
const { Option } = Select;
|
|
16
17
|
|
|
@@ -52,6 +53,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
52
53
|
noOperate, // 级联禁用按钮设置字段
|
|
53
54
|
viewShowValueStr, // 详情展示值,不传展示组件处理的默认值
|
|
54
55
|
searchStartLength, // 默认不校验长度去搜索,如果配置了,则按照配置项长度进行处理搜索
|
|
56
|
+
isQuery = false, // 是否是查询条件
|
|
55
57
|
} = rCTemp || {};
|
|
56
58
|
const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,mappingTextShowTextField,init,extralHeaders,specialBracket,noNeedSplit,noOperate,viewShowValueStr,searchStartLength,...rCTemp};
|
|
57
59
|
const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
|
|
@@ -92,7 +94,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
92
94
|
});
|
|
93
95
|
return formValueList.filter((item: any) => item).length > 0
|
|
94
96
|
}
|
|
95
|
-
const sDisabled = disabled || (isHaveDependency && !!!isHaveDValue());
|
|
97
|
+
const sDisabled = disabled || (isHaveDependency && !!!isHaveDValue() && !isQuery);
|
|
96
98
|
|
|
97
99
|
const [items, setItems] = useState([]);
|
|
98
100
|
const [selectOpen, setSelectOpen] = useState(false);
|
|
@@ -230,14 +232,14 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
230
232
|
...fixedParam,
|
|
231
233
|
...params,
|
|
232
234
|
};
|
|
233
|
-
if (isNil(queryParams[selectParamsKey])) {
|
|
234
|
-
queryParams[selectParamsKey] = searchValue;
|
|
235
|
+
if (isNil(queryParams[selectParamsKey])&&searchValue?.length) {
|
|
236
|
+
queryParams[selectParamsKey] = searchValue?.trim?.();
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
let getRequest;
|
|
238
240
|
const methodName = method?.toLocaleLowerCase?.();
|
|
239
241
|
if(['post','patch','put'].includes(methodName)) {
|
|
240
|
-
getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
|
|
242
|
+
getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams), { headers: { ...extralHeaders }})
|
|
241
243
|
} else {
|
|
242
244
|
getRequest = request.get( `${url}${convertUrlQueryParams(queryParams)}`,{headers: { ...extralHeaders }})
|
|
243
245
|
}
|
|
@@ -335,8 +337,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
335
337
|
|
|
336
338
|
// 处理键盘事件
|
|
337
339
|
const handleKeyPress = (event) => {
|
|
338
|
-
if ((event.metaKey || event.ctrlKey) && (event.key === '
|
|
339
|
-
// ctrl +
|
|
340
|
+
if ((event.metaKey || event.ctrlKey) && (event.key === 'I' || event.keyCode == 73)) {
|
|
341
|
+
// ctrl + I 键 重置
|
|
340
342
|
onResetTable()
|
|
341
343
|
} else if (event.key === 'Enter' || event.keyCode == 13) {
|
|
342
344
|
// Enter 键 查询
|
|
@@ -456,7 +458,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
456
458
|
const refreshItems = () => {
|
|
457
459
|
// 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
|
|
458
460
|
if (fieldValToParam && ctx && fixedparamsDisabled) {
|
|
459
|
-
if (!!isHaveDValue()) {
|
|
461
|
+
if (!!isHaveDValue() || isQuery) {
|
|
460
462
|
run();
|
|
461
463
|
} else {
|
|
462
464
|
clearSelectDataSource();
|
|
@@ -467,7 +469,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
467
469
|
}
|
|
468
470
|
|
|
469
471
|
const onSearchChange = (v) => {
|
|
470
|
-
setSearchValue(v);
|
|
472
|
+
setSearchValue(v?.trim?.()||'');
|
|
471
473
|
if(!!searchStartLength && v?.length < searchStartLength) return;
|
|
472
474
|
refreshItems();
|
|
473
475
|
}
|
|
@@ -573,9 +575,10 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
573
575
|
}
|
|
574
576
|
};
|
|
575
577
|
|
|
576
|
-
const { emptyArray } = getFormRowInfo(list);
|
|
578
|
+
const { emptyArray, ColSpan } = getFormRowInfo(list, modalTableProps?.tableSearchColSpan);
|
|
577
579
|
const addKong = emptyArray?.map((i: any) =>({ type: 'kong'}))||[];
|
|
578
|
-
|
|
580
|
+
const searchList = modalTableProps?.noEmptySearchField ? list : list?.concat(addKong);
|
|
581
|
+
return searchList.map((i: any, index: number) => {
|
|
579
582
|
if(i?.type === 'kong') return <Col span={ColSpan} key={i}></Col>;
|
|
580
583
|
|
|
581
584
|
if (i?.type === 'select' || i?.field?.type === 'select') {
|
|
@@ -602,6 +605,25 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
602
605
|
)
|
|
603
606
|
}
|
|
604
607
|
|
|
608
|
+
if (i?.type === 'rangepicker' || i?.field?.type === 'rangepicker') {
|
|
609
|
+
return (
|
|
610
|
+
<Col span={ColSpan} key={i.name}>
|
|
611
|
+
<Form.Item name={i.name} label={i.label} key={i.name} initialValue={i?.initialValue ?? []}>
|
|
612
|
+
<DatePicker.RangePicker style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props} disabled={setDisabled(i.name)}></DatePicker.RangePicker>
|
|
613
|
+
</Form.Item>
|
|
614
|
+
</Col>
|
|
615
|
+
)
|
|
616
|
+
}
|
|
617
|
+
if (i?.type === 'datepicker' || i?.field?.type === 'datepicker') {
|
|
618
|
+
return (
|
|
619
|
+
<Col span={ColSpan} key={i.name}>
|
|
620
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
621
|
+
<DatePicker style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props} disabled={setDisabled(i.name)}></DatePicker>
|
|
622
|
+
</Form.Item>
|
|
623
|
+
</Col>
|
|
624
|
+
)
|
|
625
|
+
}
|
|
626
|
+
|
|
605
627
|
if (i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
606
628
|
return (
|
|
607
629
|
<Col span={ColSpan} key={i.name}>
|
|
@@ -635,6 +657,19 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
635
657
|
</Col>
|
|
636
658
|
);
|
|
637
659
|
}
|
|
660
|
+
if (i?.type === 'itemPropertySelector' || i?.field?.type === 'itemPropertySelector') {
|
|
661
|
+
return (
|
|
662
|
+
<Col span={ColSpan} key={i.name}>
|
|
663
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
664
|
+
<ItemPropertySelector
|
|
665
|
+
style={{ width: '100%' }}
|
|
666
|
+
placeholder="请选择"
|
|
667
|
+
{...i?.field?.props}
|
|
668
|
+
></ItemPropertySelector>
|
|
669
|
+
</Form.Item>
|
|
670
|
+
</Col>
|
|
671
|
+
);
|
|
672
|
+
}
|
|
638
673
|
if (i?.field?.type === 'multipleQuerySearchSelect') {
|
|
639
674
|
return (
|
|
640
675
|
<Col span={ColSpan} key={i.name}>
|
|
@@ -667,9 +702,15 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
667
702
|
return collapsed ? formItem(list?.slice(0,viCount)) : formItem(list)
|
|
668
703
|
}
|
|
669
704
|
|
|
705
|
+
const renderEmptyText = (text: string,x: string) => {
|
|
706
|
+
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={text} style={{ margin: `${x} 0px`}} />
|
|
707
|
+
}
|
|
708
|
+
|
|
670
709
|
const renderShowTable = (tableList, type) => {
|
|
671
710
|
const tableBoxHeighth = getTableHeigth(modalTableProps?.tableSearchForm);
|
|
672
|
-
const
|
|
711
|
+
const x = tableList?.length ? 82 : 28; // 无数据没有分页,有数据计算减去:分页 24+16*2+10 「高 + margin * 2 + paddingBottom 10 」
|
|
712
|
+
const oSY = `calc(100vh - ${tableBoxHeighth}px - ${x}px)`;
|
|
713
|
+
const mTB = `calc(50vh - ${tableBoxHeighth/2}px - ${x/2}px - 40px)`
|
|
673
714
|
return (
|
|
674
715
|
<div style={{ height: `calc(100vh - ${tableBoxHeighth}px)` }}>
|
|
675
716
|
<Table
|
|
@@ -681,14 +722,14 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
681
722
|
{...type=='noPage'?{
|
|
682
723
|
pagination: { ...initPagination,showSizeChanger: false },
|
|
683
724
|
locale: {
|
|
684
|
-
emptyText: '暂无已选结果',
|
|
725
|
+
emptyText: renderEmptyText('暂无已选结果',mTB),
|
|
685
726
|
}
|
|
686
727
|
}:{
|
|
687
728
|
pagination: tablePagination,
|
|
688
729
|
onChange: handleTableChange,
|
|
689
730
|
loading: fetching,
|
|
690
731
|
locale: {
|
|
691
|
-
emptyText: modalSearched? '
|
|
732
|
+
emptyText: modalSearched? renderEmptyText('匹配结果,请更换其他内容再试',mTB) : renderEmptyText('请输入搜索条件',mTB),
|
|
692
733
|
}
|
|
693
734
|
}}
|
|
694
735
|
rowKey={mappingValueField}
|
|
@@ -881,7 +922,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
881
922
|
<Modal
|
|
882
923
|
maskClosable={false}
|
|
883
924
|
destroyOnClose
|
|
884
|
-
width=
|
|
925
|
+
width={`calc(100% - 320px)`}
|
|
885
926
|
title={modalTableProps?.modalTableTitle}
|
|
886
927
|
visible={isModalVisible}
|
|
887
928
|
confirmLoading={confirmLoading}
|
|
@@ -916,14 +957,14 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
916
957
|
{renderFormItem(modalTableProps?.tableSearchForm)}
|
|
917
958
|
<Col span={6}>
|
|
918
959
|
<Space>
|
|
919
|
-
<Button key="search" type="primary" onClick={onSearchTable}>
|
|
960
|
+
<Button key="search" type="primary" onClick={onSearchTable} disabled={fetching}>
|
|
920
961
|
查询 Enter
|
|
921
962
|
</Button>
|
|
922
|
-
<Button key="reset" onClick={onResetTable}>
|
|
923
|
-
重置 ctrl+
|
|
963
|
+
<Button key="reset" onClick={onResetTable} disabled={fetching}>
|
|
964
|
+
重置 ctrl+I
|
|
924
965
|
</Button>
|
|
925
966
|
<div style={{position: 'absolute',top: 0,right: 0}}>
|
|
926
|
-
{hasMoreQueryFields(modalTableProps)
|
|
967
|
+
{hasMoreQueryFields(modalTableProps)
|
|
927
968
|
? <img onClick={() => {toggleCollapsed()}} style={{
|
|
928
969
|
cursor: 'pointer',
|
|
929
970
|
fontSize: '10px',
|
|
@@ -17,12 +17,13 @@ export const handleSourceName = (sName: any) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// ------------------------------------------处理样式相关--开始----------------------------------------
|
|
20
|
-
export const getFormRowInfo = (list: any) => {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
20
|
+
export const getFormRowInfo = (list: any, tableSearchColSpan: number) => {
|
|
21
|
+
const lastColumnsPerRow = tableSearchColSpan == 6 ? columnsPerRow : 3;
|
|
22
|
+
const totalRows = Math.ceil(list.length / lastColumnsPerRow); // 计算总行数
|
|
23
|
+
const lastRowColumns = (list.length+1) % lastColumnsPerRow; // 计算最后一行的实际列数
|
|
24
|
+
const emptySlots = lastRowColumns === 0 ? 0 : lastColumnsPerRow - lastRowColumns; // 计算最后一行的空位数
|
|
24
25
|
const emptyArray = new Array(emptySlots).fill(null); // 生成长度为 emptySlots 的数组
|
|
25
|
-
return { totalRows, emptyArray }
|
|
26
|
+
return { totalRows, emptyArray, ColSpan: tableSearchColSpan ?? ColSpan}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export const defaultVisibleFieldsCount = 7;
|
|
@@ -60,11 +61,11 @@ export const getRealStr = (oldSelect: any,newSelect: any, record: any) => {
|
|
|
60
61
|
return oldSelect?.length ? oldSelect.some((o: any) => o.value == record?.value) ? oldSelect.filter((s: any) => s.value != record?.value) : [...oldSelect,...newSelect] : newSelect;
|
|
61
62
|
}
|
|
62
63
|
export const getCurrentSRKs = (selectMode: any,labelInValue:boolean,value: any) => {
|
|
63
|
-
return selectMode ? (labelInValue ? value?.map((s: any)=> (s?.value||s)) : value) : (labelInValue ? value?.value&&[value?.value]||[] : value&&[value]||[])
|
|
64
|
+
return selectMode ? (labelInValue ? value?.map((s: any)=> (s?.value||s)) : (value||[])) : (labelInValue ? value?.value&&[value?.value]||[] : value&&[value]||[])
|
|
64
65
|
}
|
|
65
66
|
export const getRenderSource = (currentSRKs: any, items: any) => {
|
|
66
67
|
// 判空处理
|
|
67
|
-
if(!currentSRKs?.length) return items||[];
|
|
68
|
+
if(!currentSRKs || !currentSRKs?.length) return items||[];
|
|
68
69
|
|
|
69
70
|
// 创建映射对象 用于记录原始选中顺序
|
|
70
71
|
const orderMap = new Map<number, number>();
|
|
@@ -157,12 +158,14 @@ export const handleParams = (params: any) => {
|
|
|
157
158
|
delete params[key];
|
|
158
159
|
} else if (element && key.indexOf('*multiInput') >= 0) {
|
|
159
160
|
let name = '',
|
|
160
|
-
value = element['value'];
|
|
161
|
+
value = (element?.['value']||element)?.trim?.();
|
|
162
|
+
const searchKey = element?.['name']||key?.split('*multiInput')?.[0]
|
|
161
163
|
if (value.indexOf(',') >= 0) {
|
|
162
|
-
name = `qp-${
|
|
164
|
+
name = `qp-${searchKey}-in`;
|
|
163
165
|
} else {
|
|
164
|
-
name = `qp-${
|
|
166
|
+
name = `qp-${searchKey}-like`;
|
|
165
167
|
}
|
|
168
|
+
value = value?.trim?.();
|
|
166
169
|
params[name] = value;
|
|
167
170
|
delete params[key];
|
|
168
171
|
}
|
|
@@ -53,6 +53,7 @@ const TreeSearchSelect = (props: any) => {
|
|
|
53
53
|
: treeDataItem[resKeyValue[1]],
|
|
54
54
|
key: treeDataItem[resKeyValue[0]],
|
|
55
55
|
value: treeDataItem[resKeyValue[0]],
|
|
56
|
+
label: `${treeDataItem[resKeyValue[0]]}${treeDataItem[resKeyValue[1]]}`,
|
|
56
57
|
parentId: treeDataItem.parent,
|
|
57
58
|
data: { ...treeDataItem },
|
|
58
59
|
isLeaf: !haveChildren,
|
|
@@ -207,7 +208,7 @@ const TreeSearchSelect = (props: any) => {
|
|
|
207
208
|
labelInValue={labelInValue}
|
|
208
209
|
showArrow={showArrow}
|
|
209
210
|
showCheckedStrategy={showCheckedStrategy}
|
|
210
|
-
|
|
211
|
+
filterTreeNode={(inputValue, treeNode) => treeNode.props.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1}
|
|
211
212
|
treeDefaultExpandAll
|
|
212
213
|
multiple={multiple} // 支持多选(当设置 treeCheckable 时自动变为 true)
|
|
213
214
|
maxTagPlaceholder={maxTagPlaceholder}
|
|
@@ -155,6 +155,7 @@ export default function RenderCompItem(props:any){
|
|
|
155
155
|
onChange={(value) => {
|
|
156
156
|
handleEdit(ites.code, value);
|
|
157
157
|
}}
|
|
158
|
+
filterOption ={(input: any, option: any) => option?.text?.toLowerCase()?.indexOf(input?.toLowerCase()) >= 0}
|
|
158
159
|
>
|
|
159
160
|
{Object.keys(ites.enumeration).map((it) => (
|
|
160
161
|
<Select.Option key={it} value={it}>
|
|
@@ -170,7 +171,7 @@ export default function RenderCompItem(props:any){
|
|
|
170
171
|
<InnerSelect
|
|
171
172
|
disabled={disabled}
|
|
172
173
|
inputType={ites?.inputType}
|
|
173
|
-
defaultValue={ites
|
|
174
|
+
defaultValue={ites?.defaultValue}
|
|
174
175
|
styleCommon={styleCommon}
|
|
175
176
|
value={showValue(ites.code)}
|
|
176
177
|
onChange={(value) => {
|