From f5d05d68f7f507ae58c48b6a741b57dd50bcfe32 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期三, 04 三月 2026 16:53:11 +0800
Subject: [PATCH] 备件管理:优化列表页展示,修复点击新增后,数量显示问题

---
 src/views/equipmentManagement/spareParts/index.vue |  122 +++++++++++++++++++++++-----------------
 1 files changed, 69 insertions(+), 53 deletions(-)

diff --git a/src/views/equipmentManagement/spareParts/index.vue b/src/views/equipmentManagement/spareParts/index.vue
index 0b0dae2..4a48d28 100644
--- a/src/views/equipmentManagement/spareParts/index.vue
+++ b/src/views/equipmentManagement/spareParts/index.vue
@@ -19,60 +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="鎻忚堪"></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 class="pagination-container">
-        <el-pagination
-          v-model:current-page="pagination.current"
-          v-model:page-size="pagination.size"
-          :page-sizes="[10, 20, 50, 100]"
-          :total="pagination.total"
-          layout="total, sizes, prev, pager, next, jumper"
-          @size-change="handleSizeChange"
-          @current-change="handleCurrentChange"
-        />
-      </div>
-    </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">
@@ -165,6 +126,60 @@
   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:'',
@@ -298,6 +313,7 @@
   form.status = '';
   form.description = '';
   form.deviceLedgerIds = [];
+  form.quantity = undefined;
   form.price = null;
   operationType.value = 'add'
   dialogVisible.value = true;

--
Gitblit v1.9.3