| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="filters" :inline="true" label-width="80px"> |
| | | <el-form-item label="客户名称"> |
| | | <el-input v-model="filters.customerName" placeholder="请输入客户名称" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getTableData"> 搜索 </el-button> |
| | | <el-button @click="resetFilters"> 重置 </el-button> |
| | | <el-button @click="handleOut"> 导出 </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableLoading="loading" |
| | | :tableData="dataList" |
| | | :page="{ |
| | | <div class="app-container"> |
| | | <el-form :model="filters" :inline="true" label-width="80px"> |
| | | <el-form-item label="客户名称"> |
| | | <el-input v-model="filters.customerName" placeholder="请输入客户名称" clearable style="width: 240px"/> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getTableData"> 搜索 </el-button> |
| | | <el-button @click="resetFilters"> 重置 </el-button> |
| | | <el-button @click="handleOut"> 导出 </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableLoading="loading" |
| | | :tableData="dataList" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | total: pagination.total, |
| | | total: pagination.total |
| | | }" |
| | | @pagination="changePage" |
| | | ></PIMTable> |
| | | </div> |
| | | </div> |
| | | :isShowSummary="true" |
| | | :summaryMethod="summarizeMainTable" |
| | | @pagination="changePage" |
| | | ></PIMTable> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | defineOptions({ |
| | | name: "项目利润", |
| | | name: "项目利润", |
| | | }); |
| | | |
| | | const { |
| | | loading, |
| | | filters, |
| | | columns, |
| | | dataList, |
| | | pagination, |
| | | getTableData, |
| | | resetFilters, |
| | | onCurrentChange, |
| | | loading, |
| | | filters, |
| | | columns, |
| | | dataList, |
| | | pagination, |
| | | getTableData, |
| | | resetFilters, |
| | | onCurrentChange, |
| | | } = usePaginationApi( |
| | | getPurchaseList, |
| | | { |
| | | customerName: undefined, |
| | | }, |
| | | [ |
| | | { |
| | | label: "销售合同号", |
| | | align: "center", |
| | | prop: "customerContractNo", |
| | | }, |
| | | { |
| | | label: "客户名称", |
| | | align: "center", |
| | | prop: "customerName", |
| | | }, |
| | | // { |
| | | // label: "项目名称", |
| | | // align: "center", |
| | | // prop: "projectName", |
| | | // }, |
| | | { |
| | | label: "合同金额", |
| | | align: "center", |
| | | prop: "contractAmount", |
| | | }, |
| | | { |
| | | label: "采购金额", |
| | | align: "center", |
| | | prop: "purchaseAmount", |
| | | }, |
| | | { |
| | | label: "利润", |
| | | align: "center", |
| | | prop: "balance", |
| | | }, |
| | | { |
| | | label: "利润率", |
| | | align: "center", |
| | | prop: "balanceRatio", |
| | | }, |
| | | { |
| | | label: "增值税", |
| | | align: "center", |
| | | prop: "balanceAmount", |
| | | }, |
| | | ] |
| | | getPurchaseList, |
| | | { |
| | | customerName: undefined, |
| | | }, |
| | | [ |
| | | { |
| | | label: "销售合同号", |
| | | align: "center", |
| | | prop: "customerContractNo", |
| | | }, |
| | | { |
| | | label: "客户名称", |
| | | align: "center", |
| | | prop: "customerName", |
| | | }, |
| | | { |
| | | label: "合同金额", |
| | | align: "center", |
| | | prop: "contractAmount", |
| | | }, |
| | | { |
| | | label: "采购金额", |
| | | align: "center", |
| | | prop: "purchaseAmount", |
| | | }, |
| | | { |
| | | label: "利润", |
| | | align: "center", |
| | | prop: "balance", |
| | | }, |
| | | { |
| | | label: "利润率", |
| | | align: "center", |
| | | prop: "balanceRatio", |
| | | }, |
| | | ] |
| | | ); |
| | | |
| | | const changePage = ({ page }) => { |
| | | pagination.currentPage = page; |
| | | onCurrentChange(page); |
| | | const changePage = ({ page, limit }) => { |
| | | pagination.currentPage = page; |
| | | pagination.pageSize = limit; |
| | | onCurrentChange(page); |
| | | }; |
| | | |
| | | // 主表合计方法 |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ["contractAmount", "purchaseAmount", "balance"]); |
| | | }; |
| | | |
| | | // 导出 |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/purchase/report/export", {}, "项目利润.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/purchase/report/export", {}, "项目利润.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getTableData(); |
| | | getTableData(); |
| | | }); |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .table_list { |
| | | margin-top: unset; |
| | | margin-top: unset; |
| | | } |
| | | </style> |