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

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';
@@ -9701,13 +9701,9 @@ var ItemList = function ItemList(props) {
9701
9701
 
9702
9702
  var columns = [{
9703
9703
  dataIndex: 'index',
9704
- title: '序号',
9704
+ title: 'No',
9705
9705
  render: function render(val, record, index) {
9706
- return /*#__PURE__*/React.createElement("div", {
9707
- style: {
9708
- width: '30px'
9709
- }
9710
- }, index + 1);
9706
+ return /*#__PURE__*/React.createElement("span", null, index + 1);
9711
9707
  }
9712
9708
  }, {
9713
9709
  dataIndex: 'skuName',
@@ -9757,13 +9753,13 @@ var columns = [{
9757
9753
  var GoodsModal$1 = function GoodsModal(props, ref) {
9758
9754
  useImperativeHandle(ref, function () {
9759
9755
  return {
9760
- open: function open() {
9756
+ open: function open(shopCode) {
9761
9757
  setVisible(true);
9762
9758
  setPageNo(1);
9763
9759
  setSelect([]);
9764
9760
  setSelectIds([]);
9765
- queryItems();
9766
- onReset();
9761
+ queryItems(shopCode);
9762
+ getShopList();
9767
9763
  }
9768
9764
  };
9769
9765
  });
@@ -9771,7 +9767,7 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9771
9767
  shopId = props.shopId,
9772
9768
  shopList = props.shopList,
9773
9769
  width = props.width,
9774
- shopCode = props.shopCode;
9770
+ companyKey = props.companyKey;
9775
9771
  var _useState = useState(false),
9776
9772
  _useState2 = _slicedToArray(_useState, 2),
9777
9773
  visible = _useState2[0],
@@ -9811,14 +9807,10 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9811
9807
  _useState20 = _slicedToArray(_useState19, 2),
9812
9808
  total = _useState20[0],
9813
9809
  setTotal = _useState20[1];
9814
- var _useState21 = useState(''),
9810
+ var _useState21 = useState(),
9815
9811
  _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]; //店铺信息
9812
+ shopOptions = _useState22[0],
9813
+ setShopList = _useState22[1];
9822
9814
  var _Form$useForm = Form.useForm(),
9823
9815
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
9824
9816
  form = _Form$useForm2[0];
@@ -9830,54 +9822,53 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9830
9822
  /**
9831
9823
  * 查询商品
9832
9824
  */
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
9825
+ var queryItems = /*#__PURE__*/function () {
9826
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(shopCode) {
9827
+ var params, res, products, newProducts;
9828
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9829
+ while (1) switch (_context.prev = _context.next) {
9830
+ case 0:
9831
+ form.setFieldsValue({
9832
+ shopId: shopCode
9854
9833
  });
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]);
9834
+ _context.prev = 1;
9835
+ setLoading(true);
9836
+ params = {
9837
+ shopCode: shopCode
9838
+ };
9839
+ _context.next = 6;
9840
+ return extendRequest('/qy/gdfw/product/bsListProduct', {
9841
+ method: 'post',
9842
+ data: params
9843
+ });
9844
+ case 6:
9845
+ res = _context.sent;
9846
+ products = res.data.products;
9847
+ newProducts = (products || []).map(function (item, index) {
9848
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9849
+ index: index + 1
9850
+ });
9851
+ });
9852
+ setAllList(_toConsumableArray(newProducts));
9853
+ initData(_toConsumableArray(newProducts));
9854
+ case 11:
9855
+ _context.prev = 11;
9856
+ setLoading(false);
9857
+ return _context.finish(11);
9858
+ case 14:
9859
+ case "end":
9860
+ return _context.stop();
9861
+ }
9862
+ }, _callee, null, [[1,, 11, 14]]);
9863
+ }));
9864
+ return function queryItems(_x) {
9865
+ return _ref.apply(this, arguments);
9866
+ };
9867
+ }();
9876
9868
  var rowSelection = {
9877
9869
  selectedRowKeys: selectIds,
9878
9870
  fixed: true,
9879
9871
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
9880
- console.log(selectedRowKeys, selectedRows, info);
9881
9872
  setSelectIds(selectedRowKeys);
9882
9873
  setSelect(_toConsumableArray(selectedRows));
9883
9874
  }
