@kmkf-fe-packages/services-components 0.9.1-alpha.0 → 0.9.2-alpha.0

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,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  declare type getFormItemProps = {
3
3
  name: string;
4
4
  title: string;
@@ -28,6 +28,6 @@ export declare const BsGoodsTable: ({ list, showHeader, text, }: {
28
28
  showHeader: string[];
29
29
  text?: string | undefined;
30
30
  }) => React.JSX.Element;
31
- export declare const FileRender: ({ fileList }: any) => React.JSX.Element;
31
+ export declare const FileRender: ({ fileList, canDownload }: any) => React.JSX.Element;
32
32
  export declare const BsSystemOrderTable: ({ value }: any) => React.JSX.Element;
33
33
  export {};
@@ -8,10 +8,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { Form, Button, Modal, Tooltip, Space, Image, Popover, Table, message } from 'antd';
12
- import React, { useState, useMemo } from 'react';
13
- import { ExpressData } from '@kmkf-fe-packages/kmkf-utils';
14
- import { CopyToClipboard } from 'react-copy-to-clipboard';
11
+ import { Form, Button, Modal, Tooltip, Space, Image, Popover, Table, message } from "antd";
12
+ import React, { useState, useMemo } from "react";
13
+ import { ExpressData } from "@kmkf-fe-packages/kmkf-utils";
14
+ import { CopyToClipboard } from "react-copy-to-clipboard";
15
15
  import styles from "./index.module.less";
16
16
  import defaultImg from "./img/default-img.png";
17
17
  export var getFormItem = function getFormItem(_ref) {
@@ -31,7 +31,7 @@ export var getFormItem = function getFormItem(_ref) {
31
31
  return /*#__PURE__*/React.createElement("div", {
32
32
  className: "form-item--wrap",
33
33
  style: {
34
- position: 'relative'
34
+ position: "relative"
35
35
  }
36
36
  }, /*#__PURE__*/React.createElement(Form.Item, {
37
37
  name: name,
@@ -45,43 +45,43 @@ export var showImage = function showImage(_ref2) {
45
45
  var item = _ref2.item,
46
46
  type = _ref2.type,
47
47
  index = _ref2.index;
48
- var picUrl = item.picUrl ? (item === null || item === void 0 ? void 0 : item.platform) !== 'tabao' ? item.picUrl : item.picUrl + '_40x40.jpg' : defaultImg;
48
+ var picUrl = item.picUrl ? (item === null || item === void 0 ? void 0 : item.platform) !== "tabao" ? item.picUrl : item.picUrl + "_40x40.jpg" : defaultImg;
49
49
  return /*#__PURE__*/React.createElement("div", {
50
50
  className: styles.goodImgBox,
51
51
  key: index
52
- }, (item === null || item === void 0 ? void 0 : item.platform) === 'taobao' ? /*#__PURE__*/React.createElement("a", {
52
+ }, (item === null || item === void 0 ? void 0 : item.platform) === "taobao" ? /*#__PURE__*/React.createElement("a", {
53
53
  target: "_blank",
54
54
  href: "https://item.taobao.com/item.htm?id=".concat(item.numIid)
55
55
  }, /*#__PURE__*/React.createElement("img", {
56
56
  style: {
57
- width: '40px',
58
- height: '40px',
59
- objectFit: 'contain'
57
+ width: "40px",
58
+ height: "40px",
59
+ objectFit: "contain"
60
60
  },
61
61
  src: picUrl
62
62
  })) : /*#__PURE__*/React.createElement("img", {
63
63
  style: {
64
- width: '40px',
65
- height: '40px',
66
- objectFit: 'contain'
64
+ width: "40px",
65
+ height: "40px",
66
+ objectFit: "contain"
67
67
  },
68
68
  src: picUrl
69
69
  }), /*#__PURE__*/React.createElement("div", {
70
70
  className: styles.options
71
- }, type === 'itemId' && /*#__PURE__*/React.createElement(TextTool, {
72
- title: '商品id',
71
+ }, type === "itemId" && /*#__PURE__*/React.createElement(TextTool, {
72
+ title: "商品id",
73
73
  text: item.numIid
74
- }), type === 'itemCode' && /*#__PURE__*/React.createElement(TextTool, {
75
- title: '商品编码',
74
+ }), type === "itemCode" && /*#__PURE__*/React.createElement(TextTool, {
75
+ title: "商品编码",
76
76
  text: item.outerId
77
- }), (type === 'itemThird' || type === 'jstItemThird') && (item.itemId || item.supplierItemOuterId) && /*#__PURE__*/React.createElement(TextTool, {
78
- title: '供应商编码',
77
+ }), (type === "itemThird" || type === "jstItemThird") && (item.itemId || item.supplierItemOuterId) && /*#__PURE__*/React.createElement(TextTool, {
78
+ title: "供应商编码",
79
79
  text: item.itemId || item.supplierItemOuterId
80
- }), (type === 'itemThird' || type === 'jstItemThird') && item.supplierName && /*#__PURE__*/React.createElement(TextTool, {
81
- title: '供应商名称',
80
+ }), (type === "itemThird" || type === "jstItemThird") && item.supplierName && /*#__PURE__*/React.createElement(TextTool, {
81
+ title: "供应商名称",
82
82
  text: item.supplierName
83
83
  }), item.propertiesName && /*#__PURE__*/React.createElement(TextTool, {
84
- title: '规格',
84
+ title: "规格",
85
85
  text: item.propertiesName
86
86
  })));
87
87
  };
@@ -94,9 +94,9 @@ var TextTool = function TextTool(_ref3) {
94
94
  title: text
95
95
  }, /*#__PURE__*/React.createElement("div", {
96
96
  style: {
97
- overflow: 'hidden',
98
- whiteSpace: 'nowrap',
99
- textOverflow: 'ellipsis'
97
+ overflow: "hidden",
98
+ whiteSpace: "nowrap",
99
+ textOverflow: "ellipsis"
100
100
  }
101
101
  }, title, ":", text));
102
102
  };
@@ -124,47 +124,47 @@ export var ShowTotalImage = function ShowTotalImage(_ref4) {
124
124
  title: "\u6240\u6709\u9009\u62E9\u5B9D\u8D1D"
125
125
  }, /*#__PURE__*/React.createElement("div", {
126
126
  style: {
127
- display: 'flex',
128
- flexWrap: 'wrap'
127
+ display: "flex",
128
+ flexWrap: "wrap"
129
129
  }
130
130
  }, allImage.map(function (i, index) {
131
131
  return /*#__PURE__*/React.createElement("div", {
132
132
  style: {
133
- width: '50%'
133
+ width: "50%"
134
134
  },
135
135
  key: index
136
136
  }, /*#__PURE__*/React.createElement("a", {
137
137
  href: i.link,
138
138
  target: "__blank",
139
139
  style: {
140
- marginRight: '12px',
141
- marginTop: '8px',
142
- padding: '2px',
143
- border: '1px dashed #ccc',
144
- display: 'inline-block'
140
+ marginRight: "12px",
141
+ marginTop: "8px",
142
+ padding: "2px",
143
+ border: "1px dashed #ccc",
144
+ display: "inline-block"
145
145
  }
146
146
  }, /*#__PURE__*/React.createElement("img", {
147
147
  alt: "",
148
148
  src: i.picUrl || defaultImg,
149
149
  style: {
150
- width: '72px',
151
- height: '72px',
152
- objectFit: 'contain'
150
+ width: "72px",
151
+ height: "72px",
152
+ objectFit: "contain"
153
153
  }
154
- })), /*#__PURE__*/React.createElement("div", null, type === 'itemId' && /*#__PURE__*/React.createElement(TextTool, {
155
- title: '商品id',
154
+ })), /*#__PURE__*/React.createElement("div", null, type === "itemId" && /*#__PURE__*/React.createElement(TextTool, {
155
+ title: "商品id",
156
156
  text: i.numIid
157
- }), type === 'itemCode' && /*#__PURE__*/React.createElement(TextTool, {
158
- title: '商品编码',
157
+ }), type === "itemCode" && /*#__PURE__*/React.createElement(TextTool, {
158
+ title: "商品编码",
159
159
  text: i.outerId
160
- }), (type === 'itemThird' || type === 'jstItemThird') && (i.itemId || i.supplierItemOuterId) && /*#__PURE__*/React.createElement(TextTool, {
161
- title: '供应商编码',
160
+ }), (type === "itemThird" || type === "jstItemThird") && (i.itemId || i.supplierItemOuterId) && /*#__PURE__*/React.createElement(TextTool, {
161
+ title: "供应商编码",
162
162
  text: i.itemId || i.supplierItemOuterId
163
- }), (type === 'itemThird' || type === 'jstItemThird') && i.supplierName && /*#__PURE__*/React.createElement(TextTool, {
164
- title: '供应商名称',
163
+ }), (type === "itemThird" || type === "jstItemThird") && i.supplierName && /*#__PURE__*/React.createElement(TextTool, {
164
+ title: "供应商名称",
165
165
  text: i.supplierName
166
166
  }), i.propertiesName && /*#__PURE__*/React.createElement(TextTool, {
167
- title: '规格',
167
+ title: "规格",
168
168
  text: i.propertiesName
169
169
  })));
170
170
  }))));
@@ -174,12 +174,12 @@ export var GoodImage = function GoodImage(_ref5) {
174
174
  var _list$slice;
175
175
  var list = _ref5.list,
176
176
  _ref5$type = _ref5.type,
177
- type = _ref5$type === void 0 ? '' : _ref5$type;
177
+ type = _ref5$type === void 0 ? "" : _ref5$type;
178
178
  var total = (list === null || list === void 0 ? void 0 : list.length) || 0;
179
179
  var initShowTotal = 3;
180
180
  return (list === null || list === void 0 ? void 0 : list.length) > 0 ? /*#__PURE__*/React.createElement("div", {
181
181
  style: {
182
- display: type === 'itemSelect' ? 'flex' : 'block'
182
+ display: type === "itemSelect" ? "flex" : "block"
183
183
  }
184
184
  }, list === null || list === void 0 ? void 0 : (_list$slice = list.slice(0, initShowTotal)) === null || _list$slice === void 0 ? void 0 : _list$slice.map(function (item, index) {
185
185
  return showImage({
@@ -196,7 +196,7 @@ export var GoodImage = function GoodImage(_ref5) {
196
196
  var content = function content(item, index) {
197
197
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
198
198
  style: {
199
- textAlign: 'center'
199
+ textAlign: "center"
200
200
  }
201
201
  }, "\u5305\u88F9".concat(index + 1, "\u5546\u54C1\u4FE1\u606F")), ((item === null || item === void 0 ? void 0 : item.items) || []).map(function (t, index) {
202
202
  return /*#__PURE__*/React.createElement("div", {
@@ -223,17 +223,17 @@ export var JstGoodImage = function JstGoodImage(_ref6) {
223
223
  }, /*#__PURE__*/React.createElement("span", {
224
224
  key: index,
225
225
  style: {
226
- color: '#1890ff',
227
- cursor: 'pointer'
226
+ color: "#1890ff",
227
+ cursor: "pointer"
228
228
  }
229
- }, "\u5305\u88F9".concat(index + 1), ":")), type === 1 ? /*#__PURE__*/React.createElement("span", null, company && item.logisticsCode ? [company, item.logisticsCode].join('/') : company ? company : item.logisticsCode) : null, type === 2 ? /*#__PURE__*/React.createElement("span", null, item.supplyName && item.supplyId ? [item.supplyId, item.supplyName].join('/') : item.supplyId ? item.supplyId : item.supplyName) : null, type === 3 ? /*#__PURE__*/React.createElement("span", null, item.sendName && item.sendId ? [item.sendId, item.sendName].join('/') : item.sendId ? item.sendId : item.sendName) : null, type === 4 ? /*#__PURE__*/React.createElement("span", null, (item === null || item === void 0 ? void 0 : item.deliveryNo) || '') : null));
229
+ }, "\u5305\u88F9".concat(index + 1), ":")), type === 1 ? /*#__PURE__*/React.createElement("span", null, company && item.logisticsCode ? [company, item.logisticsCode].join("/") : company ? company : item.logisticsCode) : null, type === 2 ? /*#__PURE__*/React.createElement("span", null, item.supplyName && item.supplyId ? [item.supplyId, item.supplyName].join("/") : item.supplyId ? item.supplyId : item.supplyName) : null, type === 3 ? /*#__PURE__*/React.createElement("span", null, item.sendName && item.sendId ? [item.sendId, item.sendName].join("/") : item.sendId ? item.sendId : item.sendName) : null, type === 4 ? /*#__PURE__*/React.createElement("span", null, (item === null || item === void 0 ? void 0 : item.deliveryNo) || "") : null));
230
230
  }) : null;
231
231
  };
232
232
  export var BsExpressRender = function BsExpressRender(_ref7) {
233
233
  var _ref7$list = _ref7.list,
234
234
  list = _ref7$list === void 0 ? [] : _ref7$list,
235
235
  _ref7$showField = _ref7.showField,
236
- showField = _ref7$showField === void 0 ? '' : _ref7$showField;
236
+ showField = _ref7$showField === void 0 ? "" : _ref7$showField;
237
237
  return list !== null && list !== void 0 && list.length ? (list || []).map(function (item, index) {
238
238
  var logisticsCompany = item.logisticsCompany;
239
239
  var company = ExpressData.getInstance().getExpressNameByCode(logisticsCompany);
@@ -245,10 +245,10 @@ export var BsExpressRender = function BsExpressRender(_ref7) {
245
245
  }, /*#__PURE__*/React.createElement("span", {
246
246
  key: index,
247
247
  style: {
248
- color: '#1890ff',
249
- cursor: 'pointer'
248
+ color: "#1890ff",
249
+ cursor: "pointer"
250
250
  }
251
- }, "\u5305\u88F9", ":")), showField === 'company' ? /*#__PURE__*/React.createElement("span", null, company ? company : null) : null, showField === 'code' ? /*#__PURE__*/React.createElement("span", null, item.logisticsCode ? item.logisticsCode : null) : null));
251
+ }, "\u5305\u88F9", ":")), showField === "company" ? /*#__PURE__*/React.createElement("span", null, company ? company : null) : null, showField === "code" ? /*#__PURE__*/React.createElement("span", null, item.logisticsCode ? item.logisticsCode : null) : null));
252
252
  }) : null;
