@kmkf-fe-packages/basic-components 2.0.54-beta.56 → 2.0.54-beta.57

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.
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { useRef, useState, useEffect, forwardRef, useImperativeHandle, useMemo, useCallback } from 'react';
2
2
  import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, message, Radio, Space, Spin, Modal, Button, Checkbox, Row, Col, Slider, Rate, Form, Popover, Table, Tabs, ConfigProvider, Pagination, Typography, Skeleton } from 'antd';
3
- import { EyeOutlined, DeleteOutlined, CloseOutlined, CopyOutlined, CloseCircleOutlined, CaretUpOutlined, MinusCircleFilled } from '@ant-design/icons';
3
+ import { EyeOutlined, DeleteOutlined, CloseOutlined, CopyOutlined, CloseCircleOutlined, CaretUpOutlined, MinusCircleFilled, VideoCameraTwoTone } from '@ant-design/icons';
4
4
  import request, { extend as extend$1 } from 'umi-request';
5
5
  import { CopyToClipboard } from 'react-copy-to-clipboard';
6
6
  import { AddressData, BsAddressData, WdtAddressData, GyAddressData, request as request$1, ExpressData, uuid, servers, columnsGoodsList, LogisticsAddressData, SendDataCenter, BS_E3_BOOLEAN_STATUS_MAP, isNull, filterWdtOrders, WDT_ORDER_TYPE_MAP, tradeStatusMap, filterBsE3Orders, filterGyOrders, GY_DELIVERY_STATE_MAPPING, filterJstOrders, filterKmOrders, getIsPlatformCodesIncludeOrderNos, BS_SYSTEM_ORDER_CONFIG, KM_SYSTEM_ORDER_CONFIG, WLN_SYSTEM_ORDER_CONFIG, WDT_SYSTEM_ORDER_CONFIG, BS_E3_SYSTEM_ORDER_CONFIG, GY_SYSTEM_ORDER_CONFIG, JST_SYSTEM_ORDER_CONFIG, updateWdtGoodsHandle, updateBsE3GoodsHandle, updateGyGoodsHandle, updateJstGoodsHandle, updateKmGoodsHandle, jstMergeIdenticalGoods, msgTypeCh, pushGyLog } from '@kmkf-fe-packages/kmkf-utils';
@@ -20356,6 +20356,7 @@ var CommonSystemOrder = function CommonSystemOrder(props) {
20356
20356
  var _props$value = props.value,
20357
20357
  value = _props$value === void 0 ? [] : _props$value,
20358
20358
  onChange = props.onChange,
20359
+ onBlur = props.onBlur,
20359
20360
  disabled = props.disabled,
20360
20361
  _props$type = props.type,
20361
20362
  type = _props$type === void 0 ? 1 : _props$type;
@@ -20437,6 +20438,7 @@ var CommonSystemOrder = function CommonSystemOrder(props) {
20437
20438
  onChange: function onChange(e) {
20438
20439
  return changeInputHandle(e.target.value, 'billNo');
20439
20440
  },
20441
+ onBlur: onBlur,
20440
20442
  value: (_value$changeIndex5 = value[changeIndex]) === null || _value$changeIndex5 === void 0 ? void 0 : _value$changeIndex5.billNo
20441
20443
  })) : null) : null);
20442
20444
  };
@@ -21465,4 +21467,243 @@ var GyReturnGoods = function GyReturnGoods(props) {
21465
21467
  })));
21466
21468
  };
21467
21469
 
