@bit-sun/business-component 4.0.13-alpha.33 → 4.0.13-alpha.35

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.
@@ -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
@@ -2696,11 +2696,34 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2696
2696
  _this = _callSuper(this, DataValidation, [props]);
2697
2697
  // this.props.onRef(this);
2698
2698
  _this.getCount = function () {
2699
- var resultData = _this.state.resultData;
2699
+ var _this$state$resultDat = _this.state.resultData,
2700
+ resultData = _this$state$resultDat === void 0 ? [] : _this$state$resultDat;
2701
+ var totalQuantity = resultData.reduce(function (total, item) {
2702
+ total += Number(item.quantity || 0);
2703
+ return total;
2704
+ }, 0);
2705
+ var totalSuccessQuantity = resultData.filter(function (item) {
2706
+ return item.flag;
2707
+ }).reduce(function (total, item) {
2708
+ total += Number(item.quantity || 0);
2709
+ return total;
2710
+ }, 0);
2711
+ var totalErrorQuantity = resultData.filter(function (item) {
2712
+ return !item.flag;
2713
+ }).reduce(function (total, item) {
2714
+ total += Number(item.quantity || 0);
2715
+ return total;
2716
+ }, 0);
2700
2717
  return {
2701
2718
  total: resultData.length,
2719
+ totalQuantity: totalQuantity,
2720
+ totalSuccessQuantity: totalSuccessQuantity,
2721
+ totalErrorQuantity: totalErrorQuantity,
2702
2722
  error: resultData.filter(function (item) {
2703
2723
  return !item.flag;
2724
+ }).length,
2725
+ success: resultData.filter(function (item) {
2726
+ return item.flag;
2704
2727
  }).length
2705
2728
  };
2706
2729
  };
@@ -2709,7 +2732,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2709
2732
  var notValid = _this.props.notValid;
2710
2733
  return {
2711
2734
  container: 'luckysheet',
2712
- showtoolbar: false,
2735
+ // showtoolbar: false,
2713
2736
  hook: {
2714
2737
  columnTitleCellRenderBefore: function columnTitleCellRenderBefore(columnAbc, postion, ctx) {
2715
2738
  if (columnAbc.name) {
@@ -2746,17 +2769,9 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2746
2769
  // console.info(data,sheetFile,ctx)
2747
2770
  }
2748
2771
  },
2749
- // showtoolbarConfig: {
2750
- // undoRedo: true, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
2751
- // paintFormat: false, //格式刷
2752
- // currencyFormat: false, //货币格式
2753
- // percentageFormat: false, //百分比格式
2754
- // numberDecrease: false, // '减少小数位数'
2755
- // numberIncrease: false, // '增加小数位数
2756
- // moreFormats: false, // '更多格式'
2757
- // font: true, // '字体'
2758
- // fontSize: true, // '字号大小'
2759
- // },
2772
+ showtoolbarConfig: {
2773
+ sortAndFilter: true
2774
+ },
2760
2775
  data: [_defineProperty(_defineProperty({
2761
2776
  name: 'Cell',
2762
2777
  color: '',
@@ -2880,7 +2895,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2880
2895
  showsheetbar: false,
2881
2896
  optionstate: false,
2882
2897
  showstatisticBarConfig: {
2883
- count: false,
2898
+ count: true,
2884
2899
  view: false,
2885
2900
  zoom: false // 缩放
2886
2901
  },
@@ -2935,6 +2950,44 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2935
2950
  return _.compact(Object.values(d)).length;
2936
2951
  });
2937
2952
  };
2953
+ _this.naturalCompare = function (a, b) {
2954
+ var checkNumber = function checkNumber(value) {
2955
+ return /^[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$/.test(value.trim());
2956
+ };
2957
+ if (checkNumber(a) && checkNumber(b)) {
2958
+ return Number(a) - Number(b);
2959
+ }
2960
+ // 优先处理 "通过" 的情况
2961
+ if (a === "通过" && b !== "通过") return -1;
2962
+ if (b === "通过" && a !== "通过") return 1;
2963
+ return a.localeCompare(b);
2964
+ };
2965
+ _this.customSort = function (a, b) {
2966
+ // 处理空值
2967
+ var aEmpty = !a;
2968
+ var bEmpty = !b;
2969
+ if (aEmpty && bEmpty) return 0;
2970
+ if (aEmpty) return 1; // a空,排后面
2971
+ if (bEmpty) return -1; // b空,a排前面
2972
+ return _this.naturalCompare(a, b);
2973
+ };
2974
+ _this.sortData = function (sorterKey) {
2975
+ var sheetData = luckysheet.getSheetData();
2976
+ var newData = JSON.parse(JSON.stringify(sheetData)).sort(function (cur, prev) {
2977
+ var _cur$cellIndex, _prev$cellIndex;
2978
+ var cellIndex = itemsTemp.findIndex(function (item) {
2979
+ return item.code === sorterKey;
2980
+ });
2981
+ if (sorterKey === 'checkresult') {
2982
+ cellIndex = itemsTemp.length;
2983
+ }
2984
+ 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);
2985
+ });
2986
+ luckysheet.create(_this.setConfig(luckysheet.transToCellData(newData)));
2987
+ _this.setState({
2988
+ data: luckysheet.transToCellData(newData)
2989
+ });
2990
+ };
2938
2991
  _this.resetData = function () {
2939
2992
  var _customerColumnsMappi;
2940
2993
  var _this$props = _this.props,
@@ -3117,10 +3170,43 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3117
3170
  });
3118
3171
  }), provided.placeholder);
3119
3172
  }))));
