@bit-sun/business-component 2.0.6 → 2.0.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.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import 'antd/dist/antd.css';
2
+ import './utils/requestUtils';
2
3
  export { default as DataValidation } from './components/Functional/DataValidation';
3
4
  export { default as DataImport } from './components/Functional/DataImport';
4
5
  export { default as QueryMutipleInput } from './components/Functional/QueryMutipleInput';
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import axios from 'axios';
2
1
  import 'antd/dist/antd.css';
2
+ import axios from 'axios';
3
3
  import React, { createContext, useContext, useEffect, forwardRef, createElement, useState, useRef, useMemo } from 'react';
4
4
  import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Popover } from 'antd';
5
5
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
@@ -8,6 +8,40 @@ import _ from 'loadsh';
8
8
  import { useDebounceFn } from 'ahooks';
9
9
  import { stringify } from 'querystring';
10
10
 
11
+ var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
12
+ function handleRequestAuthHeader(config) {
13
+ var _config$url, _config$url2;
14
+
15
+ // https://www.kdocs.cn/l/coNbPpjamr5v这个表格里面涉及的接口,接口请求头里需要添加参数:x-biz-code 值就是列表里的code
16
+ // 例:x-biz-code=STORE_CODE
17
+ // 物理仓选择组件
18
+ if ((config === null || config === void 0 ? void 0 : (_config$url = config.url) === null || _config$url === void 0 ? void 0 : _config$url.indexOf('/stock/physicalWarehouse?')) > -1) {
19
+ config.headers['x-biz-code'] = 'PW_STOCK_CODE';
20
+ } // 逻辑仓选择组件
21
+
22
+
23
+ if ((config === null || config === void 0 ? void 0 : (_config$url2 = config.url) === null || _config$url2 === void 0 ? void 0 : _config$url2.indexOf('/stock/realWarehouse?')) > -1) {
24
+ config.headers['x-biz-code'] = 'RW_STOCK_CODE';
25
+ }
26
+ } // 处理请求头
27
+
28
+ var handleRequestHeader = function handleRequestHeader(config) {
29
+ config.headers['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
30
+ config.headers['x-tenant-id'] = (resposne === null || resposne === void 0 ? void 0 : resposne.tenantId) || '1';
31
+
32
+ if (localStorage.getItem('x-user-auth-context')) {
33
+ config.headers['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
34
+ }
35
+
36
+ handleRequestAuthHeader(config);
37
+ }; // 拦截器
38
+
39
+
40
+ axios.interceptors.request.use(function (config) {
41
+ handleRequestHeader(config);
42
+ return config;
43
+ });
44
+
11
45
  function ownKeys(object, enumerableOnly) {
12
46
  var keys = Object.keys(object);
13
47
 
@@ -2053,7 +2087,7 @@ var luckysheet; // const mapping = [
2053
2087
  // { "key": "price", "name": "单价", "rule": "price" }
2054
2088
  // ]
2055
2089
 
2056
- var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注']]); // for dnd
2090
+ var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注'], ['externalCode', 'JDE商品编码']]); // for dnd
2057
2091
 
2058
2092
 
2059
2093
  var reorder = function reorder(list, startIndex, endIndex) {
@@ -5734,12 +5768,12 @@ var InputElement = function InputElement(_ref) {
5734
5768
  message.success('删除当前行');
5735
5769
  e.stopPropagation();
5736
5770
  e.preventDefault();
5737
- var dom = (_e$nativeEvent$path$ = e.nativeEvent.path[3].children[index - 1]) === null || _e$nativeEvent$path$ === void 0 ? void 0 : _e$nativeEvent$path$.getElementsByTagName('input')[currentIndex];
5771
+ var dom = (_e$nativeEvent$path$ = e.nativeEvent.path[3].children[index]) === null || _e$nativeEvent$path$ === void 0 ? void 0 : _e$nativeEvent$path$.getElementsByTagName('input')[currentIndex];
5738
5772
 
5739
5773
  if (dom) {
5740
5774
  dom.select();
5741
5775
  dom.focus();
5742
- dom.scrollIntoView(false);
5776
+ dom.scrollIntoViewIfNeeded(false);
5743
5777
  }
5744
5778
 
5745
5779
  dom = null;
@@ -5767,14 +5801,14 @@ var InputElement = function InputElement(_ref) {
5767
5801
  e.stopPropagation();
5768
5802
  e.preventDefault();
5769
5803
 
5770
- var _dom2 = (_e$nativeEvent$path$2 = e.nativeEvent.path[3].children[index]) === null || _e$nativeEvent$path$2 === void 0 ? void 0 : _e$nativeEvent$path$2.getElementsByTagName('input')[currentIndex - 1];
5804
+ var _dom2 = (_e$nativeEvent$path$2 = e.nativeEvent.path[3].children[index + 1]) === null || _e$nativeEvent$path$2 === void 0 ? void 0 : _e$nativeEvent$path$2.getElementsByTagName('input')[currentIndex - 1];
5771
5805
 
5772
5806
  if (_dom2) {
5773
5807
  _dom2.select();
5774
5808
 
5775
5809
  _dom2.focus();
5776
5810
 
5777
- _dom2.scrollIntoView(false);
5811
+ _dom2.scrollIntoViewIfNeeded(false);
5778
5812
  }
5779
5813
 
5780
5814
  _dom2 = null;
@@ -5787,14 +5821,14 @@ var InputElement = function InputElement(_ref) {
5787
5821
  e.stopPropagation();
5788
5822
  e.preventDefault();
5789
5823
 
5790
- var _dom3 = (_e$nativeEvent$path$3 = e.nativeEvent.path[3].children[index]) === null || _e$nativeEvent$path$3 === void 0 ? void 0 : _e$nativeEvent$path$3.getElementsByTagName('input')[currentIndex + 1];
5824
+ var _dom3 = (_e$nativeEvent$path$3 = e.nativeEvent.path[3].children[index + 1]) === null || _e$nativeEvent$path$3 === void 0 ? void 0 : _e$nativeEvent$path$3.getElementsByTagName('input')[currentIndex + 1];
5791
5825
 
5792
5826
  if (_dom3) {
5793
5827
  _dom3.select();
5794
5828
 
5795
5829
  _dom3.focus();
5796
5830
 
5797
- _dom3.scrollIntoView(false);
5831
+ _dom3.scrollIntoViewIfNeeded(false);
5798
5832
  }
5799
5833
 
5800
5834
  _dom3 = null;
@@ -5804,17 +5838,18 @@ var InputElement = function InputElement(_ref) {
5804
5838
  var _e$nativeEvent$path$4;
5805
5839
 
5806
5840
  // 向下
5841
+ debugger;
5807
5842
  e.stopPropagation();
5808
5843
  e.preventDefault();
5809
5844
 
5810
- var _dom4 = (_e$nativeEvent$path$4 = e.nativeEvent.path[3].children[index + 1]) === null || _e$nativeEvent$path$4 === void 0 ? void 0 : _e$nativeEvent$path$4.getElementsByTagName('input')[currentIndex];
5845
+ var _dom4 = (_e$nativeEvent$path$4 = e.nativeEvent.path[3].children[index + 2]) === null || _e$nativeEvent$path$4 === void 0 ? void 0 : _e$nativeEvent$path$4.getElementsByTagName('input')[currentIndex];
5811
5846
 
5812
5847
  if (_dom4) {
5813
5848
  _dom4.select();
5814
5849
 
5815
5850
  _dom4.focus();
5816
5851
 
5817
- _dom4.scrollIntoView(false);
5852
+ _dom4.scrollIntoViewIfNeeded(false);
5818
5853
  }
5819
5854
 
5820
5855
  _dom4 = null;
@@ -5823,7 +5858,7 @@ var InputElement = function InputElement(_ref) {
5823
5858
 
5824
5859
  e.stopPropagation();
5825
5860
  e.preventDefault();
5826
- var dom1 = (_e$nativeEvent$path$5 = e.nativeEvent.path[3].children[index - 1]) === null || _e$nativeEvent$path$5 === void 0 ? void 0 : _e$nativeEvent$path$5.getElementsByTagName('input')[currentIndex];
5861
+ var dom1 = (_e$nativeEvent$path$5 = e.nativeEvent.path[3].children[index]) === null || _e$nativeEvent$path$5 === void 0 ? void 0 : _e$nativeEvent$path$5.getElementsByTagName('input')[currentIndex];
5827
5862
 
5828
5863
  if (dom1) {
5829
5864
  // dom1.value=""
@@ -5858,12 +5893,12 @@ var InputElement = function InputElement(_ref) {
5858
5893
  message.success('删除当前行');
5859
5894
  e.stopPropagation();
5860
5895
  e.preventDefault();
5861
- var dom = (_e$nativeEvent$path$6 = e.nativeEvent.path[5].children[index - 1]) === null || _e$nativeEvent$path$6 === void 0 ? void 0 : _e$nativeEvent$path$6.getElementsByTagName('input')[currentIndex];
5896
+ var dom = (_e$nativeEvent$path$6 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$6 === void 0 ? void 0 : _e$nativeEvent$path$6.getElementsByTagName('input')[currentIndex];
5862
5897
 
5863
5898
  if (dom) {
5864
5899
  dom.select();
5865
5900
  dom.focus();
5866
- dom.scrollIntoView(false);
5901
+ dom.scrollIntoViewIfNeeded(false);
5867
5902
  }
5868
5903
 
5869
5904
  dom = null;
@@ -5879,14 +5914,14 @@ var InputElement = function InputElement(_ref) {
5879
5914
  e.stopPropagation();
5880
5915
  e.preventDefault();
5881
5916
 
5882
- var _dom5 = (_e$nativeEvent$path$7 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$7 === void 0 ? void 0 : _e$nativeEvent$path$7.getElementsByTagName('input')[currentIndex - 1];
5917
+ var _dom5 = (_e$nativeEvent$path$7 = e.nativeEvent.path[5].children[index + 1]) === null || _e$nativeEvent$path$7 === void 0 ? void 0 : _e$nativeEvent$path$7.getElementsByTagName('input')[currentIndex - 1];
5883
5918
 
5884
5919
  if (_dom5) {
5885
5920
  _dom5.select();
5886
5921
 
5887
5922
  _dom5.focus();
5888
5923
 
5889
- _dom5.scrollIntoView(false);
5924
+ _dom5.scrollIntoViewIfNeeded(false);
5890
5925
  }
5891
5926
 
5892
5927
  _dom5 = null;
@@ -5899,14 +5934,14 @@ var InputElement = function InputElement(_ref) {
5899
5934
  e.stopPropagation();
5900
5935
  e.preventDefault();
5901
5936
 
5902
- var _dom6 = (_e$nativeEvent$path$8 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$8 === void 0 ? void 0 : _e$nativeEvent$path$8.getElementsByTagName('input')[currentIndex + 1];
5937
+ var _dom6 = (_e$nativeEvent$path$8 = e.nativeEvent.path[5].children[index + 1]) === null || _e$nativeEvent$path$8 === void 0 ? void 0 : _e$nativeEvent$path$8.getElementsByTagName('input')[currentIndex + 1];
5903
5938
 
5904
5939
  if (_dom6) {
5905
5940
  _dom6.select();
5906
5941
 
5907
5942
  _dom6.focus();
5908
5943
 
5909
- _dom6.scrollIntoView(false);
5944
+ _dom6.scrollIntoViewIfNeeded(false);
5910
5945
  }
5911
5946
 
5912
5947
  _dom6 = null;
@@ -5919,14 +5954,14 @@ var InputElement = function InputElement(_ref) {
5919
5954
  e.stopPropagation();
5920
5955
  e.preventDefault();
5921
5956
 
5922
- var _dom7 = (_e$nativeEvent$path$9 = e.nativeEvent.path[5].children[index + 1]) === null || _e$nativeEvent$path$9 === void 0 ? void 0 : _e$nativeEvent$path$9.getElementsByTagName('input')[currentIndex];
5957
+ var _dom7 = (_e$nativeEvent$path$9 = e.nativeEvent.path[5].children[index + 2]) === null || _e$nativeEvent$path$9 === void 0 ? void 0 : _e$nativeEvent$path$9.getElementsByTagName('input')[currentIndex];
5923
5958
 
5924
5959
  if (_dom7) {
5925
5960
  _dom7.select();
5926
5961
 
5927
5962
  _dom7.focus();
5928
5963
 
5929
- _dom7.scrollIntoView(false);
5964
+ _dom7.scrollIntoViewIfNeeded(false);
5930
5965
  }
5931
5966
 
5932
5967
  _dom7 = null;
@@ -5935,7 +5970,7 @@ var InputElement = function InputElement(_ref) {
5935
5970
 
5936
5971
  e.stopPropagation();
5937
5972
  e.preventDefault();
5938
- var dom1 = (_e$nativeEvent$path$10 = e.nativeEvent.path[5].children[index - 1]) === null || _e$nativeEvent$path$10 === void 0 ? void 0 : _e$nativeEvent$path$10.getElementsByTagName('input')[currentIndex];
5973
+ var dom1 = (_e$nativeEvent$path$10 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$10 === void 0 ? void 0 : _e$nativeEvent$path$10.getElementsByTagName('input')[currentIndex];
5939
5974
 
5940
5975
  if (dom1) {
5941
5976
  // dom1.value=""
@@ -5993,27 +6028,36 @@ var BillEntry = function BillEntry(_ref3) {
5993
6028
  });
5994
6029
 
5995
6030
  if (base.length) {
6031
+ var _base$;
6032
+
5996
6033
  baseUnitCode = base[0].unitCode;
5997
6034
  record.selectUnitCode = base[0].unitCode;
6035
+ record.selectedScale = ((_base$ = base[0]) === null || _base$ === void 0 ? void 0 : _base$.baseUnitScale) || 1;
5998
6036
  }
5999
6037
  }
6000
6038
 
6001
- record.packingUnitList = record.packingUnitList || [];
6002
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, {
6003
- value: record.selectUnitCode,
6004
- onChange: function onChange(value) {
6005
- record.selectUnitCode = value;
6006
- },
6007
- style: {
6008
- width: '60px',
6009
- height: '22px',
6010
- lineHight: '22px'
6011
- }
6012
- }, record.packingUnitList && record.packingUnitList.map(function (item) {
6013
- return /*#__PURE__*/React.createElement(Select.Option, {
6014
- value: item.unitCode
6015
- }, item.name);
6016
- })));
6039
+ if (baseUnitCode) {
6040
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, {
6041
+ defaultValue: baseUnitCode,
6042
+ onChange: function onChange(value) {
6043
+ var _record$packingUnitLi, _record$packingUnitLi2;
6044
+
6045
+ record.selectUnitCode = value;
6046
+ record.selectedScale = (record === null || record === void 0 ? void 0 : (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : (_record$packingUnitLi2 = _record$packingUnitLi.find(function (item) {
6047
+ return item.unitCode === value;
6048
+ })) === null || _record$packingUnitLi2 === void 0 ? void 0 : _record$packingUnitLi2.baseUnitScale) || 1;
6049
+ },
6050
+ style: {
6051
+ width: '60px'
6052
+ }
6053
+ }, record.packingUnitList && record.packingUnitList.map(function (item) {
6054
+ return /*#__PURE__*/React.createElement(Select.Option, {
6055
+ value: item.unitCode
6056
+ }, item.name);
6057
+ })));
6058
+ }
6059
+
6060
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
6017
6061
  }
6018
6062
  }, {
6019
6063
  title: '数量',
@@ -6122,7 +6166,6 @@ var BillEntry = function BillEntry(_ref3) {
6122
6166
  })), [{
6123
6167
  title: '操作',
6124
6168
  width: 50,
6125
- fixed: 'right',
6126
6169
  render: function render(text, record, index) {
6127
6170
  if (index !== 0) {
6128
6171
  return /*#__PURE__*/React.createElement("span", {
@@ -8438,7 +8481,8 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
8438
8481
  style = _props$style === void 0 ? {
8439
8482
  width: '100%'
8440
8483
  } : _props$style,
8441
- getTreeData = props.getTreeData;
8484
+ getTreeData = props.getTreeData,
8485
+ disabled = props.disabled;
8442
8486
  var url = remoteSource.url,
8443
8487
  _remoteSource$paramsK = remoteSource.paramsKey,
8444
8488
  paramsKey = _remoteSource$paramsK === void 0 ? 'qp-name-like' : _remoteSource$paramsK,
@@ -8610,7 +8654,7 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
8610
8654
  multiple: multiple,
8611
8655
  maxTagPlaceholder: maxTagPlaceholder,
8612
8656
  onChange: handleChange,
8613
- disabled: mode === 'view' || (ctx === null || ctx === void 0 ? void 0 : ctx.mode) === 'view',
8657
+ disabled: disabled || mode === 'view' || (ctx === null || ctx === void 0 ? void 0 : ctx.mode) === 'view',
8614
8658
  getPopupContainer: function getPopupContainer() {
8615
8659
  return _getPopupContainer && _getPopupContainer() || document.body;
8616
8660
  }
@@ -8715,20 +8759,4 @@ var index$1 = /*#__PURE__*/React.memo(BusinessTreeSearchSelect, function (props,
8715
8759
  return true;
8716
8760
  });
8717
8761
 
8718
- /*
8719
- * @Description:
8720
- * @Author: rodchen
8721
- * @Date: 2021-11-30 22:59:39
8722
- * @LastEditTime: 2022-01-14 16:10:27
8723
- * @LastEditors: rodchen
8724
- */
8725
- var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
8726
- axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
8727
- axios.defaults.headers.common['x-tenant-id'] = (resposne === null || resposne === void 0 ? void 0 : resposne.tenantId) || '1';
8728
-
8729
- if (localStorage.getItem('x-user-auth-context')) {
8730
- // @ts-ignore
8731
- axios.defaults.headers.common['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
8732
- }
8733
-
8734
8762
  export { AddSelect, AddSkuSelect, BillEntry, BusinessSearchSelect$1 as BusinessSearchSelect, index$1 as BusinessTreeSearchSelect, index as CheckOneUser, CommodityEntry, DataImport, DataValidation, QueryMutipleInput, SearchSelect, TreeSearchSelect };
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var axios = require('axios');
6
5
  require('antd/dist/antd.css');
6
+ var axios = require('axios');
7
7
  var React = require('react');
8
8
  var antd = require('antd');
9
9
  var reactBeautifulDnd = require('react-beautiful-dnd');
@@ -19,6 +19,40 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
19
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
20
20
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
21
21
 
22
+ var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
23
+ function handleRequestAuthHeader(config) {
24
+ var _config$url, _config$url2;
25
+
26
+ // https://www.kdocs.cn/l/coNbPpjamr5v这个表格里面涉及的接口,接口请求头里需要添加参数:x-biz-code 值就是列表里的code
27
+ // 例:x-biz-code=STORE_CODE
28
+ // 物理仓选择组件
29
+ if ((config === null || config === void 0 ? void 0 : (_config$url = config.url) === null || _config$url === void 0 ? void 0 : _config$url.indexOf('/stock/physicalWarehouse?')) > -1) {
30
+ config.headers['x-biz-code'] = 'PW_STOCK_CODE';
31
+ } // 逻辑仓选择组件
32
+
33
+
34
+ if ((config === null || config === void 0 ? void 0 : (_config$url2 = config.url) === null || _config$url2 === void 0 ? void 0 : _config$url2.indexOf('/stock/realWarehouse?')) > -1) {
35
+ config.headers['x-biz-code'] = 'RW_STOCK_CODE';
36
+ }
37
+ } // 处理请求头
38
+
39
+ var handleRequestHeader = function handleRequestHeader(config) {
40
+ config.headers['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
41
+ config.headers['x-tenant-id'] = (resposne === null || resposne === void 0 ? void 0 : resposne.tenantId) || '1';
42
+
43
+ if (localStorage.getItem('x-user-auth-context')) {
44
+ config.headers['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
45
+ }
46
+
47
+ handleRequestAuthHeader(config);
48
+ }; // 拦截器
49
+
50
+
51
+ axios__default['default'].interceptors.request.use(function (config) {
52
+ handleRequestHeader(config);
53
+ return config;
54
+ });
55
+
22
56
  function ownKeys(object, enumerableOnly) {
23
57
  var keys = Object.keys(object);
24
58
 
@@ -2064,7 +2098,7 @@ var luckysheet; // const mapping = [
2064
2098
  // { "key": "price", "name": "单价", "rule": "price" }
2065
2099
  // ]
2066
2100
 
2067
- var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注']]); // for dnd
2101
+ var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号'], ['warehouseCode', '仓库编码'], ['regionCode', '库区'], ['locationCode', '货位'], ['rowNumber', '货位排数'], ['layerNumber', '货位层数'], ['gridNumber', '货位格号'], ['oldUniqueCode', '原始唯一码'], ['newUniqueCode', '新唯一码'], ['relationRecordCode', '单据编码'], ['remark', '备注'], ['externalCode', 'JDE商品编码']]); // for dnd
2068
2102
 
2069
2103
 
2070
2104
  var reorder = function reorder(list, startIndex, endIndex) {
@@ -5745,12 +5779,12 @@ var InputElement = function InputElement(_ref) {
5745
5779
  antd.message.success('删除当前行');
5746
5780
  e.stopPropagation();
5747
5781
  e.preventDefault();
5748
- var dom = (_e$nativeEvent$path$ = e.nativeEvent.path[3].children[index - 1]) === null || _e$nativeEvent$path$ === void 0 ? void 0 : _e$nativeEvent$path$.getElementsByTagName('input')[currentIndex];
5782
+ var dom = (_e$nativeEvent$path$ = e.nativeEvent.path[3].children[index]) === null || _e$nativeEvent$path$ === void 0 ? void 0 : _e$nativeEvent$path$.getElementsByTagName('input')[currentIndex];
5749
5783
 
5750
5784
  if (dom) {
5751
5785
  dom.select();
5752
5786
  dom.focus();
5753
- dom.scrollIntoView(false);
5787
+ dom.scrollIntoViewIfNeeded(false);
5754
5788
  }
5755
5789
 
5756
5790
  dom = null;
@@ -5778,14 +5812,14 @@ var InputElement = function InputElement(_ref) {
5778
5812
  e.stopPropagation();
5779
5813
  e.preventDefault();
5780
5814
 
5781
- var _dom2 = (_e$nativeEvent$path$2 = e.nativeEvent.path[3].children[index]) === null || _e$nativeEvent$path$2 === void 0 ? void 0 : _e$nativeEvent$path$2.getElementsByTagName('input')[currentIndex - 1];
5815
+ var _dom2 = (_e$nativeEvent$path$2 = e.nativeEvent.path[3].children[index + 1]) === null || _e$nativeEvent$path$2 === void 0 ? void 0 : _e$nativeEvent$path$2.getElementsByTagName('input')[currentIndex - 1];
5782
5816
 
5783
5817
  if (_dom2) {
5784
5818
  _dom2.select();
5785
5819
 
5786
5820
  _dom2.focus();
5787
5821
 
5788
- _dom2.scrollIntoView(false);
5822
+ _dom2.scrollIntoViewIfNeeded(false);
5789
5823
  }
5790
5824
 
5791
5825
  _dom2 = null;
@@ -5798,14 +5832,14 @@ var InputElement = function InputElement(_ref) {
5798
5832
  e.stopPropagation();
5799
5833
  e.preventDefault();
5800
5834
 
5801
- var _dom3 = (_e$nativeEvent$path$3 = e.nativeEvent.path[3].children[index]) === null || _e$nativeEvent$path$3 === void 0 ? void 0 : _e$nativeEvent$path$3.getElementsByTagName('input')[currentIndex + 1];
5835
+ var _dom3 = (_e$nativeEvent$path$3 = e.nativeEvent.path[3].children[index + 1]) === null || _e$nativeEvent$path$3 === void 0 ? void 0 : _e$nativeEvent$path$3.getElementsByTagName('input')[currentIndex + 1];
5802
5836
 
5803
5837
  if (_dom3) {
5804
5838
  _dom3.select();
5805
5839
 
5806
5840
  _dom3.focus();
5807
5841
 
5808
- _dom3.scrollIntoView(false);
5842
+ _dom3.scrollIntoViewIfNeeded(false);
5809
5843
  }
5810
5844
 
5811
5845
  _dom3 = null;
@@ -5815,17 +5849,18 @@ var InputElement = function InputElement(_ref) {
5815
5849
  var _e$nativeEvent$path$4;
5816
5850
 
5817
5851
  // 向下
5852
+ debugger;
5818
5853
  e.stopPropagation();
5819
5854
  e.preventDefault();
5820
5855
 
5821
- var _dom4 = (_e$nativeEvent$path$4 = e.nativeEvent.path[3].children[index + 1]) === null || _e$nativeEvent$path$4 === void 0 ? void 0 : _e$nativeEvent$path$4.getElementsByTagName('input')[currentIndex];
5856
+ var _dom4 = (_e$nativeEvent$path$4 = e.nativeEvent.path[3].children[index + 2]) === null || _e$nativeEvent$path$4 === void 0 ? void 0 : _e$nativeEvent$path$4.getElementsByTagName('input')[currentIndex];
5822
5857
 
5823
5858
  if (_dom4) {
5824
5859
  _dom4.select();
5825
5860
 
5826
5861
  _dom4.focus();
5827
5862
 
5828
- _dom4.scrollIntoView(false);
5863
+ _dom4.scrollIntoViewIfNeeded(false);
5829
5864
  }
5830
5865
 
5831
5866
  _dom4 = null;
@@ -5834,7 +5869,7 @@ var InputElement = function InputElement(_ref) {
5834
5869
 
5835
5870
  e.stopPropagation();
5836
5871
  e.preventDefault();
5837
- var dom1 = (_e$nativeEvent$path$5 = e.nativeEvent.path[3].children[index - 1]) === null || _e$nativeEvent$path$5 === void 0 ? void 0 : _e$nativeEvent$path$5.getElementsByTagName('input')[currentIndex];
5872
+ var dom1 = (_e$nativeEvent$path$5 = e.nativeEvent.path[3].children[index]) === null || _e$nativeEvent$path$5 === void 0 ? void 0 : _e$nativeEvent$path$5.getElementsByTagName('input')[currentIndex];
5838
5873
 
5839
5874
  if (dom1) {
5840
5875
  // dom1.value=""
@@ -5869,12 +5904,12 @@ var InputElement = function InputElement(_ref) {
5869
5904
  antd.message.success('删除当前行');
5870
5905
  e.stopPropagation();
5871
5906
  e.preventDefault();
5872
- var dom = (_e$nativeEvent$path$6 = e.nativeEvent.path[5].children[index - 1]) === null || _e$nativeEvent$path$6 === void 0 ? void 0 : _e$nativeEvent$path$6.getElementsByTagName('input')[currentIndex];
5907
+ var dom = (_e$nativeEvent$path$6 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$6 === void 0 ? void 0 : _e$nativeEvent$path$6.getElementsByTagName('input')[currentIndex];
5873
5908
 
5874
5909
  if (dom) {
5875
5910
  dom.select();
5876
5911
  dom.focus();
5877
- dom.scrollIntoView(false);
5912
+ dom.scrollIntoViewIfNeeded(false);
5878
5913
  }
5879
5914
 
5880
5915
  dom = null;
@@ -5890,14 +5925,14 @@ var InputElement = function InputElement(_ref) {
5890
5925
  e.stopPropagation();
5891
5926
  e.preventDefault();
5892
5927
 
5893
- var _dom5 = (_e$nativeEvent$path$7 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$7 === void 0 ? void 0 : _e$nativeEvent$path$7.getElementsByTagName('input')[currentIndex - 1];
5928
+ var _dom5 = (_e$nativeEvent$path$7 = e.nativeEvent.path[5].children[index + 1]) === null || _e$nativeEvent$path$7 === void 0 ? void 0 : _e$nativeEvent$path$7.getElementsByTagName('input')[currentIndex - 1];
5894
5929
 
5895
5930
  if (_dom5) {
5896
5931
  _dom5.select();
5897
5932
 
5898
5933
  _dom5.focus();
5899
5934
 
5900
- _dom5.scrollIntoView(false);
5935
+ _dom5.scrollIntoViewIfNeeded(false);
5901
5936
  }
5902
5937
 
5903
5938
  _dom5 = null;
@@ -5910,14 +5945,14 @@ var InputElement = function InputElement(_ref) {
5910
5945
  e.stopPropagation();
5911
5946
  e.preventDefault();
5912
5947
 
5913
- var _dom6 = (_e$nativeEvent$path$8 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$8 === void 0 ? void 0 : _e$nativeEvent$path$8.getElementsByTagName('input')[currentIndex + 1];
5948
+ var _dom6 = (_e$nativeEvent$path$8 = e.nativeEvent.path[5].children[index + 1]) === null || _e$nativeEvent$path$8 === void 0 ? void 0 : _e$nativeEvent$path$8.getElementsByTagName('input')[currentIndex + 1];
5914
5949
 
5915
5950
  if (_dom6) {
5916
5951
  _dom6.select();
5917
5952
 
5918
5953
  _dom6.focus();
5919
5954
 
5920
- _dom6.scrollIntoView(false);
5955
+ _dom6.scrollIntoViewIfNeeded(false);
5921
5956
  }
5922
5957
 
5923
5958
  _dom6 = null;
@@ -5930,14 +5965,14 @@ var InputElement = function InputElement(_ref) {
5930
5965
  e.stopPropagation();
5931
5966
  e.preventDefault();
5932
5967
 
5933
- var _dom7 = (_e$nativeEvent$path$9 = e.nativeEvent.path[5].children[index + 1]) === null || _e$nativeEvent$path$9 === void 0 ? void 0 : _e$nativeEvent$path$9.getElementsByTagName('input')[currentIndex];
5968
+ var _dom7 = (_e$nativeEvent$path$9 = e.nativeEvent.path[5].children[index + 2]) === null || _e$nativeEvent$path$9 === void 0 ? void 0 : _e$nativeEvent$path$9.getElementsByTagName('input')[currentIndex];
5934
5969
 
5935
5970
  if (_dom7) {
5936
5971
  _dom7.select();
5937
5972
 
5938
5973
  _dom7.focus();
5939
5974
 
5940
- _dom7.scrollIntoView(false);
5975
+ _dom7.scrollIntoViewIfNeeded(false);
5941
5976
  }
5942
5977
 
5943
5978
  _dom7 = null;
@@ -5946,7 +5981,7 @@ var InputElement = function InputElement(_ref) {
5946
5981
 
5947
5982
  e.stopPropagation();
5948
5983
  e.preventDefault();
5949
- var dom1 = (_e$nativeEvent$path$10 = e.nativeEvent.path[5].children[index - 1]) === null || _e$nativeEvent$path$10 === void 0 ? void 0 : _e$nativeEvent$path$10.getElementsByTagName('input')[currentIndex];
5984
+ var dom1 = (_e$nativeEvent$path$10 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$10 === void 0 ? void 0 : _e$nativeEvent$path$10.getElementsByTagName('input')[currentIndex];
5950
5985
 
5951
5986
  if (dom1) {
5952
5987
  // dom1.value=""
@@ -6004,27 +6039,36 @@ var BillEntry = function BillEntry(_ref3) {
6004
6039
  });
6005
6040
 
6006
6041
  if (base.length) {
6042
+ var _base$;
6043
+
6007
6044
  baseUnitCode = base[0].unitCode;
6008
6045
  record.selectUnitCode = base[0].unitCode;
6046
+ record.selectedScale = ((_base$ = base[0]) === null || _base$ === void 0 ? void 0 : _base$.baseUnitScale) || 1;
6009
6047
  }
6010
6048
  }
6011
6049
 
6012
- record.packingUnitList = record.packingUnitList || [];
6013
- return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
6014
- value: record.selectUnitCode,
6015
- onChange: function onChange(value) {
6016
- record.selectUnitCode = value;
6017
- },
6018
- style: {
6019
- width: '60px',
6020
- height: '22px',
6021
- lineHight: '22px'
6022
- }
6023
- }, record.packingUnitList && record.packingUnitList.map(function (item) {
6024
- return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
6025
- value: item.unitCode
6026
- }, item.name);
6027
- })));
6050
+ if (baseUnitCode) {
6051
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Select, {
6052
+ defaultValue: baseUnitCode,
6053
+ onChange: function onChange(value) {
6054
+ var _record$packingUnitLi, _record$packingUnitLi2;
6055
+
6056
+ record.selectUnitCode = value;
6057
+ record.selectedScale = (record === null || record === void 0 ? void 0 : (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : (_record$packingUnitLi2 = _record$packingUnitLi.find(function (item) {
6058
+ return item.unitCode === value;
6059
+ })) === null || _record$packingUnitLi2 === void 0 ? void 0 : _record$packingUnitLi2.baseUnitScale) || 1;
6060
+ },
6061
+ style: {
6062
+ width: '60px'
6063
+ }
6064
+ }, record.packingUnitList && record.packingUnitList.map(function (item) {
6065
+ return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
6066
+ value: item.unitCode
6067
+ }, item.name);
6068
+ })));
6069
+ }
6070
+
6071
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
6028
6072
  }
6029
6073
  }, {
6030
6074
  title: '数量',
@@ -6133,7 +6177,6 @@ var BillEntry = function BillEntry(_ref3) {
6133
6177
  })), [{
6134
6178
  title: '操作',
6135
6179
  width: 50,
6136
- fixed: 'right',
6137
6180
  render: function render(text, record, index) {
6138
6181
  if (index !== 0) {
6139
6182
  return /*#__PURE__*/React__default['default'].createElement("span", {
@@ -8449,7 +8492,8 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
8449
8492
  style = _props$style === void 0 ? {
8450
8493
  width: '100%'
8451
8494
  } : _props$style,
8452
- getTreeData = props.getTreeData;
8495
+ getTreeData = props.getTreeData,
8496
+ disabled = props.disabled;
8453
8497
  var url = remoteSource.url,
8454
8498
  _remoteSource$paramsK = remoteSource.paramsKey,
8455
8499
  paramsKey = _remoteSource$paramsK === void 0 ? 'qp-name-like' : _remoteSource$paramsK,
@@ -8621,7 +8665,7 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
8621
8665
  multiple: multiple,
8622
8666
  maxTagPlaceholder: maxTagPlaceholder,
8623
8667
  onChange: handleChange,
8624
- disabled: mode === 'view' || (ctx === null || ctx === void 0 ? void 0 : ctx.mode) === 'view',
8668
+ disabled: disabled || mode === 'view' || (ctx === null || ctx === void 0 ? void 0 : ctx.mode) === 'view',
8625
8669
  getPopupContainer: function getPopupContainer() {
8626
8670
  return _getPopupContainer && _getPopupContainer() || document.body;
8627
8671
  }
@@ -8726,22 +8770,6 @@ var index$1 = /*#__PURE__*/React__default['default'].memo(BusinessTreeSearchSele
8726
8770
  return true;
8727
8771
  });
8728
8772
 
8729
- /*
8730
- * @Description:
8731
- * @Author: rodchen
8732
- * @Date: 2021-11-30 22:59:39
8733
- * @LastEditTime: 2022-01-14 16:10:27
8734
- * @LastEditors: rodchen
8735
- */
8736
- var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
8737
- axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
8738
- axios__default['default'].defaults.headers.common['x-tenant-id'] = (resposne === null || resposne === void 0 ? void 0 : resposne.tenantId) || '1';
8739
-
8740
- if (localStorage.getItem('x-user-auth-context')) {
8741
- // @ts-ignore
8742
- axios__default['default'].defaults.headers.common['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
8743
- }
8744
-
8745
8773
  exports.AddSelect = AddSelect;
8746
8774
  exports.AddSkuSelect = AddSkuSelect;
8747
8775
  exports.BillEntry = BillEntry;
@@ -0,0 +1 @@
1
+ export declare function handleRequestAuthHeader(config?: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.0.6",
3
+ "version": "2.0.9",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -234,11 +234,11 @@ const InputElement = ({
234
234
  message.success('删除当前行')
235
235
  e.stopPropagation();
236
236
  e.preventDefault();
237
- let dom = e.nativeEvent.path[3].children[index - 1]?.getElementsByTagName('input')[currentIndex]
237
+ let dom = e.nativeEvent.path[3].children[index]?.getElementsByTagName('input')[currentIndex]
238
238
  if (dom) {
239
239
  dom.select();
240
240
  dom.focus();
241
- dom.scrollIntoView(false)
241
+ dom.scrollIntoViewIfNeeded(false)
242
242
  }
243
243
  dom = null
244
244
  setData(data.filter((item, innerIndex) => innerIndex !== index))
@@ -256,39 +256,40 @@ const InputElement = ({
256
256
  if (e.keyCode === 37 && e.shiftKey) { // 左滑动
257
257
  e.stopPropagation();
258
258
  e.preventDefault();
259
- let dom = e.nativeEvent.path[3].children[index]?.getElementsByTagName('input')[currentIndex - 1]
259
+ let dom = e.nativeEvent.path[3].children[index + 1]?.getElementsByTagName('input')[currentIndex - 1]
260
260
  if (dom) {
261
261
  dom.select();
262
262
  dom.focus();
263
- dom.scrollIntoView(false)
263
+ dom.scrollIntoViewIfNeeded(false)
264
264
  }
265
265
  dom = null
266
266
  }
267
267
  if (e.keyCode === 39 && e.shiftKey) { // 右滑
268
268
  e.stopPropagation();
269
269
  e.preventDefault();
270
- let dom = e.nativeEvent.path[3].children[index]?.getElementsByTagName('input')[currentIndex + 1]
270
+ let dom = e.nativeEvent.path[3].children[index + 1]?.getElementsByTagName('input')[currentIndex + 1]
271
271
  if (dom) {
272
272
  dom.select();
273
273
  dom.focus();
274
- dom.scrollIntoView(false)
274
+ dom.scrollIntoViewIfNeeded(false)
275
275
  }
276
276
  dom = null
277
277
  }
278
278
  if (e.keyCode === 40) { // 向下
279
+ debugger
279
280
  e.stopPropagation();
280
281
  e.preventDefault();
281
- let dom = e.nativeEvent.path[3].children[index + 1]?.getElementsByTagName('input')[currentIndex]
282
+ let dom = e.nativeEvent.path[3].children[index + 2]?.getElementsByTagName('input')[currentIndex]
282
283
  if (dom) {
283
284
  dom.select();
284
285
  dom.focus();
285
- dom.scrollIntoView(false)
286
+ dom.scrollIntoViewIfNeeded(false)
286
287
  }
287
288
  dom = null
288
289
  } else if (e.keyCode === 38) {
289
290
  e.stopPropagation();
290
291
  e.preventDefault();
291
- let dom1 = e.nativeEvent.path[3].children[index - 1]?.getElementsByTagName('input')[currentIndex]
292
+ let dom1 = e.nativeEvent.path[3].children[index]?.getElementsByTagName('input')[currentIndex]
292
293
  if (dom1) {
293
294
  // dom1.value=""
294
295
  // dom1.setSelectionRange(100, 0);
@@ -321,11 +322,11 @@ const InputElement = ({
321
322
  message.success('删除当前行')
322
323
  e.stopPropagation();
323
324
  e.preventDefault();
324
- let dom = e.nativeEvent.path[5].children[index - 1]?.getElementsByTagName('input')[currentIndex]
325
+ let dom = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex]
325
326
  if (dom) {
326
327
  dom.select();
327
328
  dom.focus();
328
- dom.scrollIntoView(false)
329
+ dom.scrollIntoViewIfNeeded(false)
329
330
  }
330
331
  dom = null
331
332
  setData(data.filter((item, innerIndex) => innerIndex !== index))
@@ -333,39 +334,39 @@ const InputElement = ({
333
334
  if (e.keyCode === 37 && e.shiftKey) { // 左滑动
334
335
  e.stopPropagation();
335
336
  e.preventDefault();
336
- let dom = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex - 1]
337
+ let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex - 1]
337
338
  if (dom) {
338
339
  dom.select();
339
340
  dom.focus();
340
- dom.scrollIntoView(false)
341
+ dom.scrollIntoViewIfNeeded(false)
341
342
  }
342
343
  dom = null
343
344
  }
344
345
  if (e.keyCode === 39 && e.shiftKey) { // 右滑
345
346
  e.stopPropagation();
346
347
  e.preventDefault();
347
- let dom = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex + 1]
348
+ let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex + 1]
348
349
  if (dom) {
349
350
  dom.select();
350
351
  dom.focus();
351
- dom.scrollIntoView(false)
352
+ dom.scrollIntoViewIfNeeded(false)
352
353
  }
353
354
  dom = null
354
355
  }
355
356
  if (e.keyCode === 40) { // 向下
356
357
  e.stopPropagation();
357
358
  e.preventDefault();
358
- let dom = e.nativeEvent.path[5].children[index + 1]?.getElementsByTagName('input')[currentIndex]
359
+ let dom = e.nativeEvent.path[5].children[index + 2]?.getElementsByTagName('input')[currentIndex]
359
360
  if (dom) {
360
361
  dom.select();
361
362
  dom.focus();
362
- dom.scrollIntoView(false)
363
+ dom.scrollIntoViewIfNeeded(false)
363
364
  }
364
365
  dom = null
365
366
  } else if (e.keyCode === 38) {
366
367
  e.stopPropagation();
367
368
  e.preventDefault();
368
- let dom1 = e.nativeEvent.path[5].children[index - 1]?.getElementsByTagName('input')[currentIndex]
369
+ let dom1 = e.nativeEvent.path[5].children[index]?.getElementsByTagName('input')[currentIndex]
369
370
  if (dom1) {
370
371
  // dom1.value=""
371
372
  // dom1.setSelectionRange(100, 0);
@@ -418,23 +419,27 @@ const BillEntry: React.FC = ({ onSaveCallback }) => {
418
419
  isSelectItem: true,
419
420
  render: (text: any, record: any) => {
420
421
  let baseUnitCode = '';
421
- if (record?.packingUnitList) {
422
- let base = record.packingUnitList.filter((item: any) => item.unitCode)
423
- if (base.length) {
424
- baseUnitCode = base[0].unitCode
425
- record.selectUnitCode = base[0].unitCode
422
+ if (record?.packingUnitList) {
423
+ let base = record.packingUnitList.filter((item: any) => item.unitCode)
424
+ if (base.length) {
425
+ baseUnitCode = base[0].unitCode
426
+ record.selectUnitCode = base[0].unitCode
427
+ record.selectedScale = base[0]?.baseUnitScale || 1
428
+ }
426
429
  }
427
- }
428
-
429
- record.packingUnitList = record.packingUnitList || []
430
430
 
431
- return <>
432
- <Select value={record.selectUnitCode} onChange={(value) => { record.selectUnitCode = value }} style={{ width: '60px', height: '22px', lineHight: '22px' }}>
433
- {record.packingUnitList && record.packingUnitList.map((item: any) => {
434
- return <Select.Option value={item.unitCode}>{item.name}</Select.Option>
435
- })}
436
- </Select>
437
- </>
431
+ if (baseUnitCode) {
432
+ return <>
433
+ <Select defaultValue={baseUnitCode} onChange={(value) => {
434
+ record.selectUnitCode = value;record.selectedScale = record?.packingUnitList?.find((item: any) => item.unitCode === value)?.baseUnitScale || 1}
435
+ } style={{width: '60px'}}>
436
+ {record.packingUnitList && record.packingUnitList.map((item: any) => {
437
+ return <Select.Option value={item.unitCode}>{item.name}</Select.Option>
438
+ })}
439
+ </Select>
440
+ </>
441
+ }
442
+ return <></>
438
443
  },
439
444
  },
440
445
  {
@@ -515,7 +520,6 @@ const BillEntry: React.FC = ({ onSaveCallback }) => {
515
520
  }), {
516
521
  title: '操作',
517
522
  width: 50,
518
- fixed: 'right',
519
523
  render: (text, record, index) => {
520
524
  if (index !== 0) {
521
525
  return (
@@ -531,7 +535,9 @@ const BillEntry: React.FC = ({ onSaveCallback }) => {
531
535
  return (
532
536
  <div className='add_select'>
533
537
  <div className='add_select_quick_header'>
534
- <div className='add_select_quick_header_title'><div>快速录入</div><Button type="primary" onClick={() => { onSaveCallback(data) }}>提交</Button></div>
538
+ <div className='add_select_quick_header_title'><div>快速录入</div><Button type="primary" onClick={() => {
539
+ onSaveCallback(data)
540
+ }}>提交</Button></div>
535
541
  <span><span>*</span> &nbsp;快捷键:【Tab】-跳格切换;【Shift+←、→】-当前行左、右移动;【 ↑、↓】-当前列上、下移动;【ctrl+Delete】-删除当前行;</span>
536
542
  </div>
537
543
  <div className={'add_select_wrapper_select add_select_wrapper_select_quick'}>
@@ -58,6 +58,7 @@ const mapping = new Map([
58
58
  ['newUniqueCode', '新唯一码'],
59
59
  ['relationRecordCode', '单据编码'],
60
60
  ['remark', '备注'],
61
+ ['externalCode', 'JDE商品编码']
61
62
  ]);
62
63
 
63
64
  // for dnd
@@ -26,7 +26,8 @@ const TreeSearchSelect = (props: any) => {
26
26
  allowClear = true,
27
27
  showCheckedStrategy = TreeSelect.SHOW_PARENT,
28
28
  style = { width: '100%' },
29
- getTreeData
29
+ getTreeData,
30
+ disabled
30
31
  } = props;
31
32
 
32
33
  const {
@@ -137,7 +138,7 @@ const TreeSearchSelect = (props: any) => {
137
138
  multiple={multiple} // 支持多选(当设置 treeCheckable 时自动变为 true)
138
139
  maxTagPlaceholder={maxTagPlaceholder}
139
140
  onChange={handleChange}
140
- disabled={mode==='view' || ctx?.mode === 'view'}
141
+ disabled={disabled || mode==='view' || ctx?.mode === 'view'}
141
142
  getPopupContainer={() => (getPopupContainer && getPopupContainer()) || document.body}
142
143
  >
143
144
  </TreeSelect>
package/src/index.ts CHANGED
@@ -5,18 +5,8 @@
5
5
  * @LastEditTime: 2022-01-14 16:10:27
6
6
  * @LastEditors: rodchen
7
7
  */
8
-
9
- import axios from 'axios';
10
8
  import 'antd/dist/antd.css';
11
-
12
- const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
13
-
14
- axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
15
- axios.defaults.headers.common['x-tenant-id'] = resposne?.tenantId || '1';
16
- if (localStorage.getItem('x-user-auth-context')) {
17
- // @ts-ignore
18
- axios.defaults.headers.common['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
19
- }
9
+ import './utils/requestUtils';
20
10
 
21
11
  export { default as DataValidation } from './components/Functional/DataValidation';
22
12
  export { default as DataImport } from './components/Functional/DataImport';
@@ -0,0 +1,32 @@
1
+ import axios from 'axios';
2
+
3
+ const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
4
+
5
+ export function handleRequestAuthHeader(config?: any) {
6
+ // https://www.kdocs.cn/l/coNbPpjamr5v这个表格里面涉及的接口,接口请求头里需要添加参数:x-biz-code 值就是列表里的code
7
+ // 例:x-biz-code=STORE_CODE
8
+ // 物理仓选择组件
9
+ if(config?.url?.indexOf( '/stock/physicalWarehouse?') > -1) {
10
+ config.headers['x-biz-code'] = 'PW_STOCK_CODE';
11
+ }
12
+ // 逻辑仓选择组件
13
+ if(config?.url?.indexOf( '/stock/realWarehouse?') > -1) {
14
+ config.headers['x-biz-code'] = 'RW_STOCK_CODE';
15
+ }
16
+ }
17
+
18
+ // 处理请求头
19
+ const handleRequestHeader = (config: any) => {
20
+ config.headers['sso-sessionid'] = resposne?.sessionId || ''
21
+ config.headers['x-tenant-id'] = resposne?.tenantId || '1'
22
+ if (localStorage.getItem('x-user-auth-context')) {
23
+ config.headers['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
24
+ }
25
+ handleRequestAuthHeader(config)
26
+ }
27
+
28
+ // 拦截器
29
+ axios.interceptors.request.use((config: any) => {
30
+ handleRequestHeader(config)
31
+ return config
32
+ })