21468
- export { ApaasAddress as Address, AliPay, Province as ApaasAddress, ApaasCascader, ApaasCheckbox, ApaasDate, withFormItem as ApaasHoc, ApaasInput, ApaasInputNumber, ApaasLogistics, ApaasMultipleSelect, ApaasPosting, ApaasRadio, ApaasRate, ApaasSelect, ApaasSlider, ApaasTextArea, ApaasUpload, index as ApaasUploadAsync, ApaasUploadFile, index$1 as ApaasUploadProAsync, AsyncSelect, bsE3Reissue as BsE3Reissue, BsExchange, BsGoods, BsReissue, BsReturnGoods as BsReturn, index$3 as BsSystemOrder, BuyerNick, CalculationInput, ChooseBaby, CommonExchangeGoods, CommonGoods, CommonSystemOrder$1 as CommonMultiStatus, CommonReturnGoods, CommonStatus, CommonSystemOrder, CopyTextIcon, ExpressLogistics, Goods, index$4 as GoodsTable, GyReissue, GyReturnGoods as GyReturn, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, LogisticsInterception, LogisticsMoreInterception, LogisticsMoreTrajectory, LogisticsTrajectory, MsgStatus, ParseLogistics, Payment, PublicReissue, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, Status, SubForm, Supplier, TBGoodId, TBGoodSerial, TradeId, WdtGoodList, wdtReissue as WdtReissue, WlnGoods, columnsBaseInfoMap, erpColumnsMap, erpFormValidator, index$2 as erpModalColumnsMap, getColumns$4 as getGyColumns, getColumns$5 as getJstColumns, getColumns$6 as getKmColumns, getColumns$2 as getWdtColumns, getColumns$3 as getWlnColumns };
21470
+ var css_248z$c = ".index-module_imageBox__1f2AI {\n display: flex;\n flex-wrap: wrap;\n}\n.index-module_imageBox__1f2AI .ant-upload {\n padding: 0;\n height: 80px;\n width: 80px;\n border: none;\n border-radius: 2px;\n background: #F2F3F5;\n text-align: center;\n color: #86909C;\n font-size: 14px;\n}\n.index-module_imageBox__1f2AI .ant-upload .index-module_addBtn__1DY59 {\n color: #86909C;\n font-size: 14px;\n}\n.index-module_tips__1XQjf {\n color: #4E5969;\n font-size: 12px;\n}\n";
21471
+ var styles$5 = {"imageBox":"index-module_imageBox__1f2AI","addBtn":"index-module_addBtn__1DY59","tips":"index-module_tips__1XQjf"};
21472
+ styleInject(css_248z$c);
21473
+
21474
+ var _excluded$r = ["maxCount", "maxSize", "onChange", "value", "disabled", "hostUrl", "canDownload", "actionUrl"];
21475
+ var Dragger$1 = Upload.Dragger;
21476
+ var fn$4 = function fn() {
21477
+ return void 0;
21478
+ };
21479
+ var videoSuffixList = ['mp4', 'avi', 'mpeg', 'asf', 'mov', '3gp', 'wmv', 'rmvb'];
21480
+ var KmVideo = function KmVideo(_ref) {
21481
+ var _ref$maxCount = _ref.maxCount,
21482
+ maxCount = _ref$maxCount === void 0 ? 20 : _ref$maxCount,
21483
+ _ref$maxSize = _ref.maxSize,
21484
+ maxSize = _ref$maxSize === void 0 ? 500 : _ref$maxSize,
21485
+ _ref$onChange = _ref.onChange,
21486
+ onChange = _ref$onChange === void 0 ? fn$4 : _ref$onChange,
21487
+ _ref$value = _ref.value,
21488
+ value = _ref$value === void 0 ? [] : _ref$value,
21489
+ _ref$disabled = _ref.disabled,
21490
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21491
+ _ref$hostUrl = _ref.hostUrl,
21492
+ hostUrl = _ref$hostUrl === void 0 ? '' : _ref$hostUrl,
21493
+ _ref$canDownload = _ref.canDownload,
21494
+ canDownload = _ref$canDownload === void 0 ? false : _ref$canDownload,
21495
+ _ref$actionUrl = _ref.actionUrl,
21496
+ actionUrl = _ref$actionUrl === void 0 ? '/qy/common/uploadWorkOrderImg' : _ref$actionUrl,
21497
+ resetProps = _objectWithoutProperties(_ref, _excluded$r);
21498
+ var _useState = useState(false),
21499
+ _useState2 = _slicedToArray(_useState, 2),
21500
+ visible = _useState2[0],
21501
+ setVisible = _useState2[1];
21502
+ var _useState3 = useState(''),
21503
+ _useState4 = _slicedToArray(_useState3, 2),
21504
+ fileUrl = _useState4[0],
21505
+ setFileUrl = _useState4[1];
21506
+ var _useState5 = useState(''),
21507
+ _useState6 = _slicedToArray(_useState5, 2),
21508
+ fileType = _useState6[0],
21509
+ setFileType = _useState6[1];
21510
+ var _useState7 = useState(''),
21511
+ _useState8 = _slicedToArray(_useState7, 2),
21512
+ fileName = _useState8[0],
21513
+ setFileName = _useState8[1];
21514
+ var valueRef = useRef(value);
21515
+ var uploadCount = useRef(0);
21516
+ var _useState9 = useState(false),
21517
+ _useState10 = _slicedToArray(_useState9, 2),
21518
+ uploading = _useState10[0],
21519
+ setUploading = _useState10[1];
21520
+ var fileList = useMemo(function () {
21521
+ return value.map(function (t, i) {
21522
+ return _objectSpread2(_objectSpread2({}, t), {}, {
21523
+ percent: 100,
21524
+ uid: i + ''
21525
+ });
21526
+ });
21527
+ }, [value]);
21528
+ useEffect(function () {
21529
+ valueRef.current = value;
21530
+ }, [value]);
21531
+ var asyncUpload = /*#__PURE__*/function () {
21532
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
21533
+ var formData, fileName, _yield$request, success, data;
21534
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
21535
+ while (1) switch (_context.prev = _context.next) {
21536
+ case 0:
21537
+ setUploading(true);
21538
+ uploadCount.current++;
21539
+ formData = new FormData();
21540
+ formData.append('file', file);
21541
+ fileName = "".concat(hooks(new Date().getTime()).format('YYYY-MM-DD hh:mm:ss'), "_").concat(file.name);
21542
+ formData.append('fileName', fileName);
21543
+ _context.prev = 6;
21544
+ _context.next = 9;
21545
+ return request(actionUrl, {
21546
+ method: 'post',
21547
+ body: formData
21548
+ });
21549
+ case 9:
21550
+ _yield$request = _context.sent;
21551
+ success = _yield$request.success;
21552
+ data = _yield$request.data;
21553
+ if (success) {
21554
+ handleChange([].concat(_toConsumableArray(valueRef.current), [{
21555
+ kmVideoName: file.name,
21556
+ kmVideoUrl: "".concat(hostUrl, "/").concat(data)
21557
+ }]));
21558
+ }
21559
+ _context.next = 18;
21560
+ break;
21561
+ case 15:
21562
+ _context.prev = 15;
21563
+ _context.t0 = _context["catch"](6);
21564
+ message.error('文件上传失败');
21565
+ case 18:
21566
+ _context.prev = 18;
21567
+ uploadCount.current--;
21568
+ if (uploadCount.current < 1) {
21569
+ setUploading(false);
21570
+ }
21571
+ return _context.finish(18);
21572
+ case 22:
21573
+ case "end":
21574
+ return _context.stop();
21575
+ }
21576
+ }, _callee, null, [[6, 15, 18, 22]]);
21577
+ }));
21578
+ return function asyncUpload(_x) {
21579
+ return _ref2.apply(this, arguments);
21580
+ };
21581
+ }();
21582
+ var download = function download(url, name) {
21583
+ fetch(url).then(function (res) {
21584
+ return res.blob();
21585
+ }).then(function (blob) {
21586
+ var a = document.createElement('a');
21587
+ document.body.appendChild(a);
21588
+ a.style.display = 'none';
21589
+ var url = window.URL.createObjectURL(blob);
21590
+ a.href = url;
21591
+ a.download = name;
21592
+ a.click();
21593
+ document.body.removeChild(a);
21594
+ window.URL.revokeObjectURL(url);
21595
+ });
21596
+ };
21597
+ var handleChange = function handleChange(list) {
21598
+ valueRef.current = list;
21599
+ onChange(list);
21600
+ };
21601
+ // 手动上传模式, 一直返回false
21602
+ var beforeUpload = function beforeUpload(file, fileList) {
21603
+ // console.log('beforeUpload', file);
21604
+ var size = file.size / 1024 / 1024 < maxSize;
21605
+ // TODO: 批量提交的时候
21606
+ if ((fileList === null || fileList === void 0 ? void 0 : fileList.length) + value.length > maxCount) {
21607
+ message.error("\u6700\u591A\u6DFB\u52A0".concat(maxCount, "\u4E2A\u6587\u4EF6\uFF01"));
21608
+ return Upload.LIST_IGNORE;
21609
+ }
21610
+ if (!size) {
21611
+ message.error("\u6587\u4EF6\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "MB"));
21612
+ return Upload.LIST_IGNORE;
21613
+ }
21614
+ asyncUpload(file);
21615
+ return Upload.LIST_IGNORE;
21616
+ };
21617
+ var onRemove = function onRemove(file) {
21618
+ var newValue = value.filter(function (item) {
21619
+ return item.kmVideoUrl !== file.kmVideoUrl;
21620
+ });
21621
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
21622
+ };
21623
+ var onPreview = function onPreview(file) {
21624
+ var _file$url;
21625
+ var fileArr = file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('.');
21626
+ var fileType = fileArr[fileArr.length - 1];
21627
+ if (videoSuffixList.includes(fileType.toLowerCase())) {
21628
+ setFileUrl(file === null || file === void 0 ? void 0 : file.url);
21629
+ setFileName(file === null || file === void 0 ? void 0 : file.name);
21630
+ setFileType('video');
21631
+ setVisible(true);
21632
+ } else {
21633
+ window.open(file === null || file === void 0 ? void 0 : file.url);
21634
+ }
21635
+ };
21636
+ var handleCancel = function handleCancel() {
21637
+ setFileUrl('');
21638
+ setFileName('');
21639
+ setVisible(false);
21640
+ };
21641
+ return /*#__PURE__*/React.createElement(Spin, {
21642
+ spinning: uploading
21643
+ }, /*#__PURE__*/React.createElement("p", {
21644
+ className: styles$5.tips
21645
+ }, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6\uFF0C\u652F\u6301", videoSuffixList.join('/'), "\u683C\u5F0F\u6587\u4EF6"), /*#__PURE__*/React.createElement("div", {
21646
+ className: styles$5.imageBox
21647
+ }, /*#__PURE__*/React.createElement(Dragger$1, _objectSpread2({
21648
+ disabled: disabled,
21649
+ multiple: true,
21650
+ name: "file",
21651
+ maxCount: maxCount,
21652
+ beforeUpload: beforeUpload,
21653
+ onPreview: onPreview,
21654
+ fileList: fileList.map(function (item) {
21655
+ return _objectSpread2(_objectSpread2({}, item), {}, {
21656
+ url: item.kmVideoUrl,
21657
+ name: item.kmVideoName
21658
+ });
21659
+ }),
21660
+ onRemove: onRemove,
21661
+ accept: ".".concat(videoSuffixList.join(',.')),
21662
+ iconRender: function iconRender(file) {
21663
+ return /*#__PURE__*/React.createElement(Space, {
21664
+ align: "center"
21665
+ }, /*#__PURE__*/React.createElement(VideoCameraTwoTone, {
21666
+ style: {
21667
+ fontSize: 16
21668
+ }
21669
+ }), file.kmVideoType && "".concat(file.kmVideoType));
21670
+ }
21671
+ }, resetProps), /*#__PURE__*/React.createElement("span", {
21672
+ className: styles$5.addBtn
21673
+ }, "+"), /*#__PURE__*/React.createElement("p", {
21674
+ className: styles$5.addBtn
21675
+ }, "\u9009\u62E9\u6587\u4EF6")), /*#__PURE__*/React.createElement(Modal, {
21676
+ visible: visible,
21677
+ title: fileName,
21678
+ footer: null,
21679
+ onCancel: handleCancel
21680
+ }, canDownload ? /*#__PURE__*/React.createElement(Button, {
21681
+ type: "link",
21682
+ onClick: function onClick() {
21683
+ return download(fileUrl, fileName);
21684
+ }
21685
+ }, "\u4E0B\u8F7D") : /*#__PURE__*/React.createElement(CopyToClipboard, {
21686
+ text: fileUrl,
21687
+ onCopy: function onCopy() {
21688
+ message.success('复制成功');
21689
+ }
21690
+ }, /*#__PURE__*/React.createElement(Button, {
21691
+ type: "link"
21692
+ }, "\u4E0B\u8F7D\u5730\u5740")), fileType === 'pic' ? /*#__PURE__*/React.createElement("img", {
21693
+ alt: "example",
21694
+ style: {
21695
+ width: '100%'
21696
+ },
21697
+ src: fileUrl
21698
+ }) : /*#__PURE__*/React.createElement("video", {
21699
+ style: {
21700
+ width: '100%',
21701
+ height: '100%'
21702
+ },
21703
+ autoPlay: true,
21704
+ controls: true,
21705
+ src: fileUrl
21706
+ }))));
21707
+ };
21708
+
21709
+ export { ApaasAddress as Address, AliPay, Province as ApaasAddress, ApaasCascader, ApaasCheckbox, ApaasDate, withFormItem as ApaasHoc, ApaasInput, ApaasInputNumber, ApaasLogistics, ApaasMultipleSelect, ApaasPosting, ApaasRadio, ApaasRate, ApaasSelect, ApaasSlider, ApaasTextArea, ApaasUpload, index as ApaasUploadAsync, ApaasUploadFile, index$1 as ApaasUploadProAsync, AsyncSelect, bsE3Reissue as BsE3Reissue, BsExchange, BsGoods, BsReissue, BsReturnGoods as BsReturn, index$3 as BsSystemOrder, BuyerNick, CalculationInput, ChooseBaby, CommonExchangeGoods, CommonGoods, CommonSystemOrder$1 as CommonMultiStatus, CommonReturnGoods, CommonStatus, CommonSystemOrder, CopyTextIcon, ExpressLogistics, Goods, index$4 as GoodsTable, GyReissue, GyReturnGoods as GyReturn, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, KmVideo, LogisticsInterception, LogisticsMoreInterception, LogisticsMoreTrajectory, LogisticsTrajectory, MsgStatus, ParseLogistics, Payment, PublicReissue, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, Status, SubForm, Supplier, TBGoodId, TBGoodSerial, TradeId, WdtGoodList, wdtReissue as WdtReissue, WlnGoods, columnsBaseInfoMap, erpColumnsMap, erpFormValidator, index$2 as erpModalColumnsMap, getColumns$4 as getGyColumns, getColumns$5 as getJstColumns, getColumns$6 as getKmColumns, getColumns$2 as getWdtColumns, getColumns$3 as getWlnColumns };
package/dist/index.js CHANGED
@@ -20368,6 +20368,7 @@ var CommonSystemOrder = function CommonSystemOrder(props) {
20368
20368
  var _props$value = props.value,
20369
20369
  value = _props$value === void 0 ? [] : _props$value,
20370
20370
  onChange = props.onChange,
20371
+ onBlur = props.onBlur,
20371
20372
  disabled = props.disabled,
20372
20373
  _props$type = props.type,
20373
20374
  type = _props$type === void 0 ? 1 : _props$type;
@@ -20449,6 +20450,7 @@ var CommonSystemOrder = function CommonSystemOrder(props) {
20449
20450
  onChange: function onChange(e) {
20450
20451
  return changeInputHandle(e.target.value, 'billNo');
20451
20452
  },
20453
+ onBlur: onBlur,
20452
20454
  value: (_value$changeIndex5 = value[changeIndex]) === null || _value$changeIndex5 === void 0 ? void 0 : _value$changeIndex5.billNo
20453
20455
  })) : null) : null);
