@kmkf-fe-packages/basic-components 0.8.9-alpha.0 → 0.8.9-alpha.14

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
@@ -1,4 +1,4 @@
1
- import React, { useRef, useState, useEffect, useMemo, forwardRef, useImperativeHandle, useCallback } from 'react';
1
+ import React, { useRef, useState, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
2
2
  import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, message, Radio, Space, Spin, Checkbox, Row, Col, Slider, Rate, Button, Form, Tabs, Modal, ConfigProvider, Pagination, Popover, Table } from 'antd';
3
3
  import { EyeOutlined, DeleteOutlined, InboxOutlined } from '@ant-design/icons';
4
4
  import request, { extend as extend$1 } from 'umi-request';
@@ -513,19 +513,22 @@ function ApaasInputNumber(props) {
513
513
  return /*#__PURE__*/React.createElement(InputNumber, _objectSpread2({}, props));
514
514
  }
515
515
 
516
- var _excluded$2 = ["options", "basicMultSelect"];
516
+ var _excluded$2 = ["options", "basicMultSelect", "readonly"];
517
517
  function ApaasSelect(props) {
518
518
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
519
519
  var _props$options = props.options,
520
520
  options = _props$options === void 0 ? [] : _props$options,
521
521
  basicMultSelect = props.basicMultSelect,
522
+ readonly = props.readonly,
522
523
  otherProps = _objectWithoutProperties(props, _excluded$2);
523
524
  return /*#__PURE__*/React.createElement(Select, _objectSpread2(_objectSpread2({}, otherProps), {}, {
525
+ showSearch: !readonly,
524
526
  style: {
525
527
  width: '100%'
526
528
  }
527
529
  }), options.map(function (item) {
528
530
  return /*#__PURE__*/React.createElement(Select.Option, {
531
+ disabled: readonly,
529
532
  value: item.value,
530
533
  key: item.value
531
534
  }, item.label);
@@ -803,7 +806,7 @@ var ApaasUpload = function ApaasUpload(_ref) {
803
806
  })));
804
807
  };
805
808
 
806
- var _excluded$5 = ["showOther", "horizontal", "options", "value", "onChange", "disabled"];
809
+ var _excluded$5 = ["showOther", "horizontal", "options", "value", "onChange", "disabled", "hideUnselectedItem"];
807
810
  function ApaasRadio(props) {
808
811
  var showOther = props.showOther,
809
812
  _props$horizontal = props.horizontal,
@@ -814,6 +817,7 @@ function ApaasRadio(props) {
814
817
  value = _props$value === void 0 ? {} : _props$value,
815
818
  onChange = props.onChange,
816
819
  disabled = props.disabled,
820
+ hideUnselectedItem = props.hideUnselectedItem,
817
821
  otherProps = _objectWithoutProperties(props, _excluded$5);
818
822
  var radioValue = value.value,
819
823
  other = value.other;
@@ -841,13 +845,14 @@ function ApaasRadio(props) {
841
845
  direction: horizontal ? 'horizontal' : 'vertical',
842
846
  wrap: true
843
847
  }, options.map(function (item) {
848
+ if (hideUnselectedItem && item.value !== radioValue) return /*#__PURE__*/React.createElement(React.Fragment, null);
844
849
  return /*#__PURE__*/React.createElement(Radio, {
845
850
  value: item.value,
846
851
  key: item.label,
847
852
  disabled: disabled,
848
853
  onClick: onRadioClick
849
854
  }, item.label);
850
- }), showOther && /*#__PURE__*/React.createElement(Radio, {
855
+ }), showOther && (!hideUnselectedItem || radioValue === '其他') && /*#__PURE__*/React.createElement(Radio, {
851
856
  value: "\u5176\u4ED6",
852
857
  disabled: disabled,
853
858
  onClick: onRadioClick
@@ -9699,13 +9704,14 @@ var ItemList = function ItemList(props) {
9699
9704
  }, "\u6682\u4E0D\u652F\u6301\u6DFB\u52A0")) : null);
9700
9705
  };
9701
9706
 
