<template> <div> <div style="margin: 10px 0; display: flex; align-items: center"> <el-input class="input_content" placeholder="请输入内容" v-model="sourceList.pagination.keyword" style="width: 50%" clearable size="small" ></el-input> <el-select v-model="sourceList.pagination.purchaseStatus" clearable filterable style="width: 40%; margin-left: 10px" size="small" > <el-option v-for="(item, index) in statusData" :key="index" :value="item.value" :label="item.label" ></el-option> </el-select> <div style="text-align: center; width: 10%"> <el-icon style="cursor: pointer" @click="getData"><Search /></el-icon> </div> </div> <el-table :data="sourceList.data" style="width: 100%; margin-top: 10px" v-loading="loading" :height="tableHeight" > <el-table-column prop="code" label="单号" width="100" fixed="left" /> <el-table-column prop="createTime" label="日期" width="150" /> <el-table-column prop="supplyName" label="供应商" min-width="150" /> <el-table-column prop="amount" label="采购总价" width="100"> <template #default="{ row }"> <div>{{ moneyFormat(row.amount, 2) }}</div> </template> </el-table-column> <el-table-column prop="purchaseStatus" label="状态" width="100" :formatter="getStatus" /> <!-- <el-table-column label="操作" width="60" fixed="right" align="center"> <template #default="{ row }"> <el-button type="primary" text ><i class="iconfont icon-iconm_wofqd"></i ></el-button> </template> </el-table-column> --> </el-table> <el-pagination style="margin-top: 10px" v-model:current-page="sourceList.pagination.pageNum" :page-size="10" layout="total, prev, pager, next" :total="sourceList.pagination.total" prev-text="上一页" next-text="下一页" @current-change="handleCurrentChange" /> </div> </template> <script setup> const tableHeight = window.innerHeight - 209; const loading = ref(false); const sourceList = ref({ data: [], pagination: { total: 300, pageNum: 1, pageSize: 10, }, }); const statusData = ref([ { label: "审批中", value: "10", }, { label: "驳回", value: "20", }, { label: "已采购", value: "30", }, { label: "终止", value: "99", }, { label: "已作废", value: "88", }, ]); const { proxy } = getCurrentInstance(); const getStatus = (row) => { const current = statusData.value.find((x) => x.value == row.purchaseStatus); if (current) return current.label; }; const getData = () => { loading.value = true; proxy.post("/purchase/page", sourceList.value.pagination).then((res) => { sourceList.value.data = res.rows; sourceList.value.pagination.total = res.total; setTimeout(() => { loading.value = false; }, 200); }); }; const handleCurrentChange = (val) => { sourceList.value.pagination.pageNum = val; getData(); }; getData(); onMounted(() => {}); </script> <style lang="scss" scoped> * { font-size: 12px; } .el-button { padding: 0px; } .btn { width: 100%; border-radius: 10px; padding: 6px 10px; height: 24px; } .el-pagination { padding-left: 30px; } :deep(.el-pagination button, .el-pager li) { font-size: 12px; } :deep(.el-table .el-table__cell) { padding: 2px 0px; } </style>