<template>
|
<div class="app-container">
|
<div class="search_form"
|
style="margin-bottom: 20px;">
|
<div>
|
<span class="search_title">供应商名称:</span>
|
<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>
|
</div>
|
<div></div>
|
</div>
|
<el-row :gutter="20">
|
<el-col :span="8">
|
<div class="table_list">
|
<el-table ref="multipleTable"
|
border
|
v-loading="tableLoading"
|
:data="tableData"
|
:header-cell-style="{ background: '#F0F1F5', color: '#333333' }"
|
height="calc(100vh - 18.5em)"
|
:highlight-current-row="true"
|
style="width: 100%"
|
tooltip-effect="dark"
|
@row-click="rowClick"
|
:show-summary="isShowSummary"
|
:summary-method="summarizeMainTable"
|
class="lims-table">
|
<el-table-column align="center"
|
label="序号"
|
type="index"
|
width="60" />
|
<el-table-column label="供应商名称"
|
prop="supplierName" />
|
<el-table-column label="合同金额(元)"
|
prop="contractAmounts"
|
show-overflow-tooltip
|
:formatter="formattedNumber" />
|
<el-table-column label="应付金额(元)"
|
prop="payableAmount"
|
show-overflow-tooltip>
|
<template #default="{ row, column }">
|
<el-text type="danger">
|
{{ formattedNumber(row, column, row.payableAmount) }}
|
</el-text>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination v-show="total > 0"
|
@pagination="paginationSearch"
|
:total="total"
|
:layout="page.layout"
|
:page="page.current"
|
:limit="page.size" />
|
</div>
|
</el-col>
|
<el-col :span="16">
|
<div class="table_list">
|
<div class="table-header" v-if="selectedSupplierName">
|
<span class="supplier-title">供应商:{{ selectedSupplierName }}</span>
|
</div>
|
<el-table border
|
v-loading="tableLoadingSon"
|
:data="originalTableDataSon"
|
:header-cell-style="{ background: '#F0F1F5', color: '#333333' }"
|
height="calc(100vh - 20em)"
|
style="width: 100%"
|
tooltip-effect="dark"
|
:show-summary="isShowSummarySon"
|
:summary-method="summarizeMainTable1">
|
<el-table-column align="center"
|
label="序号"
|
type="index"
|
width="60" />
|
<el-table-column label="合同签订日期"
|
prop="executionDate"
|
show-overflow-tooltip/>
|
<el-table-column label="采购合同号"
|
prop="purchaseContractNumber"
|
show-overflow-tooltip/>
|
<el-table-column label="项目名称"
|
prop="projectName"
|
show-overflow-tooltip/>
|
<el-table-column label="合同金额(元)"
|
prop="contractAmount"
|
show-overflow-tooltip
|
:formatter="formattedNumber" />
|
<el-table-column label="收货状态"
|
prop="status"
|
show-overflow-tooltip
|
width="100">
|
<template #default="{ row }">
|
<el-tag :type="getReceiptStatusType(row.status)" size="small">
|
{{ receiptStatusText[row.status] || '未知状态' }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination v-show="sonPage.total > 0"
|
@pagination="sonPaginationSearch"
|
:total="sonPage.total"
|
:layout="sonPage.layout"
|
:page="sonPage.current"
|
:limit="sonPage.size" />
|
</div>
|
</el-col>
|
</el-row>
|
</div>
|
</template>
|
|
<script setup>
|
import { ref, toRefs, reactive, getCurrentInstance } from "vue";
|
import { Search } from "@element-plus/icons-vue";
|
import {
|
paymentLedgerList,
|
} from "@/api/procurementManagement/paymentLedger.js";
|
import { gePurchaseListPage } from "@/api/procurementManagement/invoiceEntry.js";
|
import Pagination from "../../../components/PIMTable/Pagination.vue";
|
|
const tableData = ref([]);
|
const tableLoading = ref(false);
|
const data = reactive({
|
searchForm: {
|
supplierName: "",
|
},
|
});
|
const page = reactive({
|
current: 1,
|
size: 100,
|
});
|
const sonPage = reactive({
|
current: 1,
|
size: 10,
|
total: 0,
|
layout: "total, sizes, prev, pager, next, jumper",
|
});
|
const total = ref(0);
|
const isShowSummary = ref(true);
|
const { searchForm } = toRefs(data);
|
const currentSupplierId = ref("");
|
const selectedSupplierName = ref("");
|
const rowClick = row => {
|
currentSupplierId.value = row.supplierId;
|
selectedSupplierName.value = row.supplierName;
|
sonPage.current = 1;
|
getPurchaseList(row.supplierName);
|
};
|
const originalTableDataSon = ref([]);
|
const tableLoadingSon = ref(false);
|
const isShowSummarySon = ref(true);
|
const { proxy } = getCurrentInstance();
|
|
// 主表合计方法
|
const summarizeMainTable = param => {
|
return proxy.summarizeTable(
|
param,
|
["contractAmounts", "payableAmount"],
|
{
|
ticketsNum: { noDecimal: true },
|
futureTickets: { noDecimal: true },
|
}
|
);
|
};
|
// 子表合计方法
|
const summarizeMainTable1 = param => {
|
return proxy.summarizeTable(
|
param,
|
["contractAmount"],
|
{
|
ticketsNum: { noDecimal: true },
|
futureTickets: { noDecimal: true },
|
}
|
);
|
};
|
/** 搜索按钮操作 */
|
const handleQuery = () => {
|
page.current = 1;
|
getList();
|
};
|
const paginationSearch = obj => {
|
page.current = obj.page;
|
page.size = obj.limit;
|
getList();
|
};
|
const getList = () => {
|
tableLoading.value = true;
|
paymentLedgerList({
|
...searchForm.value,
|
...page,
|
}).then(res => {
|
let result = res.data;
|
tableLoading.value = false;
|
tableData.value = result.records || [];
|
total.value = result.total || 0;
|
if (tableData.value.length > 0) {
|
currentSupplierId.value = tableData.value[0].supplierId;
|
selectedSupplierName.value = tableData.value[0].supplierName;
|
sonPage.current = 1;
|
getPurchaseList(tableData.value[0].supplierName);
|
} else {
|
originalTableDataSon.value = [];
|
selectedSupplierName.value = "";
|
}
|
});
|
};
|
|
const getPurchaseList = supplierName => {
|
tableLoadingSon.value = true;
|
gePurchaseListPage({
|
supplierName: supplierName,
|
current: sonPage.current,
|
size: sonPage.size,
|
})
|
.then(res => {
|
tableLoadingSon.value = false;
|
let result = res.data;
|
if (Array.isArray(result)) {
|
originalTableDataSon.value = result;
|
sonPage.total = result.length;
|
} else {
|
originalTableDataSon.value = result.records || [];
|
sonPage.total = result.total || 0;
|
}
|
})
|
.catch(e => {
|
tableLoadingSon.value = false;
|
});
|
};
|
|
const sonPaginationSearch = pagination => {
|
sonPage.current = pagination.page;
|
sonPage.size = pagination.limit;
|
getPurchaseList(selectedSupplierName.value);
|
};
|
|
const formattedNumber = (row, column, cellValue) => {
|
if (cellValue !== undefined && cellValue !== null && !isNaN(cellValue)) {
|
return parseFloat(cellValue).toFixed(2);
|
}
|
return "0.00";
|
};
|
|
// 收货状态文本映射
|
const receiptStatusText = {
|
1: '待收货',
|
2: '收货中',
|
3: '已收货'
|
};
|
|
// 收货状态标签类型
|
const getReceiptStatusType = (status) => {
|
const typeMap = {
|
1: 'info',
|
2: 'warning',
|
3: 'success'
|
};
|
return typeMap[status] || 'info';
|
};
|
|
getList();
|
</script>
|
|
<style scoped lang="scss">
|
.el-pagination {
|
width: 100%;
|
height: 55px;
|
display: flex;
|
justify-content: flex-end;
|
float: right;
|
flex-direction: row;
|
align-items: center;
|
background: #fff;
|
margin: -20px 0 0 0;
|
padding: 0 20px;
|
}
|
.pagination-container {
|
margin-top: 0;
|
}
|
|
.table-header {
|
margin-bottom: 10px;
|
padding: 10px;
|
background-color: #f5f7fa;
|
border-radius: 4px;
|
|
.supplier-title {
|
font-weight: bold;
|
font-size: 14px;
|
color: #303133;
|
}
|
}
|
</style>
|