@kmkf-fe-packages/kmkf-utils 0.6.3-alpha.9 → 0.7.0

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
+ 1111
@@ -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
  });
@@ -5,25 +5,17 @@ interface OptionsItem {
5
5
  expressCode?: string;
6
6
  isInterface?: boolean;
7
7
  interceptionTypeList?: any[];
8
- interceptionStatusList?: any[];
8
+ logisticsStatusList?: any[];
9
9
  }
10
10
  export default class ExpressData {
11
11
  private static instance;
12
12
  expressData: OptionsItem[];
13
- showInterceptionMap: any;
14
- typeNameMap: any;
15
- statusNameMap: any;
16
13
  constructor();
17
14
  initData: () => OptionsItem[] | undefined;
18
15
  getExpressData: () => OptionsItem[] | undefined;
19
- getShowInterceptionBtn(): any;
20
- getTypeNameMap(): any;
21
- getStatusNameMap(): any;
22
16
  setExpressData: (val: OptionsItem[]) => OptionsItem[];
23
- getExpressNameByCode: (code: string | number) => string | number;
24
- getExpressNameByName: (name: string | number) => string | number;
25
- isInterfaceCompany: (company: string) => any;
26
- isShowNewAddress: (company: string, type: string) => any;
17
+ getExpressNameByCode: (code: string | number, returnCurrentValue?: boolean) => string | number;
18
+ getExpressCodeByName: (name: string | number, returnCurrentValue?: boolean) => string | number;
27
19
  static getInstance(): ExpressData;
28
20
  }
29
21
  export {};
@@ -9,124 +9,25 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
9
9
  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); }
10
10
  import request from "../request";
