@kmkf-fe-packages/services-components 0.7.14-alpha.9 → 0.7.15-alpha.1

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.
@@ -1,5 +1,5 @@
1
- import { ComponentInterface, PickOption, ColumnConfig, Record } from '../../type';
2
- import React from 'react';
1
+ import { ComponentInterface, PickOption, ColumnConfig, Record } from "../../type";
2
+ import React from "react";
3
3
  declare class ActualPayment implements ComponentInterface {
4
4
  name: string;
5
5
  id: string;
@@ -11,8 +11,10 @@ declare class ActualPayment implements ComponentInterface {
11
11
  canSort: boolean;
12
12
  children: ComponentInterface[];
13
13
  componentConfig: ComponentInterface["componentConfig"];
14
- dataType: ComponentInterface['dataType'];
14
+ dataType: ComponentInterface["dataType"];
15
+ dataMap: Record;
15
16
  constructor(options: PickOption);
17
+ getKeyByComponentType: (type: string) => any;
16
18
  renderClient: (record: any) => React.JSX.Element | null;
17
19
  renderPc: (value: unknown, record: Record) => React.JSX.Element;
18
20
  renderLog: (r: Record) => React.JSX.Element | null;
@@ -9,12 +9,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
  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; }
10
10
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
11
  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); }
12
- import React from 'react';
13
- import { ApaasInput } from '@kmkf-fe-packages/basic-components';
12
+ import React from "react";
13
+ import { ApaasInput } from "@kmkf-fe-packages/basic-components";
14
14
  import GetFormItem from "../GetFormItem";
15
15
  import ItemView from "../../commonComponents/ItemView";
16
- import { isNull, filterFn as _filterFn } from '@kmkf-fe-packages/kmkf-utils';
16
+ import { isNull, filterFn as _filterFn } from "@kmkf-fe-packages/kmkf-utils";
17
17
  import { SYMBOL } from "../../constant";