9707
+ var _excluded$c = ["shopId"];
9702
9708
  var columns = [{
9703
9709
  dataIndex: 'index',
9704
- title: '序号',
9710
+ title: 'NO',
9705
9711
  render: function render(val, record, index) {
9706
9712
  return /*#__PURE__*/React.createElement("div", {
9707
9713
  style: {
9708
- width: '30px'
9714
+ width: 25
9709
9715
  }
9710
9716
  }, index + 1);
9711
9717
  }
@@ -9757,13 +9763,13 @@ var columns = [{
9757
9763
  var GoodsModal$1 = function GoodsModal(props, ref) {
9758
9764
  useImperativeHandle(ref, function () {
9759
9765
  return {
9760
- open: function open() {
9766
+ open: function open(shopCode) {
9761
9767
  setVisible(true);
9762
9768
  setPageNo(1);
9763
9769
  setSelect([]);
9764
9770
  setSelectIds([]);
9765
- queryItems();
9766
- onReset();
9771
+ queryItems(shopCode);
9772
+ getShopList();
9767
9773
  }
9768
9774
  };
9769
9775
  });
@@ -9771,7 +9777,7 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9771
9777
  shopId = props.shopId,
9772
9778
  shopList = props.shopList,
9773
9779
  width = props.width,
9774
- shopCode = props.shopCode;
9780
+ companyKey = props.companyKey;
9775
9781
  var _useState = useState(false),
9776
9782
  _useState2 = _slicedToArray(_useState, 2),
9777
9783
  visible = _useState2[0],
@@ -9811,14 +9817,10 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9811
9817
  _useState20 = _slicedToArray(_useState19, 2),
9812
9818
  total = _useState20[0],
9813
9819
  setTotal = _useState20[1];
9814
- var _useState21 = useState(''),
9820
+ var _useState21 = useState(),
9815
9821
  _useState22 = _slicedToArray(_useState21, 2),
9816
- platform = _useState22[0],
9817
- setPlatform = _useState22[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9818
- var _useState23 = useState({}),
9819
- _useState24 = _slicedToArray(_useState23, 2),
9820
- shopInfo = _useState24[0],
9821
- setShopInfo = _useState24[1]; //店铺信息
9822
+ shopOptions = _useState22[0],
9823
+ setShopList = _useState22[1];
9822
9824
  var _Form$useForm = Form.useForm(),
9823
9825
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
9824
9826
  form = _Form$useForm2[0];
@@ -9830,54 +9832,53 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9830
9832
  /**
9831
9833
  * 查询商品
9832
9834
  */
9833
- var queryItems = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9834
- var params, res, products, newProducts;
9835
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9836
- while (1) switch (_context.prev = _context.next) {
9837
- case 0:
9838
- _context.prev = 0;
9839
- setLoading(true);
9840
- params = {
9841
- shopCode: shopCode
9842
- };
9843
- _context.next = 5;
9844
- return extendRequest('/qy/gdfw/product/bsListProduct', {
9845
- method: 'post',
9846
- data: params
9847
- });
9848
- case 5:
9849
- res = _context.sent;
9850
- products = res.data.products;
9851
- newProducts = (products || []).map(function (item, index) {
9852
- return _objectSpread2(_objectSpread2({}, item), {}, {
9853
- index: index + 1
9835
+ var queryItems = /*#__PURE__*/function () {
9836
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(shopCode) {
9837
+ var params, res, products, newProducts;
9838
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9839
+ while (1) switch (_context.prev = _context.next) {
9840
+ case 0:
9841
+ form.setFieldsValue({
9842
+ shopId: shopCode
9854
9843
  });
9855
- });
9856
- setAllList(_toConsumableArray(newProducts));
9857
- initData(_toConsumableArray(newProducts));
9858
- case 10:
9859
- _context.prev = 10;
9860
- setLoading(false);
9861
- return _context.finish(10);
9862
- case 13:
9863
- case "end":
9864
- return _context.stop();
9865
- }
9866
- }, _callee, null, [[0,, 10, 13]]);
9867
- })), [shopCode]);
9868
- useEffect(function () {
9869
- var shopInfo = shopList.find(function (item) {
9870
- return shopId === item.shopId || shopId === item.shopName;
9871
- });
9872
- setShopInfo(shopInfo);
9873
- var platform = shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.shopSourceStr.toLowerCase();
9874
- setPlatform(platform);
9875
- }, [shopId]);
9844
+ _context.prev = 1;
9845
+ setLoading(true);
9846
+ params = {
9847
+ shopCode: shopCode
9848
+ };
9849
+ _context.next = 6;
9850
+ return extendRequest('/qy/gdfw/product/bsListProduct', {
9851
+ method: 'post',
9852
+ data: params
9853
+ });
9854
+ case 6:
9855
+ res = _context.sent;
9856
+ products = res.data.products;
9857
+ newProducts = (products || []).map(function (item, index) {
9858
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9859
+ index: index + 1
9860
+ });
9861
+ });
9862
+ setAllList(_toConsumableArray(newProducts));
9863
+ initData(_toConsumableArray(newProducts));
9864
+ case 11:
9865
+ _context.prev = 11;
9866
+ setLoading(false);
9867
+ return _context.finish(11);
9868
+ case 14:
9869
+ case "end":
9870
+ return _context.stop();
9871
+ }
9872
+ }, _callee, null, [[1,, 11, 14]]);
9873
+ }));
9874
+ return function queryItems(_x) {
9875
+ return _ref.apply(this, arguments);
9876
+ };
9877
+ }();
9876
9878
  var rowSelection = {
9877
9879
  selectedRowKeys: selectIds,
9878
9880
  fixed: true,
9879
9881
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
9880
- console.log(selectedRowKeys, selectedRows, info);
9881
9882
  setSelectIds(selectedRowKeys);
9882
9883
  setSelect(_toConsumableArray(selectedRows));
9883
9884
  }
@@ -9889,13 +9890,17 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9889
9890
  setPageNo(1);
9890
9891
  };
9891
9892
  var _onCancel = function onCancel() {
9893
+ onReset();
9892
9894
  setVisible(false);
9893
9895
  };
9894
9896
  var onOk = function onOk() {
9895
9897
  onSubmit(selectList);
9896
9898
  _onCancel();
9897
9899
  };
