@kmkf-fe-packages/kmkf-utils 0.23.1-alpha.0 → 0.23.1-beta.3
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 +1 -1
- package/dist/esm/bsAddressData/index.js +36 -5
- package/dist/esm/global.d.ts +2 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/utils/bsOrderBackFormValues.js +15 -0
- package/dist/esm/utils/orderBackFormValues.js +11 -0
- package/dist/esm/utils/unTransField.js +1 -1
- package/dist/esm/wdtAddressData/index.d.ts +34 -0
- package/dist/esm/wdtAddressData/index.js +89 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
11223344
|
|
@@ -5,8 +5,10 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
5
5
|
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; }
|
|
6
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
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
|
+
import Monitor from "kmkf-monitor";
|
|
8
9
|
import request from "../request";
|
|
9
10
|
import { toTree } from "../utils";
|
|
11
|
+
import moment from "moment";
|
|
10
12
|
var BsAddressData = /*#__PURE__*/function () {
|
|
11
13
|
function BsAddressData() {
|
|
12
14
|
var _this = this;
|
|
@@ -15,8 +17,31 @@ var BsAddressData = /*#__PURE__*/function () {
|
|
|
15
17
|
_defineProperty(this, "addrNameMap", {});
|
|
16
18
|
_defineProperty(this, "addressOptions", []);
|
|
17
19
|
_defineProperty(this, "initData", function () {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
// if (Object.keys(this.addrData)?.length > 0) return;
|
|
21
|
+
try {
|
|
22
|
+
var list = JSON.parse(localStorage.getItem("bsAddressData") || "[]");
|
|
23
|
+
var dataTime = localStorage.getItem("bsAddressDataEndTime") ? Number(localStorage.getItem("bsAddressDataEndTime")) : 0;
|
|
24
|
+
var isTimeout = dataTime ? (new Date().getTime() - dataTime) / 3600 / 24 > 5 : true;
|
|
25
|
+
if (list.length && !isTimeout) {
|
|
26
|
+
var map = {};
|
|
27
|
+
var res = {};
|
|
28
|
+
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"];
|
|
31
|
+
}
|
|
32
|
+
_this.addrData = res;
|
|
33
|
+
_this.addrNameMap = map;
|
|
34
|
+
_this.addressOptions = toTree(list, 1);
|
|
35
|
+
window.bsAddress = _this;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
} catch (e) {
|
|
39
|
+
var _Object$keys;
|
|
40
|
+
if (((_Object$keys = Object.keys(_this.addrData)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) return;
|
|
41
|
+
}
|
|
42
|
+
Monitor.automaticReport({
|
|
43
|
+
message: "bs\u5730\u5740-\u5F00\u59CB\u8BF7\u6C42\uFF1A".concat(moment().format("YYYY-MM-DD hh:mm:ss"))
|
|
44
|
+
});
|
|
20
45
|
request({
|
|
21
46
|
url: "/qy/gdfw/template/queryBsAreas",
|
|
22
47
|
method: "get",
|
|
@@ -26,13 +51,19 @@ var BsAddressData = /*#__PURE__*/function () {
|
|
|
26
51
|
var res = {};
|
|
27
52
|
var _resp$data = resp.data,
|
|
28
53
|
list = _resp$data === void 0 ? [] : _resp$data;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
54
|
+
localStorage.setItem("bsAddressData", JSON.stringify(list));
|
|
55
|
+
localStorage.setItem("bsAddressDataEndTime", JSON.stringify(new Date().getTime()));
|
|
56
|
+
for (var _i = 0; _i < list.length; _i++) {
|
|
57
|
+
res[list[_i]["id"]] = [list[_i]["name"], list[_i]["parentId"]];
|
|
58
|
+
map[list[_i]["name"]] = list[_i]["id"];
|
|
32
59
|
}
|
|
33
60
|
_this.addrData = res;
|
|
34
61
|
_this.addrNameMap = map;
|
|
35
62
|
_this.addressOptions = toTree(list, 1);
|
|
63
|
+
window.bsAddress = _this;
|
|
64
|
+
Monitor.automaticReport({
|
|
65
|
+
message: "bs\u5730\u5740-\u83B7\u53D6\u6570\u636E\uFF1A".concat(moment().format("YYYY-MM-DD hh:mm:ss"))
|
|
66
|
+
});
|
|
36
67
|
});
|
|
37
68
|
});
|
|
38
69
|
_defineProperty(this, "parseData", function (addrCode) {
|
package/dist/esm/global.d.ts
CHANGED
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as ExpressData } from "./expressData";
|
|
|
2
2
|
export { default as ExpressInterceptData } from "./expressInterceptData";
|
|
3
3
|
export { default as AddressData } from "./addressData";
|
|
4
4
|
export { default as BsAddressData } from "./bsAddressData";
|
|
5
|
+
export { default as WdtAddressData } from "./wdtAddressData";
|
|
5
6
|
export { default as PlatData } from "./platData";
|
|
6
7
|
export { default as LogisticsAddressData } from "./logisticsAddressData";
|
|
7
8
|
export { default as request } from "./request";
|
package/dist/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as ExpressData } from "./expressData";
|
|
|
2
2
|
export { default as ExpressInterceptData } from "./expressInterceptData";
|
|
3
3
|
export { default as AddressData } from "./addressData";
|
|
4
4
|
export { default as BsAddressData } from "./bsAddressData";
|
|
5
|
+
export { default as WdtAddressData } from "./wdtAddressData";
|
|
5
6
|
export { default as PlatData } from "./platData";
|
|
6
7
|
export { default as LogisticsAddressData } from "./logisticsAddressData";
|
|
7
8
|
export { default as request } from "./request";
|
|
@@ -193,6 +193,21 @@ export var bsOrderBackFormValues = function bsOrderBackFormValues() {
|
|
|
193
193
|
case "BS_POSTING":
|
|
194
194
|
prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsPosting;
|
|
195
195
|
break;
|
|
196
|
+
case "LOGISTICS_TRAJECTORY_MORE":
|
|
197
|
+
if (config.isOpen) {
|
|
198
|
+
if (config.logisticsMapping.companyType === "BS_LOGISTICS") {
|
|
199
|
+
prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.bsLogistics.reduce(function (p, n) {
|
|
200
|
+
p.push({
|
|
201
|
+
trajectoryCompany: n.logisticsCompany,
|
|
202
|
+
trajectoryCode: n.logisticsCode,
|
|
203
|
+
trajectoryPhone: "",
|
|
204
|
+
trajectorySnapshot: ""
|
|
205
|
+
});
|
|
206
|
+
return p;
|
|
207
|
+
}, []);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
196
211
|
}
|
|
197
212
|
return prv;
|
|
198
213
|
}, {});
|
|
@@ -72,6 +72,7 @@ export default (function (_ref) {
|
|
|
72
72
|
fromQNCreateWorkOrderByOrderNo = _ref$fromQNCreateWork === void 0 ? false : _ref$fromQNCreateWork;
|
|
73
73
|
var orderValues = ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
|
|
74
74
|
var uniqueKey = next.uniqueKey;
|
|
75
|
+
var config = next.componentConfig;
|
|
75
76
|
var city = null,
|
|
76
77
|
town = null;
|
|
77
78
|
switch (next.workOrderComponentType) {
|
|
@@ -182,6 +183,16 @@ export default (function (_ref) {
|
|
|
182
183
|
case "SYSTEM_ORDER_NO":
|
|
183
184
|
prv[uniqueKey] = detail["sid"];
|
|
184
185
|
break;
|
|
186
|
+
case "LOGISTICS_TRAJECTORY_MORE":
|
|
187
|
+
if (config.isOpen) {
|
|
188
|
+
if (config.logisticsMapping.companyType === "EXPRESS_LOGISTICS_SELECT") {
|
|
189
|
+
prv[uniqueKey] = [{
|
|
190
|
+
trajectoryCompany: ExpressData.getInstance().getExpressCodeByName(detail["expressLogisticsCompany"]),
|
|
191
|
+
trajectoryCode: detail["expressLogisticsCode"]
|
|
192
|
+
}];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
185
196
|
}
|
|
186
197
|
return prv;
|
|
187
198
|
}, {});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default (function (key) {
|
|
2
|
-
return [
|
|
2
|
+
return ["itemList", "itemId", "supplierName", "numIid", "aloneItemId", "aloneItemEncode", "jstItemList", "logisticsCompany", "logisticsCode", "supplyId", "supplyName", "sendId", "sendName", "dateTime", "basicMultSelect", "checkbox", "multSelect", "rate", "picture", "file", "bsSendGood", "bsSendId", "bsSendName", "bsGoods", "bsExchangeType", "bsExchangeReturnGoods", "bsExchangeSwapOutGoods", "bsExchangeGiftGoods", "bsReissueType", "bsReissueGoods", "bsReturnGoods", "bsReturnType", "bsLogisticsList", "bsLogisticsCompany", "bsLogisticsCode", "bsSystemShowOrder", "bsSystemSelectIds", "reissueLogisticsList", "reissueLogisticsCompany", "reissueLogisticsCode", "deliveryNoList", "deliveryNoIds", "returnGoodsStatusList", "returnGoodsTradeIdList", "returnGoodsTradeItemList", "tradeIdList", "tradeItemList", "wlnLogisticsList", "wlnLogisticsCompany", "wlnLogisticsCode", "wlnSystemShowOrder", "wlnSystemSelectIds", "wlnGoods", "wlnSendGood", "wlnSendId", "wlnSendName", "exchangeReason", "flowTag", "returnGoodsStatusList", "returnGoodsStatusValue", "exchangeReason", "exchangeStatusValue", "inStockStatusItemList", "inStockStatusList", "reissueStatusValue", "reissueReason", "adjustWorkOrderStatusValue", "adjustWorkOrderReason", "msgStatusValues", "msgStatus4Search", "createStatusValue", "createReason", "invoiceStatusValue", "invoiceReason", "invoicingStatusValue", "invoicingReason", "trajectoryList", "trajectoryMoreCompany", "trajectoryMoreCode", "trajectoryMoreSnapshot"].reduce(function (cur, nxt) {
|
|
3
3
|
return cur || (key === null || key === void 0 ? void 0 : key.includes(nxt));
|
|
4
4
|
}, false);
|
|
5
5
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface TreeOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
children?: TreeOption[];
|
|
5
|
+
}
|
|
6
|
+
export default class WdtAddressData {
|
|
7
|
+
private static instance;
|
|
8
|
+
addrData: Record<string, [string, string | number]>;
|
|
9
|
+
addrNameMap: Record<string, string>;
|
|
10
|
+
addressOptions: TreeOption[];
|
|
11
|
+
constructor();
|
|
12
|
+
initData: () => void;
|
|
13
|
+
parseData: (addrCode: string | number) => {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
getProvinceByCode: (countryIndex: string | number) => {
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}[];
|
|
21
|
+
getCityByProCode: (countryIndex: string | number) => {
|
|
22
|
+
label: string;
|
|
23
|
+
value: string;
|
|
24
|
+
}[];
|
|
25
|
+
getAreaByCityCode: (countryIndex: string | number) => {
|
|
26
|
+
label: string;
|
|
27
|
+
value: string;
|
|
28
|
+
}[];
|
|
29
|
+
getProCodeByName: (proName: string) => number | undefined;
|
|
30
|
+
getNameByCode: (code: string | number) => string;
|
|
31
|
+
static getInstance(): WdtAddressData;
|
|
32
|
+
}
|
|
33
|
+
export declare type WdtAddressDataClass = WdtAddressData;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
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
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
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
|
+
import request from "../request";
|
|
9
|
+
import { toTree } from "../utils";
|
|
10
|
+
var WdtAddressData = /*#__PURE__*/function () {
|
|
11
|
+
function WdtAddressData() {
|
|
12
|
+
var _this = this;
|
|
13
|
+
_classCallCheck(this, WdtAddressData);
|
|
14
|
+
_defineProperty(this, "addrData", {});
|
|
15
|
+
_defineProperty(this, "addrNameMap", {});
|
|
16
|
+
_defineProperty(this, "addressOptions", []);
|
|
17
|
+
_defineProperty(this, "initData", function () {
|
|
18
|
+
var _Object$keys;
|
|
19
|
+
if (((_Object$keys = Object.keys(_this.addrData)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) return;
|
|
20
|
+
request({
|
|
21
|
+
url: "/qy/gdfw/template/queryWdtAreas",
|
|
22
|
+
method: "get",
|
|
23
|
+
data: {}
|
|
24
|
+
}).then(function (resp) {
|
|
25
|
+
var map = {};
|
|
26
|
+
var res = {};
|
|
27
|
+
var _resp$data = resp.data,
|
|
28
|
+
list = _resp$data === void 0 ? [] : _resp$data;
|
|
29
|
+
for (var i = 0; i < list.length; i++) {
|
|
30
|
+
res[list[i]["id"]] = [list[i]["name"], list[i]["parentId"]];
|
|
31
|
+
map[list[i]["name"]] = list[i]["id"];
|
|
32
|
+
}
|
|
33
|
+
_this.addrData = res;
|
|
34
|
+
_this.addrNameMap = map;
|
|
35
|
+
_this.addressOptions = toTree(list, 1);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
_defineProperty(this, "parseData", function (addrCode) {
|
|
39
|
+
var nameCode = {},
|
|
40
|
+
arr = [];
|
|
41
|
+
for (var key in _this.addrData) {
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(_this.addrData, key)) {
|
|
43
|
+
var valueArray = _this.addrData[key];
|
|
44
|
+
if (valueArray[1] === Number(addrCode)) {
|
|
45
|
+
nameCode[valueArray[0]] = key;
|
|
46
|
+
arr.push({
|
|
47
|
+
label: valueArray[0],
|
|
48
|
+
value: key
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return arr;
|
|
54
|
+
});
|
|
55
|
+
_defineProperty(this, "getProvinceByCode", function (countryIndex) {
|
|
56
|
+
return _this.parseData(countryIndex);
|
|
57
|
+
});
|
|
58
|
+
_defineProperty(this, "getCityByProCode", function (countryIndex) {
|
|
59
|
+
return _this.parseData(countryIndex);
|
|
60
|
+
});
|
|
61
|
+
_defineProperty(this, "getAreaByCityCode", function (countryIndex) {
|
|
62
|
+
return _this.parseData(countryIndex);
|
|
63
|
+
});
|
|
64
|
+
_defineProperty(this, "getProCodeByName", function (proName) {
|
|
65
|
+
for (var key in _this.addrData) {
|
|
66
|
+
if (_this.addrData[key][0] === proName) {
|
|
67
|
+
return Number(key);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
_defineProperty(this, "getNameByCode", function (code) {
|
|
72
|
+
var _ref;
|
|
73
|
+
return (_ref = (_this.addrData || {})[code] || []) === null || _ref === void 0 ? void 0 : _ref[0];
|
|
74
|
+
});
|
|
75
|
+
this.initData();
|
|
76
|
+
}
|
|
77
|
+
_createClass(WdtAddressData, null, [{
|
|
78
|
+
key: "getInstance",
|
|
79
|
+
value: function getInstance() {
|
|
80
|
+
if (!WdtAddressData.instance) {
|
|
81
|
+
WdtAddressData.instance = new WdtAddressData();
|
|
82
|
+
}
|
|
83
|
+
return WdtAddressData.instance;
|
|
84
|
+
}
|
|
85
|
+
}]);
|
|
86
|
+
return WdtAddressData;
|
|
87
|
+
}();
|
|
88
|
+
_defineProperty(WdtAddressData, "instance", void 0);
|
|
89
|
+
export { WdtAddressData as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/kmkf-utils",
|
|
3
|
-
"version": "0.23.1-
|
|
3
|
+
"version": "0.23.1-beta.3",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "yarn run lint && father build",
|
|
11
|
+
"jest:init": "jest --init",
|
|
11
12
|
"lint": "eslint . --ext .ts",
|
|
12
13
|
"lint:fix": "npx eslint . --ext .ts --fix",
|
|
13
|
-
"jest:init": "jest --init",
|
|
14
14
|
"test": "jest"
|
|
15
15
|
},
|
|
16
16
|
"lint-staged": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"kmkf-monitor": "^0.8.8",
|
|
25
26
|
"lodash": "^4.17.21",
|
|
26
27
|
"umi-request": "^1.4.0"
|
|
27
28
|
},
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
"publishConfig": {
|
|
40
41
|
"access": "public"
|
|
41
42
|
},
|
|
43
|
+
"gitHead": "0402084934b9b8e089b5d0f6b0679059653bf189",
|
|
42
44
|
"gitHooks": {
|
|
43
45
|
"pre-commit": "lint-staged"
|
|
44
|
-
}
|
|
45
|
-
"gitHead": "39fd1618947535a2a9186aa7f29dcd366ae0694a"
|
|
46
|
+
}
|
|
46
47
|
}
|