ocpview-pro 0.1.13 → 0.1.15
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
|
@@ -244,7 +244,22 @@ export default {
|
|
|
244
244
|
name: "BillListPanelTable",
|
|
245
245
|
extends: simpleviewgrid,
|
|
246
246
|
data() {
|
|
247
|
-
return {
|
|
247
|
+
return {
|
|
248
|
+
/**
|
|
249
|
+
* 用户配置的 showSummary 原始值,避免被 viewgridbase 自动切换
|
|
250
|
+
*/
|
|
251
|
+
userShowSummary: undefined,
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
watch: {
|
|
255
|
+
/**
|
|
256
|
+
* 列表页合计由前端计算,不清除 summaryColumn 会导致自动拼接 summary_fld 请求后端
|
|
257
|
+
*/
|
|
258
|
+
summaryColumn(val) {
|
|
259
|
+
if (val && val.length > 0) {
|
|
260
|
+
this.summaryColumn = [];
|
|
261
|
+
}
|
|
262
|
+
},
|
|
248
263
|
},
|
|
249
264
|
computed: {
|
|
250
265
|
/**
|
|
@@ -355,6 +370,40 @@ export default {
|
|
|
355
370
|
},
|
|
356
371
|
},
|
|
357
372
|
methods: {
|
|
373
|
+
/**
|
|
374
|
+
* 【覆写】列表页合计不由后端决定,恢复用户 showSummary 配置
|
|
375
|
+
*/
|
|
376
|
+
refurbishSucceedDefault() {
|
|
377
|
+
// 父类 viewgridbase.refurbishSucceedDefault 的完整逻辑,去掉合计行自动切换
|
|
378
|
+
this.sumGroupNum = 0;
|
|
379
|
+
if (this.dynamicInitData && this.dynamicInitData[this.myConfig.response]) {
|
|
380
|
+
if (this.myConfig.showAll) {
|
|
381
|
+
if (this.myConfig.rowAll) {
|
|
382
|
+
this.dynamicInitData[this.myConfig.response].splice(0, 0, this.myConfig.rowAll);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
let data = [];
|
|
386
|
+
if (this.myConfig.overrideData) {
|
|
387
|
+
data = this.myConfig.overrideData(this.dynamicInitData[this.myConfig.response]);
|
|
388
|
+
} else {
|
|
389
|
+
data = this.dynamicInitData[this.myConfig.response];
|
|
390
|
+
}
|
|
391
|
+
if (this.dynamicInitData.sumgroups) {
|
|
392
|
+
data = this.doSumgroups(data, this.dynamicInitData.sumgroups);
|
|
393
|
+
}
|
|
394
|
+
this.data = data;
|
|
395
|
+
this.tempData = this.$Method.copy(data);
|
|
396
|
+
}
|
|
397
|
+
if (this.dynamicInitData.total_results !== undefined) {
|
|
398
|
+
this.myConfig.pageConfig.total_results = Number(this.dynamicInitData.total_results);
|
|
399
|
+
}
|
|
400
|
+
// 列表页合计由前端从 tempData 计算,不依赖后端 total_summary
|
|
401
|
+
this.total_summary = {};
|
|
402
|
+
// 恢复用户配置的 showSummary,不被后端总控
|
|
403
|
+
if (this.userShowSummary !== undefined) {
|
|
404
|
+
this.myConfig.showSummary = this.userShowSummary;
|
|
405
|
+
}
|
|
406
|
+
},
|
|
358
407
|
/**
|
|
359
408
|
* 【覆写】获取多选数据事件
|
|
360
409
|
*/
|
|
@@ -411,8 +460,7 @@ export default {
|
|
|
411
460
|
return {};
|
|
412
461
|
},
|
|
413
462
|
/**
|
|
414
|
-
* vxe-grid 合计行渲染
|
|
415
|
-
* 优先使用服务端返回的 total_summary,不存在时从当前页数据计算
|
|
463
|
+
* vxe-grid 合计行渲染 — 纯前端从当前页 tempData 计算
|
|
416
464
|
*/
|
|
417
465
|
footerMethod({ columns }) {
|
|
418
466
|
const sumSub = 0;
|
|
@@ -422,25 +470,6 @@ export default {
|
|
|
422
470
|
return this.myConfig.sumText;
|
|
423
471
|
}
|
|
424
472
|
if (this.sumFields.includes(column.field)) {
|
|
425
|
-
// 优先使用服务端合计
|
|
426
|
-
const serverValue = this.total_summary[column.field];
|
|
427
|
-
if (serverValue !== undefined) {
|
|
428
|
-
const columnConfig = this.tableColumns.find(
|
|
429
|
-
(c) => c.name === column.field
|
|
430
|
-
);
|
|
431
|
-
const format = columnConfig?.format;
|
|
432
|
-
const notzero = columnConfig?.notzero;
|
|
433
|
-
// 修复 -0 显示为 -0.00 的问题
|
|
434
|
-
const rawValue = (serverValue === 0) ? 0 : serverValue;
|
|
435
|
-
const result = this.$Method.formatNumber(
|
|
436
|
-
rawValue,
|
|
437
|
-
format,
|
|
438
|
-
notzero
|
|
439
|
-
);
|
|
440
|
-
if (result === '-0.00' || result === '-0') return '0.00';
|
|
441
|
-
return result;
|
|
442
|
-
}
|
|
443
|
-
// 服务端无合计时从当前页数据计算
|
|
444
473
|
const sumData = this.handleSumField({
|
|
445
474
|
list: this.tempData,
|
|
446
475
|
field: column.field,
|
|
@@ -450,14 +479,14 @@ export default {
|
|
|
450
479
|
);
|
|
451
480
|
const format = columnConfig?.format;
|
|
452
481
|
const notzero = columnConfig?.notzero;
|
|
453
|
-
const
|
|
482
|
+
const result = this.$Method.formatNumber(
|
|
454
483
|
sumData,
|
|
455
484
|
format,
|
|
456
485
|
notzero
|
|
457
486
|
);
|
|
458
487
|
// 修复 -0.00 显示问题
|
|
459
|
-
if (
|
|
460
|
-
return
|
|
488
|
+
if (result === '-0.00' || result === '-0') return '0.00';
|
|
489
|
+
return result;
|
|
461
490
|
}
|
|
462
491
|
return null;
|
|
463
492
|
}),
|
|
@@ -477,6 +506,10 @@ export default {
|
|
|
477
506
|
mounted() {
|
|
478
507
|
// console.log("我继承覆写了22222", this.myConfig);
|
|
479
508
|
},
|
|
509
|
+
created() {
|
|
510
|
+
// 保存用户原始 showSummary 配置,避免被 viewgridbase.refurbishSucceedDefault 自动切换
|
|
511
|
+
this.userShowSummary = this.config?.showSummary;
|
|
512
|
+
},
|
|
480
513
|
};
|
|
481
514
|
</script>
|
|
482
515
|
|