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.
@@ -745,6 +745,7 @@
745
745
  </template>
746
746
 
747
747
  <script>
748
+ import axios from "axios";
748
749
  import emitter from "../../../../components/xform/utils/emitter";
749
750
  import i18n from "../../../../components/xform/utils/i18n";
750
751
  import refMixin from "../../../../components/xform/form-render/refMixin";
@@ -858,6 +859,9 @@ export default {
858
859
  checkItemIds: [],
859
860
  /* 「更多」是否点过。折叠只在详情里挂的明细列表上生效,见 collapsible */
860
861
  showAllRows: false,
862
+ tableQuerySeq: 0,
863
+ tableQueryCancelSource: null,
864
+ tableDestroyed: false,
861
865
  };
862
866
  },
863
867
  watch: {
@@ -1074,9 +1078,37 @@ export default {
1074
1078
  this.initTableList();
1075
1079
  },
1076
1080
  beforeDestroy: function () {
1081
+ this.tableDestroyed = true;
1082
+ this.cancelActiveTableQuery("table destroyed");
1077
1083
  this.unregisterFromRefList();
1078
1084
  },
1079
1085
  methods: {
1086
+ cancelActiveTableQuery(reason) {
1087
+ if (this.tableQueryCancelSource) {
1088
+ this.tableQueryCancelSource.cancel(reason || "superseded table query");
1089
+ this.tableQueryCancelSource = null;
1090
+ }
1091
+ },
1092
+ startTableQuery() {
1093
+ this.cancelActiveTableQuery();
1094
+ const source = axios.CancelToken.source();
1095
+ const context = { seq: ++this.tableQuerySeq, source };
1096
+ this.tableQueryCancelSource = source;
1097
+ return context;
1098
+ },
1099
+ isCurrentTableQuery(context) {
1100
+ return (
1101
+ !this.tableDestroyed &&
1102
+ context &&
1103
+ context.seq === this.tableQuerySeq &&
1104
+ this.tableQueryCancelSource === context.source
1105
+ );
1106
+ },
1107
+ finishTableQuery(context) {
1108
+ if (context && this.tableQueryCancelSource === context.source) {
1109
+ this.tableQueryCancelSource = null;
1110
+ }
1111
+ },
1080
1112
  /**
1081
1113
  * 是否挂在 H5 详情容器里 —— 折叠只对这种场景生效:list-h5 也能当整屏列表用,
1082
1114
  * 整屏的不该只出 5 条。
@@ -1318,7 +1350,7 @@ export default {
1318
1350
  let page = { pageSize, currentPage };
1319
1351
  return this.vxeOption.config.proxyConfig.ajax.query.call(this, {
1320
1352
  page,
1321
- param,
1353
+ param: { ...param, __exportQuery: true },
1322
1354
  });
1323
1355
  },
1324
1356
  };
@@ -1333,6 +1365,10 @@ export default {
1333
1365
  ajax: {
1334
1366
  // 接收 Promise 对象
1335
1367
  query: ({ page, sorts, filters, form, param }) => {
1368
+ const isExportQuery = param?.__exportQuery === true;
1369
+ const queryContext = isExportQuery
1370
+ ? null
1371
+ : this.startTableQuery();
1336
1372
  let scriptCode = this.getScriptCode();
1337
1373
  let formData = tableOption.param ? tableOption.param() || {} : {};
1338
1374
  const queryParams = Object.assign({}, formData);
@@ -1350,6 +1386,7 @@ export default {
1350
1386
 
1351
1387
  queryParams.searchCount = isQueryAllPage !== false;
1352
1388
  Object.assign(queryParams, param);
1389
+ delete queryParams.__exportQuery;
1353
1390
 
1354
1391
  // 与 PC 链路同规则:condition 追加合并,其余键平铺覆盖
1355
1392
  if (that.dataTableConfig.queryParam) {
@@ -1362,7 +1399,17 @@ export default {
1362
1399
  };
1363
1400
  if (scriptCode) {
1364
1401
  let done = (res) => {
1402
+ if (
1403
+ !isExportQuery &&
1404
+ !this.isCurrentTableQuery(queryContext)
1405
+ ) {
1406
+ reject(new axios.Cancel("stale table query"));
1407
+ return;
1408
+ }
1365
1409
  resolve(res);
1410
+ if (isExportQuery) return;
1411
+ const querySeq = queryContext.seq;
1412
+ this.finishTableQuery(queryContext);
1366
1413
  if (res.type === "success") {
1367
1414
  let rows = res.objx
1368
1415
  ? res.objx.records || res.objx || []
@@ -1378,6 +1425,11 @@ export default {
1378
1425
  }
1379
1426
  that.$nextTick(() => {
1380
1427
  setTimeout(function () {
1428
+ if (
1429
+ that.tableDestroyed ||
1430
+ querySeq !== that.tableQuerySeq
1431
+ )
1432
+ return;
1381
1433
  dataTableConfig.callback &&
1382
1434
  dataTableConfig.callback(rows);
1383
1435
  tableOption.callback && tableOption.callback(rows);
@@ -1398,10 +1450,16 @@ export default {
1398
1450
  this.setValue([]);
1399
1451
  }
1400
1452
  };
1401
- this.loadDefaultQueryList(reqData, done).catch((error) => {
1453
+ this.loadDefaultQueryList(
1454
+ reqData,
1455
+ done,
1456
+ queryContext?.source.token
1457
+ ).catch((error) => {
1458
+ if (queryContext) this.finishTableQuery(queryContext);
1402
1459
  reject(error);
1403
1460
  });
1404
1461
  } else {
1462
+ if (queryContext) this.finishTableQuery(queryContext);
1405
1463
  resolve();
1406
1464
  }
1407
1465
  });
@@ -1516,7 +1574,11 @@ export default {
1516
1574
 
1517
1575
  let scriptCode = this.getScriptCode();
1518
1576
  if (scriptCode) {
1519
- this.loadDefaultViewList();
1577
+ this.loadDefaultViewList().catch((error) => {
1578
+ if (!axios.isCancel(error) && !this.tableDestroyed) {
1579
+ console.error("[data-table-h5] default view query failed", error);
1580
+ }
1581
+ });
1520
1582
  }
1521
1583
  },
1522
1584
  getAccessParam() {
@@ -1563,7 +1625,7 @@ export default {
1563
1625
  ? { ...base, ...(innerData || {}) }
1564
1626
  : { ...base, data: innerData || {} };
1565
1627
  },
1566
- loadDefaultQueryList(reqData, done) {
1628
+ loadDefaultQueryList(reqData, done, cancelToken) {
1567
1629
  let reportTemplate = this.getFormRef().reportTemplate;
1568
1630
  let scriptCode = this.getScriptCode();
1569
1631
  let accessParam = this.getAccessParam() || {};
@@ -1582,6 +1644,7 @@ export default {
1582
1644
  scriptCode: scriptCode,
1583
1645
  data: this.buildFormScriptData(reportTemplate, requestData),
1584
1646
  isLoading: false,
1647
+ cancelToken,
1585
1648
  ...defaultOption,
1586
1649
  callback: (res) => {
1587
1650
  done(res);
@@ -1589,6 +1652,7 @@ export default {
1589
1652
  });
1590
1653
  },
1591
1654
  loadDefaultViewList() {
1655
+ const queryContext = this.startTableQuery();
1592
1656
  let dataId = this.formDataId;
1593
1657
  let reportTemplate = this.getFormRef().reportTemplate;
1594
1658
  let accessParam = this.getAccessParam() || {};
@@ -1598,15 +1662,18 @@ export default {
1598
1662
  otherParam.attachmentType = attachmentType;
1599
1663
  }
1600
1664
  let scriptCode = this.getScriptCode();
1601
- return this.formHttp({
1665
+ const requestTask = this.formHttp({
1602
1666
  scriptCode: scriptCode,
1667
+ cancelToken: queryContext.source.token,
1603
1668
  data: this.buildFormScriptData(reportTemplate, {
1604
1669
  id: dataId,
1605
1670
  ...otherParam,
1606
1671
  ...accessParam,
1607
1672
  }),
1608
1673
  callback: (res) => {
1674
+ if (!this.isCurrentTableQuery(queryContext)) return;
1609
1675
  let rows = res.objx ? res.objx.records || res.objx || [] : [];
1676
+ this.finishTableQuery(queryContext);
1610
1677
  this.setValue(rows);
1611
1678
  this.handleCustomEvent(
1612
1679
  this.widget.options.formScriptCallback,
@@ -1615,6 +1682,10 @@ export default {
1615
1682
  );
1616
1683
  },
1617
1684
  });
1685
+ return Promise.resolve(requestTask).catch((error) => {
1686
+ this.finishTableQuery(queryContext);
1687
+ throw error;
1688
+ });
1618
1689
  },
1619
1690
  getReqParam(item, dataId, billData) {
1620
1691
  let param = {};
@@ -0,0 +1,5 @@
1
+ /**version-1.0*/
2
+ import "./public-path"; // qiankun publicPath 修正,必须保持第一行
3
+ import "normalize.css/normalize.css"; // a modern alternative to CSS resets
4
+ import "./boot-assets.legacy.js";
5
+ export * from "./app-bootstrap.sync.js";