wt-enjoy-link-antd-repack 4.1.17
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +26 -0
- package/dist/esm/assets/location.png +0 -0
- package/dist/esm/component/BiuAButton/index.d.ts +18 -0
- package/dist/esm/component/BiuAButton/index.js +8 -0
- package/dist/esm/component/BiuACard/index.d.ts +2 -0
- package/dist/esm/component/BiuACard/index.js +9 -0
- package/dist/esm/component/BiuACascader/index.d.ts +10 -0
- package/dist/esm/component/BiuACascader/index.js +8 -0
- package/dist/esm/component/BiuADatePicker/index.d.ts +19 -0
- package/dist/esm/component/BiuADatePicker/index.js +18 -0
- package/dist/esm/component/BiuAForm/index.d.ts +7 -0
- package/dist/esm/component/BiuAForm/index.js +10 -0
- package/dist/esm/component/BiuAInput/index.d.ts +14 -0
- package/dist/esm/component/BiuAInput/index.js +32 -0
- package/dist/esm/component/BiuASelect/index.d.ts +6 -0
- package/dist/esm/component/BiuASelect/index.js +14 -0
- package/dist/esm/component/BiuASwitch/index.d.ts +2 -0
- package/dist/esm/component/BiuASwitch/index.js +9 -0
- package/dist/esm/component/BiuATimePicker/index.d.ts +4 -0
- package/dist/esm/component/BiuATimePicker/index.js +8 -0
- package/dist/esm/component/BiuATreeSelect/index.d.ts +2 -0
- package/dist/esm/component/BiuATreeSelect/index.js +8 -0
- package/dist/esm/component/BiuBar/index.d.ts +13 -0
- package/dist/esm/component/BiuBar/index.js +42 -0
- package/dist/esm/component/BiuComSelect/index.d.ts +24 -0
- package/dist/esm/component/BiuComSelect/index.js +104 -0
- package/dist/esm/component/BiuCue/index.d.ts +18 -0
- package/dist/esm/component/BiuCue/index.js +44 -0
- package/dist/esm/component/BiuCustomSelect/index.d.ts +19 -0
- package/dist/esm/component/BiuCustomSelect/index.js +153 -0
- package/dist/esm/component/BiuCustomTable/index.d.ts +14 -0
- package/dist/esm/component/BiuCustomTable/index.js +76 -0
- package/dist/esm/component/BiuCustomerOperCard/component/editTable.d.ts +8 -0
- package/dist/esm/component/BiuCustomerOperCard/component/editTable.js +264 -0
- package/dist/esm/component/BiuCustomerOperCard/component/index.d.ts +1 -0
- package/dist/esm/component/BiuCustomerOperCard/component/index.js +1 -0
- package/dist/esm/component/BiuCustomerOperCard/index.d.ts +20 -0
- package/dist/esm/component/BiuCustomerOperCard/index.js +56 -0
- package/dist/esm/component/BiuCustomerOperCard/type.d.ts +117 -0
- package/dist/esm/component/BiuCustomerOperCard/type.js +1 -0
- package/dist/esm/component/BiuCustomerOperCard/utils.d.ts +48 -0
- package/dist/esm/component/BiuCustomerOperCard/utils.js +236 -0
- package/dist/esm/component/BiuDescriptions/index.d.ts +9 -0
- package/dist/esm/component/BiuDescriptions/index.js +39 -0
- package/dist/esm/component/BiuDetailDrawer/index.d.ts +15 -0
- package/dist/esm/component/BiuDetailDrawer/index.js +54 -0
- package/dist/esm/component/BiuDivider/index.d.ts +4 -0
- package/dist/esm/component/BiuDivider/index.js +29 -0
- package/dist/esm/component/BiuField/component/AddressTableSelect.d.ts +3 -0
- package/dist/esm/component/BiuField/component/AddressTableSelect.js +150 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/hooks/index.d.ts +3 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/hooks/index.js +3 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/hooks/useConvertSubValue.d.ts +2 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/hooks/useConvertSubValue.js +49 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/hooks/useConvertUnSubValue.d.ts +2 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/hooks/useConvertUnSubValue.js +98 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/hooks/useInConvertUnSubValue.d.ts +5 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/hooks/useInConvertUnSubValue.js +82 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/index.d.ts +14 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/index.js +393 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/type.d.ts +123 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/type.js +1 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/utils.d.ts +5 -0
- package/dist/esm/component/BiuField/component/DepartOrgSelect/utils.js +59 -0
- package/dist/esm/component/BiuField/component/OMSSystem/cityAreaSelect.d.ts +12 -0
- package/dist/esm/component/BiuField/component/OMSSystem/cityAreaSelect.js +130 -0
- package/dist/esm/component/BiuField/component/OMSSystem/warehouseSel.d.ts +7 -0
- package/dist/esm/component/BiuField/component/OMSSystem/warehouseSel.js +80 -0
- package/dist/esm/component/BiuField/component/SNInput.d.ts +13 -0
- package/dist/esm/component/BiuField/component/SNInput.js +622 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/addressSelect.d.ts +23 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/addressSelect.js +187 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/base.d.ts +13 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/base.js +153 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/goodSelect.d.ts +21 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/goodSelect.js +238 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/index.d.ts +3 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/index.js +66 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/interface.d.ts +16 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/interface.js +1 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/locationSelect.d.ts +24 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/locationSelect.js +164 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/package.d.ts +3 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/package.js +149 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/supplierSelect.d.ts +18 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/supplierSelect.js +145 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/warehouseAreaSelect.d.ts +3 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/warehouseAreaSelect.js +113 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/warehouseInfoSelects.d.ts +18 -0
- package/dist/esm/component/BiuField/component/TableSelectLocal/warehouseInfoSelects.js +100 -0
- package/dist/esm/component/BiuField/component/appliedgoodsTypeSelect.d.ts +9 -0
- package/dist/esm/component/BiuField/component/appliedgoodsTypeSelect.js +75 -0
- package/dist/esm/component/BiuField/component/autoComplete.d.ts +8 -0
- package/dist/esm/component/BiuField/component/autoComplete.js +82 -0
- package/dist/esm/component/BiuField/component/boxTypeSelect.d.ts +11 -0
- package/dist/esm/component/BiuField/component/boxTypeSelect.js +139 -0
- package/dist/esm/component/BiuField/component/businessdistrictselect.d.ts +55 -0
- package/dist/esm/component/BiuField/component/businessdistrictselect.js +414 -0
- package/dist/esm/component/BiuField/component/carrierInfoSelect.d.ts +13 -0
- package/dist/esm/component/BiuField/component/carrierInfoSelect.js +145 -0
- package/dist/esm/component/BiuField/component/channelSelect.d.ts +8 -0
- package/dist/esm/component/BiuField/component/channelSelect.js +94 -0
- package/dist/esm/component/BiuField/component/cityAreaCascader.d.ts +11 -0
- package/dist/esm/component/BiuField/component/cityAreaCascader.js +86 -0
- package/dist/esm/component/BiuField/component/clientInfoTableSelect.d.ts +3 -0
- package/dist/esm/component/BiuField/component/clientInfoTableSelect.js +175 -0
- package/dist/esm/component/BiuField/component/customMenu.d.ts +3 -0
- package/dist/esm/component/BiuField/component/customMenu.js +110 -0
- package/dist/esm/component/BiuField/component/databaseSelect.d.ts +6 -0
- package/dist/esm/component/BiuField/component/databaseSelect.js +42 -0
- package/dist/esm/component/BiuField/component/departmentTreeSelect.d.ts +3 -0
- package/dist/esm/component/BiuField/component/departmentTreeSelect.js +107 -0
- package/dist/esm/component/BiuField/component/dicNameSelect.d.ts +12 -0
- package/dist/esm/component/BiuField/component/dicNameSelect.js +53 -0
- package/dist/esm/component/BiuField/component/dicTypeSelect.d.ts +41 -0
- package/dist/esm/component/BiuField/component/dicTypeSelect.js +84 -0
- package/dist/esm/component/BiuField/component/dockingPartySelect.d.ts +8 -0
- package/dist/esm/component/BiuField/component/dockingPartySelect.js +63 -0
- package/dist/esm/component/BiuField/component/editLocationSelect.d.ts +18 -0
- package/dist/esm/component/BiuField/component/editLocationSelect.js +119 -0
- package/dist/esm/component/BiuField/component/electronicFaceSheet/accountSelect.d.ts +3 -0
- package/dist/esm/component/BiuField/component/electronicFaceSheet/accountSelect.js +36 -0
- package/dist/esm/component/BiuField/component/electronicFaceSheet/addresSelect.d.ts +14 -0
- package/dist/esm/component/BiuField/component/electronicFaceSheet/addresSelect.js +97 -0
- package/dist/esm/component/BiuField/component/electronicFaceSheet/platformSelect.d.ts +7 -0
- package/dist/esm/component/BiuField/component/electronicFaceSheet/platformSelect.js +73 -0
- package/dist/esm/component/BiuField/component/goodsTypeSelect.d.ts +10 -0
- package/dist/esm/component/BiuField/component/goodsTypeSelect.js +92 -0
- package/dist/esm/component/BiuField/component/index.d.ts +37 -0
- package/dist/esm/component/BiuField/component/index.js +37 -0
- package/dist/esm/component/BiuField/component/interfaceNameSelect.d.ts +9 -0
- package/dist/esm/component/BiuField/component/interfaceNameSelect.js +65 -0
- package/dist/esm/component/BiuField/component/lpnSelect.d.ts +3 -0
- package/dist/esm/component/BiuField/component/lpnSelect.js +88 -0
- package/dist/esm/component/BiuField/component/orderTypeSelect.d.ts +15 -0
- package/dist/esm/component/BiuField/component/orderTypeSelect.js +79 -0
- package/dist/esm/component/BiuField/component/orderTypeTableSelect.d.ts +3 -0
- package/dist/esm/component/BiuField/component/orderTypeTableSelect.js +45 -0
- package/dist/esm/component/BiuField/component/parkSelect.d.ts +12 -0
- package/dist/esm/component/BiuField/component/parkSelect.js +88 -0
- package/dist/esm/component/BiuField/component/personnelinfoselect.d.ts +57 -0
- package/dist/esm/component/BiuField/component/personnelinfoselect.js +431 -0
- package/dist/esm/component/BiuField/component/propertNameSelect.d.ts +9 -0
- package/dist/esm/component/BiuField/component/propertNameSelect.js +114 -0
- package/dist/esm/component/BiuField/component/shipperTableSelect.d.ts +3 -0
- package/dist/esm/component/BiuField/component/shipperTableSelect.js +94 -0
- package/dist/esm/component/BiuField/component/userSelect.d.ts +8 -0
- package/dist/esm/component/BiuField/component/userSelect.js +163 -0
- package/dist/esm/component/BiuField/component/warehouseAreaSelect.d.ts +9 -0
- package/dist/esm/component/BiuField/component/warehouseAreaSelect.js +103 -0
- package/dist/esm/component/BiuField/component/warehouseInfoSelect.d.ts +13 -0
- package/dist/esm/component/BiuField/component/warehouseInfoSelect.js +92 -0
- package/dist/esm/component/BiuField/component/warehouseLoctionSelect.d.ts +14 -0
- package/dist/esm/component/BiuField/component/warehouseLoctionSelect.js +124 -0
- package/dist/esm/component/BiuField/index.d.ts +8 -0
- package/dist/esm/component/BiuField/index.js +607 -0
- package/dist/esm/component/BiuFileInput/index.d.ts +11 -0
- package/dist/esm/component/BiuFileInput/index.js +53 -0
- package/dist/esm/component/BiuForm/index.d.ts +12 -0
- package/dist/esm/component/BiuForm/index.js +241 -0
- package/dist/esm/component/BiuForm/type.d.ts +45 -0
- package/dist/esm/component/BiuForm/type.js +1 -0
- package/dist/esm/component/BiuForm/utils.d.ts +2 -0
- package/dist/esm/component/BiuForm/utils.js +46 -0
- package/dist/esm/component/BiuIcon/index.d.ts +3 -0
- package/dist/esm/component/BiuIcon/index.js +15 -0
- package/dist/esm/component/BiuMapSelectSite/index.d.ts +48 -0
- package/dist/esm/component/BiuMapSelectSite/index.js +453 -0
- package/dist/esm/component/BiuModal/index.d.ts +24 -0
- package/dist/esm/component/BiuModal/index.js +239 -0
- package/dist/esm/component/BiuOperForm/index.d.ts +15 -0
- package/dist/esm/component/BiuOperForm/index.js +375 -0
- package/dist/esm/component/BiuOperForm/type.d.ts +23 -0
- package/dist/esm/component/BiuOperForm/type.js +1 -0
- package/dist/esm/component/BiuOperTable/index.d.ts +15 -0
- package/dist/esm/component/BiuOperTable/index.js +349 -0
- package/dist/esm/component/BiuOperTable/type.d.ts +142 -0
- package/dist/esm/component/BiuOperTable/type.js +1 -0
- package/dist/esm/component/BiuOperTable/utils.d.ts +6 -0
- package/dist/esm/component/BiuOperTable/utils.js +13 -0
- package/dist/esm/component/BiuPagination/index.d.ts +14 -0
- package/dist/esm/component/BiuPagination/index.js +34 -0
- package/dist/esm/component/BiuResizeTable/component/biuTableCell.d.ts +1 -0
- package/dist/esm/component/BiuResizeTable/component/biuTableCell.js +74 -0
- package/dist/esm/component/BiuResizeTable/component/index.d.ts +1 -0
- package/dist/esm/component/BiuResizeTable/component/index.js +1 -0
- package/dist/esm/component/BiuResizeTable/index.d.ts +2 -0
- package/dist/esm/component/BiuResizeTable/index.js +71 -0
- package/dist/esm/component/BiuResizeTable/index.less +19 -0
- package/dist/esm/component/BiuSplit/index.d.ts +32 -0
- package/dist/esm/component/BiuSplit/index.js +57 -0
- package/dist/esm/component/BiuTable/component/index.d.ts +3 -0
- package/dist/esm/component/BiuTable/component/index.js +3 -0
- package/dist/esm/component/BiuTable/component/tableActionBarRender.d.ts +9 -0
- package/dist/esm/component/BiuTable/component/tableActionBarRender.js +88 -0
- package/dist/esm/component/BiuTable/component/tableCellRender.d.ts +14 -0
- package/dist/esm/component/BiuTable/component/tableCellRender.js +108 -0
- package/dist/esm/component/BiuTable/component/tableSettingRender.d.ts +2 -0
- package/dist/esm/component/BiuTable/component/tableSettingRender.js +345 -0
- package/dist/esm/component/BiuTable/context.d.ts +2 -0
- package/dist/esm/component/BiuTable/context.js +2 -0
- package/dist/esm/component/BiuTable/hooks/index.d.ts +1 -0
- package/dist/esm/component/BiuTable/hooks/index.js +1 -0
- package/dist/esm/component/BiuTable/hooks/useFetchData.d.ts +4 -0
- package/dist/esm/component/BiuTable/hooks/useFetchData.js +64 -0
- package/dist/esm/component/BiuTable/index.d.ts +42 -0
- package/dist/esm/component/BiuTable/index.js +484 -0
- package/dist/esm/component/BiuTable/type.d.ts +168 -0
- package/dist/esm/component/BiuTable/type.js +1 -0
- package/dist/esm/component/BiuTable/utils.d.ts +10 -0
- package/dist/esm/component/BiuTable/utils.js +117 -0
- package/dist/esm/component/BiuTableLink/index.d.ts +11 -0
- package/dist/esm/component/BiuTableLink/index.js +54 -0
- package/dist/esm/component/BiuTableSelect/index.d.ts +49 -0
- package/dist/esm/component/BiuTableSelect/index.js +209 -0
- package/dist/esm/component/BiuTabs/index.d.ts +4 -0
- package/dist/esm/component/BiuTabs/index.js +18 -0
- package/dist/esm/component/BiuVirtualTable/index.d.ts +21 -0
- package/dist/esm/component/BiuVirtualTable/index.js +161 -0
- package/dist/esm/component/index.d.ts +35 -0
- package/dist/esm/component/index.js +35 -0
- package/dist/esm/constant/Cache_Key.d.ts +28 -0
- package/dist/esm/constant/Cache_Key.js +28 -0
- package/dist/esm/constant/DateTime.d.ts +12 -0
- package/dist/esm/constant/DateTime.js +15 -0
- package/dist/esm/constant/External.d.ts +64 -0
- package/dist/esm/constant/External.js +260 -0
- package/dist/esm/constant/Gateway_Path.d.ts +5 -0
- package/dist/esm/constant/Gateway_Path.js +5 -0
- package/dist/esm/constant/Layout.d.ts +210 -0
- package/dist/esm/constant/Layout.js +215 -0
- package/dist/esm/constant/Regexp.d.ts +109 -0
- package/dist/esm/constant/Regexp.js +130 -0
- package/dist/esm/constant/index.d.ts +6 -0
- package/dist/esm/constant/index.js +6 -0
- package/dist/esm/hooks/index.d.ts +6 -0
- package/dist/esm/hooks/index.js +6 -0
- package/dist/esm/hooks/useAuth.d.ts +4 -0
- package/dist/esm/hooks/useAuth.js +22 -0
- package/dist/esm/hooks/useCurrentSystem.d.ts +6 -0
- package/dist/esm/hooks/useCurrentSystem.js +15 -0
- package/dist/esm/hooks/useLayoutInfo.d.ts +10 -0
- package/dist/esm/hooks/useLayoutInfo.js +14 -0
- package/dist/esm/hooks/useReducerState.d.ts +16 -0
- package/dist/esm/hooks/useReducerState.js +43 -0
- package/dist/esm/hooks/useUserInfo.d.ts +4 -0
- package/dist/esm/hooks/useUserInfo.js +15 -0
- package/dist/esm/hooks/useWareInfo.d.ts +4 -0
- package/dist/esm/hooks/useWareInfo.js +15 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/package/index.d.ts +1 -0
- package/dist/esm/package/index.js +1 -0
- package/dist/esm/package/requestWrapper/baseRequest.d.ts +3 -0
- package/dist/esm/package/requestWrapper/baseRequest.js +47 -0
- package/dist/esm/package/requestWrapper/index.d.ts +4 -0
- package/dist/esm/package/requestWrapper/index.js +402 -0
- package/dist/esm/package/requestWrapper/type.d.ts +36 -0
- package/dist/esm/package/requestWrapper/type.js +1 -0
- package/dist/esm/package/requestWrapper/utils.d.ts +10 -0
- package/dist/esm/package/requestWrapper/utils.js +35 -0
- package/dist/esm/utils/authUtils.d.ts +18 -0
- package/dist/esm/utils/authUtils.js +36 -0
- package/dist/esm/utils/cacheUtils.d.ts +4 -0
- package/dist/esm/utils/cacheUtils.js +24 -0
- package/dist/esm/utils/chainUtils.d.ts +26 -0
- package/dist/esm/utils/chainUtils.js +54 -0
- package/dist/esm/utils/dateUtils.d.ts +23 -0
- package/dist/esm/utils/dateUtils.js +55 -0
- package/dist/esm/utils/decimalUtils.d.ts +5 -0
- package/dist/esm/utils/decimalUtils.js +7 -0
- package/dist/esm/utils/excelUtils.d.ts +22 -0
- package/dist/esm/utils/excelUtils.js +153 -0
- package/dist/esm/utils/index.d.ts +11 -0
- package/dist/esm/utils/index.js +11 -0
- package/dist/esm/utils/layoutUtils.d.ts +1 -0
- package/dist/esm/utils/layoutUtils.js +13 -0
- package/dist/esm/utils/objectUtils.d.ts +1 -0
- package/dist/esm/utils/objectUtils.js +3 -0
- package/dist/esm/utils/soundUtils.d.ts +5 -0
- package/dist/esm/utils/soundUtils.js +29 -0
- package/dist/esm/utils/stringUtils.d.ts +24 -0
- package/dist/esm/utils/stringUtils.js +39 -0
- package/dist/esm/utils/sysUtils.d.ts +4 -0
- package/dist/esm/utils/sysUtils.js +4 -0
- package/package.json +59 -0
@@ -0,0 +1,402 @@
|
|
1
|
+
var _excluded = ["current", "pageSize"],
|
2
|
+
_excluded2 = ["data"],
|
3
|
+
_excluded3 = ["data"];
|
4
|
+
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
5
|
+
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); } }
|
6
|
+
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); }); }; }
|
7
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
13
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
14
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
15
|
+
import { notification } from 'antd';
|
16
|
+
import { pick, sortBy } from 'lodash';
|
17
|
+
import { BasicRequest } from "./baseRequest";
|
18
|
+
import { generalRequestURI } from "./utils";
|
19
|
+
import { BUBU100_CACHE_WAREINFO_KEY } from "../../constant";
|
20
|
+
import { IsSubSYS, cacheDB, clearAuthToken, clearToken, getAuthToken, getToken, setAuthToken } from "../../utils";
|
21
|
+
|
22
|
+
/**
|
23
|
+
* 系统触发请求的时候是以模块为单位的,除了登陆到系统进行加载的时候,其他请求都是在模块内部进行的且还是通过手动触发的
|
24
|
+
* 所以这里只考虑某个系统内部请求的时候,对错误提示信息进行处理
|
25
|
+
*/
|
26
|
+
|
27
|
+
/**
|
28
|
+
* 重构请求数据,删除不需要的原始数据
|
29
|
+
* 格式化日期对象
|
30
|
+
* @param data 原始数据
|
31
|
+
*/
|
32
|
+
var RequestDataFormat = function RequestDataFormat(data) {
|
33
|
+
return Object.keys(data).reduce(function (obj, currentKey) {
|
34
|
+
var activeData = data[currentKey];
|
35
|
+
|
36
|
+
// 数组、null、对象都会判断为 object
|
37
|
+
if (_typeof(activeData) === 'object' && activeData && !Array(activeData)) {
|
38
|
+
if (activeData.BASE_FIELD) {
|
39
|
+
return _objectSpread({}, obj);
|
40
|
+
}
|
41
|
+
return _objectSpread(_objectSpread({}, obj), {}, _defineProperty({}, currentKey, RequestDataFormat(activeData)));
|
42
|
+
}
|
43
|
+
return _objectSpread(_objectSpread({}, obj), {}, _defineProperty({}, currentKey, activeData));
|
44
|
+
}, {});
|
45
|
+
};
|
46
|
+
|
47
|
+
/**
|
48
|
+
* 根据请求更新全局货主缓存
|
49
|
+
* @param baseHeader 原始请求头
|
50
|
+
* @param apiName 接口名称
|
51
|
+
*/
|
52
|
+
var generalRequestHeader = function generalRequestHeader() {
|
53
|
+
var _localStorage$getItem, _getAuthToken;
|
54
|
+
var wareHouseObject = (_localStorage$getItem = localStorage.getItem(BUBU100_CACHE_WAREINFO_KEY)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}';
|
55
|
+
var baseObj = !wareHouseObject || wareHouseObject === null || wareHouseObject === 'undefined';
|
56
|
+
var obj = JSON.parse(baseObj ? '{}' : wareHouseObject);
|
57
|
+
var headers = {
|
58
|
+
Authorization: getToken() || '',
|
59
|
+
authToken: (_getAuthToken = getAuthToken()) !== null && _getAuthToken !== void 0 ? _getAuthToken : ''
|
60
|
+
};
|
61
|
+
if (obj && obj.id) headers = _objectSpread(_objectSpread({}, headers), {}, {
|
62
|
+
warehouseId: obj.id
|
63
|
+
});
|
64
|
+
return headers;
|
65
|
+
};
|
66
|
+
|
67
|
+
/**
|
68
|
+
* 重构请求数据
|
69
|
+
* @param baseData 基础请求数据
|
70
|
+
* @param beanName 后端接收 bean
|
71
|
+
*/
|
72
|
+
var GeneralRequestData = function GeneralRequestData(data, beanName) {
|
73
|
+
if (!data) return {};
|
74
|
+
var page = data.current,
|
75
|
+
size = data.pageSize,
|
76
|
+
restProps = _objectWithoutProperties(data, _excluded);
|
77
|
+
var tmpRequestData = _objectSpread({
|
78
|
+
page: page,
|
79
|
+
size: size
|
80
|
+
}, restProps);
|
81
|
+
if (!beanName || beanName === '' || beanName === null) {
|
82
|
+
return tmpRequestData;
|
83
|
+
}
|
84
|
+
return _defineProperty({}, beanName, tmpRequestData);
|
85
|
+
};
|
86
|
+
|
87
|
+
// 返回中间件
|
88
|
+
var middlewareHandler = /*#__PURE__*/function () {
|
89
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx, next) {
|
90
|
+
var req, _req$options$params, _req$options$params2, _req$options$params2$, showNotification, _req$options$params2$2, apiName, _req$options$params2$3, getResponse, requestConfig, cache, _ctx$res, _ctx$res2, _ctx$res2$data, data, response, _data$result, result, _data$success, success, _data$msg, msg, _data$code, code, urlKey, key, db, notificationKey;
|
91
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
92
|
+
while (1) switch (_context.prev = _context.next) {
|
93
|
+
case 0:
|
94
|
+
req = ctx.req;
|
95
|
+
req.options.method = 'post';
|
96
|
+
req.options.headers = generalRequestHeader();
|
97
|
+
|
98
|
+
/**
|
99
|
+
* 通过 params 获取自定义请求参数,在响应时使用
|
100
|
+
*/
|
101
|
+
_req$options$params = req.options.params, _req$options$params2 = _req$options$params === void 0 ? {} : _req$options$params, _req$options$params2$ = _req$options$params2.showNotification, showNotification = _req$options$params2$ === void 0 ? true : _req$options$params2$, _req$options$params2$2 = _req$options$params2.apiName, apiName = _req$options$params2$2 === void 0 ? '' : _req$options$params2$2, _req$options$params2$3 = _req$options$params2.getResponse, getResponse = _req$options$params2$3 === void 0 ? false : _req$options$params2$3, requestConfig = _req$options$params2.requestConfig, cache = _req$options$params2.cache;
|
102
|
+
req.options.params = {};
|
103
|
+
_context.next = 7;
|
104
|
+
return next();
|
105
|
+
case 7:
|
106
|
+
_ctx$res = ctx.res, _ctx$res2 = _ctx$res === void 0 ? {} : _ctx$res, _ctx$res2$data = _ctx$res2.data, data = _ctx$res2$data === void 0 ? {} : _ctx$res2$data, response = _ctx$res2.response;
|
107
|
+
_data$result = data.result, result = _data$result === void 0 ? {} : _data$result, _data$success = data.success, success = _data$success === void 0 ? false : _data$success, _data$msg = data.msg, msg = _data$msg === void 0 ? '' : _data$msg, _data$code = data.code, code = _data$code === void 0 ? 9999 : _data$code;
|
108
|
+
if (response.headers.get('authToken')) setAuthToken(response.headers.get('authToken'));
|
109
|
+
if (getResponse) {
|
110
|
+
ctx.res = {
|
111
|
+
result: result,
|
112
|
+
response: data
|
113
|
+
};
|
114
|
+
} else {
|
115
|
+
ctx.res = result;
|
116
|
+
}
|
117
|
+
if (!(success && +code === 0)) {
|
118
|
+
_context.next = 21;
|
119
|
+
break;
|
120
|
+
}
|
121
|
+
if (!cache) {
|
122
|
+
_context.next = 20;
|
123
|
+
break;
|
124
|
+
}
|
125
|
+
urlKey = "".concat(requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.GatewayRoute, "?api=").concat(apiName);
|
126
|
+
key = JSON.stringify({
|
127
|
+
url: urlKey,
|
128
|
+
data: sortBy(req.options.data)
|
129
|
+
});
|
130
|
+
_context.next = 17;
|
131
|
+
return cacheDB();
|
132
|
+
case 17:
|
133
|
+
db = _context.sent;
|
134
|
+
_context.next = 20;
|
135
|
+
return db.put('cache', data, key);
|
136
|
+
case 20:
|
137
|
+
return _context.abrupt("return");
|
138
|
+
case 21:
|
139
|
+
notificationKey = "notification_".concat(apiName, "_").concat(code || '9999');
|
140
|
+
if (showNotification) {
|
141
|
+
if (msg && msg !== '') {
|
142
|
+
if (code >= 601 && code <= 605 || code === 0) {
|
143
|
+
notification.open({
|
144
|
+
key: notificationKey,
|
145
|
+
message: "\u8B66\u544A",
|
146
|
+
description: msg,
|
147
|
+
duration: 3,
|
148
|
+
type: 'warning'
|
149
|
+
});
|
150
|
+
} else if (code === 100) {
|
151
|
+
notification.open({
|
152
|
+
key: notificationKey,
|
153
|
+
message: "\u9519\u8BEF\u4FE1\u606F",
|
154
|
+
description: msg,
|
155
|
+
duration: 3,
|
156
|
+
type: 'error'
|
157
|
+
});
|
158
|
+
} else if (code === 799) {
|
159
|
+
setAuthToken('');
|
160
|
+
notification.open({
|
161
|
+
key: '799',
|
162
|
+
message: '登录失效!请重新登录!',
|
163
|
+
duration: 3,
|
164
|
+
type: 'warning'
|
165
|
+
});
|
166
|
+
clearToken();
|
167
|
+
clearAuthToken();
|
168
|
+
setTimeout(function () {
|
169
|
+
if (IsSubSYS) {
|
170
|
+
window.parent.location.href = '/user/login';
|
171
|
+
} else {
|
172
|
+
window.location.href = '/user/login';
|
173
|
+
}
|
174
|
+
}, 3000);
|
175
|
+
} else {
|
176
|
+
notification.open({
|
177
|
+
key: notificationKey,
|
178
|
+
message: '错误信息',
|
179
|
+
description: '服务端请求发生错误,错误信息请查看开发者工具或联系开发人员!',
|
180
|
+
duration: 3,
|
181
|
+
type: 'info'
|
182
|
+
});
|
183
|
+
}
|
184
|
+
} else {
|
185
|
+
notification.open({
|
186
|
+
key: notificationKey,
|
187
|
+
message: '服务端请求发生错误,暂无错误信息!',
|
188
|
+
duration: 3,
|
189
|
+
type: 'info'
|
190
|
+
});
|
191
|
+
}
|
192
|
+
}
|
193
|
+
case 23:
|
194
|
+
case "end":
|
195
|
+
return _context.stop();
|
196
|
+
}
|
197
|
+
}, _callee);
|
198
|
+
}));
|
199
|
+
return function middlewareHandler(_x, _x2) {
|
200
|
+
return _ref2.apply(this, arguments);
|
201
|
+
};
|
202
|
+
}();
|
203
|
+
|
204
|
+
// 返回中间件
|
205
|
+
var middlewareHandlerV2 = /*#__PURE__*/function () {
|
206
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, next) {
|
207
|
+
var req, _req$options$params3, _req$options$params4, _req$options$params4$, showNotification, _req$options$params4$2, getResponse, _ctx$res3, _ctx$res4, _ctx$res4$data, data, response, _data$result2, result, _data$success2, success, _data$msg2, msg, _data$code2, code, notificationKey;
|
208
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
209
|
+
while (1) switch (_context2.prev = _context2.next) {
|
210
|
+
case 0:
|
211
|
+
req = ctx.req;
|
212
|
+
req.options.method = 'post';
|
213
|
+
req.options.headers = generalRequestHeader();
|
214
|
+
|
215
|
+
/**
|
216
|
+
* 通过 params 获取自定义请求参数,在响应时使用
|
217
|
+
*/
|
218
|
+
_req$options$params3 = req.options.params, _req$options$params4 = _req$options$params3 === void 0 ? {} : _req$options$params3, _req$options$params4$ = _req$options$params4.showNotification, showNotification = _req$options$params4$ === void 0 ? true : _req$options$params4$, _req$options$params4$2 = _req$options$params4.getResponse, getResponse = _req$options$params4$2 === void 0 ? false : _req$options$params4$2;
|
219
|
+
req.options.params = {};
|
220
|
+
_context2.next = 7;
|
221
|
+
return next();
|
222
|
+
case 7:
|
223
|
+
_ctx$res3 = ctx.res, _ctx$res4 = _ctx$res3 === void 0 ? {} : _ctx$res3, _ctx$res4$data = _ctx$res4.data, data = _ctx$res4$data === void 0 ? {} : _ctx$res4$data, response = _ctx$res4.response;
|
224
|
+
_data$result2 = data.result, result = _data$result2 === void 0 ? {} : _data$result2, _data$success2 = data.success, success = _data$success2 === void 0 ? false : _data$success2, _data$msg2 = data.msg, msg = _data$msg2 === void 0 ? '' : _data$msg2, _data$code2 = data.code, code = _data$code2 === void 0 ? 9999 : _data$code2;
|
225
|
+
if (response.headers.get('authToken')) setAuthToken(response.headers.get('authToken'));
|
226
|
+
if (getResponse) {
|
227
|
+
ctx.res = {
|
228
|
+
result: result,
|
229
|
+
response: data
|
230
|
+
};
|
231
|
+
} else {
|
232
|
+
ctx.res = result;
|
233
|
+
}
|
234
|
+
if (!(success && +code === 0)) {
|
235
|
+
_context2.next = 13;
|
236
|
+
break;
|
237
|
+
}
|
238
|
+
return _context2.abrupt("return");
|
239
|
+
case 13:
|
240
|
+
notificationKey = "notification_".concat(req.url, "_").concat(code || '9999');
|
241
|
+
if (!showNotification) {
|
242
|
+
_context2.next = 29;
|
243
|
+
break;
|
244
|
+
}
|
245
|
+
_context2.t0 = code;
|
246
|
+
_context2.next = _context2.t0 === 799 ? 18 : _context2.t0 === 500 ? 23 : _context2.t0 === 401 ? 25 : 27;
|
247
|
+
break;
|
248
|
+
case 18:
|
249
|
+
notification.open({
|
250
|
+
key: '799',
|
251
|
+
message: '登录失效!请重新登录!',
|
252
|
+
duration: 3,
|
253
|
+
type: 'warning'
|
254
|
+
});
|
255
|
+
clearToken();
|
256
|
+
clearAuthToken();
|
257
|
+
setTimeout(function () {
|
258
|
+
if (IsSubSYS) {
|
259
|
+
window.parent.location.href = '/user/login';
|
260
|
+
} else {
|
261
|
+
window.location.href = '/user/login';
|
262
|
+
}
|
263
|
+
}, 3000);
|
264
|
+
return _context2.abrupt("break", 29);
|
265
|
+
case 23:
|
266
|
+
notification.open({
|
267
|
+
key: notificationKey,
|
268
|
+
message: "\u7CFB\u7EDF\u670D\u52A1\u53D1\u751F\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01\u5F02\u5E38\u539F\u56E0\uFF1A",
|
269
|
+
description: msg,
|
270
|
+
duration: 3,
|
271
|
+
type: 'error'
|
272
|
+
});
|
273
|
+
return _context2.abrupt("break", 29);
|
274
|
+
case 25:
|
275
|
+
notification.open({
|
276
|
+
key: notificationKey,
|
277
|
+
message: "\u5F53\u524D\u64CD\u4F5C\u672A\u6388\u6743\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01",
|
278
|
+
duration: 3,
|
279
|
+
type: 'warning'
|
280
|
+
});
|
281
|
+
return _context2.abrupt("break", 29);
|
282
|
+
case 27:
|
283
|
+
notification.open({
|
284
|
+
key: notificationKey,
|
285
|
+
message: "\u8BF7\u6C42\u5931\u8D25\uFF01\u5931\u8D25\u539F\u56E0",
|
286
|
+
description: msg,
|
287
|
+
duration: 3,
|
288
|
+
type: 'warning'
|
289
|
+
});
|
290
|
+
return _context2.abrupt("break", 29);
|
291
|
+
case 29:
|
292
|
+
case "end":
|
293
|
+
return _context2.stop();
|
294
|
+
}
|
295
|
+
}, _callee2);
|
296
|
+
}));
|
297
|
+
return function middlewareHandlerV2(_x3, _x4) {
|
298
|
+
return _ref3.apply(this, arguments);
|
299
|
+
};
|
300
|
+
}();
|
301
|
+
export var request = /*#__PURE__*/function () {
|
302
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(props) {
|
303
|
+
var _props$requestConfig, _props$requestConfig2;
|
304
|
+
var baseUrl, requestData, urlKey, key, db, cachedResponse;
|
305
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
306
|
+
while (1) switch (_context3.prev = _context3.next) {
|
307
|
+
case 0:
|
308
|
+
// 生成请求地址
|
309
|
+
baseUrl = generalRequestURI((_props$requestConfig = props.requestConfig) !== null && _props$requestConfig !== void 0 ? _props$requestConfig : {}, props.apiName);
|
310
|
+
requestData = GeneralRequestData(props.data, props.beanName);
|
311
|
+
urlKey = "".concat((_props$requestConfig2 = props.requestConfig) === null || _props$requestConfig2 === void 0 ? void 0 : _props$requestConfig2.GatewayRoute, "?api=").concat(props.apiName);
|
312
|
+
key = JSON.stringify({
|
313
|
+
url: urlKey,
|
314
|
+
data: sortBy(requestData)
|
315
|
+
});
|
316
|
+
if (!props.cache) {
|
317
|
+
_context3.next = 19;
|
318
|
+
break;
|
319
|
+
}
|
320
|
+
_context3.prev = 5;
|
321
|
+
_context3.next = 8;
|
322
|
+
return cacheDB();
|
323
|
+
case 8:
|
324
|
+
db = _context3.sent;
|
325
|
+
_context3.next = 11;
|
326
|
+
return db.get('cache', key);
|
327
|
+
case 11:
|
328
|
+
cachedResponse = _context3.sent;
|
329
|
+
if (!cachedResponse) {
|
330
|
+
_context3.next = 14;
|
331
|
+
break;
|
332
|
+
}
|
333
|
+
return _context3.abrupt("return", cachedResponse.result);
|
334
|
+
case 14:
|
335
|
+
_context3.next = 19;
|
336
|
+
break;
|
337
|
+
case 16:
|
338
|
+
_context3.prev = 16;
|
339
|
+
_context3.t0 = _context3["catch"](5);
|
340
|
+
return _context3.abrupt("return", Promise.reject(_context3.t0));
|
341
|
+
case 19:
|
342
|
+
return _context3.abrupt("return", BasicRequest({
|
343
|
+
options: {
|
344
|
+
data: requestData,
|
345
|
+
params: _objectSpread(_objectSpread({}, pick(props, ['showNotification', 'getResponse', 'cache', 'requestConfig'])), {}, {
|
346
|
+
apiName: props.apiName
|
347
|
+
})
|
348
|
+
},
|
349
|
+
requestInterceptor: {
|
350
|
+
handler: function handler(url, _ref5) {
|
351
|
+
var data = _ref5.data,
|
352
|
+
resetOptions = _objectWithoutProperties(_ref5, _excluded2);
|
353
|
+
var iterationData = RequestDataFormat(data);
|
354
|
+
return {
|
355
|
+
url: url,
|
356
|
+
options: _objectSpread(_objectSpread({}, resetOptions), {}, {
|
357
|
+
data: iterationData
|
358
|
+
})
|
359
|
+
};
|
360
|
+
}
|
361
|
+
},
|
362
|
+
Middleware: {
|
363
|
+
handler: middlewareHandler
|
364
|
+
}
|
365
|
+
})(baseUrl));
|
366
|
+
case 20:
|
367
|
+
case "end":
|
368
|
+
return _context3.stop();
|
369
|
+
}
|
370
|
+
}, _callee3, null, [[5, 16]]);
|
371
|
+
}));
|
372
|
+
return function request(_x5) {
|
373
|
+
return _ref4.apply(this, arguments);
|
374
|
+
};
|
375
|
+
}();
|
376
|
+
export var requestV2 = function requestV2(props) {
|
377
|
+
// 生成请求地址
|
378
|
+
var baseUrl = '/api/v2' + props.apiName;
|
379
|
+
return BasicRequest({
|
380
|
+
options: {
|
381
|
+
data: GeneralRequestData(props.data, props.beanName),
|
382
|
+
params: _objectSpread({}, pick(props, ['showNotification', 'getResponse', 'apiName']))
|
383
|
+
},
|
384
|
+
requestInterceptor: {
|
385
|
+
handler: function handler(url, _ref6) {
|
386
|
+
var data = _ref6.data,
|
387
|
+
resetOptions = _objectWithoutProperties(_ref6, _excluded3);
|
388
|
+
var iterationData = RequestDataFormat(data);
|
389
|
+
return {
|
390
|
+
url: url,
|
391
|
+
options: _objectSpread(_objectSpread({}, resetOptions), {}, {
|
392
|
+
data: iterationData
|
393
|
+
})
|
394
|
+
};
|
395
|
+
}
|
396
|
+
},
|
397
|
+
Middleware: {
|
398
|
+
handler: middlewareHandlerV2
|
399
|
+
}
|
400
|
+
})(baseUrl);
|
401
|
+
};
|
402
|
+
export * from "./type";
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import type { OnionMiddleware, OnionOptions, RequestInterceptor, RequestOptionsInit, ResponseError, ResponseInterceptor } from 'umi-request';
|
2
|
+
export type RequestInterceptorSet = {
|
3
|
+
handler: RequestInterceptor;
|
4
|
+
options?: OnionOptions;
|
5
|
+
};
|
6
|
+
export type ResponseInterceptorSet = {
|
7
|
+
handler: ResponseInterceptor;
|
8
|
+
options?: OnionOptions;
|
9
|
+
};
|
10
|
+
export type MiddlewareSet = {
|
11
|
+
handler: OnionMiddleware;
|
12
|
+
options?: OnionOptions | undefined;
|
13
|
+
};
|
14
|
+
export type BasicRequestProps = {
|
15
|
+
options?: RequestOptionsInit;
|
16
|
+
requestInterceptor?: RequestInterceptorSet | RequestInterceptorSet[];
|
17
|
+
Middleware?: MiddlewareSet | MiddlewareSet[];
|
18
|
+
responseInterceptor?: ResponseInterceptorSet | ResponseInterceptorSet[];
|
19
|
+
errorHandler?: (error: ResponseError) => void;
|
20
|
+
};
|
21
|
+
export type RequestConfig = {
|
22
|
+
DefaultGateway?: string;
|
23
|
+
Version?: string | number;
|
24
|
+
GatewayRoute?: string;
|
25
|
+
};
|
26
|
+
/**
|
27
|
+
* 请求类型扩展定义
|
28
|
+
* 删除多余类型,不需要自定义
|
29
|
+
*/
|
30
|
+
export type GateWayRequestType = {
|
31
|
+
apiName: string;
|
32
|
+
beanName?: string;
|
33
|
+
requestConfig?: RequestConfig;
|
34
|
+
showNotification?: boolean;
|
35
|
+
cache?: boolean;
|
36
|
+
} & Partial<Omit<RequestOptionsInit, 'useCache' | 'ttl' | 'timeout' | 'headers' | 'responseType' | 'method'>>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { RequestConfig } from './type';
|
2
|
+
/**
|
3
|
+
*
|
4
|
+
* 根据请求配置拼接请求 URI
|
5
|
+
* @param RequestConfig
|
6
|
+
* @param apiName 接口名称
|
7
|
+
* @param isMock mock 数据
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
export declare const generalRequestURI: (requestConfig: RequestConfig | undefined, apiName: string) => string;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
var defaultRequestConfig = {
|
8
|
+
DefaultGateway: process.env.DefaultGateway,
|
9
|
+
GatewayRoute: process.env.GatewayRoute,
|
10
|
+
Version: process.env.Version
|
11
|
+
};
|
12
|
+
|
13
|
+
/**
|
14
|
+
*
|
15
|
+
* 根据请求配置拼接请求 URI
|
16
|
+
* @param RequestConfig
|
17
|
+
* @param apiName 接口名称
|
18
|
+
* @param isMock mock 数据
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
export var generalRequestURI = function generalRequestURI() {
|
22
|
+
var requestConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
23
|
+
var apiName = arguments.length > 1 ? arguments[1] : undefined;
|
24
|
+
// 前端传入时会覆盖默认环境变量
|
25
|
+
var _defaultRequestConfig = _objectSpread(_objectSpread({}, defaultRequestConfig), requestConfig),
|
26
|
+
DefaultGateway = _defaultRequestConfig.DefaultGateway,
|
27
|
+
GatewayRoute = _defaultRequestConfig.GatewayRoute,
|
28
|
+
Version = _defaultRequestConfig.Version;
|
29
|
+
|
30
|
+
// 版本号拼接字符串
|
31
|
+
var versionStr = Version && Version !== '' ? "&v=".concat(Version) : '';
|
32
|
+
|
33
|
+
// 根据网关请求拼接
|
34
|
+
return "".concat(DefaultGateway).concat(GatewayRoute, "?api=").concat(apiName).concat(versionStr);
|
35
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* 清除 token
|
3
|
+
*/
|
4
|
+
export declare function clearToken(): void;
|
5
|
+
/**
|
6
|
+
* 设置 token
|
7
|
+
* @param token token
|
8
|
+
*/
|
9
|
+
export declare function setToken(token: string): void;
|
10
|
+
/**
|
11
|
+
* 获取 token
|
12
|
+
*/
|
13
|
+
export declare function getToken(): string | null;
|
14
|
+
export declare function clearAuthToken(): void;
|
15
|
+
export declare function setAuthToken(token: string): void;
|
16
|
+
export declare function getAuthToken(): string | null;
|
17
|
+
export declare function setAuthBtnID(MenuBtnData: any[]): void;
|
18
|
+
export declare function getAuthBtnID(location: any): void;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { BUBU100_CACHE_AUTH_TOKEN_KEY, BUBU100_CACHE_TOKEN_KEY } from "../constant";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* 清除 token
|
5
|
+
*/
|
6
|
+
export function clearToken() {
|
7
|
+
sessionStorage.removeItem(BUBU100_CACHE_TOKEN_KEY);
|
8
|
+
}
|
9
|
+
/**
|
10
|
+
* 设置 token
|
11
|
+
* @param token token
|
12
|
+
*/
|
13
|
+
export function setToken(token) {
|
14
|
+
sessionStorage.setItem(BUBU100_CACHE_TOKEN_KEY, token);
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* 获取 token
|
18
|
+
*/
|
19
|
+
export function getToken() {
|
20
|
+
return sessionStorage.getItem(BUBU100_CACHE_TOKEN_KEY);
|
21
|
+
}
|
22
|
+
export function clearAuthToken() {
|
23
|
+
sessionStorage.removeItem(BUBU100_CACHE_AUTH_TOKEN_KEY);
|
24
|
+
}
|
25
|
+
export function setAuthToken(token) {
|
26
|
+
sessionStorage.setItem(BUBU100_CACHE_AUTH_TOKEN_KEY, token);
|
27
|
+
}
|
28
|
+
export function getAuthToken() {
|
29
|
+
return sessionStorage.getItem(BUBU100_CACHE_AUTH_TOKEN_KEY);
|
30
|
+
}
|
31
|
+
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
33
|
+
export function setAuthBtnID(MenuBtnData) {}
|
34
|
+
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
36
|
+
export function getAuthBtnID(location) {}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export declare const GetWareHouseCache: () => Record<string, any>;
|
2
|
+
export declare const SetWareHouseCache: (data: Record<string, any>) => void;
|
3
|
+
export declare const cacheDB: () => Promise<import("idb").IDBPDatabase<unknown>>;
|
4
|
+
export declare const clearDB: () => Promise<void>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { deleteDB, openDB } from 'idb';
|
2
|
+
import { BUBU100_CACHE_WAREINFO_KEY } from "../constant";
|
3
|
+
export var GetWareHouseCache = function GetWareHouseCache() {
|
4
|
+
var cacheData = localStorage.getItem(BUBU100_CACHE_WAREINFO_KEY);
|
5
|
+
try {
|
6
|
+
return JSON.parse(cacheData !== null && cacheData !== void 0 ? cacheData : '');
|
7
|
+
} catch (error) {
|
8
|
+
return {};
|
9
|
+
}
|
10
|
+
};
|
11
|
+
export var SetWareHouseCache = function SetWareHouseCache(data) {
|
12
|
+
var stringData = JSON.stringify(data);
|
13
|
+
localStorage.setItem(BUBU100_CACHE_WAREINFO_KEY, stringData);
|
14
|
+
};
|
15
|
+
export var cacheDB = function cacheDB() {
|
16
|
+
return openDB('request-cache', 1, {
|
17
|
+
upgrade: function upgrade(db) {
|
18
|
+
db.createObjectStore('cache');
|
19
|
+
}
|
20
|
+
});
|
21
|
+
};
|
22
|
+
export var clearDB = function clearDB() {
|
23
|
+
return deleteDB('request-cache');
|
24
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* 节流|防抖
|
3
|
+
* @param fn 函数
|
4
|
+
* @param wait 等待时间
|
5
|
+
* @param isThrottle 是否节流
|
6
|
+
*/
|
7
|
+
export declare const ChainDebounceOrThrottle: (fn: (...args: any) => any, wait?: number, isThrottle?: boolean) => (...args: any) => any;
|
8
|
+
/**
|
9
|
+
* 深拷贝
|
10
|
+
* @param value 原始对象
|
11
|
+
*/
|
12
|
+
export declare const ChainDeepClone: (value: any) => any;
|
13
|
+
/**
|
14
|
+
*
|
15
|
+
* 判断值是否相等
|
16
|
+
*
|
17
|
+
* abstract 浅对比,不包含迭代
|
18
|
+
* samevalue 确定两个值是否在任何情况下功能上是相同的
|
19
|
+
*
|
20
|
+
* [MDN JS 值相等参考]](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Equality_comparisons_and_sameness)
|
21
|
+
*
|
22
|
+
* @param value1
|
23
|
+
* @param value2
|
24
|
+
* @param equalType 'abstract' 抽象相等 | 'samevalue' 同值相等
|
25
|
+
*/
|
26
|
+
export declare const ChainValueEqual: (value1: object, value2: object, equalType?: 'abstract' | 'samevalue') => boolean;
|