cloud-web-corejs 1.1.0-dev.44 → 1.1.0-dev.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app-bootstrap.js +6 -5
- package/src/components/Qrcode/fileParse.vue +11 -0
- package/src/components/VabUpload/index.js +11 -4
- package/src/components/VabUpload/mixins/fileLibraryDialog.js +2 -0
- package/src/components/VabUpload/mixins.js +72 -40
- package/src/components/VabUpload/partUploadConfig.js +95 -0
- package/src/components/VabUpload/privateProfileDialogMixins.js +2 -0
- package/src/components/baseInputExport/mixins.js +1 -0
- package/src/components/fileLibrary/mixins/indexMixins.js +2 -0
- package/src/components/jdPrint/mixins.js +2 -0
- package/src/components/obsUpload/index.js +4 -1
- package/src/components/obsUpload/mixins.js +45 -15
- package/src/components/onlineTalk/mixins.js +11 -0
- package/src/components/table/index.js +74 -78
- package/src/components/xform/docs/2026-09 /346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206P0/344/273/243/347/240/201/350/257/204/345/256/241.md" +255 -0
- package/src/components/xform/docs/2026-09 /346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206P0/346/265/213/350/257/225/351/252/214/350/257/201/345/256/236/346/226/275/346/226/207/346/241/243.md" +595 -0
- package/src/components/xform/docs//346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206/344/270/216/344/277/256/345/244/215/350/220/275/345/234/260/346/226/271/346/241/210.md +324 -0
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1 -0
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +24 -0
- package/src/components/xform/form-render/container-item/data-table-mixin.js +413 -41
- package/src/components/xform/form-render/container-item/list-h5-item.vue +109 -38
- package/src/components/xform/styles/h5-designer.scss +13 -13
- package/src/components/xform/styles/h5-runtime.scss +520 -0
- package/src/components/xform/styles/h5.scss +5 -2
- package/src/layout/components/TagsView/index.vue +6 -1
- package/src/layout/components/TagsView/style.scss +92 -0
- package/src/styles/btn.scss +214 -3
- package/src/styles/dialog.scss +1710 -0
- package/src/styles/element-ui.scss +957 -36
- package/src/styles/index.scss +45 -0
- package/src/styles/layout-skins.scss +840 -0
- package/src/styles/mixin.scss +8 -0
- package/src/styles/page-shell.scss +622 -0
- package/src/styles/sidebar.scss +15 -0
- package/src/styles/utilities.scss +234 -118
- package/src/styles/variables.scss +28 -0
- package/src/views/user/home/wjl/content.vue +1576 -0
- package/src/views/user/intf_permission/edit.vue +230 -0
- package/src/views/user/intf_permission/list.vue +196 -0
|
@@ -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";
|
|
@@ -96,6 +97,9 @@ const MAX_SCHEMA_INIT_RETRY = 50;
|
|
|
96
97
|
*/
|
|
97
98
|
const LAZY_ROW_SCHEMA_THRESHOLD = 1000;
|
|
98
99
|
|
|
100
|
+
/** 自动保存最多允许同时排队的行数;同一行的连续修改会合并。 */
|
|
101
|
+
const MAX_EDIT_AUTO_SAVE_PENDING_ROWS = 20;
|
|
102
|
+
|
|
99
103
|
let modules = {};
|
|
100
104
|
const baseRefUtil = {
|
|
101
105
|
emitter,
|
|
@@ -211,7 +215,15 @@ modules = {
|
|
|
211
215
|
treeSingleSavePending: false,
|
|
212
216
|
treeSingleSaveReconcileTask: null,
|
|
213
217
|
editAutoSaveTimers: {},
|
|
214
|
-
|
|
218
|
+
editAutoSaveGeneration: 0,
|
|
219
|
+
editAutoSavePendingRows: Object.create(null),
|
|
220
|
+
editAutoSaveOrder: [],
|
|
221
|
+
editAutoSaveWorkerRunning: false,
|
|
222
|
+
editAutoSaveCancelSource: null,
|
|
223
|
+
editAutoSaveActiveRowKey: null,
|
|
224
|
+
tableQuerySeq: 0,
|
|
225
|
+
tableQueryCancelSource: null,
|
|
226
|
+
tableDestroyed: false,
|
|
215
227
|
// 列/网格未就绪时 setValue 只缓存数据,置此标志延后行 schema 构建
|
|
216
228
|
pendingSchemaInit: false,
|
|
217
229
|
};
|
|
@@ -314,13 +326,56 @@ modules = {
|
|
|
314
326
|
});
|
|
315
327
|
},
|
|
316
328
|
beforeDestroy: function () {
|
|
329
|
+
this.tableDestroyed = true;
|
|
330
|
+
this.cancelActiveTableQuery("table destroyed");
|
|
331
|
+
this.editAutoSaveGeneration += 1;
|
|
332
|
+
if (this.editAutoSaveCancelSource) {
|
|
333
|
+
this.editAutoSaveCancelSource.cancel("table destroyed");
|
|
334
|
+
this.editAutoSaveCancelSource = null;
|
|
335
|
+
}
|
|
336
|
+
this.editAutoSaveActiveRowKey = null;
|
|
317
337
|
Object.values(this.editAutoSaveTimers || {}).forEach((timer) => {
|
|
318
338
|
clearTimeout(timer);
|
|
319
339
|
});
|
|
320
340
|
this.editAutoSaveTimers = {};
|
|
341
|
+
this.editAutoSavePendingRows = Object.create(null);
|
|
342
|
+
this.editAutoSaveOrder = [];
|
|
343
|
+
this.fieldSchemaMap = {};
|
|
344
|
+
this.rowIdData.splice(0, this.rowIdData.length);
|
|
321
345
|
this.unregisterFromRefList();
|
|
322
346
|
},
|
|
323
347
|
methods: {
|
|
348
|
+
/** @param {String} reason 取消原因。取消当前普通查询并使旧响应失效。 */
|
|
349
|
+
cancelActiveTableQuery(reason = "query cancelled") {
|
|
350
|
+
this.tableQuerySeq += 1;
|
|
351
|
+
if (this.tableQueryCancelSource) {
|
|
352
|
+
this.tableQueryCancelSource.cancel(reason);
|
|
353
|
+
this.tableQueryCancelSource = null;
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
/** @returns {Object} 本次普通查询上下文;导出查询不走此通道。 */
|
|
357
|
+
startTableQuery() {
|
|
358
|
+
this.cancelActiveTableQuery("superseded by a newer query");
|
|
359
|
+
const context = {
|
|
360
|
+
seq: this.tableQuerySeq,
|
|
361
|
+
source: axios.CancelToken.source(),
|
|
362
|
+
};
|
|
363
|
+
this.tableQueryCancelSource = context.source;
|
|
364
|
+
return context;
|
|
365
|
+
},
|
|
366
|
+
/** @param {Object} context 查询上下文。@returns {Boolean} 是否仍是当前有效查询。 */
|
|
367
|
+
isCurrentTableQuery(context) {
|
|
368
|
+
return !!context
|
|
369
|
+
&& !this.tableDestroyed
|
|
370
|
+
&& context.seq === this.tableQuerySeq
|
|
371
|
+
&& context.source === this.tableQueryCancelSource;
|
|
372
|
+
},
|
|
373
|
+
/** @param {Object} context 查询上下文。释放已完成查询的取消句柄。 */
|
|
374
|
+
finishTableQuery(context) {
|
|
375
|
+
if (context && context.source === this.tableQueryCancelSource) {
|
|
376
|
+
this.tableQueryCancelSource = null;
|
|
377
|
+
}
|
|
378
|
+
},
|
|
324
379
|
/*
|
|
325
380
|
* 数据约定:
|
|
326
381
|
* 1. formModel[fieldKeyName] 是提交与校验使用的表单数据;fieldModel 是 vxe-grid 的绑定数据。
|
|
@@ -680,6 +735,102 @@ modules = {
|
|
|
680
735
|
let key = name + "_" + keyVal;
|
|
681
736
|
return key;
|
|
682
737
|
},
|
|
738
|
+
/**
|
|
739
|
+
* 查询整体替换后清理仍挂在表单 refList 中的旧行引用。
|
|
740
|
+
* 正常情况下字段组件会在 beforeDestroy 自行注销;这里仅处理异常残留。
|
|
741
|
+
* @param {Array<String>} previousRowKeys 查询前的行键。
|
|
742
|
+
* @param {Array<Object>} currentRows 查询后的行数据。
|
|
743
|
+
*/
|
|
744
|
+
pruneStaleRowRefs(previousRowKeys, currentRows) {
|
|
745
|
+
const validKeys = new Set(
|
|
746
|
+
(currentRows || []).map((row) => row?._X_ROW_KEY).filter(Boolean)
|
|
747
|
+
);
|
|
748
|
+
const staleKeys = (previousRowKeys || []).filter(
|
|
749
|
+
(rowKey) => rowKey && !validKeys.has(rowKey)
|
|
750
|
+
);
|
|
751
|
+
if (!staleKeys.length) return;
|
|
752
|
+
const staleKeySet = new Set(staleKeys);
|
|
753
|
+
|
|
754
|
+
const names = new Set(
|
|
755
|
+
(this.rowWidgetList || [])
|
|
756
|
+
.map((widget) => widget?.options?.name)
|
|
757
|
+
.filter(Boolean)
|
|
758
|
+
);
|
|
759
|
+
|
|
760
|
+
const cleanupStaleRefs = () => {
|
|
761
|
+
if (this.tableDestroyed || !this.refList || !names.size) return;
|
|
762
|
+
let removedCount = 0;
|
|
763
|
+
Object.keys(this.refList).forEach((refKey) => {
|
|
764
|
+
const target = this.refList[refKey];
|
|
765
|
+
const targetRowKey = target?.tableParam?.row?._X_ROW_KEY;
|
|
766
|
+
if (!targetRowKey || !staleKeySet.has(targetRowKey)) return;
|
|
767
|
+
const targetWidget = target.field || target.widget;
|
|
768
|
+
const targetName = targetWidget?.options?.name;
|
|
769
|
+
if (!targetName || !names.has(targetName)) return;
|
|
770
|
+
delete this.refList[refKey];
|
|
771
|
+
removedCount += 1;
|
|
772
|
+
});
|
|
773
|
+
if (removedCount && process.env.NODE_ENV !== "production") {
|
|
774
|
+
console.warn(
|
|
775
|
+
`[data-table] 已清理 ${removedCount} 个查询后残留的行组件引用`
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
const compactFieldSchemaMap = () => {
|
|
780
|
+
if (this.tableDestroyed) return;
|
|
781
|
+
const liveKeys = new Set(this.rowIdData || []);
|
|
782
|
+
const currentMap = this.fieldSchemaMap || {};
|
|
783
|
+
const nextMap = {};
|
|
784
|
+
let changed = false;
|
|
785
|
+
Object.keys(currentMap).forEach((rowKey) => {
|
|
786
|
+
if (liveKeys.has(rowKey)) {
|
|
787
|
+
nextMap[rowKey] = currentMap[rowKey];
|
|
788
|
+
} else {
|
|
789
|
+
changed = true;
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
// 一次替换只触发一次响应更新,避免逐行 $delete 导致多轮重渲染。
|
|
793
|
+
if (changed) this.fieldSchemaMap = nextMap;
|
|
794
|
+
};
|
|
795
|
+
this.$nextTick(() => {
|
|
796
|
+
cleanupStaleRefs();
|
|
797
|
+
// 查询 Promise resolve 后 VXE 才会提交新数据。旧行在这一小段卸载窗口内
|
|
798
|
+
// 仍可能触发 render,并通过 getRowFieldSchema 把刚清空的 schema 懒建回来。
|
|
799
|
+
// 下一宏任务按实际存活行键整体压缩一次;不再重复扫描 ref。
|
|
800
|
+
setTimeout(compactFieldSchemaMap, 0);
|
|
801
|
+
});
|
|
802
|
+
},
|
|
803
|
+
/** @param {String} rowKey 行键。释放该行的 schema 与自动保存任务。 */
|
|
804
|
+
releaseRowRuntime(rowKey) {
|
|
805
|
+
if (!rowKey) return;
|
|
806
|
+
if (this.fieldSchemaMap[rowKey]) {
|
|
807
|
+
this.$delete(this.fieldSchemaMap, rowKey);
|
|
808
|
+
}
|
|
809
|
+
if (this.editAutoSaveTimers[rowKey]) {
|
|
810
|
+
clearTimeout(this.editAutoSaveTimers[rowKey]);
|
|
811
|
+
delete this.editAutoSaveTimers[rowKey];
|
|
812
|
+
}
|
|
813
|
+
const pendingEntry = this.editAutoSavePendingRows[rowKey];
|
|
814
|
+
if (pendingEntry) {
|
|
815
|
+
pendingEntry.cancelled = true;
|
|
816
|
+
delete this.editAutoSavePendingRows[rowKey];
|
|
817
|
+
}
|
|
818
|
+
this.editAutoSaveOrder = this.editAutoSaveOrder.filter(
|
|
819
|
+
(pendingRowKey) => pendingRowKey !== rowKey
|
|
820
|
+
);
|
|
821
|
+
if (
|
|
822
|
+
this.editAutoSaveActiveRowKey === rowKey
|
|
823
|
+
&& this.editAutoSaveCancelSource
|
|
824
|
+
) {
|
|
825
|
+
this.editAutoSaveCancelSource.cancel("table row removed");
|
|
826
|
+
this.editAutoSaveCancelSource = null;
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
/** @param {Iterable<String>} rowKeys 行键集合。批量释放行运行时状态。 */
|
|
830
|
+
releaseRowsRuntime(rowKeys) {
|
|
831
|
+
if (!rowKeys) return;
|
|
832
|
+
Array.from(rowKeys).forEach((rowKey) => this.releaseRowRuntime(rowKey));
|
|
833
|
+
},
|
|
683
834
|
/** @param {Number} index 扁平数据行索引。@param {String} name 组件名。@returns {Object} 行组件 schema。 */
|
|
684
835
|
getWidgetByTableRow(index, name) {
|
|
685
836
|
// let target = this.getWidgetRefByTableRow(index, name)
|
|
@@ -1162,11 +1313,19 @@ modules = {
|
|
|
1162
1313
|
/**
|
|
1163
1314
|
* @param {Object} $table VXE Table 实例。
|
|
1164
1315
|
* @param {Array<Object>} rows 本次粘贴实际修改的行。
|
|
1165
|
-
* @description
|
|
1316
|
+
* @description 粘贴保存也进入统一 worker,和失焦/变更保存共享串行与合并规则。
|
|
1166
1317
|
*/
|
|
1167
1318
|
async autoSaveClipboardRows($table, rows) {
|
|
1319
|
+
const generation = this.editAutoSaveGeneration;
|
|
1168
1320
|
const savedKeys = new Set();
|
|
1321
|
+
let allQueued = true;
|
|
1169
1322
|
for (const sourceRow of rows || []) {
|
|
1323
|
+
if (
|
|
1324
|
+
this.tableDestroyed
|
|
1325
|
+
|| generation !== this.editAutoSaveGeneration
|
|
1326
|
+
) {
|
|
1327
|
+
return false;
|
|
1328
|
+
}
|
|
1170
1329
|
const rowKey = sourceRow?._X_ROW_KEY;
|
|
1171
1330
|
if (rowKey && savedKeys.has(rowKey)) continue;
|
|
1172
1331
|
if (rowKey) savedKeys.add(rowKey);
|
|
@@ -1174,11 +1333,11 @@ modules = {
|
|
|
1174
1333
|
const row = rowKey
|
|
1175
1334
|
? formRows.find((item) => item?._X_ROW_KEY === rowKey) || sourceRow
|
|
1176
1335
|
: sourceRow;
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
);
|
|
1336
|
+
if (!this.enqueueEditRowAutoSave({ row, $table })) {
|
|
1337
|
+
allQueued = false;
|
|
1338
|
+
}
|
|
1181
1339
|
}
|
|
1340
|
+
return allQueued;
|
|
1182
1341
|
},
|
|
1183
1342
|
/** @returns {Boolean} 是否开启编辑表格自动保存,兼容早期粘贴专用配置名。 */
|
|
1184
1343
|
isTableAutoSaveEnabled() {
|
|
@@ -1227,27 +1386,145 @@ modules = {
|
|
|
1227
1386
|
clearTimeout(this.editAutoSaveTimers[rowKey]);
|
|
1228
1387
|
this.editAutoSaveTimers[rowKey] = setTimeout(() => {
|
|
1229
1388
|
delete this.editAutoSaveTimers[rowKey];
|
|
1230
|
-
|
|
1231
|
-
const rows = this.formModel[this.fieldKeyName] || [];
|
|
1232
|
-
const currentRow = obj.row._X_ROW_KEY
|
|
1233
|
-
? rows.find((row) => row?._X_ROW_KEY === obj.row._X_ROW_KEY)
|
|
1234
|
-
|| obj.row
|
|
1235
|
-
: obj.row;
|
|
1236
|
-
return this.saveEditRow(
|
|
1237
|
-
{ ...obj, row: currentRow },
|
|
1238
|
-
{ skipConfirm: true }
|
|
1239
|
-
);
|
|
1240
|
-
};
|
|
1241
|
-
this.editAutoSaveQueue = Promise.resolve(this.editAutoSaveQueue)
|
|
1242
|
-
.catch(() => false)
|
|
1243
|
-
.then(runSave)
|
|
1244
|
-
.catch((error) => {
|
|
1245
|
-
this.$message.error(error?.message || "失焦自动保存失败。");
|
|
1246
|
-
return false;
|
|
1247
|
-
});
|
|
1389
|
+
this.enqueueEditRowAutoSave(obj);
|
|
1248
1390
|
}, autoSaveDelay);
|
|
1249
1391
|
return true;
|
|
1250
1392
|
},
|
|
1393
|
+
/**
|
|
1394
|
+
* @param {Object} obj VXE 单元格参数。
|
|
1395
|
+
* @returns {Boolean} 是否进入统一自动保存 worker。
|
|
1396
|
+
*/
|
|
1397
|
+
enqueueEditRowAutoSave(obj) {
|
|
1398
|
+
if (this.tableDestroyed || !obj?.row || !obj?.$table) return false;
|
|
1399
|
+
const rowKey = obj.row._X_ROW_KEY || "current";
|
|
1400
|
+
let pendingEntry = this.editAutoSavePendingRows[rowKey];
|
|
1401
|
+
if (pendingEntry) {
|
|
1402
|
+
pendingEntry.obj = obj;
|
|
1403
|
+
pendingEntry.version += 1;
|
|
1404
|
+
return true;
|
|
1405
|
+
}
|
|
1406
|
+
if (
|
|
1407
|
+
Object.keys(this.editAutoSavePendingRows).length
|
|
1408
|
+
>= MAX_EDIT_AUTO_SAVE_PENDING_ROWS
|
|
1409
|
+
) {
|
|
1410
|
+
this.$message.warning("自动保存任务较多,请稍后再编辑。");
|
|
1411
|
+
return false;
|
|
1412
|
+
}
|
|
1413
|
+
pendingEntry = {
|
|
1414
|
+
obj,
|
|
1415
|
+
version: 0,
|
|
1416
|
+
cancelled: false,
|
|
1417
|
+
};
|
|
1418
|
+
this.editAutoSavePendingRows[rowKey] = pendingEntry;
|
|
1419
|
+
this.editAutoSaveOrder.push(rowKey);
|
|
1420
|
+
this.runEditAutoSaveWorker();
|
|
1421
|
+
return true;
|
|
1422
|
+
},
|
|
1423
|
+
/** @returns {Promise<Boolean>} 串行消费自动保存等待行。 */
|
|
1424
|
+
async runEditAutoSaveWorker() {
|
|
1425
|
+
if (this.editAutoSaveWorkerRunning || this.tableDestroyed) return false;
|
|
1426
|
+
this.editAutoSaveWorkerRunning = true;
|
|
1427
|
+
const generation = this.editAutoSaveGeneration;
|
|
1428
|
+
try {
|
|
1429
|
+
while (
|
|
1430
|
+
!this.tableDestroyed
|
|
1431
|
+
&& generation === this.editAutoSaveGeneration
|
|
1432
|
+
&& this.editAutoSaveOrder.length
|
|
1433
|
+
) {
|
|
1434
|
+
const rowKey = this.editAutoSaveOrder.shift();
|
|
1435
|
+
const pendingEntry = this.editAutoSavePendingRows[rowKey];
|
|
1436
|
+
if (!pendingEntry) continue;
|
|
1437
|
+
try {
|
|
1438
|
+
await this.runEditAutoSaveEntry(
|
|
1439
|
+
rowKey,
|
|
1440
|
+
pendingEntry,
|
|
1441
|
+
generation
|
|
1442
|
+
);
|
|
1443
|
+
} catch (error) {
|
|
1444
|
+
if (
|
|
1445
|
+
!axios.isCancel(error)
|
|
1446
|
+
&& !this.tableDestroyed
|
|
1447
|
+
&& generation === this.editAutoSaveGeneration
|
|
1448
|
+
) {
|
|
1449
|
+
this.$message.error(error?.message || "自动保存失败。");
|
|
1450
|
+
}
|
|
1451
|
+
} finally {
|
|
1452
|
+
if (this.editAutoSavePendingRows[rowKey] === pendingEntry) {
|
|
1453
|
+
delete this.editAutoSavePendingRows[rowKey];
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
return true;
|
|
1458
|
+
} finally {
|
|
1459
|
+
this.editAutoSaveWorkerRunning = false;
|
|
1460
|
+
if (
|
|
1461
|
+
!this.tableDestroyed
|
|
1462
|
+
&& generation === this.editAutoSaveGeneration
|
|
1463
|
+
&& this.editAutoSaveOrder.length
|
|
1464
|
+
) {
|
|
1465
|
+
this.$nextTick(() => this.runEditAutoSaveWorker());
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
},
|
|
1469
|
+
/**
|
|
1470
|
+
* @param {String} rowKey 行键。
|
|
1471
|
+
* @param {Object} pendingEntry 当前行合并项。
|
|
1472
|
+
* @param {Number} generation worker 代次。
|
|
1473
|
+
* @returns {Promise<Boolean>} 是否保存完当前行的最新版本。
|
|
1474
|
+
*/
|
|
1475
|
+
async runEditAutoSaveEntry(rowKey, pendingEntry, generation) {
|
|
1476
|
+
let savedVersion = -1;
|
|
1477
|
+
while (
|
|
1478
|
+
!this.tableDestroyed
|
|
1479
|
+
&& !pendingEntry.cancelled
|
|
1480
|
+
&& generation === this.editAutoSaveGeneration
|
|
1481
|
+
&& savedVersion !== pendingEntry.version
|
|
1482
|
+
) {
|
|
1483
|
+
while (
|
|
1484
|
+
this.treeSingleSavePending
|
|
1485
|
+
&& !this.tableDestroyed
|
|
1486
|
+
&& !pendingEntry.cancelled
|
|
1487
|
+
&& generation === this.editAutoSaveGeneration
|
|
1488
|
+
) {
|
|
1489
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
1490
|
+
}
|
|
1491
|
+
if (
|
|
1492
|
+
this.tableDestroyed
|
|
1493
|
+
|| pendingEntry.cancelled
|
|
1494
|
+
|| generation !== this.editAutoSaveGeneration
|
|
1495
|
+
) {
|
|
1496
|
+
return false;
|
|
1497
|
+
}
|
|
1498
|
+
const targetVersion = pendingEntry.version;
|
|
1499
|
+
const latestObj = pendingEntry.obj;
|
|
1500
|
+
const rows = this.formModel[this.fieldKeyName] || [];
|
|
1501
|
+
const currentRow = latestObj.row._X_ROW_KEY
|
|
1502
|
+
? rows.find(
|
|
1503
|
+
(row) => row?._X_ROW_KEY === latestObj.row._X_ROW_KEY
|
|
1504
|
+
) || latestObj.row
|
|
1505
|
+
: latestObj.row;
|
|
1506
|
+
const cancelSource = axios.CancelToken.source();
|
|
1507
|
+
this.editAutoSaveActiveRowKey = rowKey;
|
|
1508
|
+
this.editAutoSaveCancelSource = cancelSource;
|
|
1509
|
+
let saveResult;
|
|
1510
|
+
try {
|
|
1511
|
+
saveResult = await this.saveEditRow(
|
|
1512
|
+
{ ...latestObj, row: currentRow },
|
|
1513
|
+
{ skipConfirm: true, cancelToken: cancelSource.token }
|
|
1514
|
+
);
|
|
1515
|
+
} finally {
|
|
1516
|
+
if (this.editAutoSaveCancelSource === cancelSource) {
|
|
1517
|
+
this.editAutoSaveCancelSource = null;
|
|
1518
|
+
}
|
|
1519
|
+
if (this.editAutoSaveActiveRowKey === rowKey) {
|
|
1520
|
+
this.editAutoSaveActiveRowKey = null;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
if (saveResult !== true) return false;
|
|
1524
|
+
savedVersion = targetVersion;
|
|
1525
|
+
}
|
|
1526
|
+
return true;
|
|
1527
|
+
},
|
|
1251
1528
|
/**
|
|
1252
1529
|
* @param {Object} $table VXE 表实例。
|
|
1253
1530
|
* @param {Array<String>} insertedRowKeys 本次粘贴自动补出的稳定行键。
|
|
@@ -3314,6 +3591,18 @@ modules = {
|
|
|
3314
3591
|
let reqPath = typeof path === "function" ? path() : path;
|
|
3315
3592
|
let accessReturnType =
|
|
3316
3593
|
this.widget.options.accessReturnType || "2";
|
|
3594
|
+
const isExportQuery = !!customParam?.export;
|
|
3595
|
+
const queryContext
|
|
3596
|
+
= isExportQuery ? null : this.startTableQuery();
|
|
3597
|
+
if (queryContext) {
|
|
3598
|
+
customParam = {
|
|
3599
|
+
...(customParam || {}),
|
|
3600
|
+
config: {
|
|
3601
|
+
...(customParam?.config || {}),
|
|
3602
|
+
cancelToken: queryContext.source.token,
|
|
3603
|
+
},
|
|
3604
|
+
};
|
|
3605
|
+
}
|
|
3317
3606
|
|
|
3318
3607
|
return new Promise((resolve, reject) => {
|
|
3319
3608
|
if (scriptCode) {
|
|
@@ -3321,8 +3610,17 @@ modules = {
|
|
|
3321
3610
|
let reqData = buildReqData();
|
|
3322
3611
|
// let f = new Function("dataId", "formCode", "param", "done", accessScript);
|
|
3323
3612
|
let done = (res) => {
|
|
3613
|
+
if (
|
|
3614
|
+
queryContext
|
|
3615
|
+
&& !this.isCurrentTableQuery(queryContext)
|
|
3616
|
+
) {
|
|
3617
|
+
reject(new axios.Cancel("stale table query response"));
|
|
3618
|
+
return;
|
|
3619
|
+
}
|
|
3324
3620
|
// this.clearRowWidgets();
|
|
3325
3621
|
|
|
3622
|
+
const previousRowKeys = this.rowIdData.slice();
|
|
3623
|
+
|
|
3326
3624
|
let items = this.handleTreeData(
|
|
3327
3625
|
res.objx?.records || res.objx || []
|
|
3328
3626
|
);
|
|
@@ -3347,8 +3645,10 @@ modules = {
|
|
|
3347
3645
|
} else {
|
|
3348
3646
|
res.objx = rows;
|
|
3349
3647
|
}
|
|
3648
|
+
this.pruneStaleRowRefs(previousRowKeys, rows);
|
|
3350
3649
|
}
|
|
3351
3650
|
|
|
3651
|
+
this.finishTableQuery(queryContext);
|
|
3352
3652
|
resolve(res);
|
|
3353
3653
|
if (that.shouldEmitQueryLoaded(res, customParam)) {
|
|
3354
3654
|
if (that.widget.options.isTreeTable) {
|
|
@@ -3376,6 +3676,12 @@ modules = {
|
|
|
3376
3676
|
if (expandAll && expandRows.length) {
|
|
3377
3677
|
that.$nextTick(() => {
|
|
3378
3678
|
setTimeout(function () {
|
|
3679
|
+
if (
|
|
3680
|
+
that.tableDestroyed ||
|
|
3681
|
+
queryContext?.seq !== that.tableQuerySeq
|
|
3682
|
+
) {
|
|
3683
|
+
return;
|
|
3684
|
+
}
|
|
3379
3685
|
$grid.treeConfig.lazy = false;
|
|
3380
3686
|
$grid.setTreeExpand(expandRows, true);
|
|
3381
3687
|
expandRows.forEach((lineData) => {
|
|
@@ -3409,6 +3715,12 @@ modules = {
|
|
|
3409
3715
|
if (row[hasChild]) {
|
|
3410
3716
|
that.$nextTick(() => {
|
|
3411
3717
|
setTimeout(function () {
|
|
3718
|
+
if (
|
|
3719
|
+
that.tableDestroyed ||
|
|
3720
|
+
queryContext?.seq !== that.tableQuerySeq
|
|
3721
|
+
) {
|
|
3722
|
+
return;
|
|
3723
|
+
}
|
|
3412
3724
|
$grid.setTreeExpand(row, true);
|
|
3413
3725
|
}, 0);
|
|
3414
3726
|
});
|
|
@@ -3416,13 +3728,26 @@ modules = {
|
|
|
3416
3728
|
}
|
|
3417
3729
|
}
|
|
3418
3730
|
}
|
|
3419
|
-
that.emitTableDataLoaded(
|
|
3731
|
+
that.emitTableDataLoaded(
|
|
3732
|
+
rows,
|
|
3733
|
+
tableOption,
|
|
3734
|
+
queryContext?.seq
|
|
3735
|
+
);
|
|
3420
3736
|
}
|
|
3421
3737
|
};
|
|
3422
|
-
this.loadDefaultQueryList(
|
|
3738
|
+
const requestTask = this.loadDefaultQueryList(
|
|
3739
|
+
reqData,
|
|
3740
|
+
done,
|
|
3741
|
+
customParam
|
|
3742
|
+
);
|
|
3743
|
+
Promise.resolve(requestTask).catch((error) => {
|
|
3744
|
+
this.finishTableQuery(queryContext);
|
|
3745
|
+
reject(error);
|
|
3746
|
+
});
|
|
3423
3747
|
};
|
|
3424
3748
|
this.runAfterTableFormReady($grid, toDo);
|
|
3425
3749
|
} else {
|
|
3750
|
+
this.finishTableQuery(queryContext);
|
|
3426
3751
|
resolve();
|
|
3427
3752
|
}
|
|
3428
3753
|
});
|
|
@@ -3748,6 +4073,7 @@ modules = {
|
|
|
3748
4073
|
* @param {Object} option 本次查询的覆盖配置。
|
|
3749
4074
|
*/
|
|
3750
4075
|
loadDefaultViewList(option) {
|
|
4076
|
+
const queryContext = this.startTableQuery();
|
|
3751
4077
|
let dataId = this.formDataId;
|
|
3752
4078
|
let reportTemplate = this.getFormRef().reportTemplate;
|
|
3753
4079
|
let formCode = reportTemplate.formCode;
|
|
@@ -3762,9 +4088,10 @@ modules = {
|
|
|
3762
4088
|
otherParam.thirdtabm = thirdtabm;
|
|
3763
4089
|
}
|
|
3764
4090
|
let scriptCode = this.getScriptCode();
|
|
3765
|
-
|
|
4091
|
+
const requestTask = this.formHttp({
|
|
3766
4092
|
/*url: "/" + reportTemplate.serviceName + "/form_ins/getList",*/
|
|
3767
4093
|
scriptCode: scriptCode,
|
|
4094
|
+
cancelToken: queryContext.source.token,
|
|
3768
4095
|
data: {
|
|
3769
4096
|
formCode: formCode,
|
|
3770
4097
|
formVersion: reportTemplate.formVersion,
|
|
@@ -3776,6 +4103,7 @@ modules = {
|
|
|
3776
4103
|
},
|
|
3777
4104
|
},
|
|
3778
4105
|
callback: (res) => {
|
|
4106
|
+
if (!this.isCurrentTableQuery(queryContext)) return;
|
|
3779
4107
|
let $grid = this.getGridTable();
|
|
3780
4108
|
// let rows = res.objx ? res.objx.records || res.objx || [] : [];
|
|
3781
4109
|
|
|
@@ -3790,7 +4118,10 @@ modules = {
|
|
|
3790
4118
|
// that.handleNullValue(rows);
|
|
3791
4119
|
rows = this.normalizeTableRows(rows, false);
|
|
3792
4120
|
this.initValue(rows);
|
|
4121
|
+
const querySeq = queryContext.seq;
|
|
4122
|
+
this.finishTableQuery(queryContext);
|
|
3793
4123
|
this.$nextTick(() => {
|
|
4124
|
+
if (this.tableDestroyed || querySeq !== this.tableQuerySeq) return;
|
|
3794
4125
|
/*if (this.widget.options.isTreeTable) {
|
|
3795
4126
|
let $grid = this.getGridTable();
|
|
3796
4127
|
$grid.treeConfig.lazy = false;
|
|
@@ -3806,6 +4137,10 @@ modules = {
|
|
|
3806
4137
|
});
|
|
3807
4138
|
},
|
|
3808
4139
|
});
|
|
4140
|
+
return Promise.resolve(requestTask).catch((error) => {
|
|
4141
|
+
this.finishTableQuery(queryContext);
|
|
4142
|
+
throw error;
|
|
4143
|
+
});
|
|
3809
4144
|
},
|
|
3810
4145
|
/** @returns {Object} 当前表格脚本访问参数。 */
|
|
3811
4146
|
getAccessParam() {
|
|
@@ -3856,10 +4191,17 @@ modules = {
|
|
|
3856
4191
|
* 是否该派发由 shouldEmitQueryLoaded 判定,这里只负责发。
|
|
3857
4192
|
* @param {Array} rows 本次加载的行。
|
|
3858
4193
|
* @param {Object} tableOption 表格配置(callback 挂在它上面)。
|
|
4194
|
+
* @param {Number} querySeq 普通查询代次;延迟回调执行前再次核验。
|
|
3859
4195
|
*/
|
|
3860
|
-
emitTableDataLoaded(rows, tableOption) {
|
|
4196
|
+
emitTableDataLoaded(rows, tableOption, querySeq) {
|
|
3861
4197
|
this.$nextTick(() => {
|
|
3862
4198
|
setTimeout(() => {
|
|
4199
|
+
if (
|
|
4200
|
+
this.tableDestroyed
|
|
4201
|
+
|| (querySeq != null && querySeq !== this.tableQuerySeq)
|
|
4202
|
+
) {
|
|
4203
|
+
return;
|
|
4204
|
+
}
|
|
3863
4205
|
let dataTableConfig = this.dataTableConfig || {};
|
|
3864
4206
|
dataTableConfig.callback && dataTableConfig.callback(rows);
|
|
3865
4207
|
tableOption && tableOption.callback && tableOption.callback(rows);
|
|
@@ -3991,7 +4333,11 @@ modules = {
|
|
|
3991
4333
|
|
|
3992
4334
|
let scriptCode = this.getScriptCode();
|
|
3993
4335
|
if (scriptCode) {
|
|
3994
|
-
this.loadDefaultViewList()
|
|
4336
|
+
this.loadDefaultViewList().catch((error) => {
|
|
4337
|
+
if (!axios.isCancel(error) && !this.tableDestroyed) {
|
|
4338
|
+
console.error("[data-table] default view query failed", error);
|
|
4339
|
+
}
|
|
4340
|
+
});
|
|
3995
4341
|
}
|
|
3996
4342
|
},
|
|
3997
4343
|
/** @param {Object} item 参数配置。@param {*} dataId 主数据 id。@param {Object} billData 单据数据。@returns {Object} */
|
|
@@ -4153,7 +4499,7 @@ modules = {
|
|
|
4153
4499
|
if (!this.canDeleteTableRow({ row, rowIndex })) {
|
|
4154
4500
|
return false;
|
|
4155
4501
|
}
|
|
4156
|
-
|
|
4502
|
+
this.releaseRowRuntime(row._X_ROW_KEY);
|
|
4157
4503
|
let $grid = this.getGridTable();
|
|
4158
4504
|
$grid.remove(row);
|
|
4159
4505
|
let tableData = $grid.getTableData();
|
|
@@ -4161,6 +4507,7 @@ modules = {
|
|
|
4161
4507
|
let fullData = !isEditTable ? tableData.fullData : tableData.tableData;
|
|
4162
4508
|
this.formModel[this.fieldKeyName] = fullData;
|
|
4163
4509
|
this.fieldModel = fullData;
|
|
4510
|
+
this.initRowIdData();
|
|
4164
4511
|
this.$nextTick(() => {
|
|
4165
4512
|
this.handleWbs();
|
|
4166
4513
|
});
|
|
@@ -4956,9 +5303,10 @@ modules = {
|
|
|
4956
5303
|
/**
|
|
4957
5304
|
* 保存当前编辑行。持久化行原位合并;新身份以回查结果重建树关系。
|
|
4958
5305
|
* @param {Object} obj VXE 插槽参数,必须包含 row 和 $table。
|
|
4959
|
-
* @param {Object} options 保存选项;skipConfirm
|
|
5306
|
+
* @param {Object} options 保存选项;skipConfirm 跳过确认,cancelToken 用于自动保存失效时取消请求。
|
|
4960
5307
|
*/
|
|
4961
5308
|
async saveEditRow(obj, options = {}) {
|
|
5309
|
+
if (this.tableDestroyed) return false;
|
|
4962
5310
|
let formRef = this.getFormRef();
|
|
4963
5311
|
let formConfig = this.formConfig;
|
|
4964
5312
|
let entity = formConfig.entity;
|
|
@@ -4974,7 +5322,9 @@ modules = {
|
|
|
4974
5322
|
return this.treeSingleSaveReconcileTask();
|
|
4975
5323
|
}
|
|
4976
5324
|
if (this.treeSingleSavePending) {
|
|
4977
|
-
this
|
|
5325
|
+
if (!this.tableDestroyed) {
|
|
5326
|
+
this.$message.warning("当前行正在保存,请勿重复操作。");
|
|
5327
|
+
}
|
|
4978
5328
|
return false;
|
|
4979
5329
|
}
|
|
4980
5330
|
this.treeSingleSavePending = true;
|
|
@@ -4991,9 +5341,11 @@ modules = {
|
|
|
4991
5341
|
this.treeSingleSavePending = false;
|
|
4992
5342
|
return true;
|
|
4993
5343
|
} catch (error) {
|
|
4994
|
-
this
|
|
4995
|
-
|
|
4996
|
-
|
|
5344
|
+
if (!this.tableDestroyed) {
|
|
5345
|
+
this.$message.error(
|
|
5346
|
+
"重新加载仍未成功,请手动刷新后再操作。"
|
|
5347
|
+
);
|
|
5348
|
+
}
|
|
4997
5349
|
return false;
|
|
4998
5350
|
} finally {
|
|
4999
5351
|
retryPromise = null;
|
|
@@ -5140,6 +5492,7 @@ modules = {
|
|
|
5140
5492
|
let requestTask = this.formHttp({
|
|
5141
5493
|
scriptCode: scriptCode,
|
|
5142
5494
|
data: reqData,
|
|
5495
|
+
cancelToken: options.cancelToken,
|
|
5143
5496
|
successMsg: true,
|
|
5144
5497
|
isConfirm: false,
|
|
5145
5498
|
success: resolve,
|
|
@@ -5152,6 +5505,7 @@ modules = {
|
|
|
5152
5505
|
requestTask.catch(reject);
|
|
5153
5506
|
}
|
|
5154
5507
|
});
|
|
5508
|
+
if (this.tableDestroyed) return false;
|
|
5155
5509
|
|
|
5156
5510
|
let querySavedRow = () =>
|
|
5157
5511
|
new Promise((resolve, reject) => {
|
|
@@ -5161,13 +5515,15 @@ modules = {
|
|
|
5161
5515
|
(res) => {
|
|
5162
5516
|
reject(new Error(res?.content || "保存结果重新查询失败。"));
|
|
5163
5517
|
},
|
|
5164
|
-
reject
|
|
5518
|
+
reject,
|
|
5519
|
+
options.cancelToken
|
|
5165
5520
|
);
|
|
5166
5521
|
if (requestTask && typeof requestTask.catch === "function") {
|
|
5167
5522
|
requestTask.catch(reject);
|
|
5168
5523
|
}
|
|
5169
5524
|
});
|
|
5170
5525
|
let reconcileSavedRow = async (rowResponse) => {
|
|
5526
|
+
if (this.tableDestroyed) return false;
|
|
5171
5527
|
let responseRow = { ...(rowResponse?.objx || {}) };
|
|
5172
5528
|
if (treeContext) {
|
|
5173
5529
|
let { rowField } = treeContext.fields;
|
|
@@ -5345,6 +5701,8 @@ modules = {
|
|
|
5345
5701
|
try {
|
|
5346
5702
|
return await runRowReconcile();
|
|
5347
5703
|
} catch (error) {
|
|
5704
|
+
if (axios.isCancel(error)) return false;
|
|
5705
|
+
if (this.tableDestroyed) return false;
|
|
5348
5706
|
this.handleRowSaveError(error, obj.row);
|
|
5349
5707
|
keepSaveLocked = true;
|
|
5350
5708
|
let retryPromise = null;
|
|
@@ -5357,10 +5715,13 @@ modules = {
|
|
|
5357
5715
|
return result;
|
|
5358
5716
|
})
|
|
5359
5717
|
.catch((retryError) => {
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5718
|
+
if (axios.isCancel(retryError)) return false;
|
|
5719
|
+
if (!this.tableDestroyed) {
|
|
5720
|
+
this.$message.error(
|
|
5721
|
+
retryError?.message
|
|
5722
|
+
|| "保存结果仍未能重新加载,请手动刷新后再操作。"
|
|
5723
|
+
);
|
|
5724
|
+
}
|
|
5364
5725
|
return false;
|
|
5365
5726
|
})
|
|
5366
5727
|
.finally(() => {
|
|
@@ -5375,6 +5736,8 @@ modules = {
|
|
|
5375
5736
|
return false;
|
|
5376
5737
|
}
|
|
5377
5738
|
} catch (error) {
|
|
5739
|
+
if (axios.isCancel(error)) return false;
|
|
5740
|
+
if (this.tableDestroyed) return false;
|
|
5378
5741
|
this.handleRowSaveError(error, obj.row);
|
|
5379
5742
|
if (error?.treeReloadFailed) {
|
|
5380
5743
|
keepSaveLocked = true;
|
|
@@ -5409,7 +5772,7 @@ modules = {
|
|
|
5409
5772
|
}
|
|
5410
5773
|
},
|
|
5411
5774
|
/** @param {*} dataId 行数据 id。@param {Function} callback 查询成功回调。加载保存后的完整行。 */
|
|
5412
|
-
getRowData(dataId, callback, fail, error) {
|
|
5775
|
+
getRowData(dataId, callback, fail, error, cancelToken) {
|
|
5413
5776
|
let reportTemplate = this.getFormRef()?.reportTemplate;
|
|
5414
5777
|
let formCode = reportTemplate.formCode;
|
|
5415
5778
|
let formConfig = this.formConfig;
|
|
@@ -5427,6 +5790,7 @@ modules = {
|
|
|
5427
5790
|
id: dataId,
|
|
5428
5791
|
},
|
|
5429
5792
|
},
|
|
5793
|
+
cancelToken,
|
|
5430
5794
|
...defaultOption,
|
|
5431
5795
|
success: (res) => {
|
|
5432
5796
|
callback && callback(res);
|
|
@@ -5727,6 +6091,7 @@ modules = {
|
|
|
5727
6091
|
}
|
|
5728
6092
|
});
|
|
5729
6093
|
}
|
|
6094
|
+
this.releaseRowsRuntime(delKeys);
|
|
5730
6095
|
let newRows = tableRows.filter((item) => !delKeys.has(item._X_ROW_KEY));
|
|
5731
6096
|
this.setValue(this.stripTreeContainerRows(newRows));
|
|
5732
6097
|
this.$nextTick(() => {
|
|
@@ -6162,6 +6527,7 @@ modules = {
|
|
|
6162
6527
|
let row = obj.row;
|
|
6163
6528
|
let $grid = this.getGridTable();
|
|
6164
6529
|
await $grid.remove(row);
|
|
6530
|
+
this.releaseRowRuntime(row?._X_ROW_KEY);
|
|
6165
6531
|
if (this.widget.options.isTreeTable) {
|
|
6166
6532
|
let { rowField } = this.getTreeFields($grid);
|
|
6167
6533
|
this.unregisterTreeKey(
|
|
@@ -6557,6 +6923,12 @@ modules = {
|
|
|
6557
6923
|
|
|
6558
6924
|
let rowIdData = this.rowIdData;
|
|
6559
6925
|
let rowLength = this.rowIdData.length;
|
|
6926
|
+
// 查询/赋值结果为空时也必须释放上一次的行级 schema。原逻辑只在
|
|
6927
|
+
// rowLength > 0 时重建,导致空结果页面仍常驻上一批数据的全部 schema。
|
|
6928
|
+
if (rowLength === 0) {
|
|
6929
|
+
this.fieldSchemaMap = {};
|
|
6930
|
+
return;
|
|
6931
|
+
}
|
|
6560
6932
|
// this.fieldSchemaData.splice(0, this.fieldSchemaData.length) //清除数组必须用splice,length=0不会响应式更新!!
|
|
6561
6933
|
// if(initFlag)this.fieldSchemaMap = {};
|
|
6562
6934
|
if (rowLength > 0) {
|