spring
2 天以前 261f2ed00235d47df3754291a4fdca9ba5cb8e7a
src/views/procurementManagement/paymentLedger/index.vue
@@ -1,27 +1,25 @@
<template>
  <div class="app-container">
    <div class="search_form" style="margin-bottom: 20px;">
    <div class="search_form"
         style="margin-bottom: 20px;">
      <div>
        <span class="search_title">供应商名称:</span>
        <el-input
          v-model="searchForm.supplierName"
        <el-input v-model="searchForm.supplierName"
          style="width: 240px"
          placeholder="输入供应商名称"
          @change="handleQuery"
          clearable
          :prefix-icon="Search"
        />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
          >搜索</el-button
        >
                  :prefix-icon="Search" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
      </div>
      <div></div>
    </div>
    <el-row :gutter="20">
      <el-col :span="14">
        <div class="table_list">
          <el-table
            ref="multipleTable"
          <el-table ref="multipleTable"
            border
            v-loading="tableLoading"
            :data="tableData"
@@ -33,32 +31,24 @@
            @row-click="rowClick"
            :show-summary="isShowSummary"
            :summary-method="summarizeMainTable"
            class="lims-table"
          >
            <el-table-column
              align="center"
                    class="lims-table">
            <el-table-column align="center"
              label="序号"
              type="index"
              width="60"
            />
            <el-table-column label="供应商名称" prop="supplierName" />
            <el-table-column
              label="合同金额(元)"
              prop="invoiceAmount"
                             width="60" />
            <el-table-column label="供应商名称"
                             prop="supplierName" />
            <el-table-column label="合同金额(元)"
                             prop="contractAmounts"
              show-overflow-tooltip
              :formatter="formattedNumber"
            />
            <el-table-column
              label="付款金额(元)"
                             :formatter="formattedNumber" />
            <el-table-column label="付款金额(元)"
              prop="paymentAmount"
              show-overflow-tooltip
              :formatter="formattedNumber"
            />
            <el-table-column
              label="应付金额(元)"
                             :formatter="formattedNumber" />
            <el-table-column label="应付金额(元)"
              prop="payableAmount"
              show-overflow-tooltip
            >
                             show-overflow-tooltip>
              <template #default="{ row, column }">
                <el-text type="danger">
                  {{ formattedNumber(row, column, row.payableAmount) }}
@@ -66,29 +56,27 @@
              </template>
            </el-table-column>
          </el-table>
          <pagination
            v-show="total > 0"
          <pagination v-show="total > 0"
            @pagination="paginationSearch"
            :total="total"
            :layout="page.layout"
            :page="page.current"
            :limit="page.size"
          />
                      :limit="page.size" />
        </div>
      </el-col>
      <el-col :span="10">
        <div class="table_list">
          <PIMTable
            rowKey="id"
          <PIMTable rowKey="id"
            :column="tableColumnSon"
            :tableData="originalTableDataSon"
            :isSelection="false"
            :isShowPagination="false"
                    :isShowPagination="true"
                    :page="sonPage"
            :tableLoading="tableLoadingSon"
            :isShowSummary="isShowSummarySon"
            :summaryMethod="summarizeMainTable1"
                  height="calc(100vh - 18.5em)"
          >
                    @pagination="sonPaginationSearch">
            <template #payableAmountSlot="{ row }">
              <el-text type="danger">
                {{ parseFloat(row.payableAmount).toFixed(2) }}
