ls-pro-common 1.0.62 → 1.0.63

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +746 -746
  2. package/README.md +22 -22
  3. package/dist/common.css +101 -22
  4. package/dist/common.js +1 -1
  5. package/dist/common.min.css +101 -22
  6. package/dist/common.min.js +1 -1
  7. package/es/components/IconSelector.d.ts +2 -8
  8. package/es/components/IconSelector.js +114 -207
  9. package/es/components/ImageSelector.d.ts +3 -0
  10. package/es/components/ImageSelector.js +128 -24
  11. package/es/components/InputMultiLine.js +1 -1
  12. package/es/components/InputTable.d.ts +5 -0
  13. package/es/components/InputTable.js +26 -4
  14. package/es/components/common.less +176 -119
  15. package/es/hooks/useDtl/index.d.ts +13 -0
  16. package/es/hooks/useDtl/index.js +388 -235
  17. package/es/hooks/usePermission/index.d.ts +1 -0
  18. package/es/hooks/usePermission/index.js +23 -1
  19. package/es/hooks/useSingle/index.d.ts +1 -0
  20. package/es/hooks/useSingle/index.js +3 -1
  21. package/es/http/index.js +26 -7
  22. package/es/service/BaseService.d.ts +8 -0
  23. package/es/service/BaseService.js +69 -26
  24. package/es/typing.d.ts +4 -0
  25. package/es/utils/index.d.ts +49 -0
  26. package/es/utils/index.js +142 -1
  27. package/lib/components/IconSelector.d.ts +2 -8
  28. package/lib/components/IconSelector.js +112 -214
  29. package/lib/components/ImageSelector.d.ts +3 -0
  30. package/lib/components/ImageSelector.js +125 -24
  31. package/lib/components/InputMultiLine.js +1 -1
  32. package/lib/components/InputTable.d.ts +5 -0
  33. package/lib/components/InputTable.js +26 -4
  34. package/lib/components/common.less +176 -119
  35. package/lib/hooks/useDtl/index.d.ts +13 -0
  36. package/lib/hooks/useDtl/index.js +388 -235
  37. package/lib/hooks/usePermission/index.d.ts +1 -0
  38. package/lib/hooks/usePermission/index.js +23 -0
  39. package/lib/hooks/useSingle/index.d.ts +1 -0
  40. package/lib/hooks/useSingle/index.js +3 -1
  41. package/lib/http/index.js +24 -6
  42. package/lib/service/BaseService.d.ts +8 -0
  43. package/lib/service/BaseService.js +69 -26
  44. package/lib/typing.d.ts +4 -0
  45. package/lib/utils/index.d.ts +49 -0
  46. package/lib/utils/index.js +163 -3
  47. package/package.json +2 -2
