@kmkf-fe-packages/services-components 0.26.0-alpha.8 → 0.26.1-alpha.1

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.
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ declare type RequestType = "queryAddressData" | "queryBsAddressData" | "queryExpressInterceptData" | "queryLogisticsAddressData" | "queryPlatData" | "queryWdtAddressData" | "queryAllLogisticsCompany";
3
+ declare const Global: ({ children, requestList, repeatRequestList }: React.PropsWithChildren<{
4
+ requestList?: RequestType[] | undefined;
5
+ repeatRequestList?: Record<string, Promise<any>> | undefined;
6
+ }>) => React.JSX.Element;
7
+ export default Global;
@@ -0,0 +1,104 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ 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; }
4
+ 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; }
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
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ 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); }
13
+ 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; }
14
+ 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; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ import React, { useEffect, useState } from "react";
17
+ import { Skeleton, Result, Button } from "antd";
18
+ import { queryAddressData, queryBsAddressData, queryExpressInterceptData, queryLogisticsAddressData, queryPlatData, queryWdtAddressData, queryAllLogisticsCompany } from "../../service/api";
19
+ var Global = function Global(_ref) {
20
+ var children = _ref.children,
21
+ _ref$requestList = _ref.requestList,
22
+ requestList = _ref$requestList === void 0 ? [] : _ref$requestList,
23
+ _ref$repeatRequestLis = _ref.repeatRequestList,
24
+ repeatRequestList = _ref$repeatRequestLis === void 0 ? {} : _ref$repeatRequestLis;
25
+ var _useState = useState("loading"),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ globalState = _useState2[0],
28
+ setGlobalState = _useState2[1];
29
+ var initDataSource = /*#__PURE__*/function () {
30
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
31
+ var mapping, mergeMapping, promises, _Object$keys, _Object$keys2, _Object$keys2$filter, _promises;
32
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ mapping = {
36
+ queryAddressData: queryAddressData,
37
+ queryBsAddressData: queryBsAddressData,
38
+ queryExpressInterceptData: queryExpressInterceptData,
39
+ queryLogisticsAddressData: queryLogisticsAddressData,
40
+ queryPlatData: queryPlatData,
41
+ queryWdtAddressData: queryWdtAddressData,
42
+ queryAllLogisticsCompany: queryAllLogisticsCompany
43
+ };
44
+ mergeMapping = _objectSpread(_objectSpread({}, mapping), repeatRequestList);
45
+ promises = [];
46
+ if ((requestList === null || requestList === void 0 ? void 0 : requestList.length) === 0) {
47
+ promises = (_Object$keys = Object.keys(mergeMapping)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(function (item) {
48
+ return mergeMapping[item];
49
+ });
50
+ } else {
51
+ promises = (_Object$keys2 = Object.keys(mergeMapping)) === null || _Object$keys2 === void 0 ? void 0 : (_Object$keys2$filter = _Object$keys2.filter(function (item) {
52
+ return requestList === null || requestList === void 0 ? void 0 : requestList.includes(item);
53
+ })) === null || _Object$keys2$filter === void 0 ? void 0 : _Object$keys2$filter.map(function (item) {
54
+ return mergeMapping[item];
55
+ });
56
+ }
57
+ _context.prev = 4;
58
+ _context.next = 7;
59
+ return Promise.all((_promises = promises) === null || _promises === void 0 ? void 0 : _promises.map(function (promise) {
60
+ return promise();
61
+ }));
62
+ case 7:
63
+ setGlobalState("success");
64
+ _context.next = 13;
65
+ break;
66
+ case 10:
67
+ _context.prev = 10;
68
+ _context.t0 = _context["catch"](4);
69
+ setGlobalState("failed");
70
+ case 13:
71
+ case "end":
72
+ return _context.stop();
73
+ }
74
+ }, _callee, null, [[4, 10]]);
75
+ }));
76
+ return function initDataSource() {
77
+ return _ref2.apply(this, arguments);
78
+ };
79
+ }();
80
+ useEffect(function () {
81
+ initDataSource();
82
+ }, []);
83
+ if (globalState === "loading") {
84
+ return /*#__PURE__*/React.createElement(Skeleton, {
85
+ active: true,
86
+ paragraph: {
87
+ rows: 8
88
+ }
89
+ });
90
+ }
91
+ if (globalState === "failed") {
92
+ return /*#__PURE__*/React.createElement(Result, {
93
+ status: "error",
94
+ title: "\u6570\u636E\u52A0\u8F7D\u5F02\u5E38,\u8BF7\u5237\u65B0\u91CD\u8BD5",
95
+ extra: /*#__PURE__*/React.createElement(Button, {
96
+ type: "primary",
97
+ key: "console",
98
+ onClick: initDataSource
99
+ }, "\u5237\u65B0\u91CD\u8BD5")
100
+ });
101
+ }
102
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
103
+ };
104
+ export default Global;
@@ -1,3 +1,3 @@
1
1
  import { JstLogistics, JstItemSelect, JstSupply, JstSendGood, BasicInput, BasicAddress, BasicCascader, BasicCheckbox, BasicDataTime, BasicSelect, BasicRadio, BasicTextArea, BasicPicture, BasicMultSelect, BasicGrade, BasicRate, BasicFile, BasicPosting, CommonDataTime, TradeId, ShopName, ErpTradeId, 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, LogisticsTrajectory, LogisticsMoreTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect, CommonSystemOrder, CommonMultiStatus, Calculation, NodeDeadLine, HandlerDeadLine, NodeStayDuration, WlnGoods, BsPosting, MsgStatus, WdtGoods } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => BsLogistics | BsReissue | BsSystemOrder | ItemEnCode | JstSendGood | BasicPosting | WdtGoods | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | CommonDataTime | TradeId | ErpTradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstLogistics | JstItemSelect | JstSupply | BsGoods | BsExchange | BsReturn | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | MsgStatus;
