@kmkf-fe-packages/basic-components 2.2.5-beta.0 → 2.2.5-beta.3

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,9 +1,9 @@
1
1
  import React, { useRef, useState, useEffect, forwardRef, useImperativeHandle, useMemo, useCallback } from 'react';
2
- import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, message, Radio, Space, Spin, Modal, Button, Checkbox, Row, Col, Slider, Rate as Rate$1, Form, Tooltip, Popover, Table, Tabs, ConfigProvider, Pagination, Typography, Skeleton, Empty, Tag } from 'antd';
3
- import { EyeOutlined, DeleteOutlined, CloseOutlined, MinusCircleFilled, PlusCircleFilled, CopyOutlined, CloseCircleOutlined, CaretUpOutlined, UpOutlined, DownOutlined, PlusOutlined, VideoCameraTwoTone } from '@ant-design/icons';
2
+ import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, message, Radio, Space, Spin, Modal, Button, Checkbox, Row, Col, Slider, Rate as Rate$1, Form, Popover, Tooltip, Table, Tabs, ConfigProvider, Pagination, Typography, Skeleton, Empty, Tag } from 'antd';
3
+ import { EyeOutlined, DeleteOutlined, CloseOutlined, PlusSquareOutlined, MinusCircleFilled, PlusCircleFilled, CopyOutlined, CloseCircleOutlined, CaretUpOutlined, UpOutlined, DownOutlined, PlusOutlined, 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
- import { AddressData, BsAddressData, WdtAddressData, GyAddressData, request as request$1, ExpressData, uuid, servers, columnsGoodsList, LogisticsAddressData, SendDataCenter, hasAddNullComponent, SUBMIT_TIME_ID, UPGRADE_TIME_ID, FINAL_TIME_ID, CUSTOM_TIME_ID, useStatus, finalFormData, transformList, dataSourceTrans, DATA_SPLIT_COMPONENT_FIELDS_MAP, BS_E3_BOOLEAN_STATUS_MAP, isNull, filterWdtOrders, WDT_ORDER_TYPE_MAP, tradeStatusMap, filterBsE3Orders, filterGyOrders, GY_DELIVERY_STATE_MAPPING, filterJstOrders, filterJyOrders, 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, JY_SYSTEM_ORDER_CONFIG, updateOrderSubFormGoodsHandle, updateWlnGoodsHandle, updateWdtGoodsHandle, updateBsE3GoodsHandle, updateGyGoodsHandle, updateJstGoodsHandle, updateKmGoodsHandle, updateJyGoodsHandle, jstMergeIdenticalGoods, msgTypeCh, pushGyLog, skxSystemOrderBackValues, skxReturnSystemOrderBackValues, formatTrade, updateSkxGoodsHandle, formatReturnTrade, updateSkxReturnGoodsHandle } from '@kmkf-fe-packages/kmkf-utils';
6
+ import { AddressData, BsAddressData, WdtAddressData, GyAddressData, request as request$1, ExpressData, imgResize, isNull, uuid, transformWorkOrderData, servers, columnsGoodsList, LogisticsAddressData, SendDataCenter, hasAddNullComponent, SUBMIT_TIME_ID, UPGRADE_TIME_ID, FINAL_TIME_ID, CUSTOM_TIME_ID, useStatus, finalFormData, transformList, dataSourceTrans, DATA_SPLIT_COMPONENT_FIELDS_MAP, BS_E3_BOOLEAN_STATUS_MAP, filterWdtOrders, WDT_ORDER_TYPE_MAP, tradeStatusMap, filterBsE3Orders, filterGyOrders, GY_DELIVERY_STATE_MAPPING, filterJstOrders, filterJyOrders, 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, JY_SYSTEM_ORDER_CONFIG, updateOrderSubFormGoodsHandle, updateWlnGoodsHandle, updateWdtGoodsHandle, updateBsE3GoodsHandle, updateGyGoodsHandle, updateJstGoodsHandle, updateKmGoodsHandle, updateJyGoodsHandle, jstMergeIdenticalGoods, msgTypeCh, pushGyLog, skxSystemOrderBackValues, skxReturnSystemOrderBackValues, formatTrade, updateSkxGoodsHandle, formatReturnTrade, updateSkxReturnGoodsHandle } from '@kmkf-fe-packages/kmkf-utils';
7
7
  import { debounce, isNaN as isNaN$1, isNumber as isNumber$1, uniqBy, cloneDeep, difference, differenceWith, isBoolean, isEqual, takeRight, reject as reject$1, intersection, isEmpty } from 'lodash';
8
8
  import { useUpdateEffect, useDebounceEffect, useAntdTable } from 'ahooks';
9
9
  import zhCN from 'antd/lib/locale/zh_CN';
@@ -8046,6 +8046,436 @@ function withFormItem(WrappedComponent) {
8046
8046
  */
8047
8047
  var extendRequest = extend$1({});
8048
8048
 
8049
+ var hostUrl = 'https://kefu.kuaimai.com';
8050
+ var FileRender = function FileRender(_ref) {
8051
+ var _ref$fileList = _ref.fileList,
8052
+ fileList = _ref$fileList === void 0 ? [] : _ref$fileList,
8053
+ _ref$canDownload = _ref.canDownload,
8054
+ canDownload = _ref$canDownload === void 0 ? false : _ref$canDownload;
8055
+ var _useState = useState(false),
8056
+ _useState2 = _slicedToArray(_useState, 2),
8057
+ visible = _useState2[0],
8058
+ setVisible = _useState2[1];
8059
+ var _useState3 = useState(''),
8060
+ _useState4 = _slicedToArray(_useState3, 2),
8061
+ fileUrl = _useState4[0],
8062
+ setFileUrl = _useState4[1];
8063
+ var _useState5 = useState(''),
8064
+ _useState6 = _slicedToArray(_useState5, 2),
8065
+ fileType = _useState6[0],
8066
+ setFileType = _useState6[1];
8067
+ var _useState7 = useState(''),
8068
+ _useState8 = _slicedToArray(_useState7, 2),
8069
+ fileName = _useState8[0],
8070
+ setFileName = _useState8[1];
8071
+ var _useState9 = useState(false),
8072
+ _useState10 = _slicedToArray(_useState9, 2),
8073
+ downloading = _useState10[0],
8074
+ setDownloading = _useState10[1];
8075
+ var handleCancel = function handleCancel() {
8076
+ setFileUrl('');
8077
+ setFileName('');
8078
+ setVisible(false);
8079
+ setDownloading(false);
8080
+ };
8081
+ var onPreview = function onPreview(file) {
8082
+ var _file$url;
8083
+ var fileArr = file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('.');
8084
+ var fileType = fileArr[fileArr.length - 1];
8085
+ if (['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg'].includes(fileType.toLowerCase())) {
8086
+ setFileUrl(file === null || file === void 0 ? void 0 : file.url);
8087
+ setFileName(file === null || file === void 0 ? void 0 : file.name);
8088
+ setFileType('pic');
8089
+ setVisible(true);
8090
+ } else if (['mp4', 'avi', 'mpeg', 'asf', 'mov', '3gp', 'wmv', 'rmvb'].includes(fileType.toLowerCase())) {
8091
+ setFileUrl(file === null || file === void 0 ? void 0 : file.url);
8092
+ setFileName(file === null || file === void 0 ? void 0 : file.name);
8093
+ setFileType('video');
8094
+ setVisible(true);
8095
+ } else {
8096
+ window.open(file === null || file === void 0 ? void 0 : file.url);
8097
+ }
8098
+ };
8099
+ var download = function download(url, name) {
8100
+ setDownloading(true);
8101
+ fetch(url).then(function (res) {
8102
+ return res.blob();
8103
+ }).then(function (blob) {
8104
+ var a = document.createElement('a');
8105
+ document.body.appendChild(a);
8106
+ a.style.display = 'none';
8107
+ var url = window.URL.createObjectURL(blob);
8108
+ a.href = url;
8109
+ a.download = name;
8110
+ a.click();
8111
+ document.body.removeChild(a);
8112
+ window.URL.revokeObjectURL(url);
8113
+ }).finally(function () {
8114
+ setDownloading(false);
8115
+ });
8116
+ };
8117
+ return /*#__PURE__*/React.createElement(React.Fragment, null, fileList.map(function (item) {
8118
+ return /*#__PURE__*/React.createElement("a", {
8119
+ style: {
8120
+ color: '#1890ff',
8121
+ cursor: 'pointer',
8122
+ display: 'block'
8123
+ },
8124
+ onClick: function onClick(e) {
8125
+ e.preventDefault();
8126
+ onPreview(item);
8127
+ },
8128
+ href: item === null || item === void 0 ? void 0 : item.url
8129
+ }, item.name);
8130
+ }), /*#__PURE__*/React.createElement(Modal, {
8131
+ visible: visible,
8132
+ title: fileName,
8133
+ footer: null,
8134
+ onCancel: handleCancel
8135
+ }, canDownload ? /*#__PURE__*/React.createElement(Button, {
8136
+ type: "link",
8137
+ onClick: function onClick() {
8138
+ return download(fileUrl, fileName);
8139
+ },
8140
+ loading: downloading
8141
+ }, "\u4E0B\u8F7D") : /*#__PURE__*/React.createElement(CopyToClipboard, {
8142
+ text: fileUrl,
8143
+ onCopy: function onCopy() {
8144
+ message.success('复制成功');
8145
+ }
8146
+ }, /*#__PURE__*/React.createElement(Button, {
8147
+ type: "link"
8148
+ }, "\u4E0B\u8F7D\u5730\u5740")), fileType === 'pic' ? /*#__PURE__*/React.createElement("img", {
8149
+ alt: "example",
8150
+ style: {
8151
+ width: '100%'
8152
+ },
8153
+ src: fileUrl
8154
+ }) : /*#__PURE__*/React.createElement("video", {
8155
+ style: {
8156
+ width: '100%',
8157
+ height: '100%'
8158
+ },
8159
+ autoPlay: true,
8160
+ controls: true,
8161
+ src: fileUrl
8162
+ })));
8163
+ };
8164
+ var PictureRender = function PictureRender(_ref2) {
8165
+ var _ref2$value = _ref2.value,
8166
+ value = _ref2$value === void 0 ? [] : _ref2$value,
8167
+ _ref2$width = _ref2.width,
8168
+ width = _ref2$width === void 0 ? 32 : _ref2$width;
8169
+ return /*#__PURE__*/React.createElement(Image.PreviewGroup, null, value === null || value === void 0 ? void 0 : value.map(function (pic) {
8170
+ return /*#__PURE__*/React.createElement("div", {
8171
+ style: {
8172
+ marginRight: '5px',
8173
+ display: 'inline-block'
8174
+ },
8175
+ onClick: function onClick(e) {
8176
+ return e.stopPropagation();
8177
+ }
8178
+ }, /*#__PURE__*/React.createElement(Image, {
8179
+ width: width,
8180
+ src: imgResize(pic || ''),
8181
+ preview: {
8182
+ src: imgResize(pic || '', 0, 0)
8183
+ }
8184
+ }));
8185
+ }));
8186
+ };
8187
+ var RadioRender = function RadioRender(_ref3) {
8188
+ var _value$value;
8189
+ var _ref3$value = _ref3.value,
8190
+ value = _ref3$value === void 0 ? {} : _ref3$value;
8191
+ return /*#__PURE__*/React.createElement("span", null, value === null || value === void 0 ? void 0 : value.value, (value === null || value === void 0 ? void 0 : value.value) && typeof value.value === 'string' && (value === null || value === void 0 ? void 0 : (_value$value = value.value) === null || _value$value === void 0 ? void 0 : _value$value.indexOf('其他')) > -1 && (value === null || value === void 0 ? void 0 : value.other) && "(".concat(value === null || value === void 0 ? void 0 : value.other, ")"));
8192
+ };
8193
+ var CheckboxRender = function CheckboxRender(_ref4) {
8194
+ var _value$value2, _value$value3, _value$value4;
8195
+ var _ref4$value = _ref4.value,
8196
+ value = _ref4$value === void 0 ? [] : _ref4$value;
8197
+ if ((value === null || value === void 0 ? void 0 : (_value$value2 = value.value) === null || _value$value2 === void 0 ? void 0 : _value$value2.length) === 0 && isNull(value === null || value === void 0 ? void 0 : value.other)) return null;
8198
+ var findIndex = value === null || value === void 0 ? void 0 : (_value$value3 = value.value) === null || _value$value3 === void 0 ? void 0 : _value$value3.findIndex(function (item) {
8199
+ return item === '其他';
8200
+ });
8201
+ if (findIndex > -1 && (value === null || value === void 0 ? void 0 : value.other)) {
8202
+ // @ts-ignore
8203
+ value.value[findIndex] = "\u5176\u4ED6(".concat(value === null || value === void 0 ? void 0 : value.other, ")");
8204
+ }
8205
+ return value === null || value === void 0 ? void 0 : (_value$value4 = value.value) === null || _value$value4 === void 0 ? void 0 : _value$value4.join('/');
8206
+ };
8207
+ var renderMap = {
8208
+ PICTURE: function PICTURE() {
8209
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
8210
+ var finalPictures = value.map(function (item) {
8211
+ return item.startsWith('http') ? item : "".concat(hostUrl, "/").concat(item);
8212
+ });
8213
+ return /*#__PURE__*/React.createElement(PictureRender, {
8214
+ value: finalPictures,
8215
+ hostUrl: 'https://kefu.kuaimai.com'
8216
+ });
8217
+ },
8218
+ FILE: function FILE(value) {
8219
+ return /*#__PURE__*/React.createElement(FileRender, {
8220
+ fileList: value,
8221
+ canDownload: true
8222
+ });
8223
+ },
8224
+ RADIO: function RADIO(value) {
8225
+ return /*#__PURE__*/React.createElement(RadioRender, {
8226
+ value: value
8227
+ });
8228
+ },
8229
+ CHECKBOX: function CHECKBOX(value) {
8230
+ return /*#__PURE__*/React.createElement(CheckboxRender, {
8231
+ value: value
8232
+ });
8233
+ }
8234
+ };
8235
+ var EditPictureRender = function EditPictureRender(_ref5) {
8236
+ var _ref5$val = _ref5.val,
8237
+ val = _ref5$val === void 0 ? [] : _ref5$val,
8238
+ index = _ref5.index,
8239
+ t = _ref5.t,
8240
+ updateHandle = _ref5.updateHandle,
8241
+ disabled = _ref5.disabled,
8242
+ hostUrl = _ref5.hostUrl;
8243
+ var finalPictures = val.map(function (item) {
8244
+ return item.startsWith('http') ? item : "".concat(hostUrl, "/").concat(item);
8245
+ });
8246
+ return /*#__PURE__*/React.createElement("div", {
8247
+ style: {
8248
+ display: 'flex',
8249
+ flexWrap: 'wrap',
8250
+ border: '1px solid #d9d9d9',
8251
+ padding: '3px'
8252
+ }
8253
+ }, !t.isEdit && !disabled ? /*#__PURE__*/React.createElement(Popover, {
8254
+ content: /*#__PURE__*/React.createElement(ApaasUploadAsync$1, _objectSpread2(_objectSpread2({}, t.componentConfig), {}, {
8255
+ value: finalPictures,
8256
+ onChange: function onChange(e) {
8257
+ return updateHandle(e, index, t.key);
8258
+ },
8259
+ hostUrl: hostUrl
8260
+ })),
8261
+ trigger: "click"
8262
+ }, /*#__PURE__*/React.createElement(PlusSquareOutlined, {
8263
+ style: {
8264
+ fontSize: 18
8265
+ }
8266
+ })) : /*#__PURE__*/React.createElement(PlusSquareOutlined, {
8267
+ style: {
8268
+ fontSize: 18,
8269
+ color: '#333'
8270
+ }
8271
+ }), /*#__PURE__*/React.createElement(PictureRender, {
8272
+ value: finalPictures,
8273
+ width: 24,
8274
+ hostUrl: hostUrl
8275
+ }));
8276
+ };
8277
+ var EditFileRender = function EditFileRender(_ref6) {
8278
+ var _ref6$val = _ref6.val,
8279
+ val = _ref6$val === void 0 ? [] : _ref6$val,
8280
+ index = _ref6.index,
8281
+ t = _ref6.t,
8282
+ updateHandle = _ref6.updateHandle,
8283
+ disabled = _ref6.disabled,
8284
+ hostUrl = _ref6.hostUrl;
8285
+ return /*#__PURE__*/React.createElement("div", {
8286
+ style: {
8287
+ display: 'flex',
8288
+ flexWrap: 'wrap',
8289
+ border: '1px solid #d9d9d9',
8290
+ padding: '3px'
8291
+ }
8292
+ }, !t.isEdit && !disabled ? /*#__PURE__*/React.createElement(Popover, {
8293
+ content: /*#__PURE__*/React.createElement(ApaasUploadFile, _objectSpread2(_objectSpread2({}, t.componentConfig), {}, {
8294
+ value: val,
8295
+ onChange: function onChange(e) {
8296
+ return updateHandle(e, index, t.key);
8297
+ },
8298
+ hostUrl: hostUrl
8299
+ })),
8300
+ trigger: "click"
8301
+ }, /*#__PURE__*/React.createElement(PlusSquareOutlined, {
8302
+ style: {
8303
+ fontSize: 18
8304
+ }
8305
+ })) : /*#__PURE__*/React.createElement(PlusSquareOutlined, {
8306
+ style: {
8307
+ fontSize: 18,
8308
+ color: '#333'
8309
+ }
8310
+ }), /*#__PURE__*/React.createElement(FileRender, {
8311
+ fileList: val,
8312
+ canDownload: true
8313
+ }));
8314
+ };
8315
+ var EditRenderMap = {
8316
+ INPUT: function INPUT(_ref7) {
8317
+ var val = _ref7.val,
8318
+ record = _ref7.record,
8319
+ index = _ref7.index,
8320
+ t = _ref7.t,
8321
+ updateHandle = _ref7.updateHandle,
8322
+ disabled = _ref7.disabled;
8323
+ var precisionValue = t.precision === 'nolimit' ? undefined : t.precision;
8324
+ return !t.isEdit && !disabled ? t.isNumber ? /*#__PURE__*/React.createElement(InputNumber, {
8325
+ style: {
8326
+ width: '100%'
8327
+ },
8328
+ value: val,
8329
+ precision: precisionValue,
8330
+ onChange: function onChange(e) {
8331
+ return updateHandle(e, index, t.key);
8332
+ },
8333
+ stringMode: true
8334
+ }) : /*#__PURE__*/React.createElement(Input, {
8335
+ style: {
8336
+ width: '100%'
8337
+ },
8338
+ value: val,
8339
+ onChange: function onChange(e) {
8340
+ var _e$target;
8341
+ return updateHandle(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value, index, t.key);
8342
+ }
8343
+ }) : /*#__PURE__*/React.createElement("div", null, val);
8344
+ },
8345
+ TEXTAREA: function TEXTAREA(_ref8) {
8346
+ var val = _ref8.val,
8347
+ record = _ref8.record,
8348
+ index = _ref8.index,
8349
+ t = _ref8.t,
8350
+ updateHandle = _ref8.updateHandle,
8351
+ disabled = _ref8.disabled;
8352
+ var precisionValue = t.precision === 'nolimit' ? undefined : t.precision;
8353
+ return !t.isEdit && !disabled ? t.isNumber ? /*#__PURE__*/React.createElement(InputNumber, {
8354
+ style: {
8355
+ width: '100%'
8356
+ },
8357
+ value: val,
8358
+ precision: precisionValue,
8359
+ onChange: function onChange(e) {
8360
+ return updateHandle(e, index, t.key);
8361
+ },
8362
+ stringMode: true
8363
+ }) : /*#__PURE__*/React.createElement(Input, {
8364
+ style: {
8365
+ width: '100%'
8366
+ },
8367
+ value: val,
8368
+ onChange: function onChange(e) {
8369
+ var _e$target2;
8370
+ return updateHandle(e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value, index, t.key);
8371
+ }
8372
+ }) : /*#__PURE__*/React.createElement("div", null, val);
8373
+ },
8374
+ PICTURE: function PICTURE(_ref9) {
8375
+ var val = _ref9.val,
8376
+ record = _ref9.record,
8377
+ index = _ref9.index,
8378
+ t = _ref9.t,
8379
+ updateHandle = _ref9.updateHandle,
8380
+ disabled = _ref9.disabled;
8381
+ return !t.isEdit && !disabled ? /*#__PURE__*/React.createElement(EditPictureRender, {
8382
+ val: val,
8383
+ t: t,
8384
+ disabled: disabled,
8385
+ index: index,
8386
+ updateHandle: updateHandle,
8387
+ hostUrl: hostUrl
8388
+ }) : /*#__PURE__*/React.createElement(PictureRender, {
8389
+ value: val,
8390
+ width: 20,
8391
+ hostUrl: hostUrl
8392
+ });
8393
+ },
8394
+ FILE: function FILE(_ref10) {
8395
+ var val = _ref10.val,
8396
+ record = _ref10.record,
8397
+ index = _ref10.index,
8398
+ t = _ref10.t,
8399
+ updateHandle = _ref10.updateHandle,
8400
+ disabled = _ref10.disabled;
8401
+ return !t.isEdit && !disabled ? /*#__PURE__*/React.createElement(EditFileRender, {
8402
+ val: val,
8403
+ t: t,
8404
+ disabled: disabled,
8405
+ index: index,
8406
+ updateHandle: updateHandle,
8407
+ hostUrl: hostUrl
8408
+ }) : /*#__PURE__*/React.createElement(FileRender, {
8409
+ fileList: val,
8410
+ canDownload: true
8411
+ });
8412
+ },
8413
+ RADIO: function RADIO(_ref11) {
8414
+ var val = _ref11.val,
8415
+ record = _ref11.record,
8416
+ index = _ref11.index,
8417
+ t = _ref11.t,
8418
+ updateHandle = _ref11.updateHandle,
8419
+ disabled = _ref11.disabled,
8420
+ componentDto = _ref11.componentDto;
8421
+ return /*#__PURE__*/React.createElement(ApaasRadio, _objectSpread2(_objectSpread2({}, componentDto === null || componentDto === void 0 ? void 0 : componentDto.componentConfig), {}, {
8422
+ value: val,
8423
+ disabled: t.isEdit || disabled,
8424
+ onChange: function onChange(e) {
8425
+ return updateHandle(e, index, t.key);
8426
+ }
8427
+ }));
8428
+ },
8429
+ SELECT: function SELECT(_ref12) {
8430
+ var val = _ref12.val,
8431
+ record = _ref12.record,
8432
+ index = _ref12.index,
8433
+ t = _ref12.t,
8434
+ updateHandle = _ref12.updateHandle,
8435
+ disabled = _ref12.disabled,
8436
+ componentDto = _ref12.componentDto;
8437
+ return /*#__PURE__*/React.createElement(ApaasSelect, _objectSpread2(_objectSpread2({}, componentDto === null || componentDto === void 0 ? void 0 : componentDto.componentConfig), {}, {
8438
+ value: val,
8439
+ disabled: t.isEdit || disabled,
8440
+ onChange: function onChange(e) {
8441
+ return updateHandle(e, index, t.key);
8442
+ }
8443
+ }));
8444
+ },
8445
+ CHECKBOX: function CHECKBOX(_ref13) {
8446
+ var val = _ref13.val,
8447
+ record = _ref13.record,
8448
+ index = _ref13.index,
8449
+ t = _ref13.t,
8450
+ updateHandle = _ref13.updateHandle,
8451
+ disabled = _ref13.disabled,
8452
+ componentDto = _ref13.componentDto;
8453
+ return /*#__PURE__*/React.createElement(ApaasCheckbox, _objectSpread2(_objectSpread2({}, componentDto === null || componentDto === void 0 ? void 0 : componentDto.componentConfig), {}, {
8454
+ value: val,
8455
+ disabled: t.isEdit || disabled,
8456
+ onChange: function onChange(e) {
8457
+ return updateHandle(e, index, t.key);
8458
+ }
8459
+ }));
8460
+ },
8461
+ BASIC_MULT_SELECT: function BASIC_MULT_SELECT(_ref14) {
8462
+ var val = _ref14.val,
8463
+ record = _ref14.record,
8464
+ index = _ref14.index,
8465
+ t = _ref14.t,
8466
+ updateHandle = _ref14.updateHandle,
8467
+ disabled = _ref14.disabled,
8468
+ componentDto = _ref14.componentDto;
8469
+ return /*#__PURE__*/React.createElement(ApaasMultipleSelect, _objectSpread2(_objectSpread2({}, componentDto === null || componentDto === void 0 ? void 0 : componentDto.componentConfig), {}, {
8470
+ value: val,
8471
+ disabled: t.isEdit || disabled,
8472
+ onChange: function onChange(e) {
8473
+ return updateHandle(e, index, t.key);
8474
+ }
8475
+ }));
8476
+ }
8477
+ };
8478
+
8049
8479
  function HoverTableRowDeleteIcon(_ref) {
8050
8480
  var index = _ref.index,
8051
8481
  hoveredRowIndex = _ref.hoveredRowIndex,
@@ -8071,8 +8501,15 @@ function HoverTableRowDeleteIcon(_ref) {
8071
8501
 
8072
8502
  var WidgetMap = {
8073
8503
  INPUT: 'input',
8074
- TEXTAREA: 'textarea'
8504
+ TEXTAREA: 'textarea',
8505
+ PICTURE: 'picture',
8506
+ FILE: 'file',
8507
+ RADIO: 'radio',
8508
+ CHECKBOX: 'checkbox',
8509
+ SELECT: 'select',
8510
+ BASIC_MULT_SELECT: 'basicMultSelect'
8075
8511
  };
8512
+ var filterComponentType = ['PICTURE', 'FILE'];
8076
8513
  var pageSize = 50;
8077
8514
  var SubForm = function SubForm(props) {
8078
8515
  var _selectOptions$;
@@ -8121,6 +8558,10 @@ var SubForm = function SubForm(props) {
8121
8558
  _useState14 = _slicedToArray(_useState13, 2),
8122
8559
  hoveredRowIndex = _useState14[0],
8123
8560
  setHoveredRowIndex = _useState14[1];
8561
+ var _useState15 = useState([]),
8562
+ _useState16 = _slicedToArray(_useState15, 2),
8563
+ componentDtoList = _useState16[0],
8564
+ setComponentDtoList = _useState16[1];
8124
8565
  var updateHandle = function updateHandle(val, index, type) {
8125
8566
  if (value === null || value === void 0 ? void 0 : value.length) {
8126
8567
  var valueItem = tableHeader.find(function (t) {
@@ -8174,18 +8615,16 @@ var SubForm = function SubForm(props) {
8174
8615
  ellipsis: true,
8175
8616
  width: t.width,
8176
8617
  render: function render(val, record, index) {
8177
- // @ts-ignore
8178
- var precisionValue = t.precision === 'nolimit' ? undefined : t.precision;
8179
- return !t.isEdit && !disabled ? t.isNumber ? /*#__PURE__*/React.createElement(InputNumber, {
8180
- style: {
8181
- width: '100%'
8182
- },
8183
- value: val,
8184
- precision: precisionValue,
8185
- onChange: function onChange(e) {
8186
- return updateHandle(e, index, t.key);
8187
- },
8188
- stringMode: true
8618
+ return EditRenderMap[t.workOrderComponentType] ? EditRenderMap[t.workOrderComponentType]({
8619
+ val: val,
8620
+ record: record,
8621
+ index: index,
8622
+ t: t,
8623
+ updateHandle: updateHandle,
8624
+ disabled: disabled,
8625
+ componentDto: componentDtoList.find(function (item) {
8626
+ return item.uniqueKey === t.key;
8627
+ })
8189
8628
  }) : /*#__PURE__*/React.createElement(Input, {
8190
8629
  style: {
8191
8630
  width: '100%'
@@ -8195,7 +8634,7 @@ var SubForm = function SubForm(props) {
8195
8634
  var _e$target;
8196
8635
  return updateHandle(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value, index, t.key);
8197
8636
  }
8198
- }) : /*#__PURE__*/React.createElement("div", null, val);
8637
+ });
8199
8638
  }
8200
8639
  };
8201
8640
  })), [disabled ? {} : {
@@ -8236,28 +8675,53 @@ var SubForm = function SubForm(props) {
8236
8675
  return index + 1;
8237
8676
  }
8238
8677
  }].concat(_toConsumableArray(newTableHeader.map(function (t) {
8239
- return {
8678
+ var item = {
8240
8679
  dataIndex: t.key,
8241
8680
  title: t.name,
8242
8681
  width: 90
8243
8682
  };
8683
+ if (renderMap[t.workOrderComponentType]) {
8684
+ item.render = function (val) {
8685
+ return renderMap[t.workOrderComponentType](val);
8686
+ };
8687
+ }
8688
+ return item;
8244
8689
  })));
8245
8690
  }, [newTableHeader]);
8246
8691
  var valueMap = useMemo(function () {
8247
8692
  return newTableHeader.reduce(function (prv, next) {
8248
- prv["".concat(next.key, "_").concat(WidgetMap[next.workOrderComponentType])] = next.key;
8693
+ var item = {
8694
+ key: next.key,
8695
+ workOrderComponentType: next.workOrderComponentType,
8696
+ defaultValue: ''
8697
+ };
8698
+ if (['PICTURE', 'FILE', 'BASIC_MULT_SELECT'].includes(next.workOrderComponentType)) {
8699
+ item.defaultValue = [];
8700
+ }
8701
+ if (['RADIO', 'CHECKBOX'].includes(next.workOrderComponentType)) {
8702
+ item.defaultValue = {
8703
+ value: next.workOrderComponentType === 'RADIO' ? '' : [],
8704
+ other: ''
8705
+ };
8706
+ }
8707
+ if (['SELECT'].includes(next.workOrderComponentType)) {
8708
+ item.defaultValue = '';
8709
+ }
8710
+ prv["".concat(next.key, "_").concat(WidgetMap[next.workOrderComponentType])] = item;
8249
8711
  return prv;
8250
8712
  }, {});
8251
8713
  }, [newTableHeader]);
8252
8714
  var defaultValueMap = useMemo(function () {
8253
8715
  return Object.keys(valueMap).reduce(function (prv, next) {
8254
- prv["".concat(valueMap[next])] = '';
8716
+ prv["".concat(valueMap[next].key)] = valueMap[next].defaultValue;
8255
8717
  return prv;
8256
8718
  }, {});
8257
8719
  }, [valueMap]);
8258
8720
  var selectOptions = useMemo(function () {
8259
8721
  var _options$;
8260
- var options = newTableHeader.map(function (item) {
8722
+ var options = newTableHeader.filter(function (item) {
8723
+ return !filterComponentType.includes(item.workOrderComponentType);
8724
+ }).map(function (item) {
8261
8725
  return {
8262
8726
  label: item.name,
8263
8727
  value: "".concat(item.key, "_").concat(WidgetMap[item.workOrderComponentType])
@@ -8281,6 +8745,7 @@ var SubForm = function SubForm(props) {
8281
8745
  newValue.splice(index, 0, _objectSpread2(_objectSpread2({}, defaultValueMap), {}, {
8282
8746
  uuid: uuid()
8283
8747
  }));
8748
+ console.log('newValue', newValue);
8284
8749
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
8285
8750
  };
8286
8751
  var onScrollCapture = function onScrollCapture(e) {
@@ -8299,10 +8764,14 @@ var SubForm = function SubForm(props) {
8299
8764
  var _ref2,
8300
8765
  _ref2$pageNo,
8301
8766
  pageNo,
8767
+ _yield$request,
8768
+ templateDetail,
8302
8769
  params,
8303
8770
  res,
8304
8771
  data,
8305
8772
  success,
8773
+ transDataSourceItem,
8774
+ headerKeys,
8306
8775
  newList,
8307
8776
  _args = arguments;
8308
8777
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -8315,6 +8784,18 @@ var SubForm = function SubForm(props) {
8315
8784
  }
8316
8785
  return _context.abrupt("return");
8317
8786
  case 3:
8787
+ _context.next = 5;
8788
+ return extendRequest('/qy/gdfw/template/queryTemplateDetail', {
8789
+ method: 'post',
8790
+ data: {
8791
+ templateType: 'QY_CUSTOM',
8792
+ uniqueKey: workOrderTemplateId
8793
+ }
8794
+ });
8795
+ case 5:
8796
+ _yield$request = _context.sent;
8797
+ templateDetail = _yield$request.data;
8798
+ setComponentDtoList((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []);
8318
8799
  params = {
8319
8800
  flowNodeId: nodeId,
8320
8801
  flowTemplateKey: flowTemplateKey === null || flowTemplateKey === void 0 ? void 0 : flowTemplateKey[1],
@@ -8340,22 +8821,27 @@ var SubForm = function SubForm(props) {
8340
8821
  value: [inputValue]
8341
8822
  }];
8342
8823
  }
8343
- _context.next = 7;
8824
+ _context.next = 12;
8344
8825
  return extendRequest('/qy/view/workOrderList', {
8345
8826
  method: 'post',
8346
8827
  data: params
8347
8828
  });
8348
- case 7:
8829
+ case 12:
8349
8830
  res = _context.sent;
8350
8831
  data = res.data, success = res.success;
8351
8832
  if (success) {
8833
+ transDataSourceItem = transformWorkOrderData(templateDetail.componentDtoList, 'init');
8834
+ headerKeys = tableHeader.map(function (t) {
8835
+ return t.key;
8836
+ });
8352
8837
  newList = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
8838
+ var value = transDataSourceItem(item);
8353
8839
  var params = {
8354
8840
  uuid: uuid()
8355
8841
  };
8356
- Object.keys(item.jsonMap).forEach(function (key) {
8357
- if (valueMap[key]) {
8358
- params[valueMap[key]] = item.jsonMap[key];
8842
+ Object.keys(value).forEach(function (key) {
8843
+ if (headerKeys.includes(key)) {
8844
+ params[key] = value[key];
8359
8845
  }
8360
8846
  });
8361
8847
  return params;
@@ -8369,7 +8855,7 @@ var SubForm = function SubForm(props) {
8369
8855
  setHasMore((data === null || data === void 0 ? void 0 : data.list.length) === pageSize);
8370
8856
  isRequest.current = false;
8371
8857
  }
8372
- case 10:
8858
+ case 15:
8373
8859
  case "end":
8374
8860
  return _context.stop();
8375
8861
  }
@@ -25784,4 +26270,4 @@ var SkxGoods = function SkxGoods(props) {
25784
26270
  }));
25785
26271
  };
25786
26272
 
25787
- 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, ApaasUploadAsync$1 as ApaasUploadAsync, ApaasUploadFile, index as ApaasUploadProAsync, AsyncSelect, bsE3Reissue as BsE3Reissue, BsExchange, BsGoods, BsReissue, BsReturnGoods as BsReturn, index$2 as BsSystemOrder, BuyerNick, CalculationInput, ChooseBaby, CommonExchangeGoods, CommonGoods, CommonSystemOrder$1 as CommonMultiStatus, CommonReturnGoods, CommonStatus, CommonSystemOrder, CopyTextIcon, ExpressLogistics, Goods, index$3 as GoodsTable, GyReissue, GyReturnGoods as GyReturn, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, KmVideo, LogisticsInterception, LogisticsMoreInterception, LogisticsMoreTrajectory, LogisticsTrajectory, MsgStatus, OrderSubForm, utils as OrderSubFormUtils, ParseLogistics, Payment, PublicReissue, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, SkxGoods, IdInputSelect as SkxIdInputSelect, Status, SubForm, Supplier, TBGoodId, TBGoodSerial, TradeId, WdtGoodList, wdtReissue as WdtReissue, WlnGoods, columnsBaseInfoMap, erpColumnsMap, erpFormValidator, index$1 as erpModalColumnsMap, getColumns$4 as getGyColumns, getColumns$5 as getJstColumns, getColumns$7 as getJyColumns, getColumns$6 as getKmColumns, getColumns$8 as getSkxColumns, getColumns$2 as getWdtColumns, getColumns$3 as getWlnColumns, orderSubFormConstants };
26273
+ 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, ApaasUploadAsync$1 as ApaasUploadAsync, ApaasUploadFile, index as ApaasUploadProAsync, AsyncSelect, bsE3Reissue as BsE3Reissue, BsExchange, BsGoods, BsReissue, BsReturnGoods as BsReturn, index$2 as BsSystemOrder, BuyerNick, CalculationInput, ChooseBaby, CommonExchangeGoods, CommonGoods, CommonSystemOrder$1 as CommonMultiStatus, CommonReturnGoods, CommonStatus, CommonSystemOrder, CopyTextIcon, ExpressLogistics, Goods, index$3 as GoodsTable, GyReissue, GyReturnGoods as GyReturn, IdentifyAddress, Invoice, jstGoods as JstGoods, ItemList as JstItemList, KmVideo, LogisticsInterception, LogisticsMoreInterception, LogisticsMoreTrajectory, LogisticsTrajectory, MsgStatus, OrderSubForm, utils as OrderSubFormUtils, ParseLogistics, Payment, PublicReissue, RemarkInput as Remark, ExpressLogistics as ReturnLogistics, ShopNameSelect as ShopName, SkxGoods, IdInputSelect as SkxIdInputSelect, Status, SubForm, Supplier, TBGoodId, TBGoodSerial, TradeId, WdtGoodList, wdtReissue as WdtReissue, WlnGoods, columnsBaseInfoMap, erpColumnsMap, erpFormValidator, index$1 as erpModalColumnsMap, getColumns$4 as getGyColumns, getColumns$5 as getJstColumns, getColumns$7 as getJyColumns, getColumns$6 as getKmColumns, getColumns$8 as getSkxColumns, getColumns$2 as getWdtColumns, getColumns$3 as getWlnColumns, orderSubFormConstants, renderMap };