@@ -9889,6 +9880,7 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9889
9880
  setPageNo(1);
9890
9881
  };
9891
9882
  var _onCancel = function onCancel() {
9883
+ onReset();
9892
9884
  setVisible(false);
9893
9885
  };
9894
9886
  var onOk = function onOk() {
@@ -9903,8 +9895,9 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9903
9895
  if (hasValue) {
9904
9896
  Object.keys(value).forEach(function (key) {
9905
9897
  if (value[key]) {
9898
+ var trimValue = value[key].trim();
9906
9899
  newFilterList = allList.filter(function (item) {
9907
- return item[key].indexOf(value[key]) > -1;
9900
+ return item[key].indexOf(trimValue) > -1;
9908
9901
  });
9909
9902
  }
9910
9903
  });
@@ -9915,7 +9908,52 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9915
9908
  };
9916
9909
  var onReset = function onReset() {
9917
9910
  form.resetFields();
9918
- initData(_toConsumableArray(allList));
9911
+ initData([]);
9912
+ };
9913
+ var getShopList = /*#__PURE__*/function () {
9914
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9915
+ var _yield$request, success, data, obj, list;
9916
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9917
+ while (1) switch (_context2.prev = _context2.next) {
9918
+ case 0:
9919
+ _context2.next = 2;
9920
+ return extendRequest('/qy/diamond/getConfigInfo', {
9921
+ method: 'get',
9922
+ params: {
9923
+ key: 'company-third-shop-info'
9924
+ }
9925
+ });
9926
+ case 2:
9927
+ _yield$request = _context2.sent;
9928
+ success = _yield$request.success;
9929
+ data = _yield$request.data;
9930
+ obj = JSON.parse(data || '{}');
9931
+ if (success) {
9932
+ list = ((obj === null || obj === void 0 ? void 0 : obj[companyKey]) || []).map(function (item) {
9933
+ return {
9934
+ label: item.shopName,
9935
+ value: item.shopCode
9936
+ };
9937
+ });
9938
+ setShopList(list);
9939
+ }
9940
+ case 7:
9941
+ case "end":
9942
+ return _context2.stop();
9943
+ }
9944
+ }, _callee2);
9945
+ }));
9946
+ return function getShopList() {
9947
+ return _ref2.apply(this, arguments);
9948
+ };
9949
+ }();
9950
+ var onValuesChange = function onValuesChange(changedValues) {
9951
+ if (changedValues === null || changedValues === void 0 ? void 0 : changedValues['shopId']) {
9952
+ queryItems(changedValues === null || changedValues === void 0 ? void 0 : changedValues.shopId);
9953
+ pubsub.publish('changeShopCode', {
9954
+ shopCode: changedValues.shopId
9955
+ });
9956
+ }
9919
9957
  };
