@kmkf-fe-packages/services-components 2.0.54-beta.21 → 2.0.54-beta.23

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.
@@ -159,7 +159,7 @@ function Logistics(options) {
159
159
 
160
160
  this.rules = [{
161
161
  validator: function validator(_, value) {
162
- var _this$componentConfig5, _this$componentConfig6, _value$interceptAddre, _value$interceptSende;
162
+ var _this$componentConfig5, _this$componentConfig6, _value$interceptAddre;
163
163
  if ((_this$componentConfig5 = _this.componentConfig) !== null && _this$componentConfig5 !== void 0 && _this$componentConfig5.required && (!(value !== null && value !== void 0 && value.interceptCompany) || !value.interceptCode)) {
164
164
  return Promise.reject(new Error("请填写物流信息"));
165
165
  }
@@ -170,13 +170,21 @@ function Logistics(options) {
170
170
  if (showAddress && (!(value !== null && value !== void 0 && (_value$interceptAddre = value.interceptAddress) !== null && _value$interceptAddre !== void 0 && _value$interceptAddre.length) || !(value !== null && value !== void 0 && value.interceptDetail) || !(value !== null && value !== void 0 && value.interceptReceiverName) || !(value !== null && value !== void 0 && value.interceptReceiverMobile))) {
171
171
  return Promise.reject(new Error("请填写派送地址"));
172
172
  }
173
- var showSender = _this.expressInterceptData.getShowSenderMobileMap()["".concat(value === null || value === void 0 ? void 0 : value.interceptType)];
174
- if (showSender && !(value !== null && value !== void 0 && value.interceptSenderMobile)) {
175
- return Promise.reject(new Error("请填写发件人手机号"));
176
- }
177
- if (showSender && value !== null && value !== void 0 && value.interceptSenderMobile && !(value !== null && value !== void 0 && (_value$interceptSende = value.interceptSenderMobile) !== null && _value$interceptSende !== void 0 && _value$interceptSende.match(/^[1][0-9]{10}$/))) {
178
- return Promise.reject(new Error("请填写正确的发件人手机号"));
179
- }
173
+
174
+ // const showSender =
175
+ // this.expressInterceptData.getShowSenderMobileMap()[
176
+ // `${value?.interceptType}`
177
+ // ];
178
+ // if (showSender && !value?.interceptSenderMobile) {
179
+ // return Promise.reject(new Error("请填写发件人手机号"));
180
+ // }
181
+ // if (
182
+ // showSender &&
183
+ // value?.interceptSenderMobile &&
184
+ // !value?.interceptSenderMobile?.match(/^[1][0-9]{10}$/)
185
+ // ) {
186
+ // return Promise.reject(new Error("请填写正确的发件人手机号"));
187
+ // }
180
188
  return Promise.resolve();
181
189
  }
182
190
  }];
@@ -188,21 +188,32 @@ function Logistics(options) {
188
188
  if (hasNoAddress) {
189
189
  return Promise.reject(new Error("\u8BF7\u586B\u5199\u6D3E\u9001\u5730\u5740"));
190
190
  }
191
- var hasNoSender = value.some(function (t) {
192
- var showSender = _this.expressInterceptData.getShowSenderMobileMap()["".concat(t === null || t === void 0 ? void 0 : t.interceptType)];
193
- return showSender && !(t !== null && t !== void 0 && t.interceptSenderMobile);
194
- });
195
- if (hasNoSender) {
196
- return Promise.reject(new Error("\u8BF7\u586B\u5199\u53D1\u4EF6\u4EBA\u624B\u673A\u53F7"));
197
- }
198
- var hasErrorSender = value.some(function (t) {
199
- var _t$interceptSenderMob;
200
- var showSender = _this.expressInterceptData.getShowSenderMobileMap()["".concat(t === null || t === void 0 ? void 0 : t.interceptType)];
201
- return showSender && (t === null || t === void 0 ? void 0 : t.interceptSenderMobile) && !(t !== null && t !== void 0 && (_t$interceptSenderMob = t.interceptSenderMobile) !== null && _t$interceptSenderMob !== void 0 && _t$interceptSenderMob.match(/^[1][0-9]{10}$/));
202
- });
203
- if (hasErrorSender) {
204
- return Promise.reject(new Error("\u8BF7\u586B\u5199\u6B63\u786E\u7684\u53D1\u4EF6\u4EBA\u624B\u673A\u53F7"));
205
- }
191
+
192
+ // const hasNoSender = value.some((t: any) => {
193
+ // const showSender =
194
+ // this.expressInterceptData.getShowSenderMobileMap()[
195
+ // `${t?.interceptType}`
196
+ // ];
197
+ // return showSender && !t?.interceptSenderMobile;
198
+ // });
199
+ // if (hasNoSender) {
200
+ // return Promise.reject(new Error(`请填写发件人手机号`));
201
+ // }
202
+ // const hasErrorSender = value.some((t: any) => {
203
+ // const showSender =
204
+ // this.expressInterceptData.getShowSenderMobileMap()[
205
+ // `${t?.interceptType}`
206
+ // ];
207
+ // return (
208
+ // showSender &&
209
+ // t?.interceptSenderMobile &&
210
+ // !t?.interceptSenderMobile?.match(/^[1][0-9]{10}$/)
211
+ // );
212
+ // });
213
+ // if (hasErrorSender) {
214
+ // return Promise.reject(new Error(`请填写正确的发件人手机号`));
215
+ // }
216
+
206
217
  return Promise.resolve();
207
218
  }
208
219
  }] : [];
