| | |
| | | } |
| | | /** 导出按钮操作 */ |
| | | function handleExport() { |
| | | let sYearMonth = ""; |
| | | let eYearMonth = ""; |
| | | // let type = ""; |
| | | // options.map((item) => { |
| | | // if (queryParams.value.searchType === item.label) { |
| | | // type = item.value; |
| | | // } |
| | | // }); |
| | | // 创建一个Date对象 |
| | | let sDate = new Date(queryParams.value.monthRange[0]); |
| | | let eDate = new Date(queryParams.value.monthRange[1]); |
| | | // 获取年份和月份 |
| | | let sYear = sDate.getFullYear(); |
| | | let sMonth = sDate.getMonth() + 1; // 月份是从0开始的,所以要加1 |
| | | let eYear = eDate.getFullYear(); |
| | | let eMonth = eDate.getMonth() + 1; // 月份是从0开始的,所以要加1 |
| | | // 格式化为"YYYY-MM"的形式 |
| | | sYearMonth = `${sYear}-${sMonth.toString().padStart(2, "0")}`; |
| | | eYearMonth = `${eYear}-${eMonth.toString().padStart(2, "0")}`; |
| | | if ( |
| | | (!queryParams.value.monthRange && dayCom.value == false) || |
| | | (!queryParams.value.monthDays && dayCom.value == true) |
| | | ) { |
| | | ElMessage({ |
| | | message: "请选择年月", |
| | | type: "error", |
| | | }); |
| | | return; |
| | | } |
| | | proxy.download( |
| | | "/aps/apsGasPipingRouteStat/exportExcel", |
| | | { |
| | | searchStartDate: |
| | | queryParams.value.searchType === "按月统计" |
| | | ? sYearMonth |
| | | searchStartDate: !dayCom.value |
| | | ? dateRangeStr(queryParams.value.monthRange).sYearMonth |
| | | : dateStr(queryParams.value.monthDays), |
| | | searchEndDate: |
| | | queryParams.value.searchType === "按月统计" |
| | | ? eYearMonth |
| | | searchEndDate: !dayCom.value |
| | | ? dateRangeStr(queryParams.value.monthRange).eYearMonth |
| | | : dateStr(queryParams.value.monthDays), |
| | | searchType: searchTypeValue.value, |
| | | major: "piping", |
| | |
| | | } |
| | | /** 导出按钮操作 */ |
| | | function handleExport2() { |
| | | let sYearMonth = ""; |
| | | let eYearMonth = ""; |
| | | // let type = ""; |
| | | // options.map((item) => { |
| | | // if (queryParams.value.searchType === item.label) { |
| | | // type = item.value; |
| | | // } |
| | | // }); |
| | | // 创建一个Date对象 |
| | | let sDate = new Date(queryParams.value.monthRange[0]); |
| | | let eDate = new Date(queryParams.value.monthRange[1]); |
| | | // 获取年份和月份 |
| | | let sYear = sDate.getFullYear(); |
| | | let sMonth = sDate.getMonth() + 1; // 月份是从0开始的,所以要加1 |
| | | let eYear = eDate.getFullYear(); |
| | | let eMonth = eDate.getMonth() + 1; // 月份是从0开始的,所以要加1 |
| | | // 格式化为"YYYY-MM"的形式 |
| | | sYearMonth = `${sYear}-${sMonth.toString().padStart(2, "0")}`; |
| | | eYearMonth = `${eYear}-${eMonth.toString().padStart(2, "0")}`; |
| | | if ( |
| | | (!queryParams.value.monthRange && dayCom.value == false) || |
| | | (!queryParams.value.monthDays && dayCom.value == true) |
| | | ) { |
| | | ElMessage({ |
| | | message: "请选择年月", |
| | | type: "error", |
| | | }); |
| | | return; |
| | | } |
| | | proxy.download( |
| | | "/aps/apsGasPipingRouteStat/exportExcel", |
| | | { |
| | | searchStartDate: |
| | | queryParams.value.searchType === "按月统计" |
| | | ? sYearMonth |
| | | searchStartDate: !dayCom.value |
| | | ? dateRangeStr(queryParams.value.monthRange).sYearMonth |
| | | : dateStr(queryParams.value.monthDays), |
| | | searchEndDate: |
| | | queryParams.value.searchType === "按月统计" |
| | | ? eYearMonth |
| | | searchEndDate: !dayCom.value |
| | | ? dateRangeStr(queryParams.value.monthRange).eYearMonth |
| | | : dateStr(queryParams.value.monthDays), |
| | | searchType: searchTypeValue.value, |
| | | major: "gas", |