9920
9958
  return /*#__PURE__*/React.createElement(Modal, {
9921
9959
  title: '选择商品',
@@ -9931,8 +9969,21 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9931
9969
  }, /*#__PURE__*/React.createElement(Form, {
9932
9970
  layout: "inline",
9933
9971
  form: form,
9934
- onFinish: onFinish
9972
+ onFinish: onFinish,
9973
+ onValuesChange: onValuesChange
9935
9974
  }, /*#__PURE__*/React.createElement(Form.Item, {
9975
+ name: "shopId"
9976
+ }, /*#__PURE__*/React.createElement(Select, {
9977
+ placeholder: "\u5E97\u94FA",
9978
+ style: {
9979
+ width: 150
9980
+ },
9981
+ options: shopOptions || [],
9982
+ showSearch: true,
9983
+ filterOption: function filterOption(input, option) {
9984
+ return option.label.includes(input);
9985
+ }
9986
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9936
9987
  name: "skuName"
9937
9988
  }, /*#__PURE__*/React.createElement(Input, {
9938
9989
  placeholder: "\u5546\u54C1sku\u540D\u79F0",
@@ -10024,6 +10075,8 @@ var GoodItem = function GoodItem(props) {
10024
10075
  _props$canUpdateNumbe = props.canUpdateNumber,
10025
10076
  canUpdateNumber = _props$canUpdateNumbe === void 0 ? false : _props$canUpdateNumbe,
10026
10077
  shopCode = props.shopCode,
10078
+ _props$companyKey = props.companyKey,
10079
+ companyKey = _props$companyKey === void 0 ? '' : _props$companyKey,
10027
10080
  onSelect = props.onSelect,
10028
10081
  onDelete = props.onDelete;
10029
10082
  var refModal = useRef();
@@ -10205,7 +10258,7 @@ var GoodItem = function GoodItem(props) {
10205
10258
  }));
10206
10259
  };
10207
10260
  var handleChangeGoods = function handleChangeGoods() {
10208
- refModal.current.open();
10261
+ refModal.current.open(shopCode);
10209
10262
  };
10210
10263
  var rowSelection = {
10211
10264
  selectedRowKeys: selectedRowKeys,
@@ -10245,7 +10298,7 @@ var GoodItem = function GoodItem(props) {
10245
10298
  shopList: shopList,
10246
10299
  shopId: shopId,
10247
10300
  maxLength: maxLength,
10248
- shopCode: shopCode
10301
+ companyKey: companyKey
10249
10302
  }));
10250
10303
  };
10251
10304
 
@@ -10284,7 +10337,6 @@ var BsGoods = function BsGoods(props) {
10284
10337
  //补发
10285
10338
  pubsub.subscribe('reissueType', function (type, data) {
10286
10339
  if (disabled) return;
10287
- console.log(type, data);
10288
10340
  withInfo.current = {
10289
10341
  type: type,
10290
10342
  val: data.val,
@@ -10299,6 +10351,12 @@ var BsGoods = function BsGoods(props) {
10299
10351
  });
10300
10352
  }
10301
10353
  });
10354
+ pubsub.subscribeOnce('changeShopCode', function (type, data) {
10355
+ console.log(data);
10356
+ onChange(_objectSpread2(_objectSpread2({}, valueRef === null || valueRef === void 0 ? void 0 : valueRef.current), {}, {
10357
+ shopCode: data.shopCode
10358
+ }));
10359
+ });
10302
10360
  }, [disabled]);
10303
10361
  var _onSelect = function onSelect(list) {
10304
10362
  var _withInfo$current, _withInfo$current2;
@@ -10377,10 +10435,14 @@ var BsExchange = function BsExchange(props) {
10377
10435
  onChange(newValue);
10378
10436
  }
10379
10437
  });
10438
+ pubsub.subscribeOnce('changeShopCode', function (type, data) {
10439
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10440
+ shopCode: data.shopCode
10441
+ }));
10442
+ });
10380
10443
  }, [value]);