@@ -30,15 +30,6 @@ declare class Logistics implements ComponentInterface {
30
30
  renderExport: (value: any, record: any) => any;
31
31
  editRender: (p: any) => React.JSX.Element;
32
32
  filterConfig: (item: ColumnConfig) => ({
33
- searchDefaultConditions: "like";
34
- type: string;
35
- id: string;
36
- name: string;
37
- filterComponentType: "Input";
38
- filterFn: (value: string) => (i: Record) => boolean;
39
- formatFilterValue: (input: string) => string;
40
- props?: undefined;
41
- } | {
42
33
  searchDefaultConditions: "in";
43
34
  type: string;
44
35
  id: string;
@@ -65,8 +56,8 @@ declare class Logistics implements ComponentInterface {
65
56
  name: string;
66
57
  filterComponentType: "Input";
67
58
  filterFn: (value: string) => (i: Record) => boolean;
68
- formatFilterValue?: undefined;
69
59
  props?: undefined;
60
+ formatFilterValue?: undefined;
70
61
  })[];
71
62
  }
72
63
  export default Logistics;
@@ -35,9 +35,9 @@ var Logistics = /*#__PURE__*/_createClass(function Logistics(_options) {
35
35
  var _this = this,
36
36
  _typeMap$_options$typ,
37
37
  _typeMap$_options$typ2,
38
- _this$componentConfig10,
39
- _this$componentConfig12,
40
- _this$componentConfig13;
38
+ _this$componentConfig9,
39
+ _this$componentConfig11,
40
+ _this$componentConfig12;
41
41
  _classCallCheck(this, Logistics);
42
42
  _defineProperty(this, "name", void 0);
43
43
  _defineProperty(this, "id", void 0);
@@ -133,29 +133,11 @@ var Logistics = /*#__PURE__*/_createClass(function Logistics(_options) {
133
133
  });
134
134
  });
135
135
  _defineProperty(this, "filterConfig", function (item) {
136
- var _this$componentConfig9, _typeMap$_this$type5, _typeMap$_this$type6, _typeMap$_this$type7, _typeMap$_this$type8;
137
- var logisticsType = ((_this$componentConfig9 = _this.componentConfig) === null || _this$componentConfig9 === void 0 ? void 0 : _this$componentConfig9.logistics) === "gy" ? "input" : "select";
138
- return [logisticsType === "input" ? {
139
- searchDefaultConditions: SYMBOL.like,
140
- type: item.type,
141
- id: "".concat(item.id, "_").concat((_typeMap$_this$type5 = typeMap[_this.type]) === null || _typeMap$_this$type5 === void 0 ? void 0 : _typeMap$_this$type5.key),
142
- name: "".concat(_this.name, "\u7269\u6D41\u516C\u53F8"),
143
- filterComponentType: "Input",
144
- filterFn: function filterFn(value) {
145
- return function (i) {
146
- return _filterFn.filterSplitComma(_filterFn.filterTableListItemColumnValue(i, item.id, "logisticsCode"), value);
147
- };
148
- },
149
- formatFilterValue: function formatFilterValue(input) {
150
- var value = batchInput(input);
151
- // console.log("formatFilterValue---", value);
152
-
153
- return value && Array.isArray(value) ? value.join("") : value;
154
- }
155
- } : {
136
+ var _typeMap$_this$type5, _typeMap$_this$type6, _typeMap$_this$type7;
137
+ return [{
156
138
  searchDefaultConditions: SYMBOL.in,
157
139
  type: item.type,
158
- id: "".concat(item.id, "_").concat((_typeMap$_this$type6 = typeMap[_this.type]) === null || _typeMap$_this$type6 === void 0 ? void 0 : _typeMap$_this$type6.company),
140
+ id: "".concat(item.id, "_").concat((_typeMap$_this$type5 = typeMap[_this.type]) === null || _typeMap$_this$type5 === void 0 ? void 0 : _typeMap$_this$type5.company),
159
141
  name: "".concat(_this.name, "\u7269\u6D41\u516C\u53F8"),
160
142
  filterComponentType: "MultipleSelect",
161
143
  props: {
@@ -174,7 +156,7 @@ var Logistics = /*#__PURE__*/_createClass(function Logistics(_options) {
174
156
  }, _this.type === "REISSUE_LOGISTICS" ? {
175
157
  searchDefaultConditions: SYMBOL.in,
176
158
  type: item.type,
177
- id: "".concat(item.id, "_").concat((_typeMap$_this$type7 = typeMap[_this.type]) === null || _typeMap$_this$type7 === void 0 ? void 0 : _typeMap$_this$type7.code),
159
+ id: "".concat(item.id, "_").concat((_typeMap$_this$type6 = typeMap[_this.type]) === null || _typeMap$_this$type6 === void 0 ? void 0 : _typeMap$_this$type6.code),
178
160
  name: "".concat(_this.name, "\u7269\u6D41\u5355\u53F7"),
179
161
  filterComponentType: "Input",
180
162
  filterFn: function filterFn(value) {
@@ -188,7 +170,7 @@ var Logistics = /*#__PURE__*/_createClass(function Logistics(_options) {
188
170
  } : {
189
171
  searchDefaultConditions: SYMBOL.like,
190
172
  type: item.type,
191
- id: "".concat(item.id, "_").concat((_typeMap$_this$type8 = typeMap[_this.type]) === null || _typeMap$_this$type8 === void 0 ? void 0 : _typeMap$_this$type8.code),
173
+ id: "".concat(item.id, "_").concat((_typeMap$_this$type7 = typeMap[_this.type]) === null || _typeMap$_this$type7 === void 0 ? void 0 : _typeMap$_this$type7.code),
192
174
  name: "".concat(_this.name, "\u7269\u6D41\u5355\u53F7"),
193
175
  filterComponentType: "Input",
194
176
  filterFn: function filterFn(value) {
@@ -208,12 +190,12 @@ var Logistics = /*#__PURE__*/_createClass(function Logistics(_options) {
208
190
  this.canSort = false;
209
191
  this.children = [];
210
192
  this.dataType = "object";
211
- this.rules = (_this$componentConfig10 = this.componentConfig) !== null && _this$componentConfig10 !== void 0 && _this$componentConfig10.required ? [{
193
+ this.rules = (_this$componentConfig9 = this.componentConfig) !== null && _this$componentConfig9 !== void 0 && _this$componentConfig9.required ? [{
212
194
  required: true,
213
195
  validator: function validator(_, value) {
214
196
  var hasNo = (value || []).some(function (item) {
215
- var _this$componentConfig11;
216
- if (((_this$componentConfig11 = _this.componentConfig) === null || _this$componentConfig11 === void 0 ? void 0 : _this$componentConfig11.logistics) === "gy") {
197
+ var _this$componentConfig10;
198
+ if (((_this$componentConfig10 = _this.componentConfig) === null || _this$componentConfig10 === void 0 ? void 0 : _this$componentConfig10.logistics) === "gy") {
217
199
  return (item.logisticsCompany || item.logisticsCompanyName) && item.logisticsCode;
218
200
  }
219
201
  return item.logisticsCompany && item.logisticsCode;
@@ -225,7 +207,7 @@ var Logistics = /*#__PURE__*/_createClass(function Logistics(_options) {
225
207
  }
226
208
  }] : [];
227
209
  this.align = "left";
228
- this.expressDateInstance = ExpressData.getInstance((_this$componentConfig12 = this.componentConfig) === null || _this$componentConfig12 === void 0 ? void 0 : _this$componentConfig12.logistics);
229
- this.sortChildField = this.getSortChildFields(((_this$componentConfig13 = this.componentConfig) === null || _this$componentConfig13 === void 0 ? void 0 : _this$componentConfig13.showField) || "", _options);
210
+ this.expressDateInstance = ExpressData.getInstance((_this$componentConfig11 = this.componentConfig) === null || _this$componentConfig11 === void 0 ? void 0 : _this$componentConfig11.logistics);
211
+ this.sortChildField = this.getSortChildFields(((_this$componentConfig12 = this.componentConfig) === null || _this$componentConfig12 === void 0 ? void 0 : _this$componentConfig12.showField) || "", _options);
230
212
  });
231
213
  export default Logistics;
@@ -47,7 +47,11 @@ var WdtShopSelect = /*#__PURE__*/_createClass(function WdtShopSelect(options) {
47
47
  width: 200
48
48
  },
49
49
  placeholder: "\u8BF7\u9009\u62E9".concat(_this.name),
50
- options: _this.options
50
+ options: _this.options,
51
+ showSearch: true,
52
+ filterOption: function filterOption(input, option) {
53
+ return option.label.includes(input);
54
+ }
51
55
  }))
52
56
  });
53
57
  });
@@ -113,6 +117,6 @@ var WdtShopSelect = /*#__PURE__*/_createClass(function WdtShopSelect(options) {
113
117
  this.componentConfig = _objectSpread(_objectSpread({}, options.componentConfig), {}, {
114
118
  options: this.options
115
119
  });
116
- this.dataType = "array";
120
+ this.dataType = "string";
117
121
  });
118
122
  export default WdtShopSelect;
@@ -1,3 +1,3 @@
1
1
  import { ReissueLogistics, JstItemSelect, JstSupply, JstSendGood, BasicInput, BasicAddress, BasicCascader, BasicCheckbox, BasicDataTime, BasicSelect, BasicRadio, BasicTextArea, BasicPicture, BasicPicturePro, BasicMultSelect, BasicGrade, BasicRate, BasicFile, BasicPosting, SubForm, CommonDataTime, TradeId, ShopName, BuyerNick, ReceiverName, ReceiverMobile, ReceiverAddress, TradeDateTime, Logistics, ReturnLogistics, ActualPayment, ERemark, AliPay, ItemSelect, ItemId, ItemEnCode, SystemOrderNo, Ordinary, ThirdItemSelect, FlowStatusSelect, FlowMarkSelect, FlowTag, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, PrevSubmitter, FlowCreator, Handler, CompletedUser, LogisticsInterception, LogisticsMoreInterception, LogisticsTrajectory, LogisticsMoreTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect, CommonSystemOrder, CommonMultiStatus, Calculation, NodeDeadLine, HandlerDeadLine, NodeStayDuration, WlnGoods, BsPosting, MsgStatus, NodeInput, FlowWorkOrderStatus, WdtGoods, WdtReturn, WdtExchange, CommonInput, PaymentVoucherCode, Label, WdtReissue, GyReissue, AfterSalesOrderId, BsE3Goods, PublicGoods, PublicReissueGoods, PublicExchange, GyGoods, BsE3Reissue, MemberLevel, GyReturn, AsyncSelect, WdtShopSelect } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => BsLogistics | JstSendGood | MsgStatus | AsyncSelect | ReissueLogistics | WdtShopSelect | 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 | Payment | JstItemSelect | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | PublicReissueGoods | PublicExchange | BsE3Reissue | BsExchange | BsReissue | BsReturn | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods | GyReissue | GyReturn;
3
+ export declare const factory: (type: string, options: PickOption) => GyReissue | GyReturn | JstSendGood | LogisticsInterception | LogisticsMoreInterception | MsgStatus | AsyncSelect | ReissueLogistics | WdtShopSelect | 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 | Payment | JstItemSelect | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | PublicReissueGoods | PublicExchange | BsE3Reissue | BsExchange | BsReissue | BsReturn | BsLogistics | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | StatusSelect | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | 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.54-beta.21",
3
+ "version": "2.0.54-beta.23",
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.54-beta.19",
25
- "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.19",
24
+ "@kmkf-fe-packages/basic-components": "2.0.54-beta.23",
25
+ "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.23",
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": "d214c607dff16915e55acff0f82f388da9094142",
44
+ "gitHead": "d582e2e1017c68ec47b7d80822a909de4c7f173e",
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;