cloud-web-corejs 1.0.54-dev.806 → 1.0.54-dev.807

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.806",
4
+ "version": "1.0.54-dev.807",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "dev:micro": "vue-cli-service serve --port 17527",
@@ -7,6 +7,7 @@ import {
7
7
  getQueryParam,
8
8
  traverseAllWidgets,
9
9
  traverseAllWidgetsNew,
10
+ flattenLeafColumns,
10
11
  } from "../../../components/xform/utils/util";
11
12
  import {
12
13
  MOCK_CASE_URL,
@@ -561,9 +562,12 @@ modules = {
561
562
  widget.tableField &&
562
563
  (widget.type === "data-table" || widget.type === "list-h5")
563
564
  ) {
564
- let vailColumns = widget.options.tableColumns.filter(
565
- (item) => item.prop && item.label
566
- );
565
+ // form-render/indexMixin 的 getFormTemplateTableDTOs 同口径:
566
+ // 分组表头自身 prop 为空,业务字段挂在 children 上,必须先展平叶子列,
567
+ // 否则「列全部分组」的表格算不出字段,子表不会写进模板表结构。
568
+ let vailColumns = flattenLeafColumns(
569
+ widget.options.tableColumns
570
+ ).filter((item) => item.prop && item.label);
567
571
  let itemFields = [];
568
572
  vailColumns.forEach((item) => {
569
573
  if (item.formatS === "editSearch") {
@@ -25,6 +25,7 @@ import {
25
25
  traverseAllWidgetsNew,
26
26
  columnFormatMap,
27
27
  getColumnWidgetOptions,
28
+ flattenLeafColumns,
28
29
  applyColumnMetaToFieldWidget,
29
30
  applyColumnMetaToColumnRow,
30
31
  cloneColumnFieldWidget,
@@ -3888,9 +3889,12 @@ modules = {
3888
3889
  if (widget.type === "data-table" || widget.type === "list-h5") {
3889
3890
  let isTreeTable = widget.options.isTreeTable || false;
3890
3891
  if (submitFlag) {
3891
- let vailColumns = widget.options.tableColumns.filter(
3892
- (item) => item.prop && item.label
3893
- );
3892
+ // 必须先展平叶子列:分组表头自身 prop 为空,业务字段全挂在 children 上。
3893
+ // 只过滤顶层时,「列全部分组」的表格会算出 0 个字段,被下面的
3894
+ // itemFields.length 判空拦掉,整张子表不进 DTO,保存报文里直接没有这张表。
3895
+ let vailColumns = flattenLeafColumns(
3896
+ widget.options.tableColumns
3897
+ ).filter((item) => item.prop && item.label);
3894
3898
  let itemFields = [];
3895
3899
  vailColumns.forEach((item) => {
3896
3900
  if (item.formatS === "editSearch") {
@@ -878,6 +878,29 @@ export function cloneColumnFieldWidget(fieldWidget) {
878
878
  return newWidget;
879
879
  }
880
880
 
881
+ /**
882
+ * 展平数据表格列配置,只返回叶子列。
883
+ * tableColumns 里带 children 的是分组表头(自身 prop 为空),真正的业务字段挂在 children 上,
884
+ * 因此凡是按 prop 取字段的逻辑都必须先展平,不能只看顶层。
885
+ */
886
+ export function flattenLeafColumns(columns) {
887
+ let result = [];
888
+ let loopDo = (cols) => {
889
+ (cols || []).forEach((item) => {
890
+ if (!item) {
891
+ return;
892
+ }
893
+ if (item.children && item.children.length) {
894
+ loopDo(item.children);
895
+ } else {
896
+ result.push(item);
897
+ }
898
+ });
899
+ };
900
+ loopDo(columns);
901
+ return result;
902
+ }
903
+
881
904
  /** 将列级 label / keyName / required 同步到列内 field widget(动态列 label 在列顶层) */
882
905
  export function applyColumnMetaToFieldWidget(fieldWidget, row, isEdit = false) {
883
906
  if (!fieldWidget || !row) {