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

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.js CHANGED
@@ -8059,6 +8059,436 @@ function withFormItem(WrappedComponent) {
8059
8059
  */
8060
8060
  var extendRequest = request.extend({});
8061
8061
 
8062
+ var hostUrl = 'https://kefu.kuaimai.com';
8063
+ var FileRender = function FileRender(_ref) {
8064
+ var _ref$fileList = _ref.fileList,
8065
+ fileList = _ref$fileList === void 0 ? [] : _ref$fileList,
8066
+ _ref$canDownload = _ref.canDownload,
8067
+ canDownload = _ref$canDownload === void 0 ? false : _ref$canDownload;
8068
+ var _useState = React.useState(false),
8069
+ _useState2 = _slicedToArray(_useState, 2),
8070
+ visible = _useState2[0],
8071
+ setVisible = _useState2[1];
8072
+ var _useState3 = React.useState(''),
8073
+ _useState4 = _slicedToArray(_useState3, 2),
8074
+ fileUrl = _useState4[0],
8075
+ setFileUrl = _useState4[1];
8076
+ var _useState5 = React.useState(''),
8077
+ _useState6 = _slicedToArray(_useState5, 2),
8078
+ fileType = _useState6[0],
8079
+ setFileType = _useState6[1];
8080
+ var _useState7 = React.useState(''),
8081
+ _useState8 = _slicedToArray(_useState7, 2),
8082
+ fileName = _useState8[0],
8083
+ setFileName = _useState8[1];
8084
+ var _useState9 = React.useState(false),
8085
+ _useState10 = _slicedToArray(_useState9, 2),
8086
+ downloading = _useState10[0],
8087
+ setDownloading = _useState10[1];
8088
+ var handleCancel = function handleCancel() {
8089
+ setFileUrl('');
8090
+ setFileName('');
8091
+ setVisible(false);
8092
+ setDownloading(false);
8093
+ };
8094
+ var onPreview = function onPreview(file) {
8095
+ var _file$url;
8096
+ var fileArr = file === null || file === void 0 ? void 0 : (_file$url = file.url) === null || _file$url === void 0 ? void 0 : _file$url.split('.');
8097
+ var fileType = fileArr[fileArr.length - 1];
8098
+ if (['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg'].includes(fileType.toLowerCase())) {
8099
+ setFileUrl(file === null || file === void 0 ? void 0 : file.url);
8100
+ setFileName(file === null || file === void 0 ? void 0 : file.name);
8101
+ setFileType('pic');
8102
+ setVisible(true);
8103
+ } else if (['mp4', 'avi', 'mpeg', 'asf', 'mov', '3gp', 'wmv', 'rmvb'].includes(fileType.toLowerCase())) {
8104
+ setFileUrl(file === null || file === void 0 ? void 0 : file.url);
8105
+ setFileName(file === null || file === void 0 ? void 0 : file.name);
8106
+ setFileType('video');
8107
+ setVisible(true);
8108
+ } else {
8109
+ window.open(file === null || file === void 0 ? void 0 : file.url);
8110
+ }
8111
+ };
8112
+ var download = function download(url, name) {
8113
+ setDownloading(true);
8114
+ fetch(url).then(function (res) {
8115
+ return res.blob();
8116
+ }).then(function (blob) {
8117
+ var a = document.createElement('a');
8118
+ document.body.appendChild(a);
8119
+ a.style.display = 'none';
8120
+ var url = window.URL.createObjectURL(blob);
8121
+ a.href = url;
8122
+ a.download = name;
8123
+ a.click();
8124
+ document.body.removeChild(a);
8125
+ window.URL.revokeObjectURL(url);
8126
+ }).finally(function () {
8127
+ setDownloading(false);
8128
+ });
8129
+ };
8130
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, fileList.map(function (item) {
8131
+ return /*#__PURE__*/React__default['default'].createElement("a", {
8132
+ style: {
8133
+ color: '#1890ff',
8134
+ cursor: 'pointer',
8135
+ display: 'block'
8136
+ },
8137
+ onClick: function onClick(e) {
8138
+ e.preventDefault();
8139
+ onPreview(item);
8140
+ },
8141
+ href: item === null || item === void 0 ? void 0 : item.url
8142
+ }, item.name);
8143
+ }), /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
8144
+ visible: visible,
8145
+ title: fileName,
8146
+ footer: null,
8147
+ onCancel: handleCancel
8148
+ }, canDownload ? /*#__PURE__*/React__default['default'].createElement(antd.Button, {
8149
+ type: "link",
8150
+ onClick: function onClick() {
8151
+ return download(fileUrl, fileName);
8152
+ },
8153
+ loading: downloading
8154
+ }, "\u4E0B\u8F7D") : /*#__PURE__*/React__default['default'].createElement(reactCopyToClipboard.CopyToClipboard, {
8155
+ text: fileUrl,
8156
+ onCopy: function onCopy() {
8157
+ antd.message.success('复制成功');
8158
+ }
8159
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Button, {
8160
+ type: "link"
8161
+ }, "\u4E0B\u8F7D\u5730\u5740")), fileType === 'pic' ? /*#__PURE__*/React__default['default'].createElement("img", {
8162
+ alt: "example",
8163
+ style: {
8164
+ width: '100%'
8165
+ },
8166
+ src: fileUrl
8167
+ }) : /*#__PURE__*/React__default['default'].createElement("video", {
8168
+ style: {
8169
+ width: '100%',
8170
+ height: '100%'
8171
+ },
8172
+ autoPlay: true,
8173
+ controls: true,
8174
+ src: fileUrl
8175
+ })));
8176
+ };
8177
+ var PictureRender = function PictureRender(_ref2) {
8178
+ var _ref2$value = _ref2.value,
8179
+ value = _ref2$value === void 0 ? [] : _ref2$value,
8180
+ _ref2$width = _ref2.width,
8181
+ width = _ref2$width === void 0 ? 32 : _ref2$width;
8182
+ return /*#__PURE__*/React__default['default'].createElement(antd.Image.PreviewGroup, null, value === null || value === void 0 ? void 0 : value.map(function (pic) {
8183
+ return /*#__PURE__*/React__default['default'].createElement("div", {
8184
+ style: {
8185
+ marginRight: '5px',
8186
+ display: 'inline-block'
8187
+ },
8188
+ onClick: function onClick(e) {
8189
+ return e.stopPropagation();
8190
+ }
8191
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Image, {
8192
+ width: width,
8193
+ src: kmkfUtils.imgResize(pic || ''),
8194
+ preview: {
8195
+ src: kmkfUtils.imgResize(pic || '', 0, 0)
8196
+ }
8197
+ }));
8198
+ }));
8199
+ };
8200
+ var RadioRender = function RadioRender(_ref3) {
8201
+ var _value$value;
8202
+ var _ref3$value = _ref3.value,
8203
+ value = _ref3$value === void 0 ? {} : _ref3$value;
8204
+ return /*#__PURE__*/React__default['default'].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, ")"));
8205
+ };
8206
+ var CheckboxRender = function CheckboxRender(_ref4) {
8207
+ var _value$value2, _value$value3, _value$value4;
8208
+ var _ref4$value = _ref4.value,
8209
+ value = _ref4$value === void 0 ? [] : _ref4$value;
8210
+ if ((value === null || value === void 0 ? void 0 : (_value$value2 = value.value) === null || _value$value2 === void 0 ? void 0 : _value$value2.length) === 0 && kmkfUtils.isNull(value === null || value === void 0 ? void 0 : value.other)) return null;
8211
+ 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) {
8212
+ return item === '其他';
8213
+ });
8214
+ if (findIndex > -1 && (value === null || value === void 0 ? void 0 : value.other)) {
8215
+ // @ts-ignore
8216
+ value.value[findIndex] = "\u5176\u4ED6(".concat(value === null || value === void 0 ? void 0 : value.other, ")");
8217
+ }
8218
+ return value === null || value === void 0 ? void 0 : (_value$value4 = value.value) === null || _value$value4 === void 0 ? void 0 : _value$value4.join('/');
8219
+ };
8220
+ var renderMap = {
8221
+ PICTURE: function PICTURE() {
8222
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
8223
+ var finalPictures = value.map(function (item) {
8224
+ return item.startsWith('http') ? item : "".concat(hostUrl, "/").concat(item);
8225
+ });
8226
+ return /*#__PURE__*/React__default['default'].createElement(PictureRender, {
8227
+ value: finalPictures,
8228
+ hostUrl: 'https://kefu.kuaimai.com'
8229
+ });
8230
+ },
8231
+ FILE: function FILE(value) {
8232
+ return /*#__PURE__*/React__default['default'].createElement(FileRender, {
8233
+ fileList: value,
8234
+ canDownload: true
8235
+ });
8236
+ },
8237
+ RADIO: function RADIO(value) {
8238
+ return /*#__PURE__*/React__default['default'].createElement(RadioRender, {
8239
+ value: value
8240
+ });
8241
+ },
8242
+ CHECKBOX: function CHECKBOX(value) {
8243
+ return /*#__PURE__*/React__default['default'].createElement(CheckboxRender, {
8244
+ value: value
8245
+ });
8246
+ }
8247
+ };
8248
+ var EditPictureRender = function EditPictureRender(_ref5) {
8249
+ var _ref5$val = _ref5.val,
8250
+ val = _ref5$val === void 0 ? [] : _ref5$val,
8251
+ index = _ref5.index,
8252
+ t = _ref5.t,
8253
+ updateHandle = _ref5.updateHandle,
8254
+ disabled = _ref5.disabled,
8255
+ hostUrl = _ref5.hostUrl;
8256
+ var finalPictures = val.map(function (item) {
8257
+ return item.startsWith('http') ? item : "".concat(hostUrl, "/").concat(item);
8258
+ });
8259
+ return /*#__PURE__*/React__default['default'].createElement("div", {
8260
+ style: {
8261
+ display: 'flex',
8262
+ flexWrap: 'wrap',
8263
+ border: '1px solid #d9d9d9',
8264
+ padding: '3px'
8265
+ }
8266
+ }, !t.isEdit && !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.Popover, {
8267
+ content: /*#__PURE__*/React__default['default'].createElement(ApaasUploadAsync$1, _objectSpread2(_objectSpread2({}, t.componentConfig), {}, {
8268
+ value: finalPictures,
8269
+ onChange: function onChange(e) {
8270
+ return updateHandle(e, index, t.key);
8271
+ },
8272
+ hostUrl: hostUrl
8273
+ })),
8274
+ trigger: "click"
8275
+ }, /*#__PURE__*/React__default['default'].createElement(icons.PlusSquareOutlined, {
8276
+ style: {
8277
+ fontSize: 18
8278
+ }
8279
+ })) : /*#__PURE__*/React__default['default'].createElement(icons.PlusSquareOutlined, {
8280
+ style: {
8281
+ fontSize: 18,
8282
+ color: '#333'
8283
+ }
8284
+ }), /*#__PURE__*/React__default['default'].createElement(PictureRender, {
8285
+ value: finalPictures,
8286
+ width: 24,
8287
+ hostUrl: hostUrl
8288
+ }));
8289
+ };
8290
+ var EditFileRender = function EditFileRender(_ref6) {
8291
+ var _ref6$val = _ref6.val,
8292
+ val = _ref6$val === void 0 ? [] : _ref6$val,
8293
+ index = _ref6.index,
8294
+ t = _ref6.t,
8295
+ updateHandle = _ref6.updateHandle,
8296
+ disabled = _ref6.disabled,
8297
+ hostUrl = _ref6.hostUrl;
8298
+ return /*#__PURE__*/React__default['default'].createElement("div", {
8299
+ style: {
8300
+ display: 'flex',
8301
+ flexWrap: 'wrap',
8302
+ border: '1px solid #d9d9d9',
8303
+ padding: '3px'
8304
+ }
8305
+ }, !t.isEdit && !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.Popover, {
8306
+ content: /*#__PURE__*/React__default['default'].createElement(ApaasUploadFile, _objectSpread2(_objectSpread2({}, t.componentConfig), {}, {
8307
+ value: val,
8308
+ onChange: function onChange(e) {
8309
+ return updateHandle(e, index, t.key);
8310
+ },
8311
+ hostUrl: hostUrl
8312
+ })),
8313
+ trigger: "click"
8314
+ }, /*#__PURE__*/React__default['default'].createElement(icons.PlusSquareOutlined, {
8315
+ style: {
8316
+ fontSize: 18
8317
+ }
8318
+ })) : /*#__PURE__*/React__default['default'].createElement(icons.PlusSquareOutlined, {
8319
+ style: {
8320
+ fontSize: 18,
8321
+ color: '#333'
8322
+ }
8323
+ }), /*#__PURE__*/React__default['default'].createElement(FileRender, {
8324
+ fileList: val,
8325
+ canDownload: true
8326
+ }));
8327
+ };
8328
+ var EditRenderMap = {
8329
+ INPUT: function INPUT(_ref7) {
8330
+ var val = _ref7.val,
8331
+ record = _ref7.record,
8332
+ index = _ref7.index,
8333
+ t = _ref7.t,
8334
+ updateHandle = _ref7.updateHandle,
8335
+ disabled = _ref7.disabled;
8336
+ var precisionValue = t.precision === 'nolimit' ? undefined : t.precision;
8337
+ return !t.isEdit && !disabled ? t.isNumber ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
8338
+ style: {
8339
+ width: '100%'
8340
+ },
8341
+ value: val,
8342
+ precision: precisionValue,
8343
+ onChange: function onChange(e) {
8344
+ return updateHandle(e, index, t.key);
8345
+ },
8346
+ stringMode: true
8347
+ }) : /*#__PURE__*/React__default['default'].createElement(antd.Input, {
8348
+ style: {
8349
+ width: '100%'
8350
+ },
8351
+ value: val,
8352
+ onChange: function onChange(e) {
8353
+ var _e$target;
8354
+ 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);
8355
+ }
8356
+ }) : /*#__PURE__*/React__default['default'].createElement("div", null, val);
8357
+ },
8358
+ TEXTAREA: function TEXTAREA(_ref8) {
8359
+ var val = _ref8.val,
8360
+ record = _ref8.record,
8361
+ index = _ref8.index,
8362
+ t = _ref8.t,
8363
+ updateHandle = _ref8.updateHandle,
8364
+ disabled = _ref8.disabled;
8365
+ var precisionValue = t.precision === 'nolimit' ? undefined : t.precision;
8366
+ return !t.isEdit && !disabled ? t.isNumber ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
8367
+ style: {
8368
+ width: '100%'
8369
+ },
8370
+ value: val,
8371
+ precision: precisionValue,
8372
+ onChange: function onChange(e) {
8373
+ return updateHandle(e, index, t.key);
8374
+ },
8375
+ stringMode: true
8376
+ }) : /*#__PURE__*/React__default['default'].createElement(antd.Input, {
8377
+ style: {
8378
+ width: '100%'
8379
+ },
8380
+ value: val,
8381
+ onChange: function onChange(e) {
8382
+ var _e$target2;
8383
+ 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);
8384
+ }
8385
+ }) : /*#__PURE__*/React__default['default'].createElement("div", null, val);
8386
+ },
8387
+ PICTURE: function PICTURE(_ref9) {
8388
+ var val = _ref9.val,
8389
+ record = _ref9.record,
8390
+ index = _ref9.index,
8391
+ t = _ref9.t,
8392
+ updateHandle = _ref9.updateHandle,
8393
+ disabled = _ref9.disabled;
8394
+ return !t.isEdit && !disabled ? /*#__PURE__*/React__default['default'].createElement(EditPictureRender, {
8395
+ val: val,
8396
+ t: t,
8397
+ disabled: disabled,
8398
+ index: index,
8399
+ updateHandle: updateHandle,
8400
+ hostUrl: hostUrl
8401
+ }) : /*#__PURE__*/React__default['default'].createElement(PictureRender, {
8402
+ value: val,
8403
+ width: 20,
8404
+ hostUrl: hostUrl
8405
+ });
8406
+ },
8407
+ FILE: function FILE(_ref10) {
8408
+ var val = _ref10.val,
8409
+ record = _ref10.record,
8410
+ index = _ref10.index,
8411
+ t = _ref10.t,
8412
+ updateHandle = _ref10.updateHandle,
8413
+ disabled = _ref10.disabled;
8414
+ return !t.isEdit && !disabled ? /*#__PURE__*/React__default['default'].createElement(EditFileRender, {
8415
+ val: val,
8416
+ t: t,
8417
+ disabled: disabled,
8418
+ index: index,
8419
+ updateHandle: updateHandle,
8420
+ hostUrl: hostUrl
8421
+ }) : /*#__PURE__*/React__default['default'].createElement(FileRender, {
8422
+ fileList: val,
8423
+ canDownload: true
8424
+ });
8425
+ },
8426
+ RADIO: function RADIO(_ref11) {
8427
+ var val = _ref11.val,
8428
+ record = _ref11.record,
8429
+ index = _ref11.index,
8430
+ t = _ref11.t,
8431
+ updateHandle = _ref11.updateHandle,
8432
+ disabled = _ref11.disabled,
8433
+ componentDto = _ref11.componentDto;
8434
+ return /*#__PURE__*/React__default['default'].createElement(ApaasRadio, _objectSpread2(_objectSpread2({}, componentDto === null || componentDto === void 0 ? void 0 : componentDto.componentConfig), {}, {
8435
+ value: val,
8436
+ disabled: t.isEdit || disabled,
8437
+ onChange: function onChange(e) {
8438
+ return updateHandle(e, index, t.key);
8439
+ }
8440
+ }));
8441
+ },
8442
+ SELECT: function SELECT(_ref12) {
8443
+ var val = _ref12.val,
8444
+ record = _ref12.record,
8445
+ index = _ref12.index,
8446
+ t = _ref12.t,
8447
+ updateHandle = _ref12.updateHandle,
8448
+ disabled = _ref12.disabled,
8449
+ componentDto = _ref12.componentDto;
8450
+ return /*#__PURE__*/React__default['default'].createElement(ApaasSelect, _objectSpread2(_objectSpread2({}, componentDto === null || componentDto === void 0 ? void 0 : componentDto.componentConfig), {}, {
8451
+ value: val,
8452
+ disabled: t.isEdit || disabled,
8453
+ onChange: function onChange(e) {
8454
+ return updateHandle(e, index, t.key);
8455
+ }
8456
+ }));
8457
+ },
8458
+ CHECKBOX: function CHECKBOX(_ref13) {
8459
+ var val = _ref13.val,
8460
+ record = _ref13.record,
8461
+ index = _ref13.index,
8462
+ t = _ref13.t,
8463
+ updateHandle = _ref13.updateHandle,
8464
+ disabled = _ref13.disabled,
8465
+ componentDto = _ref13.componentDto;
8466
+ return /*#__PURE__*/React__default['default'].createElement(ApaasCheckbox, _objectSpread2(_objectSpread2({}, componentDto === null || componentDto === void 0 ? void 0 : componentDto.componentConfig), {}, {
8467
+ value: val,
8468
+ disabled: t.isEdit || disabled,
8469
+ onChange: function onChange(e) {
8470
+ return updateHandle(e, index, t.key);
8471
+ }
8472
+ }));
8473
+ },
8474
+ BASIC_MULT_SELECT: function BASIC_MULT_SELECT(_ref14) {
8475
+ var val = _ref14.val,
8476
+ record = _ref14.record,
8477
+ index = _ref14.index,
8478
+ t = _ref14.t,
8479
+ updateHandle = _ref14.updateHandle,
8480
+ disabled = _ref14.disabled,
8481
+ componentDto = _ref14.componentDto;
8482
+ return /*#__PURE__*/React__default['default'].createElement(ApaasMultipleSelect, _objectSpread2(_objectSpread2({}, componentDto === null || componentDto === void 0 ? void 0 : componentDto.componentConfig), {}, {
8483
+ value: val,
8484
+ disabled: t.isEdit || disabled,
8485
+ onChange: function onChange(e) {
8486
+ return updateHandle(e, index, t.key);
8487
+ }
8488
+ }));
8489
+ }
8490
+ };
8491
+
8062
8492
  function HoverTableRowDeleteIcon(_ref) {
8063
8493
  var index = _ref.index,
8064
8494
  hoveredRowIndex = _ref.hoveredRowIndex,
@@ -8084,8 +8514,15 @@ function HoverTableRowDeleteIcon(_ref) {
8084
8514
 
8085
8515
  var WidgetMap = {
8086
8516
  INPUT: 'input',
8087
- TEXTAREA: 'textarea'
8517
+ TEXTAREA: 'textarea',
8518
+ PICTURE: 'picture',
8519
+ FILE: 'file',
8520
+ RADIO: 'radio',
8521
+ CHECKBOX: 'checkbox',
8522
+ SELECT: 'select',
8523
+ BASIC_MULT_SELECT: 'basicMultSelect'
8088
8524
  };
8525
+ var filterComponentType = ['PICTURE', 'FILE'];
8089
8526
  var pageSize = 50;
8090
8527
  var SubForm = function SubForm(props) {
8091
8528
  var _selectOptions$;
@@ -8134,6 +8571,10 @@ var SubForm = function SubForm(props) {
8134
8571
  _useState14 = _slicedToArray(_useState13, 2),
8135
8572
  hoveredRowIndex = _useState14[0],
8136
8573
  setHoveredRowIndex = _useState14[1];
8574
+ var _useState15 = React.useState([]),
8575
+ _useState16 = _slicedToArray(_useState15, 2),
8576
+ componentDtoList = _useState16[0],
8577
+ setComponentDtoList = _useState16[1];
8137
8578
  var updateHandle = function updateHandle(val, index, type) {
8138
8579
  if (value === null || value === void 0 ? void 0 : value.length) {
8139
8580
  var valueItem = tableHeader.find(function (t) {
@@ -8187,18 +8628,16 @@ var SubForm = function SubForm(props) {
8187
8628
  ellipsis: true,
8188
8629
  width: t.width,
8189
8630
  render: function render(val, record, index) {
8190
- // @ts-ignore
8191
- var precisionValue = t.precision === 'nolimit' ? undefined : t.precision;
8192
- return !t.isEdit && !disabled ? t.isNumber ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
8193
- style: {
8194
- width: '100%'
8195
- },
8196
- value: val,
8197
- precision: precisionValue,
8198
- onChange: function onChange(e) {
8199
- return updateHandle(e, index, t.key);
8200
- },
8201
- stringMode: true
8631
+ return EditRenderMap[t.workOrderComponentType] ? EditRenderMap[t.workOrderComponentType]({
8632
+ val: val,
8633
+ record: record,
8634
+ index: index,
8635
+ t: t,
8636
+ updateHandle: updateHandle,
8637
+ disabled: disabled,
8638
+ componentDto: componentDtoList.find(function (item) {
8639
+ return item.uniqueKey === t.key;
8640
+ })
8202
8641
  }) : /*#__PURE__*/React__default['default'].createElement(antd.Input, {
8203
8642
  style: {
8204
8643
  width: '100%'
@@ -8208,7 +8647,7 @@ var SubForm = function SubForm(props) {
8208
8647
  var _e$target;
8209
8648
  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);
8210
8649
  }
8211
- }) : /*#__PURE__*/React__default['default'].createElement("div", null, val);
8650
+ });
8212
8651
  }
8213
8652
  };
8214
8653
  })), [disabled ? {} : {
@@ -8249,28 +8688,53 @@ var SubForm = function SubForm(props) {
8249
8688
  return index + 1;
8250
8689
  }
8251
8690
  }].concat(_toConsumableArray(newTableHeader.map(function (t) {
8252
- return {
8691
+ var item = {
8253
8692
  dataIndex: t.key,
8254
8693
  title: t.name,
8255
8694
  width: 90
8256
8695
  };
8696
+ if (renderMap[t.workOrderComponentType]) {
8697
+ item.render = function (val) {
8698
+ return renderMap[t.workOrderComponentType](val);
8699
+ };
8700
+ }
8701
+ return item;
8257
8702
  })));
8258
8703
  }, [newTableHeader]);
8259
8704
  var valueMap = React.useMemo(function () {
8260
8705
  return newTableHeader.reduce(function (prv, next) {
8261
- prv["".concat(next.key, "_").concat(WidgetMap[next.workOrderComponentType])] = next.key;
8706
+ var item = {
8707
+ key: next.key,
8708
+ workOrderComponentType: next.workOrderComponentType,
8709
+ defaultValue: ''
8710
+ };
8711
+ if (['PICTURE', 'FILE', 'BASIC_MULT_SELECT'].includes(next.workOrderComponentType)) {
8712
+ item.defaultValue = [];
8713
+ }
8714
+ if (['RADIO', 'CHECKBOX'].includes(next.workOrderComponentType)) {
8715
+ item.defaultValue = {
8716
+ value: next.workOrderComponentType === 'RADIO' ? '' : [],
8717
+ other: ''
8718
+ };
8719
+ }
8720
+ if (['SELECT'].includes(next.workOrderComponentType)) {
8721
+ item.defaultValue = '';
8722
+ }
8723
+ prv["".concat(next.key, "_").concat(WidgetMap[next.workOrderComponentType])] = item;
8262
8724
  return prv;
8263
8725
  }, {});
8264
8726
  }, [newTableHeader]);
8265
8727
  var defaultValueMap = React.useMemo(function () {
8266
8728
  return Object.keys(valueMap).reduce(function (prv, next) {
8267
- prv["".concat(valueMap[next])] = '';
8729
+ prv["".concat(valueMap[next].key)] = valueMap[next].defaultValue;
8268
8730
  return prv;
8269
8731
  }, {});
8270
8732
  }, [valueMap]);
8271
8733
  var selectOptions = React.useMemo(function () {
8272
8734
  var _options$;
8273
- var options = newTableHeader.map(function (item) {
8735
+ var options = newTableHeader.filter(function (item) {
8736
+ return !filterComponentType.includes(item.workOrderComponentType);
8737
+ }).map(function (item) {
8274
8738
  return {
8275
8739
  label: item.name,
8276
8740
  value: "".concat(item.key, "_").concat(WidgetMap[item.workOrderComponentType])
@@ -8294,6 +8758,7 @@ var SubForm = function SubForm(props) {
8294
8758
  newValue.splice(index, 0, _objectSpread2(_objectSpread2({}, defaultValueMap), {}, {
8295
8759
  uuid: kmkfUtils.uuid()
8296
8760
  }));
8761
+ console.log('newValue', newValue);
8297
8762
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
8298
8763
  };
8299
8764
  var onScrollCapture = function onScrollCapture(e) {
@@ -8312,10 +8777,14 @@ var SubForm = function SubForm(props) {
8312
8777
  var _ref2,
8313
8778
  _ref2$pageNo,
8314
8779
  pageNo,
8780
+ _yield$request,
8781
+ templateDetail,
8315
8782
  params,
8316
8783
  res,
8317
8784
  data,
8318
8785
  success,
8786
+ transDataSourceItem,
8787
+ headerKeys,
8319
8788
  newList,
8320
8789
  _args = arguments;
8321
8790
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -8328,6 +8797,18 @@ var SubForm = function SubForm(props) {
8328
8797
  }
8329
8798
  return _context.abrupt("return");
8330
8799
  case 3:
8800
+ _context.next = 5;
8801
+ return extendRequest('/qy/gdfw/template/queryTemplateDetail', {
8802
+ method: 'post',
8803
+ data: {
8804
+ templateType: 'QY_CUSTOM',
8805
+ uniqueKey: workOrderTemplateId
8806
+ }
8807
+ });
8808
+ case 5:
8809
+ _yield$request = _context.sent;
8810
+ templateDetail = _yield$request.data;
8811
+ setComponentDtoList((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || []);
8331
8812
  params = {
8332
8813
  flowNodeId: nodeId,
8333
8814
  flowTemplateKey: flowTemplateKey === null || flowTemplateKey === void 0 ? void 0 : flowTemplateKey[1],
@@ -8353,22 +8834,27 @@ var SubForm = function SubForm(props) {
8353
8834
  value: [inputValue]
8354
8835
  }];
8355
8836
  }
8356
- _context.next = 7;
8837
+ _context.next = 12;
8357
8838
  return extendRequest('/qy/view/workOrderList', {
8358
8839
  method: 'post',
8359
8840
  data: params
8360
8841
  });
8361
- case 7:
8842
+ case 12:
8362
8843
  res = _context.sent;
8363
8844
  data = res.data, success = res.success;
8364
8845
  if (success) {
8846
+ transDataSourceItem = kmkfUtils.transformWorkOrderData(templateDetail.componentDtoList, 'init');
8847
+ headerKeys = tableHeader.map(function (t) {
8848
+ return t.key;
8849
+ });
8365
8850
  newList = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
8851
+ var value = transDataSourceItem(item);
8366
8852
  var params = {
8367
8853
  uuid: kmkfUtils.uuid()
8368
8854
  };
8369
- Object.keys(item.jsonMap).forEach(function (key) {
8370
- if (valueMap[key]) {
8371
- params[valueMap[key]] = item.jsonMap[key];
8855
+ Object.keys(value).forEach(function (key) {
8856
+ if (headerKeys.includes(key)) {
8857
+ params[key] = value[key];
8372
8858
  }
8373
8859
  });
8374
8860
  return params;
@@ -8382,7 +8868,7 @@ var SubForm = function SubForm(props) {
8382
8868
  setHasMore((data === null || data === void 0 ? void 0 : data.list.length) === pageSize);
8383
8869
  isRequest.current = false;
8384
8870
  }
8385
- case 10:
8871
+ case 15:
8386
8872
  case "end":
8387
8873
  return _context.stop();
8388
8874
  }
@@ -25881,3 +26367,4 @@ exports.getSkxColumns = getColumns$8;
25881
26367
  exports.getWdtColumns = getColumns$2;
25882
26368
  exports.getWlnColumns = getColumns$3;
25883
26369
  exports.orderSubFormConstants = orderSubFormConstants;
26370
+ exports.renderMap = renderMap;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { renderMap } from './render';
2
3
  type subConfigType = {
3
4
  name: string;
4
5
  key: string;
@@ -30,3 +31,4 @@ type SubFormProps = {
30
31
  };
31
32
  declare const SubForm: (props: SubFormProps) => React.JSX.Element;
32
33
  export default SubForm;
34
+ export { renderMap };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ declare const hostUrl = "https://kefu.kuaimai.com";
3
+ export declare const FileRender: ({ fileList, canDownload }: any) => React.JSX.Element;
4
+ export declare const PictureRender: ({ value, width, }: {
5
+ value: any;
6
+ hostUrl?: string | undefined;
7
+ width?: number | undefined;
8
+ }) => React.JSX.Element;
9
+ export declare const RadioRender: ({ value }: {
10
+ value: any;
11
+ }) => React.JSX.Element;
12
+ export declare const CheckboxRender: ({ value }: {
13
+ value: any;
14
+ }) => any;
15
+ export declare const renderMap: Record<string, (props: any) => React.ReactNode>;
16
+ export declare const EditPictureRender: ({ val, index, t, updateHandle, disabled, hostUrl, }: any) => React.JSX.Element;
17
+ export declare const EditFileRender: ({ val, index, t, updateHandle, disabled, hostUrl, }: any) => React.JSX.Element;
18
+ export declare const EditRenderMap: Record<string, (props: any) => React.ReactNode>;
19
+ export {};
@@ -17,7 +17,7 @@ export { default as ApaasAddress } from './apaas/ApaasAddress';
17
17
  export { default as ApaasPosting } from './apaas/ApaasPosting';
18
18
  export { default as ApaasLogistics } from './apaas/ApaasLogistics';
19
19
  export { default as ApaasHoc } from './apaas/hoc/withFormItem';
20
- export { default as SubForm } from './apaas/SubForm';
20
+ export { default as SubForm, renderMap } from './apaas/SubForm';
21
21
  export { default as CopyTextIcon } from './apaas/CopyTextIcon';
22
22
  export { default as BuyerNick } from './business/BuyerNick';
23
23
  export { default as TradeId } from './business/TradeId';