cloud-web-corejs 1.0.311 → 1.0.313

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.
@@ -127,6 +127,7 @@ tmixins = {
127
127
  },
128
128
  beforeDestroy() {
129
129
  this.removePasteEvent();
130
+ this.revokeUploadObjectUrls();
130
131
  },
131
132
  filters: {
132
133
  btnText(btn) {
@@ -430,9 +431,14 @@ tmixins = {
430
431
  );
431
432
  }
432
433
  });
434
+ this.revokeUploadObjectUrls();
435
+ this.pasteList = [];
436
+ this.removePasteEvent();
433
437
  this.picture = "picture";
434
438
  this.clearFileInfo();
435
439
  this.dialogFormVisible = false;
440
+ const destroyRoot = this.$destroyOnDialogClose;
441
+ if (destroyRoot) this.$nextTick(destroyRoot);
436
442
  },
437
443
  clearFileInfo() {
438
444
  this.fileList = [];
@@ -992,6 +998,24 @@ tmixins = {
992
998
  return this.$commonFileUtil.getFileIconRequire(fileName);
993
999
  }
994
1000
  },
1001
+ revokeUploadObjectUrl(url) {
1002
+ if (typeof url === "string" && url.startsWith("blob:")) {
1003
+ URL.revokeObjectURL(url);
1004
+ }
1005
+ },
1006
+ revokeUploadObjectUrls() {
1007
+ const files = [
1008
+ ...(this.fileList || []),
1009
+ ...(this.pasteList || []),
1010
+ ...(this.$refs.upload?.uploadFiles || []),
1011
+ ];
1012
+ const urls = new Set();
1013
+ files.forEach((file) => {
1014
+ if (file?.showUrl) urls.add(file.showUrl);
1015
+ if (file?.url) urls.add(file.url);
1016
+ });
1017
+ urls.forEach((url) => this.revokeUploadObjectUrl(url));
1018
+ },
995
1019
  removeFile(sfile) {
996
1020
  var target = this.$refs.upload;
997
1021
  var index;
@@ -1012,6 +1036,7 @@ tmixins = {
1012
1036
  }
1013
1037
  }
1014
1038
 
1039
+ this.revokeUploadObjectUrl(sfile?.showUrl || sfile?.url);
1015
1040
  target.uploadFiles.splice(index, 1);
1016
1041
  this.handleChange(sfile, target.uploadFiles);
1017
1042
  },
@@ -1305,6 +1330,8 @@ tmixins = {
1305
1330
  this.appendPasteFiles(files);
1306
1331
  },
1307
1332
  deletePasteFile(index) {
1333
+ const file = this.pasteList[index];
1334
+ this.revokeUploadObjectUrl(file?.showUrl || file?.url);
1308
1335
  this.pasteList.splice(index, 1);
1309
1336
  },
1310
1337
  confirmPasteFile() {
@@ -1318,6 +1345,9 @@ tmixins = {
1318
1345
  return fileRaw;
1319
1346
  });
1320
1347
  innerTarget.uploadFiles(files);
1348
+ this.pasteList.forEach((file) =>
1349
+ this.revokeUploadObjectUrl(file?.showUrl || file?.url)
1350
+ );
1321
1351
  this.$nextTick(() => {
1322
1352
  target.uploadFiles.forEach((uploadFile) => {
1323
1353
  let fileRaw = uploadFile.raw;
@@ -908,6 +908,7 @@ modules = {
908
908
  a.download = fileName;
909
909
  a.href = blobUrl;
910
910
  a.click();
911
+ setTimeout(() => window.URL.revokeObjectURL(blobUrl), 0);
911
912
  },
912
913
  });
913
914
  },
@@ -930,6 +931,7 @@ modules = {
930
931
  a.download = row.fileName;
931
932
  a.href = blobUrl;
932
933
  a.click();
934
+ setTimeout(() => window.URL.revokeObjectURL(blobUrl), 0);
933
935
  },
934
936
  });
