@kmkf-fe-packages/kmkf-utils 0.27.1-test.4 → 0.27.1-test.7

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.
@@ -0,0 +1,2 @@
1
+ export { useSendData } from './useSendData';
2
+ export { useLogisticsData } from './useLogisticsAddressData';
@@ -0,0 +1,2 @@
1
+ export { useSendData } from "./useSendData";
2
+ export { useLogisticsData } from "./useLogisticsAddressData";
@@ -0,0 +1,4 @@
1
+ export declare const useLogisticsData: (type: string) => {
2
+ logisticsData: any;
3
+ getNameByCode: (code: string | number) => any;
4
+ };
@@ -0,0 +1,34 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useState, useEffect } from 'react';
8
+ import { servers } from '@kmkf-fe-packages/kmkf-utils';
9
+ export var useLogisticsData = function useLogisticsData(type) {
10
+ var _useState = useState([]),
11
+ _useState2 = _slicedToArray(_useState, 2),
12
+ logisticsData = _useState2[0],
13
+ setLogisticsData = _useState2[1];
14
+ useEffect(function () {
15
+ if (type === 'wdt') {
16
+ servers.getWdtSellerLogisticsCompanyRelation().then(setLogisticsData).catch(function (e) {
17
+ // message.error(e.message)
18
+ });
19
+ }
20
+ }, []);
21
+ var getNameByCode = function getNameByCode(code) {
22
+ var currentLogistics = logisticsData.find(function (item) {
23
+ return item.value === code;
24
+ });
25
+ if (currentLogistics) {
26
+ return currentLogistics.label || '';
27
+ }
28
+ return '';
29
+ };
30
+ return {
31
+ logisticsData: logisticsData,
32
+ getNameByCode: getNameByCode
33
+ };
34
+ };
@@ -0,0 +1,4 @@
1
+ export declare const useSendData: (type: string) => {
2
+ sendData: any;
3
+ getSendNameByCode: (code: string | number) => any;
4
+ };
@@ -0,0 +1,34 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useState, useEffect } from 'react';
8
+ import { WDT } from '@kmkf-fe-packages/kmkf-utils';
9
+ export var useSendData = function useSendData(type) {
10
+ var _useState = useState([]),
11
+ _useState2 = _slicedToArray(_useState, 2),
12
+ sendData = _useState2[0],
13
+ setSendData = _useState2[1];
14
+ useEffect(function () {
15
+ if (type === 'wdt') {
16
+ WDT.getWarehouseDataAsync().then(setSendData).catch(function (e) {
17
+ // message.error(e?.message || '获取发货仓数据失败,请刷新重试');
18
+ });
19
+ }
20
+ }, []);
21
+ var getSendNameByCode = function getSendNameByCode(code) {
22
+ var currentSend = sendData.find(function (item) {
23
+ return item.value === code;
24
+ });
25
+ if (currentSend) {
26
+ return currentSend.label || '';
27
+ }
28
+ return '';
29
+ };
30
+ return {
31
+ sendData: sendData,
32
+ getSendNameByCode: getSendNameByCode
33
+ };
34
+ };
@@ -9,3 +9,4 @@ export { default as request } from "./request";
9
9
  export * as WDT from "./wdt";
10
10
  export * as servers from "./servers";
11
11
  export * from "./utils";
12
+ export * from "./hooks";
package/dist/esm/index.js CHANGED
@@ -10,4 +10,5 @@ import * as _WDT from "./wdt";
10
10
  export { _WDT as WDT };
11
11
  import * as _servers from "./servers";
12
12
  export { _servers as servers };
13
- export * from "./utils";
13
+ export * from "./utils";
14
+ export * from "./hooks";
@@ -11,3 +11,8 @@ export declare const queryWdtWarehouseList: (pageNo: number, pageSize: number) =
11
11
  }[];
12
12
  totalCount?: number | undefined;
13
13
  }>>;
14
+ export declare const getWdtSellerLogisticsCompanyRelation: () => Promise<{
15
+ label: string;
16
+ value: string;
17
+ disabled: boolean;
18
+ }[]>;
@@ -73,4 +73,28 @@ export var queryWdtWarehouseList = function queryWdtWarehouseList(pageNo, pageSi
73
73
  pageSize: pageSize
74
74
  }
75
75
  });
76
+ };
77
+ export var getWdtSellerLogisticsCompanyRelation = function getWdtSellerLogisticsCompanyRelation() {
78
+ return request({
79
+ url: "/qy/gdfw/wdt/erp/logistics/list",
80
+ method: "post",
81
+ data: {}
82
+ }).then(function (res) {
83
+ if (res !== null && res !== void 0 && res.success) {
84
+ var _res$data;
85
+ var list = ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.map(function (item) {
86
+ return {
87
+ label: item.logisticsName,
88
+ value: item.logisticsNo,
89
+ disabled: item.isDelete
90
+ };
91
+ }).filter(function (item) {
92
+ return item.value;
93
+ }).sort(function (a, b) {
94
+ return (a.disabled ? 1 : 0) - (b.disabled ? 1 : 0);
95
+ })) || [];
96
+ return list;
97
+ }
98
+ return [];
99
+ });
76
100
  };
@@ -164,7 +164,6 @@ export var wdtOrderBackFormValues = function wdtOrderBackFormValues() {
164
164
  return ((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []).reduce(function (prv, next) {
165
165
  var uniqueKey = next.uniqueKey;
166
166
  var config = next.componentConfig;
167
- console.log('[ prv ] >', prv[uniqueKey], next, detail);
168
167
  switch (next.workOrderComponentType) {
169
168
  case "WDT_SYSTEM_ORDER":
170
169
  prv[uniqueKey] = detail === null || detail === void 0 ? void 0 : detail.wdtSystemOrder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "0.27.1-test.4",
3
+ "version": "0.27.1-test.7",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -40,7 +40,7 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "156d314130701c3e3fd39a375bea1456b569591e",
43
+ "gitHead": "8d75e5eeca6c2b783dd065d893e62731da836488",
44
44
  "gitHooks": {
45
45
  "pre-commit": "lint-staged"
46
46
  }