20454
20456
  };
@@ -21477,6 +21479,245 @@ var GyReturnGoods = function GyReturnGoods(props) {
21477
21479
  })));
21478
21480
  };
21479
21481
 
21482
+ var css_248z$c = ".index-module_imageBox__1f2AI {\n display: flex;\n flex-wrap: wrap;\n}\n.index-module_imageBox__1f2AI .ant-upload {\n padding: 0;\n height: 80px;\n width: 80px;\n border: none;\n border-radius: 2px;\n background: #F2F3F5;\n text-align: center;\n color: #86909C;\n font-size: 14px;\n}\n.index-module_imageBox__1f2AI .ant-upload .index-module_addBtn__1DY59 {\n color: #86909C;\n font-size: 14px;\n}\n.index-module_tips__1XQjf {\n color: #4E5969;\n font-size: 12px;\n}\n";
21483
+ var styles$5 = {"imageBox":"index-module_imageBox__1f2AI","addBtn":"index-module_addBtn__1DY59","tips":"index-module_tips__1XQjf"};
21484
+ styleInject(css_248z$c);
21485
+
21486
+ var _excluded$r = ["maxCount", "maxSize", "onChange", "value", "disabled", "hostUrl", "canDownload", "actionUrl"];
21487
+ var Dragger$1 = antd.Upload.Dragger;
21488
+ var fn$4 = function fn() {
21489
+ return void 0;
21490
+ };
21491
+ var videoSuffixList = ['mp4', 'avi', 'mpeg', 'asf', 'mov', '3gp', 'wmv', 'rmvb'];
21492
+ var KmVideo = function KmVideo(_ref) {
21493
+ var _ref$maxCount = _ref.maxCount,
21494
+ maxCount = _ref$maxCount === void 0 ? 20 : _ref$maxCount,
21495
+ _ref$maxSize = _ref.maxSize,
21496
+ maxSize = _ref$maxSize === void 0 ? 500 : _ref$maxSize,
21497
+ _ref$onChange = _ref.onChange,
21498
+ onChange = _ref$onChange === void 0 ? fn$4 : _ref$onChange,
21499
+ _ref$value = _ref.value,
21500
+ value = _ref$value === void 0 ? [] : _ref$value,
21501
+ _ref$disabled = _ref.disabled,
21502
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21503
+ _ref$hostUrl = _ref.hostUrl,
21504
+ hostUrl = _ref$hostUrl === void 0 ? '' : _ref$hostUrl,
21505
+ _ref$canDownload = _ref.canDownload,
21506
+ canDownload = _ref$canDownload === void 0 ? false : _ref$canDownload,
21507
+ _ref$actionUrl = _ref.actionUrl,
21508
+ actionUrl = _ref$actionUrl === void 0 ? '/qy/common/uploadWorkOrderImg' : _ref$actionUrl,
21509
+ resetProps = _objectWithoutProperties(_ref, _excluded$r);
21510
+ var _useState = React.useState(false),
21511
+ _useState2 = _slicedToArray(_useState, 2),
21512
+ visible = _useState2[0],
21513
+ setVisible = _useState2[1];
21514
+ var _useState3 = React.useState(''),
21515
+ _useState4 = _slicedToArray(_useState3, 2),
21516
+ fileUrl = _useState4[0],
21517
+ setFileUrl = _useState4[1];
21518
+ var _useState5 = React.useState(''),
21519
+ _useState6 = _slicedToArray(_useState5, 2),
21520
+ fileType = _useState6[0],
21521
+ setFileType = _useState6[1];
21522
+ var _useState7 = React.useState(''),
21523
+ _useState8 = _slicedToArray(_useState7, 2),
21524
+ fileName = _useState8[0],
21525
+ setFileName = _useState8[1];
21526
+ var valueRef = React.useRef(value);
21527
+ var uploadCount = React.useRef(0);
21528
+ var _useState9 = React.useState(false),
21529
+ _useState10 = _slicedToArray(_useState9, 2),
21530
+ uploading = _useState10[0],
21531
+ setUploading = _useState10[1];
21532
+ var fileList = React.useMemo(function () {
21533
+ return value.map(function (t, i) {
21534
+ return _objectSpread2(_objectSpread2({}, t), {}, {
21535
+ percent: 100,
21536
+ uid: i + ''
21537
+ });
21538
+ });
21539
+ }, [value]);
21540
+ React.useEffect(function () {
21541
+ valueRef.current = value;
21542
+ }, [value]);
21543
+ var asyncUpload = /*#__PURE__*/function () {
21544
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
21545
+ var formData, fileName, _yield$request, success, data;
21546
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
21547
+ while (1) switch (_context.prev = _context.next) {
21548
+ case 0:
21549
+ setUploading(true);
21550
+ uploadCount.current++;
21551
+ formData = new FormData();
21552
+ formData.append('file', file);
21553
+ fileName = "".concat(hooks(new Date().getTime()).format('YYYY-MM-DD hh:mm:ss'), "_").concat(file.name);
21554
+ formData.append('fileName', fileName);
21555
+ _context.prev = 6;
21556
+ _context.next = 9;
21557
+ return request__default['default'](actionUrl, {
21558
+ method: 'post',
21559
+ body: formData
21560
+ });
21561
+ case 9:
21562
+ _yield$request = _context.sent;
21563
+ success = _yield$request.success;
21564
+ data = _yield$request.data;
21565
+ if (success) {
21566
+ handleChange([].concat(_toConsumableArray(valueRef.current), [{
21567
+ kmVideoName: file.name,
21568
+ kmVideoUrl: "".concat(hostUrl, "/").concat(data)
21569
+ }]));
21570
+ }
21571
+ _context.next = 18;
21572
+ break;
21573
+ case 15:
21574
+ _context.prev = 15;
21575
+ _context.t0 = _context["catch"](6);
21576
+ antd.message.error('文件上传失败');
21577
+ case 18:
21578
+ _context.prev = 18;
21579
+ uploadCount.current--;
21580
+ if (uploadCount.current < 1) {
21581
+ setUploading(false);
21582
+ }
21583
+ return _context.finish(18);
21584
+ case 22:
21585
+ case "end":
21586
+ return _context.stop();
21587
+ }
21588
+ }, _callee, null, [[6, 15, 18, 22]]);
21589
+ }));
21590
+ return function asyncUpload(_x) {
21591
+ return _ref2.apply(this, arguments);
21592
+ };
21593
+ }();
21594
+ var download = function download(url, name) {
21595
+ fetch(url).then(function (res) {
21596
+ return res.blob();
21597
+ }).then(function (blob) {
21598
+ var a = document.createElement('a');
21599
+ document.body.appendChild(a);
21600
+ a.style.display = 'none';
21601
+ var url = window.URL.createObjectURL(blob);
21602
+ a.href = url;
21603
+ a.download = name;
21604
+ a.click();
21605
+ document.body.removeChild(a);
21606
+ window.URL.revokeObjectURL(url);
21607
+ });
21608
+ };
21609
+ var handleChange = function handleChange(list) {
21610
+ valueRef.current = list;
21611
+ onChange(list);
21612
+ };
21613
+ // 手动上传模式, 一直返回false
21614
+ var beforeUpload = function beforeUpload(file, fileList) {
21615
+ // console.log('beforeUpload', file);
21616
+ var size = file.size / 1024 / 1024 < maxSize;
21617
+ // TODO: 批量提交的时候
21618
+ if ((fileList === null || fileList === void 0 ? void 0 : fileList.length) + value.length > maxCount) {
21619
+ antd.message.error("\u6700\u591A\u6DFB\u52A0".concat(maxCount, "\u4E2A\u6587\u4EF6\uFF01"));
21620
+ return antd.Upload.LIST_IGNORE;
21621
+ }
21622
+ if (!size) {
21623
+ antd.message.error("\u6587\u4EF6\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "MB"));
21624
+ return antd.Upload.LIST_IGNORE;
21625
+ }
21626
+ asyncUpload(file);
21627
+ return antd.Upload.LIST_IGNORE;
21628
+ };
21629
+ var onRemove = function onRemove(file) {
21630
+ var newValue = value.filter(function (item) {
21631
+ return item.kmVideoUrl !== file.kmVideoUrl;
21632
+ });
21633
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
21634
+ };
21635
+ var onPreview = function onPreview(file) {
21636
+ var _file$url;
21637
+ var fileArr = file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('.');
21638
+ var fileType = fileArr[fileArr.length - 1];
21639
+ if (videoSuffixList.includes(fileType.toLowerCase())) {
21640
+ setFileUrl(file === null || file === void 0 ? void 0 : file.url);
21641
+ setFileName(file === null || file === void 0 ? void 0 : file.name);
21642
+ setFileType('video');
21643
+ setVisible(true);
21644
+ } else {
21645
+ window.open(file === null || file === void 0 ? void 0 : file.url);
21646
+ }
21647
+ };
21648
+ var handleCancel = function handleCancel() {
21649
+ setFileUrl('');
21650
+ setFileName('');
21651
+ setVisible(false);
21652
+ };
21653
+ return /*#__PURE__*/React__default['default'].createElement(antd.Spin, {
21654
+ spinning: uploading
21655
+ }, /*#__PURE__*/React__default['default'].createElement("p", {
21656
+ className: styles$5.tips
21657
+ }, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6\uFF0C\u652F\u6301", videoSuffixList.join('/'), "\u683C\u5F0F\u6587\u4EF6"), /*#__PURE__*/React__default['default'].createElement("div", {
21658
+ className: styles$5.imageBox
21659
+ }, /*#__PURE__*/React__default['default'].createElement(Dragger$1, _objectSpread2({
21660
+ disabled: disabled,
21661
+ multiple: true,
21662
+ name: "file",
21663
+ maxCount: maxCount,
21664
+ beforeUpload: beforeUpload,
21665
+ onPreview: onPreview,
21666
+ fileList: fileList.map(function (item) {
21667
+ return _objectSpread2(_objectSpread2({}, item), {}, {
21668
+ url: item.kmVideoUrl,
21669
+ name: item.kmVideoName
21670
+ });
21671
+ }),
21672
+ onRemove: onRemove,
21673
+ accept: ".".concat(videoSuffixList.join(',.')),
21674
+ iconRender: function iconRender(file) {
21675
+ return /*#__PURE__*/React__default['default'].createElement(antd.Space, {
21676
+ align: "center"
21677
+ }, /*#__PURE__*/React__default['default'].createElement(icons.VideoCameraTwoTone, {
21678
+ style: {
21679
+ fontSize: 16
21680
+ }
21681
+ }), file.kmVideoType && "".concat(file.kmVideoType));
21682
+ }
21683
+ }, resetProps), /*#__PURE__*/React__default['default'].createElement("span", {
21684
+ className: styles$5.addBtn
21685
+ }, "+"), /*#__PURE__*/React__default['default'].createElement("p", {
21686
+ className: styles$5.addBtn
21687
+ }, "\u9009\u62E9\u6587\u4EF6")), /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
21688
+ visible: visible,
21689
+ title: fileName,
21690
+ footer: null,
21691
+ onCancel: handleCancel
21692
+ }, canDownload ? /*#__PURE__*/React__default['default'].createElement(antd.Button, {
21693
+ type: "link",
21694
+ onClick: function onClick() {
21695
+ return download(fileUrl, fileName);
21696
+ }
21697
+ }, "\u4E0B\u8F7D") : /*#__PURE__*/React__default['default'].createElement(reactCopyToClipboard.CopyToClipboard, {
21698
+ text: fileUrl,
21699
+ onCopy: function onCopy() {
21700
+ antd.message.success('复制成功');
21701
+ }
21702
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Button, {
21703
+ type: "link"
21704
+ }, "\u4E0B\u8F7D\u5730\u5740")), fileType === 'pic' ? /*#__PURE__*/React__default['default'].createElement("img", {
21705
+ alt: "example",
21706
+ style: {
21707
+ width: '100%'
21708
+ },
21709
+ src: fileUrl
21710
+ }) : /*#__PURE__*/React__default['default'].createElement("video", {
21711
+ style: {
21712
+ width: '100%',
21713
+ height: '100%'
21714
+ },
21715
+ autoPlay: true,
21716
+ controls: true,
21717
+ src: fileUrl
21718
+ }))));
21719
+ };
21720
+
21480
21721
  exports.Address = ApaasAddress;