9898
- var onFinish = function onFinish(value) {
9900
+ var onFinish = function onFinish(val) {
9901
+ var shopId = val.shopId,
9902
+ other = _objectWithoutProperties(val, _excluded$c);
9903
+ var value = other;
9899
9904
  var newFilterList = [];
9900
9905
  var hasValue = Object.values(value).some(function (t) {
9901
9906
  return !!t;
@@ -9903,8 +9908,9 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9903
9908
  if (hasValue) {
9904
9909
  Object.keys(value).forEach(function (key) {
9905
9910
  if (value[key]) {
9911
+ var trimValue = value[key].trim();
9906
9912
  newFilterList = allList.filter(function (item) {
9907
- return item[key].indexOf(value[key]) > -1;
9913
+ return item[key].indexOf(trimValue) > -1;
9908
9914
  });
9909
9915
  }
9910
9916
  });
@@ -9915,7 +9921,52 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9915
9921
  };
9916
9922
  var onReset = function onReset() {
9917
9923
  form.resetFields();
9918
- initData(_toConsumableArray(allList));
9924
+ initData([]);
9925
+ };
9926
+ var getShopList = /*#__PURE__*/function () {
9927
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9928
+ var _yield$request, success, data, obj, list;
9929
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9930
+ while (1) switch (_context2.prev = _context2.next) {
9931
+ case 0:
9932
+ _context2.next = 2;
9933
+ return extendRequest('/qy/diamond/getConfigInfo', {
9934
+ method: 'get',
9935
+ params: {
9936
+ key: 'company-third-shop-info'
9937
+ }
9938
+ });
9939
+ case 2:
9940
+ _yield$request = _context2.sent;
9941
+ success = _yield$request.success;
9942
+ data = _yield$request.data;
9943
+ obj = JSON.parse(data || '{}');
9944
+ if (success) {
9945
+ list = ((obj === null || obj === void 0 ? void 0 : obj[companyKey]) || []).map(function (item) {
9946
+ return {
9947
+ label: item.shopName,
9948
+ value: item.shopCode
9949
+ };
9950
+ });
9951
+ setShopList(list);
9952
+ }
9953
+ case 7:
9954
+ case "end":
9955
+ return _context2.stop();
9956
+ }
9957
+ }, _callee2);
9958
+ }));
9959
+ return function getShopList() {
9960
+ return _ref2.apply(this, arguments);
9961
+ };
9962
+ }();
9963
+ var onValuesChange = function onValuesChange(changedValues) {
9964
+ if (changedValues === null || changedValues === void 0 ? void 0 : changedValues['shopId']) {
9965
+ queryItems(changedValues === null || changedValues === void 0 ? void 0 : changedValues.shopId);
9966
+ pubsub.publish('changeShopCode', {
9967
+ shopCode: changedValues.shopId
9968
+ });
9969
+ }
9919
9970
  };
9920
9971
  return /*#__PURE__*/React.createElement(Modal, {
9921
9972
  title: '选择商品',
@@ -9931,8 +9982,21 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9931
9982
  }, /*#__PURE__*/React.createElement(Form, {
9932
9983
  layout: "inline",
9933
9984
  form: form,
9934
- onFinish: onFinish
9985
+ onFinish: onFinish,
9986
+ onValuesChange: onValuesChange
9935
9987
  }, /*#__PURE__*/React.createElement(Form.Item, {
9988
+ name: "shopId"
9989
+ }, /*#__PURE__*/React.createElement(Select, {
9990
+ placeholder: "\u5E97\u94FA",
9991
+ style: {
9992
+ width: 150
9993
+ },
9994
+ options: shopOptions || [],
9995
+ showSearch: true,
9996
+ filterOption: function filterOption(input, option) {
9997
+ return option.label.includes(input);
9998
+ }
9999
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9936
10000
  name: "skuName"
9937
10001
  }, /*#__PURE__*/React.createElement(Input, {
9938
10002
  placeholder: "\u5546\u54C1sku\u540D\u79F0",
@@ -10024,6 +10088,8 @@ var GoodItem = function GoodItem(props) {
10024
10088
  _props$canUpdateNumbe = props.canUpdateNumber,
10025
10089
  canUpdateNumber = _props$canUpdateNumbe === void 0 ? false : _props$canUpdateNumbe,
10026
10090
  shopCode = props.shopCode,
10091
+ _props$companyKey = props.companyKey,
10092
+ companyKey = _props$companyKey === void 0 ? '' : _props$companyKey,
10027
10093
  onSelect = props.onSelect,
10028
10094
  onDelete = props.onDelete;
10029
10095
  var refModal = useRef();
@@ -10205,7 +10271,7 @@ var GoodItem = function GoodItem(props) {
10205
10271
  }));
10206
10272
  };
10207
10273
  var handleChangeGoods = function handleChangeGoods() {
10208
- refModal.current.open();
10274
+ refModal.current.open(shopCode);
10209
10275
  };
10210
10276
  var rowSelection = {
10211
10277
  selectedRowKeys: selectedRowKeys,
@@ -10245,7 +10311,7 @@ var GoodItem = function GoodItem(props) {
10245
10311
  shopList: shopList,
10246
10312
  shopId: shopId,
10247
10313
  maxLength: maxLength,
10248
- shopCode: shopCode
10314
+ companyKey: companyKey
10249
10315
  }));
10250
10316
  };
10251
10317
 
@@ -10284,7 +10350,6 @@ var BsGoods = function BsGoods(props) {
10284
10350
  //补发
10285
10351
  pubsub.subscribe('reissueType', function (type, data) {
10286
10352
  if (disabled) return;
10287
- console.log(type, data);
10288
10353
  withInfo.current = {
10289
10354
  type: type,
10290
10355
  val: data.val,
@@ -10299,6 +10364,12 @@ var BsGoods = function BsGoods(props) {
10299
10364
  });
10300
10365
  }
10301
10366
  });
10367
+ pubsub.subscribeOnce('changeShopCode', function (type, data) {
10368
+ console.log(data);
10369
+ onChange(_objectSpread2(_objectSpread2({}, valueRef === null || valueRef === void 0 ? void 0 : valueRef.current), {}, {
10370
+ shopCode: data.shopCode
10371
+ }));
10372
+ });
10302
10373
  }, [disabled]);