@@ -114,7 +102,7 @@
const tableLoading = ref(false);
const data = reactive({
  searchForm: {
    supplierNameOrContractNo: "",
      supplierName: "",
  },
});
const page = reactive({
@@ -123,22 +111,24 @@
});
const sonPage = reactive({
  current: 1,
  size: 100,
    size: 10,
    total: 0,
    layout: "total, sizes, prev, pager, next, jumper",
});
const total = ref(0);
const sonTotal = ref(0);
const isShowSummary = ref(true);
const { searchForm } = toRefs(data);
const currentSupplierId = ref("");
const rowClick = (row) => {
  const rowClick = row => {
  currentSupplierId.value = row.supplierId;
    sonPage.current = 1;
  getPaymenRecordtList(row.supplierId);
};
// 子模块
const tableColumnSon = ref([
  {
    label: "发生日期",
    prop: "paymentDate",
      label: "合同签订日期",
      prop: "executionDate",
      width: 110,
  },
  {
@@ -148,9 +138,9 @@
  },
  {
    label: "合同金额(元)",
    prop: "invoiceAmount",
      prop: "contractAmount",
      width: 200,
    formatData: (params) => {
      formatData: params => {
      return params ? parseFloat(params).toFixed(2) : 0;
    },
  },
@@ -158,7 +148,7 @@
    label: "付款金额(元)",
    prop: "paymentAmount",
      width: 200,
    formatData: (params) => {
      formatData: params => {
      return params ? parseFloat(params).toFixed(2) : 0;
    },
  },
@@ -174,15 +164,13 @@
const originalTableDataSon = ref([]);
const tableLoadingSon = ref(false);
const isShowSummarySon = ref(true);
const detailPageNum = ref(1);
const detailPageSize = ref(10);
const { proxy } = getCurrentInstance();
// 主表合计方法
const summarizeMainTable = (param) => {
  const summarizeMainTable = param => {
  return proxy.summarizeTable(
    param,
    ["invoiceAmount", "paymentAmount", "payableAmount"],
      ["contractAmounts", "paymentAmount", "payableAmount"],
    {
      ticketsNum: { noDecimal: true }, // 不保留小数
      futureTickets: { noDecimal: true }, // 不保留小数
@@ -190,10 +178,10 @@
  );
};
// 子表合计方法
const summarizeMainTable1 = (param) => {
  const summarizeMainTable1 = param => {
  let summarizeTable = proxy.summarizeTable(
    param,
    ["invoiceAmount", "paymentAmount"],
      ["contractAmount", "invoiceAmount", "paymentAmount"],
    {
      ticketsNum: { noDecimal: true }, // 不保留小数
      futureTickets: { noDecimal: true }, // 不保留小数
@@ -214,7 +202,7 @@
  page.current = 1;
  getList();
};
const paginationSearch = (obj) => {
  const paginationSearch = obj => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
@@ -224,32 +212,44 @@
  paymentLedgerList({
    ...searchForm.value,
    ...page,
  }).then((res) => {
    }).then(res => {
    let result = res.data;
    tableLoading.value = false;
    tableData.value = result.records || [];
    total.value = result.total || 0;
    if (tableData.value.length > 0) {
      getPaymenRecordtList(tableData.value[0].supplierId);
      currentSupplierId.value = tableData.value[0].supplierId;
        sonPage.current = 1;
        getPaymenRecordtList(tableData.value[0].supplierId);
    }
  });
};
const getPaymenRecordtList = (supplierId) => {
  const getPaymenRecordtList = supplierId => {
  tableLoadingSon.value = true;
  paymentRecordList({supplierId: supplierId})
    .then((res) => {
      tableLoadingSon.value = false;
      tableDataSon.value = res.data;
      handlePagination({ page: 1, limit: sonPage.size });
      sonTotal.value = res.data.length;
    paymentRecordList({
      supplierId: supplierId,
      current: sonPage.current,
      size: sonPage.size,
    })
    .catch((e) => {
      .then(res => {
        tableLoadingSon.value = false;
        let result = res.data;
        if (Array.isArray(result)) {
          tableDataSon.value = result;
          sonPage.total = result.length;
          handlePagination({ page: sonPage.current, limit: sonPage.size });
        } else {
          originalTableDataSon.value = result.records || [];
          sonPage.total = result.total || 0;
        }
      })
      .catch(e => {
      tableLoadingSon.value = false;
    });
};
const handlePagination = ({ page, limit }) => {
    console.log(page, limit);
  sonPage.current = page;
  sonPage.size = limit;
@@ -259,9 +259,11 @@
  originalTableDataSon.value = tableDataSon.value.slice(start, end);
};
const sonPaginationSearch = (pagination) => {
  const sonPaginationSearch = pagination => {
  // 接收分页器参数 { page, limit }
  handlePagination(pagination);
    sonPage.current = pagination.page;
    sonPage.size = pagination.limit;
    getPaymenRecordtList(currentSupplierId.value);
};
const formattedNumber = (row, column, cellValue) => {
  if (column.property !== "supplierName") {