已开票‘定制导出’,查询优化
This commit is contained in:
parent
6934e5de26
commit
06f92a4cd5
@ -98,4 +98,21 @@ export function getLastMonthYearMonth() {
|
||||
|
||||
// 格式化为 YYYY-MM
|
||||
return `${lastYear}-${String(lastMonth + 1).padStart(2, "0")}`;
|
||||
}
|
||||
//判断开始和结束时间差是否超过一个月
|
||||
/**
|
||||
* 给日期加一个月(自动处理月份边界和时间精度)
|
||||
* @param {Date} date 原始日期
|
||||
* @returns {Date} 加一个月后的日期
|
||||
*/
|
||||
function addOneMonth(date) {
|
||||
const newDate = new Date(date); // 复制日期,避免修改原对象
|
||||
newDate.setMonth(newDate.getMonth() + 1);
|
||||
// 自动处理边界(如1月31日→2月最后一天,12月→次年1月)
|
||||
return newDate;
|
||||
}
|
||||
export function isOverOneMonth(startTime, endTime) {
|
||||
// 较早日期加一个月后,与较晚日期比较
|
||||
const earlierPlusOneMonth = addOneMonth(startTime);
|
||||
return endTime > earlierPlusOneMonth;
|
||||
}
|
||||
@ -282,8 +282,7 @@ import { auditCenterNoPass,auditCenterPass,listEmisSettleInvoiceRecord, getEmisS
|
||||
import OpenBillForm from '@/views/emis/emisSettleInvoiceRecord/OpenBillForm';
|
||||
import { listEmisSettleInvoiceChRecord } from "@/api/emis/emisSettleInvoiceChRecord";
|
||||
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';
|
||||
import {timeFormat} from '@/utils/dateUtils'
|
||||
|
||||
import {timeFormat , isOverOneMonth} from '@/utils/dateUtils'
|
||||
export default {
|
||||
name: "CenterInvoiceHasOpenPanel",
|
||||
components: { elDateAdvPicker,OpenBillForm },
|
||||
@ -463,31 +462,31 @@ export default {
|
||||
/** 查询开票记录表列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
||||
// 按运单查询时的处理
|
||||
if(this.queryOrderType=="1"){
|
||||
this.queryParams.params.billCode=this.queryParams.queryCode;
|
||||
this.queryParams.settleBillNo=null;
|
||||
this.queryParams.invoiceNo=null;
|
||||
}
|
||||
else if(this.queryOrderType=="2"){
|
||||
this.queryParams.params.billCode=null;
|
||||
this.queryParams.settleBillNo=this.queryParams.queryCode;
|
||||
this.queryParams.invoiceNo=null;
|
||||
}
|
||||
else if(this.queryOrderType=="3"){ //发票查询
|
||||
this.queryParams.params.billCode=null;
|
||||
this.queryParams.settleBillNo=null;
|
||||
this.queryParams.invoiceNo=this.queryParams.queryCode;
|
||||
}
|
||||
|
||||
this.initQueryParams();
|
||||
listEmisSettleInvoiceRecord(this.addDateRange(this.queryParams, this.dateTimeRange,'createTime')).then(response => {
|
||||
this.emisSettleInvoiceRecordList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
initQueryParams() {
|
||||
// 按运单查询时的处理
|
||||
if (this.queryOrderType == "1") {
|
||||
this.queryParams.params.billCode = this.queryParams.queryCode;
|
||||
this.queryParams.settleBillNo = null;
|
||||
this.queryParams.invoiceNo = null;
|
||||
}
|
||||
else if (this.queryOrderType == "2") {
|
||||
this.queryParams.params.billCode = null;
|
||||
this.queryParams.settleBillNo = this.queryParams.queryCode;
|
||||
this.queryParams.invoiceNo = null;
|
||||
}
|
||||
else if (this.queryOrderType == "3") { //发票查询
|
||||
this.queryParams.params.billCode = null;
|
||||
this.queryParams.settleBillNo = null;
|
||||
this.queryParams.invoiceNo = this.queryParams.queryCode;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
@ -647,9 +646,23 @@ export default {
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleCustomExport() {
|
||||
|
||||
this.initQueryParams();
|
||||
let params = this.addDateRange(this.queryParams, this.dateTimeRange,'createTime');
|
||||
//判断时间必选 且开始和结束时间相差不超一个月
|
||||
if(!this.dateTimeRange){
|
||||
this.$modal.msgError('请选择开票时间');
|
||||
return;
|
||||
}
|
||||
let startTime=params.params.beginCreateTime;
|
||||
let endTime=params.params.endCreateTime;
|
||||
//判断开始时间和结束时间是否在一个月内
|
||||
if(isOverOneMonth(new Date(startTime),new Date(endTime))){
|
||||
this.$modal.msgError('开票时间不能超过一个月');
|
||||
return;
|
||||
}
|
||||
this.download('emis/emisSettleInvoiceRecord/customExport', {
|
||||
...this.queryParams,pageSize:10000
|
||||
...params,
|
||||
pageSize:10000
|
||||
}, `已开票列表.xlsx`)
|
||||
},
|
||||
formatJson(filterVal, jsonData, resData) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user