cloud-web-corejs 1.0.54-dev.796 → 1.0.54-dev.798

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.796",
4
+ "version": "1.0.54-dev.798",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "dev:micro": "vue-cli-service serve --port 17527",
@@ -954,12 +954,15 @@ function getGrid(that, tableRef) {
954
954
  },
955
955
  exportAll(row) {
956
956
  let cUUid = encodeURIComponent(row.uuid);
957
+ let ippaaapp = this.ippaaapp;
957
958
  let fileName = row.title;
958
959
  let fileUrl =
959
960
  configUtil.baseUrl +
960
961
  this.CURRENT_PREFIX +
961
962
  "/excel/download?uuid=" +
962
- cUUid;
963
+ cUUid +
964
+ "&ippaaapp=" +
965
+ ippaaapp;
963
966
 
964
967
  function downLoadFile2() {
965
968
  let params = {
@@ -276,7 +276,10 @@ const result = await this.$formDrawer({
276
276
  // size: "62%", direction: "rtl", // el-drawer 外观,drawerConfig 可整体透传
277
277
  // dataId: row.id, // 详情单据 id —— 详情场景必传,xform 靠它加载单据数据
278
278
  // model: {...}, // 初始表单数据(新增态/自定义数据时用)
279
- // param: {...}, // 透传 VFormRender 的 param
279
+ // param: {...}, // 透传 VFormRender 的 param(只给模板脚本用,不参与请求)
280
+ // queryParam: {...}, // 合并进目标表单查询表格的请求参数(host:"list" 下不生效),见下
281
+ // { warehouseId: 7 } // 平铺参数:给后台脚本读(formScriptParam 那套约定)
282
+ // { condition: { status: 1, type: ["A","B"] } } // 结构化条件:追加进查询区组装的 condition,同字段以此为准
280
283
  // conditionParam: { objId, objTypeCode, taskId }, // 流程/权限上下文
281
284
  // fillHeight: true, // 强制内容区撑满(列表型模板默认自动开启)
282
285
  // host: "list", // 用列表宿主页承载,带「常规(详情)/列表」页签,见下
@@ -330,11 +333,29 @@ const result = await this.$formDrawer({
330
333
  | 以列表页承载 | 即 `host: "list"` |
331
334
  | 打开方式 | 新增(不传 dataId)/ 详情 |
332
335
  | 单据ID来源 | 当前控件值 / 指定表单字段 / 当前表格行字段 / 脚本。按钮类控件缺省用行字段(表格操作列场景) |
333
- | 自定义参数 | 脚本返回对象 → 壳的 `param` |
336
+ | 查询参数 | 脚本返回对象 → 壳的 `queryParam`,合并进目标表单查询表格的请求参数(见下「查询参数与 condition」)。「以列表页承载」时不生效,该项在编辑器里也随之隐藏 |
337
+ | 自定义参数 | 脚本返回对象 → 壳的 `param`,只透传给目标模板的脚本(`this.param`),不参与任何请求 |
334
338
  | 只读 | 抽屉走 `readonly`(只读态、底部仅「关闭」);弹框走 `disabledMode`(整表禁用、底部按钮不变) |
335
339
  | 形态 | 弹框:宽度 / 全屏;抽屉:素身详情 / 尺寸 / 弹出方向 |
336
340
  | 关闭后事件 | 参数 `(formRef, result)`。`result` 即壳的收口值——默认按钮是表单数据、配置按钮是 `{action, data}`、取消/关闭是 `null`,脚本据此决定要不要刷新宿主表格。抽屉侧 `formRef` 为 `null` |
337
341
 
342
+ ### 查询参数与 condition
343
+
344
+ 查询表格发给后台的请求体是 `{ condition: [{ field, value, filter }...], current, size, searchCount, ...平铺参数 }`——
345
+ `condition` 由查询区字段按控件类型自动组装(文本 like、日期 between、多选 in、单选 eq),平铺参数则给后台脚本读。
346
+ 宿主注入的 `queryParam` 按键分两路合并(`xform/utils/queryParamUtil.js`,PC 与 H5 两条查询链路共用):
347
+
348
+ | 写法 | 结果 |
349
+ |---|---|
350
+ | `{ warehouseId: 7 }` | 平铺覆盖,与改造前一致 |
351
+ | `{ condition: { status: 1, type: ["A","B"] } }` | 对象简写 → `[{field:"status",value:1,filter:"eq"}, {field:"type",value:["A","B"],filter:"in"}]`,**追加**到查询区条件之后 |
352
+ | `{ condition: { createTime: { value: ["2026-01-01","2026-12-31"], filter: "between" } } }` | 需要指定比较符时用 `{value, filter}` 形式 |
353
+ | `{ condition: [{ field:"status", value:1, filter:"eq" }] }` | 原生数组,`filter` 可省(数组值补 `in`,其余补 `eq`) |
354
+
355
+ 同一个 `field` 上宿主条件覆盖查询区输入(先剔旧再追加),不会撞成两条。
356
+ `condition` 不再整体覆盖——此前带 `condition` 的 `queryParam` 会把用户当场输入的查询条件一并清掉。
357
+ 注意值对象只有带 `value` 键才被当作 `{value, filter}` 解析,业务对象(如 `{ org: { id, name } }`)整体作为值传下去。
358
+
338
359
  底部按钮不在这里配——由目标表单模板自己的 `formConfig.actionButtons` 决定(就是上一节那份配置)。
339
360
  该动作**不做数据回填、不做选择模式**:要回填/选行请用「打开选择弹框」。
340
361
  实现在 `xform/form-designer/setting-panel/property-editor/field-button/clickBindActions.js`
@@ -42,7 +42,7 @@
42
42
  :data-id="dataId"
43
43
  :conditionParam.sync="conditionParam"
44
44
  :param="drawerParam"
45
- :dataTableOption="selectMode ? dataTableOption : undefined"
45
+ :dataTableOption="dataTableOption || undefined"
46
46
  :plain-detail-mode="plain"
47
47
  :parent-target="_self"
48
48
  visible-key="showRender"
@@ -183,7 +183,7 @@ export default {
183
183
  customButtons: null,
184
184
  btnLoadingMap: {},
185
185
  formRefMounted: false,
186
- // PC 专用(不支持 H5):选择行为注入 data-table
186
+ // PC 专用(不支持 H5):选择行为 / 查询参数注入 data-table
187
187
  dataTableOption: null,
188
188
  $grid: null,
189
189
  };
@@ -281,6 +281,9 @@ export default {
281
281
  if (select.fieldKey) this.fieldKey = select.fieldKey;
282
282
  this._selectOption = select;
283
283
  this.initDataTableOption(select);
284
+ } else if (options.queryParam) {
285
+ // 非选择模式的查询参数:强制合并进目标表单查询表格的请求参数
286
+ this.dataTableOption = { queryParam: options.queryParam };
284
287
  }
285
288
 
286
289
  this.showWrap = true;
@@ -17,7 +17,7 @@ function loadCtor() {
17
17
 
18
18
  /**
19
19
  * JS 调用打开 formCode 抽屉。每次调用创建独立实例,支持叠开多层。
20
- * options:{ formCode, title, size, direction, param, conditionParam, plain,
20
+ * options:{ formCode, title, size, direction, param, queryParam, conditionParam, plain,
21
21
  * select: {multiple, rows, fieldKey, queryParam, onConfirm},
22
22
  * buttons, showFooter, readonly, onReady, beforeConfirm, model, ... }
23
23
  * resolve:默认按钮下 select 模式返回选中行数组、表单模式返回表单数据;
@@ -30,6 +30,7 @@
30
30
  @reload="reload"
31
31
  v-bind="formConfig"
32
32
  :param="dialogParam"
33
+ :dataTableOption="dialogDataTableOption"
33
34
  class="data-table_height"
34
35
  @hook:mounted="handleFormMounted"
35
36
  />
@@ -133,6 +134,16 @@ export default {
133
134
  dialogParam() {
134
135
  return this.option?.param;
135
136
  },
137
+ /**
138
+ * option.queryParam:强制合并进目标表单查询表格的请求参数
139
+ * (data-table 从 formRef.$attrs.dataTableOption.queryParam 读取,优先级高于表单自身查询条件)。
140
+ * 与 param 不是一回事:param 只是透传给模板脚本用的打开参数,不参与请求。
141
+ */
142
+ dialogDataTableOption() {
143
+ return this.option?.queryParam
144
+ ? { queryParam: this.option.queryParam }
145
+ : undefined;
146
+ },
136
147
  // host:"list" —— 用列表宿主页承载(带「常规/列表」页签),而非直接渲染单个表单
137
148
  listHost() {
138
149
  return this.option?.host === "list";
@@ -6,7 +6,11 @@
6
6
  <a href="javascript:void(0);" class="a-link nums" v-if="designState">
7
7
  <i class="iconfont icon-fujian3"/>
8
8
  </a>
9
- <base-attachment :option.sync="option" v-else></base-attachment>
9
+ <!-- 关掉缩略图懒加载:附件列/字段常挂在初始隐藏的容器里(非首页签、默认折叠面板),
10
+ el-image 的 lazy 只在 mounted 时判一次可视区,隐藏态判失败后仅靠滚动容器的 scroll
11
+ 事件重试,页签切回来不产生 scroll,缩略图会永久停在空白占位。此处是 25px 缩略图,
12
+ 懒加载收益可忽略。参见 wf.js 里同样传 imageLazy:false 的表格列。 -->
13
+ <base-attachment :option.sync="option" :image-lazy="false" v-else></base-attachment>
10
14
  </form-item-wrapper>
11
15
  </template>
12
16
 
@@ -49,6 +49,7 @@ export function buildDefaultFormHostConfig(ctx = {}) {
49
49
  dataIdField: null,
50
50
  dataIdScript: null,
51
51
  paramScript: null,
52
+ queryParamScript: null,
52
53
  // 呈现
53
54
  readonly: false,
54
55
  showFooter: true,
@@ -170,9 +171,15 @@ export function openFormHost(ctx, mode) {
170
171
  let dataId = resolveDataId(ctx, cfg);
171
172
  if (dataId === undefined) return; // 详情态取不到单据 ID,已提示
172
173
 
174
+ // param:透传 VFormRender 的 param prop,只给目标模板的脚本用,不参与请求
173
175
  let param = cfg.paramScript
174
176
  ? ctx.vm.handleCustomEvent(cfg.paramScript, ["rowData"], [ctx.rowData])
175
177
  : undefined;
178
+ // queryParam:强制合并进目标表单查询表格的请求参数(两个壳都转成 dataTableOption.queryParam)。
179
+ // host:"list" 时不生效——列表宿主页自己加载模板,没有这条注入通道,编辑器里也已隐藏该项。
180
+ let queryParam = cfg.queryParamScript
181
+ ? ctx.vm.handleCustomEvent(cfg.queryParamScript, ["rowData"], [ctx.rowData])
182
+ : undefined;
176
183
  let onClose = (formRef, result) => {
177
184
  if (cfg.onCloseScript) {
178
185
  ctx.vm.handleCustomEvent(
@@ -202,6 +209,7 @@ export function openFormHost(ctx, mode) {
202
209
  host: cfg.host || undefined,
203
210
  title: cfg.title || undefined,
204
211
  param: param,
212
+ queryParam: queryParam,
205
213
  dataId: dataId, // null=新增态
206
214
  plain: !!cfg.plain,
207
215
  readonly: !!cfg.readonly,
@@ -229,6 +237,7 @@ export function openFormHost(ctx, mode) {
229
237
  formCode: formCode,
230
238
  host: cfg.host || undefined,
231
239
  param: param,
240
+ queryParam: queryParam,
232
241
  // v-bind 到 VFormRender 的 props,只放 props(禁止 param/formJson/formData)
233
242
  formConfig: dropUndefined({
234
243
  dataId: dataId,
@@ -51,12 +51,22 @@
51
51
  </template>
52
52
  </template>
53
53
 
54
+ <el-form-item label="查询参数" label-width="150px" v-if="!listHost">
55
+ <a href="javascript:void(0);" class="a-link link-oneLind"
56
+ @click="editEventHandler('queryParamScript', scriptParams, optionQueryParam)">
57
+ <span>{{ eventConfig.queryParamScript }}</span>
58
+ <i class="el-icon-edit"></i>
59
+ </a>
60
+ <span class="tips">脚本返回对象合并进目标表单查询表格的请求参数;按业务字段过滤写
61
+ <code>return {'{'} condition: {'{'} status: 1 {'}'} {'}'}</code>(追加进查询区条件,同字段以脚本为准)</span>
62
+ </el-form-item>
54
63
  <el-form-item label="自定义参数" label-width="150px">
55
64
  <a href="javascript:void(0);" class="a-link link-oneLind"
56
65
  @click="editEventHandler('paramScript', scriptParams, optionParam)">
57
66
  <span>{{ eventConfig.paramScript }}</span>
58
67
  <i class="el-icon-edit"></i>
59
68
  </a>
69
+ <span class="tips">脚本返回对象 → 目标表单的 param,只给模板脚本用,不参与请求</span>
60
70
  </el-form-item>
61
71
  <el-form-item label="只读">
62
72
  <el-switch v-model="eventConfig.readonly"></el-switch>
@@ -126,6 +136,7 @@ export default {
126
136
  return {
127
137
  optionFormCode: this.buildScriptOption("formCodeScript"),
128
138
  optionDataId: this.buildScriptOption("dataIdScript"),
139
+ optionQueryParam: this.buildScriptOption("queryParamScript"),
129
140
  optionParam: this.buildScriptOption("paramScript"),
130
141
  optionClose: this.buildScriptOption("onCloseScript"),
131
142
  // 脚本可用参数:dataId/formCode 由 getEventParam 统一注入,这里只列附加项
@@ -157,7 +168,9 @@ export default {
157
168
  return this.eventConfig[key];
158
169
  },
159
170
  callback: (code) => {
160
- this.eventConfig[key] = code;
171
+ // $set 而非直接赋值:存量模板的 formHostConfig 没有后加的字段(如 queryParamScript),
172
+ // 直接赋值不会变成响应式,编辑器里改完不刷新
173
+ this.$set(this.eventConfig, key, code);
161
174
  this.$forceUpdate();
162
175
  }
163
176
  };
@@ -21,6 +21,8 @@
21
21
  <span>{{ eventConfig.dialogQueryParam }}</span>
22
22
  <i class="el-icon-edit"></i>
23
23
  </a>
24
+ <span class="tips">按业务字段过滤写
25
+ <code>return {'{'} condition: {'{'} status: 1 {'}'} {'}'}</code>(追加进查询区条件,同字段以脚本为准)</span>
24
26
  </el-form-item>
25
27
  <el-form-item label="弹框自定义参数">
26
28
  <a href="javascript:void(0);" class="a-link link-oneLind"
@@ -25,6 +25,7 @@ import {
25
25
  applyColumnLabelIcon,
26
26
  resolveColumnRequiredFlag,
27
27
  } from "../../../../components/xform/utils/tableColumnHelper";
28
+ import { mergeQueryParam } from "../../../../components/xform/utils/queryParamUtil";
28
29
  import {
29
30
  buildCellRequiredHint,
30
31
  buildTableCellFormProp,
@@ -2609,8 +2610,10 @@ modules = {
2609
2610
 
2610
2611
  // let formRef = that.getFormRef();
2611
2612
  // let dataTableConfig = formRef.$attrs.dataTableOption || {};
2613
+ // 宿主(选择弹框/表单弹框/表单抽屉)注入的查询参数:condition 追加合并,
2614
+ // 其余键平铺覆盖,见 utils/queryParamUtil.js
2612
2615
  if (that.dataTableConfig.queryParam) {
2613
- Object.assign(queryParams, that.dataTableConfig.queryParam);
2616
+ mergeQueryParam(queryParams, that.dataTableConfig.queryParam);
2614
2617
  }
2615
2618
 
2616
2619
  let reqPath = typeof path === "function" ? path() : path;
@@ -754,6 +754,7 @@ import {
754
754
  markMaskedExportColumns,
755
755
  } from "../../../../components/xform/utils/textMaskUtil";
756
756
  import { extendDeeply } from "../../../../utils/index.js";
757
+ import { mergeQueryParam } from "../../../../components/xform/utils/queryParamUtil";
757
758
  import render from "../../../../views/user/bill_setting/render.vue";
758
759
 
759
760
  const baseRefUtil = {
@@ -1238,8 +1239,9 @@ export default {
1238
1239
  queryParams.searchCount = isQueryAllPage !== false;
1239
1240
  Object.assign(queryParams, param);
1240
1241
 
1242
+ // 与 PC 链路同规则:condition 追加合并,其余键平铺覆盖
1241
1243
  if (that.dataTableConfig.queryParam) {
1242
- Object.assign(queryParams, that.dataTableConfig.queryParam);
1244
+ mergeQueryParam(queryParams, that.dataTableConfig.queryParam);
1243
1245
  }
1244
1246
 
1245
1247
  return new Promise((resolve, reject) => {
@@ -0,0 +1,84 @@
1
+ /**
2
+ * 宿主注入查询表格的查询参数(dataTableOption.queryParam)合并规则。
3
+ *
4
+ * 查询表格发给后台的请求体形如:
5
+ * { condition: [{ field, value, filter }, ...], current, size, searchCount, ...其它平铺参数 }
6
+ * 其中 `condition` 由查询区字段按类型自动组装(见 data-table-mixin.js 的 getSearchFormData),
7
+ * 平铺参数则是给后台脚本(formScriptParam 那套约定)读的。
8
+ *
9
+ * 宿主(选择弹框 / 表单弹框 / 表单抽屉)传进来的 queryParam 此前是整体 Object.assign,
10
+ * 于是带 `condition` 的写法会把查询区当场输入的条件**整个覆盖掉**。这里把 `condition`
11
+ * 单独拿出来做追加合并,其余键保持原来的平铺覆盖语义。
12
+ *
13
+ * 使用方:data-table-mixin.js(PC)、list-h5-item.vue(H5)两条查询链路。
14
+ */
15
+
16
+ /** 未显式给 filter 时的默认比较符:数组按 in,其余按 eq(宿主条件是精确过滤,不该默认 like) */
17
+ function defaultFilter(value) {
18
+ return Array.isArray(value) ? "in" : "eq";
19
+ }
20
+
21
+ /**
22
+ * 把 condition 归一成 [{ field, value, filter }]。接受三种写法:
23
+ * 1. 数组:[{ field: "status", value: 1, filter: "eq" }](原生格式,filter 可省)
24
+ * 2. 对象简写:{ status: 1, type: ["A", "B"] } → filter 自动取 eq / in
25
+ * 3. 对象 + 比较符:{ createTime: { value: ["2026-01-01", "2026-12-31"], filter: "between" } }
26
+ * @param {Array|Object} condition
27
+ * @returns {Array} 归一后的条件项数组;无效输入返回空数组
28
+ */
29
+ export function normalizeCondition(condition) {
30
+ if (!condition) return [];
31
+ if (Array.isArray(condition)) {
32
+ return condition
33
+ .filter((item) => item && item.field)
34
+ .map((item) => ({
35
+ ...item,
36
+ filter: item.filter || defaultFilter(item.value),
37
+ }));
38
+ }
39
+ if (typeof condition !== "object") return [];
40
+ return Object.keys(condition).map((field) => {
41
+ let raw = condition[field];
42
+ // 只有「纯对象且带 value 键」才当成 {value, filter} 写法,避免把业务对象拆错
43
+ let isDetail
44
+ = raw
45
+ && typeof raw === "object"
46
+ && !Array.isArray(raw)
47
+ && Object.prototype.hasOwnProperty.call(raw, "value");
48
+ let value = isDetail ? raw.value : raw;
49
+ return {
50
+ field: field,
51
+ value: value,
52
+ filter: (isDetail && raw.filter) || defaultFilter(value),
53
+ };
54
+ });
55
+ }
56
+
57
+ /**
58
+ * 合并宿主 queryParam 到请求参数上(原地修改 queryParams 并返回它)。
59
+ * - `condition`:追加到查询区已组装的条件之后;**同 field 以宿主的为准**(先剔旧再追加),
60
+ * 这样宿主条件既不会被用户输入顶掉,也不会和用户输入同字段撞成两条。
61
+ * - 其余键:平铺覆盖(与改造前一致)。
62
+ * @param {Object} queryParams 查询表格已组装好的请求参数
63
+ * @param {Object} queryParam 宿主注入的查询参数
64
+ * @returns {Object} queryParams
65
+ */
66
+ export function mergeQueryParam(queryParams, queryParam) {
67
+ if (!queryParams || !queryParam) return queryParams;
68
+
69
+ let hostCondition = normalizeCondition(queryParam.condition);
70
+ Object.keys(queryParam).forEach((key) => {
71
+ if (key !== "condition") queryParams[key] = queryParam[key];
72
+ });
73
+
74
+ if (!hostCondition.length) return queryParams;
75
+
76
+ let hostFields = hostCondition.map((item) => item.field);
77
+ let baseCondition = Array.isArray(queryParams.condition)
78
+ ? queryParams.condition.filter(
79
+ (item) => !item || hostFields.indexOf(item.field) < 0
80
+ )
81
+ : [];
82
+ queryParams.condition = baseCondition.concat(hostCondition);
83
+ return queryParams;
84
+ }