ocpview-pro 0.1.33 → 0.1.36

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ocpview-pro",
3
- "version": "0.1.33",
3
+ "version": "0.1.36",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -7,7 +7,6 @@ import {
7
7
  buildExportSearchParam,
8
8
  buildSummaryRow,
9
9
  buildSummaryMap,
10
- collectSummaryFields,
11
10
  translateDictValues,
12
11
  DEFAULT_EXPORT_PAGE_SIZE
13
12
  } from '@/method/listexport';
@@ -59,13 +58,7 @@ export default {
59
58
  dynamicColumnItems:[],
60
59
  tempMultiSelectData:[],
61
60
  multiSoltTableColumns:[],
62
- showHelpBtn:false,
63
- /**
64
- * 业务侧显式配置的 showSummary(undefined 表示"没配")。
65
- * 用于区分"没配"与"显式关闭":没配时由列上的 sum: true 自动开启合计行,
66
- * 显式 false 时即使有 sum 列也不显示合计。
67
- */
68
- userShowSummary: undefined
61
+ showHelpBtn:false
69
62
  };
70
63
  },
71
64
  computed:{
@@ -285,65 +278,24 @@ export default {
285
278
  if (this.dynamicInitData.total_results !== undefined) {
286
279
  this.myConfig.pageConfig.total_results= Number(this.dynamicInitData.total_results);
287
280
  }
288
- // 合计行显示与否统一在这里裁决:业务侧只需在列上写 sum: true,
289
- // 不必再配 showSummary(显式 showSummary: false 可强制关闭)。
290
281
  if (this.dynamicInitData.total_summary !== undefined) {
291
- // 后端合计(报表链路):后端给了合计就是权威,直接展示
292
282
  this.total_summary = Object.assign({}, {}, this.dynamicInitData.total_summary);
293
- Object.assign(this.myConfig,{'showSummary':true});
283
+ if (!this.myConfig.showSummary) {
284
+ Object.assign(this.myConfig,{'showSummary':true});
285
+ }
294
286
  } else {
295
287
  // 前端合计:列上用 sum: true 标记时,合计由前端从当前页数据计算,
296
288
  // 既不依赖后端 total_summary,也不把字段塞进查询参数
297
289
  // (见 getFrontendSummaryFields / buildFrontendSummary)。
298
- let frontendSummary = this.calcFrontendSummary();
299
- let userShowSummary = this.getUserShowSummary();
300
- if (frontendSummary && userShowSummary !== false) {
290
+ let frontendSummary = this.myConfig.showSummary ? this.buildFrontendSummary() : null;
291
+ if (frontendSummary) {
301
292
  this.total_summary = frontendSummary;
302
293
  Object.assign(this.myConfig,{'showSummary':true});
303
- } else if (userShowSummary === false) {
304
- // 业务显式关闭合计:清掉可能残留的合计值并隐藏合计行
305
- this.total_summary = {};
306
- Object.assign(this.myConfig,{'showSummary':false});
307
- } else if (this.myConfig.showSummary && this.myConfig.customSummary) {
308
- // 纯自定义合计:没有 sum 列时也保留合计行,由 customSummary 自行填值
309
- this.total_summary = {};
310
294
  } else if (this.myConfig.showSummary) {
311
- this.total_summary = {};
312
295
  Object.assign(this.myConfig,{'showSummary':false});
313
296
  }
314
297
  }
315
298
  },
316
- /**
317
- * 业务侧显式配置的 showSummary:undefined 表示"没配"。
318
- * 只有显式 false 才阻止 sum 列自动开启合计行。
319
- */
320
- getUserShowSummary() {
321
- if (this.userShowSummary !== undefined) {
322
- return this.userShowSummary;
323
- }
324
- if (this.config && this.config.showSummary !== undefined) {
325
- return this.config.showSummary;
326
- }
327
- return undefined;
328
- },
329
- /**
330
- * 前端合计计算兜底:合计只是锦上添花,任何异常都不允许影响列表正常
331
- * 加载(refurbishSucceedDefault 在请求回调里执行,抛错会导致 loading
332
- * 卡住、数据不渲染)。最坏表现 = 没有合计行。
333
- */
334
- calcFrontendSummary() {
335
- try {
336
- if (this.dynamicInitData.sumgroups) {
337
- // 小计链路里 tempData 混有分组小计行,前端再求和会重复计数,
338
- // 该链路的合计仍由后端 total_summary 提供
339
- return null;
340
- }
341
- return this.buildFrontendSummary();
342
- } catch (e) {
343
- console.warn('[ocpview-pro] 前端合计计算失败,本次查询已跳过合计行:', e);
344
- return null;
345
- }
346
- },
347
299
  callBackChangePage(flag ,newvalue, oldvale) {
348
300
  if (!flag) {
349
301
  this.$nextTick(() => {
@@ -606,12 +558,20 @@ export default {
606
558
  * summaryColumn,进而被 getSearchParam 拼成 summary_fld 发给后端 —— 而后端
607
559
  * StorageUtils 的豁免名单不含 summary_fld,会被当成 WHERE 条件拼进 SQL 而报错。
608
560
  * sum 不进查询参数,合计一律由前端从当前页数据计算。
609
- *
610
- * 列上写了 sum: true 即视为业务要合计,合计行由 refurbishSucceedDefault 自动开启,
611
- * 业务侧无需再配 showSummary。
612
561
  */
613
562
  getFrontendSummaryFields() {
614
- return collectSummaryFields(this.myConfig.items);
563
+ let fields = [];
564
+ const collect = (items) => {
565
+ (items || []).forEach(el => {
566
+ if (el.children && el.children.length > 0) {
567
+ collect(el.children);
568
+ } else if (el.sum === true && el.name) {
569
+ fields.push(el.name);
570
+ }
571
+ });
572
+ };
573
+ collect(this.myConfig.items);
574
+ return fields;
615
575
  },
616
576
  /**
617
577
  * 前端合计:从当前页数据(tempData)求和,返回 { field: number }。
@@ -1194,9 +1154,7 @@ export default {
1194
1154
  if (this.myConfig.dynamicColumnFlag) {
1195
1155
  items = this.dynamicColumnItems;
1196
1156
  } else {
1197
- // 与 getFrontendSummaryFields 取同一份列配置(myConfig.items),
1198
- // 保证合计值一定能在列上找到 format 并正确格式化
1199
- items = this.myConfig.items || (this.config && this.config.items);
1157
+ items = this.config.items;
1200
1158
  }
1201
1159
  for (let pro in this.total_summary) {
1202
1160
  let configItems = {};
@@ -19,7 +19,6 @@
19
19
  <AppendixBoxs v-if="!temp.isHead && temp.el.type === 'AppendixBox'" :ref="temp.el.name" :config="temp.el" :modulecode="modulecode" @doAction="doAction"/>
20
20
  <FormCardBox2 v-if="!temp.isHead && temp.el.type === 'FormCardBox2'" :ref="temp.el.name" :config="temp.el" :dictData="dictData"/>
21
21
  <AppendixBoxs2 v-if="!temp.isHead && temp.el.type === 'AppendixBox2'" :ref="temp.el.name" :config="temp.el" :dictData="dictData" :modulecode="modulecode" @handleSuccessAfter="handleSuccessAfter" @doAction="doAction"/>
22
- <EditGridBoxs v-if="temp2.type === 'EditGridBox'" :ref="temp2.name" :config="temp2" :dictData="dictData" @doAction="doAction"/>
23
22
  </div>
24
23
  </div>
25
24
  </Card>
@@ -34,10 +33,9 @@ import AppendixBoxs2 from './contractappendix.vue';
34
33
  import FormCardBox2 from '../form/formcardbox2.vue';
35
34
  import random from '../../utils/random_str';
36
35
  import Formcard from './formcard.vue';
37
- import EditGridBoxs from './editgridcard.vue';
38
36
  export default {
39
37
  name:'mbilldetailform',
40
- components:{AppendixBoxs2, Formcard,EditGridCardS,DetailsBoxs,AppendixBoxs,FormCardBox2,EditGridBoxs},
38
+ components:{AppendixBoxs2, Formcard,EditGridCardS,DetailsBoxs,AppendixBoxs,FormCardBox2},
41
39
  data () {
42
40
  return {
43
41
  curlEditObject:'',
@@ -75,7 +75,7 @@ export default {
75
75
  showModuleCode:false,
76
76
  moreFlag:false,
77
77
  btnItems:[],
78
- ignoreModule:['downTemplate','listExport'],
78
+ ignoreModule:['downTemplate'],
79
79
  notpowerFlag:true,
80
80
  billoperlog:false,
81
81
  };
@@ -25,7 +25,6 @@ import BillDetailForm from './billdetailform.vue';
25
25
  import ApprovalBox from './approval.vue';
26
26
  import BillOperLog from './operlog.vue';
27
27
  import load from '@/components/base/load';
28
- import { LIST_EXPORT_ACTION } from '@/method/listexport';
29
28
  export default {
30
29
  name:'mlistdetails',
31
30
  mixins: [load],
@@ -112,7 +111,6 @@ export default {
112
111
  this.myConfig.billQueryConfig.addDataflag = 'Y';
113
112
  }
114
113
  });
115
- this.injectListExportBtn();
116
114
 
117
115
 
118
116
 
@@ -228,38 +226,7 @@ export default {
228
226
  }
229
227
  });
230
228
  },
231
- /**
232
- * 通用注入「列表导出」按钮。
233
- * ListDetails / ListDetailsV2 / ListDetailsV3 均 extends 本组件,故一处注入三处生效。
234
- * 页面已在 menuToolbar.items 自行声明同名按钮时不重复注入;
235
- * exportConfig.enabled === false 时不注入。
236
- */
237
- injectListExportBtn() {
238
- const gridConfig = this.myConfig.billQueryConfig.gridConfig;
239
- const exportConfig = gridConfig.exportConfig || {};
240
- if (exportConfig.enabled === false) {
241
- return;
242
- }
243
- const exists = this.myConfig.billQueryConfig.btnData.some(el => el.name === LIST_EXPORT_ACTION);
244
- if (exists) {
245
- return;
246
- }
247
- this.myConfig.billQueryConfig.btnData.push({
248
- name: LIST_EXPORT_ACTION,
249
- text: this.$t('列表导出'),
250
- btntype: 'batch'
251
- });
252
- },
253
229
  doAction (obj) {
254
- if (obj.name === LIST_EXPORT_ACTION) {
255
- // 页面覆盖优先:沿用框架既有钩子约定(同 setBillData / initFormAfter)
256
- if (this.$parent && typeof this.$parent[LIST_EXPORT_ACTION] === 'function') {
257
- this.$parent[LIST_EXPORT_ACTION](obj);
258
- } else {
259
- this.$refs.billqureygrid.getGrid().listExport();
260
- }
261
- return true;
262
- }
263
230
  if (obj.name === 'gridSelectionChange' ) {
264
231
  if (this.$parent[obj.name]) {
265
232
  this.$parent[obj.name](obj);
@@ -66,7 +66,6 @@ export default {
66
66
  '加签': 'Add Signer',
67
67
  '加粗': 'Bold',
68
68
  '加载': 'Loading',
69
- '合计': 'Total',
70
69
  '动态合计': 'Dynamic Sum',
71
70
  '包含': 'Contains',
72
71
  '单据主健信息为空,不允许上传': 'Bill primary key is empty, upload not allowed',
@@ -66,7 +66,6 @@ export default {
66
66
  '加签': '加签',
67
67
  '加粗': '加粗',
68
68
  '加载': '加载',
69
- '合计': '合计',
70
69
  '动态合计': '动态合计',
71
70
  '包含': '包含',
72
71
  '单据主健信息为空,不允许上传': '单据主健信息为空,不允许上传',
@@ -66,7 +66,6 @@ export default {
66
66
  '加签': '加簽',
67
67
  '加粗': '加粗',
68
68
  '加载': '加載',
69
- '合计': '合計',
70
69
  '动态合计': '動態合計',
71
70
  '包含': '包含',
72
71
  '单据主健信息为空,不允许上传': '單據主鍵信息為空,不允許上傳',
@@ -49,42 +49,13 @@ export function toNumber(value) {
49
49
  return Number.isFinite(n) ? n : 0;
50
50
  }
51
51
 
52
- /**
53
- * 收集列配置上标记 sum: true 的字段名(前端合计字段)。
54
- *
55
- * 支持多级表头的 children;跳过 visible: false 的列,避免"表头设计里隐藏的列"
56
- * 出现在合计行。与后端合计标记 summary: true 无关(后者会下发 summary_fld)。
57
- *
58
- * @param {object[]} items 列配置(gridConfig.items)
59
- * @returns {string[]} 参与合计的字段名
60
- */
61
- export function collectSummaryFields(items) {
62
- const fields = [];
63
- const collect = (list) => {
64
- // 组件库场景:items / children 可能来自后端或用户配置,非数组一律安全跳过
65
- if (!Array.isArray(list)) {
66
- return;
67
- }
68
- list.forEach(el => {
69
- if (!el || typeof el !== 'object' || el.visible === false) {
70
- return;
71
- }
72
- if (Array.isArray(el.children) && el.children.length > 0) {
73
- collect(el.children);
74
- } else if (el.sum === true && el.name) {
75
- fields.push(el.name);
76
- }
77
- });
78
- };
79
- collect(items);
80
- return fields;
81
- }
82
-
83
52
  /**
84
53
  * 构造合计行。返回的普通对象可直接 push 进导出数据末尾 ——
85
54
  * exportExcelStyle 会按列顺序从对象上取值,因此无需改动导出器本身。
86
55
  * @param {object[]} rows 参与合计的数据行
87
56
  * @param {string[]} summaryFields 参与合计的字段名
57
+ * @param {string} firstColumnName 第一列字段名,用于写"合计"文案
58
+ * @param {string} sumText 合计文案
88
59
  * @returns {object}
89
60
  */
90
61
  export function buildSummaryMap(rows, summaryFields) {