@bit-sun/business-component 3.1.9-alpha.1 → 3.1.9

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/index.esm.js CHANGED
@@ -2613,6 +2613,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2613
2613
  var _this;
2614
2614
  _classCallCheck(this, DataValidation);
2615
2615
  _this = _callSuper(this, DataValidation, [props]);
2616
+ // this.props.onRef(this);
2616
2617
  _this.getCount = function () {
2617
2618
  var resultData = _this.state.resultData;
2618
2619
  return {
@@ -3072,7 +3073,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3072
3073
  resultData: resultData
3073
3074
  });
3074
3075
  };
3075
- _this.props.onRef(_this);
3076
3076
  var format = {
3077
3077
  fa: FORMAT_NAME_GENERAL,
3078
3078
  t: FORMAT_TYPE_STRING
@@ -3117,6 +3117,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3117
3117
  }, {
3118
3118
  key: "componentDidMount",
3119
3119
  value: function componentDidMount() {
3120
+ this.props.onRef(this);
3120
3121
  luckysheet.create(this.setConfig([]));
3121
3122
  }
3122
3123
  }, {
@@ -11841,8 +11842,9 @@ var CommodityEntry = function CommodityEntry(props) {
11841
11842
  modalProps = _useState2[0],
11842
11843
  setModalProps = _useState2[1];
11843
11844
  var handleOk = function handleOk() {
11845
+ var _dataValidationRef$cu;
11844
11846
  // 方法获取当前组件内部的数据,然后进行自身的业务操作
11845
- var resultData = dataValidationRef.getValidateData();
11847
+ var resultData = (_dataValidationRef$cu = dataValidationRef.current) === null || _dataValidationRef$cu === void 0 ? void 0 : _dataValidationRef$cu.getValidateData();
11846
11848
  if (!resultData.successData.length) {
11847
11849
  message$1.error("无校验通过数据,请校验数据");
11848
11850
  return;
@@ -11872,7 +11874,7 @@ var CommodityEntry = function CommodityEntry(props) {
11872
11874
  zIndex: 15
11873
11875
  }, otherModalProps), /*#__PURE__*/React$1.createElement(DataValidation, _objectSpread2(_objectSpread2({}, props), {}, {
11874
11876
  onRef: function onRef(ref) {
11875
- dataValidationRef = ref;
11877
+ dataValidationRef.current = ref;
11876
11878
  },
11877
11879
  columns: columns,
11878
11880
  validDataUrl: validDataUrl,
@@ -12309,6 +12311,16 @@ var handleDefaultProps = function handleDefaultProps(type, otherRequestConfig) {
12309
12311
  }, otherRequestConfig)
12310
12312
  };
12311
12313
  break;
12314
+ case 'background-category':
12315
+ result = {
12316
+ isChoose: true,
12317
+ remoteSource: _objectSpread2({
12318
+ url: "/items/category/queryCategoryTree",
12319
+ headers: otherRequestConfig === null || otherRequestConfig === void 0 ? void 0 : otherRequestConfig.extralHeaders,
12320
+ resKeyValue: ['categoryCode', 'name']
12321
+ }, otherRequestConfig)
12322
+ };
12323
+ break;
12312
12324
  default:
12313
12325
  result = {
12314
12326
  treeCheckable: true,
@@ -31660,6 +31672,200 @@ var RuleField = /*#__PURE__*/function (_Component) {
31660
31672
  });
31661
31673
  }
31662
31674
  }
31675
+ // 品牌选择器
31676
+ if (dataChoiceBusinessType == 410) {
31677
+ if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
31678
+ return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(BusinessSearchSelect$1, {
31679
+ selectBusinessType: "brand",
31680
+ selectProps: _objectSpread2({
31681
+ style: styleCommon,
31682
+ placeholder: '请选择品牌'
31683
+ }, dataInputBusinessType === 12 ? {
31684
+ mode: 'multiple',
31685
+ maxTagCount: 1
31686
+ } : {}),
31687
+ disabled: disabled,
31688
+ labelInValue: true,
31689
+ value: values[0],
31690
+ requestConfig: {
31691
+ filterInit: 'qp-brandCode-in'
31692
+ },
31693
+ onChange: function onChange(value) {
31694
+ if (dataInputBusinessType === 12) {
31695
+ values[0] = value.map(function (i) {
31696
+ return i.key;
31697
+ });
31698
+ valueNames[0] = value.map(function (i) {
31699
+ return i.label || '';
31700
+ });
31701
+ } else {
31702
+ values[0] = [value.key];
31703
+ valueNames[0] = [value.label || ''];
31704
+ }
31705
+ callback(values, valueNames);
31706
+ },
31707
+ getPopupContainer: function getPopupContainer() {
31708
+ return document.body;
31709
+ }
31710
+ }), /*#__PURE__*/React$1.createElement("span", null, "~"), /*#__PURE__*/React$1.createElement(BusinessSearchSelect$1, {
31711
+ selectBusinessType: "brand",
31712
+ selectProps: _objectSpread2({
31713
+ style: styleCommon,
31714
+ placeholder: '请选择品牌'
31715
+ }, dataInputBusinessType === 12 ? {
31716
+ mode: 'multiple',
31717
+ maxTagCount: 1
31718
+ } : {}),
31719
+ disabled: disabled,
31720
+ labelInValue: true,
31721
+ value: values[1],
31722
+ requestConfig: {
31723
+ filterInit: 'qp-brandCode-in'
31724
+ },
31725
+ onChange: function onChange(value) {
31726
+ if (dataInputBusinessType === 12) {
31727
+ values[1] = value.map(function (i) {
31728
+ return i.key;
31729
+ });
31730
+ valueNames[1] = value.map(function (i) {
31731
+ return i.label || '';
31732
+ });
31733
+ } else {
31734
+ values[1] = [value.key];
31735
+ valueNames[1] = [value.label || ''];
31736
+ }
31737
+ callback(values, valueNames);
31738
+ },
31739
+ getPopupContainer: function getPopupContainer() {
31740
+ return document.body;
31741
+ }
31742
+ }));
31743
+ } else {
31744
+ var _values13;
31745
+ var _currentValue12 = dataInputBusinessType === 12 ? ((_values13 = values) === null || _values13 === void 0 ? void 0 : _values13.map(function (s, vIndex) {
31746
+ return {
31747
+ key: s,
31748
+ label: valueNames[vIndex]
31749
+ };
31750
+ })) || [] : values[0] && {
31751
+ key: values[0],
31752
+ label: valueNames[0]
31753
+ } || {};
31754
+ return /*#__PURE__*/React$1.createElement(BusinessSearchSelect$1, {
31755
+ selectBusinessType: "brand",
31756
+ selectProps: _objectSpread2({
31757
+ style: styleCommon,
31758
+ placeholder: '请选择品牌'
31759
+ }, dataInputBusinessType === 12 ? {
31760
+ mode: 'multiple',
31761
+ maxTagCount: 1
31762
+ } : {}),
31763
+ disabled: disabled,
31764
+ labelInValue: true,
31765
+ value: _currentValue12,
31766
+ requestConfig: {
31767
+ filterInit: 'qp-brandCode-in'
31768
+ },
31769
+ onChange: function onChange(value) {
31770
+ if (dataInputBusinessType === 12) {
31771
+ values = value.map(function (i) {
31772
+ return i.key;
31773
+ }) || [];
31774
+ valueNames = value.map(function (i) {
31775
+ return i.label || '';
31776
+ }) || [];
31777
+ } else {
31778
+ values = (value === null || value === void 0 ? void 0 : value.key) ? [value.key] : [];
31779
+ valueNames = (value === null || value === void 0 ? void 0 : value.label) ? [value.label] : [];
31780
+ }
31781
+ callback(values, valueNames);
31782
+ },
31783
+ getPopupContainer: function getPopupContainer() {
31784
+ return document.body;
31785
+ }
31786
+ });
31787
+ }
31788
+ }
31789
+ // 类目选择器
31790
+ if (dataChoiceBusinessType == 420) {
31791
+ if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
31792
+ return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(BusinessTreeSearchSelect$1, {
31793
+ disabled: disabled,
31794
+ treeCheckable: dataInputBusinessType === 12,
31795
+ businessType: "background-category",
31796
+ labelInValue: true,
31797
+ value: values[0],
31798
+ style: styleCommon,
31799
+ onChange: function onChange(value) {
31800
+ if (dataInputBusinessType === 12) {
31801
+ values[0] = value.map(function (i) {
31802
+ return i.key;
31803
+ });
31804
+ valueNames[0] = value.map(function (i) {
31805
+ return i.label || '';
31806
+ });
31807
+ } else {
31808
+ values[0] = [value.key];
31809
+ valueNames[0] = [value.label || ''];
31810
+ }
31811
+ callback(values, valueNames);
31812
+ },
31813
+ getPopupContainer: function getPopupContainer() {
31814
+ return document.body;
31815
+ }
31816
+ }), /*#__PURE__*/React$1.createElement("span", null, "~"), /*#__PURE__*/React$1.createElement(BusinessTreeSearchSelect$1, {
31817
+ disabled: disabled,
31818
+ treeCheckable: dataInputBusinessType === 12,
31819
+ businessType: "background-category",
31820
+ labelInValue: true,
31821
+ value: values[0],
31822
+ style: styleCommon,
31823
+ onChange: function onChange(value) {
31824
+ if (dataInputBusinessType === 12) {
31825
+ values[1] = value.map(function (i) {
31826
+ return i.key;
31827
+ });
31828
+ valueNames[1] = value.map(function (i) {
31829
+ return i.label || '';
31830
+ });
31831
+ } else {
31832
+ values[1] = [value.key];
31833
+ valueNames[1] = [value.label || ''];
31834
+ }
31835
+ callback(values, valueNames);
31836
+ },
31837
+ getPopupContainer: function getPopupContainer() {
31838
+ return document.body;
31839
+ }
31840
+ }));
31841
+ } else {
31842
+ return /*#__PURE__*/React$1.createElement(BusinessTreeSearchSelect$1, {
31843
+ disabled: disabled,
31844
+ treeCheckable: dataInputBusinessType === 12,
31845
+ businessType: "background-category",
31846
+ labelInValue: true,
31847
+ value: values[0],
31848
+ style: styleCommon,
31849
+ onChange: function onChange(value) {
31850
+ if (dataInputBusinessType === 12) {
31851
+ values = value.map(function (i) {
31852
+ return i.key;
31853
+ }) || [];
31854
+ valueNames = value.map(function (i) {
31855
+ return i.label || '';
31856
+ }) || [];
31857
+ } else {
31858
+ values = (value === null || value === void 0 ? void 0 : value.key) ? [value.key] : [];
31859
+ valueNames = (value === null || value === void 0 ? void 0 : value.label) ? [value.label] : [];
31860
+ }
31861
+ callback(values, valueNames);
31862
+ },
31863
+ getPopupContainer: function getPopupContainer() {
31864
+ return document.body;
31865
+ }
31866
+ });
31867
+ }
31868
+ }
31663
31869
  } else {
31664
31870
  if (dataTypeCode == 22 || dataTypeCode == 21 || dataTypeCode == 24 || dataTypeCode == 23) {
31665
31871
  //数值22, 字符串21, 布尔类型24, long23
@@ -32913,6 +33119,40 @@ function RenderCompItem(props) {
32913
33119
  getPopupContainer: function getPopupContainer() {
32914
33120
  return document.body;
32915
33121
  }
33122
+ })) || null, ((ites === null || ites === void 0 ? void 0 : ites.inputType) === 20 || (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30) && (ites === null || ites === void 0 ? void 0 : ites.choiceType) === 410 && ( /*#__PURE__*/React$1.createElement(BusinessSearchSelect$1, {
33123
+ selectBusinessType: "brand",
33124
+ selectProps: _objectSpread2({
33125
+ style: styleCommon,
33126
+ placeholder: '请选择品牌'
33127
+ }, (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30 ? {
33128
+ mode: 'multiple',
33129
+ maxTagCount: 1
33130
+ } : {}),
33131
+ disabled: disabled,
33132
+ labelInValue: true,
33133
+ value: showValue(ites.code),
33134
+ requestConfig: {
33135
+ filterInit: 'qp-brandCode-in'
33136
+ },
33137
+ onChange: function onChange(value) {
33138
+ handleEdit(ites.code, value);
33139
+ },
33140
+ getPopupContainer: function getPopupContainer() {
33141
+ return document.body;
33142
+ }
33143
+ })) || null, ((ites === null || ites === void 0 ? void 0 : ites.inputType) === 20 || (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30) && (ites === null || ites === void 0 ? void 0 : ites.choiceType) === 420 && ( /*#__PURE__*/React$1.createElement(BusinessTreeSearchSelect$1, {
33144
+ disabled: disabled,
33145
+ treeCheckable: (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30,
33146
+ businessType: "background-category",
33147
+ labelInValue: true,
33148
+ value: showValue(ites.code),
33149
+ style: styleCommon,
33150
+ onChange: function onChange(value) {
33151
+ handleEdit(ites.code, value);
33152
+ },
33153
+ getPopupContainer: function getPopupContainer() {
33154
+ return document.body;
33155
+ }
32916
33156
  })) || null, (ites === null || ites === void 0 ? void 0 : ites.inputType) === 40 && ( /*#__PURE__*/React$1.createElement("div", {
32917
33157
  style: {
32918
33158
  display: 'flex'
package/dist/index.js CHANGED
@@ -2636,6 +2636,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2636
2636
  var _this;
2637
2637
  _classCallCheck(this, DataValidation);
2638
2638
  _this = _callSuper(this, DataValidation, [props]);
2639
+ // this.props.onRef(this);
2639
2640
  _this.getCount = function () {
2640
2641
  var resultData = _this.state.resultData;
2641
2642
  return {
@@ -3095,7 +3096,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3095
3096
  resultData: resultData
3096
3097
  });
3097
3098
  };
3098
- _this.props.onRef(_this);
3099
3099
  var format = {
3100
3100
  fa: FORMAT_NAME_GENERAL,
3101
3101
  t: FORMAT_TYPE_STRING
@@ -3140,6 +3140,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3140
3140
  }, {
3141
3141
  key: "componentDidMount",
3142
3142
  value: function componentDidMount() {
3143
+ this.props.onRef(this);
3143
3144
  luckysheet.create(this.setConfig([]));
3144
3145
  }
3145
3146
  }, {
@@ -11864,8 +11865,9 @@ var CommodityEntry = function CommodityEntry(props) {
11864
11865
  modalProps = _useState2[0],
11865
11866
  setModalProps = _useState2[1];
11866
11867
  var handleOk = function handleOk() {
11868
+ var _dataValidationRef$cu;
11867
11869
  // 方法获取当前组件内部的数据,然后进行自身的业务操作
11868
- var resultData = dataValidationRef.getValidateData();
11870
+ var resultData = (_dataValidationRef$cu = dataValidationRef.current) === null || _dataValidationRef$cu === void 0 ? void 0 : _dataValidationRef$cu.getValidateData();
11869
11871
  if (!resultData.successData.length) {
11870
11872
  antd.message.error("无校验通过数据,请校验数据");
11871
11873
  return;
@@ -11895,7 +11897,7 @@ var CommodityEntry = function CommodityEntry(props) {
11895
11897
  zIndex: 15
11896
11898
  }, otherModalProps), /*#__PURE__*/React__default['default'].createElement(DataValidation, _objectSpread2(_objectSpread2({}, props), {}, {
11897
11899
  onRef: function onRef(ref) {
11898
- dataValidationRef = ref;
11900
+ dataValidationRef.current = ref;
11899
11901
  },
11900
11902
  columns: columns,
11901
11903
  validDataUrl: validDataUrl,
@@ -12332,6 +12334,16 @@ var handleDefaultProps = function handleDefaultProps(type, otherRequestConfig) {
12332
12334
  }, otherRequestConfig)
12333
12335
  };
12334
12336
  break;
12337
+ case 'background-category':
12338
+ result = {
12339
+ isChoose: true,
12340
+ remoteSource: _objectSpread2({
12341
+ url: "/items/category/queryCategoryTree",
12342
+ headers: otherRequestConfig === null || otherRequestConfig === void 0 ? void 0 : otherRequestConfig.extralHeaders,
12343
+ resKeyValue: ['categoryCode', 'name']
12344
+ }, otherRequestConfig)
12345
+ };
12346
+ break;
12335
12347
  default:
12336
12348
  result = {
12337
12349
  treeCheckable: true,
@@ -31683,6 +31695,200 @@ var RuleField = /*#__PURE__*/function (_Component) {
31683
31695
  });
31684
31696
  }
31685
31697
  }
31698
+ // 品牌选择器
31699
+ if (dataChoiceBusinessType == 410) {
31700
+ if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
31701
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(BusinessSearchSelect$1, {
31702
+ selectBusinessType: "brand",
31703
+ selectProps: _objectSpread2({
31704
+ style: styleCommon,
31705
+ placeholder: '请选择品牌'
31706
+ }, dataInputBusinessType === 12 ? {
31707
+ mode: 'multiple',
31708
+ maxTagCount: 1
31709
+ } : {}),
31710
+ disabled: disabled,
31711
+ labelInValue: true,
31712
+ value: values[0],
31713
+ requestConfig: {
31714
+ filterInit: 'qp-brandCode-in'
31715
+ },
31716
+ onChange: function onChange(value) {
31717
+ if (dataInputBusinessType === 12) {
31718
+ values[0] = value.map(function (i) {
31719
+ return i.key;
31720
+ });
31721
+ valueNames[0] = value.map(function (i) {
31722
+ return i.label || '';
31723
+ });
31724
+ } else {
31725
+ values[0] = [value.key];
31726
+ valueNames[0] = [value.label || ''];
31727
+ }
31728
+ callback(values, valueNames);
31729
+ },
31730
+ getPopupContainer: function getPopupContainer() {
31731
+ return document.body;
31732
+ }
31733
+ }), /*#__PURE__*/React__default['default'].createElement("span", null, "~"), /*#__PURE__*/React__default['default'].createElement(BusinessSearchSelect$1, {
31734
+ selectBusinessType: "brand",
31735
+ selectProps: _objectSpread2({
31736
+ style: styleCommon,
31737
+ placeholder: '请选择品牌'
31738
+ }, dataInputBusinessType === 12 ? {
31739
+ mode: 'multiple',
31740
+ maxTagCount: 1
31741
+ } : {}),
31742
+ disabled: disabled,
31743
+ labelInValue: true,
31744
+ value: values[1],
31745
+ requestConfig: {
31746
+ filterInit: 'qp-brandCode-in'
31747
+ },
31748
+ onChange: function onChange(value) {
31749
+ if (dataInputBusinessType === 12) {
31750
+ values[1] = value.map(function (i) {
31751
+ return i.key;
31752
+ });
31753
+ valueNames[1] = value.map(function (i) {
31754
+ return i.label || '';
31755
+ });
31756
+ } else {
31757
+ values[1] = [value.key];
31758
+ valueNames[1] = [value.label || ''];
31759
+ }
31760
+ callback(values, valueNames);
31761
+ },
31762
+ getPopupContainer: function getPopupContainer() {
31763
+ return document.body;
31764
+ }
31765
+ }));
31766
+ } else {
31767
+ var _values13;
31768
+ var _currentValue12 = dataInputBusinessType === 12 ? ((_values13 = values) === null || _values13 === void 0 ? void 0 : _values13.map(function (s, vIndex) {
31769
+ return {
31770
+ key: s,
31771
+ label: valueNames[vIndex]
31772
+ };
31773
+ })) || [] : values[0] && {
31774
+ key: values[0],
31775
+ label: valueNames[0]
31776
+ } || {};
31777
+ return /*#__PURE__*/React__default['default'].createElement(BusinessSearchSelect$1, {
31778
+ selectBusinessType: "brand",
31779
+ selectProps: _objectSpread2({
31780
+ style: styleCommon,
31781
+ placeholder: '请选择品牌'
31782
+ }, dataInputBusinessType === 12 ? {
31783
+ mode: 'multiple',
31784
+ maxTagCount: 1
31785
+ } : {}),
31786
+ disabled: disabled,
31787
+ labelInValue: true,
31788
+ value: _currentValue12,
31789
+ requestConfig: {
31790
+ filterInit: 'qp-brandCode-in'
31791
+ },
31792
+ onChange: function onChange(value) {
31793
+ if (dataInputBusinessType === 12) {
31794
+ values = value.map(function (i) {
31795
+ return i.key;
31796
+ }) || [];
31797
+ valueNames = value.map(function (i) {
31798
+ return i.label || '';
31799
+ }) || [];
31800
+ } else {
31801
+ values = (value === null || value === void 0 ? void 0 : value.key) ? [value.key] : [];
31802
+ valueNames = (value === null || value === void 0 ? void 0 : value.label) ? [value.label] : [];
31803
+ }
31804
+ callback(values, valueNames);
31805
+ },
31806
+ getPopupContainer: function getPopupContainer() {
31807
+ return document.body;
31808
+ }
31809
+ });
31810
+ }
31811
+ }
31812
+ // 类目选择器
31813
+ if (dataChoiceBusinessType == 420) {
31814
+ if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
31815
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(BusinessTreeSearchSelect$1, {
31816
+ disabled: disabled,
31817
+ treeCheckable: dataInputBusinessType === 12,
31818
+ businessType: "background-category",
31819
+ labelInValue: true,
31820
+ value: values[0],
31821
+ style: styleCommon,
31822
+ onChange: function onChange(value) {
31823
+ if (dataInputBusinessType === 12) {
31824
+ values[0] = value.map(function (i) {
31825
+ return i.key;
31826
+ });
31827
+ valueNames[0] = value.map(function (i) {
31828
+ return i.label || '';
31829
+ });
31830
+ } else {
31831
+ values[0] = [value.key];
31832
+ valueNames[0] = [value.label || ''];
31833
+ }
31834
+ callback(values, valueNames);
31835
+ },
31836
+ getPopupContainer: function getPopupContainer() {
31837
+ return document.body;
31838
+ }
31839
+ }), /*#__PURE__*/React__default['default'].createElement("span", null, "~"), /*#__PURE__*/React__default['default'].createElement(BusinessTreeSearchSelect$1, {
31840
+ disabled: disabled,
31841
+ treeCheckable: dataInputBusinessType === 12,
31842
+ businessType: "background-category",
31843
+ labelInValue: true,
31844
+ value: values[0],
31845
+ style: styleCommon,
31846
+ onChange: function onChange(value) {
31847
+ if (dataInputBusinessType === 12) {
31848
+ values[1] = value.map(function (i) {
31849
+ return i.key;
31850
+ });
31851
+ valueNames[1] = value.map(function (i) {
31852
+ return i.label || '';
31853
+ });
31854
+ } else {
31855
+ values[1] = [value.key];
31856
+ valueNames[1] = [value.label || ''];
31857
+ }
31858
+ callback(values, valueNames);
31859
+ },
31860
+ getPopupContainer: function getPopupContainer() {
31861
+ return document.body;
31862
+ }
31863
+ }));
31864
+ } else {
31865
+ return /*#__PURE__*/React__default['default'].createElement(BusinessTreeSearchSelect$1, {
31866
+ disabled: disabled,
31867
+ treeCheckable: dataInputBusinessType === 12,
31868
+ businessType: "background-category",
31869
+ labelInValue: true,
31870
+ value: values[0],
31871
+ style: styleCommon,
31872
+ onChange: function onChange(value) {
31873
+ if (dataInputBusinessType === 12) {
31874
+ values = value.map(function (i) {
31875
+ return i.key;
31876
+ }) || [];
31877
+ valueNames = value.map(function (i) {
31878
+ return i.label || '';
31879
+ }) || [];
31880
+ } else {
31881
+ values = (value === null || value === void 0 ? void 0 : value.key) ? [value.key] : [];
31882
+ valueNames = (value === null || value === void 0 ? void 0 : value.label) ? [value.label] : [];
31883
+ }
31884
+ callback(values, valueNames);
31885
+ },
31886
+ getPopupContainer: function getPopupContainer() {
31887
+ return document.body;
31888
+ }
31889
+ });
31890
+ }
31891
+ }
31686
31892
  } else {
31687
31893
  if (dataTypeCode == 22 || dataTypeCode == 21 || dataTypeCode == 24 || dataTypeCode == 23) {
31688
31894
  //数值22, 字符串21, 布尔类型24, long23
@@ -32936,6 +33142,40 @@ function RenderCompItem(props) {
32936
33142
  getPopupContainer: function getPopupContainer() {
32937
33143
  return document.body;
32938
33144
  }
33145
+ })) || null, ((ites === null || ites === void 0 ? void 0 : ites.inputType) === 20 || (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30) && (ites === null || ites === void 0 ? void 0 : ites.choiceType) === 410 && ( /*#__PURE__*/React__default['default'].createElement(BusinessSearchSelect$1, {
33146
+ selectBusinessType: "brand",
33147
+ selectProps: _objectSpread2({
33148
+ style: styleCommon,
33149
+ placeholder: '请选择品牌'
33150
+ }, (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30 ? {
33151
+ mode: 'multiple',
33152
+ maxTagCount: 1
33153
+ } : {}),
33154
+ disabled: disabled,
33155
+ labelInValue: true,
33156
+ value: showValue(ites.code),
33157
+ requestConfig: {
33158
+ filterInit: 'qp-brandCode-in'
33159
+ },
33160
+ onChange: function onChange(value) {
33161
+ handleEdit(ites.code, value);
33162
+ },
33163
+ getPopupContainer: function getPopupContainer() {
33164
+ return document.body;
33165
+ }
33166
+ })) || null, ((ites === null || ites === void 0 ? void 0 : ites.inputType) === 20 || (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30) && (ites === null || ites === void 0 ? void 0 : ites.choiceType) === 420 && ( /*#__PURE__*/React__default['default'].createElement(BusinessTreeSearchSelect$1, {
33167
+ disabled: disabled,
33168
+ treeCheckable: (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30,
33169
+ businessType: "background-category",
33170
+ labelInValue: true,
33171
+ value: showValue(ites.code),
33172
+ style: styleCommon,
33173
+ onChange: function onChange(value) {
33174
+ handleEdit(ites.code, value);
33175
+ },
33176
+ getPopupContainer: function getPopupContainer() {
33177
+ return document.body;
33178
+ }
32939
33179
  })) || null, (ites === null || ites === void 0 ? void 0 : ites.inputType) === 40 && ( /*#__PURE__*/React__default['default'].createElement("div", {
32940
33180
  style: {
32941
33181
  display: 'flex'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "3.1.9-alpha.1",
3
+ "version": "3.1.9",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -34,7 +34,7 @@ const CommodityEntry = (props: any) => {
34
34
 
35
35
  const handleOk = () => {
36
36
  // 方法获取当前组件内部的数据,然后进行自身的业务操作
37
- const resultData = dataValidationRef.getValidateData();
37
+ const resultData = dataValidationRef.current?.getValidateData();
38
38
 
39
39
  if (!resultData.successData.length) {
40
40
  message.error("无校验通过数据,请校验数据");
@@ -67,7 +67,7 @@ const CommodityEntry = (props: any) => {
67
67
  <Modal {...modalProps} onOk={handleOk} onCancel={handleCancel} destroyOnClose={true} zIndex={15} {...otherModalProps} >
68
68
  <DataValidation
69
69
  {...props}
70
- onRef={(ref) => { dataValidationRef = ref }}
70
+ onRef={(ref) => { dataValidationRef.current = ref }}
71
71
  columns={columns}
72
72
  validDataUrl={validDataUrl}
73
73
  isBrandAuth={isBrandAuth}
@@ -208,4 +208,32 @@ export default () => {
208
208
  };
209
209
  ```
210
210
 
211
+
212
+ 类目选择器:
213
+
214
+ ```tsx
215
+ import React, { useState } from 'react';
216
+ import { BusinessTreeSearchSelect } from '../../../index';
217
+
218
+ export default () => {
219
+
220
+ const [value, setValue] = useState();
221
+
222
+ const props = {
223
+ mode: 'create',
224
+ value,
225
+ onChange: (v) => {
226
+ setValue(v)
227
+ },
228
+ businessType: 'background-category'
229
+ };
230
+
231
+ return (
232
+ <div>
233
+ <BusinessTreeSearchSelect {...props} />
234
+ </div>
235
+ );
236
+ };
237
+ ```
238
+
211
239
  More skills for writing demo: https://d.umijs.org/guide/demo-principle
@@ -84,6 +84,17 @@ const handleDefaultProps = (type: string, otherRequestConfig: {extralHeaders?: s
84
84
  },
85
85
  };
86
86
  break;
87
+ case 'background-category':
88
+ result = {
89
+ isChoose: true,
90
+ remoteSource: {
91
+ url: `/items/category/queryCategoryTree`,
92
+ headers: otherRequestConfig?.extralHeaders,
93
+ resKeyValue: ['categoryCode', 'name'],
94
+ ...otherRequestConfig,
95
+ },
96
+ };
97
+ break;
87
98
  default:
88
99
  result = {
89
100
  treeCheckable: true,
@@ -131,7 +131,7 @@ const FORMAT_TYPE_STRING = "s"; //格式类型为数字类型
131
131
  class DataValidation extends React.Component {
132
132
  constructor(props) {
133
133
  super(props);
134
- this.props.onRef(this);
134
+ // this.props.onRef(this);
135
135
 
136
136
  const format = { fa: FORMAT_NAME_GENERAL, t: FORMAT_TYPE_STRING };
137
137
  if (props?.customerColumnsMapping?.length) {
@@ -381,6 +381,7 @@ class DataValidation extends React.Component {
381
381
  };
382
382
 
383
383
  componentDidMount() {
384
+ this.props.onRef(this);
384
385
  luckysheet.create(this.setConfig([]));
385
386
  }
386
387
 
@@ -639,6 +639,51 @@ export default function RenderCompItem(props:any){
639
639
  />
640
640
  )) ||
641
641
  null}
642
+ {/* 单选/多选 品牌选择器 */}
643
+ {((ites?.inputType === 20 || ites?.inputType === 30) &&
644
+ ites?.choiceType === 410 && (
645
+ <BusinessSearchSelect
646
+ selectBusinessType="brand"
647
+ selectProps={{
648
+ style: styleCommon,
649
+ placeholder: '请选择品牌',
650
+ ...(ites?.inputType === 30
651
+ ? {
652
+ mode: 'multiple',
653
+ maxTagCount: 1,
654
+ }
655
+ : {}),
656
+ }}
657
+ disabled={disabled}
658
+ labelInValue={true}
659
+ value={showValue(ites.code)}
660
+ requestConfig={{
661
+ filterInit: 'qp-brandCode-in',
662
+ }}
663
+ onChange={(value) => {
664
+ handleEdit(ites.code, value);
665
+ }}
666
+ getPopupContainer={() => document.body}
667
+ />
668
+ )) ||
669
+ null}
670
+ {/* 单选/多选 类目选择器 */}
671
+ {((ites?.inputType === 20 || ites?.inputType === 30) &&
672
+ ites?.choiceType === 420 && (
673
+ <BusinessTreeSearchSelect
674
+ disabled={disabled}
675
+ treeCheckable={ites?.inputType === 30}
676
+ businessType="background-category"
677
+ labelInValue={true}
678
+ value={showValue(ites.code)}
679
+ style={styleCommon}
680
+ onChange={(value) => {
681
+ handleEdit(ites.code, value);
682
+ }}
683
+ getPopupContainer={() => document.body}
684
+ />
685
+ )) ||
686
+ null}
642
687
  {/* 表达式 */}
643
688
  {ites?.inputType === 40 && (
644
689
  <div style={{ display: 'flex' }}>
@@ -2131,6 +2131,182 @@ export default class RuleField extends Component {
2131
2131
  );
2132
2132
  }
2133
2133
  }
2134
+ // 品牌选择器
2135
+ if (dataChoiceBusinessType == 410) {
2136
+ if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
2137
+ return (
2138
+ <>
2139
+ <BusinessSearchSelect
2140
+ selectBusinessType="brand"
2141
+ selectProps={{
2142
+ style: styleCommon,
2143
+ placeholder: '请选择品牌',
2144
+ ...(dataInputBusinessType === 12
2145
+ ? {
2146
+ mode: 'multiple',
2147
+ maxTagCount: 1,
2148
+ }
2149
+ : {}),
2150
+ }}
2151
+ disabled={disabled}
2152
+ labelInValue={true}
2153
+ value={values[0]}
2154
+ requestConfig={{
2155
+ filterInit: 'qp-brandCode-in',
2156
+ }}
2157
+ onChange={(value) => {
2158
+ if (dataInputBusinessType === 12) {
2159
+ values[0] = value.map((i) => i.key);
2160
+ valueNames[0] = value.map((i) => i.label || '');
2161
+ } else {
2162
+ values[0] = [value.key];
2163
+ valueNames[0] = [value.label || ''];
2164
+ }
2165
+ callback(values, valueNames);
2166
+ }}
2167
+ getPopupContainer={() => document.body}
2168
+ />
2169
+ <span>~</span>
2170
+ <BusinessSearchSelect
2171
+ selectBusinessType="brand"
2172
+ selectProps={{
2173
+ style: styleCommon,
2174
+ placeholder: '请选择品牌',
2175
+ ...(dataInputBusinessType === 12
2176
+ ? {
2177
+ mode: 'multiple',
2178
+ maxTagCount: 1,
2179
+ }
2180
+ : {}),
2181
+ }}
2182
+ disabled={disabled}
2183
+ labelInValue={true}
2184
+ value={values[1]}
2185
+ requestConfig={{
2186
+ filterInit: 'qp-brandCode-in',
2187
+ }}
2188
+ onChange={(value) => {
2189
+ if (dataInputBusinessType === 12) {
2190
+ values[1] = value.map((i) => i.key);
2191
+ valueNames[1] = value.map((i) => i.label || '');
2192
+ } else {
2193
+ values[1] = [value.key];
2194
+ valueNames[1] = [value.label || ''];
2195
+ }
2196
+ callback(values, valueNames);
2197
+ }}
2198
+ getPopupContainer={() => document.body}
2199
+ />
2200
+ </>
2201
+ );
2202
+ } else {
2203
+ const currentValue = dataInputBusinessType === 12 ?
2204
+ values?.map((s,vIndex)=> ({key: s, label: valueNames[vIndex]}))||[]
2205
+ : values[0]&&{key:values[0],label:valueNames[0]}||{}
2206
+ return (
2207
+ <BusinessSearchSelect
2208
+ selectBusinessType="brand"
2209
+ selectProps={{
2210
+ style: styleCommon,
2211
+ placeholder: '请选择品牌',
2212
+ ...(dataInputBusinessType === 12
2213
+ ? {
2214
+ mode: 'multiple',
2215
+ maxTagCount: 1,
2216
+ }
2217
+ : {}),
2218
+ }}
2219
+ disabled={disabled}
2220
+ labelInValue={true}
2221
+ value={currentValue}
2222
+ requestConfig={{
2223
+ filterInit: 'qp-brandCode-in',
2224
+ }}
2225
+ onChange={(value) => {
2226
+ if (dataInputBusinessType === 12) {
2227
+ values = value.map((i) => i.key)||[];
2228
+ valueNames = value.map((i) => i.label || '')||[];
2229
+ } else {
2230
+ values = value?.key?[value.key]:[];
2231
+ valueNames = value?.label?[value.label]:[];
2232
+ }
2233
+ callback(values, valueNames);
2234
+ }}
2235
+ getPopupContainer={() => document.body}
2236
+ />
2237
+ );
2238
+ }
2239
+ }
2240
+ // 类目选择器
2241
+ if (dataChoiceBusinessType == 420) {
2242
+ if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
2243
+ return (
2244
+ <>
2245
+ <BusinessTreeSearchSelect
2246
+ disabled={disabled}
2247
+ treeCheckable={dataInputBusinessType === 12}
2248
+ businessType="background-category"
2249
+ labelInValue={true}
2250
+ value={values[0]}
2251
+ style={styleCommon}
2252
+ onChange={(value) => {
2253
+ if (dataInputBusinessType === 12) {
2254
+ values[0] = value.map((i) => i.key);
2255
+ valueNames[0] = value.map((i) => i.label || '');
2256
+ } else {
2257
+ values[0] = [value.key];
2258
+ valueNames[0] = [value.label || ''];
2259
+ }
2260
+ callback(values, valueNames);
2261
+ }}
2262
+ getPopupContainer={() => document.body}
2263
+ />
2264
+ <span>~</span>
2265
+ <BusinessTreeSearchSelect
2266
+ disabled={disabled}
2267
+ treeCheckable={dataInputBusinessType === 12}
2268
+ businessType="background-category"
2269
+ labelInValue={true}
2270
+ value={values[0]}
2271
+ style={styleCommon}
2272
+ onChange={(value) => {
2273
+ if (dataInputBusinessType === 12) {
2274
+ values[1] = value.map((i) => i.key);
2275
+ valueNames[1] = value.map((i) => i.label || '');
2276
+ } else {
2277
+ values[1] = [value.key];
2278
+ valueNames[1] = [value.label || ''];
2279
+ }
2280
+ callback(values, valueNames);
2281
+ }}
2282
+ getPopupContainer={() => document.body}
2283
+ />
2284
+ </>
2285
+ );
2286
+ } else {
2287
+ return (
2288
+ <BusinessTreeSearchSelect
2289
+ disabled={disabled}
2290
+ treeCheckable={dataInputBusinessType === 12}
2291
+ businessType="background-category"
2292
+ labelInValue={true}
2293
+ value={values[0]}
2294
+ style={styleCommon}
2295
+ onChange={(value) => {
2296
+ if (dataInputBusinessType === 12) {
2297
+ values = value.map((i) => i.key)||[];
2298
+ valueNames = value.map((i) => i.label || '')||[];
2299
+ } else {
2300
+ values = value?.key?[value.key]:[];
2301
+ valueNames = value?.label?[value.label]:[];
2302
+ }
2303
+ callback(values, valueNames);
2304
+ }}
2305
+ getPopupContainer={() => document.body}
2306
+ />
2307
+ );
2308
+ }
2309
+ }
2134
2310
  } else {
2135
2311
  if (
2136
2312
  dataTypeCode == 22 ||