10303
10374
  var _onSelect = function onSelect(list) {
10304
10375
  var _withInfo$current, _withInfo$current2;
@@ -10345,7 +10416,7 @@ var BsGoods = function BsGoods(props) {
10345
10416
  }));
10346
10417
  };
10347
10418
 
10348
- var _excluded$c = ["value", "onChange", "reasonList", "disabled"];
10419
+ var _excluded$d = ["value", "onChange", "reasonList", "disabled"];
10349
10420
  var BsExchange = function BsExchange(props) {
10350
10421
  var _value$bsExchangeType4, _value$bsExchangeType5, _value$bsExchangeType6;
10351
10422
  var value = props.value,
@@ -10353,7 +10424,7 @@ var BsExchange = function BsExchange(props) {
10353
10424
  _props$reasonList = props.reasonList,
10354
10425
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10355
10426
  disabled = props.disabled,
10356
- other = _objectWithoutProperties(props, _excluded$c);
10427
+ other = _objectWithoutProperties(props, _excluded$d);
10357
10428
  var valueRef = useRef({});
10358
10429
  useEffect(function () {
10359
10430
  valueRef.current = value;
@@ -10377,10 +10448,14 @@ var BsExchange = function BsExchange(props) {
10377
10448
  onChange(newValue);
10378
10449
  }
10379
10450
  });
10451
+ pubsub.subscribeOnce('changeShopCode', function (type, data) {
10452
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10453
+ shopCode: data.shopCode
10454
+ }));
10455
+ });
10380
10456
  }, [value]);
