src/views/equipmentManagement/spareParts/index.vue
@@ -21,20 +21,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">
               <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>
        <el-dialog title="分类管理" v-model="dialogVisible" width="60%">
          <el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
@@ -98,12 +99,12 @@
        <div class="search_form">
          <el-form :inline="true" :model="usageQuery" class="search-form">
            <el-form-item label="备件名称">
              <el-input v-model="usageQuery.sparePartName" placeholder="请输入备件名称" clearable style="width: 240px" />
              <el-input v-model="usageQuery.sparePartsName" placeholder="请输入备件名称" clearable style="width: 240px" />
            </el-form-item>
            <el-form-item label="来源">
              <el-select v-model="usageQuery.source" placeholder="请选择" clearable style="width: 200px">
                <el-option label="维修" value="repair" />
                <el-option label="保养" value="upkeep" />
              <el-select v-model="usageQuery.sourceType" placeholder="请选择" clearable style="width: 200px">
                <el-option label="维修" :value="0" />
                <el-option label="保养" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item>
@@ -112,16 +113,17 @@
            </el-form-item>
          </el-form>
        </div>
        <PIMTable
          rowKey="rowKey"
          :column="usageColumns"
          :tableData="usageTableData"
          :tableLoading="usageLoading"
          :page="usagePagination"
          :isShowPagination="true"
          @pagination="handleUsagePageChange"
        />
            <div class="table_list">
               <PIMTable
                  rowKey="rowKey"
                  :column="usageColumns"
                  :tableData="usageTableData"
                  :tableLoading="usageLoading"
                  :page="usagePagination"
                  :isShowPagination="true"
                  @pagination="handleUsagePageChange"
               />
            </div>
      </el-tab-pane>
    </el-tabs>
  </div>
@@ -167,8 +169,8 @@
// 备件领用记录
const usageLoading = ref(false);
const usageQuery = reactive({
  sparePartName: "",
  source: "",
  sparePartsName: "",
  sourceType: "",
});
const usagePagination = reactive({
  current: 1,
@@ -180,10 +182,10 @@
  { label: "来源", prop: "sourceText" },
  { label: "单据/记录ID", prop: "sourceId" },
  { label: "设备名称", prop: "deviceName" },
  { label: "备件名称", prop: "sparePartName" },
  { label: "领用数量", prop: "qty" },
  { label: "备件名称", prop: "sparePartsName" },
  { label: "领用数量", prop: "quantity" },
  { label: "操作人", prop: "operator" },
  { label: "时间", prop: "time" },
  { label: "时间", prop: "createTime" },
]);
const handleTabChange = async (name) => {
@@ -340,8 +342,8 @@
    const res = await getSparePartsUsagePage({
      current: usagePagination.current,
      size: usagePagination.size,
      sparePartName: usageQuery.sparePartName || undefined,
      source: usageQuery.source || undefined,
      sparePartsName: usageQuery.sparePartsName || undefined,
      sourceType: usageQuery.sourceType || undefined,
    });
    if (res?.code === 200) {
      const records = res?.data?.records || [];
@@ -349,11 +351,7 @@
      usageTableData.value = records.map((r, idx) => ({
        rowKey: r.id ?? `${usagePagination.current}-${idx}`,
        ...r,
        sourceText:
          r.source === "维修" ? "维修" :
          r.source === "保养" ? "保养" :
          r.source === "manual" ? "手工" :
          (r.source || "-"),
        sourceText: r.sourceText === "" ? "-" : r.sourceText,
      }));
    } else {
      usagePagination.total = 0;
@@ -369,8 +367,8 @@
  fetchUsageData();
};
const resetUsageQuery = () => {
  usageQuery.sparePartName = "";
  usageQuery.source = "";
  usageQuery.sparePartsName = "";
  usageQuery.sourceType = "";
  usagePagination.current = 1;
  fetchUsageData();
};
@@ -542,7 +540,6 @@
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  padding: 16px 0;
}
.el-table__header-wrapper th {