cloud-web-corejs 1.1.0-dev.8 → 1.1.0-dev.9

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.1.0-dev.8",
4
+ "version": "1.1.0-dev.9",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "dev:micro": "vue-cli-service serve --port 17527",
@@ -93,7 +93,7 @@ modules = {
93
93
  readonly: Boolean,
94
94
  columnFlag: Boolean,
95
95
  sourceData: Object,
96
- /* 进入设计器时的默认布局模式(临时模式:仅入口默认值,模板自带 layoutType 时不覆盖) */
96
+ /* 进入设计器时的布局模式(模板自带 layoutType 时不覆盖);传入即锁定,工具栏不允许再切换 */
97
97
  defaultLayoutType: { type: String, default: "" },
98
98
  },
99
99
  data() {
@@ -149,6 +149,8 @@ modules = {
149
149
  serverFieldList: this.fieldList,
150
150
  getServerSubFormList: () => this.subFormList,
151
151
  getDesignerConfig: () => this.designerConfig,
152
+ /* 由表单模板等入口指定布局模式时,布局类型由模板类型决定,设计器内不可切换 */
153
+ getLayoutTypeLocked: () => !!this.defaultLayoutType,
152
154
  getBannedWidgets: () => this.bannedWidgets,
153
155
  saveReportTemplate: this.saveReportTemplate,
154
156
  getReportTemplate: () => this.reportTemplate,
@@ -348,7 +350,7 @@ modules = {
348
350
  },
349
351
 
350
352
  /**
351
- * 应用入口默认布局模式:模板 JSON 自带 layoutType 时以模板为准,不覆盖
353
+ * 应用入口指定的布局模式:模板 JSON 自带 layoutType 时以模板为准,不覆盖
352
354
  */
353
355
  applyDefaultLayoutType(loadedFormJson) {
354
356
  if (!this.defaultLayoutType) {
@@ -17,9 +17,12 @@
17
17
  >
18
18
  <svg-icon icon-class="redo" />
19
19
  </el-button>
20
- <el-button-group>
20
+ <el-button-group :title="layoutTypeLocked ? layoutTypeLockedTip : ''">
21
+ <!-- 锁定时只保留当前模式一个按钮,另一个不显示 -->
21
22
  <el-button
23
+ v-if="!layoutTypeLocked || layoutType === 'PC'"
22
24
  :type="layoutType === 'PC' ? 'info' : ''"
25
+ :disabled="layoutTypeLocked"
23
26
  @click="changeLayoutType('PC')"
24
27
  size="mini"
25
28
  >
@@ -27,7 +30,9 @@
27
30
  </el-button>
28
31
  <!-- <el-button :type="layoutType === 'Pad' ? 'info' : ''" @click="changeLayoutType('Pad')">{{ i18nt('designer.toolbar.padLayout') }}</el-button>-->
29
32
  <el-button
33
+ v-if="!layoutTypeLocked || layoutType === 'H5'"
30
34
  :type="layoutType === 'H5' ? 'info' : ''"
35
+ :disabled="layoutTypeLocked"
31
36
  @click="changeLayoutType('H5')"
32
37
  size="mini"
33
38
  >
@@ -682,6 +687,11 @@ div.toolbar-container {
682
687
  .left-toolbar {
683
688
  float: left;
684
689
  font-size: 16px;
690
+
691
+ /* 按钮组不是 .el-button,吃不到 element 的 .el-button+.el-button 间距,得自己补 */
692
+ .el-button-group {
693
+ margin-left: 10px;
694
+ }
685
695
  }
686
696
 
687
697
  .right-toolbar {
@@ -36,6 +36,7 @@ modules = {
36
36
  },
37
37
  inject: [
38
38
  "getDesignerConfig",
39
+ "getLayoutTypeLocked",
39
40
  "saveReportTemplate",
40
41
  "getReportTemplate",
41
42
  "getFormTemplateTableDTOs",
@@ -105,6 +106,15 @@ modules = {
105
106
  layoutType() {
106
107
  return this.designer.getLayoutType();
107
108
  },
109
+
110
+ /* 布局模式由入口(表单模板类型)锁定时,PC/移动端按钮只回显不可切换 */
111
+ layoutTypeLocked() {
112
+ return !!this.getLayoutTypeLocked();
113
+ },
114
+
115
+ layoutTypeLockedTip() {
116
+ return this.$t1("模板类型由表单模板维护,设计器内不可切换");
117
+ },
108
118
  },
109
119
  watch: {
110
120
  "designer.widgetList": {
@@ -281,6 +291,9 @@ modules = {
281
291
  },
282
292
 
283
293
  changeLayoutType(newType) {
294
+ if (this.layoutTypeLocked) {
295
+ return;
296
+ }
284
297
  this.designer.changeLayoutType(newType);
285
298
  this.$emit("loadWidgets");
286
299
  },
@@ -10,7 +10,12 @@
10
10
 
11
11
  <template>
12
12
  <container-item-wrapper :widget="widget">
13
- <div class="h5-detail-wrap grid-container" :class="[customClass]" :ref="widget.id">
13
+ <!-- h5-no-bottom-btns:底栏一个按钮都没有时打上,让内容区吃掉底栏那一格高度。
14
+ 光靠底栏自己 v-if 不够 —— .h5-detail-body 的高度是
15
+ calc(100% - 底栏 - 标题栏) 硬减出来的(styles/h5.scss 块 G),
16
+ 不同步改的话底部会空出一条 56px 的白带。见块 G2。 -->
17
+ <div class="h5-detail-wrap grid-container"
18
+ :class="[customClass, { 'h5-no-bottom-btns': !hasBottomButtons() }]" :ref="widget.id">
14
19
  <div class="h5-header">{{ widget.options.label }}</div>
15
20
  <!-- 唯一滚动区:标题栏与底部动作栏 flex:none 固定,内容在这里滚。
16
21
  样式见 components/xform/styles/h5.scss 块 G(.h5-detail-body 必须有 min-height:0) -->
@@ -49,7 +54,9 @@
49
54
  :defaultShowWfContent="getDefaultShowWfContent()"
50
55
  :hideActions="true"/>
51
56
  </div>
52
- <div class="h5-fixed-bottom-btns ">
57
+ <!-- 一个按钮都没有时整条不渲染:底栏是 flex:none 的定高块,
58
+ 留着就是一条 56px 的空白胶囊条,还带阴影。 -->
59
+ <div class="h5-fixed-bottom-btns " v-if="hasBottomButtons()">
53
60
  <transition-group name="fade" tag="div" class="form-widget-list">
54
61
  <template v-if="visibleButtons().length > 0">
55
62
  <template v-for="(subWidget, swIdx) in visibleButtons()">
@@ -273,6 +280,18 @@ export default {
273
280
  );
274
281
  return this.wfActionButtons().concat(widgetButtons);
275
282
  },
283
+ /**
284
+ * 底栏要不要出。与 visibleButtons/overflowButtons 同源(都走 bottomButtons),
285
+ * 不会出现「有按钮却不渲染」的错位。
286
+ *
287
+ * 用方法而非 computed,同本文件其余流程相关方法:wfActionButtons 依赖的流程状态
288
+ * 挂在表单实例上、多数不是响应式的。重渲染的触发点是 f.hasWf(它在 form-render
289
+ * 的 data 里)与 widget.widgetList —— 流程就绪、按钮显隐变化时都会重算,
290
+ * 底栏跟着出现或消失。
291
+ */
292
+ hasBottomButtons() {
293
+ return this.bottomButtons().length > 0;
294
+ },
276
295
  /**
277
296
  * 平铺的按钮。宽度由 CSS 的 flex:1 等分决定 ——
278
297
  * 1 个铺满、2 个各一半、3 个各三分之一,不需要在这里算。
@@ -67,7 +67,7 @@
67
67
  </div>
68
68
  <div class="h5-list-box">
69
69
  <div
70
- v-for="(row, rowIndex) in fieldModel"
70
+ v-for="(row, rowIndex) in visibleRows"
71
71
  :key="rowIndex"
72
72
  class="item"
73
73
  @click="onRowClick(row)"
@@ -397,6 +397,19 @@
397
397
  <p>产地:广东佛山</p>
398
398
  </div>-->
399
399
  </div>
400
+ <!-- 折叠尾行:详情里挂的明细列表默认只出 H5_LIST_COLLAPSE_SIZE 条,
401
+ 点一次展开全部(不给「收起」,见 expandAllRows 的注释)。
402
+ 摆在 .h5-list-box 里当最后一个子元素,跟着它的内边距与卡片对齐。
403
+ 样式见 styles/h5.scss 块 I4。 -->
404
+ <div
405
+ class="h5-list-more"
406
+ v-if="collapsedRest > 0"
407
+ @click="expandAllRows"
408
+ >
409
+ <span>{{ $t1("更多") }}</span>
410
+ <span class="h5-list-more-count">({{ collapsedRest }})</span>
411
+ <i class="el-icon-arrow-down"></i>
412
+ </div>
400
413
  </div>
401
414
  <div class="vxe-grid" v-if="widget.options.isQueryTable">
402
415
  <div class="vxe-grid&#45;&#45;pager-wrapper">
@@ -752,6 +765,11 @@ const baseRefUtil = {
752
765
  };
753
766
 
754
767
  const defaultPageSize = 2;
768
+
769
+ /* H5 详情里挂的明细列表,折叠态露出的行数。
770
+ 写死而不做成表单选项:与 detail-h5-item 的 H5_BOTTOM_MAX_BUTTONS 同理 ——
771
+ 做成 options 后,已保存的表单会锁住旧值,改原型默认值不生效,反成绊脚石。 */
772
+ const H5_LIST_COLLAPSE_SIZE = 5;
755
773
  export default {
756
774
  name: "list-h5-item",
757
775
  components: {
@@ -827,11 +845,16 @@ export default {
827
845
  keyword: null,
828
846
 
829
847
  checkItemIds: [],
848
+ /* 「更多」是否点过。折叠只在详情里挂的明细列表上生效,见 collapsible */
849
+ showAllRows: false,
830
850
  };
831
851
  },
832
852
  watch: {
833
853
  fieldModel(val) {
834
854
  this.formModel[this.fieldKeyName] = val || [];
855
+ /* 换了一整批数据(setValue / 重新取数)就退回折叠态。
856
+ push 追加行不会触发这里,那条路径由 addTableData 自己展开。 */
857
+ this.showAllRows = false;
835
858
  },
836
859
  },
837
860
  computed: {
@@ -882,6 +905,32 @@ export default {
882
905
  // 明细卡片:只有一列时不抽标题 —— 抽走字段区就空了,不如照常当字段出
883
906
  return visible.length < 2 ? null : main;
884
907
  },
908
+ /**
909
+ * 是否走折叠(默认只出 H5_LIST_COLLAPSE_SIZE 条 + 「更多」尾行)。
910
+ * 两个条件缺一不可,见 isInDetailH5 与下面这条:
911
+ * 查询选择列表(isQueryTable)是整屏选数据用的、自己带分页器,再截断会跟分页打架。
912
+ */
913
+ collapsible() {
914
+ return !this.widget.options.isQueryTable && this.isInDetailH5();
915
+ },
916
+ /* 折起来没露出的行数,同时是「更多」尾行的显示条件 */
917
+ collapsedRest() {
918
+ if (!this.collapsible || this.showAllRows) return 0;
919
+ let total = (this.fieldModel || []).length;
920
+ return total > H5_LIST_COLLAPSE_SIZE ? total - H5_LIST_COLLAPSE_SIZE : 0;
921
+ },
922
+ /**
923
+ * 真正渲染的行。
924
+ * ★ 只能从头切:rowIndex 在模板里同时当 subFormRowIndex / formItemProp 的下标
925
+ * (行内控件靠它定位 formModel 里的那一行)和 deleteRow 的下标,从头切时它与
926
+ * fieldModel 的下标恒等,不必再做一层映射。
927
+ * 传给格式化函数的 items 仍是整份 fieldModel(模板里没改),那是数据不是视图。
928
+ */
929
+ visibleRows() {
930
+ let rows = this.fieldModel || [];
931
+ if (this.collapsedRest <= 0) return rows;
932
+ return rows.slice(0, H5_LIST_COLLAPSE_SIZE);
933
+ },
885
934
  columns() {
886
935
  let tableColumns = this.widget.options.tableColumns;
887
936
  let newColumns = [];
@@ -1009,6 +1058,36 @@ export default {
1009
1058
  this.unregisterFromRefList();
1010
1059
  },
1011
1060
  methods: {
1061
+ /**
1062
+ * 是否挂在 H5 详情容器里 —— 折叠只对这种场景生效:list-h5 也能当整屏列表用,
1063
+ * 整屏的不该只出 5 条。
1064
+ *
1065
+ * 沿父链找 detail-h5-item,中间隔着 transition-group / 卡片容器都无所谓;
1066
+ * 遇到弹框/抽屉容器就停 —— 弹框里那份是独立的一屏,不算详情里挂的明细。
1067
+ * 结果缓存在非响应式实例属性上:父链在实例生命周期内不变,而 collapsible
1068
+ * 是渲染期求值的 computed,不能每次都走一遍链。
1069
+ */
1070
+ isInDetailH5() {
1071
+ if (this._inDetailH5 === undefined) {
1072
+ this._inDetailH5 = false;
1073
+ let vm = this.$parent;
1074
+ while (vm) {
1075
+ let name = vm.$options.name;
1076
+ if (name === "vf-dialog-item" || name === "vf-drawer-item") break;
1077
+ if (name === "detail-h5-item") {
1078
+ this._inDetailH5 = true;
1079
+ break;
1080
+ }
1081
+ vm = vm.$parent;
1082
+ }
1083
+ }
1084
+ return this._inDetailH5;
1085
+ },
1086
+ /* 「更多」:一次性展开全部,不再收回 —— 详情里这一段本来就短,
1087
+ 展开后再给个「收起」只会多一次误点。重新取数时 watch 会退回折叠态。 */
1088
+ expandAllRows() {
1089
+ this.showAllRows = true;
1090
+ },
1012
1091
  openAdvancedSearchDialog() {
1013
1092
  /*let formData = this.formModel;
1014
1093
  let advancedFormData = {};
@@ -1582,6 +1661,9 @@ export default {
1582
1661
  let newData = this.createNewTableData();
1583
1662
  tableRows.push(newData);
1584
1663
  }
1664
+ /* 追加的行落在末尾,折叠态下会被藏住 —— 加完就展开。
1665
+ 这里是 push 改数组,watch fieldModel 不触发,必须自己来。 */
1666
+ this.showAllRows = true;
1585
1667
  // this.formModel[this.fieldKeyName] = this.$baseLodash(this.fieldModel)
1586
1668
  // this.fieldModel = tableRows
1587
1669
  // $grid.loadData(tableRows);
@@ -473,6 +473,16 @@ $xformH5Size:14px;
473
473
  }
474
474
  }
475
475
 
476
+ /* ============ 块 G2:底栏没按钮时把那一格还给内容区 ============ */
477
+ /* 底栏一个按钮都没有时 detail-h5-item 不渲染它,并在根节点打 h5-no-bottom-btns。
478
+ 块 G 的 .h5-detail-body 高度是 calc(100% - 底栏 - 标题栏) 硬减出来的,
479
+ 不跟着改的话底部会空出一条 56px 的白带(底栏没了,减法还在)。
480
+ 对手是块 G 里 .xform-h5 .h5-detail-body 那条 (0,2,0) + !important,
481
+ 本方 (0,4,0) + !important,靠段数取胜,不依赖书写顺序。 */
482
+ .xform-h5 .h5-detail-wrap.h5-no-bottom-btns .h5-detail-body {
483
+ height: calc(100% - $xformH5HeaderHeight) !important;
484
+ }
485
+
476
486
  /* ★ 页面态必须定死一屏,不能用 min-height。
477
487
  实测宿主链没有确定高度(#containt 只有背景/圆角,没有 height),
478
488
  .designer-view{height:100%} → .xform-h5{height:100%} 一路塌陷成 auto;
@@ -843,6 +853,34 @@ $xformH5Size:14px;
843
853
  }
844
854
  }
845
855
 
856
+ /* ============ 块 I4:明细列表的「更多」尾行 ============ */
857
+ /* 详情里挂的明细列表默认只出 5 条(list-h5-item 的 H5_LIST_COLLAPSE_SIZE),
858
+ 这一行是展开入口,点一次出全部、自己消失。
859
+ 它是 .h5-list-box 的最后一个子元素,横向跟着那层 12px 内边距与卡片对齐;
860
+ 卡片自带 12px 下边距(本文件块「查看角标」那段),这里不再叠上边距。
861
+ 无对手规则,(0,3,0) 一条就够。 */
862
+ .xform-h5 .h5-list-box .h5-list-more {
863
+ display: flex;
864
+ align-items: center;
865
+ justify-content: center;
866
+ height: 36px;
867
+ border-radius: $xformH5CardRadius;
868
+ background: #fff;
869
+ border: solid 1px #eee;
870
+ color: $baseColor;
871
+ font-size: 13px;
872
+ cursor: pointer;
873
+
874
+ .h5-list-more-count {
875
+ color: #999;
876
+ }
877
+
878
+ i {
879
+ margin-left: 2px;
880
+ font-size: 12px;
881
+ }
882
+ }
883
+
846
884
  /* ============ 块 J:附件(VabUpload 列表的 H5 行式版式) ============ */
847
885
  /* 这一块的第一版是照抄 bill_setting/h5.scss 的 74px 方格口径,实测把附件压没了、
848
886
  已撤回;那套 DOM 里 .el-upload-list__item-thumbnail 是 item 的直接子元素,而
@@ -942,6 +980,7 @@ $xformH5Size:14px;
942
980
  .el-image {
943
981
  width: 100%;
944
982
  height: 100%;
983
+ img{width:56px;height:56px}
945
984
  }
946
985
 
947
986
  img {
@@ -36,7 +36,7 @@ export function getTemplateTypeByFormCode(formCode) {
36
36
  }
37
37
 
38
38
  /**
39
- * 进入设计器时的默认布局模式(临时模式:仅入口默认值,用户仍可手动切换)
39
+ * 进入设计器时的布局模式:由模板类型决定,进入后不允许在工具栏切换
40
40
  */
41
41
  export function getDesignerLayoutType(formCode) {
42
42
  return isH5FormTemplate(formCode) ? "H5" : "PC";
@@ -228,7 +228,7 @@ modules = {
228
228
  }
229
229
  },
230
230
  openDesingerDialog(row, callback, readonly = false) {
231
- /* 移动端模板进设计器默认 H5 模式(临时模式,工具栏仍可手动切回 PC) */
231
+ /* 布局模式跟随模板类型,移动端模板进设计器为 H5,且工具栏不可切换 */
232
232
  this.designerLayoutType = getDesignerLayoutType(row.formCode);
233
233
  this.formCode = row.formCode;
234
234
  this.formName = row.formName;