3
+ export declare const factory: (type: string, options: PickOption) => BuyerNick | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | CommonDataTime | TradeId | ErpTradeId | ShopName | ReceiverName | ReceiverMobile | ReceiverAddress | TradeDateTime | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstLogistics | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | MsgStatus | WdtGoods;
@@ -78,3 +78,4 @@ export { default as PlatBuyer } from "./commonComponents/PlatBuyer";
78
78
  export { default as ShopList } from "./commonComponents/ShopList";
79
79
  export { default as OperationLog } from "./commonComponents/OperationLog";
80
80
  export { default as GetFormItem } from "./components/GetFormItem";
81
+ export { default as Global } from "./commonComponents/GlobalContext";
package/dist/esm/index.js CHANGED
@@ -77,4 +77,5 @@ export { default as SelectMark } from "./commonComponents/SelectMark";
77
77
  export { default as PlatBuyer } from "./commonComponents/PlatBuyer";
78
78
  export { default as ShopList } from "./commonComponents/ShopList";
79
79
  export { default as OperationLog } from "./commonComponents/OperationLog";
80
- export { default as GetFormItem } from "./components/GetFormItem";
80
+ export { default as GetFormItem } from "./components/GetFormItem";
81
+ export { default as Global } from "./commonComponents/GlobalContext";
@@ -1 +1,8 @@
1
1
  export declare const replaceCheck: (data: any) => Promise<any>;
2
+ export declare const queryAddressData: () => Promise<void>;
3
+ export declare const queryBsAddressData: () => Promise<void>;
4
+ export declare const queryWdtAddressData: () => Promise<void>;
5
+ export declare const queryPlatData: () => Promise<void>;
6
+ export declare const queryExpressInterceptData: () => Promise<void>;
7
+ export declare const queryLogisticsAddressData: () => Promise<void>;
8
+ export declare const queryAllLogisticsCompany: () => Promise<void>;
@@ -1,3 +1,17 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ 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; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ 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); }
7
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
+ 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."); }
9
+ 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); }
10
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
+ 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; }
13
+ import { AddressData, toTree, BsAddressData, WdtAddressData, PlatData, ExpressInterceptData, LogisticsAddressData, ExpressData } from '@kmkf-fe-packages/kmkf-utils';
14
+ import get from 'lodash/get';
1
15
  import request from "./request";
