¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :inline="true" :model="queryParams" class="search-form"> |
| | | <el-form-item label="æç´¢"> |
| | | <el-input |
| | | v-model="queryParams.searchText" |
| | | placeholder="请è¾å
¥å
³é®è¯" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ä¾åºååç§°"> |
| | | <el-input |
| | | v-model="queryParams.supplierName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ä¸äººè¯å«å·"> |
| | | <el-input |
| | | v-model="queryParams.identifyNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è¥å°å"> |
| | | <el-input |
| | | v-model="queryParams.address" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery">æ¥è¯¢</el-button> |
| | | <el-button @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-card> |
| | | <!-- æ ç¾é¡µ --> |
| | | <el-tabs |
| | | v-model="activeTab" |
| | | class="info-tabs" |
| | | @tab-click="handleTabClick" |
| | | > |
| | | <el-tab-pane |
| | | v-for="tab in tabs" |
| | | :key="tab.name" |
| | | :label="tab.label" |
| | | :name="tab.name" |
| | | /> |
| | | </el-tabs> |
| | | <!-- æä½æé®åº --> |
| | | <el-row :gutter="24" class="table-toolbar"> |
| | | <el-button type="primary" :icon="Plus" >æ°å»º</el-button |
| | | > |
| | | <el-button type="danger" :icon="Delete">å é¤</el-button> |
| | | <el-button type="info" :icon="Download">导åº</el-button> |
| | | </el-row> |
| | | <div> |
| | | <el-table :data="tableData" border :span-method="mergeSameRows"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="åºå·" type="index" width="60" align="center" /> |
| | | <el-table-column prop="name" label="ä¾è´§ååç§°" width="180" /> |
| | | <el-table-column prop="type" label="ç
¤ç§" /> |
| | | <el-table-column prop="unit" label="åä½" /> |
| | | <el-table-column prop="number" label="åºåæ°é" /> |
| | | <el-table-column prop="money" label="åä»·ï¼å«ç¨ï¼" /> |
| | | <el-table-column prop="money1" label="æ»ä»·ï¼å«ç¨ï¼" /> |
| | | <el-table-column prop="money2" label="ææ¬åä»·" /> |
| | | <el-table-column prop="money3" label="婿¶¦" /> |
| | | <el-table-column prop="createUser" label="ç»è®°äºº" /> |
| | | <el-table-column prop="createTime" label="ç»è®°æ¥æ" /> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {onMounted, ref} from "vue"; |
| | | import {Delete, Download, Plus} from "@element-plus/icons-vue"; |
| | | |
| | | const tableData = ref([]) |
| | | const columns = ref([]) |
| | | const tableLoading = ref(false); |
| | | const total = ref(0); |
| | | // å½åæ ç¾ |
| | | const activeTab = ref("pendingInbound"); |
| | | const tabName = ref("pendingInbound"); |
| | | // æ ç¾é¡µæ°æ® |
| | | const tabs = reactive([ |
| | | { name: "pendingInbound", label: "å¾
å
¥åº" }, |
| | | { name: "officialInventory", label: "æ£å¼åºå" }, |
| | | ]); |
| | | // æ¥è¯¢åæ° |
| | | const queryParams = reactive({ |
| | | searchText: "", |
| | | supplierName: "", |
| | | identifyNumber: "", |
| | | address: "", |
| | | }) |
| | | onMounted(() => { |
| | | handleTabClick({ props: { name: "supplier" } }); |
| | | }); |
| | | // æ ç¾é¡µç¹å» |
| | | const handleTabClick = (tab) => { |
| | | getList(); |
| | | tableLoading.value = true; |
| | | tabName.value = tab.props.name; |
| | | tableData.value = []; |
| | | getList(); |
| | | // switch (tabName.value) { |
| | | // case "pendingInbound": |
| | | // columns.value = pendingColumns; |
| | | // break; |
| | | // case "officialInventory": |
| | | // columns.value = officialColumns; |
| | | // break; |
| | | // } |
| | | setTimeout(() => { |
| | | tableLoading.value = false; |
| | | }, 500); |
| | | }; |
| | | // ç¹å»æ¥è¯¢ |
| | | const handleQuery = () => { |
| | | tableLoading.value = true; |
| | | setTimeout(() => { |
| | | tableLoading.value = false; |
| | | }, 500); |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | setTimeout(() => { |
| | | // ææ¶å¼å
¥æµè¯æ°æ® |
| | | tableData.value = [ |
| | | { name: "ä¾åºåA", type: "å¨åç
¤", unit: "å¨", number: 100, money: 500 }, |
| | | { name: "ä¾åºåA", type: "å¨åç
¤", unit: "å¨", number: 100, money: 500 }, |
| | | { name: "ä¾åºåB", type: "ç¦ç
¤", unit: "å¨", number: 300, money: 789 }, |
| | | { name: "ä¾åºåB", type: "ç¦ç
¤", unit: "å¨", number: 256, money: 800 }, |
| | | { name: "ä¾åºåC", type: "æ çç
¤", unit: "å¨", number: 256, money: 700 } |
| | | ]; |
| | | total.value = tableData.value.length; |
| | | tableLoading.value = false; |
| | | }, 500); |
| | | }; |
| | | // éç½®æ¥è¯¢ |
| | | const resetQuery = () => { |
| | | Object.keys(queryParams).forEach((key) => { |
| | | if (key !== "pageNum" && key !== "pageSize") { |
| | | queryParams[key] = ""; |
| | | } |
| | | }); |
| | | handleQuery(); |
| | | }; |
| | | // åå¹¶ç¸åè¡çæ¹æ³ |
| | | const mergeSameRows = ({ row, column, rowIndex, columnIndex }) => { |
| | | const fieldsToMerge = ['number', 'money'] |
| | | |
| | | if (fieldsToMerge.includes(column.property)) { |
| | | const prevRow = tableData.value[rowIndex - 1] |
| | | const nextRow = tableData.value[rowIndex + 1] |
| | | // 夿å½åè¡åä¸ä¸è¡æ¯å¦ç¸ç |
| | | if ( |
| | | (!prevRow || prevRow[column.property] !== row[column.property]) && |
| | | (!nextRow || nextRow[column.property] === row[column.property]) |
| | | ) { |
| | | let count = 1 |
| | | while ( |
| | | tableData.value[rowIndex + count] && |
| | | tableData.value[rowIndex + count][column.property] === row[column.property] |
| | | ) { |
| | | count++ |
| | | } |
| | | return { rowspan: count, colspan: 1 } |
| | | } else if (prevRow && prevRow[column.property] === row[column.property]) { |
| | | // éè被åå¹¶çåå
æ ¼ |
| | | return { rowspan: 0, colspan: 0 } |
| | | } |
| | | return { rowspan: 1, colspan: 1 } |
| | | } |
| | | |
| | | // å
¶ä»åä¸åå¹¶ |
| | | return { rowspan: 1, colspan: 1 } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .app-container{ |
| | | box-sizing: border-box; |
| | | } |
| | | .search-form { |
| | | background-color: #fff; |
| | | padding: 20px 20px 0 20px; |
| | | margin-bottom: 20px; |
| | | border-radius: 4px; |
| | | box-shadow: var(--el-box-shadow-light); |
| | | } |
| | | .search-form :deep(.el-form-item) { |
| | | margin-bottom: 16px; |
| | | width: 100%; |
| | | } |
| | | |
| | | /* ååºå¼å¸å± */ |
| | | @media screen and (min-width: 768px) { |
| | | .search-form :deep(.el-form-item) { |
| | | width: 50%; |
| | | } |
| | | } |
| | | @media screen and (min-width: 1200px) { |
| | | .search-form :deep(.el-form-item) { |
| | | width: 18%; |
| | | } |
| | | } |
| | | |
| | | .table-toolbar { |
| | | margin-bottom: 20px; |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 10px; |
| | | } |
| | | |
| | | :deep(.el-table) { |
| | | margin-bottom: 20px; |
| | | overflow-x: auto; |
| | | } |
| | | |
| | | :deep(.el-table th) { |
| | | background-color: #f5f7fa; |
| | | } |
| | | |
| | | /* ååºå¼æ ·å¼ */ |
| | | @media screen and (max-width: 768px) { |
| | | :deep(.el-table) { |
| | | width: 100%; |
| | | overflow-x: auto; |
| | | } |
| | | } |
| | | /* è¡¨æ ¼å·¥å
·æ */ |
| | | .table-toolbar, .table-toolbar > * { |
| | | margin: 0 0 0 0 !important; |
| | | } |
| | | .table-toolbar{ |
| | | margin-bottom: 20px !important; |
| | | } |
| | | </style> |