10381
10457
  useEffect(function () {
10382
10458
  pubsub.subscribe('selectList', function (_, data) {
10383
- console.log('selectList', data, valueRef.current);
10384
10459
  if (disabled) return;
10385
10460
  var newDataList = cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10386
10461
  onChange(_objectSpread2(_objectSpread2({}, data.goodValue), {}, {
@@ -10390,7 +10465,6 @@ var BsExchange = function BsExchange(props) {
10390
10465
  }, []);
10391
10466
  useEffect(function () {
10392
10467
  pubsub.subscribe('selectListReturn', function (_, data) {
10393
- console.log('selectListReturn', data);
10394
10468
  if (disabled) return;
10395
10469
  var newValue = _objectSpread2({}, data.goodValue);
10396
10470
  var newDataList = cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
@@ -10572,14 +10646,14 @@ var BsExchange = function BsExchange(props) {
10572
10646
  }))) : null);
10573
10647
  };
10574
10648
 
10575
- var _excluded$d = ["value", "onChange", "reasonList", "disabled"];
10649
+ var _excluded$e = ["value", "onChange", "reasonList", "disabled"];
10576
10650
  var BsReissue = function BsReissue(props) {
10577
10651
  var value = props.value,
10578
10652
  onChange = props.onChange,
10579
10653
  _props$reasonList = props.reasonList,
10580
10654
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10581
10655
  disabled = props.disabled,
10582
- other = _objectWithoutProperties(props, _excluded$d);
10656
+ other = _objectWithoutProperties(props, _excluded$e);
10583
10657
  var valueRef = useRef({});
10584
10658
  useEffect(function () {
10585
10659
  pubsub.subscribe('reissueSelectList', function (_, data) {
@@ -10621,6 +10695,11 @@ var BsReissue = function BsReissue(props) {
10621
10695
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10622
10696
  }
10623
10697
  });
10698
+ pubsub.subscribeOnce('changeShopCode', function (type, data) {
10699
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10700
+ shopCode: data.shopCode
10701
+ }));
10702
+ });
10624
10703
  }, [value, disabled]);
10625
10704
  var changeTypeHandle = function changeTypeHandle(val) {
10626
10705
  var newValue = _objectSpread2({}, value);
package/dist/index.js CHANGED
@@ -524,19 +524,22 @@ function ApaasInputNumber(props) {
524
524
  return /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, _objectSpread2({}, props));
525
525
  }
526
526
 
527
- var _excluded$2 = ["options", "basicMultSelect"];
527
+ var _excluded$2 = ["options", "basicMultSelect", "readonly"];
528
528
  function ApaasSelect(props) {
529
529
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
530
530
  var _props$options = props.options,
531
531
  options = _props$options === void 0 ? [] : _props$options,
532
532
  basicMultSelect = props.basicMultSelect,
533
+ readonly = props.readonly,
533
534
  otherProps = _objectWithoutProperties(props, _excluded$2);
534
535
  return /*#__PURE__*/React__default['default'].createElement(antd.Select, _objectSpread2(_objectSpread2({}, otherProps), {}, {
536
+ showSearch: !readonly,
535
537
  style: {
536
538
  width: '100%'
537
539
  }
538
540
  }), options.map(function (item) {
539
541
  return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
542
+ disabled: readonly,
540
543
  value: item.value,
541
544
  key: item.value
542
545
  }, item.label);
@@ -814,7 +817,7 @@ var ApaasUpload = function ApaasUpload(_ref) {
814
817
  })));
815
818
  };
816
819
 
817
- var _excluded$5 = ["showOther", "horizontal", "options", "value", "onChange", "disabled"];
820
+ var _excluded$5 = ["showOther", "horizontal", "options", "value", "onChange", "disabled", "hideUnselectedItem"];
818
821
  function ApaasRadio(props) {
819
822
  var showOther = props.showOther,
820
823
  _props$horizontal = props.horizontal,
@@ -825,6 +828,7 @@ function ApaasRadio(props) {
825
828
  value = _props$value === void 0 ? {} : _props$value,
826
829
  onChange = props.onChange,
827
830
  disabled = props.disabled,
831
+ hideUnselectedItem = props.hideUnselectedItem,
828
832
  otherProps = _objectWithoutProperties(props, _excluded$5);
829
833
  var radioValue = value.value,
830
834
  other = value.other;
@@ -852,13 +856,14 @@ function ApaasRadio(props) {
852
856
  direction: horizontal ? 'horizontal' : 'vertical',
853
857
  wrap: true
854
858
  }, options.map(function (item) {
859
+ if (hideUnselectedItem && item.value !== radioValue) return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
855
860
  return /*#__PURE__*/React__default['default'].createElement(antd.Radio, {
856
861
  value: item.value,
857
862
  key: item.label,
858
863
  disabled: disabled,
859
864
  onClick: onRadioClick
860
865
  }, item.label);
861
- }), showOther && /*#__PURE__*/React__default['default'].createElement(antd.Radio, {
866
+ }), showOther && (!hideUnselectedItem || radioValue === '其他') && /*#__PURE__*/React__default['default'].createElement(antd.Radio, {
862
867
  value: "\u5176\u4ED6",
863
868
  disabled: disabled,
864
869
  onClick: onRadioClick
@@ -9710,13 +9715,14 @@ var ItemList = function ItemList(props) {
9710
9715
  }, "\u6682\u4E0D\u652F\u6301\u6DFB\u52A0")) : null);
9711
9716
  };
9712
9717
 
9718
+ var _excluded$c = ["shopId"];
9713
9719
  var columns = [{
9714
9720
  dataIndex: 'index',
9715
- title: '序号',
9721
+ title: 'NO',
9716
9722
  render: function render(val, record, index) {
9717
9723
  return /*#__PURE__*/React__default['default'].createElement("div", {
9718
9724
  style: {
9719
- width: '30px'
9725
+ width: 25
9720
9726
  }
9721
9727
  }, index + 1);
9722
9728
  }
@@ -9768,13 +9774,13 @@ var columns = [{
9768
9774
  var GoodsModal$1 = function GoodsModal(props, ref) {
9769
9775
  React.useImperativeHandle(ref, function () {
9770
9776
  return {
9771
- open: function open() {
9777
+ open: function open(shopCode) {
9772
9778
  setVisible(true);
9773
9779
  setPageNo(1);
9774
9780
  setSelect([]);
9775
9781
  setSelectIds([]);
9776
- queryItems();
9777
- onReset();
9782
+ queryItems(shopCode);
9783
+ getShopList();
9778
9784
  }
9779
9785
  };
9780
9786
  });
@@ -9782,7 +9788,7 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9782
9788
  shopId = props.shopId,
9783
9789
  shopList = props.shopList,
9784
9790
  width = props.width,
9785
- shopCode = props.shopCode;
9791
+ companyKey = props.companyKey;
9786
9792
  var _useState = React.useState(false),
9787
9793
  _useState2 = _slicedToArray(_useState, 2),
9788
9794
  visible = _useState2[0],
@@ -9822,14 +9828,10 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9822
9828
  _useState20 = _slicedToArray(_useState19, 2),
9823
9829
  total = _useState20[0],
9824
9830
  setTotal = _useState20[1];
9825
- var _useState21 = React.useState(''),
9831
+ var _useState21 = React.useState(),
9826
9832
  _useState22 = _slicedToArray(_useState21, 2),
9827
- platform = _useState22[0],
9828
- setPlatform = _useState22[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9829
- var _useState23 = React.useState({}),
9830
- _useState24 = _slicedToArray(_useState23, 2),
9831
- shopInfo = _useState24[0],
9832
- setShopInfo = _useState24[1]; //店铺信息
9833
+ shopOptions = _useState22[0],
9834
+ setShopList = _useState22[1];
9833
9835
  var _Form$useForm = antd.Form.useForm(),
9834
9836
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
9835
9837
  form = _Form$useForm2[0];
@@ -9841,54 +9843,53 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9841
9843
  /**
9842
9844
  * 查询商品
9843
9845
  */
9844
- var queryItems = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9845
- var params, res, products, newProducts;
9846
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9847
- while (1) switch (_context.prev = _context.next) {
9848
- case 0:
9849
- _context.prev = 0;
9850
- setLoading(true);
9851
- params = {
9852
- shopCode: shopCode
9853
- };
9854
- _context.next = 5;
9855
- return extendRequest('/qy/gdfw/product/bsListProduct', {
9856
- method: 'post',
9857
- data: params
9858
- });
9859
- case 5:
9860
- res = _context.sent;
9861
- products = res.data.products;
9862
- newProducts = (products || []).map(function (item, index) {
9863
- return _objectSpread2(_objectSpread2({}, item), {}, {
9864
- index: index + 1
9846
+ var queryItems = /*#__PURE__*/function () {
9847
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(shopCode) {
9848
+ var params, res, products, newProducts;
9849
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9850
+ while (1) switch (_context.prev = _context.next) {
9851
+ case 0:
9852
+ form.setFieldsValue({
9853
+ shopId: shopCode
9865
9854
  });
9866
- });
9867
- setAllList(_toConsumableArray(newProducts));
9868
- initData(_toConsumableArray(newProducts));
9869
- case 10:
9870
- _context.prev = 10;
9871
- setLoading(false);
9872
- return _context.finish(10);
9873
- case 13:
9874
- case "end":
9875
- return _context.stop();
9876
- }
9877
- }, _callee, null, [[0,, 10, 13]]);
9878
- })), [shopCode]);
9879
- React.useEffect(function () {
9880
- var shopInfo = shopList.find(function (item) {
9881
- return shopId === item.shopId || shopId === item.shopName;
9882
- });
9883
- setShopInfo(shopInfo);
9884
- var platform = shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.shopSourceStr.toLowerCase();
9885
- setPlatform(platform);
9886
- }, [shopId]);
9855
+ _context.prev = 1;
9856
+ setLoading(true);
9857
+ params = {
9858
+ shopCode: shopCode
9859
+ };
9860
+ _context.next = 6;
9861
+ return extendRequest('/qy/gdfw/product/bsListProduct', {
9862
+ method: 'post',
9863
+ data: params
9864
+ });
9865
+ case 6:
9866
+ res = _context.sent;
9867
+ products = res.data.products;
9868
+ newProducts = (products || []).map(function (item, index) {
9869
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9870
+ index: index + 1
9871
+ });
9872
+ });
9873
+ setAllList(_toConsumableArray(newProducts));
9874
+ initData(_toConsumableArray(newProducts));
9875
+ case 11:
9876
+ _context.prev = 11;
9877
+ setLoading(false);
9878
+ return _context.finish(11);
9879
+ case 14:
9880
+ case "end":
9881
+ return _context.stop();
9882
+ }
9883
+ }, _callee, null, [[1,, 11, 14]]);
9884
+ }));
9885
+ return function queryItems(_x) {
9886
+ return _ref.apply(this, arguments);
9887
+ };
9888
+ }();
9887
9889
  var rowSelection = {
9888
9890
  selectedRowKeys: selectIds,
9889
9891
  fixed: true,
9890
9892
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
9891
- console.log(selectedRowKeys, selectedRows, info);
9892
9893
  setSelectIds(selectedRowKeys);
9893
9894
  setSelect(_toConsumableArray(selectedRows));
9894
9895
  }