935
937
  },
@@ -413,6 +413,7 @@ modules = {
413
413
  a.download = realFileName;
414
414
  a.href = blobUrl;
415
415
  a.click();
416
+ setTimeout(() => window.URL.revokeObjectURL(blobUrl), 0);
416
417
  },
417
418
  });
418
419
  }
@@ -1418,6 +1418,7 @@ modules = {
1418
1418
  a.download = fileName;
1419
1419
  a.href = blobUrl;
1420
1420
  a.click();
1421
+ setTimeout(() => window.URL.revokeObjectURL(blobUrl), 0);
1421
1422
  },
1422
1423
  });
1423
1424
  },
@@ -1440,6 +1441,7 @@ modules = {
1440
1441
  a.download = row.fileName;
1441
1442
  a.href = blobUrl;
1442
1443
  a.click();
1444
+ setTimeout(() => window.URL.revokeObjectURL(blobUrl), 0);
1443
1445
  },
1444
1446
  });
1445
1447
  },
@@ -108,6 +108,8 @@ modules = {
108
108
  openUrl(file_data) {
109
109
  let url = this.base64ToUrl(file_data, "image/png");
110
110
  window.open(url);
111
+ // 新窗口完成 Blob URL 读取后释放;立即 revoke 可能让预览页尚未加载就失效。
112
+ setTimeout(() => URL.revokeObjectURL(url), 60000);
111
113
  },
112
114
  base64ToUrl(base64String, fileType) {
113
115
  // 将Base64字符串解码为二进制数据
@@ -13,6 +13,10 @@ const initInstance = (containter) => {
13
13
  let currentInstance = new objInstance({i18n: window.$vueRoot._i18n});
14
14
  let dom = currentInstance.$mount().$el;
15
15
  containter.appendChild(dom);
16
+ currentInstance.$destroyOnDialogClose = () => {
17
+ if (!currentInstance._isDestroyed) currentInstance.$destroy();
18
+ if (dom.parentNode) dom.parentNode.removeChild(dom);
19
+ };
16
20
  return currentInstance;
17
21
  };
18
22
 
@@ -111,6 +111,7 @@ tmixins = {
111
111
  },
112
112
  beforeDestroy() {
113
113
  this.removePasteEvent();
114
+ this.revokeUploadObjectUrls();
114
115
  },
115
116
  filters: {
116
117
  btnText(btn) {
@@ -359,9 +360,14 @@ tmixins = {
359
360
  );
360
361
  }
361
362
  });
363
+ this.revokeUploadObjectUrls();
364
+ this.pasteList = [];
365
+ this.removePasteEvent();
362
366
  this.picture = "picture";
363
367
  this.clearFileInfo();
364
368
  this.dialogFormVisible = false;
369
+ const destroyRoot = this.$destroyOnDialogClose;
370
+ if (destroyRoot) this.$nextTick(destroyRoot);
365
371
  },
366
372
  clearFileInfo() {
367
373
  this.fileList = [];
@@ -1212,6 +1218,24 @@ tmixins = {
1212
1218
  return this.$commonFileUtil.getFileIconRequire(fileName);
1213
1219
  }
1214
1220
  },
1221
+ revokeUploadObjectUrl(url) {
1222
+ if (typeof url === "string" && url.startsWith("blob:")) {
1223
+ URL.revokeObjectURL(url);
1224
+ }
1225
+ },
1226
+ revokeUploadObjectUrls() {
1227
+ const files = [
1228
+ ...(this.fileList || []),
1229
+ ...(this.pasteList || []),
1230
+ ...(this.$refs.upload?.uploadFiles || []),
1231
+ ];
1232
+ const urls = new Set();
1233
+ files.forEach((file) => {
1234
+ if (file?.showUrl) urls.add(file.showUrl);
1235
+ if (file?.url) urls.add(file.url);
1236
+ });
1237
+ urls.forEach((url) => this.revokeUploadObjectUrl(url));
1238
+ },
1215
1239
  removeFile(sfile) {
1216
1240
  var target = this.$refs.upload;
1217
1241
  var index;
@@ -1233,6 +1257,7 @@ tmixins = {
1233
1257
  }
1234
1258
  }
