@kmkf-fe-packages/services-components 2.0.42 → 2.0.44

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.
@@ -9,18 +9,20 @@ import bs_e3 from "./bs_e3";
9
9
  import bs from "./bs";
10
10
  import wdt from "./wdt";
11
11
  import gy from "./gy";
12
- import { getJstColumns } from "@kmkf-fe-packages/basic-components";
12
+ import { getJstColumns, getWlnColumns } from "@kmkf-fe-packages/basic-components";
13
13
  import defaultColumns from "./defaultColumns";
14
14
  export var getColumnsMap = function getColumnsMap(args) {
15
15
  var _ref = args || {},
16
16
  _ref$text = _ref.text,
17
17
  text = _ref$text === void 0 ? "" : _ref$text;
18
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, system()), bs({
18
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, system()), bs({
19
19
  text: text
20
20
  })), bs_e3()), wdt({
21
21
  text: text
22
22
  })), gy()), getJstColumns({
23
23
  disabled: true
24
+ })), getWlnColumns({
25
+ text: text
24
26
  })), {}, {
25
27
  default: defaultColumns({
26
28
  text: text
@@ -55,10 +55,13 @@ var getColumns = function getColumns(_ref) {
55
55
  }
56
56
  }, {
57
57
  dataIndex: "orderPrice",
58
- title: "\u5B9E\u4ED8\u603B\u91D1\u989D",
58
+ title: "\u6210\u4EA4\u603B\u91D1\u989D",
59
59
  align: "center",
60
60
  ellipsis: true,
61
- width: 100
61
+ width: 100,
62
+ render: function render(val, record) {
63
+ return (record.num || record.num === 0) && (val || val === 0) ? val * record.num : null;
64
+ }
62
65
  }, {
63
66
  dataIndex: "num",
64
67
  title: "".concat(text, "\u6570\u91CF"),
@@ -69,9 +69,17 @@ var GoodHeaderMap = {
69
69
  },
70
70
  orderPrice: {
71
71
  component: BsHeaderChild,
72
- name: "实付总金额",
72
+ name: "成交总金额",
73
73
  key: "orderPrice",
74
- width: 100
74
+ width: 100,
75
+ transformValue: function transformValue(val, record, parentName) {
76
+ var num = record["".concat(parentName, "_num")];
77
+ return (num || num === 0) && (val || val === 0) ? val * num : null;
78
+ },
79
+ renderExport: function renderExport(val, record, parentName) {
80
+ var num = record["".concat(parentName, "_num")];
81
+ return (num || num === 0) && (val || val === 0) ? val * num : null;
82
+ }
75
83
  },
76
84
  num: {
77
85
  component: BsHeaderChild,
@@ -99,7 +107,7 @@ var GoodHeaderMap = {
99
107
  specId: "SKUID",
100
108
  specNo: "商品SKU编码",
101
109
  specName: "商品SKU名称",
102
- orderPrice: "实付总金额",
110
+ orderPrice: "成交总金额",
103
111
  num: "数量",
104
112
  sharePrice: "分摊价",
105
113
  giftType: "赠品方式"
@@ -1068,6 +1076,81 @@ var GoodHeaderMap = {
1068
1076
  remark: "备注"
1069
1077
  },
1070
1078
  moneyKey: "salePrice"
1079
+ },
1080
+ WLN_GOODS: {
1081
+ headerMap: {
1082
+ wlnItemName: {
1083
+ name: '商品名称',
1084
+ width: 250
1085
+ },
1086
+ goodsCode: {
1087
+ name: '商品编码',
1088
+ width: 250
1089
+ },
1090
+ skuCode: {
1091
+ name: 'sku编码',
1092
+ width: 250
1093
+ },
1094
+ skuName: {
1095
+ name: '线上sku名称',
1096
+ width: 250
1097
+ },
1098
+ olnSkuCode: {
1099
+ name: '线上sku编码',
1100
+ width: 150
1101
+ },
1102
+ sku: {
1103
+ name: '线上sku id',
1104
+ width: 150
1105
+ },
1106
+ name: {
1107
+ name: '线上商品名称',
1108
+ width: 250
1109
+ },
1110
+ pic: {
1111
+ name: '线上图片',
1112
+ width: 100,
1113
+ component: BsHeaderPic
1114
+ },
1115
+ olnItemCOde: {
1116
+ name: '线上商品编码',
1117
+ width: 150
1118
+ },
1119
+ code: {
1120
+ name: '线上商品id',
1121
+ width: 150
1122
+ },
1123
+ barCode: {
1124
+ name: '商品条码',
1125
+ width: 150
1126
+ },
1127
+ money: {
1128
+ name: '实付金额',
1129
+ width: 100
1130
+ },
1131
+ number: {
1132
+ name: '数量',
1133
+ width: 100
1134
+ },
1135
+ share: '应收款',
1136
+ type: {
1137
+ name: '赠品类型',
1138
+ width: 100
1139
+ },
1140
+ isPackage: {
1141
+ width: 100,
1142
+ name: "是否组合商品",
1143
+ transformValue: function transformValue(val) {
1144
+ if (isNull(val)) return '--';
1145
+ return val ? '是' : '否';
1146
+ },
1147
+ renderExport: function renderExport(val) {
1148
+ if (isNull(val)) return '--';
1149
+ return val ? '是' : '否';
1150
+ }
1151
+ }
1152
+ },
1153
+ moneyKey: "money"
1071
1154
  }
1072
1155
  };
1073
1156
  GoodHeaderMap["WDT_REISSUE_GOODS"] = GoodHeaderMap["WDT_GOODS"];
@@ -1,6 +1,6 @@
1
1
  import { ComponentInterface, PickOption, ColumnConfig, Record } from "../../../type";
2
2
  import React from "react";
3
- import { BsHeaderGood } from "../../BS/common/index";
3
+ import CommonHeaderGoods from "../../CommonHeaderGood";
4
4
  declare class WlnGoods implements ComponentInterface {
5
5
  name: string;
6
6
  id: string;
@@ -14,7 +14,7 @@ declare class WlnGoods implements ComponentInterface {
14
14
  canSort: boolean;
15
15
  children: ComponentInterface[];
16
16
  dataType: ComponentInterface["dataType"];
17
- wlnGoods: BsHeaderGood;
17
+ wlnGoods: CommonHeaderGoods;
18
18
  constructor(options: PickOption);
19
19
  renderClient: (record: any) => React.JSX.Element | null;
20
20
  renderPc: () => null;
@@ -11,7 +11,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
11
11
  import React from "react";
12
12
  import GetFormItem from "../../GetFormItem";
13
13
  import { BsGoodsTable } from "../../Common";
14
- import { BsHeaderGood } from "../../BS/common/index";
14
+ import CommonHeaderGoods from "../../CommonHeaderGood";
15
15
  import ItemView from "../../../commonComponents/ItemView";
16
16
  import { isNull } from "@kmkf-fe-packages/kmkf-utils";
17
17
  import { WlnGoods as Goods } from "@kmkf-fe-packages/basic-components";
@@ -40,7 +40,8 @@ var WlnGoods = /*#__PURE__*/_createClass(function WlnGoods(options) {
40
40
  label: _this.name,
41
41
  value: /*#__PURE__*/React.createElement(BsGoodsTable, {
42
42
  list: (record === null || record === void 0 ? void 0 : (_record = record["".concat(_this.id)]) === null || _record === void 0 ? void 0 : _record.wlnGoods) || [],
43
- showHeader: ((_this$componentConfig = _this.componentConfig) === null || _this$componentConfig === void 0 ? void 0 : _this$componentConfig.showHeader) || []
43
+ showHeader: ((_this$componentConfig = _this.componentConfig) === null || _this$componentConfig === void 0 ? void 0 : _this$componentConfig.showHeader) || [],
44
+ type: _this.type
44
45
  })
45
46
  })) : null;
46
47
  });
@@ -52,7 +53,8 @@ var WlnGoods = /*#__PURE__*/_createClass(function WlnGoods(options) {
52
53
  if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_wlnGoods")])) return null;
53
54
  return /*#__PURE__*/React.createElement(BsGoodsTable, {
54
55
  list: (r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_wlnGoods")]) || [],
55
- showHeader: ((_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.showHeader) || []
56
+ showHeader: ((_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.showHeader) || [],
57
+ type: _this.type
56
58
  });
57
59
  });
58
60
  _defineProperty(this, "getComponentValue", function (r) {
@@ -76,7 +78,8 @@ var WlnGoods = /*#__PURE__*/_createClass(function WlnGoods(options) {
76
78
  shopId: (_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.shopId,
77
79
  shopList: ((_this$effects2 = _this.effects) === null || _this$effects2 === void 0 ? void 0 : _this$effects2.shopList) || [],
78
80
  companyKey: (_this$effects3 = _this.effects) === null || _this$effects3 === void 0 ? void 0 : _this$effects3.companyKey,
79
- width: "90%"
81
+ width: "90%",
82
+ type: _this.type
80
83
  }))
81
84
  });
82
85
  });
@@ -99,7 +102,7 @@ var WlnGoods = /*#__PURE__*/_createClass(function WlnGoods(options) {
99
102
  this.effects = options === null || options === void 0 ? void 0 : options.effects;
100
103
  this.isCombinationComponent = true;
101
104
  this.canSort = false;
102
- this.wlnGoods = new BsHeaderGood(_objectSpread(_objectSpread({}, options), {}, {
105
+ this.wlnGoods = new CommonHeaderGoods(_objectSpread(_objectSpread({}, options), {}, {
103
106
  id: "".concat(options.id, "_wlnGoods"),
104
107
  name: "商品信息"
105
108
  }));
@@ -1,3 +1,3 @@
1
1
  import { ReissueLogistics, JstItemSelect, JstSupply, JstSendGood, BasicInput, BasicAddress, BasicCascader, BasicCheckbox, BasicDataTime, BasicSelect, BasicRadio, BasicTextArea, BasicPicture, 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";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => StatusSelect | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicSelect | BasicRadio | BasicTextArea | BasicPicture | 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 | Payment | ReissueLogistics | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | PublicReissueGoods | PublicExchange | BsE3Reissue | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | MsgStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods | GyReissue | GyReturn;
3
+ export declare const factory: (type: string, options: PickOption) => GyReissue | GyReturn | BasicSelect | WlnGoods | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicDataTime | BasicRadio | BasicTextArea | BasicPicture | 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 | Payment | ReissueLogistics | JstItemSelect | JstSendGood | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | PublicReissueGoods | PublicExchange | BsE3Reissue | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | BsPosting | NodeInput | FlowWorkOrderStatus | MsgStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "2.0.42",
3
+ "version": "2.0.44",
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.42",
25
- "@kmkf-fe-packages/kmkf-utils": "2.0.42",
24
+ "@kmkf-fe-packages/basic-components": "2.0.44",
25
+ "@kmkf-fe-packages/kmkf-utils": "2.0.44",
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": "fa256bbf3b073a798c5d523e27d7205c1bd197e6",
44
+ "gitHead": "20ac9a7a67b69931f4920c1492a43261a080ba3d",
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;
@@ -1,186 +0,0 @@
1
- "use strict";
2
-
3
- var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) {
5
- return value instanceof P ? value : new P(function (resolve) {
6
- resolve(value);
7
- });
8
- }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) {
11
- try {
12
- step(generator.next(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- }
17
- function rejected(value) {
18
- try {
19
- step(generator["throw"](value));
20
- } catch (e) {
21
- reject(e);
22
- }
23
- }
24
- function step(result) {
25
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
- }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
- var __generator = this && this.__generator || function (thisArg, body) {
31
- var _ = {
32
- label: 0,
33
- sent: function sent() {
34
- if (t[0] & 1) throw t[1];
35
- return t[1];
36
- },
37
- trys: [],
38
- ops: []
39
- },
40
- f,
41
- y,
42
- t,
43
- g;
44
- return g = {
45
- next: verb(0),
46
- "throw": verb(1),
47
- "return": verb(2)
48
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
49
- return this;
50
- }), g;
51
- function verb(n) {
52
- return function (v) {
53
- return step([n, v]);
54
- };
55
- }
56
- function step(op) {
57
- if (f) throw new TypeError("Generator is already executing.");
58
- while (_) try {
59
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
- if (y = 0, t) op = [op[0] & 2, t.value];
61
- switch (op[0]) {
62
- case 0:
63
- case 1:
64
- t = op;
65
- break;
66
- case 4:
67
- _.label++;
68
- return {
69
- value: op[1],
70
- done: false
71
- };
72
- case 5:
73
- _.label++;
74
- y = op[1];
75
- op = [0];
76
- continue;
77
- case 7:
78
- op = _.ops.pop();
79
- _.trys.pop();
80
- continue;
81
- default:
82
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
- _ = 0;
84
- continue;
85
- }
86
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
- _.label = op[1];
88
- break;
89
- }
90
- if (op[0] === 6 && _.label < t[1]) {
91
- _.label = t[1];
92
- t = op;
93
- break;
94
- }
95
- if (t && _.label < t[2]) {
96
- _.label = t[2];
97
- _.ops.push(op);
98
- break;
99
- }
100
- if (t[2]) _.ops.pop();
101
- _.trys.pop();
102
- continue;
103
- }
104
- op = body.call(thisArg, _);
105
- } catch (e) {
106
- op = [6, e];
107
- y = 0;
108
- } finally {
109
- f = t = 0;
110
- }
111
- if (op[0] & 5) throw op[1];
112
- return {
113
- value: op[0] ? op[1] : void 0,
114
- done: true
115
- };
116
- }
117
- };
118
- exports.__esModule = true;
119
- var react_1 = require("react");
120
- var useGetHasErpData_1 = require("../hook/useGetHasErpData");
121
- var ahooks_1 = require("ahooks");
122
- var api_1 = require("../../../service/api");
123
- function useGetErpLogisticsCompany(notJudgedErp) {
124
- var _this = this;
125
- var _a = react_1.useState("loading"),
126
- globalState = _a[0],
127
- setGlobalState = _a[1];
128
- var hasErpData = useGetHasErpData_1["default"]();
129
- ahooks_1.useUpdateEffect(function () {
130
- asyncQueryData(hasErpData, notJudgedErp);
131
- }, [hasErpData, notJudgedErp]);
132
- var asyncQueryData = function asyncQueryData(hasErpData, notJudgedErp) {
133
- return __awaiter(_this, void 0, void 0, function () {
134
- var hasWdt, hasE3, hasJst, hasWln, promises, e_1;
135
- return __generator(this, function (_a) {
136
- switch (_a.label) {
137
- case 0:
138
- hasWdt = hasErpData.hasWdt, hasE3 = hasErpData.hasE3, hasJst = hasErpData.hasJst, hasWln = hasErpData.hasWln;
139
- promises = [api_1.queryKMLogisticsCompany];
140
- if (hasWdt || notJudgedErp) promises.push(api_1.queryWdtLogisticsCompany);
141
- if (hasE3 || notJudgedErp) promises.push(api_1.queryBsE3LogisticsCompany);
142
- if (hasJst || notJudgedErp) promises.push(api_1.queryJSTLogisticsCompany);
143
- if (hasWln || notJudgedErp) promises.push(api_1.queryWLNLogisticsCompany);
144
- if (!hasWdt && !hasE3 && !hasJst && !hasWln && !notJudgedErp) {
145
- setGlobalState("success");
146
- return [2 /*return*/];
147
- }
148
-
149
- _a.label = 1;
150
- case 1:
151
- _a.trys.push([1, 3,, 4]);
152
- return [4 /*yield*/, Promise.all(promises.map(function (promise) {
153
- return promise();
154
- }))];
155
- case 2:
156
- _a.sent();
157
- setGlobalState("success");
158
- return [3 /*break*/, 4];
159
- case 3:
160
- e_1 = _a.sent();
161
- setGlobalState("failed");
162
- return [3 /*break*/, 4];
163
- case 4:
164
- return [2 /*return*/];
165
- }
166
- });
167
- });
168
- };
169
-
170
- var onReload = function onReload() {
171
- return __awaiter(_this, void 0, void 0, function () {
172
- return __generator(this, function (_a) {
173
- switch (_a.label) {
174
- case 0:
175
- return [4 /*yield*/, asyncQueryData(hasErpData, notJudgedErp)];
176
- case 1:
177
- _a.sent();
178
- return [2 /*return*/];
179
- }
180
- });
181
- });
182
- };
183
-
184
- return [globalState, onReload];
185
- }
186
- exports["default"] = useGetErpLogisticsCompany;