10381
10444
  useEffect(function () {
10382
10445
  pubsub.subscribe('selectList', function (_, data) {
10383
- console.log('selectList', data, valueRef.current);
10384
10446
  if (disabled) return;
10385
10447
  var newDataList = cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10386
10448
  onChange(_objectSpread2(_objectSpread2({}, data.goodValue), {}, {
@@ -10390,7 +10452,6 @@ var BsExchange = function BsExchange(props) {
10390
10452
  }, []);
10391
10453
  useEffect(function () {
10392
10454
  pubsub.subscribe('selectListReturn', function (_, data) {
10393
- console.log('selectListReturn', data);
10394
10455
  if (disabled) return;
10395
10456
  var newValue = _objectSpread2({}, data.goodValue);
10396
10457
  var newDataList = cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
@@ -10621,6 +10682,11 @@ var BsReissue = function BsReissue(props) {
10621
10682
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10622
10683
  }
10623
10684
  });
10685
+ pubsub.subscribeOnce('changeShopCode', function (type, data) {
10686
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10687
+ shopCode: data.shopCode
10688
+ }));
10689
+ });
10624
10690
  }, [value, disabled]);
10625
10691
  var changeTypeHandle = function changeTypeHandle(val) {
10626
10692
  var newValue = _objectSpread2({}, value);
package/dist/index.js CHANGED
@@ -9712,13 +9712,9 @@ var ItemList = function ItemList(props) {
9712
9712
 
9713
9713
  var columns = [{
9714
9714
  dataIndex: 'index',
9715
- title: '序号',
9715
+ title: 'No',
9716
9716
  render: function render(val, record, index) {
9717
- return /*#__PURE__*/React__default['default'].createElement("div", {
9718
- style: {
9719
- width: '30px'
9720
- }
9721
- }, index + 1);
9717
+ return /*#__PURE__*/React__default['default'].createElement("span", null, index + 1);
9722
9718
  }
9723
9719
  }, {
9724
9720
  dataIndex: 'skuName',
@@ -9768,13 +9764,13 @@ var columns = [{
9768
9764
  var GoodsModal$1 = function GoodsModal(props, ref) {
9769
9765
  React.useImperativeHandle(ref, function () {
9770
9766
  return {
9771
- open: function open() {
9767
+ open: function open(shopCode) {
9772
9768
  setVisible(true);
9773
9769
  setPageNo(1);
9774
9770
  setSelect([]);
9775
9771
  setSelectIds([]);
9776
- queryItems();
9777
- onReset();
9772
+ queryItems(shopCode);
9773
+ getShopList();
9778
9774
  }
9779
9775
  };
9780
9776
  });
@@ -9782,7 +9778,7 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9782
9778
  shopId = props.shopId,
9783
9779
  shopList = props.shopList,
9784
9780
  width = props.width,
9785
- shopCode = props.shopCode;
9781
+ companyKey = props.companyKey;
9786
9782
  var _useState = React.useState(false),
9787
9783
  _useState2 = _slicedToArray(_useState, 2),
9788
9784
  visible = _useState2[0],
@@ -9822,14 +9818,10 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9822
9818
  _useState20 = _slicedToArray(_useState19, 2),
9823
9819
  total = _useState20[0],
9824
9820
  setTotal = _useState20[1];
9825
- var _useState21 = React.useState(''),
9821
+ var _useState21 = React.useState(),
9826
9822
  _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]; //店铺信息
9823
+ shopOptions = _useState22[0],
9824
+ setShopList = _useState22[1];
9833
9825
  var _Form$useForm = antd.Form.useForm(),
9834
9826
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
9835
9827
  form = _Form$useForm2[0];
@@ -9841,54 +9833,53 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9841
9833
  /**
9842
9834
  * 查询商品
9843
9835
  */
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
9836
+ var queryItems = /*#__PURE__*/function () {
9837
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(shopCode) {
9838
+ var params, res, products, newProducts;
9839
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9840
+ while (1) switch (_context.prev = _context.next) {
9841
+ case 0:
9842
+ form.setFieldsValue({
9843
+ shopId: shopCode
9865
9844
  });
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]);
9845
+ _context.prev = 1;
9846
+ setLoading(true);
9847
+ params = {
9848
+ shopCode: shopCode
9849
+ };
9850
+ _context.next = 6;
9851
+ return extendRequest('/qy/gdfw/product/bsListProduct', {
9852
+ method: 'post',
9853
+ data: params
9854
+ });
9855
+ case 6:
9856
+ res = _context.sent;
9857
+ products = res.data.products;
9858
+ newProducts = (products || []).map(function (item, index) {
9859
+ return _objectSpread2(_objectSpread2({}, item), {}, {
9860
+ index: index + 1
9861
+ });
9862
+ });
9863
+ setAllList(_toConsumableArray(newProducts));
9864
+ initData(_toConsumableArray(newProducts));
9865
+ case 11:
9866
+ _context.prev = 11;
9867
+ setLoading(false);
9868
+ return _context.finish(11);
9869
+ case 14:
9870
+ case "end":
9871
+ return _context.stop();
9872
+ }
9873
+ }, _callee, null, [[1,, 11, 14]]);
9874
+ }));
9875
+ return function queryItems(_x) {
9876
+ return _ref.apply(this, arguments);
9877
+ };
9878
+ }();
9887
9879
  var rowSelection = {
9888
9880
  selectedRowKeys: selectIds,
9889
9881
  fixed: true,
9890
9882
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
9891
- console.log(selectedRowKeys, selectedRows, info);
9892
9883
  setSelectIds(selectedRowKeys);
9893
9884
  setSelect(_toConsumableArray(selectedRows));
9894
9885
  }
@@ -9900,6 +9891,7 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9900
9891
  setPageNo(1);
9901
9892
  };
9902
9893
  var _onCancel = function onCancel() {
9894
+ onReset();
9903
9895
  setVisible(false);
9904
9896
  };
9905
9897
  var onOk = function onOk() {
@@ -9914,8 +9906,9 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9914
9906
  if (hasValue) {
9915
9907
  Object.keys(value).forEach(function (key) {
9916
9908
  if (value[key]) {
9909
+ var trimValue = value[key].trim();
9917
9910
  newFilterList = allList.filter(function (item) {
9918
- return item[key].indexOf(value[key]) > -1;
9911
+ return item[key].indexOf(trimValue) > -1;
9919
9912
  });
9920
9913
  }
9921
9914
  });
@@ -9926,7 +9919,52 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9926
9919
  };
9927
9920
  var onReset = function onReset() {
9928
9921
  form.resetFields();
9929
- initData(_toConsumableArray(allList));
9922
+ initData([]);
9923
+ };
9924
+ var getShopList = /*#__PURE__*/function () {
9925
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9926
+ var _yield$request, success, data, obj, list;
9927
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9928
+ while (1) switch (_context2.prev = _context2.next) {
9929
+ case 0:
9930
+ _context2.next = 2;
9931
+ return extendRequest('/qy/diamond/getConfigInfo', {
9932
+ method: 'get',
9933
+ params: {
9934
+ key: 'company-third-shop-info'
9935
+ }
9936
+ });
9937
+ case 2:
9938
+ _yield$request = _context2.sent;
9939
+ success = _yield$request.success;
9940
+ data = _yield$request.data;
9941
+ obj = JSON.parse(data || '{}');
9942
+ if (success) {
9943
+ list = ((obj === null || obj === void 0 ? void 0 : obj[companyKey]) || []).map(function (item) {
9944
+ return {
9945
+ label: item.shopName,
9946
+ value: item.shopCode
9947
+ };
9948
+ });
9949
+ setShopList(list);
9950
+ }
9951
+ case 7:
9952
+ case "end":
9953
+ return _context2.stop();
9954
+ }
9955
+ }, _callee2);
9956
+ }));
9957
+ return function getShopList() {
9958
+ return _ref2.apply(this, arguments);
9959
+ };
9960
+ }();
9961
+ var onValuesChange = function onValuesChange(changedValues) {
9962
+ if (changedValues === null || changedValues === void 0 ? void 0 : changedValues['shopId']) {
9963
+ queryItems(changedValues === null || changedValues === void 0 ? void 0 : changedValues.shopId);
9964
+ pubsub__default['default'].publish('changeShopCode', {
9965
+ shopCode: changedValues.shopId
9966
+ });
9967
+ }
9930
9968
  };
