|
@@ -129,7 +129,7 @@
|
|
|
<div class="cr-b1">
|
|
|
<div class="r1-sort">
|
|
|
<el-date-picker
|
|
|
- @change="getVegeExpect"
|
|
|
+ @change="changeYearMonth"
|
|
|
v-model="sort_scbz.yearMonth"
|
|
|
type="month"
|
|
|
placeholder="选择月"
|
|
@@ -657,6 +657,11 @@ export default {
|
|
|
list_jyzt: [],
|
|
|
list_jyzt_total: 0,
|
|
|
clqs: [],
|
|
|
+
|
|
|
+ scxl_time: {
|
|
|
+ startTime: "",
|
|
|
+ endTime: "",
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -784,6 +789,18 @@ export default {
|
|
|
new Date(today.valueOf() - 30 * 24 * 3600 * 1000),
|
|
|
"yyyy-MM-dd"
|
|
|
);
|
|
|
+
|
|
|
+ const thisYear = today.getFullYear();
|
|
|
+ const thisMonth = today.getMonth();
|
|
|
+ let lastMonth = thisMonth - 1;
|
|
|
+ const lastYear = lastMonth === -1 ? thisYear - 1 : thisYear;
|
|
|
+ lastMonth = lastMonth === -1 ? 12 : lastMonth
|
|
|
+ console.log(lastYear,lastMonth);
|
|
|
+
|
|
|
+ const firstDayOfLastMonth = new Date(lastYear, lastMonth, 1); // 获取上个月的第一天
|
|
|
+ const lastDayOfLastMonth = new Date(firstDayOfLastMonth.getTime() - 86400000); // 获取上个月的最后一天
|
|
|
+ this.scxl_time.startTime = lastYear + "-" + lastMonth + "-01"
|
|
|
+ this.scxl_time.endTime = formatDate(lastDayOfLastMonth,"yyyy-MM-dd")
|
|
|
},
|
|
|
getAllTownList(){
|
|
|
getSnkdcAllTown().then(res => {
|
|
@@ -819,6 +836,17 @@ export default {
|
|
|
this.tableData_vegeInOut = res.obj.list || [];
|
|
|
});
|
|
|
},
|
|
|
+ changeYearMonth(){
|
|
|
+ this.getVegeExpect()
|
|
|
+
|
|
|
+ let yearMonth = formatDate(new Date(this.sort_scbz.yearMonth),'yyyy-MM')
|
|
|
+ let firstDayOfLastMonth = new Date(yearMonth.split("-")[0], yearMonth.split("-")[1], 1);
|
|
|
+ let lastDayOfLastMonth = new Date(firstDayOfLastMonth.getTime() - 86400000);
|
|
|
+ this.scxl_time.startTime = yearMonth + "-01"
|
|
|
+ this.scxl_time.endTime = formatDate(lastDayOfLastMonth,"yyyy-MM-dd")
|
|
|
+ console.log(this.scxl_time);
|
|
|
+ this.getData_crb3(this.tab_crb3)
|
|
|
+ },
|
|
|
getVegeExpect() {
|
|
|
// this.sort_scbz.yearMonth
|
|
|
getClfxScTableData(this.sort_scbz.townId || '',this.sort_scbz.yearMonth?formatDate(new Date(this.sort_scbz.yearMonth),'yyyy年MM月'):'').then(res => {
|
|
@@ -923,7 +951,7 @@ export default {
|
|
|
},
|
|
|
getData_crb3(val) {
|
|
|
if (val === 1) {
|
|
|
- GetScxlFarm().then((res) => {
|
|
|
+ GetScxlFarm(this.scxl_time.startTime,this.scxl_time.endTime).then((res) => {
|
|
|
if (res?.obj?.list.length > 0) {
|
|
|
res.obj.list.forEach(
|
|
|
(row) => (row.totalSales = setDecimal(row.totalSales / 1000))
|
|
@@ -934,7 +962,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
} else if (val === 2) {
|
|
|
- GetScxlCrop().then((res) => {
|
|
|
+ GetScxlCrop(this.scxl_time.startTime,this.scxl_time.endTime).then((res) => {
|
|
|
if (res?.obj?.list.length > 0) {
|
|
|
res.obj.list.forEach(
|
|
|
(row) => (row.totalSales = setDecimal(row.totalSales / 1000))
|