253
253
  };
254
254
  export var CommonOrderContent = function CommonOrderContent(_ref8) {
@@ -261,7 +261,7 @@ export var CommonOrderContent = function CommonOrderContent(_ref8) {
261
261
  var orderContent = function orderContent(item, index) {
262
262
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
263
263
  style: {
264
- textAlign: 'center'
264
+ textAlign: "center"
265
265
  }
266
266
  }, "\u7CFB\u7EDF\u8BA2\u5355\u53F7", index + 1, "\uFF1A", item.systemOrderId));
267
267
  };
@@ -269,7 +269,7 @@ export var CommonOrderContent = function CommonOrderContent(_ref8) {
269
269
  var _options$find;
270
270
  var color = ((_options$find = options.find(function (item) {
271
271
  return item[valueKey] === failValue;
272
- })) === null || _options$find === void 0 ? void 0 : _options$find.color) || '#000';
272
+ })) === null || _options$find === void 0 ? void 0 : _options$find.color) || "#000";
273
273
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Popover, {
274
274
  content: orderContent(item, index),
275
275
  overlayStyle: {
@@ -278,14 +278,14 @@ export var CommonOrderContent = function CommonOrderContent(_ref8) {
278
278
  }, /*#__PURE__*/React.createElement("span", {
279
279
  key: index,
280
280
  style: {
281
- color: '#1890ff',
282
- cursor: 'pointer'
281
+ color: "#1890ff",
282
+ cursor: "pointer"
283
283
  }
284
284
  }, "\u7CFB\u7EDF\u8BA2\u5355\u53F7".concat(index + 1), ":")), /*#__PURE__*/React.createElement("span", {
285
285
  style: {
286
286
  color: color
287
287
  }
288
- }, (item === null || item === void 0 ? void 0 : item[valueKey]) || '')));
288
+ }, (item === null || item === void 0 ? void 0 : item[valueKey]) || "")));
289
289
  }) : null;
