<template>
|
<el-dialog v-model="isShow"
|
title="库存详情"
|
width="90%"
|
top="3vh"
|
class="batch-no-qty-detail-dialog"
|
@close="closeModal">
|
<div class="detail-content">
|
<div class="detail-table-wrapper">
|
<el-table :data="tableData"
|
border
|
v-loading="tableLoading"
|
style="width: 100%"
|
height="100%">
|
<el-table-column label="产品名称"
|
prop="productName"
|
show-overflow-tooltip />
|
<el-table-column label="规格型号"
|
prop="model"
|
show-overflow-tooltip />
|
<el-table-column label="厂家"
|
prop="manufacturerId"
|
show-overflow-tooltip>
|
<template #default="scope">
|
{{ getManufacturerName(scope.row.manufacturerId) }}
|
</template>
|
</el-table-column>
|
<el-table-column label="来源"
|
show-overflow-tooltip>
|
<template #default="scope">
|
{{ scope.row.sourceText || "--" }}
|
</template>
|
</el-table-column>
|
<el-table-column label="单位"
|
prop="unit"
|
show-overflow-tooltip />
|
<el-table-column label="批号"
|
prop="batchNo"
|
show-overflow-tooltip />
|
<el-table-column label="库存数量"
|
prop="qualitity"
|
show-overflow-tooltip />
|
<el-table-column label="备注"
|
prop="remark"
|
show-overflow-tooltip />
|
<el-table-column label="最近更新时间"
|
prop="updateTime"
|
show-overflow-tooltip />
|
</el-table>
|
</div>
|
<pagination v-show="total > 0"
|
:total="total"
|
layout="total, sizes, prev, pager, next, jumper"
|
:page="page.current"
|
:limit="page.size"
|
@pagination="paginationChange" />
|
</div>
|
</el-dialog>
|
</template>
|
|
<script setup>
|
import pagination from "@/components/PIMTable/Pagination.vue";
|
import { computed, reactive, ref, watch, onMounted } from "vue";
|
import { getWasteBatchNoQty } from "@/api/inventoryManagement/stockUninventory.js";
|
import { getManufacturerOptions } from "@/api/inspectionManagement/manufacturerManageFile.js";
|
|
const props = defineProps({
|
visible: {
|
type: Boolean,
|
required: true,
|
},
|
record: {
|
type: Object,
|
default: () => ({}),
|
},
|
});
|
|
const emit = defineEmits(["update:visible"]);
|
|
const isShow = computed({
|
get() {
|
return props.visible;
|
},
|
set(val) {
|
emit("update:visible", val);
|
},
|
});
|
|
const tableData = ref([]);
|
const tableLoading = ref(false);
|
const manufacturerOptions = ref([]);
|
const total = ref(0);
|
const page = reactive({
|
current: 1,
|
size: 20,
|
});
|
|
const getManufacturerName = manufacturerId => {
|
return (
|
manufacturerOptions.value.find(item => item.id === manufacturerId)?.name ||
|
"--"
|
);
|
};
|
|
const fetchManufacturerOptions = () => {
|
getManufacturerOptions().then(res => {
|
manufacturerOptions.value = res.data || [];
|
});
|
};
|
|
onMounted(() => {
|
fetchManufacturerOptions();
|
});
|
|
const getList = () => {
|
if (!props.record?.productId || !props.record?.productModelId) {
|
tableData.value = [];
|
total.value = 0;
|
return;
|
}
|
|
tableLoading.value = true;
|
getWasteBatchNoQty({
|
current: page.current,
|
size: page.size,
|
productId: props.record.productId,
|
productModelId: props.record.productModelId,
|
type: "waste",
|
})
|
.then(res => {
|
tableData.value = res.data?.records || [];
|
total.value = res.data?.total || 0;
|
})
|
.finally(() => {
|
tableLoading.value = false;
|
});
|
};
|
|
const paginationChange = obj => {
|
page.current = obj.page;
|
page.size = obj.limit;
|
getList();
|
};
|
|
const closeModal = () => {
|
isShow.value = false;
|
page.current = 1;
|
page.size = 20;
|
tableData.value = [];
|
total.value = 0;
|
};
|
|
watch(
|
() => props.visible,
|
visible => {
|
if (!visible) {
|
return;
|
}
|
page.current = 1;
|
getList();
|
},
|
{ immediate: true }
|
);
|
</script>
|
|
<style scoped lang="scss">
|
.detail-content {
|
display: flex;
|
flex-direction: column;
|
height: calc(100vh - 170px);
|
min-height: 520px;
|
}
|
|
.detail-table-wrapper {
|
flex: 1;
|
min-height: 0;
|
}
|
|
:deep(.batch-no-qty-detail-dialog .el-dialog) {
|
max-width: calc(100vw - 48px);
|
}
|
|
:deep(.batch-no-qty-detail-dialog .el-dialog__body) {
|
padding-top: 12px;
|
}
|
</style>
|