From 6cd4984f83e7c9fabac3daa23cc9946d9d68314b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 七月 2025 17:10:00 +0800
Subject: [PATCH] 1.采购管理-分页bug
---
src/views/equipmentManagement/ledger/index.vue | 184 ++++++++++++++++++++++++++-------------------
1 files changed, 105 insertions(+), 79 deletions(-)
diff --git a/src/views/equipmentManagement/ledger/index.vue b/src/views/equipmentManagement/ledger/index.vue
index 590bc01..fceba64 100644
--- a/src/views/equipmentManagement/ledger/index.vue
+++ b/src/views/equipmentManagement/ledger/index.vue
@@ -22,9 +22,19 @@
<div>
<el-button type="primary" @click="add" icon="Plus"> 鏂板 </el-button>
<el-button @click="handleOut" icon="download">瀵煎嚭</el-button>
+ <el-button
+ type="danger"
+ icon="Delete"
+ :disabled="multipleList.length <= 0"
+ @click="deleteRow(multipleList.map((item) => item.id))"
+ >
+ 鎵归噺鍒犻櫎
+ </el-button>
</div>
</div>
<PIMTable
+ rowKey="id"
+ isSelection
:column="columns"
:tableData="dataList"
:page="{
@@ -32,6 +42,8 @@
size: pagination.pageSize,
total: pagination.total,
}"
+ @selection-change="handleSelectionChange"
+ @pagination="changePage"
>
<template #operation="{ row }">
<el-button type="primary" text @click="edit(row.id)" icon="editPen">
@@ -54,89 +66,104 @@
<script setup>
import { usePaginationApi } from "@/hooks/usePaginationApi";
-import { Search } from "@element-plus/icons-vue";
+// import { Search } from "@element-plus/icons-vue";
import { getLedgerPage, delLedger } from "@/api/equipmentManagement/ledger";
-import { onMounted } from "vue";
+import { onMounted, getCurrentInstance } from "vue";
import Modal from "./Modal.vue";
-import { ElMessageBox } from "element-plus";
+import { ElMessageBox, ElMessage } from "element-plus";
defineOptions({
name: "璁惧鍙拌处",
});
+// 琛ㄦ牸澶氶�夋閫変腑椤�
+const multipleList = ref([]);
+const { proxy } = getCurrentInstance();
const modalRef = ref();
-const { filters, columns, dataList, pagination, getTableData, resetFilters } =
- usePaginationApi(
- getLedgerPage,
+const {
+ filters,
+ columns,
+ dataList,
+ pagination,
+ getTableData,
+ resetFilters,
+ onCurrentChange,
+} = usePaginationApi(
+ getLedgerPage,
+ {
+ searchText: undefined,
+ },
+ [
{
- searchText: undefined,
+ label: "璁惧鍚嶇О",
+ align: "center",
+ prop: "deviceName",
},
- [
- {
- label: "璁惧鍚嶇О",
- align: "center",
- prop: "deviceName",
- },
- {
- label: "瑙勬牸鍨嬪彿",
- align: "center",
- prop: "deviceModel",
- },
- {
- label: "渚涘簲鍟�",
- align: "center",
- prop: "supplierName",
- },
- {
- label: "鍗曚綅",
- align: "center",
- prop: "unit",
- },
- {
- label: "鏁伴噺",
- align: "center",
- prop: "number",
- },
- {
- label: "鍚◣鍗曚环",
- align: "center",
- prop: "taxIncludingPriceUnit",
- },
- {
- label: "鍚◣鎬讳环",
- align: "center",
- prop: "taxIncludingPriceTotal",
- },
- {
- label: "绋庣巼",
- align: "center",
- prop: "taxRate",
- },
- {
- label: "涓嶅惈绋庢�讳环",
- align: "center",
- prop: "unTaxIncludingPriceTotal",
- },
- {
- label: "褰曞叆浜�",
- align: "center",
- prop: "createUser",
- },
- {
- label: "褰曞叆鏃ユ湡",
- align: "center",
- prop: "createTime",
- },
- {
- fixed: "right",
- label: "鎿嶄綔",
- dataType: "slot",
- slot: "operation",
- align: "center",
- width: "200px",
- },
- ]
- );
+ {
+ label: "瑙勬牸鍨嬪彿",
+ align: "center",
+ prop: "deviceModel",
+ },
+ {
+ label: "渚涘簲鍟�",
+ align: "center",
+ prop: "supplierName",
+ },
+ {
+ label: "鍗曚綅",
+ align: "center",
+ prop: "unit",
+ },
+ {
+ label: "鏁伴噺",
+ align: "center",
+ prop: "number",
+ },
+ {
+ label: "鍚◣鍗曚环",
+ align: "center",
+ prop: "taxIncludingPriceUnit",
+ },
+ {
+ label: "鍚◣鎬讳环",
+ align: "center",
+ prop: "taxIncludingPriceTotal",
+ },
+ {
+ label: "绋庣巼",
+ align: "center",
+ prop: "taxRate",
+ },
+ {
+ label: "涓嶅惈绋庢�讳环",
+ align: "center",
+ prop: "unTaxIncludingPriceTotal",
+ },
+ {
+ label: "褰曞叆浜�",
+ align: "center",
+ prop: "createUser",
+ },
+ {
+ label: "褰曞叆鏃ユ湡",
+ align: "center",
+ prop: "createTime",
+ },
+ {
+ fixed: "right",
+ label: "鎿嶄綔",
+ dataType: "slot",
+ slot: "operation",
+ align: "center",
+ width: "200px",
+ },
+ ]
+);
+
+// 澶氶�夊悗鍋氫粈涔�
+const handleSelectionChange = (selectionList) => {
+ multipleList.value = selectionList;
+};
const add = () => {
modalRef.value.openModal();
@@ -144,7 +171,10 @@
const edit = (id) => {
modalRef.value.loadForm(id);
};
-
+const changePage = ({ page }) => {
+ pagination.currentPage = page;
+ onCurrentChange(page);
+};
const deleteRow = (id) => {
ElMessageBox.confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?", "鎻愮ず", {
confirmButtonText: "纭畾",
@@ -169,11 +199,7 @@
type: "warning",
})
.then(() => {
- proxy.download(
- `/device/ledger/export?ids=${ids}`,
- {},
- "璁惧鍙拌处妗f.xlsx"
- );
+ proxy.download(`/device/ledger/export`, {}, "璁惧鍙拌处妗f.xlsx");
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
--
Gitblit v1.9.3