diff --git a/src/views/reportforms/SalesDepartmentIncomeReport.vue b/src/views/reportforms/SalesDepartmentIncomeReport.vue index f235f0c0..2e88bb5c 100644 --- a/src/views/reportforms/SalesDepartmentIncomeReport.vue +++ b/src/views/reportforms/SalesDepartmentIncomeReport.vue @@ -620,20 +620,25 @@ const handleJumpDetail = (row, column) => { // 年 console.log('details.query.year :>> ', details.query.year); + const formatDate = date => { + console.log('date :>> ', date); + const y = date.getFullYear(); + const m = String(date.getMonth() + 1).padStart(2, '0'); // 月份补零 + const d = String(date.getDate()).padStart(2, '0'); // 日期补零 + return `${y}-${m}-${d}`; + }; + if (details.query.year) { - query.startTimeStr = details.query.year + '-01-01'; - query.endTimeStr = details.query.year + '-12-31'; - } else if (details.query.month) { - const formatDate = date => { - console.log('date :>> ', date); - const y = date.getFullYear(); - const m = String(date.getMonth() + 1).padStart(2, '0'); // 月份补零 - const d = String(date.getDate()).padStart(2, '0'); // 日期补零 - return `${y}-${m}-${d}`; - }; + const month = [details.query.year, row.yue]; + query.startTimeStr = + details.query.year + '-' + (Number(row.yue) >= 10 ? row.yue : '0' + row.yue) + '-01'; + query.endTimeStr = formatDate(new Date(month[0], Number(month[1]), 0)); + // // yue + // query.startTimeStr = details.query.year + '-01-01'; + // query.endTimeStr = details.query.year + '-12-31'; + } else if (details.query.month) { const month = details.query.month.split('-'); - console.log('month :>> ', month); query.startTimeStr = details.query.month + '-01'; query.endTimeStr = formatDate(new Date(month[0], Number(month[1]), 0)); console.log('query.endTimeStr :>> ', query.endTimeStr);