ocpview-pro 0.1.10 → 0.1.12
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/dist/index.js +61 -3
- package/dist/ocpviewplus.min.js +16 -16
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/label/showtext.vue +1 -0
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTable.vue +2 -0
- package/src/components/masterplate/RewriteBillListDetails/BillListPanelTable.vue +68 -0
package/package.json
CHANGED
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
:height="tableHeight"
|
|
25
25
|
:max-height="tableMaxHeight"
|
|
26
26
|
:loading="loading"
|
|
27
|
+
:show-footer="myConfig.showSummary"
|
|
28
|
+
:footer-method="footerMethod"
|
|
27
29
|
:sort-config="{ remote: true, trigger: 'cell' }"
|
|
28
30
|
:column-config="{ useKey: true }"
|
|
29
31
|
:row-config="{ useKey: true }"
|
|
@@ -343,6 +345,14 @@ export default {
|
|
|
343
345
|
this.myConfig.pageConfig.page_size,
|
|
344
346
|
};
|
|
345
347
|
},
|
|
348
|
+
/**
|
|
349
|
+
* 需要合计的字段列表
|
|
350
|
+
*/
|
|
351
|
+
sumFields() {
|
|
352
|
+
return this.tableColumns
|
|
353
|
+
.filter((item) => item.summary)
|
|
354
|
+
.map((item) => item.name);
|
|
355
|
+
},
|
|
346
356
|
},
|
|
347
357
|
methods: {
|
|
348
358
|
/**
|
|
@@ -400,6 +410,64 @@ export default {
|
|
|
400
410
|
}
|
|
401
411
|
return {};
|
|
402
412
|
},
|
|
413
|
+
/**
|
|
414
|
+
* vxe-grid 合计行渲染
|
|
415
|
+
* 优先使用服务端返回的 total_summary,不存在时从当前页数据计算
|
|
416
|
+
*/
|
|
417
|
+
footerMethod({ columns }) {
|
|
418
|
+
const sumSub = 0;
|
|
419
|
+
return [
|
|
420
|
+
columns.map((column) => {
|
|
421
|
+
if (column.index === sumSub) {
|
|
422
|
+
return this.myConfig.sumText;
|
|
423
|
+
}
|
|
424
|
+
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
|
+
return this.$Method.formatNumber(
|
|
436
|
+
rawValue,
|
|
437
|
+
format,
|
|
438
|
+
notzero
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
// 服务端无合计时从当前页数据计算
|
|
442
|
+
const sumData = this.handleSumField({
|
|
443
|
+
list: this.tempData,
|
|
444
|
+
field: column.field,
|
|
445
|
+
});
|
|
446
|
+
const columnConfig = this.tableColumns.find(
|
|
447
|
+
(c) => c.name === column.field
|
|
448
|
+
);
|
|
449
|
+
const format = columnConfig?.format;
|
|
450
|
+
const notzero = columnConfig?.notzero;
|
|
451
|
+
return this.$Method.formatNumber(
|
|
452
|
+
sumData,
|
|
453
|
+
format,
|
|
454
|
+
notzero
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}),
|
|
459
|
+
];
|
|
460
|
+
},
|
|
461
|
+
handleSumField(params) {
|
|
462
|
+
const { list, field } = params;
|
|
463
|
+
let count = 0;
|
|
464
|
+
list.forEach((item) => {
|
|
465
|
+
count = this.$utils.add(count, item[field]);
|
|
466
|
+
});
|
|
467
|
+
// 修复 -0 显示为 -0.00 的问题
|
|
468
|
+
if (count === 0) count = 0;
|
|
469
|
+
return count;
|
|
470
|
+
},
|
|
403
471
|
},
|
|
404
472
|
mounted() {
|
|
405
473
|
// console.log("我继承覆写了22222", this.myConfig);
|