21481
21722
  exports.AliPay = AliPay;
21482
21723
  exports.ApaasAddress = Province;
@@ -21524,6 +21765,7 @@ exports.IdentifyAddress = IdentifyAddress;
21524
21765
  exports.Invoice = Invoice;
21525
21766
  exports.JstGoods = jstGoods;
21526
21767
  exports.JstItemList = ItemList;
21768
+ exports.KmVideo = KmVideo;
21527
21769
  exports.LogisticsInterception = LogisticsInterception;
21528
21770
  exports.LogisticsMoreInterception = LogisticsMoreInterception;
21529
21771
  exports.LogisticsMoreTrajectory = LogisticsMoreTrajectory;
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { FocusEventHandler } from 'react';
2
2
  interface CommonSystemOrderProps {
3
3
  value: any[];
4
4
  type: number;
5
5
  options: any[];
6
6
  disabled: boolean;
7
7
  onChange: (val: any[]) => void;
8
+ onBlur: FocusEventHandler<HTMLInputElement>;
8
9
  }
9
10
  declare const CommonSystemOrder: (props: Partial<CommonSystemOrderProps>) => React.JSX.Element;
10
11
  export default CommonSystemOrder;
@@ -67,5 +67,6 @@ export type { WdtGoods } from './bs/component/model/WdtGoodList';
67
67
  export { default as GyReissue } from './gy/Reissue';
