@kmkf-fe-packages/services-components 2.0.55 → 2.0.56

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.
@@ -12,53 +12,27 @@ import React from "react";
12
12
  import GetFormItem from "../../GetFormItem";
13
13
  import ItemView from "../../../commonComponents/ItemView";
14
14
  import { isNull, filterFn as _filterFn } from "@kmkf-fe-packages/kmkf-utils";
15
- import { PublicReissue as Reissue } from "@kmkf-fe-packages/basic-components";
15
+ import { PublicReissue as Reissue, erpFormValidator } from "@kmkf-fe-packages/basic-components";
16
16
  import { SYMBOL } from "../../../constant";
17
17
  import { BsGoodsTable } from "../../Common/index";
18
18
  import { BsType, BsMemo, SystemOrderNo } from "../../BS/common/index";
19
19
  import SystemOrderType from "../SystemOrderType";
20
20
  import CommonHeaderGoods from "../../CommonHeaderGood";
21
- function toNum(value) {
22
- if (typeof value === "string") {
23
- return value ? +value : void 0;
24
- }
25
- if (typeof value === "number") {
26
- return value;
27
- }
28
- return void 0;
29
- }
30
21
  var typeMap = {
31
22
  JST_REISSUE_GOODS: {
32
23
  key: "jstReissueGoods",
33
24
  typeName: "jstReissueType",
34
25
  remark: "jstReissueType_memo",
35
26
  systemOrderNo: "jstSystemOrderNo",
36
- systemOrderBillType: 'jstSystemOrderBillType',
27
+ systemOrderBillType: "jstSystemOrderBillType",
37
28
  errMsg: "请选择聚水潭补发商品",
38
29
  name: "聚水潭",
39
- compType: '补发',
40
- validator: function validator(_rule, value) {
30
+ compType: "补发",
31
+ validator: function validator(_rule, value, type) {
41
32
  if (!_rule.required) return Promise.resolve();
42
- var goodsName = "";
43
- if (((value === null || value === void 0 ? void 0 : value.jstReissueGoods) || []).some(function (goods) {
44
- var qty = toNum(goods === null || goods === void 0 ? void 0 : goods.qty);
45
- var res = typeof qty === "number" ? qty < 1 : true;
46
- if (res) {
47
- goodsName = goods !== null && goods !== void 0 && goods.name ? "[".concat(goods === null || goods === void 0 ? void 0 : goods.name, "]") : '';
48
- }
49
- return res;
50
- })) {
51
- return Promise.reject("".concat(goodsName, "\u6570\u91CF\u5FC5\u987B\u5927\u4E8E0"));
52
- }
53
- if (((value === null || value === void 0 ? void 0 : value.jstReissueGoods) || []).some(function (goods) {
54
- var v = toNum(goods === null || goods === void 0 ? void 0 : goods.salePrice);
55
- var res = typeof v === "number" ? v < 0 : true;
56
- if (res) {
57
- goodsName = goods !== null && goods !== void 0 && goods.name ? "[".concat(goods === null || goods === void 0 ? void 0 : goods.name, "]") : '';
58
- }
59
- return res;
60
- })) {
61
- return Promise.reject("".concat(goodsName, "\u5355\u4EF7\u4E3A\u5927\u4E8E\u7B49\u4E8E0\u7684\u6570"));
33
+ var validatorFlag = erpFormValidator(_rule, value, type);
34
+ if (validatorFlag) {
35
+ return validatorFlag;
62
36
  }
63
37
  return Promise.resolve();
64
38
  }
@@ -68,32 +42,15 @@ var typeMap = {
68
42
  typeName: "jstReturnType",
69
43
  remark: "jstReturnType_memo",
70
44
  systemOrderNo: "jstSystemOrderNo",
71
- systemOrderBillType: 'jstSystemOrderBillType',
45
+ systemOrderBillType: "jstSystemOrderBillType",
72
46
  errMsg: "请选择聚水潭退货商品",
73
47
  name: "聚水潭",
74
- compType: '退货',
75
- validator: function validator(_rule, value) {
48
+ compType: "退货",
49
+ validator: function validator(_rule, value, type) {
76
50
  if (!_rule.required) return Promise.resolve();
77
- var goodsName = "";
78
- if (((value === null || value === void 0 ? void 0 : value.jstReturnGoods) || []).some(function (goods) {
79
- var qty = toNum(goods === null || goods === void 0 ? void 0 : goods.qty);
80
- var res = typeof qty === "number" ? qty < 1 : true;
81
- if (res) {
82
- goodsName = goods !== null && goods !== void 0 && goods.name ? "[".concat(goods === null || goods === void 0 ? void 0 : goods.name, "]") : '';
83
- }
84
- return res;
85
- })) {
86
- return Promise.reject("".concat(goodsName, "\u6570\u91CF\u5FC5\u987B\u5927\u4E8E0"));
87
- }
88
- if (((value === null || value === void 0 ? void 0 : value.jstReturnGoods) || []).some(function (goods) {
89
- var v = toNum(goods === null || goods === void 0 ? void 0 : goods.salePrice);
90
- var res = typeof v === "number" ? v < 0 : true;
91
- if (res) {
92
- goodsName = goods !== null && goods !== void 0 && goods.name ? "[".concat(goods === null || goods === void 0 ? void 0 : goods.name, "]") : '';
93
- }
94
- return res;
95
- })) {
96
- return Promise.reject("".concat(goodsName, "\u5355\u4EF7\u4E3A\u5927\u4E8E\u7B49\u4E8E0\u7684\u6570"));
51
+ var validatorFlag = erpFormValidator(_rule, value, type);
52
+ if (validatorFlag) {
53
+ return validatorFlag;
97
54
  }
98
55
  return Promise.resolve();
99
56
  }
@@ -113,8 +70,7 @@ var PublicReissue = /*#__PURE__*/_createClass(function PublicReissue(options) {
113
70
  _typeMap$options$type10,
114
71
  _typeMap$options$type11,
115
72
  _typeMap$options$type12,
116
- _this$componentConfig6,
117
- _typeMap$options$type15;
73
+ _this$componentConfig6;
118
74
  _classCallCheck(this, PublicReissue);
119
75
  _defineProperty(this, "name", void 0);
120
76
  _defineProperty(this, "id", void 0);
@@ -272,8 +228,11 @@ var PublicReissue = /*#__PURE__*/_createClass(function PublicReissue(options) {
272
228
  }
273
229
  }, {
274
230
  required: isRequired,
275
- validator: ((_typeMap$options$type15 = typeMap[options.type]) === null || _typeMap$options$type15 === void 0 ? void 0 : _typeMap$options$type15.validator) || function () {
276
- return Promise.resolve();
231
+ validator: function validator(_rule, value) {
232
+ var _typeMap$options$type15, _typeMap$options$type16;
233
+ return ((_typeMap$options$type15 = typeMap[options.type]) === null || _typeMap$options$type15 === void 0 ? void 0 : (_typeMap$options$type16 = _typeMap$options$type15.validator) === null || _typeMap$options$type16 === void 0 ? void 0 : _typeMap$options$type16.call(_typeMap$options$type15, _rule, value, options.type)) || function () {
234
+ return Promise.resolve();
235
+ };
277
236
  }
278
237
  }];
279
238
  this.dataType = "object";
@@ -150,7 +150,8 @@ var Logistics = /*#__PURE__*/_createClass(function Logistics(_options) {
150
150
  },
151
151
  formatFilterValue: function formatFilterValue(input) {
152
152
  var value = batchInput(input);
153
- console.log("formatFilterValue---", value);
153
+ // console.log("formatFilterValue---", value);
154
+
154
155
  return value && Array.isArray(value) ? value.join("") : value;
155
156
  }
156
157
  } : {
@@ -1,5 +1,5 @@
1
- import { ComponentInterface, PickOption, Record, ColumnConfig } from '../../type';
2
- import React from 'react';
1
+ import { ComponentInterface, PickOption, Record, ColumnConfig } from "../../type";
2
+ import React from "react";
3
3
  declare type Value = string | string[] | undefined;
4
4
  declare class BasicDataTime implements ComponentInterface {
5
5
  name: string;
@@ -8,14 +8,14 @@ declare class BasicDataTime implements ComponentInterface {
8
8
  type: string;
9
9
  rules: any[];
10
10
  showContains: boolean;
11
- componentConfig: ComponentInterface['componentConfig'];
11
+ componentConfig: ComponentInterface["componentConfig"];
12
12
  isCombinationComponent: boolean;
13
13
  formField: string;
14
14
  canSort: boolean;
15
15
  children: ComponentInterface[];
16
16
  dataMap: Record;
17
- dataType: ComponentInterface['dataType'];
18
- format: ComponentInterface['format'];
17
+ dataType: ComponentInterface["dataType"];
18
+ format: ComponentInterface["format"];
19
19
  constructor(options: PickOption);
20
20
  render: (value: Value) => React.JSX.Element;
21
21
  renderClient: (record: any) => React.JSX.Element | null;
@@ -6,21 +6,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
6
6
  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; }
7
7
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
8
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
- import React from 'react';
10
- import moment from 'moment';
9
+ import React from "react";
10
+ import moment from "moment";
11
11
  import { DateTime } from "../DataTime";
12
12
  import GetFormItem from "../GetFormItem";
13
13
  import ItemView from "../../commonComponents/ItemView";
14
- import { isNull, filterFn as _filterFn } from '@kmkf-fe-packages/kmkf-utils';
14
+ import { isNull, filterFn as _filterFn } from "@kmkf-fe-packages/kmkf-utils";
15
15
  import { SYMBOL } from "../../constant";
16
16
  var typeMap = {
17
- TRADE_CREATE_DATETIME: 'tradeCreateDateTime',
18
- TRADE_PAYMENT_DATETIME: 'tradePaymentDateTime',
19
- TRADE_DELIVERY_DATETIME: 'tradeDeliveryDateTime',
20
- TRADE_CLOSING_DATETIME: 'tradeClosingDateTime',
21
- BS_SIGNING_TIME: 'bsSigningTime',
22
- BS_SEND_TIME: 'bsSendTime',
23
- BS_TRADE_PAYMENT_TIME: 'bsTradePaymentTime'
17
+ TRADE_CREATE_DATETIME: "tradeCreateDateTime",
18
+ TRADE_PAYMENT_DATETIME: "tradePaymentDateTime",
19
+ TRADE_DELIVERY_DATETIME: "tradeDeliveryDateTime",
20
+ TRADE_CLOSING_DATETIME: "tradeClosingDateTime",
21
+ TRADE_SIGNING_DATETIME: "tradeSigningDateTime",
22
+ BS_SIGNING_TIME: "bsSigningTime",
23
+ BS_SEND_TIME: "bsSendTime",
24
+ BS_TRADE_PAYMENT_TIME: "bsTradePaymentTime"
24
25
  };
25
26
  var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
26
27
  var _this = this;
@@ -40,7 +41,7 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
40
41
  _defineProperty(this, "dataType", void 0);
41
42
  _defineProperty(this, "format", void 0);
42
43
  _defineProperty(this, "render", function (value) {
43
- return /*#__PURE__*/React.createElement("span", null, Array.isArray(value) ? value.join('~') : /*#__PURE__*/React.createElement("span", null, value));
44
+ return /*#__PURE__*/React.createElement("span", null, Array.isArray(value) ? value.join("~") : /*#__PURE__*/React.createElement("span", null, value));
44
45
  });
45
46
  _defineProperty(this, "renderClient", function (record) {
46
47
  return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
@@ -52,7 +53,7 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
52
53
  _defineProperty(this, "renderPc", function (value, record) {
53
54
  var _record;
54
55
  var type = _this.type;
55
- return /*#__PURE__*/React.createElement("span", null, (_record = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(_this.dataMap[type])]) !== null && _record !== void 0 ? _record : '--');
56
+ return /*#__PURE__*/React.createElement("span", null, (_record = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(_this.dataMap[type])]) !== null && _record !== void 0 ? _record : "--");
56
57
  });
57
58
  _defineProperty(this, "renderLog", function (r) {
58
59
  var type = _this.type;
@@ -66,7 +67,7 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
66
67
  _defineProperty(this, "renderExport", function (value, record) {
67
68
  var _record2;
68
69
  var type = _this.type;
69
- return (_record2 = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(typeMap[type])]) !== null && _record2 !== void 0 ? _record2 : '--';
70
+ return (_record2 = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(typeMap[type])]) !== null && _record2 !== void 0 ? _record2 : "--";
70
71
  });
71
72
  _defineProperty(this, "editRender", function (p) {
72
73
  var _this$componentConfig, _this$componentConfig2, _this$componentConfig3, _this$componentConfig4;
@@ -77,7 +78,7 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
77
78
  hidden: p === null || p === void 0 ? void 0 : p.hidden,
78
79
  display: p === null || p === void 0 ? void 0 : p.display,
79
80
  required: (_this$componentConfig = (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.required) !== null && _this$componentConfig !== void 0 ? _this$componentConfig : false,
80
- tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : '',
81
+ tooltip: (_this$componentConfig3 = _this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.showTooltip ? (_this$componentConfig4 = _this.componentConfig) === null || _this$componentConfig4 === void 0 ? void 0 : _this$componentConfig4.tooltip : "",
81
82
  component: /*#__PURE__*/React.createElement(DateTime, _extends({}, _this.componentConfig, {
82
83
  dateType: "DATE_TIME"
83
84
  }))
@@ -96,7 +97,7 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
96
97
  // 过滤组件id
97
98
  name: item.name,
98
99
  // 过滤组件名称
99
- filterComponentType: 'Date',
100
+ filterComponentType: "Date",
100
101
  filterFn: function filterFn(value) {
101
102
  return function (i) {
102
103
  var recordDateTime = _filterFn.filterTableListItemColumnValue(i, item.id, key);
@@ -106,13 +107,13 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
106
107
  formatFilterValue: function formatFilterValue(val) {
107
108
  if ((val === null || val === void 0 ? void 0 : val.length) > 0) {
108
109
  return val === null || val === void 0 ? void 0 : val.map(function (v) {
109
- return moment(v).startOf('second').valueOf();
110
+ return moment(v).startOf("second").valueOf();
110
111
  });
111
112
  }
112
113
  }
113
114
  };
114
- if ((_ref = ['BS_SIGNING_TIME', 'BS_SEND_TIME', 'BS_TRADE_PAYMENT_TIME']) !== null && _ref !== void 0 && _ref.includes(item.type)) {
115
- params.componentDataType = 'dateTime';
115
+ if ((_ref = ["BS_SIGNING_TIME", "BS_SEND_TIME", "BS_TRADE_PAYMENT_TIME"]) !== null && _ref !== void 0 && _ref.includes(item.type)) {
116
+ params.componentDataType = "dateTime";
116
117
  }
117
118
  return params;
118
119
  });
@@ -122,21 +123,22 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
122
123
  this.formField = "".concat(options.id, "_").concat(this.getKeyByComponentType(options.type));
123
124
  this.type = options.type;
124
125
  this.showContains = false;
125
- this.dataType = 'string';
126
- this.format = 'dateTime';
126
+ this.dataType = "string";
127
+ this.format = "dateTime";
127
128
  this.componentConfig = options.componentConfig;
128
129
  this.rules = [];
129
130
  this.isCombinationComponent = false;
130
131
  this.canSort = true;
131
132
  this.children = [];
132
133
  this.dataMap = {
133
- TRADE_CREATE_DATETIME: 'tradeCreateDateTime',
134
- TRADE_PAYMENT_DATETIME: 'tradePaymentDateTime',
135
- TRADE_DELIVERY_DATETIME: 'tradeDeliveryDateTime',
136
- TRADE_CLOSING_DATETIME: 'tradeClosingDateTime',
137
- BS_SIGNING_TIME: 'bsSigningTime',
138
- BS_SEND_TIME: 'bsSendTime',
139
- BS_TRADE_PAYMENT_TIME: 'bsTradePaymentTime'
134
+ TRADE_CREATE_DATETIME: "tradeCreateDateTime",
135
+ TRADE_PAYMENT_DATETIME: "tradePaymentDateTime",
136
+ TRADE_DELIVERY_DATETIME: "tradeDeliveryDateTime",
137
+ TRADE_CLOSING_DATETIME: "tradeClosingDateTime",
138
+ TRADE_SIGNING_DATETIME: "tradeSigningDateTime",
139
+ BS_SIGNING_TIME: "bsSigningTime",
140
+ BS_SEND_TIME: "bsSendTime",
141
+ BS_TRADE_PAYMENT_TIME: "bsTradePaymentTime"
140
142
  };
141
143
  });
142
144
  export default BasicDataTime;
@@ -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 } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => GyReissue | GyReturn | JstSendGood | MsgStatus | BasicPicture | BasicPicturePro | PublicExchange | PublicReissueGoods | ReissueLogistics | BasicSelect | StatusSelect | BasicDataTime | TradeDateTime | TradeId | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicRadio | BasicTextArea | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | SubForm | CommonDataTime | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstItemSelect | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | 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 | WdtGoods | WdtReissue | WdtReturn | WdtExchange | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods;
3
+ export declare const factory: (type: string, options: PickOption) => BsLogistics | GyReissue | GyReturn | JstSendGood | MsgStatus | BasicPicture | BasicPicturePro | PublicReissueGoods | ReissueLogistics | StatusSelect | BasicDataTime | TradeDateTime | BasicInput | BasicAddress | BasicCascader | BasicCheckbox | BasicSelect | BasicRadio | BasicTextArea | BasicMultSelect | BasicGrade | BasicRate | BasicFile | BasicPosting | SubForm | CommonDataTime | TradeId | ShopName | BuyerNick | ReceiverName | ReceiverMobile | ReceiverAddress | Logistics | ReturnLogistics | ActualPayment | ERemark | AliPay | ItemSelect | ItemId | ItemEnCode | SystemOrderNo | Ordinary | ThirdItemSelect | Payment | JstItemSelect | JstSupply | BsSystemOrder | BsGoods | BsE3Goods | PublicGoods | PublicExchange | BsE3Reissue | BsExchange | BsReissue | BsReturn | FlowStatusSelect | FlowMarkSelect | FlowTag | TemplateSelect | WorkOrderId | LogisticsInterception | LogisticsMoreInterception | LogisticsTrajectory | LogisticsMoreTrajectory | PlatForm | ShopInput | Submitter | PrevSubmitter | FlowCreator | Handler | CompletedUser | FlowWorkOrderId | Calculation | CommonSystemOrder | CommonMultiStatus | NodeDeadLine | HandlerDeadLine | NodeStayDuration | WlnGoods | BsPosting | NodeInput | FlowWorkOrderStatus | WdtGoods | WdtReissue | WdtReturn | WdtExchange | CommonInput | PaymentVoucherCode | Label | MemberLevel | AfterSalesOrderId | GyGoods;
@@ -70,6 +70,7 @@ export var factory = function factory(type, options) {
70
70
  case "TRADE_PAYMENT_DATETIME":
71
71
  case "TRADE_DELIVERY_DATETIME":
72
72
  case "TRADE_CLOSING_DATETIME":
73
+ case "TRADE_SIGNING_DATETIME":
73
74
  case "BS_SIGNING_TIME":
74
75
  case "BS_SEND_TIME":
75
76
  case "BS_TRADE_PAYMENT_TIME":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "2.0.55",
3
+ "version": "2.0.56",
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.55",
25
- "@kmkf-fe-packages/kmkf-utils": "2.0.55",
24
+ "@kmkf-fe-packages/basic-components": "2.0.56",
25
+ "@kmkf-fe-packages/kmkf-utils": "2.0.56",
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": "17280f003e2ecbdc5dd3316b1196c6b10d78c0f4",
44
+ "gitHead": "cc90a2328d7efea5866745a63d88e2b5107c6ef5",
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;