gaoluyang
10 小时以前 001b025ff84dec3c614f0b0346e9a50491034f04
src/views/accountReceivableLedger/index.vue
@@ -181,13 +181,23 @@
};
const getList = () => {
  tableLoading.value = true;
  const { receiptPaymentDate, ...rest } = searchForm;
  receiptPaymentHistoryListPage({ ...rest, ...page }).then((res) => {
  const { receiptPaymentDate, receiptPaymentDateStart, receiptPaymentDateEnd, ...rest } = searchForm;
  // 构建请求参数,只包含有效的日期字段
  const params = { ...rest, ...page };
  // 只有当日期字段有值时才添加到参数中
  if (receiptPaymentDateStart) {
    params.receiptPaymentDateStart = receiptPaymentDateStart;
  }
  if (receiptPaymentDateEnd) {
    params.receiptPaymentDateEnd = receiptPaymentDateEnd;
  }
  receiptPaymentHistoryListPage(params).then((res) => {
    tableLoading.value = false;
    tableData.value = res.records;
      page.total = res.total;
  }).catch(() => {
    tableLoading.value = false;
  });
  tableLoading.value = false;
};
// 子表合计方法
const summarizeMainTable1 = (param) => {
@@ -202,21 +212,26 @@
};
const changeDateRange = (date) => {
  if (date) {
  if (date && date.length === 2) {
    searchForm.receiptPaymentDateStart = dayjs(date[0]).format(
      "YYYY-MM-DD 00:00:00"
    );
    searchForm.receiptPaymentDateEnd = dayjs(date[1]).format(
      "YYYY-MM-DD 23:59:59"
    );
    getList();
  } else {
    // 日期为空时,删除日期字段
    delete searchForm.receiptPaymentDateStart;
    delete searchForm.receiptPaymentDateEnd;
  }
  getList();
};
const clearRange = () => {
  searchForm.receiptPaymentDate = [];
  searchForm.receiptPaymentDateStart = undefined;
  searchForm.receiptPaymentDateEnd = undefined;
  searchForm.receiptPaymentDate = null;
  // 直接删除字段,而不是设置为 undefined
  delete searchForm.receiptPaymentDateStart;
  delete searchForm.receiptPaymentDateEnd;
  getList();
};