11
11
  var ExpressData = /*#__PURE__*/function () {
12
- //展示拦截按钮映射
13
- //拦截类型映射
14
- //拦截状态映射
15
12
  function ExpressData() {
16
13
  var _this = this;
17
14
  _classCallCheck(this, ExpressData);
18
15
  _defineProperty(this, "expressData", []);
19
- _defineProperty(this, "showInterceptionMap", null);
20
- _defineProperty(this, "typeNameMap", null);
21
- _defineProperty(this, "statusNameMap", null);
22
16
  _defineProperty(this, "initData", function () {
23
17
  if (_this.expressData.length > 0) return _this.expressData;
24
18
  request({
25
- url: "/tianwen/print/queryAllDeliveryCompanyInfo",
26
- method: "post",
19
+ url: "/qy/logistics/company/getAllLogisticsCompany",
20
+ method: "get",
27
21
  data: {}
28
22
  }).then(function (res) {
29
23
  var data = res.data;
30
- var mock = [{
31
- name: "中通",
32
- // 物流名称
33
- cpCode: "ZT",
34
- // 物流CODE
35
- isInterface: true,
36
- // 是否为已对接快递公司
37
- interceptionTypeList: [
38
- // 拦截类型列表
39
- {
40
- label: "退回",
41
- value: "RETURN",
42
- config: {
43
- showAddress: false // 是否展示省市区组件
44
- }
45
- }, {
46
- label: "转寄",
47
- value: "FORWARD",
48
- config: {
49
- showAddress: true
50
- }
51
- }],
52
- interceptionStatusList: [
53
- // 拦截状态列表
54
- ],
55
- needAuth: true // 是否需要授权
56
- }, {
57
- name: "圆通",
58
- cpCode: "YT",
59
- isInterface: false,
60
- interceptionTypeList: [{
61
- label: "退回",
62
- value: "RETURN",
63
- config: {
64
- showAddress: false
65
- }
66
- }, {
67
- label: "转寄",
68
- value: "FORWARD",
69
- config: {
70
- showAddress: true
71
- }
72
- }, {
73
- label: "其他",
74
- value: "OTHER",
75
- config: {
76
- showAddress: true
77
- }
78
- }],
79
- interceptionStatusList: [
80
- // 拦截状态
81
- {
82
- label: "拦截中",
83
- value: "ITNTERCEPTING",
84
- showInterceptionBtn: true
85
- }, {
86
- label: "拦截成功",
87
- value: "ITNTERCEPT_SUCCESS",
88
- showInterceptionBtn: false
89
- }, {
90
- label: "拦截失败",
91
- value: "ITNTERCEPT_FAIL",
92
- showInterceptionBtn: false
93
- }, {
94
- label: "其他",
95
- value: "OTHER",
96
- showInterceptionBtn: false
97
- }],
98
- needAuth: false
99
- }];
100
- var expressList = data.deliveryCompanyInfoList.map(function (item) {
24
+ var expressList = data.logisticsCompanyDtoList.map(function (item) {
101
25
  return _objectSpread(_objectSpread({}, item), {}, {
102
26
  label: item.name,
103
27
  value: item.cpCode
104
28
  });
105
29
  });
106
30
  _this.expressData = expressList;
107
- var showBtn = {},
108
- typeMap = {},
109
- statusMap = {};
110
- expressList.forEach(function (item) {
111
- var _item$interceptionSta, _item$interceptionTyp;
112
- if (item !== null && item !== void 0 && (_item$interceptionSta = item.interceptionStatusList) !== null && _item$interceptionSta !== void 0 && _item$interceptionSta.length) {
113
- item.interceptionStatusList.forEach(function (t) {
114
- statusMap[t.value] = t.label;
115
- });
116
- var t = item === null || item === void 0 ? void 0 : item.interceptionStatusList.find(function (t) {
117
- return t === null || t === void 0 ? void 0 : t.showInterceptionBtn;
118
- });
119
- (item === null || item === void 0 ? void 0 : item.value) && (showBtn[item === null || item === void 0 ? void 0 : item.value] = t.value);
120
- }
121
- if (item !== null && item !== void 0 && (_item$interceptionTyp = item.interceptionTypeList) !== null && _item$interceptionTyp !== void 0 && _item$interceptionTyp.length) {
122
- item.interceptionTypeList.forEach(function (t) {
123
- typeMap[t.value] = t.label;
124
- });
125
- }
126
- });
127
- _this.showInterceptionMap = showBtn;
128
- _this.typeNameMap = typeMap;
129
- _this.statusNameMap = statusMap;
130
31
  });
131
32
  });
132
33
  _defineProperty(this, "getExpressData", function () {
@@ -138,54 +39,22 @@ var ExpressData = /*#__PURE__*/function () {
138
39
  return _this.expressData = val;
139
40
  });
140
41
  _defineProperty(this, "getExpressNameByCode", function (code) {
42
+ var returnCurrentValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
141
43
  var item = (_this.expressData || []).filter(function (item) {
142
44
  return item.value === code;
143
45
  });
144
- return item.length ? item[0].label : code;
46
+ return item.length ? item[0].label : returnCurrentValue ? code : "";
145
47
  });
146
- _defineProperty(this, "getExpressNameByName", function (name) {
48
+ _defineProperty(this, "getExpressCodeByName", function (name) {
49
+ var returnCurrentValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
147
50
  var item = (_this.expressData || []).filter(function (item) {
148
51
  return item.label === name;
149
52
  });
150
- return item.length ? item[0].value : "";
151
- });
152
- _defineProperty(this, "isInterfaceCompany", function (company) {
153
- var item = (_this.expressData || []).find(function (item) {
154
- return item.value === company;
155
- });
156
- return item === null || item === void 0 ? void 0 : item.isInterface;
157
- });
158
- _defineProperty(this, "isShowNewAddress", function (company, type) {
159
- var _find, _find$config;
160
- var item = (_this.expressData || []).find(function (item) {
161
- return item.value === company;
162
- });
163
- return (_find = ((item === null || item === void 0 ? void 0 : item.interceptionTypeList) || []).find(function (t) {
164
- return t.value === type;
165
- })) === null || _find === void 0 ? void 0 : (_find$config = _find.config) === null || _find$config === void 0 ? void 0 : _find$config.showAddress;
53
+ return item.length ? item[0].value : returnCurrentValue ? name : "";
166
54
  });
167
55
  this.initData();
168
56
  }
169
- _createClass(ExpressData, [{
170
- key: "getShowInterceptionBtn",
171
- value:
172
- //获取拦截按钮展示映射
173
- function getShowInterceptionBtn() {
174
- return this.showInterceptionMap;
175
- }
176
- //获取拦截类型映射
177
- }, {
178
- key: "getTypeNameMap",
179
- value: function getTypeNameMap() {
180
- return this.typeNameMap;
181
- }
182
- //获取拦截状态映射
183
- }, {
184
- key: "getStatusNameMap",
185
- value: function getStatusNameMap() {
186
- return this.statusNameMap;
187
- }
188
- }], [{
57
+ _createClass(ExpressData, null, [{
189
58
  key: "getInstance",
190
59
  value: function getInstance() {
191
60
  if (!ExpressData.instance) {
@@ -0,0 +1,46 @@
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
+ showSenderMobileMap: any;
15
+ showNewAddressMap: any;
16
+ typeNameMap: any;
17
+ statusNameMap: any;
18
+ typeOptions: {
19
+ label: string;
20
+ value: string;
21
+ }[];
22
+ statusOptions: {
23
+ label: string;
24
+ value: string;
25
+ }[];
26
+ constructor();
27
+ initData: () => OptionsItem[] | undefined;
28
+ getExpressData: () => OptionsItem[] | undefined;
29
+ getShowInterceptionBtn(): any;
30
+ getTypeNameMap(): any;
31
+ getStatusNameMap(): any;
32
+ getShowNewAddressMap(): any;
33
+ getShowSenderMobileMap(): any;
34
+ getTypeOptions(): {
35
+ label: string;
36
+ value: string;
37
+ }[];
38
+ getStatusOptions(): {
39
+ label: string;
40
+ value: string;
41
+ }[];
42
+ setExpressData: (val: OptionsItem[]) => OptionsItem[];
43
+ isInterfaceCompany: (company: string) => boolean;
44
+ static getInstance(): ExpressInterceptData;
45
+ }
46
+ export {};
@@ -0,0 +1,184 @@
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
+ //物流状态映射
23
+ //拦截类型筛选options
24
+ //物流状态筛选options
25
+ function ExpressInterceptData() {
26
+ var _this = this;
27
+ _classCallCheck(this, ExpressInterceptData);
28
+ _defineProperty(this, "expressData", []);
29
+ _defineProperty(this, "showInterceptionMap", null);
30
+ _defineProperty(this, "showSenderMobileMap", {});
31
+ _defineProperty(this, "showNewAddressMap", {});
32
+ _defineProperty(this, "typeNameMap", null);
33
+ _defineProperty(this, "statusNameMap", null);
34
+ _defineProperty(this, "typeOptions", []);
35
+ _defineProperty(this, "statusOptions", []);
36
+ _defineProperty(this, "initData", function () {
37
+ if (_this.expressData.length > 0) return _this.expressData;
38
+ request({
39
+ url: "/qy/logistics/listLogisticsWithInterceptInfo",
40
+ method: "post",
41
+ data: {
42
+ platformType: 118
43
+ }
44
+ }).then(function (res) {
45
+ var data = res.data;
46
+ var expressList = data.map(function (item) {
47
+ return _objectSpread(_objectSpread({}, item), {}, {
48
+ label: item.name,
49
+ value: item.cpCode
50
+ });
51
+ });
52
+ _this.expressData = expressList;
53
+ var showBtn = {},
54
+ showSender = {},
55
+ showAddress = {},
56
+ typeMap = {},
57
+ statusMap = {},
58
+ typeObj = {},
59
+ statusObj = {};
60
+ expressList.forEach(function (item) {
61
+ var _item$logisticsStatus, _item$interceptionTyp;
62
+ if (item !== null && item !== void 0 && (_item$logisticsStatus = item.logisticsStatusList) !== null && _item$logisticsStatus !== void 0 && _item$logisticsStatus.length) {
63
+ item.logisticsStatusList.forEach(function (t) {
64
+ statusMap["".concat(t.value)] = t.label;
65
+ if (statusObj[t.label]) {
66
+ statusObj[t.label] = statusObj[t.label].add(t.value);
67
+ } else {
68
+ statusObj[t.label] = new Set([t.value]);
69
+ }
70
+ //todo 取消拦截按钮
71
+ if (t !== null && t !== void 0 && t.showInterceptionBtn) {
72
+ showBtn["".concat(t.value)] = true;
73
+ }
74
+ });
75
+ }
76
+ if (item !== null && item !== void 0 && (_item$interceptionTyp = item.interceptionTypeList) !== null && _item$interceptionTyp !== void 0 && _item$interceptionTyp.length) {
77
+ item.interceptionTypeList.forEach(function (t) {
78
+ var _t$config, _t$config2;
79
+ typeMap["".concat(t.value)] = t.label;
80
+ if (typeObj[t.label]) {
81
+ typeObj[t.label] = typeObj[t.label].add(t.value);
82
+ } else {
83
+ typeObj[t.label] = new Set([t.value]);
84
+ }
85
+ if (t !== null && t !== void 0 && (_t$config = t.config) !== null && _t$config !== void 0 && _t$config.showAddress) {
86
+ showAddress["".concat(t.value)] = true;
87
+ }
88
+ if (t !== null && t !== void 0 && (_t$config2 = t.config) !== null && _t$config2 !== void 0 && _t$config2.showSenderMobile) {
89
+ showSender["".concat(t.value)] = true;
90
+ }
91
+ });
92
+ }
93
+ });
94
+ _this.showInterceptionMap = showBtn;
95
+ _this.typeNameMap = typeMap;
96
+ _this.statusNameMap = statusMap;
97
+ _this.showNewAddressMap = showAddress;
98
+ _this.showSenderMobileMap = showSender;
99
+ _this.typeOptions = Object.keys(typeObj).map(function (key) {
100
+ return {
101
+ label: key,
102
+ value: _toConsumableArray(typeObj[key]).join(",")
103
+ };
104
+ });
105
+ _this.statusOptions = Object.keys(statusObj).map(function (key) {
106
+ return {
107
+ label: key,
108
+ value: _toConsumableArray(statusObj[key]).join(",")
109
+ };
110
+ });
111
+ }).catch(function (e) {
112
+ console.log(e);
113
+ });
114
+ });
115
+ _defineProperty(this, "getExpressData", function () {
116
+ var _this$expressData;
117
+ if (((_this$expressData = _this.expressData) === null || _this$expressData === void 0 ? void 0 : _this$expressData.length) > 0) return _this.expressData;
118
+ _this.initData();
119
+ });
120
+ _defineProperty(this, "setExpressData", function (val) {
121
+ return _this.expressData = val;
122
+ });
123
+ _defineProperty(this, "isInterfaceCompany", function (company) {
124
+ var item = (_this.expressData || []).find(function (item) {
125
+ return item.value === company;
126
+ });
127
+ return !!(item !== null && item !== void 0 && item.isInterface);
128
+ });
129
+ this.initData();
130
+ }
131
+ _createClass(ExpressInterceptData, [{
132
+ key: "getShowInterceptionBtn",
133
+ value:
134
+ //获取拦截按钮展示映射
135
+ function getShowInterceptionBtn() {
136
+ return this.showInterceptionMap;
137
+ }
138
+ //获取拦截类型映射
139
+ }, {
140
+ key: "getTypeNameMap",
141
+ value: function getTypeNameMap() {
142
+ return this.typeNameMap;
143
+ }
144
+ //获取物流状态映射
145
+ }, {
146
+ key: "getStatusNameMap",
147
+ value: function getStatusNameMap() {
148
+ return this.statusNameMap;
149
+ }
150
+ //获取派送地址展示映射
151
+ }, {
152
+ key: "getShowNewAddressMap",
153
+ value: function getShowNewAddressMap() {
154
+ return this.showNewAddressMap;
155
+ }
156
+ //获取发件人手机号展示映射
157
+ }, {
158
+ key: "getShowSenderMobileMap",
159
+ value: function getShowSenderMobileMap() {
160
+ return this.showSenderMobileMap;
161
+ }
162
+ }, {
163
+ key: "getTypeOptions",
164
+ value: function getTypeOptions() {
165
+ return this.typeOptions;
166
+ }
167
+ }, {
168
+ key: "getStatusOptions",
169
+ value: function getStatusOptions() {
170
+ return this.statusOptions;
171
+ }
172
+ }], [{
173
+ key: "getInstance",
174
+ value: function getInstance() {
175
+ if (!ExpressInterceptData.instance) {
176
+ ExpressInterceptData.instance = new ExpressInterceptData();
177
+ }
178
+ return ExpressInterceptData.instance;
179
+ }
180
+ }]);
181
+ return ExpressInterceptData;
182
+ }();
183
+ _defineProperty(ExpressInterceptData, "instance", void 0);
184
+ 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,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
  export * as filterFn from './filterFn';
8
+ export * as templateFn from './template';
@@ -3,5 +3,8 @@ 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
- export { _filterFn as filterFn };
8
+ export { _filterFn as filterFn };
9
+ import * as _templateFn from "./template";
10
+ export { _templateFn as templateFn };
@@ -0,0 +1,22 @@
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: boolean;
10
+ enableSupplierName: boolean;
11
+ [key: string]: any;
12
+ }>;
13
+ workOrderComponentType?: TComponentType | string;
14
+ workOrderComponentGroup: string;
15
+ }>;
16
+ };
17
+ formValue?: Record<string, unknown>;
18
+ order_no?: string | null;
19
+ detail: Record<string, unknown>;
20
+ }
21
+ declare const _default: ({ detail, order_no, formValue, templateDetail, type, }: OrderBackFormValuesI) => Record<string, any>;
22
+ export default _default;
@@ -0,0 +1,266 @@
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
+ interceptSenderMobile: undefined,
239
+ interceptAddress: [],
240
+ interceptDetail: undefined,
241
+ interceptReceiverName: undefined,
242
+ interceptReceiverMobile: undefined,
243
+ interceptStatus: undefined,
244
+ interceptOther: undefined
245
+ };
246
+ break;
247
+ }
248
+ case "JST_ITEM_SELECT_THIRD":
249
+ prv[uniqueKey] = updateJSTItemListHandle(detail["jstItemList"], "itemList", config);
250
+ break;
251
+ case "JST_SUPPLY":
252
+ prv[uniqueKey] = updateJSTItemListHandle(detail["jstItemList"], "supply", config);
253
+ break;
254
+ case "JST_SEND_GOOD":
255
+ prv[uniqueKey] = updateJSTItemListHandle(detail["jstItemList"], "send", config);
256
+ break;
257
+ case "JST_LOGISTICS":
258
+ prv[uniqueKey] = updateJSTItemListHandle(detail["jstItemList"], "logistics", config);
259
+ break;
260
+ case "SYSTEM_ORDER_NO":
261
+ prv[uniqueKey] = detail["sid"];
262
+ break;
263
+ }
264
+ return prv;
265
+ }, {});
266
+ });
@@ -0,0 +1,11 @@
1
+ declare type Node = {
2
+ groupId: number;
3
+ groupName: string;
4
+ workOrderTemplates: Array<{
5
+ groupId: number;
6
+ uniqueKey: string;
7
+ name: string;
8
+ }>;
9
+ };
10
+ export declare const getNodeNamesByChildId: (tree: Array<Node>, childId: string) => (string | undefined)[] | null;
11
+ export {};
@@ -0,0 +1,17 @@
1
+ export var getNodeNamesByChildId = function getNodeNamesByChildId(tree, childId) {
2
+ var _tree$map;
3
+ var childList = tree === null || tree === void 0 ? void 0 : (_tree$map = tree.map(function (item) {
4
+ return item.workOrderTemplates;
5
+ })) === null || _tree$map === void 0 ? void 0 : _tree$map.flat();
6
+ var child = childList.find(function (c) {
7
+ return c.uniqueKey === childId;
8
+ });
9
+ if (child) {
10
+ var parentId = child.groupId;
11
+ var parentNode = tree === null || tree === void 0 ? void 0 : tree.find(function (item) {
12
+ return item.groupId === parentId;
13
+ });
14
+ return [parentNode === null || parentNode === void 0 ? void 0 : parentNode.groupName, child.name];
15
+ }
16
+ return null;
17
+ };
@@ -1,6 +1,6 @@
1
- import get from 'lodash/get';
1
+ import get from "lodash/get";
2
2
  var findNodeById = function findNodeById(tree) {
3
- var actived = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3
+ var actived = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
4
4
  for (var i = 0; i < tree.length; i++) {
5
5
  if (tree[i].actived == actived) {
6
6
  return tree[i];
@@ -18,7 +18,7 @@ export default (function (sourceOptions) {
18
18
  var newOptions = JSON.parse(JSON.stringify(sourceOptions));
19
19
  newOptions.map(function (item) {
20
20
  if (tree.length === 0) {
21
- return tree = tree.concat(get(item, 'list.1', []));
21
+ return tree = tree.concat(get(item, "list.1", []));
22
22
  }
23
23
  Object.keys(item.list).map(function (l) {
24
24
  // 在树中找到l对应的节点,将当前数组放到children里面
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "0.6.3-alpha.9",
3
+ "version": "0.7.0",
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}": [
@@ -22,7 +26,15 @@
22
26
  "umi-request": "^1.4.0"
23
27
  },
24
28
  "devDependencies": {
25
- "father": "^4.1.7"
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"
26
38
  },
27
39
  "publishConfig": {
28
40
  "access": "public"
@@ -30,5 +42,5 @@
30
42
  "gitHooks": {
31
43
  "pre-commit": "lint-staged"
32
44
  },
33
- "gitHead": "f34f6e6a6c25cbdb64cafbd9d563f68be9734c5e"
45
+ "gitHead": "214345484eba96df7edb7f29f9205f2389f1debc"
34
46
  }