68
68
  export * from './constants/index';
69
69
  export { default as GyReturn } from './gy/Return';
70
+ export { default as KmVideo } from './km/KmVideo';
70
71
  export { default as columnsBaseInfoMap, erpColumnsMap, erpFormValidator, } from './constants/columnsBaseInfoMap';
71
72
  export { default as erpModalColumnsMap } from './bs/component/model/Columns';
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { UploadProps } from 'antd';
3
+ declare type UploadValue = {
4
+ kmVideoName: string;
5
+ kmVideoUrl: string;
6
+ kmVideoType?: string;
7
+ }[];
8
+ export interface ApaasUploadProps extends Omit<UploadProps, 'onChange' | 'value'> {
9
+ maxCount?: number;
10
+ maxSize?: number;
11
+ uploadText?: string;
12
+ disabled?: boolean;
13
+ onChange?: (value: UploadValue) => void;
14
+ value?: UploadValue;
15
+ hostUrl?: string;
16
+ actionUrl?: string;
17
+ canDownload?: boolean;
18
+ }
19
+ declare const KmVideo: ({ maxCount, maxSize, onChange, value, disabled, hostUrl, canDownload, actionUrl, ...resetProps }: ApaasUploadProps) => React.JSX.Element;
20
+ export default KmVideo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "2.0.54-beta.56",
3
+ "version": "2.0.54-beta.57",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.56",
23
+ "@kmkf-fe-packages/kmkf-utils": "2.0.54-beta.57",
24
24
  "ahooks": "^3.7.4",
25
25
  "bignumber.js": "^9.1.2",
26
26
  "kmkf-monitor": "^0.8.9",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "2cc80b8222126e8c2a4c4ce9738a1449f2821aa3"
68
+ "gitHead": "8243d9f752c54db54fcbcdc9df0a2e5a4b9f7bc6"
69
69
  }