ocpview-pro 0.1.14 → 0.1.16
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
|
@@ -239,13 +239,20 @@
|
|
|
239
239
|
</template>
|
|
240
240
|
<script>
|
|
241
241
|
import simpleviewgrid from "../simpleviewgrid.vue";
|
|
242
|
+
import viewgridbase from "../../grid/viewgridbase.vue";
|
|
242
243
|
|
|
243
244
|
export default {
|
|
244
245
|
name: "BillListPanelTable",
|
|
245
246
|
extends: simpleviewgrid,
|
|
246
247
|
data() {
|
|
247
|
-
return {
|
|
248
|
+
return {
|
|
249
|
+
/**
|
|
250
|
+
* 用户配置的 showSummary 原始值,避免被 viewgridbase 自动切换
|
|
251
|
+
*/
|
|
252
|
+
userShowSummary: undefined,
|
|
253
|
+
};
|
|
248
254
|
},
|
|
255
|
+
watch: {},
|
|
249
256
|
computed: {
|
|
250
257
|
/**
|
|
251
258
|
* 表格列定义清洗
|
|
@@ -355,6 +362,52 @@ export default {
|
|
|
355
362
|
},
|
|
356
363
|
},
|
|
357
364
|
methods: {
|
|
365
|
+
/**
|
|
366
|
+
* 【覆写】列表页合计不请求后端,拦截搜索参数移除 summary_fld
|
|
367
|
+
*/
|
|
368
|
+
getSearchParam(obj, flag) {
|
|
369
|
+
// 调用父类 viewgridbase.getSearchParam 拼接完整参数
|
|
370
|
+
const result = viewgridbase.methods.getSearchParam.call(this, obj, flag);
|
|
371
|
+
// 移除 summary_fld — 列表页合计由前端从 tempData 计算
|
|
372
|
+
if (result && result.summary_fld) {
|
|
373
|
+
delete result.summary_fld;
|
|
374
|
+
}
|
|
375
|
+
return result;
|
|
376
|
+
},
|
|
377
|
+
/**
|
|
378
|
+
* 【覆写】列表页合计不由后端决定,恢复用户 showSummary 配置
|
|
379
|
+
*/
|
|
380
|
+
refurbishSucceedDefault() {
|
|
381
|
+
// 父类 viewgridbase.refurbishSucceedDefault 的完整逻辑,去掉合计行自动切换
|
|
382
|
+
this.sumGroupNum = 0;
|
|
383
|
+
if (this.dynamicInitData && this.dynamicInitData[this.myConfig.response]) {
|
|
384
|
+
if (this.myConfig.showAll) {
|
|
385
|
+
if (this.myConfig.rowAll) {
|
|
386
|
+
this.dynamicInitData[this.myConfig.response].splice(0, 0, this.myConfig.rowAll);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
let data = [];
|
|
390
|
+
if (this.myConfig.overrideData) {
|
|
391
|
+
data = this.myConfig.overrideData(this.dynamicInitData[this.myConfig.response]);
|
|
392
|
+
} else {
|
|
393
|
+
data = this.dynamicInitData[this.myConfig.response];
|
|
394
|
+
}
|
|
395
|
+
if (this.dynamicInitData.sumgroups) {
|
|
396
|
+
data = this.doSumgroups(data, this.dynamicInitData.sumgroups);
|
|
397
|
+
}
|
|
398
|
+
this.data = data;
|
|
399
|
+
this.tempData = this.$Method.copy(data);
|
|
400
|
+
}
|
|
401
|
+
if (this.dynamicInitData.total_results !== undefined) {
|
|
402
|
+
this.myConfig.pageConfig.total_results = Number(this.dynamicInitData.total_results);
|
|
403
|
+
}
|
|
404
|
+
// 列表页合计由前端从 tempData 计算,不依赖后端 total_summary
|
|
405
|
+
this.total_summary = {};
|
|
406
|
+
// 恢复用户配置的 showSummary,不被后端总控
|
|
407
|
+
if (this.userShowSummary !== undefined) {
|
|
408
|
+
this.myConfig.showSummary = this.userShowSummary;
|
|
409
|
+
}
|
|
410
|
+
},
|
|
358
411
|
/**
|
|
359
412
|
* 【覆写】获取多选数据事件
|
|
360
413
|
*/
|
|
@@ -411,8 +464,7 @@ export default {
|
|
|
411
464
|
return {};
|
|
412
465
|
},
|
|
413
466
|
/**
|
|
414
|
-
* vxe-grid 合计行渲染
|
|
415
|
-
* 优先使用服务端返回的 total_summary,不存在时从当前页数据计算
|
|
467
|
+
* vxe-grid 合计行渲染 — 纯前端从当前页 tempData 计算
|
|
416
468
|
*/
|
|
417
469
|
footerMethod({ columns }) {
|
|
418
470
|
const sumSub = 0;
|
|
@@ -422,25 +474,6 @@ export default {
|
|
|
422
474
|
return this.myConfig.sumText;
|
|
423
475
|
}
|
|
424
476
|
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
477
|
const sumData = this.handleSumField({
|
|
445
478
|
list: this.tempData,
|
|
446
479
|
field: column.field,
|
|
@@ -450,14 +483,14 @@ export default {
|
|
|
450
483
|
);
|
|
451
484
|
const format = columnConfig?.format;
|
|
452
485
|
const notzero = columnConfig?.notzero;
|
|
453
|
-
const
|
|
486
|
+
const result = this.$Method.formatNumber(
|
|
454
487
|
sumData,
|
|
455
488
|
format,
|
|
456
489
|
notzero
|
|
457
490
|
);
|
|
458
491
|
// 修复 -0.00 显示问题
|
|
459
|
-
if (
|
|
460
|
-
return
|
|
492
|
+
if (result === '-0.00' || result === '-0') return '0.00';
|
|
493
|
+
return result;
|
|
461
494
|
}
|
|
462
495
|
return null;
|
|
463
496
|
}),
|
|
@@ -477,6 +510,10 @@ export default {
|
|
|
477
510
|
mounted() {
|
|
478
511
|
// console.log("我继承覆写了22222", this.myConfig);
|
|
479
512
|
},
|
|
513
|
+
created() {
|
|
514
|
+
// 保存用户原始 showSummary 配置,避免被 viewgridbase.refurbishSucceedDefault 自动切换
|
|
515
|
+
this.userShowSummary = this.config?.showSummary;
|
|
516
|
+
},
|
|
480
517
|
};
|
|
481
518
|
</script>
|
|
482
519
|
|