@kmkf-fe-packages/kmkf-utils 0.6.3-alpha.4 → 0.6.3-alpha.44

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/README.md CHANGED
@@ -1 +1,3 @@
1
1
  ### 修改发布
2
+
3
+ 111
@@ -1,9 +1,3 @@
1
- declare type AddressMapT = {
2
- [p in string]: string;
3
- };
4
- declare type AddressTuples = {
5
- [p in string]: [string, string | number];
6
- };
7
1
  interface TreeOption {
8
2
  label: string;
9
3
  value: string;
@@ -11,9 +5,9 @@ interface TreeOption {
11
5
  }
12
6
  export default class AddressData {
13
7
  private static instance;
14
- addrData: AddressTuples;
15
- addrNameMap: AddressMapT;
16
- treeData: TreeOption[];
8
+ addrData: Record<string, [string, string | number]>;
9
+ addrNameMap: Record<string, string>;
10
+ addressOptions: TreeOption[];
17
11
  constructor();
18
12
  initData: () => void;
19
13
  parseData: (addrCode: string | number) => {
@@ -32,7 +26,7 @@ export default class AddressData {
32
26
  label: string;
33
27
  value: string;
34
28
  }[];
35
- getProCodeByName: (proName: string) => string | undefined;
29
+ getProCodeByName: (proName: string) => number | undefined;
36
30
  getNameByCode: (code: string | number) => string;
37
31
  static getInstance(): AddressData;
38
32
  }
@@ -7,38 +7,39 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
7
7
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
8
  import request from "../request";
9
9
  import { toTree } from "../utils";
10
+ import get from 'lodash/get';
10
11
  var AddressData = /*#__PURE__*/function () {
11
12
  function AddressData() {
12
13
  var _this = this;
13
14
  _classCallCheck(this, AddressData);
14
15
  _defineProperty(this, "addrData", {});
15
16
  _defineProperty(this, "addrNameMap", {});
16
- _defineProperty(this, "treeData", []);
17
+ _defineProperty(this, "addressOptions", []);
17
18
  _defineProperty(this, "initData", function () {
18
19
  var _Object$keys;
19
20
  if (((_Object$keys = Object.keys(_this.addrData)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) return;
20
21
  request({
21
- url: '/qy/gdfw/template/queryAreas',
22
- method: 'get',
22
+ url: "/qy/gdfw/template/queryAreas",
23
+ method: "get",
23
24
  data: {}
24
25
  }).then(function (resp) {
25
26
  var map = {};
26
27
  var res = {};
27
28
  var list = resp.data;
28
29
  for (var i = 0; i < list.length; i++) {
29
- res[list[i]['id']] = [list[i]['name'], list[i]['parentId']];
30
- map[list[i]['name']] = list[i]['id'];
30
+ res[list[i]["id"]] = [list[i]["name"], list[i]["parentId"]];
31
+ map[list[i]["name"]] = list[i]["id"];
31
32
  }
32
33
  _this.addrData = res;
33
34
  _this.addrNameMap = map;
34
- _this.treeData = toTree(list, 0);
35
+ _this.addressOptions = get(toTree(list, 0), '0.children', []);
35
36
  });
36
37
  });
37
38
  _defineProperty(this, "parseData", function (addrCode) {
38
39
  var nameCode = {},
39
40
  arr = [];
40
41
  for (var key in _this.addrData) {
41
- if (_this.addrData.hasOwnProperty(key)) {
42
+ if (Object.prototype.hasOwnProperty.call(_this.addrData, key)) {
42
43
  var valueArray = _this.addrData[key];
43
44
  if (valueArray[1] === Number(addrCode)) {
44
45
  nameCode[valueArray[0]] = key;
@@ -63,7 +64,7 @@ var AddressData = /*#__PURE__*/function () {
63
64
  _defineProperty(this, "getProCodeByName", function (proName) {
64
65
  for (var key in _this.addrData) {
65
66
  if (_this.addrData[key][0] === proName) {
66
- return key;
67
+ return Number(key);
67
68
  }
68
69
  }
69
70
  });
@@ -1,6 +1,11 @@
1
1
  interface OptionsItem {
2
2
  label: string | number;
3
3
  value: string | number;
4
+ expressName?: string;
5
+ expressCode?: string;
6
+ isInterface?: boolean;
7
+ interceptionTypeList?: any[];
8
+ logisticsStatusList?: any[];
4
9
  }
5
10
  export default class ExpressData {
6
11
  private static instance;
@@ -9,12 +14,8 @@ export default class ExpressData {
9
14
  initData: () => OptionsItem[] | undefined;
10
15
  getExpressData: () => OptionsItem[] | undefined;
11
16
  setExpressData: (val: OptionsItem[]) => OptionsItem[];
12
- getExpressNameByCode: (code: string | number) => string | number;
13
- getExpressNameByName: (name: string | number) => string | number;
14
- getInterceptionTypeName: (company: string, type: string) => any;
15
- getInterceptionStatusName: (company: string, status: string) => any;
16
- isInterfaceCompany: (company: string) => any;
17
- isShowNewAddress: (company: string, type: string) => any;
17
+ getExpressNameByCode: (code: string | number, returnCurrentValue?: boolean) => string | number;
18
+ getExpressCodeByName: (name: string | number, returnCurrentValue?: boolean) => string | number;
18
19
  static getInstance(): ExpressData;
19
20
  }
20
21
  export {};
@@ -1,4 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
4
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
5
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
6
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -14,16 +16,16 @@ var ExpressData = /*#__PURE__*/function () {
14
16
  _defineProperty(this, "initData", function () {
15
17
  if (_this.expressData.length > 0) return _this.expressData;
16
18
  request({
17
- url: '/tianwen/print/queryAllDeliveryCompanyInfo',
18
- method: 'post',
19
+ url: "/qy/logistics/company/getAllLogisticsCompany",
20
+ method: "get",
19
21
  data: {}
20
22
  }).then(function (res) {
21
23
  var data = res.data;
22
- var expressList = data.deliveryCompanyInfoList.map(function (item) {
23
- return {
24
+ var expressList = data.logisticsCompanyDtoList.map(function (item) {
25
+ return _objectSpread(_objectSpread({}, item), {}, {
24
26
  label: item.name,
25
- value: item.deliveryCode
26
- };
27
+ value: item.cpCode
28
+ });
27
29
  });
28
30
  _this.expressData = expressList;
29
31
  });
@@ -37,51 +39,18 @@ var ExpressData = /*#__PURE__*/function () {
37
39
  return _this.expressData = val;
38
40
  });
39
41
  _defineProperty(this, "getExpressNameByCode", function (code) {
42
+ var returnCurrentValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
40
43
  var item = (_this.expressData || []).filter(function (item) {
41
44
  return item.value === code;
42
45
  });
43
- return item.length ? item[0].label : code;
46
+ return item.length ? item[0].label : returnCurrentValue ? code : "";
44
47
  });
45
- _defineProperty(this, "getExpressNameByName", function (name) {
48
+ _defineProperty(this, "getExpressCodeByName", function (name) {
49
+ var returnCurrentValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
46
50
  var item = (_this.expressData || []).filter(function (item) {
47
51
  return item.label === name;
48
52
  });
49
- return item.length ? item[0].value : name;
50
- });
51
- _defineProperty(this, "getInterceptionTypeName", function (company, type) {
52
- var _find;
53
- var item = (_this.expressData || []).find(function (item) {
54
- return item.value === company;
55
- });
56
- var label = (_find = ((item === null || item === void 0 ? void 0 : item.interceptionTypeList) || []).find(function (t) {
57
- return t.value === type;
58
- })) === null || _find === void 0 ? void 0 : _find.label;
59
- return label;
60
- });
61
- _defineProperty(this, "getInterceptionStatusName", function (company, status) {
62
- var _find2;
63
- var item = (_this.expressData || []).find(function (item) {
64
- return item.value === company;
65
- });
66
- var label = (_find2 = ((item === null || item === void 0 ? void 0 : item.interceptionStatusList) || []).find(function (t) {
67
- return t.value === status;
68
- })) === null || _find2 === void 0 ? void 0 : _find2.label;
69
- return label;
70
- });
71
- _defineProperty(this, "isInterfaceCompany", function (company) {
72
- var item = (_this.expressData || []).find(function (item) {
73
- return item.value === company;
74
- });
75
- return item === null || item === void 0 ? void 0 : item.isInterface;
76
- });
77
- _defineProperty(this, "isShowNewAddress", function (company, type) {
78
- var _find3, _find3$config;
79
- var item = (_this.expressData || []).find(function (item) {
80
- return item.value === company;
81
- });
82
- return (_find3 = ((item === null || item === void 0 ? void 0 : item.interceptionTypeList) || []).find(function (t) {
83
- return t.value === type;
84
- })) === null || _find3 === void 0 ? void 0 : (_find3$config = _find3.config) === null || _find3$config === void 0 ? void 0 : _find3$config.showAddress;
53
+ return item.length ? item[0].value : returnCurrentValue ? name : "";
85
54
  });
86
55
  this.initData();
87
56
  }
@@ -0,0 +1,44 @@
1
+ interface OptionsItem {
2
+ label: string | number;
3
+ value: string | number;
4
+ expressName?: string;
5
+ expressCode?: string;
6
+ isInterface?: boolean;
7
+ interceptionTypeList?: any[];
8
+ logisticsStatusList?: any[];
9
+ }
10
+ export default class ExpressInterceptData {
11
+ private static instance;
12
+ expressData: OptionsItem[];
13
+ showInterceptionMap: any;
14
+ showNewAddressMap: any;
15
+ typeNameMap: any;
16
+ statusNameMap: any;
17
+ typeOptions: {
18
+ label: string;
19
+ value: string;
20
+ }[];
21
+ statusOptions: {
22
+ label: string;
23
+ value: string;
24
+ }[];
25
+ constructor();
26
+ initData: () => OptionsItem[] | undefined;
27
+ getExpressData: () => OptionsItem[] | undefined;
28
+ getShowInterceptionBtn(): any;
29
+ getTypeNameMap(): any;
30
+ getStatusNameMap(): any;
31
+ getShowNewAddressMap(): any;
32
+ getTypeOptions(): {
33
+ label: string;
34
+ value: string;
35
+ }[];
36
+ getStatusOptions(): {
37
+ label: string;
38
+ value: string;
39
+ }[];
40
+ setExpressData: (val: OptionsItem[]) => OptionsItem[];
41
+ isInterfaceCompany: (company: string) => boolean;
42
+ static getInstance(): ExpressInterceptData;
43
+ }
44
+ export {};
@@ -0,0 +1,169 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
+ import request from "../request";
17
+ var ExpressInterceptData = /*#__PURE__*/function () {
18
+ //展示拦截按钮映射
19
+ //展示新收货地映射
20
+ //拦截类型映射
21
+ //物流状态映射
22
+ //拦截类型筛选options
23
+ //物流状态筛选options
24
+ function ExpressInterceptData() {
25
+ var _this = this;
26
+ _classCallCheck(this, ExpressInterceptData);
27
+ _defineProperty(this, "expressData", []);
28
+ _defineProperty(this, "showInterceptionMap", null);
29
+ _defineProperty(this, "showNewAddressMap", {});
30
+ _defineProperty(this, "typeNameMap", null);
31
+ _defineProperty(this, "statusNameMap", null);
32
+ _defineProperty(this, "typeOptions", []);
33
+ _defineProperty(this, "statusOptions", []);
34
+ _defineProperty(this, "initData", function () {
35
+ if (_this.expressData.length > 0) return _this.expressData;
36
+ request({
37
+ url: "/qy/logistics/listLogisticsWithInterceptInfo",
38
+ method: "post",
39
+ data: {
40
+ platformType: 118
41
+ }
42
+ }).then(function (res) {
43
+ var data = res.data;
44
+ var expressList = data.map(function (item) {
45
+ return _objectSpread(_objectSpread({}, item), {}, {
46
+ label: item.name,
47
+ value: item.cpCode
48
+ });
49
+ });
50
+ _this.expressData = expressList;
51
+ var showBtn = {},
52
+ showAddress = {},
53
+ typeMap = {},
54
+ statusMap = {},
55
+ typeObj = {},
56
+ statusObj = {};
57
+ expressList.forEach(function (item) {
58
+ var _item$logisticsStatus, _item$interceptionTyp;
59
+ if (item !== null && item !== void 0 && (_item$logisticsStatus = item.logisticsStatusList) !== null && _item$logisticsStatus !== void 0 && _item$logisticsStatus.length) {
60
+ item.logisticsStatusList.forEach(function (t) {
61
+ statusMap["".concat(t.value)] = t.label;
62
+ if (statusObj[t.label]) {
63
+ statusObj[t.label] = statusObj[t.label].add(t.value);
64
+ } else {
65
+ statusObj[t.label] = new Set([t.value]);
66
+ }
67
+ //todo 取消拦截按钮
68
+ if (t !== null && t !== void 0 && t.showInterceptionBtn) {
69
+ showBtn["".concat(t.value)] = true;
70
+ }
71
+ });
72
+ }
73
+ if (item !== null && item !== void 0 && (_item$interceptionTyp = item.interceptionTypeList) !== null && _item$interceptionTyp !== void 0 && _item$interceptionTyp.length) {
74
+ item.interceptionTypeList.forEach(function (t) {
75
+ var _t$config;
76
+ typeMap["".concat(t.value)] = t.label;
77
+ if (typeObj[t.label]) {
78
+ typeObj[t.label] = typeObj[t.label].add(t.value);
79
+ } else {
80
+ typeObj[t.label] = new Set([t.value]);
81
+ }
82
+ if (t !== null && t !== void 0 && (_t$config = t.config) !== null && _t$config !== void 0 && _t$config.showAddress) {
83
+ showAddress["".concat(t.value)] = true;
84
+ }
85
+ });
86
+ }
87
+ });
88
+ _this.showInterceptionMap = showBtn;
89
+ _this.typeNameMap = typeMap;
90
+ _this.statusNameMap = statusMap;
91
+ _this.showNewAddressMap = showAddress;
92
+ _this.typeOptions = Object.keys(typeObj).map(function (key) {
93
+ return {
94
+ label: key,
95
+ value: _toConsumableArray(typeObj[key]).join(",")
96
+ };
97
+ });
98
+ _this.statusOptions = Object.keys(statusObj).map(function (key) {
99
+ return {
100
+ label: key,
101
+ value: _toConsumableArray(statusObj[key]).join(",")
102
+ };
103
+ });
104
+ });
105
+ });
106
+ _defineProperty(this, "getExpressData", function () {
107
+ var _this$expressData;
108
+ if (((_this$expressData = _this.expressData) === null || _this$expressData === void 0 ? void 0 : _this$expressData.length) > 0) return _this.expressData;
109
+ _this.initData();
110
+ });
111
+ _defineProperty(this, "setExpressData", function (val) {
112
+ return _this.expressData = val;
113
+ });
114
+ _defineProperty(this, "isInterfaceCompany", function (company) {
115
+ var item = (_this.expressData || []).find(function (item) {
116
+ return item.value === company;
117
+ });
118
+ return !!(item !== null && item !== void 0 && item.isInterface);
119
+ });
120
+ this.initData();
121
+ }
122
+ _createClass(ExpressInterceptData, [{
123
+ key: "getShowInterceptionBtn",
124
+ value:
125
+ //获取拦截按钮展示映射
126
+ function getShowInterceptionBtn() {
127
+ return this.showInterceptionMap;
128
+ }
129
+ //获取拦截类型映射
130
+ }, {
131
+ key: "getTypeNameMap",
132
+ value: function getTypeNameMap() {
133
+ return this.typeNameMap;
134
+ }
135
+ //获取物流状态映射
136
+ }, {
137
+ key: "getStatusNameMap",
138
+ value: function getStatusNameMap() {
139
+ return this.statusNameMap;
140
+ }
141
+ //获取新派送地展示映射
142
+ }, {
143
+ key: "getShowNewAddressMap",
144
+ value: function getShowNewAddressMap() {
145
+ return this.showNewAddressMap;
146
+ }
147
+ }, {
148
+ key: "getTypeOptions",
149
+ value: function getTypeOptions() {
150
+ return this.typeOptions;
151
+ }
152
+ }, {
153
+ key: "getStatusOptions",
154
+ value: function getStatusOptions() {
155
+ return this.statusOptions;
156
+ }
157
+ }], [{
158
+ key: "getInstance",
159
+ value: function getInstance() {
160
+ if (!ExpressInterceptData.instance) {
161
+ ExpressInterceptData.instance = new ExpressInterceptData();
162
+ }
163
+ return ExpressInterceptData.instance;
164
+ }
165
+ }]);
166
+ return ExpressInterceptData;
167
+ }();
168
+ _defineProperty(ExpressInterceptData, "instance", void 0);
169
+ export { ExpressInterceptData as default };
@@ -0,0 +1,51 @@
1
+ declare enum TComponentType {
2
+ PLATFORM_INPUT = 'PLATFORM_INPUT',
3
+ SHOP_INPUT = 'SHOP_INPUT',
4
+ OPERATOR_INPUT = 'OPERATOR_INPUT',
5
+ HANDLER_INPUT = 'HANDLER_INPUT',
6
+ COMPLETED_USER_INPUT='COMPLETED_USER_INPUT',
7
+ INPUT='INPUT',
8
+ RADIO='RADIO',TEXTAREA='TEXTAREA'
9
+ ,CHECKBOX='CHECKBOX'
10
+ ,DATETIME='DATETIME'
11
+ ,SELECT='SELECT'
12
+ ,PICTURE='PICTURE'
13
+ ,BASIC_MULT_SELECT='BASIC_MULT_SELECT'
14
+ ,MULT_SELECT='MULT_SELECT'
15
+ ,BASIC_ADDRESS='BASIC_ADDRESS'
16
+ ,BASIC_GRADE='BASIC_GRADE'
17
+ ,RATE='RATE'
18
+ ,SHOP_NAME_INPUT='SHOP_NAME_INPUT'
19
+ ,TRADE_ID_INPUT='TRADE_ID_INPUT'
20
+ ,BUYER_NICK_INPUT = 'BUYER_NICK_INPUT'
21
+ ,RECEIVER_NAME_INPUT='RECEIVER_NAME_INPUT'
22
+ ,RECEIVER_MOBILE_INPUT='RECEIVER_MOBILE_INPUT'
23
+ ,RECEIVER_ADDRESS_INPUT='RECEIVER_ADDRESS_INPUT'
24
+ ,TRADE_CREATE_DATETIME='TRADE_CREATE_DATETIME'
25
+ ,TRADE_PAYMENT_DATETIME='TRADE_PAYMENT_DATETIME'
26
+ ,TRADE_DELIVERY_DATETIME='TRADE_DELIVERY_DATETIME'
27
+ ,TRADE_CLOSING_DATETIME='TRADE_CLOSING_DATETIME'
28
+ ,EXPRESS_LOGISTICS_SELECT='EXPRESS_LOGISTICS_SELECT'
29
+ ,RETURN_LOGISTICS_SELECT='RETURN_LOGISTICS_SELECT'
30
+ ,ACTUAL_PAYMENT='ACTUAL_PAYMENT'
31
+ ,REMARK_INPUT='REMARK_INPUT'
32
+ ,ITEM_SELECT='ITEM_SELECT'
33
+ ,ITEM_ID='ITEM_ID'
34
+ ,ITEM_ENCODE='ITEM_ENCODE'
35
+ ,ALI_PAY_INPUT='ALI_PAY_INPUT'
36
+ ,ORDINARY_INVOICE='ORDINARY_INVOICE'
37
+ ,ITEM_SELECT_THIRD='ITEM_SELECT_THIRD'
38
+ ,ENTERPRISE_PAYMENT='ENTERPRISE_PAYMENT'
39
+ ,SYSTEM_ORDER_NO='SYSTEM_ORDER_NO'
40
+ ,LOGISTICS_INTERCEPTION='LOGISTICS_INTERCEPTION'
41
+ ,WORK_ORDER_ID_INPUT='WORK_ORDER_ID_INPUT'
42
+ ,FLOW_STATUS_SELECT='FLOW_STATUS_SELECT'
43
+ ,COMPLETED_DATETIME='COMPLETED_DATETIME'
44
+ ,CREATED_DATETIME='CREATED_DATETIME'
45
+ ,UPDATE_DATETIME='UPDATE_DATETIME'
46
+ ,TEMPLATE_ID_INPUT='TEMPLATE_ID_INPUT'
47
+ ,JST_LOGISTICS='JST_LOGISTICS'
48
+ ,JST_ITEM_SELECT_THIRD='JST_ITEM_SELECT_THIRD'
49
+ ,JST_SUPPLY='JST_SUPPLY'
50
+ ,JST_SEND_GOOD='JST_SEND_GOOD'
51
+ }
@@ -1,5 +1,6 @@
1
- export { default as ExpressData } from './expressData';
2
- export { default as AddressData } from './addressData';
3
- export { default as PlatData } from './platData';
4
- export { default as request } from './request';
5
- export * from './utils';
1
+ export { default as ExpressData } from "./expressData";
2
+ export { default as ExpressInterceptData } from "./expressInterceptData";
3
+ export { default as AddressData } from "./addressData";
4
+ export { default as PlatData } from "./platData";
5
+ export { default as request } from "./request";
6
+ export * from "./utils";
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as ExpressData } from "./expressData";
2
+ export { default as ExpressInterceptData } from "./expressInterceptData";
2
3
  export { default as AddressData } from "./addressData";
3
4
  export { default as PlatData } from "./platData";
4
5
  export { default as request } from "./request";
@@ -23,9 +23,7 @@ interface PlatInterface {
23
23
  export default class PlatData {
24
24
  private static instance;
25
25
  platTypeList: PlatInterface[];
26
- platMap: {
27
- [prop in string]: string;
28
- };
26
+ platMap: Record<string, string>;
29
27
  platSelectList: {
30
28
  label: string;
31
29
  value: string;
@@ -36,9 +34,7 @@ export default class PlatData {
36
34
  /**
37
35
  * 获取平台类型和平台名称映射关系
38
36
  */
39
- getPlatMap: () => {
40
- [x: string]: string;
41
- };
37
+ getPlatMap: () => Record<string, string>;
42
38
  /**
43
39
  * 获取平台选择列表
44
40
  * @returns
@@ -1,2 +1,2 @@
1
- declare const _default: (vales: any[], options: any) => any[];
1
+ declare const _default: (values: any[], options: any) => any[];
2
2
  export default _default;
@@ -2,35 +2,21 @@ import isEmpty from 'lodash/isEmpty';
2
2
  import keys from 'lodash/keys';
3
3
  import get from 'lodash/get';
4
4
  import find from 'lodash/find';
5
- export default (function (vales, options) {
6
- if (isEmpty(vales)) return [];
5
+ export default (function (values, options) {
6
+ if (isEmpty(values)) return [];
7
7
  var newKV = [];
8
- vales === null || vales === void 0 ? void 0 : vales.map(function (value, index) {
8
+ values === null || values === void 0 ? void 0 : values.map(function (value, index) {
9
9
  var list = options[index]['list'];
10
10
  var flatt = keys(list).reduce(function (next, cur) {
11
11
  return next.concat(list[cur]);
12
12
  }, []);
13
13
  var label = get(find(flatt, {
14
14
  actived: value
15
- }), 'label');
15
+ }), 'label', '');
16
16
  newKV.push({
17
17
  label: label,
18
18
  actived: value
19
19
  });
20
20
  });
21
21
  return newKV;
22
- });
23
- var findNodeById = function findNodeById(tree) {
24
- var actived = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
25
- for (var i = 0; i < tree.length; i++) {
26
- if (tree[i].actived == actived) {
27
- return tree[i];
28
- }
29
- if (tree[i].children) {
30
- var result = findNodeById(tree[i].children, actived);
31
- if (result) {
32
- return result;
33
- }
34
- }
35
- }
36
- };
22
+ });
@@ -3,4 +3,5 @@ export { default as findLabelBySelectValue } from './findLabelBySelectValue';
3
3
  export { default as transMultSelectOptions } from './transMultSelectOptions';
4
4
  export { default as imgResize } from './imgResize';
5
5
  export { default as isNull } from './isNull';
6
+ export { default as orderBackFormValues } from './orderBackFormValues';
6
7
  export * as filterFn from './filterFn';
@@ -3,5 +3,6 @@ export { default as findLabelBySelectValue } from "./findLabelBySelectValue";
3
3
  export { default as transMultSelectOptions } from "./transMultSelectOptions";
4
4
  export { default as imgResize } from "./imgResize";
5
5
  export { default as isNull } from "./isNull";
6
+ export { default as orderBackFormValues } from "./orderBackFormValues";
6
7
  import * as _filterFn from "./filterFn";
7
8
  export { _filterFn as filterFn };
@@ -1,14 +1,14 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  import every from 'lodash/every';
3
3
  var isNull = function isNull(value) {
4
+ if (Array.isArray(value)) {
5
+ return value.length === 0;
6
+ }
4
7
  if (_typeof(value) === 'object' && value !== null) {
5
8
  return every(Object.values(value), function (v) {
6
9
  return isNull(v);
7
10
  });
8
11
  }
9
- if (Array.isArray(value)) {
10
- return value.length === 0;
11
- }
12
12
  if (typeof value === 'number') {
13
13
  return false;
14
14
  }
@@ -0,0 +1,20 @@
1
+ import TComponentType from "../global.d.ts";
2
+ interface OrderBackFormValuesI {
3
+ type?: "add" | "edit";
4
+ templateDetail: {
5
+ componentDtoList?: Array<{
6
+ uniqueKey: string;
7
+ componentConfig: Partial<{
8
+ showField: string;
9
+ enableItemId: number | string;
10
+ enableSupplierName: string;
11
+ }>;
12
+ workOrderComponentType?: TComponentType;
13
+ }>;
14
+ };
15
+ formValue?: Record<string, unknown>;
16
+ order_no?: string | null;
17
+ detail: Record<string, unknown>;
18
+ }
19
+ declare const _default: ({ detail, order_no, formValue, templateDetail, type, }: OrderBackFormValuesI) => Record<string, any>;
20
+ export default _default;
@@ -0,0 +1,265 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ import moment from "moment";
8
+ import ExpressData from "../expressData";
9
+ import ExpressInterceptData from "../expressInterceptData";
10
+ //重组聚水潭商品数据
11
+ var updateJSTItemListHandle = function updateJSTItemListHandle() {
12
+ var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
13
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "logistics";
14
+ var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
15
+ var showField = config.showField,
16
+ enableItemId = config.enableItemId,
17
+ enableSupplierName = config.enableSupplierName;
18
+ if (type !== "itemList") {
19
+ var newList = list === null || list === void 0 ? void 0 : list.map(function (item) {
20
+ var items = item.items.map(function (t) {
21
+ return {
22
+ title: t.skuName,
23
+ picUrl: t.pic,
24
+ platform: "jst",
25
+ skuId: t.skuId
26
+ };
27
+ });
28
+ var params = {
29
+ items: items
30
+ };
31
+ if (type === "logistics") {
32
+ params.logisticsCompany = ExpressData.getInstance().getExpressCodeByName(item.logisticsCompany, false);
33
+ params.logisticsCode = item.lId;
34
+ } else if (type === "supply") {
35
+ if (["supplyId", "all"].includes(showField || "")) {
36
+ params.supplyId = item.drpCoIdTo;
37
+ }
38
+ if (["supplyName", "all"].includes(showField || "")) {
39
+ params.supplyName = item.drpCoName;
40
+ }
41
+ } else if (type === "send") {
42
+ if (["sendId", "all"].includes(showField || "")) {
43
+ params.sendId = item.wmsCoId;
44
+ }
45
+ if (["sendName", "all"].includes(showField || "")) {
46
+ params.sendName = item.wmsCoName;
47
+ }
48
+ }
49
+ return params;
50
+ });
51
+ if (!newList.length) {
52
+ switch (type) {
53
+ case "logistics":
54
+ newList = [{
55
+ logisticsCompany: null,
56
+ logisticsCode: ""
57
+ }];
58
+ break;
59
+ case "supply":
60
+ newList = [{
61
+ supplyId: ""
62
+ }];
63
+ break;
64
+ case "send":
65
+ newList = [{
66
+ sendId: "",
67
+ sendName: ""
68
+ }];
69
+ break;
70
+ }
71
+ }
72
+ return newList;
73
+ } else {
74
+ return list === null || list === void 0 ? void 0 : list.reduce(function (prv, next) {
75
+ var items = next.items.map(function (t) {
76
+ var params = {
77
+ title: t.skuName,
78
+ picUrl: t.pic,
79
+ platform: "jst"
80
+ };
81
+ if (enableItemId) {
82
+ params.itemId = t.supplierId;
83
+ }
84
+ if (enableSupplierName) {
85
+ params.supplierName = t.supplierName;
86
+ }
87
+ return params;
88
+ });
89
+ prv.push.apply(prv, _toConsumableArray(items));
90
+ return prv;
91
+ }, []);
92
+ }
93
+ };
94
+
95
+ // 淘宝商品组件信息处理
96
+
97
+ var taobaoGoodHandle = function taobaoGoodHandle() {
98
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
99
+ var type = arguments.length > 1 ? arguments[1] : undefined;
100
+ var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
101
+ var changeSku = config.changeSku;
102
+ return arr === null || arr === void 0 ? void 0 : arr.map(function (item) {
103
+ var numIid = item.numIid,
104
+ title = item.title,
105
+ picUrl = item.picUrl,
106
+ price = item.price,
107
+ outerId = item.outerId,
108
+ platform = item.platform,
109
+ skuInfoDTO = item.skuInfoDTO;
110
+ var params = {
111
+ numIid: numIid,
112
+ title: title,
113
+ picUrl: picUrl,
114
+ price: price,
115
+ platform: platform
116
+ };
117
+ if (skuInfoDTO) {
118
+ params.picUrl = skuInfoDTO === null || skuInfoDTO === void 0 ? void 0 : skuInfoDTO.picUrl;
119
+ params.price = skuInfoDTO === null || skuInfoDTO === void 0 ? void 0 : skuInfoDTO.price;
120
+ params.skuId = skuInfoDTO === null || skuInfoDTO === void 0 ? void 0 : skuInfoDTO.skuId;
121
+ }
122
+ if (changeSku) {
123
+ params.propertiesName = (skuInfoDTO === null || skuInfoDTO === void 0 ? void 0 : skuInfoDTO.propertiesName) || "";
124
+ }
125
+ if (type === "ITEM_ENCODE") {
126
+ params.outerId = (skuInfoDTO === null || skuInfoDTO === void 0 ? void 0 : skuInfoDTO.outerSkuId) || outerId;
127
+ } else if (type === "ITEM_SELECT_THIRD") {
128
+ params.itemId = "";
129
+ params.supplierName = "";
130
+ }
131
+ return params;
132
+ });
133
+ };
134
+ //订单返填数据重组
135
+ export default (function (_ref) {
136
+ var _ref$detail = _ref.detail,
137
+ detail = _ref$detail === void 0 ? {} : _ref$detail,
138
+ _ref$order_no = _ref.order_no,
139
+ order_no = _ref$order_no === void 0 ? null : _ref$order_no,
140
+ _ref$formValue = _ref.formValue,
141
+ formValue = _ref$formValue === void 0 ? {} : _ref$formValue,
142
+ _ref$templateDetail = _ref.templateDetail,
143
+ templateDetail = _ref$templateDetail === void 0 ? {} : _ref$templateDetail,
144
+ _ref$type = _ref.type,
145
+ type = _ref$type === void 0 ? "add" : _ref$type;
146
+ return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
147
+ var uniqueKey = next.uniqueKey;
148
+ var config = next.componentConfig;
149
+ switch (next.workOrderComponentType) {
150
+ case "TRADE_ID_INPUT":
151
+ prv[uniqueKey] = order_no || detail["orderNo"];
152
+ break;
153
+ case "BUYER_NICK_INPUT":
154
+ prv[uniqueKey] = {
155
+ buyerNick: detail["buyerNick"],
156
+ buyerOpenUid: detail["buyerOpenUid"]
157
+ };
158
+ break;
159
+ case "RECEIVER_NAME_INPUT":
160
+ prv[uniqueKey] = detail["receiveName"];
161
+ break;
162
+ case "RECEIVER_MOBILE_INPUT":
163
+ prv[uniqueKey] = detail["receiveMobile"];
164
+ break;
165
+ case "RECEIVER_ADDRESS_INPUT":
166
+ prv[uniqueKey] = {
167
+ address: detail["provinceCode"] ? [+detail["provinceCode"], +detail["cityCode"], +detail["townCode"]] : [],
168
+ detail: detail["address"] || ""
169
+ };
170
+ break;
171
+ case "TRADE_CREATE_DATETIME":
172
+ prv[uniqueKey] = detail["orderCreateDateTime"] ? moment(detail["orderCreateDateTime"]).format("YYYY-MM-DD HH:mm:ss") : "";
173
+ break;
174
+ case "TRADE_PAYMENT_DATETIME":
175
+ prv[uniqueKey] = detail["orderPaymentDateTime"] ? moment(detail["orderPaymentDateTime"]).format("YYYY-MM-DD HH:mm:ss") : "";
176
+ break;
177
+ case "TRADE_DELIVERY_DATETIME":
178
+ prv[uniqueKey] = detail["orderDeliveryDateTime"] ? moment(detail["orderDeliveryDateTime"]).format("YYYY-MM-DD HH:mm:ss") : "";
179
+ break;
180
+ case "TRADE_CLOSING_DATETIME":
181
+ prv[uniqueKey] = detail["orderClosingDateTime"] ? moment(detail["orderClosingDateTime"]).format("YYYY-MM-DD HH:mm:ss") : "";
182
+ break;
183
+ case "ACTUAL_PAYMENT":
184
+ prv[uniqueKey] = detail["actualPayment"];
185
+ break;
186
+ case "EXPRESS_LOGISTICS_SELECT":
187
+ prv[uniqueKey] = {
188
+ company: ExpressData.getInstance().getExpressCodeByName(detail["expressLogisticsCompany"]),
189
+ order: detail["expressLogisticsCode"]
190
+ };
191
+ break;
192
+ case "RETURN_LOGISTICS_SELECT":
193
+ prv[uniqueKey] = {
194
+ company: ExpressData.getInstance().getExpressCodeByName(detail["returnLogisticsCompany"]),
195
+ order: detail["returnLogisticsCode"]
196
+ };
197
+ break;
198
+ case "ALI_PAY_INPUT":
199
+ prv[uniqueKey] = {
200
+ name: detail["alipayName"],
201
+ user: detail["alipayAccount"]
202
+ };
203
+ break;
204
+ case "ITEM_SELECT":
205
+ case "ITEM_ID":
206
+ case "ITEM_ENCODE":
207
+ prv[uniqueKey] = taobaoGoodHandle(detail["itemList"], next.workOrderComponentType, next.componentConfig);
208
+ break;
209
+ case "REMARK_INPUT":
210
+ prv[uniqueKey] = {
211
+ remark: detail["remark"] || "",
212
+ flag: detail["flag"] ? Number(detail["flag"]) : detail["flag"]
213
+ };
214
+ break;
215
+ case "ENTERPRISE_PAYMENT":
216
+ //编辑的时候不能修改打款信息
217
+ if (type === "edit") break;
218
+ prv[uniqueKey] = {
219
+ enterprisePaymentTid: detail["orderNo"],
220
+ enterprisePaymentRefundFee: "",
221
+ enterprisePaymentBuyerNick: detail["buyerNick"],
222
+ enterprisePaymentBuyerOpenUid: detail["buyerOpenUid"],
223
+ enterprisePaymentAlipayNick: "",
224
+ enterprisePaymentAlipayNo: ""
225
+ };
226
+ break;
227
+ case "LOGISTICS_INTERCEPTION":
228
+ {
229
+ var _formValue$uniqueKey;
230
+ //物流公司是已对接快递公司时,订单反填不会再起作用
231
+ var interceptCompany = (_formValue$uniqueKey = formValue[uniqueKey]) === null || _formValue$uniqueKey === void 0 ? void 0 : _formValue$uniqueKey.interceptCompany;
232
+ var isInterface = interceptCompany ? ExpressInterceptData.getInstance().isInterfaceCompany(interceptCompany) : false;
233
+ if (type === "edit" && isInterface) break;
234
+ prv[uniqueKey] = {
235
+ interceptCompany: ExpressData.getInstance().getExpressCodeByName(detail["expressLogisticsCompany"]),
236
+ interceptCode: detail["expressLogisticsCode"],
237
+ interceptType: undefined,
238
+ interceptAddress: [],
239
+ interceptDetail: undefined,
240
+ interceptReceiverName: undefined,
241
+ interceptReceiverMobile: undefined,
242
+ interceptStatus: undefined,
243
+ interceptOther: undefined
244
+ };
245
+ break;
246
+ }
247
+ case "JST_ITEM_SELECT_THIRD":
248
+ prv[uniqueKey] = updateJSTItemListHandle(detail["jstItemList"], "itemList", config);
249
+ break;
250
+ case "JST_SUPPLY":
251
+ prv[uniqueKey] = updateJSTItemListHandle(detail["jstItemList"], "supply", config);
252
+ break;
253
+ case "JST_SEND_GOOD":
254
+ prv[uniqueKey] = updateJSTItemListHandle(detail["jstItemList"], "send", config);
255
+ break;
256
+ case "JST_LOGISTICS":
257
+ prv[uniqueKey] = updateJSTItemListHandle(detail["jstItemList"], "logistics", config);
258
+ break;
259
+ case "SYSTEM_ORDER_NO":
260
+ prv[uniqueKey] = detail["sid"];
261
+ break;
262
+ }
263
+ return prv;
264
+ }, {});
265
+ });
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "0.6.3-alpha.4",
3
+ "version": "0.6.3-alpha.44",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
9
  "scripts": {
10
- "build": "father build"
10
+ "build": "yarn run lint && father build",
11
+ "lint": "eslint . --ext .ts",
12
+ "lint:fix": "npx eslint . --ext .ts --fix",
13
+ "jest:init": "jest --init",
14
+ "test": "jest"
11
15
  },
12
16
  "lint-staged": {
13
17
  "*.{js,jsx,less,md,json}": [
@@ -17,18 +21,26 @@
17
21
  "prettier --parser=typescript --write"
18
22
  ]
19
23
  },
20
- "devDependencies": {
21
- "father": "^4.1.7"
22
- },
23
24
  "dependencies": {
24
25
  "lodash": "^4.17.21",
25
26
  "umi-request": "^1.4.0"
26
27
  },
28
+ "devDependencies": {
29
+ "@types/jest": "^29.5.1",
30
+ "@types/node": "^20.1.1",
31
+ "@typescript-eslint/eslint-plugin": "^5.59.2",
32
+ "@typescript-eslint/parser": "^5.59.2",
33
+ "eslint": "^8.40.0",
34
+ "father": "^4.1.7",
35
+ "jest": "^29.5.0",
36
+ "ts-jest": "^29.1.0",
37
+ "ts-node": "^10.9.1"
38
+ },
27
39
  "publishConfig": {
28
40
  "access": "public"
29
41
  },
30
42
  "gitHooks": {
31
43
  "pre-commit": "lint-staged"
32
44
  },
33
- "gitHead": "59ce91a916fe14c9149999f4a4b87c7e1fc696ae"
45
+ "gitHead": "cbdb203dd7951559af410da4c7a1d2339bd45878"
34
46
  }