huminmin
2026-04-03 d99337be75724c5add989f0775e1bd188f7516f7
src/views/equipmentManagement/spareParts/index.vue
@@ -98,12 +98,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="维修" />
                <el-option label="保养" value="保养" />
              <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>
@@ -167,8 +167,8 @@
// 备件领用记录
const usageLoading = ref(false);
const usageQuery = reactive({
  sparePartName: "",
  source: "",
  sparePartsName: "",
  sourceType: "",
});
const usagePagination = reactive({
  current: 1,
@@ -180,10 +180,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 +340,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 +349,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 +365,8 @@
  fetchUsageData();
};
const resetUsageQuery = () => {
  usageQuery.sparePartName = "";
  usageQuery.source = "";
  usageQuery.sparePartsName = "";
  usageQuery.sourceType = "";
  usagePagination.current = 1;
  fetchUsageData();
};