@bit-sun/business-component 4.0.13-alpha.34 → 4.0.13-alpha.36
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/Functional/DataValidation/index.d.ts +11 -1
- package/dist/index.esm.js +143 -30
- package/dist/index.js +143 -30
- package/package.json +1 -1
- package/src/components/Functional/DataValidation/index.tsx +127 -19
- package/src/components/Functional/SearchSelect/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/utils.tsx +2 -2
|
@@ -5,16 +5,22 @@ declare class DataValidation extends React.Component {
|
|
|
5
5
|
onDragEnd(result: any): void;
|
|
6
6
|
getCount: () => {
|
|
7
7
|
total: any;
|
|
8
|
+
totalQuantity: any;
|
|
9
|
+
totalSuccessQuantity: any;
|
|
10
|
+
totalErrorQuantity: any;
|
|
8
11
|
error: any;
|
|
12
|
+
success: any;
|
|
9
13
|
};
|
|
10
14
|
setConfig: (data: any) => {
|
|
11
15
|
container: string;
|
|
12
|
-
showtoolbar: boolean;
|
|
13
16
|
hook: {
|
|
14
17
|
columnTitleCellRenderBefore: (columnAbc: any, postion: any, ctx: any) => void;
|
|
15
18
|
cellRenderBefore: (cell: any, postion: any, sheetFile: any, ctx: any) => void;
|
|
16
19
|
cellAllRenderBefore: (data: any, sheetFile: any, ctx: any) => void;
|
|
17
20
|
};
|
|
21
|
+
showtoolbarConfig: {
|
|
22
|
+
sortAndFilter: boolean;
|
|
23
|
+
};
|
|
18
24
|
data: {
|
|
19
25
|
name: string;
|
|
20
26
|
color: string;
|
|
@@ -132,6 +138,9 @@ declare class DataValidation extends React.Component {
|
|
|
132
138
|
failData: any;
|
|
133
139
|
};
|
|
134
140
|
getData: () => any;
|
|
141
|
+
naturalCompare: (a: any, b: any) => any;
|
|
142
|
+
customSort: (a: any, b: any) => any;
|
|
143
|
+
sortData: (sorterKey: string) => void;
|
|
135
144
|
resetData: () => void;
|
|
136
145
|
filterData: (type: string) => void;
|
|
137
146
|
toggleData: () => void;
|
|
@@ -139,6 +148,7 @@ declare class DataValidation extends React.Component {
|
|
|
139
148
|
errorChange: (e: any) => void;
|
|
140
149
|
menuList: React.JSX.Element;
|
|
141
150
|
leftMenu: React.JSX.Element;
|
|
151
|
+
getSortList: () => React.JSX.Element;
|
|
142
152
|
getSheetMap: () => {};
|
|
143
153
|
importExcelToLuckySheet: (resultData: any) => void;
|
|
144
154
|
render(): React.JSX.Element;
|
package/dist/index.esm.js
CHANGED
|
@@ -2658,11 +2658,34 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2658
2658
|
_this = _callSuper(this, DataValidation, [props]);
|
|
2659
2659
|
// this.props.onRef(this);
|
|
2660
2660
|
_this.getCount = function () {
|
|
2661
|
-
var
|
|
2661
|
+
var _this$state$resultDat = _this.state.resultData,
|
|
2662
|
+
resultData = _this$state$resultDat === void 0 ? [] : _this$state$resultDat;
|
|
2663
|
+
var totalQuantity = resultData.reduce(function (total, item) {
|
|
2664
|
+
total += Number(item.quantity || 0);
|
|
2665
|
+
return total;
|
|
2666
|
+
}, 0);
|
|
2667
|
+
var totalSuccessQuantity = resultData.filter(function (item) {
|
|
2668
|
+
return item.flag;
|
|
2669
|
+
}).reduce(function (total, item) {
|
|
2670
|
+
total += Number(item.quantity || 0);
|
|
2671
|
+
return total;
|
|
2672
|
+
}, 0);
|
|
2673
|
+
var totalErrorQuantity = resultData.filter(function (item) {
|
|
2674
|
+
return !item.flag;
|
|
2675
|
+
}).reduce(function (total, item) {
|
|
2676
|
+
total += Number(item.quantity || 0);
|
|
2677
|
+
return total;
|
|
2678
|
+
}, 0);
|
|
2662
2679
|
return {
|
|
2663
2680
|
total: resultData.length,
|
|
2681
|
+
totalQuantity: totalQuantity,
|
|
2682
|
+
totalSuccessQuantity: totalSuccessQuantity,
|
|
2683
|
+
totalErrorQuantity: totalErrorQuantity,
|
|
2664
2684
|
error: resultData.filter(function (item) {
|
|
2665
2685
|
return !item.flag;
|
|
2686
|
+
}).length,
|
|
2687
|
+
success: resultData.filter(function (item) {
|
|
2688
|
+
return item.flag;
|
|
2666
2689
|
}).length
|
|
2667
2690
|
};
|
|
2668
2691
|
};
|
|
@@ -2671,7 +2694,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2671
2694
|
var notValid = _this.props.notValid;
|
|
2672
2695
|
return {
|
|
2673
2696
|
container: 'luckysheet',
|
|
2674
|
-
showtoolbar: false,
|
|
2697
|
+
// showtoolbar: false,
|
|
2675
2698
|
hook: {
|
|
2676
2699
|
columnTitleCellRenderBefore: function columnTitleCellRenderBefore(columnAbc, postion, ctx) {
|
|
2677
2700
|
if (columnAbc.name) {
|
|
@@ -2708,17 +2731,9 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2708
2731
|
// console.info(data,sheetFile,ctx)
|
|
2709
2732
|
}
|
|
2710
2733
|
},
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
// currencyFormat: false, //货币格式
|
|
2715
|
-
// percentageFormat: false, //百分比格式
|
|
2716
|
-
// numberDecrease: false, // '减少小数位数'
|
|
2717
|
-
// numberIncrease: false, // '增加小数位数
|
|
2718
|
-
// moreFormats: false, // '更多格式'
|
|
2719
|
-
// font: true, // '字体'
|
|
2720
|
-
// fontSize: true, // '字号大小'
|
|
2721
|
-
// },
|
|
2734
|
+
showtoolbarConfig: {
|
|
2735
|
+
sortAndFilter: true
|
|
2736
|
+
},
|
|
2722
2737
|
data: [_defineProperty(_defineProperty({
|
|
2723
2738
|
name: 'Cell',
|
|
2724
2739
|
color: '',
|
|
@@ -2842,7 +2857,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2842
2857
|
showsheetbar: false,
|
|
2843
2858
|
optionstate: false,
|
|
2844
2859
|
showstatisticBarConfig: {
|
|
2845
|
-
count:
|
|
2860
|
+
count: true,
|
|
2846
2861
|
view: false,
|
|
2847
2862
|
zoom: false // 缩放
|
|
2848
2863
|
},
|
|
@@ -2897,6 +2912,44 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2897
2912
|
return _.compact(Object.values(d)).length;
|
|
2898
2913
|
});
|
|
2899
2914
|
};
|
|
2915
|
+
_this.naturalCompare = function (a, b) {
|
|
2916
|
+
var checkNumber = function checkNumber(value) {
|
|
2917
|
+
return /^[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$/.test(value.trim());
|
|
2918
|
+
};
|
|
2919
|
+
if (checkNumber(a) && checkNumber(b)) {
|
|
2920
|
+
return Number(a) - Number(b);
|
|
2921
|
+
}
|
|
2922
|
+
// 优先处理 "通过" 的情况
|
|
2923
|
+
if (a === "通过" && b !== "通过") return -1;
|
|
2924
|
+
if (b === "通过" && a !== "通过") return 1;
|
|
2925
|
+
return a.localeCompare(b);
|
|
2926
|
+
};
|
|
2927
|
+
_this.customSort = function (a, b) {
|
|
2928
|
+
// 处理空值
|
|
2929
|
+
var aEmpty = !a;
|
|
2930
|
+
var bEmpty = !b;
|
|
2931
|
+
if (aEmpty && bEmpty) return 0;
|
|
2932
|
+
if (aEmpty) return 1; // a空,排后面
|
|
2933
|
+
if (bEmpty) return -1; // b空,a排前面
|
|
2934
|
+
return _this.naturalCompare(a, b);
|
|
2935
|
+
};
|
|
2936
|
+
_this.sortData = function (sorterKey) {
|
|
2937
|
+
var sheetData = luckysheet.getSheetData();
|
|
2938
|
+
var newData = JSON.parse(JSON.stringify(sheetData)).sort(function (cur, prev) {
|
|
2939
|
+
var _cur$cellIndex, _prev$cellIndex;
|
|
2940
|
+
var cellIndex = itemsTemp.findIndex(function (item) {
|
|
2941
|
+
return item.code === sorterKey;
|
|
2942
|
+
});
|
|
2943
|
+
if (sorterKey === 'checkresult') {
|
|
2944
|
+
cellIndex = itemsTemp.length;
|
|
2945
|
+
}
|
|
2946
|
+
return _this.customSort((_cur$cellIndex = cur[cellIndex]) === null || _cur$cellIndex === void 0 ? void 0 : _cur$cellIndex.v, (_prev$cellIndex = prev[cellIndex]) === null || _prev$cellIndex === void 0 ? void 0 : _prev$cellIndex.v);
|
|
2947
|
+
});
|
|
2948
|
+
luckysheet.create(_this.setConfig(luckysheet.transToCellData(newData)));
|
|
2949
|
+
_this.setState({
|
|
2950
|
+
data: luckysheet.transToCellData(newData)
|
|
2951
|
+
});
|
|
2952
|
+
};
|
|
2900
2953
|
_this.resetData = function () {
|
|
2901
2954
|
var _customerColumnsMappi;
|
|
2902
2955
|
var _this$props = _this.props,
|
|
@@ -3079,10 +3132,43 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3079
3132
|
});
|
|
3080
3133
|
}), provided.placeholder);
|
|
3081
3134
|
}))));
|
|
3135
|
+
_this.getSortList = function () {
|
|
3136
|
+
var _this$props2, _this$props2$customer;
|
|
3137
|
+
var sortList = [];
|
|
3138
|
+
if ((_this$props2 = _this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$customer = _this$props2.customerColumnsMapping) === null || _this$props2$customer === void 0 ? void 0 : _this$props2$customer.length) {
|
|
3139
|
+
var _this$props3, _this$props3$customer;
|
|
3140
|
+
sortList = ((_this$props3 = _this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$customer = _this$props3.customerColumnsMapping) === null || _this$props3$customer === void 0 ? void 0 : _this$props3$customer.map(function (item, index) {
|
|
3141
|
+
return createItem('item-0', index, item.title, item.name, _this.format);
|
|
3142
|
+
})) || [];
|
|
3143
|
+
} else {
|
|
3144
|
+
var _this$props4, _this$props4$columns;
|
|
3145
|
+
sortList = ((_this$props4 = _this.props) === null || _this$props4 === void 0 ? void 0 : (_this$props4$columns = _this$props4.columns) === null || _this$props4$columns === void 0 ? void 0 : _this$props4$columns.map(function (item, index) {
|
|
3146
|
+
if (!mapping.get(item)) throw Error("".concat(item, " is not in DataValidation component, please fix this error"));
|
|
3147
|
+
return createItem('item-0', index, mapping.get(item), item, _this.format);
|
|
3148
|
+
})) || [];
|
|
3149
|
+
}
|
|
3150
|
+
return /*#__PURE__*/React$1.createElement(Menu, null, (sortList || []).map(function (item, index) {
|
|
3151
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Menu.Item, {
|
|
3152
|
+
key: index,
|
|
3153
|
+
className: "sheet_table-menu_item_text"
|
|
3154
|
+
}, /*#__PURE__*/React$1.createElement("a", {
|
|
3155
|
+
onClick: function onClick() {
|
|
3156
|
+
return _this.sortData(item.code);
|
|
3157
|
+
}
|
|
3158
|
+
}, item.content)), /*#__PURE__*/React$1.createElement(Menu.Divider, null));
|
|
3159
|
+
}), /*#__PURE__*/React$1.createElement(Menu.Item, {
|
|
3160
|
+
key: "checkresult",
|
|
3161
|
+
className: "sheet_table-menu_item_text"
|
|
3162
|
+
}, /*#__PURE__*/React$1.createElement("a", {
|
|
3163
|
+
onClick: function onClick() {
|
|
3164
|
+
return _this.sortData('checkresult');
|
|
3165
|
+
}
|
|
3166
|
+
}, "\u6821\u9A8C\u7ED3\u679C")));
|
|
3167
|
+
};
|
|
3082
3168
|
_this.getSheetMap = function () {
|
|
3083
|
-
var _this$
|
|
3084
|
-
customerColumnsMapping = _this$
|
|
3085
|
-
columns = _this$
|
|
3169
|
+
var _this$props5 = _this.props,
|
|
3170
|
+
customerColumnsMapping = _this$props5.customerColumnsMapping,
|
|
3171
|
+
columns = _this$props5.columns;
|
|
3086
3172
|
var sheetData = customerColumnsMapping || columns.map(function (s) {
|
|
3087
3173
|
return {
|
|
3088
3174
|
title: mapping.get(s),
|
|
@@ -3173,12 +3259,12 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3173
3259
|
key: "render",
|
|
3174
3260
|
value: function render() {
|
|
3175
3261
|
var errorListCheck = this.state.errorListCheck;
|
|
3176
|
-
var _this$
|
|
3177
|
-
title = _this$
|
|
3178
|
-
notValid = _this$
|
|
3179
|
-
notExcelImport = _this$
|
|
3180
|
-
excelImportConfig = _this$
|
|
3181
|
-
getTemplate = _this$
|
|
3262
|
+
var _this$props6 = this.props,
|
|
3263
|
+
title = _this$props6.title,
|
|
3264
|
+
notValid = _this$props6.notValid,
|
|
3265
|
+
notExcelImport = _this$props6.notExcelImport,
|
|
3266
|
+
excelImportConfig = _this$props6.excelImportConfig,
|
|
3267
|
+
getTemplate = _this$props6.getTemplate;
|
|
3182
3268
|
var _ref5 = excelImportConfig || {},
|
|
3183
3269
|
size = _ref5.size,
|
|
3184
3270
|
accept = _ref5.accept,
|
|
@@ -3234,6 +3320,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3234
3320
|
left: '0px',
|
|
3235
3321
|
top: '0px'
|
|
3236
3322
|
};
|
|
3323
|
+
console.log('itemsTemp', itemsTemp);
|
|
3237
3324
|
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("div", {
|
|
3238
3325
|
className: "sheet_table_top"
|
|
3239
3326
|
}, /*#__PURE__*/React$1.createElement(Space, null, /*#__PURE__*/React$1.createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React$1.createElement(Dropdown, {
|
|
@@ -3252,7 +3339,11 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3252
3339
|
trigger: ['click'],
|
|
3253
3340
|
overlay: this.menuList,
|
|
3254
3341
|
placement: "bottomRight"
|
|
3255
|
-
}, /*#__PURE__*/React$1.createElement(Button, null, "\u6E05\u7A7A", /*#__PURE__*/React$1.createElement(DownOutlined, null))),
|
|
3342
|
+
}, /*#__PURE__*/React$1.createElement(Button, null, "\u6E05\u7A7A", /*#__PURE__*/React$1.createElement(DownOutlined, null))), /*#__PURE__*/React$1.createElement(Dropdown, {
|
|
3343
|
+
trigger: ['click'],
|
|
3344
|
+
overlay: this.getSortList(),
|
|
3345
|
+
placement: "bottomRight"
|
|
3346
|
+
}, /*#__PURE__*/React$1.createElement(Button, null, "\u6392\u5E8F", /*#__PURE__*/React$1.createElement(DownOutlined, null))), !notValid && /*#__PURE__*/React$1.createElement(Button, {
|
|
3256
3347
|
type: "primary",
|
|
3257
3348
|
onClick: this.resetData
|
|
3258
3349
|
}, "\u8BC6\u522B"))), /*#__PURE__*/React$1.createElement("div", {
|
|
@@ -3263,11 +3354,31 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3263
3354
|
}, /*#__PURE__*/React$1.createElement("div", {
|
|
3264
3355
|
id: "luckysheet",
|
|
3265
3356
|
style: luckyCss
|
|
3266
|
-
})), !this.props.notValid && /*#__PURE__*/React$1.createElement("div", {
|
|
3357
|
+
})), !this.props.notValid && !!totalSummary.total && /*#__PURE__*/React$1.createElement("div", {
|
|
3267
3358
|
className: "sheet_table_footer"
|
|
3268
3359
|
}, /*#__PURE__*/React$1.createElement("span", {
|
|
3269
3360
|
className: "sheet_table_footer_l"
|
|
3270
|
-
}, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E
|
|
3361
|
+
}, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E\uFF1A", /*#__PURE__*/React$1.createElement("span", {
|
|
3362
|
+
style: {
|
|
3363
|
+
color: 'green',
|
|
3364
|
+
marginLeft: '5px'
|
|
3365
|
+
}
|
|
3366
|
+
}, " \u6210\u529F\u6761\u6570\uFF1A"), totalSummary.success, /*#__PURE__*/React$1.createElement("span", {
|
|
3367
|
+
style: {
|
|
3368
|
+
color: 'green',
|
|
3369
|
+
marginLeft: '5px'
|
|
3370
|
+
}
|
|
3371
|
+
}, " \u6210\u529F\u6570\u91CF\uFF1A"), totalSummary.totalSuccessQuantity || 0, /*#__PURE__*/React$1.createElement("span", {
|
|
3372
|
+
style: {
|
|
3373
|
+
color: 'red',
|
|
3374
|
+
marginLeft: '5px'
|
|
3375
|
+
}
|
|
3376
|
+
}, " \u5931\u8D25\u6761\u6570\uFF1A"), totalSummary.error || 0, /*#__PURE__*/React$1.createElement("span", {
|
|
3377
|
+
style: {
|
|
3378
|
+
color: 'red',
|
|
3379
|
+
marginLeft: '5px'
|
|
3380
|
+
}
|
|
3381
|
+
}, " \u5931\u8D25\u6570\u91CF\uFF1A"), totalSummary.totalErrorQuantity || 0), !notValid && /*#__PURE__*/React$1.createElement(Space, {
|
|
3271
3382
|
className: "sheet_table_footer_r"
|
|
3272
3383
|
}, /*#__PURE__*/React$1.createElement(Checkbox, {
|
|
3273
3384
|
checked: errorListCheck,
|
|
@@ -4151,11 +4262,11 @@ var getRealStr = function getRealStr(oldSelect, newSelect, record) {
|
|
|
4151
4262
|
var getCurrentSRKs = function getCurrentSRKs(selectMode, labelInValue, value) {
|
|
4152
4263
|
return selectMode ? labelInValue ? value === null || value === void 0 ? void 0 : value.map(function (s) {
|
|
4153
4264
|
return (s === null || s === void 0 ? void 0 : s.value) || s;
|
|
4154
|
-
}) : value : labelInValue ? (value === null || value === void 0 ? void 0 : value.value) && [value === null || value === void 0 ? void 0 : value.value] || [] : value && [value] || [];
|
|
4265
|
+
}) : value || [] : labelInValue ? (value === null || value === void 0 ? void 0 : value.value) && [value === null || value === void 0 ? void 0 : value.value] || [] : value && [value] || [];
|
|
4155
4266
|
};
|
|
4156
4267
|
var getRenderSource = function getRenderSource(currentSRKs, items) {
|
|
4157
4268
|
// 判空处理
|
|
4158
|
-
if (!(currentSRKs === null || currentSRKs === void 0 ? void 0 : currentSRKs.length)) return items || [];
|
|
4269
|
+
if (!currentSRKs || !(currentSRKs === null || currentSRKs === void 0 ? void 0 : currentSRKs.length)) return items || [];
|
|
4159
4270
|
// 创建映射对象 用于记录原始选中顺序
|
|
4160
4271
|
var orderMap = new Map();
|
|
4161
4272
|
currentSRKs === null || currentSRKs === void 0 ? void 0 : currentSRKs.forEach(function (value, index) {
|
|
@@ -5337,7 +5448,9 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
5337
5448
|
noNeedSplit = _ref$noNeedSplit === void 0 ? false : _ref$noNeedSplit,
|
|
5338
5449
|
noOperate = _ref.noOperate,
|
|
5339
5450
|
viewShowValueStr = _ref.viewShowValueStr,
|
|
5340
|
-
searchStartLength = _ref.searchStartLength
|
|
5451
|
+
searchStartLength = _ref.searchStartLength,
|
|
5452
|
+
_ref$isQuery = _ref.isQuery,
|
|
5453
|
+
isQuery = _ref$isQuery === void 0 ? false : _ref$isQuery;
|
|
5341
5454
|
var requestConfig = _objectSpread2({
|
|
5342
5455
|
url: url,
|
|
5343
5456
|
method: method,
|
|
@@ -5404,7 +5517,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
5404
5517
|
return item;
|
|
5405
5518
|
}).length > 0;
|
|
5406
5519
|
};
|
|
5407
|
-
var sDisabled = disabled || isHaveDependency && !!!isHaveDValue();
|
|
5520
|
+
var sDisabled = disabled || isHaveDependency && !!!isHaveDValue() && !isQuery;
|
|
5408
5521
|
var _useState = useState([]),
|
|
5409
5522
|
_useState2 = _slicedToArray(_useState, 2),
|
|
5410
5523
|
items = _useState2[0],
|
package/dist/index.js
CHANGED
|
@@ -2681,11 +2681,34 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2681
2681
|
_this = _callSuper(this, DataValidation, [props]);
|
|
2682
2682
|
// this.props.onRef(this);
|
|
2683
2683
|
_this.getCount = function () {
|
|
2684
|
-
var
|
|
2684
|
+
var _this$state$resultDat = _this.state.resultData,
|
|
2685
|
+
resultData = _this$state$resultDat === void 0 ? [] : _this$state$resultDat;
|
|
2686
|
+
var totalQuantity = resultData.reduce(function (total, item) {
|
|
2687
|
+
total += Number(item.quantity || 0);
|
|
2688
|
+
return total;
|
|
2689
|
+
}, 0);
|
|
2690
|
+
var totalSuccessQuantity = resultData.filter(function (item) {
|
|
2691
|
+
return item.flag;
|
|
2692
|
+
}).reduce(function (total, item) {
|
|
2693
|
+
total += Number(item.quantity || 0);
|
|
2694
|
+
return total;
|
|
2695
|
+
}, 0);
|
|
2696
|
+
var totalErrorQuantity = resultData.filter(function (item) {
|
|
2697
|
+
return !item.flag;
|
|
2698
|
+
}).reduce(function (total, item) {
|
|
2699
|
+
total += Number(item.quantity || 0);
|
|
2700
|
+
return total;
|
|
2701
|
+
}, 0);
|
|
2685
2702
|
return {
|
|
2686
2703
|
total: resultData.length,
|
|
2704
|
+
totalQuantity: totalQuantity,
|
|
2705
|
+
totalSuccessQuantity: totalSuccessQuantity,
|
|
2706
|
+
totalErrorQuantity: totalErrorQuantity,
|
|
2687
2707
|
error: resultData.filter(function (item) {
|
|
2688
2708
|
return !item.flag;
|
|
2709
|
+
}).length,
|
|
2710
|
+
success: resultData.filter(function (item) {
|
|
2711
|
+
return item.flag;
|
|
2689
2712
|
}).length
|
|
2690
2713
|
};
|
|
2691
2714
|
};
|
|
@@ -2694,7 +2717,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2694
2717
|
var notValid = _this.props.notValid;
|
|
2695
2718
|
return {
|
|
2696
2719
|
container: 'luckysheet',
|
|
2697
|
-
showtoolbar: false,
|
|
2720
|
+
// showtoolbar: false,
|
|
2698
2721
|
hook: {
|
|
2699
2722
|
columnTitleCellRenderBefore: function columnTitleCellRenderBefore(columnAbc, postion, ctx) {
|
|
2700
2723
|
if (columnAbc.name) {
|
|
@@ -2731,17 +2754,9 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2731
2754
|
// console.info(data,sheetFile,ctx)
|
|
2732
2755
|
}
|
|
2733
2756
|
},
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
// currencyFormat: false, //货币格式
|
|
2738
|
-
// percentageFormat: false, //百分比格式
|
|
2739
|
-
// numberDecrease: false, // '减少小数位数'
|
|
2740
|
-
// numberIncrease: false, // '增加小数位数
|
|
2741
|
-
// moreFormats: false, // '更多格式'
|
|
2742
|
-
// font: true, // '字体'
|
|
2743
|
-
// fontSize: true, // '字号大小'
|
|
2744
|
-
// },
|
|
2757
|
+
showtoolbarConfig: {
|
|
2758
|
+
sortAndFilter: true
|
|
2759
|
+
},
|
|
2745
2760
|
data: [_defineProperty(_defineProperty({
|
|
2746
2761
|
name: 'Cell',
|
|
2747
2762
|
color: '',
|
|
@@ -2865,7 +2880,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2865
2880
|
showsheetbar: false,
|
|
2866
2881
|
optionstate: false,
|
|
2867
2882
|
showstatisticBarConfig: {
|
|
2868
|
-
count:
|
|
2883
|
+
count: true,
|
|
2869
2884
|
view: false,
|
|
2870
2885
|
zoom: false // 缩放
|
|
2871
2886
|
},
|
|
@@ -2920,6 +2935,44 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2920
2935
|
return ___default['default'].compact(Object.values(d)).length;
|
|
2921
2936
|
});
|
|
2922
2937
|
};
|
|
2938
|
+
_this.naturalCompare = function (a, b) {
|
|
2939
|
+
var checkNumber = function checkNumber(value) {
|
|
2940
|
+
return /^[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$/.test(value.trim());
|
|
2941
|
+
};
|
|
2942
|
+
if (checkNumber(a) && checkNumber(b)) {
|
|
2943
|
+
return Number(a) - Number(b);
|
|
2944
|
+
}
|
|
2945
|
+
// 优先处理 "通过" 的情况
|
|
2946
|
+
if (a === "通过" && b !== "通过") return -1;
|
|
2947
|
+
if (b === "通过" && a !== "通过") return 1;
|
|
2948
|
+
return a.localeCompare(b);
|
|
2949
|
+
};
|
|
2950
|
+
_this.customSort = function (a, b) {
|
|
2951
|
+
// 处理空值
|
|
2952
|
+
var aEmpty = !a;
|
|
2953
|
+
var bEmpty = !b;
|
|
2954
|
+
if (aEmpty && bEmpty) return 0;
|
|
2955
|
+
if (aEmpty) return 1; // a空,排后面
|
|
2956
|
+
if (bEmpty) return -1; // b空,a排前面
|
|
2957
|
+
return _this.naturalCompare(a, b);
|
|
2958
|
+
};
|
|
2959
|
+
_this.sortData = function (sorterKey) {
|
|
2960
|
+
var sheetData = luckysheet.getSheetData();
|
|
2961
|
+
var newData = JSON.parse(JSON.stringify(sheetData)).sort(function (cur, prev) {
|
|
2962
|
+
var _cur$cellIndex, _prev$cellIndex;
|
|
2963
|
+
var cellIndex = itemsTemp.findIndex(function (item) {
|
|
2964
|
+
return item.code === sorterKey;
|
|
2965
|
+
});
|
|
2966
|
+
if (sorterKey === 'checkresult') {
|
|
2967
|
+
cellIndex = itemsTemp.length;
|
|
2968
|
+
}
|
|
2969
|
+
return _this.customSort((_cur$cellIndex = cur[cellIndex]) === null || _cur$cellIndex === void 0 ? void 0 : _cur$cellIndex.v, (_prev$cellIndex = prev[cellIndex]) === null || _prev$cellIndex === void 0 ? void 0 : _prev$cellIndex.v);
|
|
2970
|
+
});
|
|
2971
|
+
luckysheet.create(_this.setConfig(luckysheet.transToCellData(newData)));
|
|
2972
|
+
_this.setState({
|
|
2973
|
+
data: luckysheet.transToCellData(newData)
|
|
2974
|
+
});
|
|
2975
|
+
};
|
|
2923
2976
|
_this.resetData = function () {
|
|
2924
2977
|
var _customerColumnsMappi;
|
|
2925
2978
|
var _this$props = _this.props,
|
|
@@ -3102,10 +3155,43 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3102
3155
|
});
|
|
3103
3156
|
}), provided.placeholder);
|
|
3104
3157
|
}))));
|
|
3158
|
+
_this.getSortList = function () {
|
|
3159
|
+
var _this$props2, _this$props2$customer;
|
|
3160
|
+
var sortList = [];
|
|
3161
|
+
if ((_this$props2 = _this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$customer = _this$props2.customerColumnsMapping) === null || _this$props2$customer === void 0 ? void 0 : _this$props2$customer.length) {
|
|
3162
|
+
var _this$props3, _this$props3$customer;
|
|
3163
|
+
sortList = ((_this$props3 = _this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$customer = _this$props3.customerColumnsMapping) === null || _this$props3$customer === void 0 ? void 0 : _this$props3$customer.map(function (item, index) {
|
|
3164
|
+
return createItem('item-0', index, item.title, item.name, _this.format);
|
|
3165
|
+
})) || [];
|
|
3166
|
+
} else {
|
|
3167
|
+
var _this$props4, _this$props4$columns;
|
|
3168
|
+
sortList = ((_this$props4 = _this.props) === null || _this$props4 === void 0 ? void 0 : (_this$props4$columns = _this$props4.columns) === null || _this$props4$columns === void 0 ? void 0 : _this$props4$columns.map(function (item, index) {
|
|
3169
|
+
if (!mapping.get(item)) throw Error("".concat(item, " is not in DataValidation component, please fix this error"));
|
|
3170
|
+
return createItem('item-0', index, mapping.get(item), item, _this.format);
|
|
3171
|
+
})) || [];
|
|
3172
|
+
}
|
|
3173
|
+
return /*#__PURE__*/React__default['default'].createElement(antd.Menu, null, (sortList || []).map(function (item, index) {
|
|
3174
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
3175
|
+
key: index,
|
|
3176
|
+
className: "sheet_table-menu_item_text"
|
|
3177
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
3178
|
+
onClick: function onClick() {
|
|
3179
|
+
return _this.sortData(item.code);
|
|
3180
|
+
}
|
|
3181
|
+
}, item.content)), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Divider, null));
|
|
3182
|
+
}), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
3183
|
+
key: "checkresult",
|
|
3184
|
+
className: "sheet_table-menu_item_text"
|
|
3185
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
3186
|
+
onClick: function onClick() {
|
|
3187
|
+
return _this.sortData('checkresult');
|
|
3188
|
+
}
|
|
3189
|
+
}, "\u6821\u9A8C\u7ED3\u679C")));
|
|
3190
|
+
};
|
|
3105
3191
|
_this.getSheetMap = function () {
|
|
3106
|
-
var _this$
|
|
3107
|
-
customerColumnsMapping = _this$
|
|
3108
|
-
columns = _this$
|
|
3192
|
+
var _this$props5 = _this.props,
|
|
3193
|
+
customerColumnsMapping = _this$props5.customerColumnsMapping,
|
|
3194
|
+
columns = _this$props5.columns;
|
|
3109
3195
|
var sheetData = customerColumnsMapping || columns.map(function (s) {
|
|
3110
3196
|
return {
|
|
3111
3197
|
title: mapping.get(s),
|
|
@@ -3196,12 +3282,12 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3196
3282
|
key: "render",
|
|
3197
3283
|
value: function render() {
|
|
3198
3284
|
var errorListCheck = this.state.errorListCheck;
|
|
3199
|
-
var _this$
|
|
3200
|
-
title = _this$
|
|
3201
|
-
notValid = _this$
|
|
3202
|
-
notExcelImport = _this$
|
|
3203
|
-
excelImportConfig = _this$
|
|
3204
|
-
getTemplate = _this$
|
|
3285
|
+
var _this$props6 = this.props,
|
|
3286
|
+
title = _this$props6.title,
|
|
3287
|
+
notValid = _this$props6.notValid,
|
|
3288
|
+
notExcelImport = _this$props6.notExcelImport,
|
|
3289
|
+
excelImportConfig = _this$props6.excelImportConfig,
|
|
3290
|
+
getTemplate = _this$props6.getTemplate;
|
|
3205
3291
|
var _ref5 = excelImportConfig || {},
|
|
3206
3292
|
size = _ref5.size,
|
|
3207
3293
|
accept = _ref5.accept,
|
|
@@ -3257,6 +3343,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3257
3343
|
left: '0px',
|
|
3258
3344
|
top: '0px'
|
|
3259
3345
|
};
|
|
3346
|
+
console.log('itemsTemp', itemsTemp);
|
|
3260
3347
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
3261
3348
|
className: "sheet_table_top"
|
|
3262
3349
|
}, /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
|
|
@@ -3275,7 +3362,11 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3275
3362
|
trigger: ['click'],
|
|
3276
3363
|
overlay: this.menuList,
|
|
3277
3364
|
placement: "bottomRight"
|
|
3278
|
-
}, /*#__PURE__*/React__default['default'].createElement(antd.Button, null, "\u6E05\u7A7A", /*#__PURE__*/React__default['default'].createElement(icons.DownOutlined, null))),
|
|
3365
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Button, null, "\u6E05\u7A7A", /*#__PURE__*/React__default['default'].createElement(icons.DownOutlined, null))), /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
|
|
3366
|
+
trigger: ['click'],
|
|
3367
|
+
overlay: this.getSortList(),
|
|
3368
|
+
placement: "bottomRight"
|
|
3369
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Button, null, "\u6392\u5E8F", /*#__PURE__*/React__default['default'].createElement(icons.DownOutlined, null))), !notValid && /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
3279
3370
|
type: "primary",
|
|
3280
3371
|
onClick: this.resetData
|
|
3281
3372
|
}, "\u8BC6\u522B"))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -3286,11 +3377,31 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3286
3377
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
3287
3378
|
id: "luckysheet",
|
|
3288
3379
|
style: luckyCss
|
|
3289
|
-
})), !this.props.notValid && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
3380
|
+
})), !this.props.notValid && !!totalSummary.total && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
3290
3381
|
className: "sheet_table_footer"
|
|
3291
3382
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
3292
3383
|
className: "sheet_table_footer_l"
|
|
3293
|
-
}, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E
|
|
3384
|
+
}, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E\uFF1A", /*#__PURE__*/React__default['default'].createElement("span", {
|
|
3385
|
+
style: {
|
|
3386
|
+
color: 'green',
|
|
3387
|
+
marginLeft: '5px'
|
|
3388
|
+
}
|
|
3389
|
+
}, " \u6210\u529F\u6761\u6570\uFF1A"), totalSummary.success, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
3390
|
+
style: {
|
|
3391
|
+
color: 'green',
|
|
3392
|
+
marginLeft: '5px'
|
|
3393
|
+
}
|
|
3394
|
+
}, " \u6210\u529F\u6570\u91CF\uFF1A"), totalSummary.totalSuccessQuantity || 0, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
3395
|
+
style: {
|
|
3396
|
+
color: 'red',
|
|
3397
|
+
marginLeft: '5px'
|
|
3398
|
+
}
|
|
3399
|
+
}, " \u5931\u8D25\u6761\u6570\uFF1A"), totalSummary.error || 0, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
3400
|
+
style: {
|
|
3401
|
+
color: 'red',
|
|
3402
|
+
marginLeft: '5px'
|
|
3403
|
+
}
|
|
3404
|
+
}, " \u5931\u8D25\u6570\u91CF\uFF1A"), totalSummary.totalErrorQuantity || 0), !notValid && /*#__PURE__*/React__default['default'].createElement(antd.Space, {
|
|
3294
3405
|
className: "sheet_table_footer_r"
|
|
3295
3406
|
}, /*#__PURE__*/React__default['default'].createElement(antd.Checkbox, {
|
|
3296
3407
|
checked: errorListCheck,
|
|
@@ -4174,11 +4285,11 @@ var getRealStr = function getRealStr(oldSelect, newSelect, record) {
|
|
|
4174
4285
|
var getCurrentSRKs = function getCurrentSRKs(selectMode, labelInValue, value) {
|
|
4175
4286
|
return selectMode ? labelInValue ? value === null || value === void 0 ? void 0 : value.map(function (s) {
|
|
4176
4287
|
return (s === null || s === void 0 ? void 0 : s.value) || s;
|
|
4177
|
-
}) : value : labelInValue ? (value === null || value === void 0 ? void 0 : value.value) && [value === null || value === void 0 ? void 0 : value.value] || [] : value && [value] || [];
|
|
4288
|
+
}) : value || [] : labelInValue ? (value === null || value === void 0 ? void 0 : value.value) && [value === null || value === void 0 ? void 0 : value.value] || [] : value && [value] || [];
|
|
4178
4289
|
};
|
|
4179
4290
|
var getRenderSource = function getRenderSource(currentSRKs, items) {
|
|
4180
4291
|
// 判空处理
|
|
4181
|
-
if (!(currentSRKs === null || currentSRKs === void 0 ? void 0 : currentSRKs.length)) return items || [];
|
|
4292
|
+
if (!currentSRKs || !(currentSRKs === null || currentSRKs === void 0 ? void 0 : currentSRKs.length)) return items || [];
|
|
4182
4293
|
// 创建映射对象 用于记录原始选中顺序
|
|
4183
4294
|
var orderMap = new Map();
|
|
4184
4295
|
currentSRKs === null || currentSRKs === void 0 ? void 0 : currentSRKs.forEach(function (value, index) {
|
|
@@ -5360,7 +5471,9 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
|
|
|
5360
5471
|
noNeedSplit = _ref$noNeedSplit === void 0 ? false : _ref$noNeedSplit,
|
|
5361
5472
|
noOperate = _ref.noOperate,
|
|
5362
5473
|
viewShowValueStr = _ref.viewShowValueStr,
|
|
5363
|
-
searchStartLength = _ref.searchStartLength
|
|
5474
|
+
searchStartLength = _ref.searchStartLength,
|
|
5475
|
+
_ref$isQuery = _ref.isQuery,
|
|
5476
|
+
isQuery = _ref$isQuery === void 0 ? false : _ref$isQuery;
|
|
5364
5477
|
var requestConfig = _objectSpread2({
|
|
5365
5478
|
url: url,
|
|
5366
5479
|
method: method,
|
|
@@ -5427,7 +5540,7 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
|
|
|
5427
5540
|
return item;
|
|
5428
5541
|
}).length > 0;
|
|
5429
5542
|
};
|
|
5430
|
-
var sDisabled = disabled || isHaveDependency && !!!isHaveDValue();
|
|
5543
|
+
var sDisabled = disabled || isHaveDependency && !!!isHaveDValue() && !isQuery;
|
|
5431
5544
|
var _useState = React$1.useState([]),
|
|
5432
5545
|
_useState2 = _slicedToArray(_useState, 2),
|
|
5433
5546
|
items = _useState2[0],
|
package/package.json
CHANGED
|
@@ -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;
|
|
@@ -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">
|
|
@@ -766,6 +860,16 @@ class DataValidation extends React.Component {
|
|
|
766
860
|
<DownOutlined />
|
|
767
861
|
</Button>
|
|
768
862
|
</Dropdown>
|
|
863
|
+
<Dropdown
|
|
864
|
+
trigger={['click']}
|
|
865
|
+
overlay={this.getSortList()}
|
|
866
|
+
placement="bottomRight"
|
|
867
|
+
>
|
|
868
|
+
<Button>
|
|
869
|
+
排序
|
|
870
|
+
<DownOutlined />
|
|
871
|
+
</Button>
|
|
872
|
+
</Dropdown>
|
|
769
873
|
|
|
770
874
|
{!notValid && <Button type="primary" onClick={this.resetData}>
|
|
771
875
|
识别
|
|
@@ -776,9 +880,13 @@ class DataValidation extends React.Component {
|
|
|
776
880
|
<div style={{ position: 'relative', height: '400px' }}>
|
|
777
881
|
<div id="luckysheet" style={luckyCss}></div>
|
|
778
882
|
</div>
|
|
779
|
-
{!this.props.notValid && <div className="sheet_table_footer">
|
|
883
|
+
{!this.props.notValid && !!totalSummary.total && <div className="sheet_table_footer">
|
|
780
884
|
<span className="sheet_table_footer_l">
|
|
781
|
-
共 {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}
|
|
782
890
|
</span>
|
|
783
891
|
{!notValid && <Space className="sheet_table_footer_r">
|
|
784
892
|
<Checkbox
|
|
@@ -53,6 +53,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
53
53
|
noOperate, // 级联禁用按钮设置字段
|
|
54
54
|
viewShowValueStr, // 详情展示值,不传展示组件处理的默认值
|
|
55
55
|
searchStartLength, // 默认不校验长度去搜索,如果配置了,则按照配置项长度进行处理搜索
|
|
56
|
+
isQuery = false, // 是否是查询条件
|
|
56
57
|
} = rCTemp || {};
|
|
57
58
|
const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,mappingTextShowTextField,init,extralHeaders,specialBracket,noNeedSplit,noOperate,viewShowValueStr,searchStartLength,...rCTemp};
|
|
58
59
|
const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
|
|
@@ -93,7 +94,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
93
94
|
});
|
|
94
95
|
return formValueList.filter((item: any) => item).length > 0
|
|
95
96
|
}
|
|
96
|
-
const sDisabled = disabled || (isHaveDependency && !!!isHaveDValue());
|
|
97
|
+
const sDisabled = disabled || (isHaveDependency && !!!isHaveDValue() && !isQuery);
|
|
97
98
|
|
|
98
99
|
const [items, setItems] = useState([]);
|
|
99
100
|
const [selectOpen, setSelectOpen] = useState(false);
|
|
@@ -61,11 +61,11 @@ export const getRealStr = (oldSelect: any,newSelect: any, record: any) => {
|
|
|
61
61
|
return oldSelect?.length ? oldSelect.some((o: any) => o.value == record?.value) ? oldSelect.filter((s: any) => s.value != record?.value) : [...oldSelect,...newSelect] : newSelect;
|
|
62
62
|
}
|
|
63
63
|
export const getCurrentSRKs = (selectMode: any,labelInValue:boolean,value: any) => {
|
|
64
|
-
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]||[])
|
|
65
65
|
}
|
|
66
66
|
export const getRenderSource = (currentSRKs: any, items: any) => {
|
|
67
67
|
// 判空处理
|
|
68
|
-
if(!currentSRKs?.length) return items||[];
|
|
68
|
+
if(!currentSRKs || !currentSRKs?.length) return items||[];
|
|
69
69
|
|
|
70
70
|
// 创建映射对象 用于记录原始选中顺序
|
|
71
71
|
const orderMap = new Map<number, number>();
|