3173
+ _this.getSortList = function () {
3174
+ var _this$props2, _this$props2$customer;
3175
+ var sortList = [];
3176
+ 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) {
3177
+ var _this$props3, _this$props3$customer;
3178
+ 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) {
3179
+ return createItem('item-0', index, item.title, item.name, _this.format);
3180
+ })) || [];
3181
+ } else {
3182
+ var _this$props4, _this$props4$columns;
3183
+ 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) {
3184
+ if (!mapping.get(item)) throw Error("".concat(item, " is not in DataValidation component, please fix this error"));
3185
+ return createItem('item-0', index, mapping.get(item), item, _this.format);
3186
+ })) || [];
3187
+ }
3188
+ return /*#__PURE__*/React$1.createElement(Menu, null, (sortList || []).map(function (item, index) {
3189
+ return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Menu.Item, {
3190
+ key: index,
3191
+ className: "sheet_table-menu_item_text"
3192
+ }, /*#__PURE__*/React$1.createElement("a", {
3193
+ onClick: function onClick() {
3194
+ return _this.sortData(item.code);
3195
+ }
3196
+ }, item.content)), /*#__PURE__*/React$1.createElement(Menu.Divider, null));
3197
+ }), /*#__PURE__*/React$1.createElement(Menu.Item, {
3198
+ key: "checkresult",
3199
+ className: "sheet_table-menu_item_text"
3200
+ }, /*#__PURE__*/React$1.createElement("a", {
3201
+ onClick: function onClick() {
3202
+ return _this.sortData('checkresult');
3203
+ }
3204
+ }, "\u6821\u9A8C\u7ED3\u679C")));
3205
+ };
3120
3206
  _this.getSheetMap = function () {
3121
- var _this$props2 = _this.props,
3122
- customerColumnsMapping = _this$props2.customerColumnsMapping,
3123
- columns = _this$props2.columns;
3207
+ var _this$props5 = _this.props,
3208
+ customerColumnsMapping = _this$props5.customerColumnsMapping,
3209
+ columns = _this$props5.columns;
3124
3210
  var sheetData = customerColumnsMapping || columns.map(function (s) {
3125
3211
  return {
3126
3212
  title: mapping.get(s),
@@ -3211,12 +3297,12 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3211
3297
  key: "render",
3212
3298
  value: function render() {
3213
3299
  var errorListCheck = this.state.errorListCheck;
3214
- var _this$props3 = this.props,
3215
- title = _this$props3.title,
3216
- notValid = _this$props3.notValid,
3217
- notExcelImport = _this$props3.notExcelImport,
3218
- excelImportConfig = _this$props3.excelImportConfig,
3219
- getTemplate = _this$props3.getTemplate;
3300
+ var _this$props6 = this.props,
3301
+ title = _this$props6.title,
3302
+ notValid = _this$props6.notValid,
3303
+ notExcelImport = _this$props6.notExcelImport,
3304
+ excelImportConfig = _this$props6.excelImportConfig,
3305
+ getTemplate = _this$props6.getTemplate;
3220
3306
  var _ref5 = excelImportConfig || {},
3221
3307
  size = _ref5.size,
3222
3308
  accept = _ref5.accept,
@@ -3272,6 +3358,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3272
3358
  left: '0px',
3273
3359
  top: '0px'
3274
3360
  };
3361
+ console.log('itemsTemp', itemsTemp);
3275
3362
  return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("div", {
3276
3363
  className: "sheet_table_top"
3277
3364
  }, /*#__PURE__*/React$1.createElement(Space, null, /*#__PURE__*/React$1.createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React$1.createElement(Dropdown, {
@@ -3290,7 +3377,11 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3290
3377
  trigger: ['click'],
3291
3378
  overlay: this.menuList,
3292
3379
  placement: "bottomRight"
3293
- }, /*#__PURE__*/React$1.createElement(Button, null, "\u6E05\u7A7A", /*#__PURE__*/React$1.createElement(DownOutlined, null))), !notValid && /*#__PURE__*/React$1.createElement(Button, {
3380
+ }, /*#__PURE__*/React$1.createElement(Button, null, "\u6E05\u7A7A", /*#__PURE__*/React$1.createElement(DownOutlined, null))), /*#__PURE__*/React$1.createElement(Dropdown, {
3381
+ trigger: ['click'],
3382
+ overlay: this.getSortList(),
3383
+ placement: "bottomRight"
3384
+ }, /*#__PURE__*/React$1.createElement(Button, null, "\u6392\u5E8F", /*#__PURE__*/React$1.createElement(DownOutlined, null))), !notValid && /*#__PURE__*/React$1.createElement(Button, {
3294
3385
  type: "primary",
3295
3386
  onClick: this.resetData
3296
3387
  }, "\u8BC6\u522B"))), /*#__PURE__*/React$1.createElement("div", {
@@ -3301,11 +3392,31 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3301
3392
  }, /*#__PURE__*/React$1.createElement("div", {
3302
3393
  id: "luckysheet",
3303
3394
  style: luckyCss
3304
- })), !this.props.notValid && /*#__PURE__*/React$1.createElement("div", {
3395
+ })), !this.props.notValid && !!totalSummary.total && /*#__PURE__*/React$1.createElement("div", {
3305
3396
  className: "sheet_table_footer"
3306
3397
  }, /*#__PURE__*/React$1.createElement("span", {
3307
3398
  className: "sheet_table_footer_l"
3308
- }, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E", !notValid && ", \u5176\u4E2D\u9519\u8BEF ".concat(totalSummary.error, " \u9879")), !notValid && /*#__PURE__*/React$1.createElement(Space, {
3399
+ }, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E\uFF1A", /*#__PURE__*/React$1.createElement("span", {
3400
+ style: {
3401
+ color: 'green',
3402
+ marginLeft: '5px'
3403
+ }
3404
+ }, " \u6210\u529F\u6761\u6570\uFF1A"), totalSummary.success, /*#__PURE__*/React$1.createElement("span", {
3405
+ style: {
3406
+ color: 'green',
3407
+ marginLeft: '5px'
3408
+ }
3409
+ }, " \u6210\u529F\u6570\u91CF\uFF1A"), totalSummary.totalSuccessQuantity || 0, /*#__PURE__*/React$1.createElement("span", {
3410
+ style: {
3411
+ color: 'red',
3412
+ marginLeft: '5px'
3413
+ }
3414
+ }, " \u5931\u8D25\u6761\u6570\uFF1A"), totalSummary.error || 0, /*#__PURE__*/React$1.createElement("span", {
3415
+ style: {
3416
+ color: 'red',
3417
+ marginLeft: '5px'
3418
+ }
3419
+ }, " \u5931\u8D25\u6570\u91CF\uFF1A"), totalSummary.totalErrorQuantity || 0), !notValid && /*#__PURE__*/React$1.createElement(Space, {
3309
3420
  className: "sheet_table_footer_r"
3310
3421
  }, /*#__PURE__*/React$1.createElement(Checkbox, {
3311
3422
  checked: errorListCheck,
@@ -4267,13 +4378,16 @@ var handleParams = function handleParams(params) {
4267
4378
  });
4268
4379
  delete params[key];
4269
4380
  } else if (element && key.indexOf('*multiInput') >= 0) {
4381
+ var _ref3, _ref3$trim, _key$split, _value, _value$trim;
4270
4382
  var name = '',
4271
- value = element['value'];
4383
+ value = (_ref3 = (element === null || element === void 0 ? void 0 : element['value']) || element) === null || _ref3 === void 0 ? void 0 : (_ref3$trim = _ref3.trim) === null || _ref3$trim === void 0 ? void 0 : _ref3$trim.call(_ref3);
4384
+ var searchKey = (element === null || element === void 0 ? void 0 : element['name']) || (key === null || key === void 0 ? void 0 : (_key$split = key.split('*multiInput')) === null || _key$split === void 0 ? void 0 : _key$split[0]);
4272
4385
  if (value.indexOf(',') >= 0) {
4273
- name = "qp-".concat(element['name'], "-in");
4386
+ name = "qp-".concat(searchKey, "-in");
4274
4387
  } else {
4275
- name = "qp-".concat(element['name'], "-like");
4388
+ name = "qp-".concat(searchKey, "-like");
4276
4389
  }
4390
+ value = (_value = value) === null || _value === void 0 ? void 0 : (_value$trim = _value.trim) === null || _value$trim === void 0 ? void 0 : _value$trim.call(_value);
4277
4391
  params[name] = value;
4278
4392
  delete params[key];
4279
4393
  } else if (element && key.indexOf('*') >= 0) {
@@ -4462,11 +4576,11 @@ var LightHeightOption = function LightHeightOption(props) {
4462
4576
  title: text
4463
4577
  }, renderContent);
4464
4578
  };
4465
- var maxTagPlaceholder = function maxTagPlaceholder(selectedValues, _ref3) {
4466
- var selectProps = _ref3.selectProps,
4467
- onChange = _ref3.onChange,
4468
- value = _ref3.value,
4469
- setIsMaxTagsOpen = _ref3.setIsMaxTagsOpen;
4579
+ var maxTagPlaceholder = function maxTagPlaceholder(selectedValues, _ref4) {
4580
+ var selectProps = _ref4.selectProps,
4581
+ onChange = _ref4.onChange,
4582
+ value = _ref4.value,
4583
+ setIsMaxTagsOpen = _ref4.setIsMaxTagsOpen;
4470
4584
  var labelInValue = selectProps.labelInValue;
4471
4585
  var _onClose = function onClose(e, item) {
4472
4586
  e.preventDefault();
@@ -4520,11 +4634,11 @@ var handleTableColumns = function handleTableColumns(tableColumns) {
4520
4634
  };
4521
4635
  // ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
4522
4636
  // ------------------------------------------ 选中数据展示 相关处理--开始----------------------------------------
4523
- var getShowLabelTextStr = function getShowLabelTextStr(_ref4) {
4524
- var kongValue = _ref4.kongValue,
4525
- selectMode = _ref4.selectMode,
4526
- value = _ref4.value,
4527
- items = _ref4.items;
4637
+ var getShowLabelTextStr = function getShowLabelTextStr(_ref5) {
4638
+ var kongValue = _ref5.kongValue,
4639
+ selectMode = _ref5.selectMode,
4640
+ value = _ref5.value,
4641
+ items = _ref5.items;
4528
4642
  if (selectMode) {
4529
4643
  var _value$map;
4530
4644
  return Array.isArray(value) && (value === null || value === void 0 ? void 0 : (_value$map = value.map(function (item) {
@@ -4539,11 +4653,11 @@ var getSelectValueText = function getSelectValueText(v, items) {
4539
4653
  return item.value === v;
4540
4654
  })) === null || _filter === void 0 ? void 0 : (_filter$ = _filter[0]) === null || _filter$ === void 0 ? void 0 : _filter$.text) || v || '';
4541
4655
  };
4542
- var getShowValueStr = function getShowValueStr(_ref5) {
4543
- var kongValue = _ref5.kongValue,
4544
- selectMode = _ref5.selectMode,
4545
- value = _ref5.value,
4546
- items = _ref5.items;
4656
+ var getShowValueStr = function getShowValueStr(_ref6) {
4657
+ var kongValue = _ref6.kongValue,
4658
+ selectMode = _ref6.selectMode,
4659
+ value = _ref6.value,
4660
+ items = _ref6.items;
4547
4661
  if (selectMode) {
4548
4662
  var _value$map2;
4549
4663
  return Array.isArray(value) && (value === null || value === void 0 ? void 0 : (_value$map2 = value.map(function (item) {
@@ -4552,12 +4666,12 @@ var getShowValueStr = function getShowValueStr(_ref5) {
4552
4666
  }
4553
4667
  return getSelectValueText(value, items) || kongValue;
4554
4668
  };
4555
- var getShowStr = function getShowStr(_ref6) {
4556
- var viewShowValueStr = _ref6.viewShowValueStr,
4557
- labelInValue = _ref6.labelInValue,
4558
- selectMode = _ref6.selectMode,
4559
- value = _ref6.value,
4560
- items = _ref6.items;
4669
+ var getShowStr = function getShowStr(_ref7) {
4670
+ var viewShowValueStr = _ref7.viewShowValueStr,
4671
+ labelInValue = _ref7.labelInValue,
4672
+ selectMode = _ref7.selectMode,
4673
+ value = _ref7.value,
4674
+ items = _ref7.items;
4561
4675
  // 优先使用业务使用传入的展示
4562
4676
  if (viewShowValueStr) return viewShowValueStr;
4563
4677
  var kongValue = '无';
@@ -10801,11 +10915,13 @@ function commonFun(type, prefixUrl, parentProps) {
10801
10915
  sourceName: 'warehouseIds'
10802
10916
  }, requestConfigProp);
10803
10917
  tableSearchForm = [{
10804
- name: 'qp-physicalWarehouseName-like',
10805
- label: '物理仓名称'
10918
+ name: 'physicalWarehouseName*multiInput',
10919
+ label: '物理仓名称',
10920
+ type: 'multipleQueryInput'
10806
10921
  }, {
10807
- name: 'qp-physicalWarehouseCode-like',
10808
- label: '物理仓编码'
10922
+ name: 'physicalWarehouseCode*multiInput',
10923
+ label: '物理仓编码',
10924
+ type: 'multipleQueryInput'
10809
10925
  }, {
10810
10926
  name: 'qp-physicalWarehouseType-eq',
10811
10927
  type: 'select',
@@ -10904,11 +11020,13 @@ function commonFun(type, prefixUrl, parentProps) {
10904
11020
  sourceName: 'warehouseIds'
10905
11021
  }, requestConfigProp);
10906
11022
  tableSearchForm = [{
10907
- name: 'qp-realWarehouseName-like',
10908
- label: '逻辑仓名称'
11023
+ name: 'realWarehouseName*multiInput',
11024
+ label: '逻辑仓名称',
11025
+ type: 'multipleQueryInput'
10909
11026
  }, {
10910
- name: 'qp-realWarehouseCode-like',
10911
- label: '逻辑仓编码'
11027
+ name: 'realWarehouseCode*multiInput',
11028
+ label: '逻辑仓编码',
11029
+ type: 'multipleQueryInput'
10912
11030
  }, {
10913
11031
  name: 'qp-realWarehouseType-eq',
10914
11032
  type: 'select',
@@ -10989,11 +11107,13 @@ function commonFun(type, prefixUrl, parentProps) {
10989
11107
  sourceName: 'qp-operationWarehouseCode-in'
10990
11108
  }, requestConfigProp);
10991
11109
  tableSearchForm = [{
10992
- name: 'qp-name-like',
10993
- label: '运营仓名称'
11110
+ name: 'name*multiInput',
11111
+ label: '运营仓名称',
11112
+ type: 'multipleQueryInput'
10994
11113
  }, {
10995
- name: 'qp-operationWarehouseCode-like',
10996
- label: '运营仓编码'
11114
+ name: 'operationWarehouseCode*multiInput',
11115
+ label: '运营仓编码',
11116
+ type: 'multipleQueryInput'
10997
11117
  }, {
10998
11118
  name: 'qp-groupCode-in',
10999
11119
  type: 'select',
@@ -11574,11 +11694,11 @@ function commonFun(type, prefixUrl, parentProps) {
11574
11694
  sourceName: 'code'
11575
11695
  }, requestConfigProp);
11576
11696
  tableSearchForm = [{
11577
- name: 'qp-name-in',
11697
+ name: 'name*multiInput',
11578
11698
  label: '商店名称',
11579
11699
  type: 'multipleQueryInput'
11580
11700
  }, {
11581
- name: 'qp-code-in',
11701
+ name: 'code*multiInput',
11582
11702
  label: '商店编码',
11583
11703
  type: 'multipleQueryInput'
11584
11704
  }, {
package/dist/index.js CHANGED
@@ -2719,11 +2719,34 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2719
2719
  _this = _callSuper(this, DataValidation, [props]);
2720
2720
  // this.props.onRef(this);
2721
2721
  _this.getCount = function () {
2722
- var resultData = _this.state.resultData;
2722
+ var _this$state$resultDat = _this.state.resultData,
2723
+ resultData = _this$state$resultDat === void 0 ? [] : _this$state$resultDat;
2724
+ var totalQuantity = resultData.reduce(function (total, item) {
2725
+ total += Number(item.quantity || 0);
2726
+ return total;
2727
+ }, 0);
2728
+ var totalSuccessQuantity = resultData.filter(function (item) {
2729
+ return item.flag;
2730
+ }).reduce(function (total, item) {
2731
+ total += Number(item.quantity || 0);
2732
+ return total;
2733
+ }, 0);
2734
+ var totalErrorQuantity = resultData.filter(function (item) {
2735
+ return !item.flag;
2736
+ }).reduce(function (total, item) {
2737
+ total += Number(item.quantity || 0);
2738
+ return total;
2739
+ }, 0);
2723
2740
  return {
2724
2741
  total: resultData.length,
2742
+ totalQuantity: totalQuantity,
2743
+ totalSuccessQuantity: totalSuccessQuantity,
2744
+ totalErrorQuantity: totalErrorQuantity,
2725
2745
  error: resultData.filter(function (item) {
2726
2746
  return !item.flag;
2747
+ }).length,
2748
+ success: resultData.filter(function (item) {
2749
+ return item.flag;
2727
2750
  }).length
2728
2751
  };
2729
2752
  };
@@ -2732,7 +2755,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2732
2755
  var notValid = _this.props.notValid;
2733
2756
  return {
2734
2757
  container: 'luckysheet',
2735
- showtoolbar: false,
2758
+ // showtoolbar: false,
2736
2759
  hook: {
2737
2760
  columnTitleCellRenderBefore: function columnTitleCellRenderBefore(columnAbc, postion, ctx) {
2738
2761
  if (columnAbc.name) {
@@ -2769,17 +2792,9 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2769
2792
  // console.info(data,sheetFile,ctx)
2770
2793
  }
2771
2794
  },
2772
- // showtoolbarConfig: {
2773
- // undoRedo: true, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
2774
- // paintFormat: false, //格式刷
2775
- // currencyFormat: false, //货币格式
2776
- // percentageFormat: false, //百分比格式
2777
- // numberDecrease: false, // '减少小数位数'
2778
- // numberIncrease: false, // '增加小数位数
2779
- // moreFormats: false, // '更多格式'
2780
- // font: true, // '字体'
2781
- // fontSize: true, // '字号大小'
2782
- // },
2795
+ showtoolbarConfig: {
2796
+ sortAndFilter: true
2797
+ },
2783
2798
  data: [_defineProperty(_defineProperty({
2784
2799
  name: 'Cell',
2785
2800
  color: '',
@@ -2903,7 +2918,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2903
2918
  showsheetbar: false,
2904
2919
  optionstate: false,
2905
2920
  showstatisticBarConfig: {
2906
- count: false,
2921
+ count: true,
2907
2922
  view: false,
2908
2923
  zoom: false // 缩放
2909
2924
  },
@@ -2958,6 +2973,44 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2958
2973
  return ___default['default'].compact(Object.values(d)).length;
2959
2974
  });
2960
2975
  };
2976
+ _this.naturalCompare = function (a, b) {
2977
+ var checkNumber = function checkNumber(value) {
2978
+ return /^[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$/.test(value.trim());
2979
+ };
2980
+ if (checkNumber(a) && checkNumber(b)) {
2981
+ return Number(a) - Number(b);
2982
+ }
2983
+ // 优先处理 "通过" 的情况
2984
+ if (a === "通过" && b !== "通过") return -1;
2985
+ if (b === "通过" && a !== "通过") return 1;
2986
+ return a.localeCompare(b);
2987
+ };
2988
+ _this.customSort = function (a, b) {
2989
+ // 处理空值
2990
+ var aEmpty = !a;
2991
+ var bEmpty = !b;
2992
+ if (aEmpty && bEmpty) return 0;
2993
+ if (aEmpty) return 1; // a空,排后面
2994
+ if (bEmpty) return -1; // b空,a排前面
2995
+ return _this.naturalCompare(a, b);
2996
+ };
2997
+ _this.sortData = function (sorterKey) {
2998
+ var sheetData = luckysheet.getSheetData();
2999
+ var newData = JSON.parse(JSON.stringify(sheetData)).sort(function (cur, prev) {
3000
+ var _cur$cellIndex, _prev$cellIndex;
3001
+ var cellIndex = itemsTemp.findIndex(function (item) {
3002
+ return item.code === sorterKey;
3003
+ });
3004
+ if (sorterKey === 'checkresult') {
3005
+ cellIndex = itemsTemp.length;
3006
+ }
3007
+ 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);
3008
+ });
3009
+ luckysheet.create(_this.setConfig(luckysheet.transToCellData(newData)));
3010
+ _this.setState({
3011
+ data: luckysheet.transToCellData(newData)
3012
+ });
3013
+ };
2961
3014
  _this.resetData = function () {
2962
3015
  var _customerColumnsMappi;
2963
3016
  var _this$props = _this.props,
@@ -3140,10 +3193,43 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3140
3193
  });
3141
3194
  }), provided.placeholder);
3142
3195
  }))));
3196
+ _this.getSortList = function () {
3197
+ var _this$props2, _this$props2$customer;
3198
+ var sortList = [];
3199
+ 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) {
3200
+ var _this$props3, _this$props3$customer;
3201
+ 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) {
3202
+ return createItem('item-0', index, item.title, item.name, _this.format);
3203
+ })) || [];
3204
+ } else {
3205
+ var _this$props4, _this$props4$columns;
3206
+ 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) {
3207
+ if (!mapping.get(item)) throw Error("".concat(item, " is not in DataValidation component, please fix this error"));
3208
+ return createItem('item-0', index, mapping.get(item), item, _this.format);
3209
+ })) || [];
3210
+ }
3211
+ return /*#__PURE__*/React__default['default'].createElement(antd.Menu, null, (sortList || []).map(function (item, index) {
3212
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
3213
+ key: index,
3214
+ className: "sheet_table-menu_item_text"
3215
+ }, /*#__PURE__*/React__default['default'].createElement("a", {
3216
+ onClick: function onClick() {
3217
+ return _this.sortData(item.code);
3218
+ }
3219
+ }, item.content)), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Divider, null));
3220
+ }), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
3221
+ key: "checkresult",
3222
+ className: "sheet_table-menu_item_text"
3223
+ }, /*#__PURE__*/React__default['default'].createElement("a", {
3224
+ onClick: function onClick() {
3225
+ return _this.sortData('checkresult');
3226
+ }
3227
+ }, "\u6821\u9A8C\u7ED3\u679C")));
3228
+ };
3143
3229
  _this.getSheetMap = function () {
3144
- var _this$props2 = _this.props,
3145
- customerColumnsMapping = _this$props2.customerColumnsMapping,
3146
- columns = _this$props2.columns;
3230
+ var _this$props5 = _this.props,
3231
+ customerColumnsMapping = _this$props5.customerColumnsMapping,
3232
+ columns = _this$props5.columns;
3147
3233
  var sheetData = customerColumnsMapping || columns.map(function (s) {
3148
3234
  return {
3149
3235
  title: mapping.get(s),
@@ -3234,12 +3320,12 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3234
3320
  key: "render",
3235
3321
  value: function render() {
3236
3322
  var errorListCheck = this.state.errorListCheck;
3237
- var _this$props3 = this.props,
3238
- title = _this$props3.title,
3239
- notValid = _this$props3.notValid,
3240
- notExcelImport = _this$props3.notExcelImport,
3241
- excelImportConfig = _this$props3.excelImportConfig,
3242
- getTemplate = _this$props3.getTemplate;
3323
+ var _this$props6 = this.props,
3324
+ title = _this$props6.title,
3325
+ notValid = _this$props6.notValid,
3326
+ notExcelImport = _this$props6.notExcelImport,
3327
+ excelImportConfig = _this$props6.excelImportConfig,
3328
+ getTemplate = _this$props6.getTemplate;
3243
3329
  var _ref5 = excelImportConfig || {},
3244
3330
  size = _ref5.size,
3245
3331
  accept = _ref5.accept,
@@ -3295,6 +3381,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3295
3381
  left: '0px',
3296
3382
  top: '0px'
3297
3383
  };
3384
+ console.log('itemsTemp', itemsTemp);
3298
3385
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
3299
3386
  className: "sheet_table_top"
3300
3387
  }, /*#__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, {
@@ -3313,7 +3400,11 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3313
3400
  trigger: ['click'],
3314
3401
  overlay: this.menuList,
3315
3402
  placement: "bottomRight"
3316
- }, /*#__PURE__*/React__default['default'].createElement(antd.Button, null, "\u6E05\u7A7A", /*#__PURE__*/React__default['default'].createElement(icons.DownOutlined, null))), !notValid && /*#__PURE__*/React__default['default'].createElement(antd.Button, {
3403
+ }, /*#__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, {
3404
+ trigger: ['click'],
3405
+ overlay: this.getSortList(),
3406
+ placement: "bottomRight"
3407
+ }, /*#__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, {
3317
3408
  type: "primary",
3318
3409
  onClick: this.resetData
3319
3410
  }, "\u8BC6\u522B"))), /*#__PURE__*/React__default['default'].createElement("div", {
@@ -3324,11 +3415,31 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3324
3415
  }, /*#__PURE__*/React__default['default'].createElement("div", {
3325
3416
  id: "luckysheet",
3326
3417
  style: luckyCss
3327
- })), !this.props.notValid && /*#__PURE__*/React__default['default'].createElement("div", {
3418
+ })), !this.props.notValid && !!totalSummary.total && /*#__PURE__*/React__default['default'].createElement("div", {
3328
3419
  className: "sheet_table_footer"
3329
3420
  }, /*#__PURE__*/React__default['default'].createElement("span", {
3330
3421
  className: "sheet_table_footer_l"
3331
- }, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E", !notValid && ", \u5176\u4E2D\u9519\u8BEF ".concat(totalSummary.error, " \u9879")), !notValid && /*#__PURE__*/React__default['default'].createElement(antd.Space, {
3422
+ }, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E\uFF1A", /*#__PURE__*/React__default['default'].createElement("span", {
3423
+ style: {
3424
+ color: 'green',
3425
+ marginLeft: '5px'
3426
+ }
3427
+ }, " \u6210\u529F\u6761\u6570\uFF1A"), totalSummary.success, /*#__PURE__*/React__default['default'].createElement("span", {
3428
+ style: {
3429
+ color: 'green',
3430
+ marginLeft: '5px'
3431
+ }
3432
+ }, " \u6210\u529F\u6570\u91CF\uFF1A"), totalSummary.totalSuccessQuantity || 0, /*#__PURE__*/React__default['default'].createElement("span", {
3433
+ style: {
3434
+ color: 'red',
3435
+ marginLeft: '5px'
3436
+ }
3437
+ }, " \u5931\u8D25\u6761\u6570\uFF1A"), totalSummary.error || 0, /*#__PURE__*/React__default['default'].createElement("span", {
3438
+ style: {
3439
+ color: 'red',
3440
+ marginLeft: '5px'
3441
+ }
3442
+ }, " \u5931\u8D25\u6570\u91CF\uFF1A"), totalSummary.totalErrorQuantity || 0), !notValid && /*#__PURE__*/React__default['default'].createElement(antd.Space, {
3332
3443
  className: "sheet_table_footer_r"
3333
3444
  }, /*#__PURE__*/React__default['default'].createElement(antd.Checkbox, {
3334
3445
  checked: errorListCheck,
@@ -4290,13 +4401,16 @@ var handleParams = function handleParams(params) {
4290
4401
  });
4291
4402
  delete params[key];
4292
4403
  } else if (element && key.indexOf('*multiInput') >= 0) {
4404
+ var _ref3, _ref3$trim, _key$split, _value, _value$trim;
4293
4405
  var name = '',
4294
- value = element['value'];
4406
+ value = (_ref3 = (element === null || element === void 0 ? void 0 : element['value']) || element) === null || _ref3 === void 0 ? void 0 : (_ref3$trim = _ref3.trim) === null || _ref3$trim === void 0 ? void 0 : _ref3$trim.call(_ref3);
4407
+ var searchKey = (element === null || element === void 0 ? void 0 : element['name']) || (key === null || key === void 0 ? void 0 : (_key$split = key.split('*multiInput')) === null || _key$split === void 0 ? void 0 : _key$split[0]);
4295
4408
  if (value.indexOf(',') >= 0) {
4296
- name = "qp-".concat(element['name'], "-in");
4409
+ name = "qp-".concat(searchKey, "-in");
4297
4410
  } else {
4298
- name = "qp-".concat(element['name'], "-like");
4411
+ name = "qp-".concat(searchKey, "-like");
4299
4412
  }
4413
+ value = (_value = value) === null || _value === void 0 ? void 0 : (_value$trim = _value.trim) === null || _value$trim === void 0 ? void 0 : _value$trim.call(_value);
4300
4414
  params[name] = value;
4301
4415
  delete params[key];
4302
4416
  } else if (element && key.indexOf('*') >= 0) {
@@ -4485,11 +4599,11 @@ var LightHeightOption = function LightHeightOption(props) {
4485
4599
  title: text
4486
4600
  }, renderContent);
4487
4601
  };
