| | |
| | | <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> |
| | |
| | | // 备件领用记录 |
| | | const usageLoading = ref(false); |
| | | const usageQuery = reactive({ |
| | | sparePartName: "", |
| | | source: "", |
| | | sparePartsName: "", |
| | | sourceType: "", |
| | | }); |
| | | const usagePagination = reactive({ |
| | | current: 1, |
| | |
| | | { 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) => { |
| | |
| | | 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 || []; |
| | |
| | | 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; |
| | |
| | | fetchUsageData(); |
| | | }; |
| | | const resetUsageQuery = () => { |
| | | usageQuery.sparePartName = ""; |
| | | usageQuery.source = ""; |
| | | usageQuery.sparePartsName = ""; |
| | | usageQuery.sourceType = ""; |
| | | usagePagination.current = 1; |
| | | fetchUsageData(); |
| | | }; |