应收账款等4个新增页面

This commit is contained in:
2026-04-03 16:14:28 +08:00
parent 9d91188b98
commit ed0fd63474
33 changed files with 140 additions and 201 deletions

View File

@@ -51,16 +51,14 @@ export default {
// 遍历传入的 trendData 数组(响应式依赖,变化时自动重算)
this.trendData.forEach((item) => {
// 1. 格式化时间并推入时间数组
const yearMonth = this.formatTimeToYearMonth(item.time);
timeArr.push(yearMonth);
timeArr.push(item.title);
// 2. 提取其他字段兜底为0防止null/undefined影响图表渲染
valueArr.push(item.value ?? 0);
diffValueArr.push(item.diffValue ?? 0);
targetValueArr.push(item.targetValue ?? 0);
proportionArr.push(item.proportion ?? 0);
completedArr.push(item.completed ?? 0);
valueArr.push(item.real ?? 0);
diffValueArr.push(item.diff ?? 0);
targetValueArr.push(item.budget ?? 0);
proportionArr.push(item.rate ?? 0);
completedArr.push(item.rate && item.rate>=100 ? 1 : 0);
});
// 组装并返回格式化后的数据(结构与原一致)
@@ -81,15 +79,6 @@ export default {
* @param {Number} timestamp 13位毫秒级时间戳
* @returns {String} 格式化后的年月字符串2025-10
*/
formatTimeToYearMonth(timestamp) {
if (!timestamp || isNaN(timestamp)) {
return ""; // 容错:非有效时间戳返回空字符串
}
const date = new Date(timestamp);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始补0至2位
return `${year}-${month}`;
},
getData(value) {
this.$emit('getData', value)
},