4488
- var maxTagPlaceholder = function maxTagPlaceholder(selectedValues, _ref3) {
4489
- var selectProps = _ref3.selectProps,
4490
- onChange = _ref3.onChange,
4491
- value = _ref3.value,
4492
- setIsMaxTagsOpen = _ref3.setIsMaxTagsOpen;
4602
+ var maxTagPlaceholder = function maxTagPlaceholder(selectedValues, _ref4) {
4603
+ var selectProps = _ref4.selectProps,
4604
+ onChange = _ref4.onChange,
4605
+ value = _ref4.value,
4606
+ setIsMaxTagsOpen = _ref4.setIsMaxTagsOpen;
4493
4607
  var labelInValue = selectProps.labelInValue;
4494
4608
  var _onClose = function onClose(e, item) {
4495
4609
  e.preventDefault();
@@ -4543,11 +4657,11 @@ var handleTableColumns = function handleTableColumns(tableColumns) {
4543
4657
  };
4544
4658
  // ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
4545
4659
  // ------------------------------------------ 选中数据展示 相关处理--开始----------------------------------------
4546
- var getShowLabelTextStr = function getShowLabelTextStr(_ref4) {
4547
- var kongValue = _ref4.kongValue,
4548
- selectMode = _ref4.selectMode,
4549
- value = _ref4.value,
4550
- items = _ref4.items;
4660
+ var getShowLabelTextStr = function getShowLabelTextStr(_ref5) {
4661
+ var kongValue = _ref5.kongValue,
4662
+ selectMode = _ref5.selectMode,
4663
+ value = _ref5.value,
4664
+ items = _ref5.items;
4551
4665
  if (selectMode) {
4552
4666
  var _value$map;
4553
4667
  return Array.isArray(value) && (value === null || value === void 0 ? void 0 : (_value$map = value.map(function (item) {
@@ -4562,11 +4676,11 @@ var getSelectValueText = function getSelectValueText(v, items) {
4562
4676
  return item.value === v;
4563
4677
  })) === null || _filter === void 0 ? void 0 : (_filter$ = _filter[0]) === null || _filter$ === void 0 ? void 0 : _filter$.text) || v || '';
4564
4678
  };
4565
- var getShowValueStr = function getShowValueStr(_ref5) {
4566
- var kongValue = _ref5.kongValue,
4567
- selectMode = _ref5.selectMode,
4568
- value = _ref5.value,
4569
- items = _ref5.items;
4679
+ var getShowValueStr = function getShowValueStr(_ref6) {
4680
+ var kongValue = _ref6.kongValue,
4681
+ selectMode = _ref6.selectMode,
4682
+ value = _ref6.value,
4683
+ items = _ref6.items;
4570
4684
  if (selectMode) {
4571
4685
  var _value$map2;
4572
4686
  return Array.isArray(value) && (value === null || value === void 0 ? void 0 : (_value$map2 = value.map(function (item) {
@@ -4575,12 +4689,12 @@ var getShowValueStr = function getShowValueStr(_ref5) {
4575
4689
  }
4576
4690
  return getSelectValueText(value, items) || kongValue;
4577
4691
  };
4578
- var getShowStr = function getShowStr(_ref6) {
4579
- var viewShowValueStr = _ref6.viewShowValueStr,
4580
- labelInValue = _ref6.labelInValue,
4581
- selectMode = _ref6.selectMode,
4582
- value = _ref6.value,
4583
- items = _ref6.items;
4692
+ var getShowStr = function getShowStr(_ref7) {
4693
+ var viewShowValueStr = _ref7.viewShowValueStr,
4694
+ labelInValue = _ref7.labelInValue,
4695
+ selectMode = _ref7.selectMode,
4696
+ value = _ref7.value,
4697
+ items = _ref7.items;
4584
4698
  // 优先使用业务使用传入的展示
4585
4699
  if (viewShowValueStr) return viewShowValueStr;
4586
4700
  var kongValue = '无';
@@ -10824,11 +10938,13 @@ function commonFun(type, prefixUrl, parentProps) {
10824
10938
  sourceName: 'warehouseIds'
10825
10939
  }, requestConfigProp);
10826
10940
  tableSearchForm = [{
10827
- name: 'qp-physicalWarehouseName-like',
10828
- label: '物理仓名称'
10941
+ name: 'physicalWarehouseName*multiInput',
10942
+ label: '物理仓名称',
10943
+ type: 'multipleQueryInput'
10829
10944
  }, {
10830
- name: 'qp-physicalWarehouseCode-like',
10831
- label: '物理仓编码'
10945
+ name: 'physicalWarehouseCode*multiInput',
10946
+ label: '物理仓编码',
10947
+ type: 'multipleQueryInput'
10832
10948
  }, {
10833
10949
  name: 'qp-physicalWarehouseType-eq',
10834
10950
  type: 'select',
@@ -10927,11 +11043,13 @@ function commonFun(type, prefixUrl, parentProps) {
10927
11043
  sourceName: 'warehouseIds'
10928
11044
  }, requestConfigProp);
10929
11045
  tableSearchForm = [{
10930
- name: 'qp-realWarehouseName-like',
10931
- label: '逻辑仓名称'
11046
+ name: 'realWarehouseName*multiInput',
11047
+ label: '逻辑仓名称',
11048
+ type: 'multipleQueryInput'
10932
11049
  }, {
10933
- name: 'qp-realWarehouseCode-like',
10934
- label: '逻辑仓编码'
11050
+ name: 'realWarehouseCode*multiInput',
11051
+ label: '逻辑仓编码',
11052
+ type: 'multipleQueryInput'
10935
11053
  }, {
10936
11054
  name: 'qp-realWarehouseType-eq',
10937
11055
  type: 'select',
@@ -11012,11 +11130,13 @@ function commonFun(type, prefixUrl, parentProps) {
11012
11130
  sourceName: 'qp-operationWarehouseCode-in'
11013
11131
  }, requestConfigProp);
11014
11132
  tableSearchForm = [{
11015
- name: 'qp-name-like',
11016
- label: '运营仓名称'
11133
+ name: 'name*multiInput',
11134
+ label: '运营仓名称',
11135
+ type: 'multipleQueryInput'
11017
11136
  }, {
11018
- name: 'qp-operationWarehouseCode-like',
11019
- label: '运营仓编码'
11137
+ name: 'operationWarehouseCode*multiInput',
11138
+ label: '运营仓编码',
11139
+ type: 'multipleQueryInput'
11020
11140
  }, {
11021
11141
  name: 'qp-groupCode-in',
11022
11142
  type: 'select',
@@ -11597,11 +11717,11 @@ function commonFun(type, prefixUrl, parentProps) {
11597
11717
  sourceName: 'code'
11598
11718
  }, requestConfigProp);
11599
11719
  tableSearchForm = [{
11600
- name: 'qp-name-in',
11720
+ name: 'name*multiInput',
11601
11721
  label: '商店名称',
11602
11722
  type: 'multipleQueryInput'
11603
11723
  }, {
11604
- name: 'qp-code-in',
11724
+ name: 'code*multiInput',
11605
11725
  label: '商店编码',
11606
11726
  type: 'multipleQueryInput'
11607
11727
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.0.13-alpha.33",
3
+ "version": "4.0.13-alpha.35",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -1069,8 +1069,8 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1069
1069
  ...requestConfigProp,
1070
1070
  }
1071
1071
  tableSearchForm = [
1072
- { name: 'qp-physicalWarehouseName-like', label: '物理仓名称' },
1073
- { name: 'qp-physicalWarehouseCode-like', label: '物理仓编码' },
1072
+ { name: 'physicalWarehouseName*multiInput', label: '物理仓名称', type: 'multipleQueryInput' },
1073
+ { name: 'physicalWarehouseCode*multiInput', label: '物理仓编码', type: 'multipleQueryInput' },
1074
1074
  { name: 'qp-physicalWarehouseType-eq', type: 'select', label: '物理仓类型', initialSource: getDictionarySource('SC00002') },
1075
1075
  { name: 'qp-companyCode-eq', type: 'select', label: '所属公司', field: {
1076
1076
  type: 'select',
@@ -1167,8 +1167,8 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1167
1167
  ...requestConfigProp,
1168
1168
  }
1169
1169
  tableSearchForm = [
1170
- { name: 'qp-realWarehouseName-like', label: '逻辑仓名称' },
1171
- { name: 'qp-realWarehouseCode-like', label: '逻辑仓编码' },
1170
+ { name: 'realWarehouseName*multiInput', label: '逻辑仓名称', type: 'multipleQueryInput' },
1171
+ { name: 'realWarehouseCode*multiInput', label: '逻辑仓编码', type: 'multipleQueryInput' },
1172
1172
  { name: 'qp-realWarehouseType-eq', type: 'select', label: '逻辑仓类型', initialSource: getDictionarySource('SC00004') },
1173
1173
  { name: 'belongArea', field: {type: 'select', props: {mode: 'multiple',}}, label: '管理大区', initialSource: getDictionarySource('BUSINESS_belongArea'), },
1174
1174
  ...(modalTableBusProps?.needStatusSearch?[{ name: 'qp-isEnable-eq', type: 'select', label: '逻辑仓状态', initialSource: getDictionarySource('SC00001') }]:[])
@@ -1240,8 +1240,8 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1240
1240
  ...requestConfigProp,
1241
1241
  }
1242
1242
  tableSearchForm = [
1243
- { name: 'qp-name-like', label: '运营仓名称' },
1244
- { name: 'qp-operationWarehouseCode-like', label: '运营仓编码' },
1243
+ { name: 'name*multiInput', label: '运营仓名称', type: 'multipleQueryInput' },
1244
+ { name: 'operationWarehouseCode*multiInput', label: '运营仓编码', type: 'multipleQueryInput' },
1245
1245
  { name: 'qp-groupCode-in', type: 'select', label: '运营组', field: {
1246
1246
  type: 'select',
1247
1247
  props: {
@@ -1818,8 +1818,8 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1818
1818
  ...requestConfigProp,
1819
1819
  }
1820
1820
  tableSearchForm = [
1821
- { name: 'qp-name-in', label: '商店名称', type: 'multipleQueryInput' },
1822
- { name: 'qp-code-in', label: '商店编码', type: 'multipleQueryInput' },
1821
+ { name: 'name*multiInput', label: '商店名称', type: 'multipleQueryInput' },
1822
+ { name: 'code*multiInput', label: '商店编码', type: 'multipleQueryInput' },
1823
1823
  { name: 'qp-type-in', type: 'select', label: '商店类型', initialSource: shopFile2Type },
1824
1824
  { name: 'qp-status-in', type: 'select', label: '商店状态', initialSource: shopFile2Status },
1825
1825
  { name: 'qp-orgCode-in', type: 'select', label: '所属销售组织', field: {
@@ -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
- // showtoolbarConfig: {
237
- // undoRedo: true, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
238
- // paintFormat: false, //格式刷
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: false, // 计数栏
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} 条数据{!notValid && `, 其中错误 ${totalSummary.error} 项`}
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
@@ -158,12 +158,14 @@ export const handleParams = (params: any) => {
158
158
  delete params[key];
159
159
  } else if (element && key.indexOf('*multiInput') >= 0) {
160
160
  let name = '',
161
- value = element['value'];
161
+ value = (element?.['value']||element)?.trim?.();
162
+ const searchKey = element?.['name']||key?.split('*multiInput')?.[0]
162
163
  if (value.indexOf(',') >= 0) {
163
- name = `qp-${element['name']}-in`;
164
+ name = `qp-${searchKey}-in`;
164
165
  } else {
165
- name = `qp-${element['name']}-like`;
166
+ name = `qp-${searchKey}-like`;
166
167
  }
168
+ value = value?.trim?.();
167
169
  params[name] = value;
168
170
  delete params[key];
169
171
  }