2
16
  // 重复校验
3
17
  export var replaceCheck = function replaceCheck(data) {
@@ -6,4 +20,231 @@ export var replaceCheck = function replaceCheck(data) {
6
20
  method: 'post',
7
21
  data: data
8
22
  });
23
+ };
24
+ export var queryAddressData = function queryAddressData() {
25
+ return request({
26
+ url: "/qy/gdfw/template/queryAreas/noLogin",
27
+ method: "get",
28
+ data: {}
29
+ }).then(function (resp) {
30
+ var map = {};
31
+ var res = {};
32
+ var list = resp.data;
33
+ for (var i = 0; i < list.length; i++) {
34
+ res[list[i]["id"]] = [list[i]["name"], list[i]["parentId"]];
35
+ map[list[i]["name"]] = list[i]["id"];
36
+ }
37
+ var instance = AddressData.getInstance();
38
+ instance.addrData = res;
39
+ instance.addrNameMap = map;
40
+ instance.addressOptions = get(toTree(list, 0), '0.children', []);
41
+ });
42
+ };
43
+ export var queryBsAddressData = function queryBsAddressData() {
44
+ return request({
45
+ url: "/qy/gdfw/template/queryBsAreas/noLogin",
46
+ method: "get",
47
+ data: {}
48
+ }).then(function (resp) {
49
+ var map = {};
50
+ var res = {};
51
+ var _resp$data = resp.data,
52
+ list = _resp$data === void 0 ? [] : _resp$data;
53
+ for (var i = 0; i < list.length; i++) {
54
+ res[list[i]["id"]] = [list[i]["name"], list[i]["parentId"]];
55
+ map[list[i]["name"]] = list[i]["id"];
56
+ }
57
+ var instance = BsAddressData.getInstance();
58
+ instance.addrData = res;
59
+ instance.addrNameMap = map;
60
+ instance.addressOptions = toTree(list, 1);
61
+ });
62
+ };
63
+ export var queryWdtAddressData = function queryWdtAddressData() {
64
+ return request({
65
+ url: "/qy/gdfw/template/queryWdtAreas/noLogin",
66
+ method: "get",
67
+ data: {}
68
+ }).then(function (resp) {
69
+ var map = {};
70
+ var res = {};
71
+ var _resp$data2 = resp.data,
72
+ list = _resp$data2 === void 0 ? [] : _resp$data2;
73
+ for (var i = 0; i < list.length; i++) {
74
+ res[list[i]["id"]] = [list[i]["name"], list[i]["parentId"]];
75
+ map[list[i]["name"]] = list[i]["id"];
76
+ }
77
+ var instance = WdtAddressData.getInstance();
78
+ instance.addrData = res;
79
+ instance.addrNameMap = map;
80
+ instance.addressOptions = toTree(list, 1);
81
+ });
82
+ };
83
+ export var queryPlatData = function queryPlatData() {
84
+ return request({
85
+ url: "/qy/platform/listPlatform/noLogin",
86
+ method: "get",
87
+ data: {}
88
+ }).then(function (res) {
89
+ if (res.success) {
90
+ var platType = res.data || {};
91
+ platType.alreadyJoinedList = platType.alreadyJoinedList || [];
92
+ platType.notJoinList = platType.notJoinList || [];
93
+ var list = [].concat(_toConsumableArray(platType.alreadyJoinedList), _toConsumableArray(platType.notJoinList));
94
+ var instance = PlatData.getInstance();
95
+ instance.platTypeList = list;
96
+ var platMap = list === null || list === void 0 ? void 0 : list.reduce(function (cur, nxt) {
97
+ cur[nxt.platformType] = nxt.platformName;
98
+ return cur;
99
+ }, {});
100
+ instance.platMap = platMap;
101
+ var platSelectList = list.map(function (p) {
102
+ return {
103
+ label: p.platformName,
104
+ value: p.platformType
105
+ };
106
+ });
107
+ instance.platSelectList = platSelectList;
108
+ }
109
+ });
110
+ };
111
+ export var queryExpressInterceptData = function queryExpressInterceptData() {
112
+ return request({
113
+ url: '/qy/logistics/listLogisticsWithInterceptInfo/noLogin',
114
+ method: 'get',
115
+ data: {
116
+ platformType: 118
117
+ }
118
+ }).then(function (res) {
119
+ var data = res.data;
120
+ var instance = ExpressInterceptData.getInstance();
121
+ var companyTypeMap = {
122
+ SF: '顺丰',
123
+ ZTO: '中通',
124
+ JT: '极兔',
125
+ DEFAULT: ''
126
+ };
127
+ var expressList = data.map(function (item) {
128
+ return _objectSpread(_objectSpread({}, item), {}, {
129
+ label: item.name,
130
+ value: item.cpCode
131
+ });
132
+ });
133
+ instance.expressData = expressList;
134
+ var showBtn = {},
135
+ showSender = {},
136
+ showAddress = {},
137
+ showReturnAddress = {},
138
+ typeMap = {},
139
+ statusMap = {},
140
+ typeObj = {},
141
+ statusObj = {};
142
+ expressList.forEach(function (item) {
143
+ var _item$logisticsStatus, _item$interceptionTyp;
144
+ if (item !== null && item !== void 0 && (_item$logisticsStatus = item.logisticsStatusList) !== null && _item$logisticsStatus !== void 0 && _item$logisticsStatus.length) {
145
+ item.logisticsStatusList.forEach(function (t) {
146
+ statusMap["".concat(t.value)] = t.label;
147
+ if (statusObj[t.label]) {
148
+ statusObj[t.label] = statusObj[t.label].add(t.value);
149
+ } else {
150
+ statusObj[t.label] = new Set([t.value]);
151
+ }
152
+ //todo 取消拦截按钮
153
+ if (t !== null && t !== void 0 && t.showInterceptionBtn) {
154
+ showBtn["".concat(t.value)] = true;
155
+ }
156
+ });
157
+ }
158
+ if (item !== null && item !== void 0 && (_item$interceptionTyp = item.interceptionTypeList) !== null && _item$interceptionTyp !== void 0 && _item$interceptionTyp.length) {
159
+ item.interceptionTypeList.forEach(function (t) {
160
+ var _t$config, _t$config2, _t$config3;
161
+ typeMap["".concat(t.value)] = t.label;
162
+ if (typeObj[t.label]) {
163
+ typeObj[t.label] = typeObj[t.label].add(t.value);
164
+ } else {
165
+ typeObj[t.label] = new Set([t.value]);
166
+ }
167
+ if (t !== null && t !== void 0 && (_t$config = t.config) !== null && _t$config !== void 0 && _t$config.showAddress) {
168
+ showAddress["".concat(t.value)] = true;
169
+ }
170
+ if (t !== null && t !== void 0 && (_t$config2 = t.config) !== null && _t$config2 !== void 0 && _t$config2.showAddressSelect) {
171
+ showReturnAddress["".concat(t.value)] = true;
172
+ }
173
+ if (t !== null && t !== void 0 && (_t$config3 = t.config) !== null && _t$config3 !== void 0 && _t$config3.showSenderMobile) {
174
+ showSender["".concat(t.value)] = true;
175
+ }
176
+ });
177
+ }
178
+ });
179
+ instance.showInterceptionMap = showBtn;
180
+ instance.typeNameMap = typeMap;
181
+ instance.statusNameMap = statusMap;
182
+ instance.showNewAddressMap = showAddress;
183
+ instance.showReturnAddressMap = showReturnAddress;
184
+ instance.showSenderMobileMap = showSender;
185
+ instance.typeOptions = Object.keys(typeObj).map(function (key) {
186
+ return {
187
+ label: key,
188
+ value: _toConsumableArray(typeObj[key]).join(',')
189
+ };
190
+ });
191
+ instance.typeConditionOptions = Object.keys(instance.typeNameMap).map(function (key) {
192
+ var type = key.split('|')[0];
193
+ return {
194
+ label: "".concat(companyTypeMap[type] || '').concat(instance.typeNameMap[key]),
195
+ value: key
196
+ };
197
+ });
198
+ instance.statusOptions = Object.keys(statusObj).map(function (key) {
199
+ return {
200
+ label: key,
201
+ value: _toConsumableArray(statusObj[key]).join(',')
202
+ };
203
+ });
204
+ var tempList = [];
205
+ var tempObj = {};
206
+ Object.keys(instance.statusNameMap).forEach(function (key) {
207
+ var type = key.split('|')[1];
208
+ if (!tempObj[type]) {
209
+ tempList.push({
210
+ label: instance.statusNameMap[key],
211
+ value: type
212
+ });
213
+ tempObj[type] = instance.statusNameMap[key];
214
+ }
215
+ });
216
+ instance.statusConditionOptions = tempList;
217
+ }).catch(function (e) {
218
+ console.log(e);
219
+ });
220
+ };
221
+ export var queryLogisticsAddressData = function queryLogisticsAddressData() {
222
+ return request({
223
+ url: "/qy/userConfig/listLogisticsAddress",
224
+ method: "get",
225
+ data: {}
226
+ }).then(function (res) {
227
+ var data = res.data;
228
+ var instance = LogisticsAddressData.getInstance();
229
+ instance.addressData = data;
230
+ }).catch(function (e) {
231
+ console.log(e);
232
+ });
233
+ };
234
+ export var queryAllLogisticsCompany = function queryAllLogisticsCompany() {
235
+ return request({
236
+ url: "/qy/logistics/company/getAllLogisticsCompany/noLogin",
237
+ method: "get",
238
+ data: {}
239
+ }).then(function (res) {
240
+ var data = res.data;
241
+ var instance = ExpressData.getInstance();
242
+ var expressList = data.logisticsCompanyDtoList.map(function (item) {
243
+ return _objectSpread(_objectSpread({}, item), {}, {
244
+ label: item.name,
245
+ value: item.cpCode
246
+ });
247
+ });
248
+ instance.expressData = expressList;
249
+ });
9
250
  };
