@kmkf-fe-packages/services-components 2.0.2-beta.1 → 2.0.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/commonComponents/GlobalContext/hook/dist/useGetHasErpData.js +52 -0
- package/dist/esm/commonComponents/GlobalContext/index.d.ts +1 -1
- package/dist/esm/commonComponents/GlobalContext/index.js +11 -6
- package/dist/esm/commonComponents/GlobalContext/orderQuery/dist/useGetErpAddressData.js +180 -0
- package/dist/esm/commonComponents/GlobalContext/orderQuery/dist/useGetErpLogisticsCompany.js +186 -0
- package/dist/esm/commonComponents/GlobalContext/orderQuery/useGetErpAddressData.js +18 -23
- package/dist/esm/commonComponents/GlobalContext/orderQuery/useGetErpLogisticsCompany.js +18 -21
- package/dist/esm/commonComponents/GlobalContext/orderQuery/useGetErpSendData.js +21 -21
- package/package.json +4 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var react_redux_1 = require("react-redux");
|
|
6
|
+
var toolkit_1 = require("@reduxjs/toolkit");
|
|
7
|
+
var getTemplate = function getTemplate(companyUserConfig) {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
9
|
+
return JSON.stringify({
|
|
10
|
+
hasWln: (_c = (_b = (_a = companyUserConfig === null || companyUserConfig === void 0 ? void 0 : companyUserConfig.plugins) === null || _a === void 0 ? void 0 : _a.wln) === null || _b === void 0 ? void 0 : _b.show) !== null && _c !== void 0 ? _c : false,
|
|
11
|
+
hasWdt: (_f = (_e = (_d = companyUserConfig === null || companyUserConfig === void 0 ? void 0 : companyUserConfig.plugins) === null || _d === void 0 ? void 0 : _d.wdt) === null || _e === void 0 ? void 0 : _e.show) !== null && _f !== void 0 ? _f : false,
|
|
12
|
+
hasBs: (_j = (_h = (_g = companyUserConfig === null || companyUserConfig === void 0 ? void 0 : companyUserConfig.plugins) === null || _g === void 0 ? void 0 : _g.bs) === null || _h === void 0 ? void 0 : _h.show) !== null && _j !== void 0 ? _j : false,
|
|
13
|
+
hasE3: (_m = (_l = (_k = companyUserConfig === null || companyUserConfig === void 0 ? void 0 : companyUserConfig.plugins) === null || _k === void 0 ? void 0 : _k.bse3) === null || _l === void 0 ? void 0 : _l.show) !== null && _m !== void 0 ? _m : false,
|
|
14
|
+
hasJst: (_q = (_p = (_o = companyUserConfig === null || companyUserConfig === void 0 ? void 0 : companyUserConfig.plugins) === null || _o === void 0 ? void 0 : _o.jst) === null || _p === void 0 ? void 0 : _p.show) !== null && _q !== void 0 ? _q : false,
|
|
15
|
+
hasGy: (_t = (_s = (_r = companyUserConfig === null || companyUserConfig === void 0 ? void 0 : companyUserConfig.plugins) === null || _r === void 0 ? void 0 : _r.gy) === null || _s === void 0 ? void 0 : _s.show) !== null && _t !== void 0 ? _t : false
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
function useGetHasErpData() {
|
|
19
|
+
var companyUserConfig = react_redux_1.useSelector(toolkit_1.createSelector([function (state) {
|
|
20
|
+
var _a, _b, _c, _d;
|
|
21
|
+
console.log("state--useSelector", state);
|
|
22
|
+
/**
|
|
23
|
+
* pc main
|
|
24
|
+
* 端 workOrder
|
|
25
|
+
* **/
|
|
26
|
+
return (_d = (_b = (_a = state === null || state === void 0 ? void 0 : state.main) === null || _a === void 0 ? void 0 : _a.userInfo) !== null && _b !== void 0 ? _b : (_c = state === null || state === void 0 ? void 0 : state.workOrder) === null || _c === void 0 ? void 0 : _c.userInfo) !== null && _d !== void 0 ? _d : {};
|
|
27
|
+
}], function (state) {
|
|
28
|
+
var _a;
|
|
29
|
+
var companyUserConfig = (_a = state === null || state === void 0 ? void 0 : state.companyUserConfig) !== null && _a !== void 0 ? _a : {};
|
|
30
|
+
if (typeof companyUserConfig === "string") {
|
|
31
|
+
try {
|
|
32
|
+
companyUserConfig = JSON.parse(companyUserConfig);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.error("companyUserConfig转换异常", companyUserConfig);
|
|
35
|
+
companyUserConfig = {};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return companyUserConfig;
|
|
39
|
+
}));
|
|
40
|
+
var _a = react_1.useState(getTemplate({})),
|
|
41
|
+
hasErpDataJson = _a[0],
|
|
42
|
+
setHasErpDataJson = _a[1];
|
|
43
|
+
react_1.useEffect(function () {
|
|
44
|
+
setHasErpDataJson(getTemplate(companyUserConfig));
|
|
45
|
+
console.log("companyUserConfig---", companyUserConfig);
|
|
46
|
+
}, [companyUserConfig]);
|
|
47
|
+
var hasErpData = react_1.useMemo(function () {
|
|
48
|
+
return JSON.parse(hasErpDataJson);
|
|
49
|
+
}, [hasErpDataJson]);
|
|
50
|
+
return hasErpData;
|
|
51
|
+
}
|
|
52
|
+
exports["default"] = useGetHasErpData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare type RequestType = "queryAddressData" | "queryExpressInterceptData" | "queryLogisticsAddressData" | "queryPlatData" | "queryAllLogisticsCompany" | "queryLabel";
|
|
2
|
+
declare type RequestType = "queryAddressData" | "queryExpressInterceptData" | "queryLogisticsAddressData" | "queryPlatData" | "queryAllLogisticsCompany" | "queryLabel" | "queryKMLogisticsCompany" | "queryKMSendData";
|
|
3
3
|
declare const Global: ({ children, requestList, repeatRequestList, notJudgedErp, }: React.PropsWithChildren<{
|
|
4
4
|
requestList?: RequestType[] | undefined;
|
|
5
5
|
repeatRequestList?: Record<string, () => Promise<any>> | undefined;
|
|
@@ -15,8 +15,8 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
16
|
import React, { useEffect, useState, useMemo } from "react";
|
|
17
17
|
import { Skeleton, Button, Alert, Space, message } from "antd";
|
|
18
|
-
import { queryExpressInterceptData, queryLogisticsAddressData, queryPlatData, queryLabel, queryAllLogisticsCompany } from "../../service/api";
|
|
19
|
-
import { servers } from "@kmkf-fe-packages/kmkf-utils";
|
|
18
|
+
import { queryExpressInterceptData, queryLogisticsAddressData, queryPlatData, queryLabel, queryAllLogisticsCompany, queryKMLogisticsCompany } from "../../service/api";
|
|
19
|
+
import { servers, SendDataCenter } from "@kmkf-fe-packages/kmkf-utils";
|
|
20
20
|
import useGetErpLogisticsCompany from "./orderQuery/useGetErpLogisticsCompany";
|
|
21
21
|
import useGetErpSendData from "./orderQuery/useGetErpSendData";
|
|
22
22
|
import useGetErpAddressData from "./orderQuery/useGetErpAddressData";
|
|
@@ -36,7 +36,13 @@ var Global = function Global(_ref) {
|
|
|
36
36
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
37
|
loading = _useState4[0],
|
|
38
38
|
setLoading = _useState4[1];
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
initDataSource();
|
|
41
|
+
}, []);
|
|
39
42
|
|
|
43
|
+
/**
|
|
44
|
+
* 需要hasErpData判断
|
|
45
|
+
* **/
|
|
40
46
|
//获取Erp物流公司信息
|
|
41
47
|
var _useGetErpLogisticsCo = useGetErpLogisticsCompany(notJudgedErp),
|
|
42
48
|
_useGetErpLogisticsCo2 = _slicedToArray(_useGetErpLogisticsCo, 2),
|
|
@@ -120,7 +126,9 @@ var Global = function Global(_ref) {
|
|
|
120
126
|
queryLogisticsAddressData: queryLogisticsAddressData,
|
|
121
127
|
queryPlatData: queryPlatData,
|
|
122
128
|
queryAllLogisticsCompany: queryAllLogisticsCompany,
|
|
123
|
-
queryLabel: queryLabel
|
|
129
|
+
queryLabel: queryLabel,
|
|
130
|
+
queryKMLogisticsCompany: queryKMLogisticsCompany,
|
|
131
|
+
queryKMSendData: SendDataCenter.getInstance("km").fetchData
|
|
124
132
|
};
|
|
125
133
|
mergeMapping = _objectSpread(_objectSpread({}, mapping), repeatRequestList);
|
|
126
134
|
promises = [];
|
|
@@ -158,9 +166,6 @@ var Global = function Global(_ref) {
|
|
|
158
166
|
return _ref3.apply(this, arguments);
|
|
159
167
|
};
|
|
160
168
|
}();
|
|
161
|
-
useEffect(function () {
|
|
162
|
-
initDataSource();
|
|
163
|
-
}, []);
|
|
164
169
|
if (allState === "loading") {
|
|
165
170
|
return /*#__PURE__*/React.createElement(Skeleton, {
|
|
166
171
|
active: true,
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) {
|
|
5
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
+
resolve(value);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.next(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function step(result) {
|
|
25
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
+
}
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
+
var _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function sent() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
},
|
|
40
|
+
f,
|
|
41
|
+
y,
|
|
42
|
+
t,
|
|
43
|
+
g;
|
|
44
|
+
return g = {
|
|
45
|
+
next: verb(0),
|
|
46
|
+
"throw": verb(1),
|
|
47
|
+
"return": verb(2)
|
|
48
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
+
return this;
|
|
50
|
+
}), g;
|
|
51
|
+
function verb(n) {
|
|
52
|
+
return function (v) {
|
|
53
|
+
return step([n, v]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function step(op) {
|
|
57
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
+
while (_) try {
|
|
59
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
+
switch (op[0]) {
|
|
62
|
+
case 0:
|
|
63
|
+
case 1:
|
|
64
|
+
t = op;
|
|
65
|
+
break;
|
|
66
|
+
case 4:
|
|
67
|
+
_.label++;
|
|
68
|
+
return {
|
|
69
|
+
value: op[1],
|
|
70
|
+
done: false
|
|
71
|
+
};
|
|
72
|
+
case 5:
|
|
73
|
+
_.label++;
|
|
74
|
+
y = op[1];
|
|
75
|
+
op = [0];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
op = _.ops.pop();
|
|
79
|
+
_.trys.pop();
|
|
80
|
+
continue;
|
|
81
|
+
default:
|
|
82
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
+
_ = 0;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
+
_.label = op[1];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
+
_.label = t[1];
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (t && _.label < t[2]) {
|
|
96
|
+
_.label = t[2];
|
|
97
|
+
_.ops.push(op);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t[2]) _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
op = [6, e];
|
|
107
|
+
y = 0;
|
|
108
|
+
} finally {
|
|
109
|
+
f = t = 0;
|
|
110
|
+
}
|
|
111
|
+
if (op[0] & 5) throw op[1];
|
|
112
|
+
return {
|
|
113
|
+
value: op[0] ? op[1] : void 0,
|
|
114
|
+
done: true
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports.__esModule = true;
|
|
119
|
+
var react_1 = require("react");
|
|
120
|
+
var useGetHasErpData_1 = require("../hook/useGetHasErpData");
|
|
121
|
+
var ahooks_1 = require("ahooks");
|
|
122
|
+
var kmkf_utils_1 = require("@kmkf-fe-packages/kmkf-utils");
|
|
123
|
+
function useGetErpAddressData(notJudgedErp) {
|
|
124
|
+
var _this = this;
|
|
125
|
+
var _a = react_1.useState("loading"),
|
|
126
|
+
globalState = _a[0],
|
|
127
|
+
setGlobalState = _a[1];
|
|
128
|
+
var hasErpData = useGetHasErpData_1["default"]();
|
|
129
|
+
ahooks_1.useUpdateEffect(function () {
|
|
130
|
+
asyncQueryData(hasErpData, notJudgedErp);
|
|
131
|
+
}, [hasErpData, notJudgedErp]);
|
|
132
|
+
var asyncQueryData = function asyncQueryData(hasErpData, notJudgedErp) {
|
|
133
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
134
|
+
var hasBs, hasWdt, hasGy, promises, e_1;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0:
|
|
138
|
+
hasBs = hasErpData.hasBs, hasWdt = hasErpData.hasWdt, hasGy = hasErpData.hasGy;
|
|
139
|
+
promises = [];
|
|
140
|
+
if (hasBs || notJudgedErp) promises.push(kmkf_utils_1.servers.queryBsAddressData);
|
|
141
|
+
if (hasWdt || notJudgedErp) promises.push(kmkf_utils_1.servers.queryWdtAddressData);
|
|
142
|
+
if (hasGy || notJudgedErp) promises.push(kmkf_utils_1.servers.queryGyAddressData);
|
|
143
|
+
_a.label = 1;
|
|
144
|
+
case 1:
|
|
145
|
+
_a.trys.push([1, 3,, 4]);
|
|
146
|
+
return [4 /*yield*/, Promise.all(promises.map(function (promise) {
|
|
147
|
+
return promise();
|
|
148
|
+
}))];
|
|
149
|
+
case 2:
|
|
150
|
+
_a.sent();
|
|
151
|
+
setGlobalState("success");
|
|
152
|
+
return [3 /*break*/, 4];
|
|
153
|
+
case 3:
|
|
154
|
+
e_1 = _a.sent();
|
|
155
|
+
setGlobalState("failed");
|
|
156
|
+
return [3 /*break*/, 4];
|
|
157
|
+
case 4:
|
|
158
|
+
return [2 /*return*/];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var onReload = function onReload() {
|
|
165
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
+
return __generator(this, function (_a) {
|
|
167
|
+
switch (_a.label) {
|
|
168
|
+
case 0:
|
|
169
|
+
return [4 /*yield*/, asyncQueryData(hasErpData, notJudgedErp)];
|
|
170
|
+
case 1:
|
|
171
|
+
_a.sent();
|
|
172
|
+
return [2 /*return*/];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return [globalState, onReload];
|
|
179
|
+
}
|
|
180
|
+
exports["default"] = useGetErpAddressData;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) {
|
|
5
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
+
resolve(value);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.next(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function step(result) {
|
|
25
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
+
}
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
+
var _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function sent() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
},
|
|
40
|
+
f,
|
|
41
|
+
y,
|
|
42
|
+
t,
|
|
43
|
+
g;
|
|
44
|
+
return g = {
|
|
45
|
+
next: verb(0),
|
|
46
|
+
"throw": verb(1),
|
|
47
|
+
"return": verb(2)
|
|
48
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
+
return this;
|
|
50
|
+
}), g;
|
|
51
|
+
function verb(n) {
|
|
52
|
+
return function (v) {
|
|
53
|
+
return step([n, v]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function step(op) {
|
|
57
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
+
while (_) try {
|
|
59
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
+
switch (op[0]) {
|
|
62
|
+
case 0:
|
|
63
|
+
case 1:
|
|
64
|
+
t = op;
|
|
65
|
+
break;
|
|
66
|
+
case 4:
|
|
67
|
+
_.label++;
|
|
68
|
+
return {
|
|
69
|
+
value: op[1],
|
|
70
|
+
done: false
|
|
71
|
+
};
|
|
72
|
+
case 5:
|
|
73
|
+
_.label++;
|
|
74
|
+
y = op[1];
|
|
75
|
+
op = [0];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
op = _.ops.pop();
|
|
79
|
+
_.trys.pop();
|
|
80
|
+
continue;
|
|
81
|
+
default:
|
|
82
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
+
_ = 0;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
+
_.label = op[1];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
+
_.label = t[1];
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (t && _.label < t[2]) {
|
|
96
|
+
_.label = t[2];
|
|
97
|
+
_.ops.push(op);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t[2]) _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
op = [6, e];
|
|
107
|
+
y = 0;
|
|
108
|
+
} finally {
|
|
109
|
+
f = t = 0;
|
|
110
|
+
}
|
|
111
|
+
if (op[0] & 5) throw op[1];
|
|
112
|
+
return {
|
|
113
|
+
value: op[0] ? op[1] : void 0,
|
|
114
|
+
done: true
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports.__esModule = true;
|
|
119
|
+
var react_1 = require("react");
|
|
120
|
+
var useGetHasErpData_1 = require("../hook/useGetHasErpData");
|
|
121
|
+
var ahooks_1 = require("ahooks");
|
|
122
|
+
var api_1 = require("../../../service/api");
|
|
123
|
+
function useGetErpLogisticsCompany(notJudgedErp) {
|
|
124
|
+
var _this = this;
|
|
125
|
+
var _a = react_1.useState("loading"),
|
|
126
|
+
globalState = _a[0],
|
|
127
|
+
setGlobalState = _a[1];
|
|
128
|
+
var hasErpData = useGetHasErpData_1["default"]();
|
|
129
|
+
ahooks_1.useUpdateEffect(function () {
|
|
130
|
+
asyncQueryData(hasErpData, notJudgedErp);
|
|
131
|
+
}, [hasErpData, notJudgedErp]);
|
|
132
|
+
var asyncQueryData = function asyncQueryData(hasErpData, notJudgedErp) {
|
|
133
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
134
|
+
var hasWdt, hasE3, hasJst, hasWln, promises, e_1;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0:
|
|
138
|
+
hasWdt = hasErpData.hasWdt, hasE3 = hasErpData.hasE3, hasJst = hasErpData.hasJst, hasWln = hasErpData.hasWln;
|
|
139
|
+
promises = [api_1.queryKMLogisticsCompany];
|
|
140
|
+
if (hasWdt || notJudgedErp) promises.push(api_1.queryWdtLogisticsCompany);
|
|
141
|
+
if (hasE3 || notJudgedErp) promises.push(api_1.queryBsE3LogisticsCompany);
|
|
142
|
+
if (hasJst || notJudgedErp) promises.push(api_1.queryJSTLogisticsCompany);
|
|
143
|
+
if (hasWln || notJudgedErp) promises.push(api_1.queryWLNLogisticsCompany);
|
|
144
|
+
if (!hasWdt && !hasE3 && !hasJst && !hasWln && !notJudgedErp) {
|
|
145
|
+
setGlobalState("success");
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
_a.label = 1;
|
|
150
|
+
case 1:
|
|
151
|
+
_a.trys.push([1, 3,, 4]);
|
|
152
|
+
return [4 /*yield*/, Promise.all(promises.map(function (promise) {
|
|
153
|
+
return promise();
|
|
154
|
+
}))];
|
|
155
|
+
case 2:
|
|
156
|
+
_a.sent();
|
|
157
|
+
setGlobalState("success");
|
|
158
|
+
return [3 /*break*/, 4];
|
|
159
|
+
case 3:
|
|
160
|
+
e_1 = _a.sent();
|
|
161
|
+
setGlobalState("failed");
|
|
162
|
+
return [3 /*break*/, 4];
|
|
163
|
+
case 4:
|
|
164
|
+
return [2 /*return*/];
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
var onReload = function onReload() {
|
|
171
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
172
|
+
return __generator(this, function (_a) {
|
|
173
|
+
switch (_a.label) {
|
|
174
|
+
case 0:
|
|
175
|
+
return [4 /*yield*/, asyncQueryData(hasErpData, notJudgedErp)];
|
|
176
|
+
case 1:
|
|
177
|
+
_a.sent();
|
|
178
|
+
return [2 /*return*/];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
return [globalState, onReload];
|
|
185
|
+
}
|
|
186
|
+
exports["default"] = useGetErpLogisticsCompany;
|
|
@@ -8,9 +8,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
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; }
|
|
9
9
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import {
|
|
11
|
+
import { useEffect, useState } from "react";
|
|
12
12
|
import useGetHasErpData from "../hook/useGetHasErpData";
|
|
13
|
-
import { useUpdateEffect } from "ahooks";
|
|
14
13
|
import { servers } from "@kmkf-fe-packages/kmkf-utils";
|
|
15
14
|
function useGetErpAddressData(notJudgedErp) {
|
|
16
15
|
var _useState = useState("loading"),
|
|
@@ -18,47 +17,43 @@ function useGetErpAddressData(notJudgedErp) {
|
|
|
18
17
|
globalState = _useState2[0],
|
|
19
18
|
setGlobalState = _useState2[1];
|
|
20
19
|
var hasErpData = useGetHasErpData();
|
|
21
|
-
useUpdateEffect(function () {
|
|
22
|
-
if (!notJudgedErp) {
|
|
23
|
-
asyncQueryData(hasErpData, notJudgedErp);
|
|
24
|
-
}
|
|
25
|
-
}, [hasErpData, notJudgedErp]);
|
|
26
20
|
useEffect(function () {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}, [notJudgedErp]);
|
|
21
|
+
asyncQueryData(hasErpData, notJudgedErp);
|
|
22
|
+
}, [hasErpData, notJudgedErp]);
|
|
31
23
|
var asyncQueryData = /*#__PURE__*/function () {
|
|
32
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hasErpData, notJudgedErp) {
|
|
24
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hasErpData, notJudgedErp, isReload) {
|
|
33
25
|
var hasBs, hasWdt, hasGy, promises;
|
|
34
26
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
35
27
|
while (1) switch (_context.prev = _context.next) {
|
|
36
28
|
case 0:
|
|
29
|
+
if (!isReload) {
|
|
30
|
+
setGlobalState("loading");
|
|
31
|
+
}
|
|
37
32
|
hasBs = hasErpData.hasBs, hasWdt = hasErpData.hasWdt, hasGy = hasErpData.hasGy;
|
|
38
33
|
promises = [];
|
|
39
34
|
if (hasBs || notJudgedErp) promises.push(servers.queryBsAddressData);
|
|
40
35
|
if (hasWdt || notJudgedErp) promises.push(servers.queryWdtAddressData);
|
|
41
36
|
if (hasGy || notJudgedErp) promises.push(servers.queryGyAddressData);
|
|
42
|
-
_context.prev =
|
|
43
|
-
_context.next =
|
|
37
|
+
_context.prev = 6;
|
|
38
|
+
_context.next = 9;
|
|
44
39
|
return Promise.all(promises.map(function (promise) {
|
|
45
40
|
return promise();
|
|
46
41
|
}));
|
|
47
|
-
case
|
|
42
|
+
case 9:
|
|
48
43
|
setGlobalState("success");
|
|
49
|
-
_context.next =
|
|
44
|
+
_context.next = 15;
|
|
50
45
|
break;
|
|
51
|
-
case
|
|
52
|
-
_context.prev =
|
|
53
|
-
_context.t0 = _context["catch"](
|
|
46
|
+
case 12:
|
|
47
|
+
_context.prev = 12;
|
|
48
|
+
_context.t0 = _context["catch"](6);
|
|
54
49
|
setGlobalState("failed");
|
|
55
|
-
case
|
|
50
|
+
case 15:
|
|
56
51
|
case "end":
|
|
57
52
|
return _context.stop();
|
|
58
53
|
}
|
|
59
|
-
}, _callee, null, [[
|
|
54
|
+
}, _callee, null, [[6, 12]]);
|
|
60
55
|
}));
|
|
61
|
-
return function asyncQueryData(_x2, _x3) {
|
|
56
|
+
return function asyncQueryData(_x2, _x3, _x4) {
|
|
62
57
|
return _ref.apply(this, arguments);
|
|
63
58
|
};
|
|
64
59
|
}();
|
|
@@ -68,7 +63,7 @@ function useGetErpAddressData(notJudgedErp) {
|
|
|
68
63
|
while (1) switch (_context2.prev = _context2.next) {
|
|
69
64
|
case 0:
|
|
70
65
|
_context2.next = 2;
|
|
71
|
-
return asyncQueryData(hasErpData, notJudgedErp);
|
|
66
|
+
return asyncQueryData(hasErpData, notJudgedErp, true);
|
|
72
67
|
case 2:
|
|
73
68
|
case "end":
|
|
74
69
|
return _context2.stop();
|
|
@@ -10,54 +10,51 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { useEffect, useState } from "react";
|
|
12
12
|
import useGetHasErpData from "../hook/useGetHasErpData";
|
|
13
|
-
import {
|
|
14
|
-
import { queryWdtLogisticsCompany, queryBsE3LogisticsCompany, queryJSTLogisticsCompany, queryWLNLogisticsCompany, queryKMLogisticsCompany } from "../../../service/api";
|
|
13
|
+
import { queryWdtLogisticsCompany, queryBsE3LogisticsCompany, queryJSTLogisticsCompany, queryWLNLogisticsCompany } from "../../../service/api";
|
|
15
14
|
function useGetErpLogisticsCompany(notJudgedErp) {
|
|
16
15
|
var _useState = useState("loading"),
|
|
17
16
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
17
|
globalState = _useState2[0],
|
|
19
18
|
setGlobalState = _useState2[1];
|
|
20
19
|
var hasErpData = useGetHasErpData();
|
|
21
|
-
|
|
20
|
+
useEffect(function () {
|
|
22
21
|
asyncQueryData(hasErpData, notJudgedErp);
|
|
23
22
|
}, [hasErpData, notJudgedErp]);
|
|
24
|
-
useEffect(function () {
|
|
25
|
-
if (notJudgedErp) {
|
|
26
|
-
asyncQueryData({}, notJudgedErp);
|
|
27
|
-
}
|
|
28
|
-
}, [notJudgedErp]);
|
|
29
23
|
var asyncQueryData = /*#__PURE__*/function () {
|
|
30
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hasErpData, notJudgedErp) {
|
|
24
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hasErpData, notJudgedErp, isReload) {
|
|
31
25
|
var hasWdt, hasE3, hasJst, hasWln, promises;
|
|
32
26
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
33
27
|
while (1) switch (_context.prev = _context.next) {
|
|
34
28
|
case 0:
|
|
29
|
+
if (!isReload) {
|
|
30
|
+
setGlobalState("loading");
|
|
31
|
+
}
|
|
35
32
|
hasWdt = hasErpData.hasWdt, hasE3 = hasErpData.hasE3, hasJst = hasErpData.hasJst, hasWln = hasErpData.hasWln;
|
|
36
|
-
promises = [
|
|
33
|
+
promises = [];
|
|
37
34
|
if (hasWdt || notJudgedErp) promises.push(queryWdtLogisticsCompany);
|
|
38
35
|
if (hasE3 || notJudgedErp) promises.push(queryBsE3LogisticsCompany);
|
|
39
36
|
if (hasJst || notJudgedErp) promises.push(queryJSTLogisticsCompany);
|
|
40
37
|
if (hasWln || notJudgedErp) promises.push(queryWLNLogisticsCompany);
|
|
41
|
-
_context.prev =
|
|
42
|
-
_context.next =
|
|
38
|
+
_context.prev = 7;
|
|
39
|
+
_context.next = 10;
|
|
43
40
|
return Promise.all(promises.map(function (promise) {
|
|
44
41
|
return promise();
|
|
45
42
|
}));
|
|
46
|
-
case
|
|
43
|
+
case 10:
|
|
47
44
|
setGlobalState("success");
|
|
48
|
-
_context.next =
|
|
45
|
+
_context.next = 16;
|
|
49
46
|
break;
|
|
50
|
-
case
|
|
51
|
-
_context.prev =
|
|
52
|
-
_context.t0 = _context["catch"](
|
|
47
|
+
case 13:
|
|
48
|
+
_context.prev = 13;
|
|
49
|
+
_context.t0 = _context["catch"](7);
|
|
53
50
|
setGlobalState("failed");
|
|
54
|
-
case
|
|
51
|
+
case 16:
|
|
55
52
|
case "end":
|
|
56
53
|
return _context.stop();
|
|
57
54
|
}
|
|
58
|
-
}, _callee, null, [[
|
|
55
|
+
}, _callee, null, [[7, 13]]);
|
|
59
56
|
}));
|
|
60
|
-
return function asyncQueryData(_x2, _x3) {
|
|
57
|
+
return function asyncQueryData(_x2, _x3, _x4) {
|
|
61
58
|
return _ref.apply(this, arguments);
|
|
62
59
|
};
|
|
63
60
|
}();
|
|
@@ -67,7 +64,7 @@ function useGetErpLogisticsCompany(notJudgedErp) {
|
|
|
67
64
|
while (1) switch (_context2.prev = _context2.next) {
|
|
68
65
|
case 0:
|
|
69
66
|
_context2.next = 2;
|
|
70
|
-
return asyncQueryData(hasErpData, notJudgedErp);
|
|
67
|
+
return asyncQueryData(hasErpData, notJudgedErp, true);
|
|
71
68
|
case 2:
|
|
72
69
|
case "end":
|
|
73
70
|
return _context2.stop();
|
|
@@ -10,7 +10,6 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { useEffect, useState } from "react";
|
|
12
12
|
import useGetHasErpData from "../hook/useGetHasErpData";
|
|
13
|
-
import { useUpdateEffect } from "ahooks";
|
|
14
13
|
import { SendDataCenter } from "@kmkf-fe-packages/kmkf-utils";
|
|
15
14
|
function useGetErpSendData(notJudgedErp) {
|
|
16
15
|
var _useState = useState("loading"),
|
|
@@ -18,41 +17,42 @@ function useGetErpSendData(notJudgedErp) {
|
|
|
18
17
|
globalState = _useState2[0],
|
|
19
18
|
setGlobalState = _useState2[1];
|
|
20
19
|
var hasErpData = useGetHasErpData();
|
|
21
|
-
|
|
20
|
+
useEffect(function () {
|
|
22
21
|
asyncQueryData(hasErpData, notJudgedErp);
|
|
23
22
|
}, [hasErpData, notJudgedErp]);
|
|
24
|
-
useEffect(function () {
|
|
25
|
-
if (notJudgedErp) {
|
|
26
|
-
asyncQueryData({}, notJudgedErp);
|
|
27
|
-
}
|
|
28
|
-
}, [notJudgedErp]);
|
|
29
23
|
var asyncQueryData = /*#__PURE__*/function () {
|
|
30
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hasErpData, notJudgedErp) {
|
|
31
|
-
var promises;
|
|
24
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hasErpData, notJudgedErp, isReload) {
|
|
25
|
+
var hasWdt, hasGy, promises;
|
|
32
26
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
33
27
|
while (1) switch (_context.prev = _context.next) {
|
|
34
28
|
case 0:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
if (!isReload) {
|
|
30
|
+
setGlobalState("loading");
|
|
31
|
+
}
|
|
32
|
+
_context.prev = 1;
|
|
33
|
+
hasWdt = hasErpData.hasWdt, hasGy = hasErpData.hasGy;
|
|
34
|
+
promises = [];
|
|
35
|
+
if (hasWdt || notJudgedErp) promises.push(SendDataCenter.getInstance("wdt").fetchData);
|
|
36
|
+
if (hasGy || notJudgedErp) promises.push(SendDataCenter.getInstance("gy").fetchData);
|
|
37
|
+
_context.next = 8;
|
|
38
38
|
return Promise.all(promises.map(function (promise) {
|
|
39
39
|
return promise();
|
|
40
40
|
}));
|
|
41
|
-
case
|
|
41
|
+
case 8:
|
|
42
42
|
setGlobalState("success");
|
|
43
|
-
_context.next =
|
|
43
|
+
_context.next = 14;
|
|
44
44
|
break;
|
|
45
|
-
case
|
|
46
|
-
_context.prev =
|
|
47
|
-
_context.t0 = _context["catch"](
|
|
45
|
+
case 11:
|
|
46
|
+
_context.prev = 11;
|
|
47
|
+
_context.t0 = _context["catch"](1);
|
|
48
48
|
setGlobalState("failed");
|
|
49
|
-
case
|
|
49
|
+
case 14:
|
|
50
50
|
case "end":
|
|
51
51
|
return _context.stop();
|
|
52
52
|
}
|
|
53
|
-
}, _callee, null, [[
|
|
53
|
+
}, _callee, null, [[1, 11]]);
|
|
54
54
|
}));
|
|
55
|
-
return function asyncQueryData(_x2, _x3) {
|
|
55
|
+
return function asyncQueryData(_x2, _x3, _x4) {
|
|
56
56
|
return _ref.apply(this, arguments);
|
|
57
57
|
};
|
|
58
58
|
}();
|
|
@@ -62,7 +62,7 @@ function useGetErpSendData(notJudgedErp) {
|
|
|
62
62
|
while (1) switch (_context2.prev = _context2.next) {
|
|
63
63
|
case 0:
|
|
64
64
|
_context2.next = 2;
|
|
65
|
-
return asyncQueryData(hasErpData, notJudgedErp);
|
|
65
|
+
return asyncQueryData(hasErpData, notJudgedErp, true);
|
|
66
66
|
case 2:
|
|
67
67
|
case "end":
|
|
68
68
|
return _context2.stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/services-components",
|
|
3
|
-
"version": "2.0.2-beta.
|
|
3
|
+
"version": "2.0.2-beta.2",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@kmkf-fe-packages/basic-components": "2.0.2-beta.
|
|
25
|
-
"@kmkf-fe-packages/kmkf-utils": "2.0.2-beta.
|
|
24
|
+
"@kmkf-fe-packages/basic-components": "2.0.2-beta.2",
|
|
25
|
+
"@kmkf-fe-packages/kmkf-utils": "2.0.2-beta.2",
|
|
26
26
|
"b64-to-blob": "^1.2.19",
|
|
27
27
|
"html2canvas": "^1.4.1",
|
|
28
28
|
"react-pdf-js": "^5.1.0"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "7a72cc893f87338d7d7ed03f15f999f29952d011",
|
|
45
45
|
"gitHooks": {
|
|
46
46
|
"pre-commit": "lint-staged"
|
|
47
47
|
}
|