@@ -9900,13 +9901,17 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9900
9901
  setPageNo(1);
9901
9902
  };
9902
9903
  var _onCancel = function onCancel() {
9904
+ onReset();
9903
9905
  setVisible(false);
9904
9906
  };
9905
9907
  var onOk = function onOk() {
9906
9908
  onSubmit(selectList);
9907
9909
  _onCancel();
9908
9910
  };
9909
- var onFinish = function onFinish(value) {
9911
+ var onFinish = function onFinish(val) {
9912
+ var shopId = val.shopId,
9913
+ other = _objectWithoutProperties(val, _excluded$c);
9914
+ var value = other;
9910
9915
  var newFilterList = [];
9911
9916
  var hasValue = Object.values(value).some(function (t) {
9912
9917
  return !!t;
@@ -9914,8 +9919,9 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9914
9919
  if (hasValue) {
9915
9920
  Object.keys(value).forEach(function (key) {
9916
9921
  if (value[key]) {
9922
+ var trimValue = value[key].trim();
9917
9923
  newFilterList = allList.filter(function (item) {
9918
- return item[key].indexOf(value[key]) > -1;
9924
+ return item[key].indexOf(trimValue) > -1;
9919
9925
  });
9920
9926
  }
9921
9927
  });
@@ -9926,7 +9932,52 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9926
9932
  };
9927
9933
  var onReset = function onReset() {
9928
9934
  form.resetFields();
9929
- initData(_toConsumableArray(allList));
9935
+ initData([]);
9936
+ };
9937
+ var getShopList = /*#__PURE__*/function () {
9938
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9939
+ var _yield$request, success, data, obj, list;
9940
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9941
+ while (1) switch (_context2.prev = _context2.next) {
9942
+ case 0:
9943
+ _context2.next = 2;
9944
+ return extendRequest('/qy/diamond/getConfigInfo', {
9945
+ method: 'get',
9946
+ params: {
9947
+ key: 'company-third-shop-info'
9948
+ }
9949
+ });
9950
+ case 2:
9951
+ _yield$request = _context2.sent;
9952
+ success = _yield$request.success;
9953
+ data = _yield$request.data;
9954
+ obj = JSON.parse(data || '{}');
9955
+ if (success) {
9956
+ list = ((obj === null || obj === void 0 ? void 0 : obj[companyKey]) || []).map(function (item) {
9957
+ return {
9958
+ label: item.shopName,
9959
+ value: item.shopCode
9960
+ };
9961
+ });
9962
+ setShopList(list);
9963
+ }
9964
+ case 7:
9965
+ case "end":
9966
+ return _context2.stop();
9967
+ }
9968
+ }, _callee2);
9969
+ }));
9970
+ return function getShopList() {
9971
+ return _ref2.apply(this, arguments);
9972
+ };
9973
+ }();
9974
+ var onValuesChange = function onValuesChange(changedValues) {
9975
+ if (changedValues === null || changedValues === void 0 ? void 0 : changedValues['shopId']) {
9976
+ queryItems(changedValues === null || changedValues === void 0 ? void 0 : changedValues.shopId);
9977
+ pubsub__default['default'].publish('changeShopCode', {
9978
+ shopCode: changedValues.shopId
9979
+ });
9980
+ }
9930
9981
  };