18
+ var typeMap = {
19
+ ACTUAL_PAYMENT: "actualPayment",
20
+ BS_NET_RECEIPTS: "bsNetReceipts",
21
+ BS_DEPOSIT: "bsDeposit",
22
+ BS_PACKAGE_WEIGHT: "bsPackageWeight"
23
+ };
18
24
  var ActualPayment = /*#__PURE__*/_createClass(function ActualPayment(options) {
19
25
  var _this = this;
20
26
  _classCallCheck(this, ActualPayment);
@@ -29,6 +35,10 @@ var ActualPayment = /*#__PURE__*/_createClass(function ActualPayment(options) {
29
35
  _defineProperty(this, "children", void 0);
30
36
  _defineProperty(this, "componentConfig", void 0);
31
37
  _defineProperty(this, "dataType", void 0);
38
+ _defineProperty(this, "dataMap", void 0);
39
+ _defineProperty(this, "getKeyByComponentType", function (type) {
40
+ return typeMap[type] || "";
41
+ });
32
42
  _defineProperty(this, "renderClient", function (record) {
33
43
  return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
34
44
  id: _this.id,
@@ -38,18 +48,22 @@ var ActualPayment = /*#__PURE__*/_createClass(function ActualPayment(options) {
38
48
  });
39
49
  _defineProperty(this, "renderPc", function (value, record) {
40
50
  var _record;
41
- return /*#__PURE__*/React.createElement("span", null, (_record = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_actualPayment")]) !== null && _record !== void 0 ? _record : '--');
51
+ var type = _this.type;
52
+ return /*#__PURE__*/React.createElement("span", null, (_record = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(typeMap[type])]) !== null && _record !== void 0 ? _record : "--");
42
53
  });
43
54
  _defineProperty(this, "renderLog", function (r) {
44
- if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_actualPayment")])) return null;
55
+ var type = _this.type;
56
+ if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_").concat(typeMap[type])])) return null;
45
57
  return _this.renderPc(undefined, r);
46
58
  });
47
59
  _defineProperty(this, "getComponentValue", function (r) {
48
- return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_actualPayment")];
60
+ var type = _this.type;
61
+ return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_").concat(typeMap[type])];
49
62
  });
50
63
  _defineProperty(this, "renderExport", function (value, record) {
51
64
  var _record2;
52
- return (_record2 = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_actualPayment")]) !== null && _record2 !== void 0 ? _record2 : '--';
65
+ var type = _this.type;
66
+ return (_record2 = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_").concat(typeMap[type])]) !== null && _record2 !== void 0 ? _record2 : "--";
53
67
  });
54
68
  _defineProperty(this, "editRender", function (p) {
55
69
  var _this$componentConfig, _this$componentConfig2;
@@ -65,14 +79,15 @@ var ActualPayment = /*#__PURE__*/_createClass(function ActualPayment(options) {
65
79
  });
66
80
  });
67
81
  _defineProperty(this, "filterConfig", function (item) {
82
+ var key = _this.getKeyByComponentType(item.type);
68
83
  return {
69
84
  searchDefaultConditions: SYMBOL.between,
70
85
  type: item.type,
71
- id: "".concat(item.id, "_actualPayment"),
86
+ id: "".concat(item.id, "_").concat(key),
72
87
  // 过滤组件id
73
88
  name: item.name,
74
89
  // 过滤组件名称
75
- filterComponentType: 'Rate',
90
+ filterComponentType: "Rate",
76
91
  rules: [{
77
92
  validator: function () {
78
93
  var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_, value) {
@@ -97,13 +112,13 @@ var ActualPayment = /*#__PURE__*/_createClass(function ActualPayment(options) {
97
112
  _context.next = 5;
98
113
  break;
99
114
  }
100
- return _context.abrupt("return", Promise.reject(new Error('请输入正确的金额区间范围')));
115
+ return _context.abrupt("return", Promise.reject(new Error("请输入正确的金额区间范围")));
101
116
  case 5:
102
117
  if (!(value[0] > value[1])) {
103
118
  _context.next = 7;
104
119
  break;
105
120
  }
106
- return _context.abrupt("return", Promise.reject(new Error('开始金额必须小于结束金额')));
121
+ return _context.abrupt("return", Promise.reject(new Error("开始金额必须小于结束金额")));
107
122
  case 7:
108
123
  case "end":
109
124
  return _context.stop();
@@ -117,7 +132,7 @@ var ActualPayment = /*#__PURE__*/_createClass(function ActualPayment(options) {
117
132
  }()
118
133
  }],
119
134
  props: {
120
- placeholder: ['始-实付金额', '终-实付金额']
135
+ placeholder: ["始-实付金额", "终-实付金额"]
121
136
  },
122
137
  formatFilterValue: function formatFilterValue(val) {
123
138
  if (val !== null && val !== void 0 && val.some(function (v) {
@@ -129,24 +144,30 @@ var ActualPayment = /*#__PURE__*/_createClass(function ActualPayment(options) {
129
144
  },
130
145
  filterFn: function filterFn(value) {
131
146
  return function (i) {
132
- return "".concat(_filterFn.filterTableListItemColumnValue(i, item.id, 'actualPayment')).includes(value);
147
+ return "".concat(_filterFn.filterTableListItemColumnValue(i, item.id, key)).includes(value);
133
148
  };
134
149
  }
135
150
  };
136
151
  });
137
152
  this.id = options.id;
138
- this.sortField = "".concat(options.id, "_actualPayment");
139
- this.formField = "".concat(options.id, "_actualPayment");
153
+ this.sortField = "".concat(options.id, "_").concat(this.getKeyByComponentType(options.type));
154
+ this.formField = "".concat(options.id, "_").concat(this.getKeyByComponentType(options.type));
140
155
  this.name = options.name;
141
156
  this.type = options.type;
142
- this.dataType = 'number';
157
+ this.dataType = "number";
143
158
  this.isCombinationComponent = false;
144
159
  this.canSort = true;
145
160
  this.children = [];
146
161
  this.componentConfig = options.componentConfig;
147
162
  this.rules = [{
148
163
  pattern: /^\d+(\.\d{1,2})?$/,
149
- message: '字段为正数或最多两位小数'
164
+ message: "字段为正数或最多两位小数"
150
165
  }];
166
+ this.dataMap = {
167
+ ACTUAL_PAYMENT: "actualPayment",
168
+ BS_NET_RECEIPTS: "bsNetReceipts",
169
+ BS_DEPOSIT: "bsDeposit",
170
+ BS_PACKAGE_WEIGHT: "bsPackageWeight"
171
+ };
151
172
  });
152
173
  export default ActualPayment;
@@ -0,0 +1,50 @@
1
+ import { ComponentInterface, PickOption, ColumnConfig, Record } from "../../type";
2
+ import React from "react";
3
+ import { ExpressData } from "@kmkf-fe-packages/kmkf-utils";
4
+ import Express from "../Express";
5
+ import ExpressCode from "../ExpressCode";
6
+ declare class BsLogistics implements ComponentInterface {
7
+ name: string;
8
+ id: string;
9
+ sortField: string;
10
+ type: string;
11
+ rules: any[];
12
+ componentConfig: ComponentInterface["componentConfig"];
13
+ expressDateInstance: InstanceType<typeof ExpressData>;
14
+ express: Express;
15
+ expressCode: ExpressCode;
16
+ isCombinationComponent: boolean;
17
+ formField: string;
18
+ canSort: boolean;
19
+ children: ComponentInterface[];
20
+ dataType: ComponentInterface["dataType"];
21
+ constructor(options: PickOption);
22
+ editRender: (p: any) => React.JSX.Element;
23
+ renderClient: (record: Record) => React.JSX.Element;
24
+ renderPc: () => null;
25
+ renderLog: (r: Record) => React.JSX.Element;
26
+ getComponentValue: (r: Record) => {
27
+ company: any;
28
+ order: any;
29
+ };
30
+ renderExport: () => null;
31
+ filterConfig: (item: ColumnConfig) => ({
32
+ searchDefaultConditions: "in";
33
+ type: string;
34
+ id: string;
35
+ name: string;
36
+ filterComponentType: "MultipleSelect";
37
+ props: {
38
+ options: any[];
39
+ };
40
+ filterFn: (value: string) => (i: Record) => boolean;
41
+ } | {
42
+ searchDefaultConditions: "like";
43
+ type: string;
44
+ id: string;
45
+ name: string;
46
+ filterComponentType: "Input";
47
+ filterFn: (value: string) => (i: Record) => boolean;
48
+ })[];
49
+ }
50
+ export default BsLogistics;
@@ -0,0 +1,115 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ 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; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ 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); }
11
+ import React from "react";
12
+ import { ExpressData } from "@kmkf-fe-packages/kmkf-utils";
13
+ import { ExpressLogistics } from "@kmkf-fe-packages/basic-components";
14
+ import Express from "../Express";
15
+ import ExpressCode from "../ExpressCode";
16
+ import GetFormItem from "../GetFormItem";
17
+ var BsLogistics = /*#__PURE__*/_createClass(function BsLogistics(options) {
18
+ var _this = this,
19
+ _this$componentConfig3;
20
+ _classCallCheck(this, BsLogistics);
21
+ _defineProperty(this, "name", void 0);
22
+ _defineProperty(this, "id", void 0);
23
+ _defineProperty(this, "sortField", void 0);
24
+ _defineProperty(this, "type", void 0);
25
+ _defineProperty(this, "rules", void 0);
26
+ _defineProperty(this, "componentConfig", void 0);
27
+ _defineProperty(this, "expressDateInstance", void 0);
28
+ _defineProperty(this, "express", void 0);
29
+ _defineProperty(this, "expressCode", void 0);
30
+ _defineProperty(this, "isCombinationComponent", void 0);
31
+ _defineProperty(this, "formField", void 0);
32
+ _defineProperty(this, "canSort", void 0);
33
+ _defineProperty(this, "children", void 0);
34
+ _defineProperty(this, "dataType", void 0);
35
+ _defineProperty(this, "editRender", function (p) {
36
+ var _this$componentConfig, _this$componentConfig2;
37
+ return /*#__PURE__*/React.createElement(GetFormItem, {
38
+ title: _this.name,
39
+ name: _this.id,
40
+ rules: _this.rules,
41
+ hidden: p === null || p === void 0 ? void 0 : p.hidden,
42
+ 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,
43
+ component: /*#__PURE__*/React.createElement(ExpressLogistics, _extends({}, _this.componentConfig, {
44
+ options: _this.expressDateInstance.getExpressData(),
45
+ onBlur: p === null || p === void 0 ? void 0 : p.onBlur
46
+ }))
47
+ });
48
+ });
49
+ _defineProperty(this, "renderClient", function (record) {
50
+ return /*#__PURE__*/React.createElement(React.Fragment, null, _this.express.renderClient(record), _this.expressCode.renderClient(record));
51
+ });
52
+ _defineProperty(this, "renderPc", function () {
53
+ return null;
54
+ });
55
+ _defineProperty(this, "renderLog", function (r) {
56
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, _this.express.name, ": ", _this.express.renderLog(r)), /*#__PURE__*/React.createElement("div", null, _this.expressCode.name, ": ", _this.expressCode.renderLog(r)));
57
+ });
58
+ _defineProperty(this, "getComponentValue", function (r) {
59
+ return {
60
+ company: _this.express.getComponentValue(r),
61
+ order: _this.expressCode.getComponentValue(r)
62
+ };
63
+ });
64
+ _defineProperty(this, "renderExport", function () {
65
+ return null;
66
+ });
67
+ _defineProperty(this, "filterConfig", function (item) {
68
+ return [_this.express.filterConfig(_objectSpread(_objectSpread({}, item), {}, {
69
+ subKey: "bsLogisticsCompany"
70
+ })), _this.expressCode.filterConfig(_objectSpread(_objectSpread({}, item), {}, {
71
+ subKey: "bsLogisticsCode"
72
+ }))];
73
+ });
74
+ this.name = options.name;
75
+ this.id = options.id;
76
+ this.sortField = options.id;
77
+ this.formField = options.id;
78
+ this.type = options.type;
79
+ this.componentConfig = options.componentConfig;
80
+ this.expressDateInstance = ExpressData.getInstance();
81
+ this.express = new Express(_objectSpread(_objectSpread({}, options), {}, {
82
+ name: "快递物流公司",
83
+ id: "".concat(this.id, "_bsLogisticsCompany")
84
+ }));
85
+ this.expressCode = new ExpressCode(_objectSpread(_objectSpread({}, options), {}, {
86
+ name: "快递物流单号",
87
+ id: "".concat(this.id, "_bsLogisticsCode")
88
+ }));
89
+ this.isCombinationComponent = true;
90
+ this.canSort = false;
91
+ this.dataType = "object";
92
+ this.children = [this.express, this.expressCode];
93
+ this.rules = (_this$componentConfig3 = this.componentConfig) !== null && _this$componentConfig3 !== void 0 && _this$componentConfig3.required ? [{
94
+ validator: function validator(_, value) {
95
+ var _this$componentConfig4;
96
+ if ((_this$componentConfig4 = _this.componentConfig) !== null && _this$componentConfig4 !== void 0 && _this$componentConfig4.isSingle) {
97
+ var _this$componentConfig5, _this$componentConfig6;
98
+ if (((_this$componentConfig5 = _this.componentConfig) === null || _this$componentConfig5 === void 0 ? void 0 : _this$componentConfig5.showField) === "EXPRESS_COMPANY" && !(value !== null && value !== void 0 && value.company)) {
99
+ return Promise.reject(new Error("请选择物流公司"));
100
+ } else if (((_this$componentConfig6 = _this.componentConfig) === null || _this$componentConfig6 === void 0 ? void 0 : _this$componentConfig6.showField) === "EXPRESS_WAYBILL_CODE" && !(value !== null && value !== void 0 && value.order)) {
101
+ return Promise.reject(new Error("请输入物流单号"));
102
+ }
103
+ } else {
104
+ if (!(value !== null && value !== void 0 && value.company)) {
105
+ return Promise.reject(new Error("请选择物流公司"));
106
+ }
107
+ if (!(value !== null && value !== void 0 && value.order)) {
108
+ return Promise.reject(new Error("请输入物流单号"));
109
+ }
110
+ }
111
+ return Promise.resolve();
112
+ }
113
+ }] : [];
114
+ });
115
+ export default BsLogistics;
@@ -0,0 +1,25 @@
1
+ import { ComponentInterface, PickOption, ColumnConfig, ALignType, Record } from "../../type";
2
+ import React from "react";
3
+ declare class BsSendGood implements ComponentInterface {
4
+ name: string;
5
+ id: string;
6
+ sortField: string;
7
+ type: string;
8
+ rules: any[];
9
+ componentConfig: ComponentInterface["componentConfig"];
10
+ align: ALignType;
11
+ isCombinationComponent: boolean;
12
+ formField: string;
13
+ canSort: boolean;
14
+ children: ComponentInterface[];
15
+ dataType: ComponentInterface["dataType"];
16
+ constructor(options: PickOption);
17
+ renderClient: (record: Record) => React.JSX.Element | null;
18
+ renderPc: (value: any, record: Record) => React.JSX.Element;
19
+ renderLog: (r: Record) => React.JSX.Element | null;
20
+ getComponentValue: (r: Record) => any;
21
+ renderExport: (value: any, record: any) => any;
22
+ editRender: (p: any) => React.JSX.Element;
23
+ filterConfig: (item: ColumnConfig) => never[];
24
+ }
25
+ export default BsSendGood;
@@ -0,0 +1,116 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
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 some from "lodash/some";
11
+ import GetFormItem from "../GetFormItem";
12
+ import { JstGoodImage } from "../Common";
13
+ import { JstGoods } from "@kmkf-fe-packages/basic-components";
14
+ import ItemView from "../../commonComponents/ItemView";
15
+ import { isNull } from "@kmkf-fe-packages/kmkf-utils";
16
+ var BsSendGood = /*#__PURE__*/_createClass(function BsSendGood(options) {
17
+ var _this = this,
18
+ _this$componentConfig;
19
+ _classCallCheck(this, BsSendGood);
20
+ _defineProperty(this, "name", void 0);
21
+ _defineProperty(this, "id", void 0);
22
+ _defineProperty(this, "sortField", void 0);
23
+ _defineProperty(this, "type", void 0);
24
+ _defineProperty(this, "rules", void 0);
25
+ _defineProperty(this, "componentConfig", void 0);
26
+ _defineProperty(this, "align", void 0);
27
+ _defineProperty(this, "isCombinationComponent", void 0);
28
+ _defineProperty(this, "formField", void 0);
29
+ _defineProperty(this, "canSort", void 0);
30
+ _defineProperty(this, "children", void 0);
31
+ _defineProperty(this, "dataType", void 0);
32
+ _defineProperty(this, "renderClient", function (record) {
33
+ var isShow = Array.isArray(record === null || record === void 0 ? void 0 : record[_this.id]) ? some(record === null || record === void 0 ? void 0 : record[_this.id], function (item) {
34
+ return !isNull(item);
35
+ }) : false;
36
+ return isShow ? /*#__PURE__*/React.createElement(ItemView, {
37
+ id: _this.id,
38
+ label: _this.name,
39
+ value: /*#__PURE__*/React.createElement(JstGoodImage, {
40
+ list: record === null || record === void 0 ? void 0 : record[_this.id],
41
+ type: 3
42
+ })
43
+ }) : null;
44
+ });
45
+ _defineProperty(this, "renderPc", function (value, record) {
46
+ var list = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_bsSendGood")];
47
+ //兼容多个商品
48
+ return /*#__PURE__*/React.createElement(JstGoodImage, {
49
+ list: list,
50
+ type: 3
51
+ });
52
+ });
53
+ _defineProperty(this, "renderLog", function (r) {
54
+ var list = r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_bsSendGood")];
55
+ if (isNull(list)) return null;
56
+ return _this.renderPc(undefined, r);
57
+ });
58
+ _defineProperty(this, "getComponentValue", function (r) {
59
+ return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_bsSendGood")];
60
+ });
61
+ _defineProperty(this, "renderExport", function (value, record) {
62
+ var list = record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_bsSendGood")];
63
+ return (list || []).map(function (item) {
64
+ return [item === null || item === void 0 ? void 0 : item.sendId, item === null || item === void 0 ? void 0 : item.sendName].join("/");
65
+ }).join(",");
66
+ });
67
+ _defineProperty(this, "editRender", function (p) {
68
+ return /*#__PURE__*/React.createElement(GetFormItem, {
69
+ title: _this.name,
70
+ name: _this.id,
71
+ rules: _this.rules,
72
+ required: false,
73
+ hidden: p === null || p === void 0 ? void 0 : p.hidden,
74
+ component: /*#__PURE__*/React.createElement(JstGoods, _extends({}, _this.componentConfig, {
75
+ type: 3
76
+ }))
77
+ });
78
+ });
79
+ _defineProperty(this, "filterConfig", function (item) {
80
+ return [];
81
+ });
82
+ this.name = options.name;
83
+ this.id = options.id;
84
+ this.sortField = "".concat(options.id, "_bsSendGood");
85
+ this.formField = "".concat(options.id, "_bsSendGood");
86
+ this.type = options.type;
87
+ this.componentConfig = options.componentConfig;
88
+ this.dataType = "object";
89
+ this.rules = (_this$componentConfig = this.componentConfig) !== null && _this$componentConfig !== void 0 && _this$componentConfig.required ? [{
90
+ required: true,
91
+ validator: function validator(_, value) {
92
+ if (!value || !value.length) {
93
+ return Promise.reject(new Error("请选择宝贝"));
94
+ }
95
+ var hasNo = (value || []).some(function (item) {
96
+ var _this$componentConfig2, _this$componentConfig3;
97
+ if (["sendName"].includes((_this === null || _this === void 0 ? void 0 : (_this$componentConfig2 = _this.componentConfig) === null || _this$componentConfig2 === void 0 ? void 0 : _this$componentConfig2.showField) || "")) {
98
+ return item.sendName;
99
+ } else if (["sendId"].includes((_this === null || _this === void 0 ? void 0 : (_this$componentConfig3 = _this.componentConfig) === null || _this$componentConfig3 === void 0 ? void 0 : _this$componentConfig3.showField) || "")) {
100
+ return item.sendId;
101
+ } else {
102
+ return item.sendId && item.sendName;
103
+ }
104
+ });
105
+ if (!hasNo) {
106
+ return Promise.reject(new Error("\u81F3\u5C11\u586B\u5199\u4E00\u4E2A\u5B8C\u6574\u7684\u53D1\u8D27\u4ED3\u4FE1\u606F"));
107
+ }
108
+ return Promise.resolve();
109
+ }
110
+ }] : [];
111
+ this.align = "left";
112
+ this.isCombinationComponent = false;
113
+ this.canSort = false;
114
+ this.children = [];
115
+ });
116
+ export default BsSendGood;
@@ -0,0 +1,33 @@
1
+ import { ComponentInterface, PickOption, Record } from "../../type";
2
+ import React from "react";
3
+ declare type Value = string[] | undefined;
4
+ declare class BasicFile implements ComponentInterface {
5
+ name: string;
6
+ id: string;
7
+ sortField: string;
8
+ type: string;
9
+ rules: any[];
10
+ componentConfig: ComponentInterface["componentConfig"];
11
+ isCombinationComponent: boolean;
12
+ canSort: boolean;
13
+ children: ComponentInterface[];
14
+ constructor(options: PickOption);
15
+ formatPictures: (pictures: string) => string[];
16
+ render: (value: Value) => React.JSX.Element | null;
17
+ renderPc: (value: any, record: Record) => React.JSX.Element | React.JSX.Element[];
18
+ renderLog: (r: Record) => React.JSX.Element | React.JSX.Element[] | null;
19
+ getComponentValue: (r: Record) => any;
20
+ renderClient: (record: any) => React.JSX.Element | null;
21
+ editRender: () => React.JSX.Element;
22
+ /**
23
+ *
24
+ * @returns 图片类型的导出需要在导出时单独处理
25
+ */
26
+ renderExport: () => null;
27
+ /**
28
+ *
29
+ * @returns 图片不支持过滤
30
+ */
31
+ filterConfig: () => never[];
32
+ }
33
+ export default BasicFile;
@@ -0,0 +1,117 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
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 { Image } from "antd";
11
+ import { ApaasUploadFile } from "@kmkf-fe-packages/basic-components";
12
+ import { imgResize } from "@kmkf-fe-packages/kmkf-utils";
13
+ import GetFormItem from "../GetFormItem";
14
+ import ItemView from "../../commonComponents/ItemView";
15
+ import { isNull } from "@kmkf-fe-packages/kmkf-utils";
16
+ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
17
+ var _this = this;
18
+ _classCallCheck(this, BasicFile);
19
+ _defineProperty(this, "name", void 0);
20
+ _defineProperty(this, "id", void 0);
21
+ _defineProperty(this, "sortField", void 0);
22
+ _defineProperty(this, "type", void 0);
23
+ _defineProperty(this, "rules", void 0);
24
+ _defineProperty(this, "componentConfig", void 0);
25
+ _defineProperty(this, "isCombinationComponent", void 0);
26
+ _defineProperty(this, "canSort", void 0);
27
+ _defineProperty(this, "children", void 0);
28
+ _defineProperty(this, "formatPictures", function (pictures) {
29
+ pictures = pictures.replace(/[\[\]]/g, "");
30
+ pictures = pictures.replace(/\s/g, "");
31
+ return pictures ? pictures.split(",") : [];
32
+ });
33
+ _defineProperty(this, "render", function (value) {
34
+ if (!(value !== null && value !== void 0 && value.length)) {
35
+ return null;
36
+ }
37
+ return /*#__PURE__*/React.createElement("div", null, value === null || value === void 0 ? void 0 : value.map(function (pic) {
38
+ return /*#__PURE__*/React.createElement("div", {
39
+ style: {
40
+ marginRight: "5px",
41
+ display: "inline-block"
42
+ }
43
+ }, /*#__PURE__*/React.createElement(Image, {
44
+ width: 32,
45
+ src: imgResize(pic || ""),
46
+ preview: {
47
+ src: imgResize(pic || "", 0, 0)
48
+ }
49
+ }));
50
+ }));
51
+ });
52
+ _defineProperty(this, "renderPc", function (value, record) {
53
+ if ((record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_picture")]) === undefined) {
54
+ return /*#__PURE__*/React.createElement("span", null, "--");
55
+ }
56
+ var finalPictures = _this.formatPictures(record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_picture")]).map(function (item) {
57
+ return "".concat(window.location.origin, "/").concat(item);
58
+ });
59
+ return finalPictures === null || finalPictures === void 0 ? void 0 : finalPictures.map(function (pic) {
60
+ return /*#__PURE__*/React.createElement("div", {
61
+ style: {
62
+ marginRight: "5px",
63
+ display: "inline-block"
64
+ }
65
+ }, /*#__PURE__*/React.createElement(Image, {
66
+ width: 32,
67
+ src: "".concat(pic, "?x-oss-process=image/resize,m_pad,h_40,w_40"),
68
+ preview: {
69
+ src: pic
70
+ }
71
+ }));
72
+ });
73
+ });
74
+ _defineProperty(this, "renderLog", function (r) {
75
+ if (isNull(r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_picture")])) return null;
76
+ return _this.renderPc(undefined, r);
77
+ });
78
+ _defineProperty(this, "getComponentValue", function (r) {
79
+ return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_picture")];
80
+ });
81
+ _defineProperty(this, "renderClient", function (record) {
82
+ return !isNull(record === null || record === void 0 ? void 0 : record[_this.id]) ? /*#__PURE__*/React.createElement(ItemView, {
83
+ id: _this.id,
84
+ label: _this.name,
85
+ value: _this.render(record === null || record === void 0 ? void 0 : record[_this.id])
86
+ }) : null;
87
+ });
88
+ _defineProperty(this, "editRender", function () {
89
+ var _this$componentConfig, _this$componentConfig2;
90
+ return /*#__PURE__*/React.createElement(GetFormItem, {
91
+ title: _this.name,
92
+ name: _this.id,
93
+ rules: _this.rules,
94
+ 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,
95
+ component: /*#__PURE__*/React.createElement(ApaasUploadFile, _extends({}, _this.componentConfig, {
96
+ uniqueKey: _this.id,
97
+ hostUrl: "https://kefu.kuaimai.com"
98
+ }))
99
+ });
100
+ });
101
+ _defineProperty(this, "renderExport", function () {
102
+ return null;
103
+ });
104
+ _defineProperty(this, "filterConfig", function () {
105
+ return [];
106
+ });
107
+ this.name = options.name;
108
+ this.id = options.id;
109
+ this.sortField = "".concat(options.id, "_file");
110
+ this.type = options.type;
111
+ this.componentConfig = options.componentConfig;
112
+ this.rules = [];
113
+ this.isCombinationComponent = false;
114
+ this.canSort = false;
115
+ this.children = [];
116
+ });
117
+ export default BasicFile;