@nokecy/qc-ui 1.1.9 → 1.1.10
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.
|
@@ -224,16 +224,16 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
224
224
|
* 保存列配置
|
|
225
225
|
* 将扁平化配置转换回 Grid State 并应用到 AG-Grid
|
|
226
226
|
*/
|
|
227
|
-
var handleSaveColumns = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
228
|
-
var values, flatConfig, configToSave, invalidColumns, gridColumnDefs, columnState;
|
|
229
|
-
return _regeneratorRuntime().wrap(function
|
|
230
|
-
while (1) switch (
|
|
227
|
+
var handleSaveColumns = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
228
|
+
var values, flatConfig, configToSave, invalidColumns, gridColumnDefs, columnState, filterModel, defaultScheme, newScheme;
|
|
229
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
230
|
+
while (1) switch (_context.prev = _context.next) {
|
|
231
231
|
case 0:
|
|
232
232
|
if (form) {
|
|
233
|
-
|
|
233
|
+
_context.next = 2;
|
|
234
234
|
break;
|
|
235
235
|
}
|
|
236
|
-
return
|
|
236
|
+
return _context.abrupt("return");
|
|
237
237
|
case 2:
|
|
238
238
|
values = form.values;
|
|
239
239
|
flatConfig = values.items || []; // 检查是否是旧版本数据,如果是则先迁移
|
|
@@ -257,14 +257,11 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
257
257
|
|
|
258
258
|
// 【修复】转换为 AG-Grid 的列定义,传入原始列定义以保留自定义属性
|
|
259
259
|
gridColumnDefs = (0, _columnGroupUtils.flatConfigToGridState)(configToSave, originalColumnDefs); // 【关键修复】先更新 columnDefs(处理分组结构变化)
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
// 等待 columnDefs 更新完成
|
|
263
|
-
_context2.next = 12;
|
|
260
|
+
_context.next = 11;
|
|
264
261
|
return new Promise(function (resolve) {
|
|
265
262
|
return setTimeout(resolve, 100);
|
|
266
263
|
});
|
|
267
|
-
case
|
|
264
|
+
case 11:
|
|
268
265
|
// 【修复】然后应用列状态(宽度、隐藏、顺序等)
|
|
269
266
|
columnState = (0, _columnGroupUtils.flatConfigToColumnState)(configToSave);
|
|
270
267
|
gridApi.applyColumnState({
|
|
@@ -272,113 +269,113 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
272
269
|
applyOrder: true // 强制应用列顺序
|
|
273
270
|
});
|
|
274
271
|
|
|
275
|
-
//
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
272
|
+
// 【关键修复】等待 Grid 状态更新完成后再保存到方案
|
|
273
|
+
// 使用 await 确保保存完成后再关闭弹窗,避免生产环境竞态条件
|
|
274
|
+
_context.next = 15;
|
|
275
|
+
return new Promise(function (resolve) {
|
|
276
|
+
return setTimeout(resolve, 50);
|
|
277
|
+
});
|
|
278
|
+
case 15:
|
|
279
|
+
_context.prev = 15;
|
|
280
|
+
filterModel = gridApi.getFilterModel();
|
|
281
|
+
if (!currentScheme) {
|
|
282
|
+
_context.next = 23;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
_context.next = 20;
|
|
286
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, currentScheme), {}, {
|
|
287
|
+
columnConfig: configToSave,
|
|
288
|
+
filterModel: filterModel,
|
|
289
|
+
updatedAt: Date.now()
|
|
290
|
+
}));
|
|
291
|
+
case 20:
|
|
292
|
+
_antd.message.success('列配置已保存到方案');
|
|
293
|
+
_context.next = 38;
|
|
294
|
+
break;
|
|
295
|
+
case 23:
|
|
296
|
+
// 如果没有激活的方案,自动创建默认方案
|
|
297
|
+
defaultScheme = schemes.find(function (s) {
|
|
298
|
+
return s.isDefault;
|
|
299
|
+
});
|
|
300
|
+
if (!defaultScheme) {
|
|
301
|
+
_context.next = 32;
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
_context.next = 27;
|
|
305
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, defaultScheme), {}, {
|
|
306
|
+
columnConfig: configToSave,
|
|
307
|
+
filterModel: filterModel,
|
|
308
|
+
updatedAt: Date.now()
|
|
309
|
+
}));
|
|
310
|
+
case 27:
|
|
311
|
+
_context.next = 29;
|
|
312
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, defaultScheme.id);
|
|
313
|
+
case 29:
|
|
314
|
+
_antd.message.success('列配置已保存到默认方案');
|
|
315
|
+
_context.next = 38;
|
|
316
|
+
break;
|
|
317
|
+
case 32:
|
|
318
|
+
// 创建新的默认方案并激活
|
|
319
|
+
newScheme = {
|
|
320
|
+
id: (0, _uuid.v4)(),
|
|
321
|
+
name: '默认配置',
|
|
322
|
+
description: '自动创建的默认列配置',
|
|
323
|
+
columnConfig: configToSave,
|
|
324
|
+
filterModel: filterModel,
|
|
325
|
+
isDefault: true,
|
|
326
|
+
isSystem: false,
|
|
327
|
+
createdAt: Date.now(),
|
|
328
|
+
updatedAt: Date.now()
|
|
329
|
+
};
|
|
330
|
+
_context.next = 35;
|
|
331
|
+
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, newScheme);
|
|
332
|
+
case 35:
|
|
333
|
+
_context.next = 37;
|
|
334
|
+
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, newScheme.id);
|
|
335
|
+
case 37:
|
|
336
|
+
_antd.message.success('已创建并保存到默认方案');
|
|
337
|
+
case 38:
|
|
338
|
+
_context.next = 40;
|
|
339
|
+
return new Promise(function (resolve) {
|
|
340
|
+
return setTimeout(resolve, 100);
|
|
341
|
+
});
|
|
342
|
+
case 40:
|
|
343
|
+
_context.next = 46;
|
|
344
|
+
break;
|
|
345
|
+
case 42:
|
|
346
|
+
_context.prev = 42;
|
|
347
|
+
_context.t0 = _context["catch"](15);
|
|
348
|
+
console.error('保存列配置到方案失败:', _context.t0);
|
|
349
|
+
_antd.message.error('保存列配置失败');
|
|
350
|
+
case 46:
|
|
354
351
|
// 【修复】保存成功后清除快照
|
|
355
352
|
setSnapshotColumnDefs(null);
|
|
356
353
|
|
|
357
|
-
//
|
|
354
|
+
// 【关键修复】确保在方案保存完成并传播后才关闭弹窗
|
|
358
355
|
onClose();
|
|
359
|
-
case
|
|
356
|
+
case 48:
|
|
360
357
|
case "end":
|
|
361
|
-
return
|
|
358
|
+
return _context.stop();
|
|
362
359
|
}
|
|
363
|
-
},
|
|
360
|
+
}, _callee, null, [[15, 42]]);
|
|
364
361
|
})), [form, gridApi, onSaveColumnState, onClose, saveColumnScheme, setCurrentColumnScheme, currentScheme, schemes, gridKey, originalColumnDefs]);
|
|
365
362
|
|
|
366
363
|
// 保存为新方案
|
|
367
|
-
var handleSaveScheme = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
364
|
+
var handleSaveScheme = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
368
365
|
var columnConfigToSave, values, gridColumnDefs, columnState, _values, filterModel, newScheme;
|
|
369
|
-
return _regeneratorRuntime().wrap(function
|
|
370
|
-
while (1) switch (
|
|
366
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
367
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
371
368
|
case 0:
|
|
372
369
|
if (schemeName.trim()) {
|
|
373
|
-
|
|
370
|
+
_context2.next = 3;
|
|
374
371
|
break;
|
|
375
372
|
}
|
|
376
373
|
_antd.message.warning('请输入方案名称');
|
|
377
|
-
return
|
|
374
|
+
return _context2.abrupt("return");
|
|
378
375
|
case 3:
|
|
379
|
-
|
|
376
|
+
_context2.prev = 3;
|
|
380
377
|
if (!(activeTab === 'columns' && form)) {
|
|
381
|
-
|
|
378
|
+
_context2.next = 17;
|
|
382
379
|
break;
|
|
383
380
|
}
|
|
384
381
|
values = form.values;
|
|
@@ -388,7 +385,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
388
385
|
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
389
386
|
|
|
390
387
|
// 等待 columnDefs 更新完成
|
|
391
|
-
|
|
388
|
+
_context2.next = 11;
|
|
392
389
|
return new Promise(function (resolve) {
|
|
393
390
|
return setTimeout(resolve, 100);
|
|
394
391
|
});
|
|
@@ -401,12 +398,12 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
401
398
|
});
|
|
402
399
|
|
|
403
400
|
// 等待状态更新
|
|
404
|
-
|
|
401
|
+
_context2.next = 15;
|
|
405
402
|
return new Promise(function (resolve) {
|
|
406
403
|
return setTimeout(resolve, 50);
|
|
407
404
|
});
|
|
408
405
|
case 15:
|
|
409
|
-
|
|
406
|
+
_context2.next = 19;
|
|
410
407
|
break;
|
|
411
408
|
case 17:
|
|
412
409
|
// 如果在"方案管理"标签页,使用当前表单数据
|
|
@@ -426,7 +423,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
426
423
|
createdAt: Date.now(),
|
|
427
424
|
updatedAt: Date.now()
|
|
428
425
|
};
|
|
429
|
-
|
|
426
|
+
_context2.next = 23;
|
|
430
427
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, newScheme);
|
|
431
428
|
case 23:
|
|
432
429
|
_antd.message.success('方案保存成功');
|
|
@@ -436,28 +433,28 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
436
433
|
|
|
437
434
|
// 切换到方案管理标签页,显示新创建的方案
|
|
438
435
|
setActiveTab('schemes');
|
|
439
|
-
|
|
436
|
+
_context2.next = 33;
|
|
440
437
|
break;
|
|
441
438
|
case 30:
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
_antd.message.error(
|
|
439
|
+
_context2.prev = 30;
|
|
440
|
+
_context2.t0 = _context2["catch"](3);
|
|
441
|
+
_antd.message.error(_context2.t0.message || '保存方案失败');
|
|
445
442
|
case 33:
|
|
446
443
|
case "end":
|
|
447
|
-
return
|
|
444
|
+
return _context2.stop();
|
|
448
445
|
}
|
|
449
|
-
},
|
|
446
|
+
}, _callee2, null, [[3, 30]]);
|
|
450
447
|
})), [gridApi, saveColumnScheme, gridKey, schemeName, schemeDescription, activeTab, form, originalColumnDefs]);
|
|
451
448
|
|
|
452
449
|
// 加载方案
|
|
453
450
|
var handleLoadScheme = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
454
|
-
var
|
|
451
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(schemeId) {
|
|
455
452
|
var scheme, gridColumnDefs, columnState;
|
|
456
|
-
return _regeneratorRuntime().wrap(function
|
|
457
|
-
while (1) switch (
|
|
453
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
454
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
458
455
|
case 0:
|
|
459
|
-
|
|
460
|
-
|
|
456
|
+
_context3.prev = 0;
|
|
457
|
+
_context3.next = 3;
|
|
461
458
|
return setCurrentColumnScheme === null || setCurrentColumnScheme === void 0 ? void 0 : setCurrentColumnScheme(gridKey, schemeId);
|
|
462
459
|
case 3:
|
|
463
460
|
// 应用方案到 Grid
|
|
@@ -465,7 +462,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
465
462
|
return s.id === schemeId;
|
|
466
463
|
});
|
|
467
464
|
if (!(scheme && gridApi)) {
|
|
468
|
-
|
|
465
|
+
_context3.next = 12;
|
|
469
466
|
break;
|
|
470
467
|
}
|
|
471
468
|
// 【关键修复】先更新 columnDefs(处理分组结构)
|
|
@@ -473,7 +470,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
473
470
|
gridApi.setGridOption('columnDefs', gridColumnDefs);
|
|
474
471
|
|
|
475
472
|
// 等待 columnDefs 更新完成
|
|
476
|
-
|
|
473
|
+
_context3.next = 9;
|
|
477
474
|
return new Promise(function (resolve) {
|
|
478
475
|
return setTimeout(resolve, 100);
|
|
479
476
|
});
|
|
@@ -504,73 +501,73 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
504
501
|
|
|
505
502
|
// 自动关闭弹窗,让用户看到Grid的变化
|
|
506
503
|
onClose();
|
|
507
|
-
|
|
504
|
+
_context3.next = 20;
|
|
508
505
|
break;
|
|
509
506
|
case 17:
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
_antd.message.error(
|
|
507
|
+
_context3.prev = 17;
|
|
508
|
+
_context3.t0 = _context3["catch"](0);
|
|
509
|
+
_antd.message.error(_context3.t0.message || '加载方案失败');
|
|
513
510
|
case 20:
|
|
514
511
|
case "end":
|
|
515
|
-
return
|
|
512
|
+
return _context3.stop();
|
|
516
513
|
}
|
|
517
|
-
},
|
|
514
|
+
}, _callee3, null, [[0, 17]]);
|
|
518
515
|
}));
|
|
519
516
|
return function (_x) {
|
|
520
|
-
return
|
|
517
|
+
return _ref4.apply(this, arguments);
|
|
521
518
|
};
|
|
522
519
|
}(), [setCurrentColumnScheme, gridKey, schemes, gridApi, originalColumnDefs, form, getColumnData, onClose]);
|
|
523
520
|
|
|
524
521
|
// 设置默认方案
|
|
525
522
|
var handleSetDefault = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
526
|
-
var
|
|
523
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(schemeId) {
|
|
527
524
|
var scheme, _iterator, _step, s;
|
|
528
|
-
return _regeneratorRuntime().wrap(function
|
|
529
|
-
while (1) switch (
|
|
525
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
526
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
530
527
|
case 0:
|
|
531
|
-
|
|
528
|
+
_context4.prev = 0;
|
|
532
529
|
scheme = schemes.find(function (s) {
|
|
533
530
|
return s.id === schemeId;
|
|
534
531
|
});
|
|
535
532
|
if (!scheme) {
|
|
536
|
-
|
|
533
|
+
_context4.next = 24;
|
|
537
534
|
break;
|
|
538
535
|
}
|
|
539
536
|
// 将其他方案设为非默认
|
|
540
537
|
_iterator = _createForOfIteratorHelper(schemes);
|
|
541
|
-
|
|
538
|
+
_context4.prev = 4;
|
|
542
539
|
_iterator.s();
|
|
543
540
|
case 6:
|
|
544
541
|
if ((_step = _iterator.n()).done) {
|
|
545
|
-
|
|
542
|
+
_context4.next = 13;
|
|
546
543
|
break;
|
|
547
544
|
}
|
|
548
545
|
s = _step.value;
|
|
549
546
|
if (!(s.isDefault && s.id !== schemeId)) {
|
|
550
|
-
|
|
547
|
+
_context4.next = 11;
|
|
551
548
|
break;
|
|
552
549
|
}
|
|
553
|
-
|
|
550
|
+
_context4.next = 11;
|
|
554
551
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, s), {}, {
|
|
555
552
|
isDefault: false,
|
|
556
553
|
updatedAt: Date.now()
|
|
557
554
|
}));
|
|
558
555
|
case 11:
|
|
559
|
-
|
|
556
|
+
_context4.next = 6;
|
|
560
557
|
break;
|
|
561
558
|
case 13:
|
|
562
|
-
|
|
559
|
+
_context4.next = 18;
|
|
563
560
|
break;
|
|
564
561
|
case 15:
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
_iterator.e(
|
|
562
|
+
_context4.prev = 15;
|
|
563
|
+
_context4.t0 = _context4["catch"](4);
|
|
564
|
+
_iterator.e(_context4.t0);
|
|
568
565
|
case 18:
|
|
569
|
-
|
|
566
|
+
_context4.prev = 18;
|
|
570
567
|
_iterator.f();
|
|
571
|
-
return
|
|
568
|
+
return _context4.finish(18);
|
|
572
569
|
case 21:
|
|
573
|
-
|
|
570
|
+
_context4.next = 23;
|
|
574
571
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
|
|
575
572
|
isDefault: true,
|
|
576
573
|
updatedAt: Date.now()
|
|
@@ -578,37 +575,37 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
578
575
|
case 23:
|
|
579
576
|
_antd.message.success('已设置为默认方案');
|
|
580
577
|
case 24:
|
|
581
|
-
|
|
578
|
+
_context4.next = 29;
|
|
582
579
|
break;
|
|
583
580
|
case 26:
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
_antd.message.error(
|
|
581
|
+
_context4.prev = 26;
|
|
582
|
+
_context4.t1 = _context4["catch"](0);
|
|
583
|
+
_antd.message.error(_context4.t1.message || '设置失败');
|
|
587
584
|
case 29:
|
|
588
585
|
case "end":
|
|
589
|
-
return
|
|
586
|
+
return _context4.stop();
|
|
590
587
|
}
|
|
591
|
-
},
|
|
588
|
+
}, _callee4, null, [[0, 26], [4, 15, 18, 21]]);
|
|
592
589
|
}));
|
|
593
590
|
return function (_x2) {
|
|
594
|
-
return
|
|
591
|
+
return _ref5.apply(this, arguments);
|
|
595
592
|
};
|
|
596
593
|
}(), [schemes, saveColumnScheme, gridKey]);
|
|
597
594
|
|
|
598
595
|
// 删除方案
|
|
599
596
|
var handleDeleteScheme = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
600
|
-
var
|
|
597
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(schemeId, schemeName) {
|
|
601
598
|
var _currentSchemes$gridK2, isCurrentScheme, defaultScheme;
|
|
602
|
-
return _regeneratorRuntime().wrap(function
|
|
603
|
-
while (1) switch (
|
|
599
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
600
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
604
601
|
case 0:
|
|
605
|
-
|
|
602
|
+
_context5.prev = 0;
|
|
606
603
|
// 检查是否删除的是当前方案
|
|
607
604
|
isCurrentScheme = schemeId === (currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK2 = currentSchemes[gridKey]) === null || _currentSchemes$gridK2 === void 0 ? void 0 : _currentSchemes$gridK2.columnSchemeId); // 查找默认方案
|
|
608
605
|
defaultScheme = schemes.find(function (s) {
|
|
609
606
|
return s.isDefault && s.id !== schemeId;
|
|
610
607
|
});
|
|
611
|
-
|
|
608
|
+
_context5.next = 5;
|
|
612
609
|
return deleteColumnScheme === null || deleteColumnScheme === void 0 ? void 0 : deleteColumnScheme(gridKey, schemeId);
|
|
613
610
|
case 5:
|
|
614
611
|
// 根据情况显示不同的提示消息
|
|
@@ -619,20 +616,20 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
619
616
|
} else {
|
|
620
617
|
_antd.message.success("\u65B9\u6848\"".concat(schemeName, "\"\u5DF2\u5220\u9664"));
|
|
621
618
|
}
|
|
622
|
-
|
|
619
|
+
_context5.next = 11;
|
|
623
620
|
break;
|
|
624
621
|
case 8:
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
_antd.message.error(
|
|
622
|
+
_context5.prev = 8;
|
|
623
|
+
_context5.t0 = _context5["catch"](0);
|
|
624
|
+
_antd.message.error(_context5.t0.message || '删除失败');
|
|
628
625
|
case 11:
|
|
629
626
|
case "end":
|
|
630
|
-
return
|
|
627
|
+
return _context5.stop();
|
|
631
628
|
}
|
|
632
|
-
},
|
|
629
|
+
}, _callee5, null, [[0, 8]]);
|
|
633
630
|
}));
|
|
634
631
|
return function (_x3, _x4) {
|
|
635
|
-
return
|
|
632
|
+
return _ref6.apply(this, arguments);
|
|
636
633
|
};
|
|
637
634
|
}(), [deleteColumnScheme, gridKey, schemes, currentSchemes]);
|
|
638
635
|
|
|
@@ -644,26 +641,26 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
644
641
|
}, []);
|
|
645
642
|
|
|
646
643
|
// 保存编辑
|
|
647
|
-
var handleSaveEdit = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
644
|
+
var handleSaveEdit = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
648
645
|
var scheme;
|
|
649
|
-
return _regeneratorRuntime().wrap(function
|
|
650
|
-
while (1) switch (
|
|
646
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
647
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
651
648
|
case 0:
|
|
652
649
|
if (editingId) {
|
|
653
|
-
|
|
650
|
+
_context6.next = 2;
|
|
654
651
|
break;
|
|
655
652
|
}
|
|
656
|
-
return
|
|
653
|
+
return _context6.abrupt("return");
|
|
657
654
|
case 2:
|
|
658
|
-
|
|
655
|
+
_context6.prev = 2;
|
|
659
656
|
scheme = schemes.find(function (s) {
|
|
660
657
|
return s.id === editingId;
|
|
661
658
|
});
|
|
662
659
|
if (!scheme) {
|
|
663
|
-
|
|
660
|
+
_context6.next = 9;
|
|
664
661
|
break;
|
|
665
662
|
}
|
|
666
|
-
|
|
663
|
+
_context6.next = 7;
|
|
667
664
|
return saveColumnScheme === null || saveColumnScheme === void 0 ? void 0 : saveColumnScheme(gridKey, _objectSpread(_objectSpread({}, scheme), {}, {
|
|
668
665
|
name: editingName.trim(),
|
|
669
666
|
description: editingDescription.trim() || undefined,
|
|
@@ -673,17 +670,17 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
673
670
|
_antd.message.success('更新成功');
|
|
674
671
|
setEditingId(null);
|
|
675
672
|
case 9:
|
|
676
|
-
|
|
673
|
+
_context6.next = 14;
|
|
677
674
|
break;
|
|
678
675
|
case 11:
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
_antd.message.error(
|
|
676
|
+
_context6.prev = 11;
|
|
677
|
+
_context6.t0 = _context6["catch"](2);
|
|
678
|
+
_antd.message.error(_context6.t0.message || '更新失败');
|
|
682
679
|
case 14:
|
|
683
680
|
case "end":
|
|
684
|
-
return
|
|
681
|
+
return _context6.stop();
|
|
685
682
|
}
|
|
686
|
-
},
|
|
683
|
+
}, _callee6, null, [[2, 11]]);
|
|
687
684
|
})), [schemes, saveColumnScheme, gridKey, editingId, editingName, editingDescription]);
|
|
688
685
|
|
|
689
686
|
// 筛选方案列表
|