@kmkf-fe-packages/services-components 2.0.76 → 2.0.78
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/components/Public/AsyncSelect/index.d.ts +3 -0
- package/dist/esm/components/Public/AsyncSelect/index.js +80 -15
- package/dist/esm/factory.d.ts +1 -1
- package/dist/esm/factory.js +2 -0
- package/package.json +4 -4
- package/dist/esm/commonComponents/GlobalContext/hook/dist/useGetHasErpData.js +0 -52
- package/dist/esm/commonComponents/GlobalContext/orderQuery/dist/useGetErpAddressData.js +0 -180
- package/dist/esm/commonComponents/GlobalContext/orderQuery/dist/useGetErpLogisticsCompany.js +0 -186
- package/dist/esm/components/BS/BsGoods/dist/index.js +0 -113
- package/dist/esm/components/Common/dist/index.js +0 -1019
|
@@ -14,8 +14,11 @@ declare class AsyncSelect implements ComponentInterface {
|
|
|
14
14
|
children: ComponentInterface[];
|
|
15
15
|
dataType: ComponentInterface["dataType"];
|
|
16
16
|
asyncOptions?: any[];
|
|
17
|
+
mode: string;
|
|
18
|
+
maxSelectCount: number | undefined;
|
|
17
19
|
constructor(options: PickOption);
|
|
18
20
|
getOptionsAsync(): Promise<any[]>;
|
|
21
|
+
getValueString: (value: any) => any;
|
|
19
22
|
renderClient: (record: any) => React.JSX.Element | null;
|
|
20
23
|
renderPc: (_value: any, record: Record) => React.JSX.Element;
|
|
21
24
|
renderLog: (r: Record) => React.JSX.Element | null;
|
|
@@ -14,7 +14,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
14
14
|
import React from "react";
|
|
15
15
|
import GetFormItem from "../../GetFormItem";
|
|
16
16
|
import { AsyncSelect as BasicAsyncSelect } from "@kmkf-fe-packages/basic-components";
|
|
17
|
-
import { servers } from "@kmkf-fe-packages/kmkf-utils";
|
|
17
|
+
import { isNull, servers } from "@kmkf-fe-packages/kmkf-utils";
|
|
18
18
|
import ItemView from "../../../commonComponents/ItemView";
|
|
19
19
|
import { filterFn as _filterFn } from "@kmkf-fe-packages/kmkf-utils";
|
|
20
20
|
import { SYMBOL } from "../../../constant";
|
|
@@ -24,6 +24,43 @@ var typeMap = {
|
|
|
24
24
|
key: "gyPaymentMethod",
|
|
25
25
|
name: "管易支付方式",
|
|
26
26
|
api: servers.GY.getTradePaymentDataAsync
|
|
27
|
+
},
|
|
28
|
+
WDT_TAGS: {
|
|
29
|
+
key: "wdtTags",
|
|
30
|
+
name: "旺店通标签",
|
|
31
|
+
mode: "multiple",
|
|
32
|
+
api: servers.WDT.getTagsDataAsync,
|
|
33
|
+
//旗舰版暂时限制最多选择一个
|
|
34
|
+
maxSelectCount: function maxSelectCount() {
|
|
35
|
+
var version = "flagship";
|
|
36
|
+
try {
|
|
37
|
+
var userInfo = JSON.parse(localStorage.getItem("reduxData_userInfo") || "{}");
|
|
38
|
+
if (isNull(userInfo)) {
|
|
39
|
+
version = "flagship";
|
|
40
|
+
} else {
|
|
41
|
+
var _userInfo$companyUser, _companyUserConfig, _companyUserConfig$pl, _companyUserConfig$pl2;
|
|
42
|
+
var companyUserConfig = (_userInfo$companyUser = userInfo === null || userInfo === void 0 ? void 0 : userInfo.companyUserConfig) !== null && _userInfo$companyUser !== void 0 ? _userInfo$companyUser : {};
|
|
43
|
+
if (typeof companyUserConfig === "string") {
|
|
44
|
+
companyUserConfig = JSON.parse(companyUserConfig);
|
|
45
|
+
}
|
|
46
|
+
version = ((_companyUserConfig = companyUserConfig) === null || _companyUserConfig === void 0 ? void 0 : (_companyUserConfig$pl = _companyUserConfig.plugins) === null || _companyUserConfig$pl === void 0 ? void 0 : (_companyUserConfig$pl2 = _companyUserConfig$pl.wdt) === null || _companyUserConfig$pl2 === void 0 ? void 0 : _companyUserConfig$pl2.version) || "flagship";
|
|
47
|
+
}
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error(error);
|
|
50
|
+
}
|
|
51
|
+
if (version === "flagship") return 1;
|
|
52
|
+
},
|
|
53
|
+
handleOptions: function handleOptions(options) {
|
|
54
|
+
var ext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
55
|
+
var _ext$componentConfig = ext.componentConfig,
|
|
56
|
+
_ext$componentConfig2 = _ext$componentConfig === void 0 ? {} : _ext$componentConfig,
|
|
57
|
+
tagsRange = _ext$componentConfig2.tagsRange;
|
|
58
|
+
if (!tagsRange || tagsRange === "all") return options;
|
|
59
|
+
return options.filter(function (option) {
|
|
60
|
+
if (tagsRange === "builtInTags") return !!option.isBuiltIn;
|
|
61
|
+
return !option.isBuiltIn;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
27
64
|
}
|
|
28
65
|
};
|
|
29
66
|
var AsyncSelect = /*#__PURE__*/function () {
|
|
@@ -32,7 +69,10 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
32
69
|
function AsyncSelect(options) {
|
|
33
70
|
var _this = this,
|
|
34
71
|
_typeMap$options$type,
|
|
35
|
-
_typeMap$options$type2
|
|
72
|
+
_typeMap$options$type2,
|
|
73
|
+
_typeMap$options$type3,
|
|
74
|
+
_typeMap$options$type4,
|
|
75
|
+
_typeMap$options$type5;
|
|
36
76
|
_classCallCheck(this, AsyncSelect);
|
|
37
77
|
_defineProperty(this, "name", void 0);
|
|
38
78
|
_defineProperty(this, "id", void 0);
|
|
@@ -47,6 +87,24 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
47
87
|
_defineProperty(this, "children", void 0);
|
|
48
88
|
_defineProperty(this, "dataType", void 0);
|
|
49
89
|
_defineProperty(this, "asyncOptions", void 0);
|
|
90
|
+
_defineProperty(this, "mode", void 0);
|
|
91
|
+
_defineProperty(this, "maxSelectCount", void 0);
|
|
92
|
+
_defineProperty(this, "getValueString", function (value) {
|
|
93
|
+
var list = _this.asyncOptions || [];
|
|
94
|
+
if (!_this.mode) {
|
|
95
|
+
var selectedItem = list.find(function (item) {
|
|
96
|
+
return item.value === value;
|
|
97
|
+
});
|
|
98
|
+
return selectedItem ? selectedItem.label : value !== null && value !== void 0 ? value : "--";
|
|
99
|
+
} else if (_this.mode === "multiple" && Array.isArray(value)) {
|
|
100
|
+
var _list$filter$map$join;
|
|
101
|
+
return (_list$filter$map$join = list.filter(function (item) {
|
|
102
|
+
return value.includes(item.value);
|
|
103
|
+
}).map(function (item) {
|
|
104
|
+
return item.label;
|
|
105
|
+
}).join(",")) !== null && _list$filter$map$join !== void 0 ? _list$filter$map$join : "--";
|
|
106
|
+
}
|
|
107
|
+
});
|
|
50
108
|
_defineProperty(this, "renderClient", function (record) {
|
|
51
109
|
var value = record === null || record === void 0 ? void 0 : record[_this.id];
|
|
52
110
|
return !isNil(value) ? /*#__PURE__*/React.createElement(ItemView, {
|
|
@@ -54,6 +112,7 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
54
112
|
label: _this.name,
|
|
55
113
|
value: /*#__PURE__*/React.createElement(BasicAsyncSelect, {
|
|
56
114
|
value: value,
|
|
115
|
+
mode: _this.mode,
|
|
57
116
|
getOptionsAsync: _this.getOptionsAsync.bind(_this),
|
|
58
117
|
showOnly: true
|
|
59
118
|
})
|
|
@@ -63,6 +122,7 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
63
122
|
var value = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(typeMap[_this.type].key)];
|
|
64
123
|
return /*#__PURE__*/React.createElement("span", null, isNil(value) ? "--" : /*#__PURE__*/React.createElement(BasicAsyncSelect, {
|
|
65
124
|
value: value,
|
|
125
|
+
mode: _this.mode,
|
|
66
126
|
getOptionsAsync: _this.getOptionsAsync.bind(_this),
|
|
67
127
|
showOnly: true
|
|
68
128
|
}));
|
|
@@ -79,11 +139,7 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
79
139
|
});
|
|
80
140
|
_defineProperty(this, "renderExport", function (value, record) {
|
|
81
141
|
var val = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(typeMap[_this.type].key)];
|
|
82
|
-
|
|
83
|
-
var seletedItem = list.find(function (item) {
|
|
84
|
-
return item.value === val;
|
|
85
|
-
});
|
|
86
|
-
return seletedItem ? seletedItem.label : val !== null && val !== void 0 ? val : "--";
|
|
142
|
+
return _this.getValueString(val);
|
|
87
143
|
});
|
|
88
144
|
_defineProperty(this, "editRender", function (p) {
|
|
89
145
|
var _this$componentConfig, _this$componentConfig2, _this$componentConfig3, _this$componentConfig4;
|
|
@@ -96,9 +152,11 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
96
152
|
required: (_this$componentConfig = (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.required) !== null && _this$componentConfig !== void 0 ? _this$componentConfig : false,
|
|
97
153
|
tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : "",
|
|
98
154
|
component: /*#__PURE__*/React.createElement(BasicAsyncSelect, _extends({}, _this.componentConfig, {
|
|
155
|
+
mode: _this.mode,
|
|
99
156
|
placeholder: "\u8BF7\u9009\u62E9".concat(_this.name),
|
|
100
157
|
getOptionsAsync: _this.getOptionsAsync.bind(_this),
|
|
101
|
-
onChange: p === null || p === void 0 ? void 0 : p.onChange
|
|
158
|
+
onChange: p === null || p === void 0 ? void 0 : p.onChange,
|
|
159
|
+
maxSelectCount: _this.maxSelectCount
|
|
102
160
|
}))
|
|
103
161
|
});
|
|
104
162
|
});
|
|
@@ -139,6 +197,8 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
139
197
|
this.dataType = "weakenArray";
|
|
140
198
|
this.rules = [];
|
|
141
199
|
this.align = "left";
|
|
200
|
+
this.mode = (_typeMap$options$type3 = typeMap[options.type]) === null || _typeMap$options$type3 === void 0 ? void 0 : _typeMap$options$type3.mode;
|
|
201
|
+
this.maxSelectCount = typeof ((_typeMap$options$type4 = typeMap[options.type]) === null || _typeMap$options$type4 === void 0 ? void 0 : _typeMap$options$type4.maxSelectCount) === "function" ? typeMap[options.type].maxSelectCount() : (_typeMap$options$type5 = typeMap[options.type]) === null || _typeMap$options$type5 === void 0 ? void 0 : _typeMap$options$type5.maxSelectCount;
|
|
142
202
|
this.getOptionsAsync().then(function (list) {
|
|
143
203
|
_this.asyncOptions = list;
|
|
144
204
|
});
|
|
@@ -147,7 +207,7 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
147
207
|
key: "getOptionsAsync",
|
|
148
208
|
value: function () {
|
|
149
209
|
var _getOptionsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
150
|
-
var options, _typeMap$this$type, _typeMap$this$type$ap;
|
|
210
|
+
var options, _typeMap$this$type, _typeMap$this$type$ap, _typeMap$this$type2, _typeMap$this$type3;
|
|
151
211
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
152
212
|
while (1) switch (_context.prev = _context.next) {
|
|
153
213
|
case 0:
|
|
@@ -164,19 +224,24 @@ var AsyncSelect = /*#__PURE__*/function () {
|
|
|
164
224
|
_context.t0 = [];
|
|
165
225
|
case 7:
|
|
166
226
|
options = _context.t0;
|
|
167
|
-
|
|
227
|
+
if ((_typeMap$this$type2 = typeMap[this.type]) !== null && _typeMap$this$type2 !== void 0 && _typeMap$this$type2.handleOptions) {
|
|
228
|
+
options = (_typeMap$this$type3 = typeMap[this.type]) === null || _typeMap$this$type3 === void 0 ? void 0 : _typeMap$this$type3.handleOptions(options, {
|
|
229
|
+
componentConfig: this.componentConfig
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
_context.next = 14;
|
|
168
233
|
break;
|
|
169
|
-
case
|
|
170
|
-
_context.prev =
|
|
234
|
+
case 11:
|
|
235
|
+
_context.prev = 11;
|
|
171
236
|
_context.t1 = _context["catch"](1);
|
|
172
237
|
console.debug("api error", _context.t1);
|
|
173
|
-
case 13:
|
|
174
|
-
return _context.abrupt("return", options);
|
|
175
238
|
case 14:
|
|
239
|
+
return _context.abrupt("return", options);
|
|
240
|
+
case 15:
|
|
176
241
|
case "end":
|
|
177
242
|
return _context.stop();
|
|
178
243
|
}
|
|
179
|
-
}, _callee, this, [[1,
|
|
244
|
+
}, _callee, this, [[1, 11]]);
|
|
180
245
|
}));
|
|
181
246
|
function getOptionsAsync() {
|
|
182
247
|
return _getOptionsAsync.apply(this, arguments);
|
package/dist/esm/factory.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ReissueLogistics, JstItemSelect, JstSupply, JstSendGood, BasicInput, BasicAddress, BasicCascader, BasicCheckbox, BasicDataTime, BasicSelect, BasicRadio, BasicTextArea, BasicPicture, BasicPicturePro, BasicMultSelect, BasicGrade, BasicRate, BasicFile, BasicPosting, SubForm, CommonDataTime, TradeId, ShopName, BuyerNick, ReceiverName, ReceiverMobile, ReceiverAddress, TradeDateTime, Logistics, ReturnLogistics, ActualPayment, ERemark, AliPay, ItemSelect, ItemId, ItemEnCode, SystemOrderNo, Ordinary, ThirdItemSelect, FlowStatusSelect, FlowMarkSelect, FlowTag, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, PrevSubmitter, FlowCreator, Handler, CompletedUser, LogisticsInterception, LogisticsMoreInterception, LogisticsTrajectory, LogisticsMoreTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect, CommonSystemOrder, CommonMultiStatus, Calculation, NodeDeadLine, HandlerDeadLine, NodeStayDuration, WlnGoods, BsPosting, MsgStatus, NodeInput, FlowWorkOrderStatus, WdtGoods, WdtReturn, WdtExchange, CommonInput, PaymentVoucherCode, Label, WdtReissue, GyReissue, AfterSalesOrderId, BsE3Goods, PublicGoods, PublicReissueGoods, PublicExchange, GyGoods, BsE3Reissue, MemberLevel, GyReturn, AsyncSelect, WdtShopSelect, KmVideo } from "./index";
|
|
2
2
|
import { PickOption } from "./type";
|
|
3
|
-
export declare const factory: (type: string, options: PickOption) =>
|
|
3
|
+
export declare const factory: (type: string, options: PickOption) => BuyerNick | JstSendGood | MsgStatus | AsyncSelect | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicPicturePro | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | SubForm | CommonDataTime | TradeId | ShopName | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | ReissueLogistics | JstItemSelect | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | PublicReissueGoods | PublicExchange | BsE3Reissue | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | WdtShopSelect | KmVideo | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods | GyReissue | GyReturn;
|
package/dist/esm/factory.js
CHANGED
|
@@ -269,6 +269,8 @@ export var factory = function factory(type, options) {
|
|
|
269
269
|
return new WdtShopSelect(options);
|
|
270
270
|
case "KM_VIDEO":
|
|
271
271
|
return new KmVideo(options);
|
|
272
|
+
case "WDT_TAGS":
|
|
273
|
+
return new AsyncSelect(options);
|
|
272
274
|
default:
|
|
273
275
|
return new BasicInput(options);
|
|
274
276
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/services-components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.78",
|
|
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.
|
|
25
|
-
"@kmkf-fe-packages/kmkf-utils": "2.0.
|
|
24
|
+
"@kmkf-fe-packages/basic-components": "2.0.78",
|
|
25
|
+
"@kmkf-fe-packages/kmkf-utils": "2.0.78",
|
|
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": "029c929112eda38ed0d433cdc122bcf9f687bdf3",
|
|
45
45
|
"gitHooks": {
|
|
46
46
|
"pre-commit": "lint-staged"
|
|
47
47
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
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,180 +0,0 @@
|
|
|
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;
|
package/dist/esm/commonComponents/GlobalContext/orderQuery/dist/useGetErpLogisticsCompany.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
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;
|