9931
9982
  return /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
9932
9983
  title: '选择商品',
@@ -9942,8 +9993,21 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9942
9993
  }, /*#__PURE__*/React__default['default'].createElement(antd.Form, {
9943
9994
  layout: "inline",
9944
9995
  form: form,
9945
- onFinish: onFinish
9996
+ onFinish: onFinish,
9997
+ onValuesChange: onValuesChange
9946
9998
  }, /*#__PURE__*/React__default['default'].createElement(antd.Form.Item, {
9999
+ name: "shopId"
10000
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
10001
+ placeholder: "\u5E97\u94FA",
10002
+ style: {
10003
+ width: 150
10004
+ },
10005
+ options: shopOptions || [],
10006
+ showSearch: true,
10007
+ filterOption: function filterOption(input, option) {
10008
+ return option.label.includes(input);
10009
+ }
10010
+ })), /*#__PURE__*/React__default['default'].createElement(antd.Form.Item, {
9947
10011
  name: "skuName"
9948
10012
  }, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
9949
10013
  placeholder: "\u5546\u54C1sku\u540D\u79F0",
@@ -10035,6 +10099,8 @@ var GoodItem = function GoodItem(props) {
10035
10099
  _props$canUpdateNumbe = props.canUpdateNumber,
10036
10100
  canUpdateNumber = _props$canUpdateNumbe === void 0 ? false : _props$canUpdateNumbe,
10037
10101
  shopCode = props.shopCode,
10102
+ _props$companyKey = props.companyKey,
10103
+ companyKey = _props$companyKey === void 0 ? '' : _props$companyKey,
10038
10104
  onSelect = props.onSelect,
10039
10105
  onDelete = props.onDelete;
10040
10106
  var refModal = React.useRef();
@@ -10216,7 +10282,7 @@ var GoodItem = function GoodItem(props) {
10216
10282
  }));
10217
10283
  };
10218
10284
  var handleChangeGoods = function handleChangeGoods() {
10219
- refModal.current.open();
10285
+ refModal.current.open(shopCode);
10220
10286
  };
10221
10287
  var rowSelection = {
10222
10288
  selectedRowKeys: selectedRowKeys,
@@ -10256,7 +10322,7 @@ var GoodItem = function GoodItem(props) {
10256
10322
  shopList: shopList,
10257
10323
  shopId: shopId,
10258
10324
  maxLength: maxLength,
10259
- shopCode: shopCode
10325
+ companyKey: companyKey
10260
10326
  }));
10261
10327
  };
10262
10328
 
@@ -10295,7 +10361,6 @@ var BsGoods = function BsGoods(props) {
10295
10361
  //补发
10296
10362
  pubsub__default['default'].subscribe('reissueType', function (type, data) {
10297
10363
  if (disabled) return;
10298
- console.log(type, data);
10299
10364
  withInfo.current = {
10300
10365
  type: type,
10301
10366
  val: data.val,
@@ -10310,6 +10375,12 @@ var BsGoods = function BsGoods(props) {
10310
10375
  });
10311
10376
  }
10312
10377
  });
10378
+ pubsub__default['default'].subscribeOnce('changeShopCode', function (type, data) {
10379
+ console.log(data);
10380
+ onChange(_objectSpread2(_objectSpread2({}, valueRef === null || valueRef === void 0 ? void 0 : valueRef.current), {}, {
10381
+ shopCode: data.shopCode
10382
+ }));
10383
+ });
10313
10384
  }, [disabled]);
10314
10385
  var _onSelect = function onSelect(list) {
10315
10386
  var _withInfo$current, _withInfo$current2;
@@ -10356,7 +10427,7 @@ var BsGoods = function BsGoods(props) {
10356
10427
  }));
10357
10428
  };
10358
10429
 