290
290
  };
291
291
 
@@ -295,22 +295,22 @@ export var BsGoodImage = function BsGoodImage(_ref9) {
295
295
  index = _ref9.index;
296
296
  var picUrl = item.picUrl || defaultImg;
297
297
  var keyMap = {
298
- name: 'bs名称',
299
- code: 'bs编码',
300
- skuId: 'bssku编码',
301
- money: 'bs实付金额',
302
- number: 'bs数量',
303
- share: 'bs分摊价',
304
- type: 'bs赠品类型'
298
+ name: "bs名称",
299
+ code: "bs编码",
300
+ skuId: "bssku编码",
301
+ money: "bs实付金额",
302
+ number: "bs数量",
303
+ share: "bs分摊价",
304
+ type: "bs赠品类型"
305
305
  };
306
306
  return /*#__PURE__*/React.createElement("div", {
307
307
  className: styles.goodImgBox,
308
308
  key: index
309
309
  }, /*#__PURE__*/React.createElement("img", {
310
310
  style: {
311
- width: '40px',
312
- height: '40px',
313
- objectFit: 'contain'
311
+ width: "40px",
312
+ height: "40px",
313
+ objectFit: "contain"
314
314
  },
315
315
  src: picUrl
316
316
  }), /*#__PURE__*/React.createElement("div", {
@@ -332,11 +332,11 @@ export var BsExchangeList = function BsExchangeList(_ref10) {
332
332
  return /*#__PURE__*/React.createElement(React.Fragment, null, BsGoodsTable({
333
333
  list: (item === null || item === void 0 ? void 0 : item.bsExchangeReturnGoods) || [],
334
334
  showHeader: showHeader,
335
- text: '退回'
335
+ text: "退回"
336
336
  }), BsGoodsTable({
337
337
  list: item === null || item === void 0 ? void 0 : item.bsExchangeSwapOutGoods,
338
338
  showHeader: showHeader,
339
- text: '换出'
339
+ text: "换出"
340
340
  }));
341
341
  }));
342
342
  };
@@ -353,38 +353,38 @@ export var BsGoodsTable = function BsGoodsTable(_ref11) {
353
353
  var list = _ref11.list,
354
354
  showHeader = _ref11.showHeader,
355
355
  _ref11$text = _ref11.text,
356
- text = _ref11$text === void 0 ? '' : _ref11$text;
356
+ text = _ref11$text === void 0 ? "" : _ref11$text;
357
357
  //商品信息
358
358
  var GOODS_INFO_COLUMNS = function GOODS_INFO_COLUMNS() {
359
- var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
359
+ var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
360
360
  return [{
361
- dataIndex: 'mark',
361
+ dataIndex: "mark",
362
362
  title: "\u5546\u54C1\u6807\u8BB0",
363
- align: 'center',
363
+ align: "center",
364
364
  ellipsis: true,
365
365
  width: 100
366
366
  }, {
367
- dataIndex: 'skuName',
367
+ dataIndex: "skuName",
368
368
  title: "".concat(text, "sku\u540D\u79F0"),
369
- align: 'center',
369
+ align: "center",
370
370
  ellipsis: true,
371
371
  width: 200
372
372
  }, {
373
- dataIndex: 'sku',
373
+ dataIndex: "sku",
374
374
  title: "".concat(text, "sku\u7F16\u7801"),
375
- align: 'center',
375
+ align: "center",
376
376
  ellipsis: true,
377
377
  width: 100
378
378
  }, {
379
- dataIndex: 'name',
379
+ dataIndex: "name",
380
380
  title: "".concat(text, "\u540D\u79F0"),
381
- align: 'center',
381
+ align: "center",
382
382
  ellipsis: true,
383
383
  width: 200
384
384
  }, {
385
- dataIndex: 'pic',
385
+ dataIndex: "pic",
386
386
  title: "\u56FE\u7247",
387
- align: 'center',
387
+ align: "center",
388
388
  ellipsis: true,
389
389
  width: 100,
390
390
  render: function render(val) {
@@ -394,42 +394,42 @@ export var BsGoodsTable = function BsGoodsTable(_ref11) {
394
394
  });
395
395
  }
396
396
  }, {
397
- dataIndex: 'code',
397
+ dataIndex: "code",
398
398
  title: "".concat(text, "\u7F16\u7801"),
399
- align: 'center',
399
+ align: "center",
400
400
  ellipsis: true,
401
401
  width: 100
402
402
  }, {
403
- dataIndex: 'money',
403
+ dataIndex: "money",
404
404
  title: "\u5B9E\u4ED8\u91D1\u989D",
405
- align: 'center',
405
+ align: "center",
406
406
  ellipsis: true,
407
407
  width: 100
408
408
  }, {
409
- dataIndex: 'number',
409
+ dataIndex: "number",
410
410
  title: "".concat(text, "\u6570\u91CF"),
411
- align: 'center',
411
+ align: "center",
412
412
  ellipsis: true,
413
413
  width: 100
414
414
  }, {
415
- dataIndex: 'share',
415
+ dataIndex: "share",
416
416
  title: "\u5206\u644A\u4EF7",
417
- align: 'center',
417
+ align: "center",
418
418
  ellipsis: true,
419
419
  width: 70
420
420
  }, {
421
- dataIndex: 'type',
421
+ dataIndex: "type",
422
422
  title: "\u8D60\u54C1\u7C7B\u578B",
423
- align: 'center',
423
+ align: "center",
424
424
  ellipsis: true,
425
425
  width: 100
426
426
  }];
427
427
  };
428
428
  var newColumns = useMemo(function () {
429
429
  var columnList = [{
430
- dataIndex: '',
431
- title: '序号',
432
- align: 'center',
430
+ dataIndex: "",
431
+ title: "序号",
432
+ align: "center",
433
433
  ellipsis: true,
434
434
  width: 50,
435
435
  render: function render(val, record, index) {
@@ -443,91 +443,115 @@ export var BsGoodsTable = function BsGoodsTable(_ref11) {
443
443
  return /*#__PURE__*/React.createElement(Table, {
444
444
  columns: newColumns,
445
445
  dataSource: list,
446
- rowKey: 'uuid',
446
+ rowKey: "uuid",
447
447
  size: "small",
448
448
  pagination: false,
449
449
  scroll: {
450
- x: '100%'
450
+ x: "100%"
451
451
  },
452
452
  locale: {
453
- emptyText: '暂无数据'
453
+ emptyText: "暂无数据"
454
454
  }
455
455
  });
456
456
  };
457
457
  export var FileRender = function FileRender(_ref12) {
458
458
  var _ref12$fileList = _ref12.fileList,
459
- fileList = _ref12$fileList === void 0 ? [] : _ref12$fileList;
459
+ fileList = _ref12$fileList === void 0 ? [] : _ref12$fileList,
460
+ _ref12$canDownload = _ref12.canDownload,
461
+ canDownload = _ref12$canDownload === void 0 ? false : _ref12$canDownload;
460
462
  var _useState3 = useState(false),
461
463
  _useState4 = _slicedToArray(_useState3, 2),
462
464
  visible = _useState4[0],
463
465
  setVisible = _useState4[1];
464
- var _useState5 = useState(''),
466
+ var _useState5 = useState(""),
465
467
  _useState6 = _slicedToArray(_useState5, 2),
466
468
  fileUrl = _useState6[0],
467
469
  setFileUrl = _useState6[1];
468
- var _useState7 = useState(''),
470
+ var _useState7 = useState(""),
469
471
  _useState8 = _slicedToArray(_useState7, 2),
470
472
  fileType = _useState8[0],
471
473
  setFileType = _useState8[1];
472
- var _useState9 = useState(''),
474
+ var _useState9 = useState(""),
473
475
  _useState10 = _slicedToArray(_useState9, 2),
474
476
  fileName = _useState10[0],
475
477
  setFileName = _useState10[1];
476
478
  var handleCancel = function handleCancel() {
477
- setFileUrl('');
478
- setFileName('');
479
+ setFileUrl("");
480
+ setFileName("");
479
481
  setVisible(false);
480
482
  };
481
483
  var onPreview = function onPreview(file) {
482
484
  var _file$url;
483
- var fileArr = file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('.');
485
+ var fileArr = file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split(".");
484
486
  var fileType = fileArr[fileArr.length - 1];
485
- if (['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg'].includes(fileType.toLowerCase())) {
487
+ if (["png", "jpg", "jpeg", "gif", "bmp", "svg"].includes(fileType.toLowerCase())) {
486
488
  setFileUrl(file === null || file === void 0 ? void 0 : file.url);
487
489
  setFileName(file === null || file === void 0 ? void 0 : file.name);
488
- setFileType('pic');
490
+ setFileType("pic");
489
491
  setVisible(true);
490
- } else if (['mp4', 'avi', 'mpeg', 'asf', 'mov', '3gp', 'wmv', 'rmvb'].includes(fileType.toLowerCase())) {
492
+ } else if (["mp4", "avi", "mpeg", "asf", "mov", "3gp", "wmv", "rmvb"].includes(fileType.toLowerCase())) {
491
493
  setFileUrl(file === null || file === void 0 ? void 0 : file.url);
492
494
  setFileName(file === null || file === void 0 ? void 0 : file.name);
493
- setFileType('video');
495
+ setFileType("video");
494
496
  setVisible(true);
495
497
  } else {
496
498
  window.open(file === null || file === void 0 ? void 0 : file.url);
497
499
  }
498
500
  };
501
+ var download = function download(url, name) {
502
+ fetch(url).then(function (res) {
503
+ return res.blob();
504
+ }).then(function (blob) {
505
+ var a = document.createElement("a");
506
+ document.body.appendChild(a);
507
+ a.style.display = "none";
508
+ var url = window.URL.createObjectURL(blob);
509
+ a.href = url;
510
+ a.download = name;
511
+ a.click();
512
+ document.body.removeChild(a);
513
+ window.URL.revokeObjectURL(url);
514
+ });
515
+ };
499
516
  return /*#__PURE__*/React.createElement(React.Fragment, null, fileList.map(function (item) {
500
- return /*#__PURE__*/React.createElement("div", {
517
+ return /*#__PURE__*/React.createElement("a", {
501
518
  style: {
502
- color: '#1890ff',
503
- cursor: 'pointer'
519
+ color: "#1890ff",
520
+ cursor: "pointer"
504
521
  },
505
- onClick: function onClick() {
506
- return onPreview(item);
507
- }
522
+ onClick: function onClick(e) {
523
+ e.preventDefault();
524
+ onPreview(item);
525
+ },
526
+ href: item === null || item === void 0 ? void 0 : item.url
508
527
  }, item.name);
509
528
  }), /*#__PURE__*/React.createElement(Modal, {
510
529
  visible: visible,
511
530
  title: fileName,
512
531
  footer: null,
513
532
  onCancel: handleCancel
514
- }, /*#__PURE__*/React.createElement(CopyToClipboard, {
533
+ }, canDownload ? /*#__PURE__*/React.createElement(Button, {
534
+ type: "link",
535
+ onClick: function onClick() {
536
+ return download(fileUrl, fileName);
537
+ }
538
+ }, "\u4E0B\u8F7D") : /*#__PURE__*/React.createElement(CopyToClipboard, {
515
539
  text: fileUrl,
516
540
  onCopy: function onCopy() {
517
- message.success('复制成功');
541
+ message.success("复制成功");
518
542
  }
519
543
  }, /*#__PURE__*/React.createElement(Button, {
520
544
  type: "link"
521
- }, "\u4E0B\u8F7D\u5730\u5740")), fileType === 'pic' ? /*#__PURE__*/React.createElement("img", {
545
+ }, "\u4E0B\u8F7D\u5730\u5740")), fileType === "pic" ? /*#__PURE__*/React.createElement("img", {
522
546
  alt: "example",
523
547
  style: {
524
- width: '100%'
548
+ width: "100%"
525
549
  },
526
550
  src: fileUrl
527
551
  }) : /*#__PURE__*/React.createElement("video", {
528
552
  style: {
529
- width: '100%',
530
- height: '100%'
553
+ width: "100%",
554
+ height: "100%"
531
555
  },
532
556
  autoPlay: true,
533
557
  controls: true,
@@ -537,14 +561,14 @@ export var FileRender = function FileRender(_ref12) {
537
561
  export var BsSystemOrderTable = function BsSystemOrderTable(_ref13) {
538
562
  var value = _ref13.value;
539
563
  var columns = [{
540
- dataIndex: 'billType',
541
- title: '单据类型'
564
+ dataIndex: "billType",
565
+ title: "单据类型"
542
566
  }, {
543
- dataIndex: 'billNo',
544
- title: '系统订单号'
567
+ dataIndex: "billNo",
568
+ title: "系统订单号"
545
569
  }, {
546
- dataIndex: 'billTag',
547
- title: '标签'
570
+ dataIndex: "billTag",
571
+ title: "标签"
548
572
  }];
549
573
  var rowSelection = {
550
574
  selectedRowKeys: (value === null || value === void 0 ? void 0 : value.selectIds) || [],
@@ -560,14 +584,14 @@ export var BsSystemOrderTable = function BsSystemOrderTable(_ref13) {
560
584
  dataSource: (value === null || value === void 0 ? void 0 : value.showOrderInfo) || [],
561
585
  columns: columns,
562
586
  rowSelection: rowSelection,
563
- rowKey: 'billNo',
587
+ rowKey: "billNo",
564
588
  size: "small",
565
589
  pagination: false,
566
590
  scroll: {
567
- x: '100%'
591
+ x: "100%"
568
592
  },
569
593
  locale: {
570
- emptyText: '暂无数据'
594
+ emptyText: "暂无数据"
571
595
  }
572
596
  });
573
597
  };
@@ -11,6 +11,7 @@ declare class BasicFile implements ComponentInterface {
11
11
  isCombinationComponent: boolean;
12
12
  canSort: boolean;
13
13
  children: ComponentInterface[];
14
+ effects: ComponentInterface["effects"];
14
15
  dataType: ComponentInterface["dataType"];
15
16
  constructor(options: PickOption);
16
17
  renderPc: (value: any, record: Record) => any;
@@ -18,6 +18,7 @@ import GetFormItem from "../GetFormItem";
18
18
  import ItemView from "../../commonComponents/ItemView";
19
19
  import { isNull } from "@kmkf-fe-packages/kmkf-utils";
20
20
  import { FileRender } from "../Common";
21
+ import { PlatForm } from "../../type";
21
22
  var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
22
23
  var _this = this;
23
24
  _classCallCheck(this, BasicFile);
@@ -31,6 +32,7 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
31
32
  _defineProperty(this, "isCombinationComponent", void 0);
32
33
  _defineProperty(this, "canSort", void 0);
33
34
  _defineProperty(this, "children", void 0);
35
+ _defineProperty(this, "effects", void 0);
34
36
  _defineProperty(this, "dataType", void 0);
35
37
  _defineProperty(this, "renderPc", function (value, record) {
36
38
  var fileList = (record === null || record === void 0 ? void 0 : record["".concat(_this.id, "_file")]) || [];
@@ -55,19 +57,23 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
55
57
  return r === null || r === void 0 ? void 0 : r["".concat(_this.id, "_file")];
56
58
  });
57
59
  _defineProperty(this, "renderClient", function (record) {
60
+ var _this$effects;
58
61
  var _this$id$split = _this.id.split("_"),
59
62
  _this$id$split2 = _slicedToArray(_this$id$split, 1),
60
63
  id = _this$id$split2[0];
64
+ var canDownload = ![PlatForm.KS, PlatForm.FXG].includes((_this$effects = _this.effects) === null || _this$effects === void 0 ? void 0 : _this$effects.env);
61
65
  return !isNull(record === null || record === void 0 ? void 0 : record[id]) ? /*#__PURE__*/React.createElement(ItemView, {
62
66
  id: _this.id,
63
67
  label: _this.name,
64
68
  value: /*#__PURE__*/React.createElement(FileRender, {
65
- fileList: record === null || record === void 0 ? void 0 : record[id]
69
+ fileList: record === null || record === void 0 ? void 0 : record[id],
70
+ canDownload: canDownload
66
71
  })
67
72
  }) : null;
68
73
  });
69
74
  _defineProperty(this, "editRender", function (p) {
70
- var _this$componentConfig, _this$componentConfig2;
75
+ var _this$effects2, _this$componentConfig, _this$componentConfig2;
76
+ var canDownload = ((_this$effects2 = _this.effects) === null || _this$effects2 === void 0 ? void 0 : _this$effects2.env) === PlatForm.PC;
71
77
  return /*#__PURE__*/React.createElement(GetFormItem, {
72
78
  title: _this.name,
73
79
  name: _this.id,
@@ -76,6 +82,7 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
76
82
  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,
77
83
  component: /*#__PURE__*/React.createElement(ApaasUploadFile, _extends({}, _this.componentConfig, {
78
84
  uniqueKey: _this.id,
85
+ canDownload: canDownload,
79
86
  hostUrl: "https://kefu.kuaimai.com"
80
87
  }))
81
88
  });
@@ -101,5 +108,6 @@ var BasicFile = /*#__PURE__*/_createClass(function BasicFile(options) {
101
108
  this.canSort = false;
102
109
  this.children = [];
103
110
  this.dataType = "array";
111
+ this.effects = options.effects;
104
112
  });
105
113
  export default BasicFile;
@@ -1,3 +1,3 @@
1
1
  import { JstLogistics, JstItemSelect, JstSupply, JstSendGood, BasicInput, BasicAddress, BasicCascader, BasicCheckbox, BasicDataTime, BasicSelect, BasicRadio, BasicTextArea, BasicPicture, BasicMultSelect, BasicGrade, BasicRate, BasicFile, BasicPosting, CommonDataTime, TradeId, ShopName, ErpTradeId, BuyerNick, ReceiverName, ReceiverMobile, ReceiverAddress, TradeDateTime, Logistics, ReturnLogistics, ActualPayment, ERemark, AliPay, ItemSelect, ItemId, ItemEnCode, SystemOrderNo, Ordinary, ThirdItemSelect, FlowStatusSelect, FlowMarkSelect, Payment, TemplateSelect, WorkOrderId, PlatForm, ShopInput, Submitter, Handler, CompletedUser, LogisticsInterception, LogisticsTrajectory, FlowWorkOrderId, BsGoods, BsExchange, BsReissue, BsReturn, BsSystemOrder, BsLogistics, StatusSelect, CommonTradeId, CommonSystemOrder, CommonMultiStatus, Calculation, NodeDeadLine, HandlerDeadLine, NodeStayDuration } from "./index";
2
2
  import { PickOption } from "./type";
3
- export declare const factory: (type: string, options: PickOption) => ActualPayment | BsExchange | BsGoods | BsLogistics | BsReissue | BsReturn | BsSystemOrder | BuyerNick | Calculation | BasicCascader | CommonMultiStatus | CommonSystemOrder | CommonTradeId | ItemEnCode | ItemId | ItemSelect | ErpTradeId | BasicFile | FlowMarkSelect | FlowStatusSelect | FlowWorkOrderId | HandlerDeadLine | BasicInput | JstItemSelect | JstLogistics | JstSendGood | JstSupply | LogisticsTrajectory | NodeDeadLine | NodeStayDuration | Payment | BasicPicture | BasicPosting | BasicRadio | BasicRate | ReceiverAddress | ReceiverMobile | ReceiverName | BasicSelect | ShopInput | StatusSelect | BasicTextArea | ThirdItemSelect | BasicDataTime | TradeDateTime | TradeId | WorkOrderId | BasicAddress | BasicCheckbox | BasicMultSelect | BasicGrade | CommonDataTime | ShopName | Logistics | ReturnLogistics | ERemark | AliPay | SystemOrderNo | Ordinary | TemplateSelect | LogisticsInterception | PlatForm | Submitter | Handler | CompletedUser;
3
+ export declare const factory: (type: string, options: PickOption) => ActualPayment | BsExchange | BsGoods | BsLogistics | BsReissue | BsReturn | BsSystemOrder | BuyerNick | Calculation | BasicCascader | CommonMultiStatus | CommonSystemOrder | CommonTradeId | ItemEnCode | ItemId | ItemSelect | ErpTradeId | BasicFile | FlowMarkSelect | FlowStatusSelect | FlowWorkOrderId | HandlerDeadLine | BasicInput | JstItemSelect | JstLogistics | JstSendGood | JstSupply | LogisticsInterception | LogisticsTrajectory | NodeDeadLine | NodeStayDuration | Payment | BasicPicture | BasicPosting | BasicRadio | BasicRate | ReceiverAddress | ReceiverMobile | ReceiverName | BasicSelect | ShopInput | StatusSelect | BasicTextArea | ThirdItemSelect | BasicDataTime | TradeDateTime | TradeId | WorkOrderId | BasicAddress | BasicCheckbox | BasicMultSelect | BasicGrade | CommonDataTime | ShopName | Logistics | ReturnLogistics | ERemark | AliPay | SystemOrderNo | Ordinary | TemplateSelect | PlatForm | Submitter | Handler | CompletedUser;
@@ -7,6 +7,15 @@ export declare type QuerySymbol = keyof typeof SYMBOL;
7
7
  export declare type Record = {
8
8
  [props in string]: any;
9
9
  };
10
+ export declare enum PlatForm {
11
+ TB = "tb",
12
+ FXG = "fxg",
13
+ KS = "ks",
14
+ PDD = "pdd",
15
+ JD = "jd",
16
+ XIAOZHI = "xiaozhi",
17
+ PC = "pc"
18
+ }
10
19
  export declare type FilterConfigType = {
11
20
  searchDefaultConditions: QuerySymbol;
12
21
  type: string;
@@ -165,6 +174,7 @@ export interface ComponentInterface {
165
174
  }[];
166
175
  tbAppKey?: string;
167
176
  companyKey?: string;
177
+ env?: PlatForm;
168
178
  };
169
179
  /**
170
180
  * 日志渲染
package/dist/esm/type.js CHANGED
@@ -1 +1,10 @@
1
- export {};
1
+ export var PlatForm;
2
+ (function (PlatForm) {
3
+ PlatForm["TB"] = "tb";
4
+ PlatForm["FXG"] = "fxg";
5
+ PlatForm["KS"] = "ks";
6
+ PlatForm["PDD"] = "pdd";
7
+ PlatForm["JD"] = "jd";
8
+ PlatForm["XIAOZHI"] = "xiaozhi";
9
+ PlatForm["PC"] = "pc";
10
+ })(PlatForm || (PlatForm = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "0.9.1-alpha.0",
3
+ "version": "0.9.2-alpha.0",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -26,7 +26,7 @@
26
26
  "father": "^4.1.7"
27
27
  },
28
28
  "dependencies": {
29
- "@kmkf-fe-packages/basic-components": "^0.9.1-alpha.0",
29
+ "@kmkf-fe-packages/basic-components": "^0.9.2-alpha.0",
30
30
  "@kmkf-fe-packages/kmkf-utils": "^0.8.19"
31
31
  },
32
32
  "peerDependencies": {
@@ -40,5 +40,5 @@
40
40
  "gitHooks": {
41
41
  "pre-commit": "lint-staged"
42
42
  },
43
- "gitHead": "8f6cf7363cbff3615cb4017dc316eb18c7f07739"
43
+ "gitHead": "6c885663f48bb35755c6a0e8e67878d8233727c9"
44
44
  }