9931
9969
  return /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
9932
9970
  title: '选择商品',
@@ -9942,8 +9980,21 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9942
9980
  }, /*#__PURE__*/React__default['default'].createElement(antd.Form, {
9943
9981
  layout: "inline",
9944
9982
  form: form,
9945
- onFinish: onFinish
9983
+ onFinish: onFinish,
9984
+ onValuesChange: onValuesChange
9946
9985
  }, /*#__PURE__*/React__default['default'].createElement(antd.Form.Item, {
9986
+ name: "shopId"
9987
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
9988
+ placeholder: "\u5E97\u94FA",
9989
+ style: {
9990
+ width: 150
9991
+ },
9992
+ options: shopOptions || [],
9993
+ showSearch: true,
9994
+ filterOption: function filterOption(input, option) {
9995
+ return option.label.includes(input);
9996
+ }
9997
+ })), /*#__PURE__*/React__default['default'].createElement(antd.Form.Item, {
9947
9998
  name: "skuName"
9948
9999
  }, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
9949
10000
  placeholder: "\u5546\u54C1sku\u540D\u79F0",
@@ -10035,6 +10086,8 @@ var GoodItem = function GoodItem(props) {
10035
10086
  _props$canUpdateNumbe = props.canUpdateNumber,
10036
10087
  canUpdateNumber = _props$canUpdateNumbe === void 0 ? false : _props$canUpdateNumbe,
10037
10088
  shopCode = props.shopCode,
10089
+ _props$companyKey = props.companyKey,
10090
+ companyKey = _props$companyKey === void 0 ? '' : _props$companyKey,
10038
10091
  onSelect = props.onSelect,
10039
10092
  onDelete = props.onDelete;
10040
10093
  var refModal = React.useRef();
@@ -10216,7 +10269,7 @@ var GoodItem = function GoodItem(props) {
10216
10269
  }));