@@ -13,7 +13,15 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
13
13
  */
14
14
  import { extend } from 'umi-request';
15
15
  import { message } from 'antd';
16
- var request = extend({});
16
+ var request = extend({
17
+ useCache: true,
18
+ ttl: 24 * 3600 * 1000,
19
+ // 缓存1天
20
+ validateCache: function validateCache(url, options) {
21
+ var _options$method;
22
+ return (options === null || options === void 0 ? void 0 : (_options$method = options.method) === null || _options$method === void 0 ? void 0 : _options$method.toLowerCase()) === 'get';
23
+ }
24
+ });
17
25
  var requestApi = function requestApi(_ref) {
18
26
  var url = _ref.url,
19
27
  method = _ref.method,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "0.26.0-alpha.8",
3
+ "version": "0.26.1-alpha.1",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -20,8 +20,8 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/basic-components": "^0.26.0-alpha.8",
24
- "@kmkf-fe-packages/kmkf-utils": "^0.26.0-alpha.8"
23
+ "@kmkf-fe-packages/basic-components": "^0.26.1-alpha.1",
24
+ "@kmkf-fe-packages/kmkf-utils": "^0.26.1-alpha.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@typescript-eslint/eslint-plugin": "^5.59.2",
@@ -37,7 +37,7 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "f90724cc688f5fd08cf9909a8c63b8d4cebb1a73",
40
+ "gitHead": "82b28b7d1fb02d0a197460143bc023a75c81ddfb",
41
41
  "gitHooks": {
42
42
  "pre-commit": "lint-staged"
43
43
  }