@@ -94,10 +94,13 @@ function useDtl(dtlParam) {
94
94
  /** @name 从表编辑表单Ref */
95
95
 
96
96
  var dtlFormRef = (0, _react.useRef)();
97
+ /**@name 判断是否已审核 */
98
+
97
99
  var isAudit = (0, _react.useCallback)(function () {
98
100
  if (!auditStatus || !statusField) return false;
99
101
  return Number(masterObject[statusField] || 0) >= auditStatus;
100
102
  }, [auditStatus, statusField, masterObject]);
103
+ /** @name 保存主表 */
101
104
 
102
105
  var onSaveMst = /*#__PURE__*/function () {
103
106
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(values) {
@@ -194,262 +197,411 @@ function useDtl(dtlParam) {
194
197
  return _ref.apply(this, arguments);
195
198
  };
196
199
  }();
197
- /** 删除按钮事件 */
200
+ /** @name 主从一起保存 */
198
201
 
199
202
 
200
- var onRemoveMst = /*#__PURE__*/function () {
203
+ var onSaveMstDtl = /*#__PURE__*/function () {
201
204
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
202
- var _result$flag2;
205
+ var _formRef$current, _formRef$current$getF, _tableRef$current, _tableRef$current$get, _tableRef$current2, _tableRef$current2$ge, _result$flag2;
203
206
 
204
- var ids, result;
207
+ var isDelete,
208
+ values,
209
+ mst,
210
+ dtlEditData,
211
+ dtlData,
212
+ param,
213
+ result,
214
+ _args2 = arguments;
205
215
  return _regenerator.default.wrap(function _callee2$(_context2) {
206
216
  while (1) {
207
217
  switch (_context2.prev = _context2.next) {
208
218
  case 0:
209
- if (!(!masterObject || !masterObject[mstKeyField])) {
210
- _context2.next = 2;
219
+ isDelete = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : false;
220
+
221
+ if (!isAudit()) {
222
+ _context2.next = 4;
223
+ break;
224
+ }
225
+
226
+ (0, _utils.showWarn)('当前单据已审核,不能保存');
227
+ return _context2.abrupt("return", false);
228
+
229
+ case 4:
230
+ if (dtlParam.dtlName) {
231
+ _context2.next = 7;
232
+ break;
233
+ }
234
+
235
+ (0, _utils.showWarn)('useDtl未传入dtlName参数,不能主从一起保存');
236
+ return _context2.abrupt("return");
237
+
238
+ case 7:
239
+ values = (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsFormatValue) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF.call(_formRef$current);
240
+ mst = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, masterObject), values);
241
+ dtlEditData = ((_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$get = _tableRef$current.getChanged) === null || _tableRef$current$get === void 0 ? void 0 : _tableRef$current$get.call(_tableRef$current)) || {
242
+ insertRows: [],
243
+ updateRows: [],
244
+ deleteRows: []
245
+ };
246
+ dtlData = ((_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$ge = _tableRef$current2.getDatasource) === null || _tableRef$current2$ge === void 0 ? void 0 : _tableRef$current2$ge.call(_tableRef$current2)) || [];
247
+ param = {
248
+ master: mst,
249
+ opType: 'inserted',
250
+ billType: dtlParam.billType,
251
+ codeRuleDynamicField: dtlParam.codeRuleDynamicField,
252
+ details: {}
253
+ };
254
+
255
+ if (isDelete) {
256
+ param.opType = 'deleted';
257
+ param.details[dtlParam.dtlName] = {
258
+ insertRows: dtlData,
259
+ updateRows: [],
260
+ deleteRows: []
261
+ };
262
+ } else if (mst[mstKeyField] && mst.id) {
263
+ param.opType = 'updated';
264
+ param.details[dtlParam.dtlName] = (0, _objectSpread2.default)({}, dtlEditData);
265
+ } else {
266
+ param.details[dtlParam.dtlName] = {
267
+ insertRows: dtlData,
268
+ updateRows: [],
269
+ deleteRows: []
270
+ };
271
+ }
272
+
273
+ _context2.t0 = beforeSave;
274
+
275
+ if (!_context2.t0) {
276
+ _context2.next = 19;
277
+ break;
278
+ }
279
+
280
+ _context2.next = 17;
281
+ return beforeSave(param, false);
282
+
283
+ case 17:
284
+ _context2.t1 = _context2.sent;
285
+ _context2.t0 = _context2.t1 === false;
286
+
287
+ case 19:
288
+ if (!_context2.t0) {
289
+ _context2.next = 21;
290
+ break;
291
+ }
292
+
293
+ return _context2.abrupt("return", false);
294
+
295
+ case 21:
296
+ _context2.next = 23;
297
+ return mstService.saveMstDtl(param);
298
+
299
+ case 23:
300
+ result = _context2.sent;
301
+ _context2.t2 = afterSave;
302
+
303
+ if (!_context2.t2) {
304
+ _context2.next = 30;
305
+ break;
306
+ }
307
+
308
+ _context2.next = 28;
309
+ return afterSave(result, param, false);
310
+
311
+ case 28:
312
+ _context2.t3 = _context2.sent;
313
+ _context2.t2 = _context2.t3 === false;
314
+
315
+ case 30:
316
+ if (!_context2.t2) {
317
+ _context2.next = 32;
318
+ break;
319
+ }
320
+
321
+ return _context2.abrupt("return", false);
322
+
323
+ case 32:
324
+ if (!((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0')) {
325
+ _context2.next = 37;
211
326
  break;
212
327
  }
213
328
 
329
+ (0, _utils.showSuccess)(result.flag.retMsg || '操作成功');
330
+ Object.assign(masterObject, result.data);
331
+ setEditItem({});
332
+ return _context2.abrupt("return", true);
333
+
334
+ case 37:
214
335
  return _context2.abrupt("return", false);
215
336
 
337
+ case 38:
338
+ case "end":
339
+ return _context2.stop();
340
+ }
341
+ }
342
+ }, _callee2);
343
+ }));
344
+
345
+ return function onSaveMstDtl() {
346
+ return _ref2.apply(this, arguments);
347
+ };
348
+ }();
349
+ /** 删除按钮事件 */
350
+
351
+
352
+ var onRemoveMst = /*#__PURE__*/function () {
353
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
354
+ var _result$flag3;
355
+
356
+ var ids, result;
357
+ return _regenerator.default.wrap(function _callee3$(_context3) {
358
+ while (1) {
359
+ switch (_context3.prev = _context3.next) {
360
+ case 0:
361
+ if (!(!masterObject || !masterObject[mstKeyField])) {
362
+ _context3.next = 2;
363
+ break;
364
+ }
365
+
366
+ return _context3.abrupt("return", false);
367
+
216
368
  case 2:
217
369
  if (!isAudit()) {
218
- _context2.next = 5;
370
+ _context3.next = 5;
219
371
  break;
220
372
  }
221
373
 
222
374
  (0, _utils.showWarn)('当前单据已审核,不能删除');
223
- return _context2.abrupt("return", false);
375
+ return _context3.abrupt("return", false);
224
376
 
225
377
  case 5:
226
- _context2.next = 7;
378
+ _context3.next = 7;
227
379
  return (0, _utils.showConfirm)('确认要删除当前数据?');
228
380
 
229
381
  case 7:
230
382
  if (!beforeRemove) {
231
- _context2.next = 13;
383
+ _context3.next = 13;
232
384
  break;
233
385
  }
234
386
 
235
- _context2.next = 10;
387
+ _context3.next = 10;
236
388
  return beforeRemove([masterObject]);
237
389
 
238
390
  case 10:
239
- ids = _context2.sent;
391
+ ids = _context3.sent;
240
392
 
241
393
  if (!(ids === false)) {
242
- _context2.next = 13;
394
+ _context3.next = 13;
243
395
  break;
244
396
  }
245
397
 
246
- return _context2.abrupt("return", false);
398
+ return _context3.abrupt("return", false);
247
399
 
248
400
  case 13:
249
401
  if (!ids) {
250
402
  ids = [masterObject[mstKeyField]];
251
403
  }
252
404
 
253
- _context2.next = 16;
405
+ _context3.next = 16;
254
406
  return mstService.remove(ids);
255
407
 
256
408
  case 16:
257
- result = _context2.sent;
258
- _context2.t0 = afterRemove;
409
+ result = _context3.sent;
410
+ _context3.t0 = afterRemove;
259
411
 
260
- if (!_context2.t0) {
261
- _context2.next = 23;
412
+ if (!_context3.t0) {
413
+ _context3.next = 23;
262
414
  break;
263
415
  }
264
416
 
265
- _context2.next = 21;
417
+ _context3.next = 21;
266
418
  return afterRemove(result, masterObject);
267
419
 
268
420
  case 21:
269
- _context2.t1 = _context2.sent;
270
- _context2.t0 = _context2.t1 === false;
421
+ _context3.t1 = _context3.sent;
422
+ _context3.t0 = _context3.t1 === false;
271
423
 
272
424
  case 23:
273
- if (!_context2.t0) {
274
- _context2.next = 25;
425
+ if (!_context3.t0) {
426
+ _context3.next = 25;
275
427
  break;
276
428
  }
277
429
 
278
- return _context2.abrupt("return");
430
+ return _context3.abrupt("return");
279
431
 
280
432
  case 25:
281
- if (!((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retCode) === '0')) {
282
- _context2.next = 28;
433
+ if (!((result === null || result === void 0 ? void 0 : (_result$flag3 = result.flag) === null || _result$flag3 === void 0 ? void 0 : _result$flag3.retCode) === '0')) {
434
+ _context3.next = 28;
283
435
  break;
284
436
  }
285
437
 
286
438
  (0, _utils.showSuccess)(result.flag.retMsg || '删除成功');
287
- return _context2.abrupt("return", true);
439
+ return _context3.abrupt("return", true);
288
440
 
289
441
  case 28:
290
- return _context2.abrupt("return", false);
442
+ return _context3.abrupt("return", false);
291
443
 
292
444
  case 29:
293
445
  case "end":
294
- return _context2.stop();
446
+ return _context3.stop();
295
447
  }
296
448
  }
297
- }, _callee2);
449
+ }, _callee3);
298
450
  }));