10359
- var _excluded$c = ["value", "onChange", "reasonList", "disabled"];
10430
+ var _excluded$d = ["value", "onChange", "reasonList", "disabled"];
10360
10431
  var BsExchange = function BsExchange(props) {
10361
10432
  var _value$bsExchangeType4, _value$bsExchangeType5, _value$bsExchangeType6;
10362
10433
  var value = props.value,
@@ -10364,7 +10435,7 @@ var BsExchange = function BsExchange(props) {
10364
10435
  _props$reasonList = props.reasonList,
10365
10436
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10366
10437
  disabled = props.disabled,
10367
- other = _objectWithoutProperties(props, _excluded$c);
10438
+ other = _objectWithoutProperties(props, _excluded$d);
10368
10439
  var valueRef = React.useRef({});
10369
10440
  React.useEffect(function () {
10370
10441
  valueRef.current = value;
@@ -10388,10 +10459,14 @@ var BsExchange = function BsExchange(props) {
10388
10459
  onChange(newValue);
10389
10460
  }
10390
10461
  });
10462
+ pubsub__default['default'].subscribeOnce('changeShopCode', function (type, data) {
10463
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10464
+ shopCode: data.shopCode
10465
+ }));
10466
+ });
10391
10467
  }, [value]);
10392
10468
  React.useEffect(function () {
10393
10469
  pubsub__default['default'].subscribe('selectList', function (_, data) {
10394
- console.log('selectList', data, valueRef.current);
10395
10470
  if (disabled) return;
10396
10471
  var newDataList = lodash.cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10397
10472
  onChange(_objectSpread2(_objectSpread2({}, data.goodValue), {}, {
@@ -10401,7 +10476,6 @@ var BsExchange = function BsExchange(props) {
10401
10476
  }, []);
10402
10477
  React.useEffect(function () {
10403
10478
  pubsub__default['default'].subscribe('selectListReturn', function (_, data) {
10404
- console.log('selectListReturn', data);
10405
10479
  if (disabled) return;
10406
10480
  var newValue = _objectSpread2({}, data.goodValue);
10407
10481
  var newDataList = lodash.cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
@@ -10583,14 +10657,14 @@ var BsExchange = function BsExchange(props) {
10583
10657
  }))) : null);
10584
10658
  };
10585
10659
 
10586
- var _excluded$d = ["value", "onChange", "reasonList", "disabled"];
10660
+ var _excluded$e = ["value", "onChange", "reasonList", "disabled"];
10587
10661
  var BsReissue = function BsReissue(props) {
10588
10662
  var value = props.value,
10589
10663
  onChange = props.onChange,
10590
10664
  _props$reasonList = props.reasonList,
10591
10665
  reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
10592
10666
  disabled = props.disabled,
10593
- other = _objectWithoutProperties(props, _excluded$d);
10667
+ other = _objectWithoutProperties(props, _excluded$e);
10594
10668
  var valueRef = React.useRef({});
10595
10669
  React.useEffect(function () {
10596
10670
  pubsub__default['default'].subscribe('reissueSelectList', function (_, data) {
@@ -10632,6 +10706,11 @@ var BsReissue = function BsReissue(props) {
10632
10706
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10633
10707
  }
10634
10708
  });
10709
+ pubsub__default['default'].subscribeOnce('changeShopCode', function (type, data) {
10710
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10711
+ shopCode: data.shopCode
10712
+ }));
10713
+ });
10635
10714
  }, [value, disabled]);
10636
10715
  var changeTypeHandle = function changeTypeHandle(val) {
10637
10716
  var newValue = _objectSpread2({}, value);
@@ -14,6 +14,7 @@ export interface ApaasRadioProps extends Omit<RadioGroupProps, 'onChange' | 'val
14
14
  horizontal?: boolean;
15
15
  options?: OptionsType[];
16
16
  disabled?: boolean;
17
+ hideUnselectedItem?: boolean;
17
18
  onChange?: (value: RadioValue) => void;
18
19
  value?: RadioValue;
19
20
  }
@@ -7,6 +7,7 @@ type OptionsType = {
7
7
  };
8
8
  export interface ApaasSelectProps extends SelectProps<string[]> {
9
9
  options?: OptionsType[];
10
+ readonly?: boolean;
10
11
  [propName: string]: any;
11
12
  }
12
13
  declare function ApaasSelect(props: ApaasSelectProps): React.JSX.Element;
@@ -15,6 +15,7 @@ interface BsGoodsProps {
15
15
  otherOperations: any;
16
16
  canUpdateNumber: boolean;
17
17
  shopCode: string;
18
+ companyKey: string;
18
19
  onChange: (val: any[]) => void;
19
20
  onSelect: (val: any[]) => void;
20
21
  onDelete: (val: any[]) => void;
@@ -5,6 +5,7 @@ interface GoodModelProps {
5
5
  shopList: any[];
6
6
  width?: string | number;
7
7
  shopCode?: string;
8
+ companyKey: string;
8
9
  onSubmit: (...args: any[]) => any;
9
10
  }
10
11
  declare const _default: React.ForwardRefExoticComponent<GoodModelProps & React.RefAttributes<unknown>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.8.9-alpha.0",
3
+ "version": "0.8.9-alpha.14",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "^0.8.7-alpha.0",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.8.9-alpha.9",
24
24
  "lodash": "^4.17.21",
25
25
  "pubsub-js": "^1.9.4",
26
26
  "umi-request": "^1.4.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "97f6ab166f536ac9098b1883732a91c848165a04"
61
+ "gitHead": "3a28d034441471c57ea0b8a5d123fdbae7722b2e"
62
62
  }