10217
10270
  };
10218
10271
  var handleChangeGoods = function handleChangeGoods() {
10219
- refModal.current.open();
10272
+ refModal.current.open(shopCode);
10220
10273
  };
10221
10274
  var rowSelection = {
10222
10275
  selectedRowKeys: selectedRowKeys,
@@ -10256,7 +10309,7 @@ var GoodItem = function GoodItem(props) {
10256
10309
  shopList: shopList,
10257
10310
  shopId: shopId,
10258
10311
  maxLength: maxLength,
10259
- shopCode: shopCode
10312
+ companyKey: companyKey
10260
10313
  }));
10261
10314
  };
10262
10315
 
@@ -10295,7 +10348,6 @@ var BsGoods = function BsGoods(props) {
10295
10348
  //补发
10296
10349
  pubsub__default['default'].subscribe('reissueType', function (type, data) {
10297
10350
  if (disabled) return;
10298
- console.log(type, data);
10299
10351
  withInfo.current = {
10300
10352
  type: type,
10301
10353
  val: data.val,
@@ -10310,6 +10362,12 @@ var BsGoods = function BsGoods(props) {
10310
10362
  });
10311
10363
  }
10312
10364
  });
10365
+ pubsub__default['default'].subscribeOnce('changeShopCode', function (type, data) {
10366
+ console.log(data);
10367
+ onChange(_objectSpread2(_objectSpread2({}, valueRef === null || valueRef === void 0 ? void 0 : valueRef.current), {}, {
10368
+ shopCode: data.shopCode
10369
+ }));
10370
+ });
10313
10371
  }, [disabled]);
10314
10372
  var _onSelect = function onSelect(list) {
10315
10373
  var _withInfo$current, _withInfo$current2;
@@ -10388,10 +10446,14 @@ var BsExchange = function BsExchange(props) {
10388
10446
  onChange(newValue);
10389
10447
  }
10390
10448
  });
10449
+ pubsub__default['default'].subscribeOnce('changeShopCode', function (type, data) {
10450
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10451
+ shopCode: data.shopCode
10452
+ }));
10453
+ });
10391
10454
  }, [value]);
10392
10455
  React.useEffect(function () {
10393
10456
  pubsub__default['default'].subscribe('selectList', function (_, data) {
10394
- console.log('selectList', data, valueRef.current);
10395
10457
  if (disabled) return;
10396
10458
  var newDataList = lodash.cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10397
10459
  onChange(_objectSpread2(_objectSpread2({}, data.goodValue), {}, {
@@ -10401,7 +10463,6 @@ var BsExchange = function BsExchange(props) {
10401
10463
  }, []);
10402
10464
  React.useEffect(function () {
10403
10465
  pubsub__default['default'].subscribe('selectListReturn', function (_, data) {
10404
- console.log('selectListReturn', data);
10405
10466
  if (disabled) return;
10406
10467
  var newValue = _objectSpread2({}, data.goodValue);
10407
10468
  var newDataList = lodash.cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
@@ -10632,6 +10693,11 @@ var BsReissue = function BsReissue(props) {
10632
10693
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10633
10694
  }
10634
10695
  });
10696
+ pubsub__default['default'].subscribeOnce('changeShopCode', function (type, data) {
10697
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10698
+ shopCode: data.shopCode
10699
+ }));
10700
+ });
10635
10701
  }, [value, disabled]);
10636
10702
  var changeTypeHandle = function changeTypeHandle(val) {
10637
10703
  var newValue = _objectSpread2({}, value);
@@ -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.2",
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.2",
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": "2326638457272e646e3fb9f5f20f5ce92e8a8347"
62
62
  }