From ea1a0a7522dbe869e02cdde1042fe2596d413bef Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期四, 05 三月 2026 11:37:05 +0800
Subject: [PATCH] 坤泰修改产出统计
---
src/views/equipmentManagement/spareParts/index.vue | 153 ++++++++++++++++++++++++++++++++------------------
1 files changed, 98 insertions(+), 55 deletions(-)
diff --git a/src/views/equipmentManagement/spareParts/index.vue b/src/views/equipmentManagement/spareParts/index.vue
index eb0bdd5..68e0f6e 100644
--- a/src/views/equipmentManagement/spareParts/index.vue
+++ b/src/views/equipmentManagement/spareParts/index.vue
@@ -19,48 +19,19 @@
<el-button type="primary" @click="addCategory" >鏂板</el-button>
</div>
</div>
-
- <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>
+ <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>
<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">
@@ -99,16 +70,6 @@
<el-form-item label="鎻忚堪" prop="description">
<el-input v-model="form.description"></el-input>
</el-form-item>
- <el-form-item label="浠锋牸" prop="price">
- <el-input-number
- v-model="form.price"
- placeholder="璇疯緭鍏ヤ环鏍�"
- :min="0"
- :step="0.01"
- :precision="2"
- style="width: 100%"
- ></el-input-number>
- </el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
@@ -125,6 +86,7 @@
import { ElMessage, ElMessageBox } from 'element-plus';
import { getSparePartsList, addSparePart, editSparePart, delSparePart } from "@/api/equipmentManagement/spareParts";
import { getDeviceLedger } from "@/api/equipmentManagement/ledger";
+import PIMTable from "@/components/PIMTable/PIMTable.vue";
// 鍔犺浇鐘舵��
const loading = ref(false);
@@ -147,6 +109,12 @@
const queryParams = reactive({
name: ''
});
+// 鍒嗛〉鍙傛暟
+const pagination = reactive({
+ current: 1,
+ size: 10,
+ total: 0
+});
// 琛ㄥ崟鏁版嵁
const form = reactive({
id:'',
@@ -155,7 +123,6 @@
status: '',
description: '',
deviceLedgerIds: [],
- price: null
});
// 琛ㄥ崟楠岃瘉瑙勫垯
@@ -187,6 +154,56 @@
}
]
});
+const columns = ref([
+ {
+ label: "璁惧鍚嶇О",
+ prop: "deviceNameStr",
+ },
+ {
+ label: "澶囦欢鍚嶇О",
+ prop: "name",
+ },
+ {
+ label: "澶囦欢缂栧彿",
+ prop: "sparePartsNo",
+ },
+ {
+ label: "鐘舵��",
+ prop: "status",
+ slot: "status",
+ dataType: "slot",
+ },
+ {
+ 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 getIndentation = (row) => {
// 杩欓噷绠�鍗曡繑鍥� 20锛屽彲鏍规嵁瀹為檯闇�姹傚疄鐜板眰绾х缉杩涢�昏緫
@@ -215,7 +232,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 +243,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 +254,27 @@
// 鏌ヨ
const handleQuery = () => {
+ pagination.current = 1;
fetchListData();
}
// 閲嶇疆鏌ヨ
const resetQuery = () => {
queryParams.name = '';
+ pagination.current = 1;
+ fetchListData();
+}
+
+// 鍒嗛〉澶у皬鏀瑰彉
+const handleSizeChange = (obj) => {
+ pagination.current = obj.page;
+ pagination.size = obj.limit;
+ fetchListData();
+}
+
+// 褰撳墠椤垫敼鍙�
+const handleCurrentChange = (current) => {
+ pagination.current = current;
fetchListData();
}
@@ -260,8 +296,8 @@
form.sparePartsNo = '';
form.status = '';
form.description = '';
+ form.quantity = undefined;
form.deviceLedgerIds = [];
- form.price = null;
operationType.value = 'add'
dialogVisible.value = true;
};
@@ -373,6 +409,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