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