From e2317a1bcab0134f0c1b1aec99eb4d78dfddf1b8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 05 三月 2026 17:41:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New
---
src/views/equipmentManagement/spareParts/index.vue | 144 ++++++++++++++++++++++++++++++++++--------------
1 files changed, 102 insertions(+), 42 deletions(-)
diff --git a/src/views/equipmentManagement/spareParts/index.vue b/src/views/equipmentManagement/spareParts/index.vue
index eb0bdd5..4a48d28 100644
--- a/src/views/equipmentManagement/spareParts/index.vue
+++ b/src/views/equipmentManagement/spareParts/index.vue
@@ -19,48 +19,21 @@
<el-button type="primary" @click="addCategory" >鏂板</el-button>
</div>
</div>
+
+ <PIMTable
+ rowKey="id"
+ :column="columns"
+ :tableData="renderTableData"
+ :tableLoading="loading"
+ :page="pagination"
+ :isShowPagination="true"
+ @pagination="handleSizeChange"
+ >
+ <template #status="{ row }">
+ <el-tag type="success" size="small">{{ row.status }}</el-tag>
+ </template>
+ </PIMTable>
- <div class="table_list">
- <el-table
- v-loading="loading"
- :data="renderTableData"
- style="width: 100%; margin-top: 10px;"
- border
- row-key="id"
- >
- <el-table-column prop="deviceNameStr" label="璁惧鍚嶇О" width="300"></el-table-column>
- <el-table-column prop="name" label="澶囦欢鍚嶇О" width="200"></el-table-column>
- <el-table-column prop="sparePartsNo" label="澶囦欢缂栧彿" width="200"></el-table-column>
- <el-table-column prop="status" label="鐘舵��" width="100">
- <template #default="{ row }">
- <el-tag type="success" size="small">{{ row.status }}</el-tag>
- </template>
- </el-table-column>
- <el-table-column prop="price" label="浠锋牸" width="140"></el-table-column>
- <el-table-column prop="quantity" label="鏁伴噺" width="140"></el-table-column>
- <el-table-column prop="description" label="鎻忚堪" width="150"></el-table-column>
- <el-table-column label="鎿嶄綔" width="150" fixed="right" align="center">
- <template #default="{ row }">
- <el-button
- link
- type="primary"
- @click="() => editCategory(row)"
- :disabled="loading"
- >
- 缂栬緫
- </el-button>
- <el-button
- link
- @click="() => deleteCategory(row.id)"
- style="color: #f56c6c;"
- :disabled="loading"
- >
- 鍒犻櫎
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
<el-dialog title="鍒嗙被绠$悊" v-model="dialogVisible" width="60%">
<el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
<el-form-item label="璁惧" prop="deviceLedgerIds">
@@ -147,6 +120,66 @@
const queryParams = reactive({
name: ''
});
+// 鍒嗛〉鍙傛暟
+const pagination = reactive({
+ current: 1,
+ size: 10,
+ total: 0
+});
+const columns = ref([
+ {
+ label: "璁惧鍚嶇О",
+ prop: "deviceNameStr",
+ },
+ {
+ label: "澶囦欢鍚嶇О",
+ prop: "name",
+ },
+ {
+ label: "澶囦欢缂栧彿",
+ prop: "sparePartsNo",
+ },
+ {
+ label: "鐘舵��",
+ prop: "status",
+ slot: "status",
+ dataType: "slot",
+ },
+ {
+ label: "浠锋牸",
+ prop: "price",
+ },
+ {
+ label: "鏁伴噺",
+ prop: "quantity",
+ },
+ {
+ label: "鎻忚堪",
+ prop: "description",
+ },
+ {
+ label: "鎿嶄綔",
+ prop: "operation",
+ width: 150,
+ fixed: 'right',
+ align: "center",
+ dataType: "action",
+ operation: [
+ {
+ name: "缂栬緫",
+ clickFun: (row) => {
+ editCategory(row)
+ },
+ },
+ {
+ name: "鍒犻櫎",
+ clickFun: (row) => {
+ deleteCategory(row.id)
+ },
+ },
+ ],
+ },
+]);
// 琛ㄥ崟鏁版嵁
const form = reactive({
id:'',
@@ -215,7 +248,10 @@
const fetchListData = async () => {
loading.value = true;
try {
- const params = {};
+ const params = {
+ current: pagination.current,
+ size: pagination.size
+ };
if (queryParams.name) {
params.name = queryParams.name;
}
@@ -223,6 +259,7 @@
if (res.code === 200) {
renderTableData.value = res.data.records || [];
categories.value = res.data.records || [];
+ pagination.total = res.data.total || 0;
}
} catch (error) {
loading.value = false;
@@ -233,12 +270,27 @@
// 鏌ヨ
const handleQuery = () => {
+ pagination.current = 1;
fetchListData();
}
// 閲嶇疆鏌ヨ
const resetQuery = () => {
queryParams.name = '';
+ pagination.current = 1;
+ fetchListData();
+}
+
+// 鍒嗛〉澶у皬鏀瑰彉
+const handleSizeChange = (size) => {
+ pagination.size = size;
+ pagination.current = 1;
+ fetchListData();
+}
+
+// 褰撳墠椤垫敼鍙�
+const handleCurrentChange = (current) => {
+ pagination.current = current;
fetchListData();
}
@@ -261,6 +313,7 @@
form.status = '';
form.description = '';
form.deviceLedgerIds = [];
+ form.quantity = undefined;
form.price = null;
operationType.value = 'add'
dialogVisible.value = true;
@@ -373,6 +426,13 @@
margin-top: unset;
}
+.pagination-container {
+ margin-top: 20px;
+ display: flex;
+ justify-content: flex-end;
+ padding: 16px 0;
+}
+
.el-table__header-wrapper th {
background-color: #f5f7fa;
font-weight: 600;
--
Gitblit v1.9.3