@kmkf-fe-packages/services-components 2.0.59 → 2.0.61
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 +43 -0
- package/dist/esm/components/Public/AsyncSelect/index.js +189 -0
- package/dist/esm/factory.d.ts +2 -2
- package/dist/esm/factory.js +3 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/type.d.ts +2 -2
- 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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComponentInterface, PickOption, ColumnConfig, ALignType, Record } from "../../../type";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare class AsyncSelect implements ComponentInterface {
|
|
4
|
+
name: string;
|
|
5
|
+
id: string;
|
|
6
|
+
sortField: string;
|
|
7
|
+
type: string;
|
|
8
|
+
rules: any[];
|
|
9
|
+
componentConfig: ComponentInterface["componentConfig"];
|
|
10
|
+
align: ALignType;
|
|
11
|
+
isCombinationComponent: boolean;
|
|
12
|
+
formField: string;
|
|
13
|
+
canSort: boolean;
|
|
14
|
+
children: ComponentInterface[];
|
|
15
|
+
dataType: ComponentInterface["dataType"];
|
|
16
|
+
asyncOptions?: any[];
|
|
17
|
+
constructor(options: PickOption);
|
|
18
|
+
getOptionsAsync(): Promise<any[]>;
|
|
19
|
+
renderClient: (record: any) => React.JSX.Element | null;
|
|
20
|
+
renderPc: (_value: any, record: Record) => React.JSX.Element;
|
|
21
|
+
renderLog: (r: Record) => React.JSX.Element | null;
|
|
22
|
+
getComponentValue: (r: Record) => any;
|
|
23
|
+
renderExport: (value: any, record: any) => any;
|
|
24
|
+
editRender: (p: any) => React.JSX.Element;
|
|
25
|
+
filterConfig: (item: ColumnConfig) => {
|
|
26
|
+
searchDefaultConditions: "in";
|
|
27
|
+
type: string;
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
filterComponentType: "AsyncSelect";
|
|
31
|
+
props: {
|
|
32
|
+
mode: string;
|
|
33
|
+
options: any[] | undefined;
|
|
34
|
+
getOptionsAsync: () => Promise<any[]>;
|
|
35
|
+
fieldNames: {
|
|
36
|
+
label: string;
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
filterFn: (value: string) => (i: Record) => boolean;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export default AsyncSelect;
|
|
@@ -0,0 +1,189 @@
|
|
|
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 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); } }
|
|
4
|
+
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); }); }; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
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); }
|
|
14
|
+
import React from "react";
|
|
15
|
+
import GetFormItem from "../../GetFormItem";
|
|
16
|
+
import { AsyncSelect as BasicAsyncSelect } from "@kmkf-fe-packages/basic-components";
|
|
17
|
+
import { servers } from "@kmkf-fe-packages/kmkf-utils";
|
|
18
|
+
import ItemView from "../../../commonComponents/ItemView";
|
|
19
|
+
import { filterFn as _filterFn } from "@kmkf-fe-packages/kmkf-utils";
|
|
20
|
+
import { SYMBOL } from "../../../constant";
|
|
21
|
+
import { isNil } from "lodash";
|
|
22
|
+
var typeMap = {
|
|
23
|
+
GY_PAYMENT_METHOD: {
|
|
24
|
+
key: "gyPaymentMethod",
|
|
25
|
+
name: "管易支付方式",
|
|
26
|
+
api: servers.GY.getTradePaymentDataAsync
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var AsyncSelect = /*#__PURE__*/function () {
|
|
30
|
+
// options: ComponentInterface["options"];
|
|
31
|
+
|
|
32
|
+
function AsyncSelect(options) {
|
|
33
|
+
var _this = this,
|
|
34
|
+
_typeMap$options$type,
|
|
35
|
+
_typeMap$options$type2;
|
|
36
|
+
_classCallCheck(this, AsyncSelect);
|
|
37
|
+
_defineProperty(this, "name", void 0);
|
|
38
|
+
_defineProperty(this, "id", void 0);
|
|
39
|
+
_defineProperty(this, "sortField", void 0);
|
|
40
|
+
_defineProperty(this, "type", void 0);
|
|
41
|
+
_defineProperty(this, "rules", void 0);
|
|
42
|
+
_defineProperty(this, "componentConfig", void 0);
|
|
43
|
+
_defineProperty(this, "align", void 0);
|
|
44
|
+
_defineProperty(this, "isCombinationComponent", void 0);
|
|
45
|
+
_defineProperty(this, "formField", void 0);
|
|
46
|
+
_defineProperty(this, "canSort", void 0);
|
|
47
|
+
_defineProperty(this, "children", void 0);
|
|
48
|
+
_defineProperty(this, "dataType", void 0);
|
|
49
|
+
_defineProperty(this, "asyncOptions", void 0);
|
|
50
|
+
_defineProperty(this, "renderClient", function (record) {
|
|
51
|
+
var value = record === null || record === void 0 ? void 0 : record[_this.id];
|
|
52
|
+
return !isNil(value) ? /*#__PURE__*/React.createElement(ItemView, {
|
|
53
|
+
id: _this.id,
|
|
54
|
+
label: _this.name,
|
|
55
|
+
value: /*#__PURE__*/React.createElement(BasicAsyncSelect, {
|
|
56
|
+
value: value,
|
|
57
|
+
getOptionsAsync: _this.getOptionsAsync.bind(_this),
|
|
58
|
+
showOnly: true
|
|
59
|
+
})
|
|
60
|
+
}) : null;
|
|
61
|
+
});
|
|
62
|
+
_defineProperty(this, "renderPc", function (_value, record) {
|
|
63
|
+
var value = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(typeMap[_this.type].key)];
|
|
64
|
+
return /*#__PURE__*/React.createElement("span", null, isNil(value) ? "--" : /*#__PURE__*/React.createElement(BasicAsyncSelect, {
|
|
65
|
+
value: value,
|
|
66
|
+
getOptionsAsync: _this.getOptionsAsync.bind(_this),
|
|
67
|
+
showOnly: true
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(this, "renderLog", function (r) {
|
|
71
|
+
var _typeMap$_this$type;
|
|
72
|
+
var value = r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_").concat((_typeMap$_this$type = typeMap[_this.type]) === null || _typeMap$_this$type === void 0 ? void 0 : _typeMap$_this$type.key)];
|
|
73
|
+
if (isNil(value)) return null;
|
|
74
|
+
return _this.renderPc(undefined, r);
|
|
75
|
+
});
|
|
76
|
+
_defineProperty(this, "getComponentValue", function (r) {
|
|
77
|
+
var _typeMap$_this$type2;
|
|
78
|
+
return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_").concat((_typeMap$_this$type2 = typeMap[_this.type]) === null || _typeMap$_this$type2 === void 0 ? void 0 : _typeMap$_this$type2.key)];
|
|
79
|
+
});
|
|
80
|
+
_defineProperty(this, "renderExport", function (value, record) {
|
|
81
|
+
var val = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(typeMap[_this.type].key)];
|
|
82
|
+
var list = _this.asyncOptions || [];
|
|
83
|
+
var seletedItem = list.find(function (item) {
|
|
84
|
+
return item.value === val;
|
|
85
|
+
});
|
|
86
|
+
return seletedItem ? seletedItem.label : val !== null && val !== void 0 ? val : "--";
|
|
87
|
+
});
|
|
88
|
+
_defineProperty(this, "editRender", function (p) {
|
|
89
|
+
var _this$componentConfig, _this$componentConfig2, _this$componentConfig3, _this$componentConfig4;
|
|
90
|
+
return /*#__PURE__*/React.createElement(GetFormItem, {
|
|
91
|
+
title: _this.name,
|
|
92
|
+
name: _this.id,
|
|
93
|
+
rules: _this.rules,
|
|
94
|
+
hidden: p === null || p === void 0 ? void 0 : p.hidden,
|
|
95
|
+
display: p === null || p === void 0 ? void 0 : p.display,
|
|
96
|
+
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
|
+
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
|
+
component: /*#__PURE__*/React.createElement(BasicAsyncSelect, _extends({}, _this.componentConfig, {
|
|
99
|
+
placeholder: "\u8BF7\u9009\u62E9".concat(_this.name),
|
|
100
|
+
getOptionsAsync: _this.getOptionsAsync.bind(_this),
|
|
101
|
+
onChange: p === null || p === void 0 ? void 0 : p.onChange
|
|
102
|
+
}))
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
_defineProperty(this, "filterConfig", function (item) {
|
|
106
|
+
var _typeMap$_this$type3;
|
|
107
|
+
return {
|
|
108
|
+
searchDefaultConditions: SYMBOL.in,
|
|
109
|
+
type: item.type,
|
|
110
|
+
id: "".concat(item.id, "_").concat((_typeMap$_this$type3 = typeMap[_this.type]) === null || _typeMap$_this$type3 === void 0 ? void 0 : _typeMap$_this$type3.key),
|
|
111
|
+
name: "".concat(_this.name),
|
|
112
|
+
filterComponentType: "AsyncSelect",
|
|
113
|
+
props: {
|
|
114
|
+
mode: "multiple",
|
|
115
|
+
options: _this.asyncOptions,
|
|
116
|
+
getOptionsAsync: _this.getOptionsAsync.bind(_this),
|
|
117
|
+
fieldNames: {
|
|
118
|
+
label: "label",
|
|
119
|
+
value: "value"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
filterFn: function filterFn(value) {
|
|
123
|
+
return function (i) {
|
|
124
|
+
var _typeMap$_this$type4;
|
|
125
|
+
return _filterFn.filterSplitComma(_filterFn.filterTableListItemColumnValue(i, item.id, (_typeMap$_this$type4 = typeMap[_this.type]) === null || _typeMap$_this$type4 === void 0 ? void 0 : _typeMap$_this$type4.key), value);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
this.name = options.name;
|
|
131
|
+
this.id = options.id;
|
|
132
|
+
this.sortField = "".concat(options.id, "_").concat((_typeMap$options$type = typeMap[options.type]) === null || _typeMap$options$type === void 0 ? void 0 : _typeMap$options$type.key);
|
|
133
|
+
this.formField = "".concat(options.id, "_").concat((_typeMap$options$type2 = typeMap[options.type]) === null || _typeMap$options$type2 === void 0 ? void 0 : _typeMap$options$type2.key);
|
|
134
|
+
this.type = options.type;
|
|
135
|
+
this.componentConfig = _objectSpread({}, options.componentConfig);
|
|
136
|
+
this.isCombinationComponent = false;
|
|
137
|
+
this.canSort = false;
|
|
138
|
+
this.children = [];
|
|
139
|
+
this.dataType = "weakenArray";
|
|
140
|
+
this.rules = [];
|
|
141
|
+
this.align = "left";
|
|
142
|
+
this.getOptionsAsync().then(function (list) {
|
|
143
|
+
_this.asyncOptions = list;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
_createClass(AsyncSelect, [{
|
|
147
|
+
key: "getOptionsAsync",
|
|
148
|
+
value: function () {
|
|
149
|
+
var _getOptionsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
150
|
+
var options, _typeMap$this$type, _typeMap$this$type$ap;
|
|
151
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
152
|
+
while (1) switch (_context.prev = _context.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
options = [];
|
|
155
|
+
_context.prev = 1;
|
|
156
|
+
_context.next = 4;
|
|
157
|
+
return (_typeMap$this$type = typeMap[this.type]) === null || _typeMap$this$type === void 0 ? void 0 : (_typeMap$this$type$ap = _typeMap$this$type.api) === null || _typeMap$this$type$ap === void 0 ? void 0 : _typeMap$this$type$ap.call(_typeMap$this$type);
|
|
158
|
+
case 4:
|
|
159
|
+
_context.t0 = _context.sent;
|
|
160
|
+
if (_context.t0) {
|
|
161
|
+
_context.next = 7;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
_context.t0 = [];
|
|
165
|
+
case 7:
|
|
166
|
+
options = _context.t0;
|
|
167
|
+
_context.next = 13;
|
|
168
|
+
break;
|
|
169
|
+
case 10:
|
|
170
|
+
_context.prev = 10;
|
|
171
|
+
_context.t1 = _context["catch"](1);
|
|
172
|
+
console.debug("api error", _context.t1);
|
|
173
|
+
case 13:
|
|
174
|
+
return _context.abrupt("return", options);
|
|
175
|
+
case 14:
|
|
176
|
+
case "end":
|
|
177
|
+
return _context.stop();
|
|
178
|
+
}
|
|
179
|
+
}, _callee, this, [[1, 10]]);
|
|
180
|
+
}));
|
|
181
|
+
function getOptionsAsync() {
|
|
182
|
+
return _getOptionsAsync.apply(this, arguments);
|
|
183
|
+
}
|
|
184
|
+
return getOptionsAsync;
|
|
185
|
+
}()
|
|
186
|
+
}]);
|
|
187
|
+
return AsyncSelect;
|
|
188
|
+
}();
|
|
189
|
+
export default AsyncSelect;
|
package/dist/esm/factory.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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 } from "./index";
|
|
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 } from "./index";
|
|
2
2
|
import { PickOption } from "./type";
|
|
3
|
-
export declare const factory: (type: string, options: PickOption) => BsLogistics | GyReissue | GyReturn |
|
|
3
|
+
export declare const factory: (type: string, options: PickOption) => BsLogistics | GyReissue | GyReturn | BasicPicture | BasicPicturePro | PublicExchange | PublicReissueGoods | ReissueLogistics | BasicSelect | StatusSelect | BasicDataTime | TradeDateTime | TradeId | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicRadio | BasicTextArea | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | SubForm | CommonDataTime | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | BsE3Reissue | BsExchange | BsReissue | BsReturn | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | MsgStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods | AsyncSelect;
|
package/dist/esm/factory.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, 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, LogisticsMoreInterception, LogisticsTrajectory, LogisticsMoreTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect,
|
|
2
2
|
// CommonTradeId,
|
|
3
|
-
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 } from "./index";
|
|
3
|
+
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 } from "./index";
|
|
4
4
|
export var factory = function factory(type, options) {
|
|
5
5
|
var _options$componentCon;
|
|
6
6
|
switch (type) {
|
|
@@ -220,6 +220,8 @@ export var factory = function factory(type, options) {
|
|
|
220
220
|
return new CommonMultiStatus(options);
|
|
221
221
|
case "MSG_STATUS":
|
|
222
222
|
return new MsgStatus(options);
|
|
223
|
+
case "GY_PAYMENT_METHOD":
|
|
224
|
+
return new AsyncSelect(options);
|
|
223
225
|
// case "REISSUE_TRADE_ID":
|
|
224
226
|
// case 'EXCHANGE_TRADE_ID':
|
|
225
227
|
// return new CommonTradeId(options);
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export { default as AfterSalesOrderId } from "./components/AfterSalesOrderId";
|
|
|
93
93
|
export { default as GyGoods } from "./components/GY/GyGoods";
|
|
94
94
|
export { default as GyReissue } from "./components/GY/GyReissue";
|
|
95
95
|
export { default as GyReturn } from "./components/GY/GyReturn";
|
|
96
|
+
export { default as AsyncSelect } from "./components/Public/AsyncSelect";
|
|
96
97
|
export { default as KmErpOrderNum } from "./components/ErpTradeId/components/OrderNum";
|
|
97
98
|
export { factory } from "./factory";
|
|
98
99
|
export { default as PlatformAvatar } from "./commonComponents/PlatformAvatar";
|
package/dist/esm/index.js
CHANGED
|
@@ -93,6 +93,7 @@ export { default as AfterSalesOrderId } from "./components/AfterSalesOrderId";
|
|
|
93
93
|
export { default as GyGoods } from "./components/GY/GyGoods";
|
|
94
94
|
export { default as GyReissue } from "./components/GY/GyReissue";
|
|
95
95
|
export { default as GyReturn } from "./components/GY/GyReturn";
|
|
96
|
+
export { default as AsyncSelect } from "./components/Public/AsyncSelect";
|
|
96
97
|
// TODO: ERP 打款工单使用
|
|
97
98
|
export { default as KmErpOrderNum } from "./components/ErpTradeId/components/OrderNum";
|
|
98
99
|
export { factory } from "./factory";
|
package/dist/esm/type.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare type FilterConfigType = {
|
|
|
32
32
|
filterFn?: (p: any) => (r: Record) => unknown;
|
|
33
33
|
formatFilterValue?: (p: any) => any;
|
|
34
34
|
};
|
|
35
|
-
export declare type FilterComponentType =
|
|
35
|
+
export declare type FilterComponentType = "MultipleSelect" | "Input" | "Date" | "Cascader" | "ShopList" | "Rate" | "SelectInput" | "AsyncSelect";
|
|
36
36
|
export interface ComponentInterface {
|
|
37
37
|
transformValue?: (val: any, record?: any, parentName?: string) => any;
|
|
38
38
|
id: string;
|
|
@@ -256,7 +256,7 @@ export interface ComponentInterface {
|
|
|
256
256
|
* @param p
|
|
257
257
|
* @returns
|
|
258
258
|
*/
|
|
259
|
-
renderExport: (value: any, record: Record) => string | number | undefined | null
|
|
259
|
+
renderExport: (value: any, record: Record) => (string | number | undefined | null) | Promise<string | number | undefined | null>;
|
|
260
260
|
/**
|
|
261
261
|
* 编辑渲染
|
|
262
262
|
*/
|
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.61",
|
|
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.61",
|
|
25
|
+
"@kmkf-fe-packages/kmkf-utils": "2.0.61",
|
|
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": "ef08879d621387f54844cfea45999ff003326c7d",
|
|
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;
|