1235
1259
 
1260
+ this.revokeUploadObjectUrl(sfile?.showUrl || sfile?.url);
1236
1261
  target.uploadFiles.splice(index, 1);
1237
1262
  this.handleChange(sfile, target.uploadFiles);
1238
1263
  },
@@ -1444,6 +1469,8 @@ tmixins = {
1444
1469
  }
1445
1470
  },
1446
1471
  deletePasteFile(index) {
1472
+ const file = this.pasteList[index];
1473
+ this.revokeUploadObjectUrl(file?.showUrl || file?.url);
1447
1474
  this.pasteList.splice(index, 1);
1448
1475
  },
1449
1476
  confirmPasteFile() {
@@ -1457,6 +1484,9 @@ tmixins = {
1457
1484
  return fileRaw;
1458
1485
  });
1459
1486
  innerTarget.uploadFiles(files);
1487
+ this.pasteList.forEach((file) =>
1488
+ this.revokeUploadObjectUrl(file?.showUrl || file?.url)
1489
+ );
1460
1490
  this.$nextTick(() => {
1461
1491
  target.uploadFiles.forEach((uploadFile) => {
1462
1492
  let fileRaw = uploadFile.raw;
@@ -92,6 +92,12 @@ tmixins = {
92
92
  },
93
93
  beforeDestroy() {
94
94
  this.clearTimerHandle();
95
+ (this.files || []).forEach((file) => {
96
+ const url = file?.showUrl || file?.url;
97
+ if (typeof url === "string" && url.startsWith("blob:")) {
98
+ URL.revokeObjectURL(url);
99
+ }
100
+ });
95
101
  },
96
102
  methods: {
97
103
  bindMove(e) {
@@ -678,6 +684,11 @@ tmixins = {
678
684
  })
679
685
  },
680
686
  deleteFile(index) {
687
+ const file = this.files[index];
688
+ const url = file?.showUrl || file?.url;
689
+ if (typeof url === "string" && url.startsWith("blob:")) {
690
+ URL.revokeObjectURL(url);
691
+ }
681
692
  this.files.splice(index, 1);
682
693
  },
683
694
  confirmPrivateProfileDialog(rows) {
@@ -2262,6 +2262,7 @@ tmixins = {
2262
2262
  }
2263
2263
  a.download = fileName;
2264
2264
  a.click();
2265
+ setTimeout(() => URL.revokeObjectURL(url), 0);
2265
2266
 
2266
2267
  // 7. 更新进度
2267
2268
  this.progress = 100;
@@ -199,6 +199,8 @@ export default {
199
199
  imageRows: [],
200
200
  chooseIndex: -1,
201
201
  showViewer: false,
202
+ ownedBlobUrls: [],
203
+ componentDestroyed: false,
202
204
  };
203
205
  },
204
206
  watch: {
@@ -236,10 +238,24 @@ export default {
236
238
  },
237
239
 
238
240
  beforeDestroy() {
241
+ this.componentDestroyed = true;
242
+ this.revokeOwnedBlobUrls();
239
243
  this.unregisterFromRefList();
240
244
  },
241
245
  methods: {
242
246
  //begin
247
+ revokeBlobUrl(url) {
248
+ if (typeof url === "string" && url.startsWith("blob:")) {
249
+ window.URL.revokeObjectURL(url);
250
+ this.ownedBlobUrls = this.ownedBlobUrls.filter((item) => item !== url);
251
+ }
252
+ },
253
+ revokeOwnedBlobUrls() {
254
+ [...new Set(this.ownedBlobUrls)].forEach((url) =>
255
+ window.URL.revokeObjectURL(url)
256
+ );
257
+ this.ownedBlobUrls = [];
258
+ },
243
259
  closeViewer() {
244
260
  this.showViewer = false;
245
261
  },
@@ -367,6 +383,7 @@ export default {
367
383
  isLoading: true,
368
384
  callback: (res, response) => {
369
385
  if (res.code === 1000) {
386
+ this.revokeBlobUrl(attachment.showUrl || attachment.url);
370
387
  this.fieldModel.splice(index, 1);
371
388
  } else {
372
389
  this.$baseAlert(res.message);
@@ -600,6 +617,12 @@ export default {
600
617
  };
601
618
  } else {
602
619
  const blobUrl = window.URL.createObjectURL(res);
620
+ if (this.componentDestroyed) {
621
+ window.URL.revokeObjectURL(blobUrl);
622
+ return;
623
+ }
624
+ this.revokeBlobUrl(attachment.showUrl || attachment.url);
625
+ this.ownedBlobUrls.push(blobUrl);
603
626
  attachment.showUrl = blobUrl;
604
627
  attachment.url = blobUrl;
605
628
  callback && callback();
@@ -610,6 +633,7 @@ export default {
610
633
  //end
611
634
 
612
635
  setValue(val) {
636
+ this.revokeOwnedBlobUrls();
613
637
  let data = val || [];
614
638
  data.forEach((item) => {
615
639
  if (!item.hasOwnProperty("showUrl")) {
@@ -1,4 +1,5 @@
1
1
  import Vue from "vue";
2
+ import axios from "axios";
2
3
  import emitter from "../../../../components/xform/utils/emitter";
3
4
  import i18n from "../../../../components/xform/utils/i18n";
4
5
  import refMixin from "../../../../components/xform/form-render/refMixin";
@@ -205,6 +206,9 @@ modules = {
205
206
  treeKnownFormalKeyRegistry: new Set(),
206
207
  treeSingleSavePending: false,
207
208
  treeSingleSaveReconcileTask: null,
209
+ tableQuerySeq: 0,
210
+ tableQueryCancelSource: null,
211
+ tableDestroyed: false,
208
212
  // 列/网格未就绪时 setValue 只缓存数据,置此标志延后行 schema 构建
209
213
  pendingSchemaInit: false,
210
214
  };
@@ -294,9 +298,44 @@ modules = {
294
298
  });
295
299
  },
296
300
  beforeDestroy: function () {
301
+ this.tableDestroyed = true;
302
+ this.cancelActiveTableQuery("table destroyed");
303
+ this.fieldSchemaMap = {};
304
+ this.rowIdData.splice(0, this.rowIdData.length);
297
305
  this.unregisterFromRefList();
298
306
  },
299
307
  methods: {
308
+ /** @param {String} reason 取消原因。取消当前普通查询并使旧响应失效。 */
309
+ cancelActiveTableQuery(reason = "query cancelled") {
310
+ this.tableQuerySeq += 1;
311
+ if (this.tableQueryCancelSource) {
312
+ this.tableQueryCancelSource.cancel(reason);
313
+ this.tableQueryCancelSource = null;
314
+ }
315
+ },
316
+ /** @returns {Object} 本次普通查询上下文;导出查询不走此通道。 */
317
+ startTableQuery() {
318
+ this.cancelActiveTableQuery("superseded by a newer query");
319
+ const context = {
320
+ seq: this.tableQuerySeq,
321
+ source: axios.CancelToken.source(),
322
+ };
323
+ this.tableQueryCancelSource = context.source;
324
+ return context;
325
+ },
326
+ /** @param {Object} context 查询上下文。@returns {Boolean} 是否仍是当前有效查询。 */
327
+ isCurrentTableQuery(context) {
328
+ return !!context
329
+ && !this.tableDestroyed
330
+ && context.seq === this.tableQuerySeq
331
+ && context.source === this.tableQueryCancelSource;
332
+ },
333
+ /** @param {Object} context 查询上下文。释放已完成查询的取消句柄。 */
334
+ finishTableQuery(context) {
335
+ if (context && context.source === this.tableQueryCancelSource) {
336
+ this.tableQueryCancelSource = null;
337
+ }
338
+ },
300
339
  /*
301
340
  * 数据约定:
302
341
  * 1. formModel[fieldKeyName] 是提交与校验使用的表单数据;fieldModel 是 vxe-grid 的绑定数据。
@@ -656,6 +695,83 @@ modules = {
656
695
  let key = name + "_" + keyVal;
657
696
  return key;
658
697
  },
698
+ /**
699
+ * 查询整体替换后清理仍挂在表单 refList 中的旧行引用。
700
+ * 正常情况下字段组件会在 beforeDestroy 自行注销;这里仅处理异常残留。
701
+ * @param {Array<String>} previousRowKeys 查询前的行键。
702
+ * @param {Array<Object>} currentRows 查询后的行数据。
703
+ */
704
+ pruneStaleRowRefs(previousRowKeys, currentRows) {
705
+ const validKeys = new Set(
706
+ (currentRows || []).map((row) => row?._X_ROW_KEY).filter(Boolean)
707
+ );
708
+ const staleKeys = (previousRowKeys || []).filter(
709
+ (rowKey) => rowKey && !validKeys.has(rowKey)
710
+ );
711
+ if (!staleKeys.length) return;
712
+ const staleKeySet = new Set(staleKeys);
713
+
714
+ const names = new Set(
715
+ (this.rowWidgetList || [])
716
+ .map((widget) => widget?.options?.name)
717
+ .filter(Boolean)
718
+ );
719
+
720
+ const cleanupStaleRefs = () => {
721
+ if (this.tableDestroyed || !this.refList || !names.size) return;
722
+ let removedCount = 0;
723
+ Object.keys(this.refList).forEach((refKey) => {
724
+ const target = this.refList[refKey];
725
+ const targetRowKey = target?.tableParam?.row?._X_ROW_KEY;
726
+ if (!targetRowKey || !staleKeySet.has(targetRowKey)) return;
727
+ const targetWidget = target.field || target.widget;
728
+ const targetName = targetWidget?.options?.name;
729
+ if (!targetName || !names.has(targetName)) return;
730
+ delete this.refList[refKey];
731
+ removedCount += 1;
732
+ });
733
+ if (removedCount && process.env.NODE_ENV !== "production") {
734
+ console.warn(
735
+ `[data-table] 已清理 ${removedCount} 个查询后残留的行组件引用`
736
+ );
737
+ }
738
+ };
739
+ const compactFieldSchemaMap = () => {
740
+ if (this.tableDestroyed) return;
741
+ const liveKeys = new Set(this.rowIdData || []);
742
+ const currentMap = this.fieldSchemaMap || {};
743
+ const nextMap = {};
744
+ let changed = false;
745
+ Object.keys(currentMap).forEach((rowKey) => {
746
+ if (liveKeys.has(rowKey)) {
747
+ nextMap[rowKey] = currentMap[rowKey];
748
+ } else {
749
+ changed = true;
750
+ }
751
+ });
752
+ // 一次替换只触发一次响应更新,避免逐行 $delete 导致多轮重渲染。
753
+ if (changed) this.fieldSchemaMap = nextMap;
754
+ };
755
+ this.$nextTick(() => {
756
+ cleanupStaleRefs();
757
+ // 查询 Promise resolve 后 VXE 才会提交新数据。旧行在这一小段卸载窗口内
758
+ // 仍可能触发 render,并通过 getRowFieldSchema 把刚清空的 schema 懒建回来。
759
+ // 下一宏任务按实际存活行键整体压缩一次;不再重复扫描 ref。
760
+ setTimeout(compactFieldSchemaMap, 0);
761
+ });
762
+ },
763
+ /** @param {String} rowKey 行键。释放该行 schema。 */
764
+ releaseRowRuntime(rowKey) {
765
+ if (!rowKey) return;
766
+ if (this.fieldSchemaMap[rowKey]) {
767
+ this.$delete(this.fieldSchemaMap, rowKey);
768
+ }
769
+ },
770
+ /** @param {Iterable<String>} rowKeys 行键集合。批量释放行运行时状态。 */
771
+ releaseRowsRuntime(rowKeys) {
772
+ if (!rowKeys) return;
773
+ Array.from(rowKeys).forEach((rowKey) => this.releaseRowRuntime(rowKey));
774
+ },
659
775
  /** @param {Number} index 扁平数据行索引。@param {String} name 组件名。@returns {Object} 行组件 schema。 */
660
776
  getWidgetByTableRow(index, name) {
661
777
  // let target = this.getWidgetRefByTableRow(index, name)
@@ -2842,6 +2958,17 @@ modules = {
2842
2958
  let reqPath = typeof path === "function" ? path() : path;
2843
2959
  let accessReturnType =
2844
2960
  this.widget.options.accessReturnType || "2";
2961
+ const isExportQuery = !!customParam?.export;
2962
+ const queryContext = isExportQuery ? null : this.startTableQuery();
2963
+ if (queryContext) {
2964
+ customParam = {
2965
+ ...(customParam || {}),
2966
+ config: {
2967
+ ...(customParam?.config || {}),
2968
+ cancelToken: queryContext.source.token,
2969
+ },
2970
+ };
2971
+ }
2845
2972
 
2846
2973
  return new Promise((resolve, reject) => {
2847
2974
  if (scriptCode) {
@@ -2849,8 +2976,17 @@ modules = {
2849
2976
  let reqData = buildReqData();
2850
2977
  // let f = new Function("dataId", "formCode", "param", "done", accessScript);
2851
2978
  let done = (res) => {
2979
+ if (
2980
+ queryContext
2981
+ && !this.isCurrentTableQuery(queryContext)
2982
+ ) {
2983
+ reject(new axios.Cancel("stale table query response"));
2984
+ return;
2985
+ }
2852
2986
  // this.clearRowWidgets();
2853
2987
 
2988
+ const previousRowKeys = this.rowIdData.slice();
2989
+
2854
2990
  let items = this.handleTreeData(
2855
2991
  res.objx?.records || res.objx || []
2856
2992
  );
@@ -2875,8 +3011,10 @@ modules = {
2875
3011
  } else {
2876
3012
  res.objx = rows;
2877
3013
  }
3014
+ this.pruneStaleRowRefs(previousRowKeys, rows);
2878
3015
  }
2879
3016
 
3017
+ this.finishTableQuery(queryContext);
2880
3018
  resolve(res);
2881
3019
  if (that.shouldEmitQueryLoaded(res, customParam)) {
2882
3020
  if (that.widget.options.isTreeTable) {
@@ -2904,6 +3042,12 @@ modules = {
2904
3042
  if (expandAll && expandRows.length) {
2905
3043
  that.$nextTick(() => {
2906
3044
  setTimeout(function () {
3045
+ if (
3046
+ that.tableDestroyed ||
3047
+ queryContext?.seq !== that.tableQuerySeq
3048
+ ) {
3049
+ return;
3050
+ }
2907
3051
  $grid.treeConfig.lazy = false;
2908
3052
  $grid.setTreeExpand(expandRows, true);
2909
3053
  expandRows.forEach((lineData) => {
@@ -2937,6 +3081,12 @@ modules = {
2937
3081
  if (row[hasChild]) {
2938
3082
  that.$nextTick(() => {
2939
3083
  setTimeout(function () {
3084
+ if (
3085
+ that.tableDestroyed ||
3086
+ queryContext?.seq !== that.tableQuerySeq
3087
+ ) {
3088
+ return;
3089
+ }
2940
3090
  $grid.setTreeExpand(row, true);
2941
3091
  }, 0);
2942
3092
  });
@@ -2944,13 +3094,26 @@ modules = {
2944
3094
  }
2945
3095
  }
2946
3096
  }
2947
- that.emitTableDataLoaded(rows, tableOption);
3097
+ that.emitTableDataLoaded(
3098
+ rows,
3099
+ tableOption,
3100
+ queryContext?.seq
3101
+ );
2948
3102
  }
2949
3103
  };
2950
- this.loadDefaultQueryList(reqData, done, customParam);
3104
+ const requestTask = this.loadDefaultQueryList(
3105
+ reqData,
3106
+ done,
3107
+ customParam
3108
+ );
3109
+ Promise.resolve(requestTask).catch((error) => {
3110
+ this.finishTableQuery(queryContext);
3111
+ reject(error);
3112
+ });
2951
3113
  };
2952
3114
  this.runAfterTableFormReady($grid, toDo);
2953
3115
  } else {
3116
+ this.finishTableQuery(queryContext);
2954
3117
  resolve();
2955
3118
  }
2956
3119
  });
@@ -3276,6 +3439,7 @@ modules = {
3276
3439
  * @param {Object} option 本次查询的覆盖配置。
3277
3440
  */
3278
3441
  loadDefaultViewList(option) {
3442
+ const queryContext = this.startTableQuery();
3279
3443
  let dataId = this.formDataId;
3280
3444
  let reportTemplate = this.getFormRef().reportTemplate;
3281
3445
  let formCode = reportTemplate.formCode;
@@ -3290,9 +3454,10 @@ modules = {
3290
3454
  otherParam.thirdtabm = thirdtabm;
3291
3455
  }
3292
3456
  let scriptCode = this.getScriptCode();
3293
- return this.formHttp({
3457
+ const requestTask = this.formHttp({
3294
3458
  /*url: "/" + reportTemplate.serviceName + "/form_ins/getList",*/
3295
3459
  scriptCode: scriptCode,
3460
+ cancelToken: queryContext.source.token,
3296
3461
  data: {
3297
3462
  formCode: formCode,
3298
3463
  formVersion: reportTemplate.formVersion,
@@ -3304,6 +3469,7 @@ modules = {
3304
3469
  },
3305
3470
  },
3306
3471
  callback: (res) => {
3472
+ if (!this.isCurrentTableQuery(queryContext)) return;
3307
3473
  let $grid = this.getGridTable();
3308
3474
  // let rows = res.objx ? res.objx.records || res.objx || [] : [];
3309
3475
 
@@ -3318,7 +3484,10 @@ modules = {
3318
3484
  // that.handleNullValue(rows);
3319
3485
  rows = this.normalizeTableRows(rows, false);
3320
3486
  this.initValue(rows);
3487
+ const querySeq = queryContext.seq;
3488
+ this.finishTableQuery(queryContext);
3321
3489
  this.$nextTick(() => {
3490
+ if (this.tableDestroyed || querySeq !== this.tableQuerySeq) return;
3322
3491
  /*if (this.widget.options.isTreeTable) {
3323
3492
  let $grid = this.getGridTable();
3324
3493
  $grid.treeConfig.lazy = false;
@@ -3334,6 +3503,10 @@ modules = {
3334
3503
  });
3335
3504
  },
3336
3505
  });
3506
+ return Promise.resolve(requestTask).catch((error) => {
3507
+ this.finishTableQuery(queryContext);
3508
+ throw error;
3509
+ });
3337
3510
  },
3338
3511
  /** @returns {Object} 当前表格脚本访问参数。 */
3339
3512
  getAccessParam() {
@@ -3384,10 +3557,17 @@ modules = {
3384
3557
  * 是否该派发由 shouldEmitQueryLoaded 判定,这里只负责发。
3385
3558
  * @param {Array} rows 本次加载的行。
3386
3559
  * @param {Object} tableOption 表格配置(callback 挂在它上面)。
3560
+ * @param {Number} querySeq 普通查询代次;延迟回调执行前再次核验。
3387
3561
  */
3388
- emitTableDataLoaded(rows, tableOption) {
3562
+ emitTableDataLoaded(rows, tableOption, querySeq) {
3389
3563
  this.$nextTick(() => {
3390
3564
  setTimeout(() => {
3565
+ if (
3566
+ this.tableDestroyed
3567
+ || (querySeq != null && querySeq !== this.tableQuerySeq)
3568
+ ) {
3569
+ return;
3570
+ }
3391
3571
  let dataTableConfig = this.dataTableConfig || {};
3392
3572
  dataTableConfig.callback && dataTableConfig.callback(rows);
3393
3573
  tableOption && tableOption.callback && tableOption.callback(rows);
@@ -3519,7 +3699,11 @@ modules = {
3519
3699
 
3520
3700
  let scriptCode = this.getScriptCode();
3521
3701
  if (scriptCode) {
3522
- this.loadDefaultViewList();
3702
+ this.loadDefaultViewList().catch((error) => {
3703
+ if (!axios.isCancel(error) && !this.tableDestroyed) {
3704
+ console.error("[data-table] default view query failed", error);
3705
+ }
3706
+ });
3523
3707
  }
3524
3708
  },
3525
3709
  /** @param {Object} item 参数配置。@param {*} dataId 主数据 id。@param {Object} billData 单据数据。@returns {Object} */
@@ -3679,7 +3863,7 @@ modules = {
3679
3863
  this.removeTreeRow({ row });
3680
3864
  return;
3681
3865
  }
3682
- delete this.fieldSchemaMap[row._X_ROW_KEY];
3866
+ this.releaseRowRuntime(row._X_ROW_KEY);
3683
3867
  let $grid = this.getGridTable();
3684
3868
  $grid.remove(row);
3685
3869
  let tableData = $grid.getTableData();
@@ -3687,6 +3871,7 @@ modules = {
3687
3871
  let fullData = !isEditTable ? tableData.fullData : tableData.tableData;
3688
3872
  this.formModel[this.fieldKeyName] = fullData;
3689
3873
  this.fieldModel = fullData;
3874
+ this.initRowIdData();
3690
3875
  this.$nextTick(() => {
3691
3876
  this.handleWbs();
3692
3877
  });
@@ -5219,6 +5404,7 @@ modules = {
5219
5404
  }
5220
5405
  });
5221
5406
  }
5407
+ this.releaseRowsRuntime(delKeys);
5222
5408
  let newRows = tableRows.filter((item) => !delKeys.has(item._X_ROW_KEY));
5223
5409
  this.setValue(this.stripTreeContainerRows(newRows));
5224
5410
  this.$nextTick(() => {
@@ -5577,6 +5763,7 @@ modules = {
5577
5763
  let row = obj.row;
5578
5764
  let $grid = this.getGridTable();
5579
5765
  await $grid.remove(row);
5766
+ this.releaseRowRuntime(row?._X_ROW_KEY);
5580
5767
  if (this.widget.options.isTreeTable) {
5581
5768
  let { rowField } = this.getTreeFields($grid);
5582
5769
  this.unregisterTreeKey(
@@ -5972,6 +6159,12 @@ modules = {
5972
6159
 
5973
6160
  let rowIdData = this.rowIdData;
5974
6161
  let rowLength = this.rowIdData.length;
6162
+ // 查询/赋值结果为空时也必须释放上一次的行级 schema。原逻辑只在
6163
+ // rowLength > 0 时重建,导致空结果页面仍常驻上一批数据的全部 schema。
6164
+ if (rowLength === 0) {
6165
+ this.fieldSchemaMap = {};
6166
+ return;
6167
+ }
5975
6168
  // this.fieldSchemaData.splice(0, this.fieldSchemaData.length) //清除数组必须用splice,length=0不会响应式更新!!
5976
6169
  // if(initFlag)this.fieldSchemaMap = {};
5977
6170
  if (rowLength > 0) {