299
451
 
300
452
  return function onRemoveMst() {
301
- return _ref2.apply(this, arguments);
453
+ return _ref3.apply(this, arguments);
302
454
  };
303
455
  }();
304
456
  /** 新增按钮事件 */
305
457
 
306
458
 
307
459
  var onAddDtl = /*#__PURE__*/function () {
308
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
460
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
309
461
  var item,
310
- _formRef$current,
462
+ _formRef$current2,
311
463
  mstVal,
312
464
  mst,
313
- _args3 = arguments;
465
+ _args4 = arguments;
314
466
 
315
- return _regenerator.default.wrap(function _callee3$(_context3) {
467
+ return _regenerator.default.wrap(function _callee4$(_context4) {
316
468
  while (1) {
317
- switch (_context3.prev = _context3.next) {
469
+ switch (_context4.prev = _context4.next) {
318
470
  case 0:
319
- item = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : (0, _objectSpread2.default)({}, dtlItem);
471
+ item = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : (0, _objectSpread2.default)({}, dtlItem);
320
472
 
321
473
  if (!(!masterObject[mstKeyField] && formRef.current)) {
322
- _context3.next = 16;
474
+ _context4.next = 16;
323
475
  break;
324
476
  }
325
477
 
326
- _context3.prev = 2;
327
- _context3.next = 5;
328
- return (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.validateFields();
478
+ _context4.prev = 2;
479
+ _context4.next = 5;
480
+ return (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.validateFields();
329
481
 
330
482
  case 5:
331
483
  mstVal = formRef.current.getFieldsValue();
332
- _context3.next = 8;
484
+ _context4.next = 8;
333
485
  return onSaveMst(mstVal);
334
486
 
335
487
  case 8:
336
- mst = _context3.sent;
488
+ mst = _context4.sent;
337
489
 
338
490
  if (!(mst !== true)) {
339
- _context3.next = 11;
491
+ _context4.next = 11;
340
492
  break;
341
493
  }
342
494
 
343
- return _context3.abrupt("return", false);
495
+ return _context4.abrupt("return", false);
344
496
 
345
497
  case 11:
346
- _context3.next = 16;
498
+ _context4.next = 16;
347
499
  break;
348
500
 
349
501
  case 13:
350
- _context3.prev = 13;
351
- _context3.t0 = _context3["catch"](2);
352
- return _context3.abrupt("return", false);
502
+ _context4.prev = 13;
503
+ _context4.t0 = _context4["catch"](2);
504
+ return _context4.abrupt("return", false);
353
505
 
354
506
  case 16:
355
- _context3.t1 = beforeAdd;
507
+ _context4.t1 = beforeAdd;
356
508
 
357
- if (!_context3.t1) {
358
- _context3.next = 22;
509
+ if (!_context4.t1) {
510
+ _context4.next = 22;
359
511
  break;
360
512
  }
361
513
 
362
- _context3.next = 20;
514
+ _context4.next = 20;
363
515
  return beforeAdd(item);
364
516
 
365
517
  case 20:
366
- _context3.t2 = _context3.sent;
367
- _context3.t1 = _context3.t2 === false;
518
+ _context4.t2 = _context4.sent;
519
+ _context4.t1 = _context4.t2 === false;
368
520
 
369
521
  case 22:
370
- if (!_context3.t1) {
371
- _context3.next = 24;
522
+ if (!_context4.t1) {
523
+ _context4.next = 24;
372
524
  break;
373
525
  }
374
526
 
375
- return _context3.abrupt("return", false);
527
+ return _context4.abrupt("return", false);
376
528
 
377
529
  case 24:
378
530
  setEditItem(item);
379
531
  setShowEdit(true);
380
- return _context3.abrupt("return", true);
532
+ return _context4.abrupt("return", true);
381
533
 
382
534
  case 27:
383
535
  case "end":
384
- return _context3.stop();
536
+ return _context4.stop();
385
537
  }
386
538
  }
387
- }, _callee3, null, [[2, 13]]);
539
+ }, _callee4, null, [[2, 13]]);
388
540
  }));
389
541
 
390
542
  return function onAddDtl() {
391
- return _ref3.apply(this, arguments);
543
+ return _ref4.apply(this, arguments);
392
544
  };
393
545
  }();
394
546
  /** 编辑按钮事件 */
395
547
 
396
548
 
397
549
  var onEditDtl = /*#__PURE__*/function () {
398
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
550
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
399
551
  var item,
400
- _args4 = arguments;
401
- return _regenerator.default.wrap(function _callee4$(_context4) {
552
+ _args5 = arguments;
553
+ return _regenerator.default.wrap(function _callee5$(_context5) {
402
554
  while (1) {
403
- switch (_context4.prev = _context4.next) {
555
+ switch (_context5.prev = _context5.next) {
404
556
  case 0:
405
- item = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : (0, _objectSpread2.default)({}, selectedRows[0]);
557
+ item = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : (0, _objectSpread2.default)({}, selectedRows[0]);
406
558
 
407
559
  if (selectedRows.length) {
408
- _context4.next = 4;
560
+ _context5.next = 4;
409
561
  break;
410
562
  }
411
563
 
412
564
  (0, _utils.showWarn)('请先选择需要更改的数据');
413
- return _context4.abrupt("return", false);
565
+ return _context5.abrupt("return", false);
414
566
 
415
567
  case 4:
416
- _context4.t0 = beforeEdit;
568
+ _context5.t0 = beforeEdit;
417
569
 
418
- if (!_context4.t0) {
419
- _context4.next = 10;
570
+ if (!_context5.t0) {
571
+ _context5.next = 10;
420
572
  break;
421
573
  }
422
574
 
423
- _context4.next = 8;
575
+ _context5.next = 8;
424
576
  return beforeEdit(item);
425
577
 
426
578
  case 8:
427
- _context4.t1 = _context4.sent;
428
- _context4.t0 = _context4.t1 === false;
579
+ _context5.t1 = _context5.sent;
580
+ _context5.t0 = _context5.t1 === false;
429
581
 
430
582
  case 10:
431
- if (!_context4.t0) {
432
- _context4.next = 12;
583
+ if (!_context5.t0) {
584
+ _context5.next = 12;
433
585
  break;
434
586
  }
435
587
 
436
- return _context4.abrupt("return", false);
588
+ return _context5.abrupt("return", false);
437
589
 
438
590
  case 12:
439
591
  setEditItem(item);
440
592
  setShowEdit(true);
441
- return _context4.abrupt("return", true);
593
+ return _context5.abrupt("return", true);
442
594
 
443
595
  case 15:
444
596
  case "end":
445
- return _context4.stop();
597
+ return _context5.stop();
446
598
  }
447
599
  }
448
- }, _callee4);
600
+ }, _callee5);
449
601
  }));
450
602
 
451
603
  return function onEditDtl() {
452
- return _ref4.apply(this, arguments);
604
+ return _ref5.apply(this, arguments);
453
605
  };
454
606
  }();
455
607
  /** 删除按钮事件 */
@@ -463,31 +615,31 @@ function useDtl(dtlParam) {
463
615
  return;
464
616
  }
465
617
 
466
- (0, _utils.showConfirm)('确认要删除选择的数据?').then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
467
- var _result$flag3;
618
+ (0, _utils.showConfirm)('确认要删除选择的数据?').then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
619
+ var _result$flag4;
468
620
 
469
621
  var ids, result;
470
- return _regenerator.default.wrap(function _callee5$(_context5) {
622
+ return _regenerator.default.wrap(function _callee6$(_context6) {
471
623
  while (1) {
472
- switch (_context5.prev = _context5.next) {
624
+ switch (_context6.prev = _context6.next) {
473
625
  case 0:
474
626
  if (!beforeRemove) {
475
- _context5.next = 6;
627
+ _context6.next = 6;
476
628
  break;
477
629
  }
478
630
 
479
- _context5.next = 3;
631
+ _context6.next = 3;
480
632
  return beforeRemove(rows);
481
633
 
482
634
  case 3:
483
- ids = _context5.sent;
635
+ ids = _context6.sent;
484
636
 
485
637
  if (!(ids === false)) {
486
- _context5.next = 6;
638
+ _context6.next = 6;
487
639
  break;
488
640
  }
489
641
 
490
- return _context5.abrupt("return");
642
+ return _context6.abrupt("return");
491
643
 
492
644
  case 6:
493
645
  if (!ids) {
@@ -496,35 +648,35 @@ function useDtl(dtlParam) {
496
648
  });
497
649
  }
498
650
 
499
- _context5.next = 9;
651
+ _context6.next = 9;
500
652
  return dtlService.remove(ids);
501
653
 
502
654
  case 9:
503
- result = _context5.sent;
504
- _context5.t0 = afterRemove;
655
+ result = _context6.sent;
656
+ _context6.t0 = afterRemove;
505
657
 
506
- if (!_context5.t0) {
507
- _context5.next = 16;
658
+ if (!_context6.t0) {
659
+ _context6.next = 16;
508
660
  break;
509
661
  }
510
662
 
511
- _context5.next = 14;
663
+ _context6.next = 14;
512
664
  return afterRemove(result, rows);
513
665
 
514
666
  case 14:
515
- _context5.t1 = _context5.sent;
516
- _context5.t0 = _context5.t1 === false;
667
+ _context6.t1 = _context6.sent;
668
+ _context6.t0 = _context6.t1 === false;
517
669
 
518
670
  case 16:
519
- if (!_context5.t0) {
520
- _context5.next = 18;
671
+ if (!_context6.t0) {
672
+ _context6.next = 18;
521
673
  break;
522
674
  }
523
675
 
524
- return _context5.abrupt("return");
676
+ return _context6.abrupt("return");
525
677
 
526
678
  case 18:
527
- if ((result === null || result === void 0 ? void 0 : (_result$flag3 = result.flag) === null || _result$flag3 === void 0 ? void 0 : _result$flag3.retCode) === '0') {
679
+ if ((result === null || result === void 0 ? void 0 : (_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0') {
528
680
  (0, _utils.showSuccess)(result.flag.retMsg);
529
681
 
530
682
  if (tableRef.current) {
@@ -534,23 +686,23 @@ function useDtl(dtlParam) {
534
686
 
535
687
  case 19:
536
688
  case "end":
537
- return _context5.stop();
689
+ return _context6.stop();
538
690
  }
539
691
  }
540
- }, _callee5);
692
+ }, _callee6);
541
693
  })));
542
694
  };
543
695
  /** 新增,更改对应的保存事件 */
544
696
 
545
697
 
546
698
  var onSaveDtl = /*#__PURE__*/function () {
547
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(formData) {
548
- var _result$flag4;
699
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(formData) {
700
+ var _result$flag5;
549
701
 
550
702
  var data, result;
551
- return _regenerator.default.wrap(function _callee6$(_context6) {
703
+ return _regenerator.default.wrap(function _callee7$(_context7) {
552
704
  while (1) {
553
- switch (_context6.prev = _context6.next) {
705
+ switch (_context7.prev = _context7.next) {
554
706
  case 0:
555
707
  data = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, editItem), formData);
556
708
 
@@ -558,59 +710,59 @@ function useDtl(dtlParam) {
558
710
  data[relationField] = masterObject[mstKeyField];
559
711
  }
560
712
 
561
- _context6.t0 = beforeSave;
713
+ _context7.t0 = beforeSave;
562
714
 
563
- if (!_context6.t0) {
564
- _context6.next = 8;
715
+ if (!_context7.t0) {
716
+ _context7.next = 8;
565
717
  break;
566
718
  }
567
719
 
568
- _context6.next = 6;
720
+ _context7.next = 6;
569
721
  return beforeSave(data, true);
570
722
 
571
723
  case 6:
572
- _context6.t1 = _context6.sent;
573
- _context6.t0 = _context6.t1 === false;
724
+ _context7.t1 = _context7.sent;
725
+ _context7.t0 = _context7.t1 === false;
574
726
 
575
727
  case 8:
576
- if (!_context6.t0) {
577
- _context6.next = 10;
728
+ if (!_context7.t0) {
729
+ _context7.next = 10;
578
730
  break;
579
731
  }
580
732
 
581
- return _context6.abrupt("return", false);
733
+ return _context7.abrupt("return", false);
582
734
 
583
735
  case 10:
584
- _context6.next = 12;
736
+ _context7.next = 12;
585
737
  return dtlService.save(data);
586
738
 
587
739
  case 12:
588
- result = _context6.sent;
589
- _context6.t2 = afterSave;
740
+ result = _context7.sent;
741
+ _context7.t2 = afterSave;
590
742
 
591
- if (!_context6.t2) {
592
- _context6.next = 19;
743
+ if (!_context7.t2) {
744
+ _context7.next = 19;
593
745
  break;
594
746
  }
595
747
 
596
- _context6.next = 17;
748
+ _context7.next = 17;
597
749
  return afterSave(result, data, true);
598
750
 
599
751
  case 17:
600
- _context6.t3 = _context6.sent;
601
- _context6.t2 = _context6.t3 === false;
752
+ _context7.t3 = _context7.sent;
753
+ _context7.t2 = _context7.t3 === false;
602
754
 
603
755
  case 19:
604
- if (!_context6.t2) {
605
- _context6.next = 21;
756
+ if (!_context7.t2) {
757
+ _context7.next = 21;
606
758
  break;
607
759
  }
608
760
 
609
- return _context6.abrupt("return", false);
761
+ return _context7.abrupt("return", false);
610
762
 
611
763
  case 21:
612
- if (!((result === null || result === void 0 ? void 0 : (_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
613
- _context6.next = 25;
764
+ if (!((result === null || result === void 0 ? void 0 : (_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retCode) === '0')) {
765
+ _context7.next = 25;
614
766
  break;
615
767
  }
616
768
 
@@ -620,44 +772,44 @@ function useDtl(dtlParam) {
620
772
  tableRef.current.reload(false);
621
773
  }
622
774
 
623
- return _context6.abrupt("return", true);
775
+ return _context7.abrupt("return", true);
624
776
 
625
777
  case 25:
626
- return _context6.abrupt("return", false);
778
+ return _context7.abrupt("return", false);
627
779
 
628
780
  case 26:
629
781
  case "end":
630
- return _context6.stop();
782
+ return _context7.stop();
631
783
  }
632
784
  }
633
- }, _callee6);
785
+ }, _callee7);
634
786
  }));
635
787
 
636
788
  return function onSaveDtl(_x2) {
637
- return _ref6.apply(this, arguments);
789
+ return _ref7.apply(this, arguments);
638
790
  };
639
791
  }();
640
792
  /** 加载数据方法 */
641
793
 
642
794
 
643
795
  var onLoadDtl = /*#__PURE__*/function () {
644
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(params, sort, filter) {
645
- var _tableRef$current, _tableRef$current$cle;
796
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(params, sort, filter) {
797
+ var _tableRef$current3, _tableRef$current3$cl;
646
798
 
647
799
  var current, pageSize, rest, param, key, sortArr, _key, _key2, result;
648
800
 
649
- return _regenerator.default.wrap(function _callee7$(_context7) {
801
+ return _regenerator.default.wrap(function _callee8$(_context8) {
650
802
  while (1) {
651
- switch (_context7.prev = _context7.next) {
803
+ switch (_context8.prev = _context8.next) {
652
804
  case 0:
653
805
  current = params.current, pageSize = params.pageSize, rest = (0, _objectWithoutProperties2.default)(params, _excluded);
654
806
 
655
807
  if (!(!masterObject || !masterObject[mstKeyField])) {
656
- _context7.next = 3;
808
+ _context8.next = 3;
657
809
  break;
658
810
  }
659
811
 
660
- return _context7.abrupt("return", {
812
+ return _context8.abrupt("return", {
661
813
  data: [],
662
814
  success: true
663
815
  });
@@ -703,255 +855,255 @@ function useDtl(dtlParam) {
703
855
  }
704
856
 
705
857
  setSelectedRows([]);
706
- (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$cle = _tableRef$current.clearSelected) === null || _tableRef$current$cle === void 0 ? void 0 : _tableRef$current$cle.call(_tableRef$current);
707
- _context7.t0 = beforeLoad;
858
+ (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$cl = _tableRef$current3.clearSelected) === null || _tableRef$current3$cl === void 0 ? void 0 : _tableRef$current3$cl.call(_tableRef$current3);
859
+ _context8.t0 = beforeLoad;
708
860
 
709
- if (!_context7.t0) {
710
- _context7.next = 19;
861
+ if (!_context8.t0) {
862
+ _context8.next = 19;
711
863
  break;
712
864
  }
713
865
 
714
- _context7.next = 17;
866
+ _context8.next = 17;
715
867
  return beforeLoad(param);
716
868
 
717
869
  case 17:
718
- _context7.t1 = _context7.sent;
719
- _context7.t0 = _context7.t1 === false;
870
+ _context8.t1 = _context8.sent;
871
+ _context8.t0 = _context8.t1 === false;
720
872
 
721
873
  case 19:
722
- if (!_context7.t0) {
723
- _context7.next = 21;
874
+ if (!_context8.t0) {
875
+ _context8.next = 21;
724
876
  break;
725
877
  }
726
878
 
727
- return _context7.abrupt("return", {
879
+ return _context8.abrupt("return", {
728
880
  data: [],
729
881
  success: true
730
882
  });
731
883
 
732
884
  case 21:
733
- _context7.next = 23;
885
+ _context8.next = 23;
734
886
  return dtlService.load(param);
735
887
 
736
888
  case 23:
737
- result = _context7.sent;
889
+ result = _context8.sent;
738
890
  result.data = result.rows;
739
891
  result.success = true;
740
- return _context7.abrupt("return", result);
892
+ return _context8.abrupt("return", result);
741
893
 
742
894
  case 27:
743
895
  case "end":
744
- return _context7.stop();
896
+ return _context8.stop();
745
897
  }
746
898
  }
747
- }, _callee7);
899
+ }, _callee8);
748
900
  }));
749
901
 
750
902
  return function onLoadDtl(_x3, _x4, _x5) {
751
- return _ref7.apply(this, arguments);
903
+ return _ref8.apply(this, arguments);
752
904
  };
753
905
  }();
754
906
 
755
907
  var onExportDtl = /*#__PURE__*/function () {
756
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(url, param) {
908
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(url, param) {
757
909
  var _param$exportColumns;
758
910
 
759
- var _result$flag5, result, _result$flag6, _result$flag7;
911
+ var _result$flag6, result, _result$flag7, _result$flag8;
760
912
 
761
- return _regenerator.default.wrap(function _callee8$(_context8) {
913
+ return _regenerator.default.wrap(function _callee9$(_context9) {
762
914
  while (1) {
763
- switch (_context8.prev = _context8.next) {
915
+ switch (_context9.prev = _context9.next) {
764
916
  case 0:
765
917
  if ((_param$exportColumns = param.exportColumns) === null || _param$exportColumns === void 0 ? void 0 : _param$exportColumns.length) {
766
- _context8.next = 3;
918
+ _context9.next = 3;
767
919
  break;
768
920
  }
769
921
 
770
922
  (0, _utils.showWarn)('请选择要导出的列');
771
- return _context8.abrupt("return", false);
923
+ return _context9.abrupt("return", false);
772
924
 
773
925
  case 3:
774
926
  if (param.findUrl) {
775
- _context8.next = 6;
927
+ _context9.next = 6;
776
928
  break;
777
929
  }
778
930
 
779
931
  (0, _utils.showWarn)('请配置业务接口 bizApi 属性');
780
- return _context8.abrupt("return", false);
932
+ return _context9.abrupt("return", false);
781
933
 
782
934
  case 6:
783
- _context8.prev = 6;
784
- _context8.next = 9;
935
+ _context9.prev = 6;
936
+ _context9.next = 9;
785
937
  return (0, _http.httpPost)(url, param);
786
938
 
787
939
  case 9:
788
- result = _context8.sent;
940
+ result = _context9.sent;
789
941
 
790
942
  if (!(result.data && typeof result.data === 'string')) {
791
- _context8.next = 13;
943
+ _context9.next = 13;
792
944
  break;
793
945
  }
794
946
 
795
947
  window.open(result.data);
796
- return _context8.abrupt("return", true);
948
+ return _context9.abrupt("return", true);
797
949
 
798
950
  case 13:
799
- if (!(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retCode) === '0')) {
800
- _context8.next = 18;
951
+ if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
952
+ _context9.next = 18;
801
953
  break;
802
954
  }
803
955
 
804
- (0, _utils.showSuccess)(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retMsg) || '导出成功');
805
- return _context8.abrupt("return", true);
956
+ (0, _utils.showSuccess)(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出成功');
957
+ return _context9.abrupt("return", true);
806
958
 
807
959
  case 18:
808
- (0, _utils.showError)(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出失败,请联系系统管理员');
809
- return _context8.abrupt("return", false);
960
+ (0, _utils.showError)(((_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retMsg) || '导出失败,请联系系统管理员');
961
+ return _context9.abrupt("return", false);
810
962
 
811
963
  case 20:
812
- _context8.next = 27;
964
+ _context9.next = 27;
813
965
  break;
814
966
 
815
967
  case 22:
816
- _context8.prev = 22;
817
- _context8.t0 = _context8["catch"](6);
818
- console.log(_context8.t0);
819
- (0, _utils.showError)(_context8.t0.message);
820
- return _context8.abrupt("return", false);
968
+ _context9.prev = 22;
969
+ _context9.t0 = _context9["catch"](6);
970
+ console.log(_context9.t0);
971
+ (0, _utils.showError)(_context9.t0.message);
972
+ return _context9.abrupt("return", false);
821
973
 
822
974
  case 27:
823
975
  case "end":
824
- return _context8.stop();
976
+ return _context9.stop();
825
977
  }
826
978
  }
827
- }, _callee8, null, [[6, 22]]);
979
+ }, _callee9, null, [[6, 22]]);
828
980
  }));
829
981
 
830
982
  return function onExportDtl(_x6, _x7) {
831
- return _ref8.apply(this, arguments);
983
+ return _ref9.apply(this, arguments);
832
984
  };
833
985
  }();
834
986
  /** 审核按钮事件 */
835
987
 
836
988
 
837
989
  var onAudit = /*#__PURE__*/function () {
838
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
839
- var obj, _result$flag8, result;
990
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
991
+ var obj, _result$flag9, result;
840
992
 
841
- return _regenerator.default.wrap(function _callee9$(_context9) {
993
+ return _regenerator.default.wrap(function _callee10$(_context10) {
842
994
  while (1) {
843
- switch (_context9.prev = _context9.next) {
995
+ switch (_context10.prev = _context10.next) {
844
996
  case 0:
845
997
  if (!isAudit()) {
846
- _context9.next = 3;
998
+ _context10.next = 3;
847
999
  break;
848
1000
  }
849
1001
 
850
1002
  (0, _utils.showWarn)('当前数据已审核,不能再做审核操作!');
851
- return _context9.abrupt("return");
1003
+ return _context10.abrupt("return");
852
1004
 
853
1005
  case 3:
854
1006
  obj = (0, _objectSpread2.default)({}, masterObject);
855
1007
 
856
1008
  if (masterObject[mstKeyField]) {
857
- _context9.next = 7;
1009
+ _context10.next = 7;
858
1010
  break;
859
1011
  }
860
1012
 
861
1013
  (0, _utils.showWarn)('当前数据未保存,不能审核');
862
- return _context9.abrupt("return");
1014
+ return _context10.abrupt("return");
863
1015
 
864
1016
  case 7:
865
- _context9.prev = 7;
866
- _context9.next = 10;
1017
+ _context10.prev = 7;
1018
+ _context10.next = 10;
867
1019
  return (0, _utils.showConfirm)('确认要审核此数据?', '审核提示');
868
1020
 
869
1021
  case 10:
870
- _context9.next = 16;
1022
+ _context10.next = 16;
871
1023
  break;
872
1024
 
873
1025
  case 12:
874
- _context9.prev = 12;
875
- _context9.t0 = _context9["catch"](7);
876
- console.log('终止审核', _context9.t0);
877
- return _context9.abrupt("return");
1026
+ _context10.prev = 12;
1027
+ _context10.t0 = _context10["catch"](7);
1028
+ console.log('终止审核', _context10.t0);
1029
+ return _context10.abrupt("return");
878
1030
 
879
1031
  case 16:
880
- _context9.t1 = beforeAudit;
1032
+ _context10.t1 = beforeAudit;
881
1033
 
882
- if (!_context9.t1) {
883
- _context9.next = 22;
1034
+ if (!_context10.t1) {
1035
+ _context10.next = 22;
884
1036
  break;
885
1037
  }
886
1038
 
887
- _context9.next = 20;
1039
+ _context10.next = 20;
888
1040
  return beforeAudit(obj);
889
1041
 
890
1042
  case 20:
891
- _context9.t2 = _context9.sent;
892
- _context9.t1 = _context9.t2 === false;
1043
+ _context10.t2 = _context10.sent;
1044
+ _context10.t1 = _context10.t2 === false;
893
1045
 
894
1046
  case 22:
895
- if (!_context9.t1) {
896
- _context9.next = 24;
1047
+ if (!_context10.t1) {
1048
+ _context10.next = 24;
897
1049
  break;
898
1050
  }
899
1051
 
900
- return _context9.abrupt("return");
1052
+ return _context10.abrupt("return");
901
1053
 
902
1054
  case 24:
903
- _context9.prev = 24;
904
- _context9.next = 27;
1055
+ _context10.prev = 24;
1056
+ _context10.next = 27;
905
1057
  return mstService.audit([obj]);
906
1058
 
907
1059
  case 27:
908
- result = _context9.sent;
909
- _context9.t3 = afterAudit;
1060
+ result = _context10.sent;
1061
+ _context10.t3 = afterAudit;
910
1062
 
911
- if (!_context9.t3) {
912
- _context9.next = 34;
1063
+ if (!_context10.t3) {
1064
+ _context10.next = 34;
913
1065
  break;
914
1066
  }
915
1067
 
916
- _context9.next = 32;
1068
+ _context10.next = 32;
917
1069
  return afterAudit(result, [obj]);
918
1070
 
919
1071
  case 32:
920
- _context9.t4 = _context9.sent;
921
- _context9.t3 = _context9.t4 === false;
1072
+ _context10.t4 = _context10.sent;
1073
+ _context10.t3 = _context10.t4 === false;
922
1074
 
923
1075
  case 34:
924
- if (!_context9.t3) {
925
- _context9.next = 36;
1076
+ if (!_context10.t3) {
1077
+ _context10.next = 36;
926
1078
  break;
927
1079
  }
928
1080
 
929
- return _context9.abrupt("return");
1081
+ return _context10.abrupt("return");
930
1082
 
931
1083
  case 36:
932
- if ((result === null || result === void 0 ? void 0 : (_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retCode) === '0') {
1084
+ if ((result === null || result === void 0 ? void 0 : (_result$flag9 = result.flag) === null || _result$flag9 === void 0 ? void 0 : _result$flag9.retCode) === '0') {
933
1085
  (0, _utils.showSuccess)(result.flag.retMsg || '审核成功');
934
1086
  Object.assign(masterObject, result.data);
935
1087
  }
936
1088
 
937
- _context9.next = 42;
1089
+ _context10.next = 42;
938
1090
  break;
939
1091
 
940
1092
  case 39:
941
- _context9.prev = 39;
942
- _context9.t5 = _context9["catch"](24);
943
- console.log('审核异常', _context9.t5);
1093
+ _context10.prev = 39;
1094
+ _context10.t5 = _context10["catch"](24);
1095
+ console.log('审核异常', _context10.t5);
944
1096
 
945
1097
  case 42:
946
1098
  case "end":
947
- return _context9.stop();
1099
+ return _context10.stop();
948
1100
  }
949
1101
  }
950
- }, _callee9, null, [[7, 12], [24, 39]]);
1102
+ }, _callee10, null, [[7, 12], [24, 39]]);
951
1103
  }));
952
1104
 
953
1105
  return function onAudit() {
954
- return _ref9.apply(this, arguments);
1106
+ return _ref10.apply(this, arguments);
955
1107
  };
956
1108
  }();
957
1109
 
@@ -971,25 +1123,25 @@ function useDtl(dtlParam) {
971
1123
  };
972
1124
 
973
1125
  var onExport = function onExport() {
974
- var _tableRef$current2, _tableRef$current2$sh;
1126
+ var _tableRef$current4, _tableRef$current4$sh;
975
1127
 
976
1128
  if (!masterObject[mstKeyField]) {
977
1129
  (0, _utils.showWarn)('主表没保存,无法导出数据');
978
1130
  return;
979
1131
  }
980
1132
 
981
- tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$sh = _tableRef$current2.showExport) === null || _tableRef$current2$sh === void 0 ? void 0 : _tableRef$current2$sh.call(_tableRef$current2);
1133
+ tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current4 = tableRef.current) === null || _tableRef$current4 === void 0 ? void 0 : (_tableRef$current4$sh = _tableRef$current4.showExport) === null || _tableRef$current4$sh === void 0 ? void 0 : _tableRef$current4$sh.call(_tableRef$current4);
982
1134
  };
983
1135
 
984
1136
  var onImport = function onImport() {
985
- var _tableRef$current3, _tableRef$current3$sh;
1137
+ var _tableRef$current5, _tableRef$current5$sh;
986
1138
 
987
1139
  if (!masterObject[mstKeyField]) {
988
1140
  (0, _utils.showWarn)('主表没保存,无法导入数据');
989
1141
  return;
990
1142
  }
991
1143
 
992
- tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$sh = _tableRef$current3.showImport) === null || _tableRef$current3$sh === void 0 ? void 0 : _tableRef$current3$sh.call(_tableRef$current3);
1144
+ tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current5 = tableRef.current) === null || _tableRef$current5 === void 0 ? void 0 : (_tableRef$current5$sh = _tableRef$current5.showImport) === null || _tableRef$current5$sh === void 0 ? void 0 : _tableRef$current5$sh.call(_tableRef$current5);
993
1145
  };
994
1146
 
995
1147
  var tableTools = (0, _react.useMemo)(function () {
@@ -1050,6 +1202,7 @@ function useDtl(dtlParam) {
1050
1202
  onAddDtl: onAddDtl,
1051
1203
  onEditDtl: onEditDtl,
1052
1204
  onSaveMst: onSaveMst,
1205
+ onSaveMstDtl: onSaveMstDtl,
1053
1206
  onRemoveMst: onRemoveMst,
1054
1207
  onExportDtl: onExportDtl,
1055
1208
  isAudit: isAudit,