| | |
| | | <template> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="库存详情" |
| | | width="90%" |
| | | top="3vh" |
| | | class="batch-no-qty-detail-dialog" |
| | | @close="closeModal" |
| | | > |
| | | <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="unit" show-overflow-tooltip /> |
| | | <el-table-column label="批号" prop="batchNo" show-overflow-tooltip /> |
| | | <el-table-column |
| | | label="合格库存数量" |
| | | prop="qualifiedQuantity" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="不合格库存数量" |
| | | prop="unQualifiedQuantity" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="合格冻结数量" |
| | | prop="qualifiedLockedQuantity" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="不合格冻结数量" |
| | | prop="unQualifiedLockedQuantity" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="库存预警数量" |
| | | prop="warnNum" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column label="备注" prop="remark" show-overflow-tooltip /> |
| | | <el-table-column |
| | | label="最近更新时间" |
| | | prop="updateTime" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column fixed="right" label="操作" min-width="180" align="center"> |
| | | <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"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | @click="handleSubtract(scope.row)" |
| | | :disabled=" |
| | | {{ getManufacturerName(scope.row.manufacturerId) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="来源" |
| | | show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | {{ scope.row.qualifiedSourceText || scope.row.unQualifiedSourceText || "--" }} |
| | | </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="qualifiedQuantity" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="不合格库存数量" |
| | | prop="unQualifiedQuantity" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="合格冻结数量" |
| | | prop="qualifiedLockedQuantity" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="不合格冻结数量" |
| | | prop="unQualifiedLockedQuantity" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="库存预警数量" |
| | | prop="warnNum" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="备注" |
| | | prop="remark" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="最近更新时间" |
| | | prop="updateTime" |
| | | show-overflow-tooltip /> |
| | | <el-table-column fixed="right" |
| | | label="操作" |
| | | min-width="180" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleSubtract(scope.row)" |
| | | :disabled=" |
| | | (scope.row.qualifiedUnLockedQuantity || 0) + |
| | | (scope.row.qualifiedPendingOutQuantity || 0) <= |
| | | 0 && |
| | | (scope.row.unQualifiedUnLockedQuantity || 0) + |
| | | (scope.row.unQualifiedPendingOutQuantity || 0) <= |
| | | 0 |
| | | " |
| | | >领用</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | v-if=" |
| | | ">领用</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | v-if=" |
| | | scope.row.unQualifiedUnLockedQuantity > 0 || |
| | | scope.row.qualifiedUnLockedQuantity > 0 |
| | | " |
| | | @click="handleFrozen(scope.row)" |
| | | >冻结</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | v-if=" |
| | | @click="handleFrozen(scope.row)">冻结</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | v-if=" |
| | | scope.row.qualifiedLockedQuantity > 0 || |
| | | scope.row.unQualifiedLockedQuantity > 0 |
| | | " |
| | | @click="handleThaw(scope.row)" |
| | | >解冻</el-button |
| | | > |
| | | @click="handleThaw(scope.row)">解冻</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </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" |
| | | /> |
| | | <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 } from "vue"; |
| | | import { getStockInventoryBatchNoQty } from "@/api/inventoryManagement/stockInventory.js"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { computed, reactive, ref, watch, onMounted } from "vue"; |
| | | import { getStockInventoryBatchNoQty } from "@/api/inventoryManagement/stockInventory.js"; |
| | | import { getManufacturerOptions } from "@/api/inspectionManagement/manufacturerManageFile.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | record: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | }); |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | record: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | }); |
| | | |
| | | const emit = defineEmits(["update:visible", "subtract", "frozen", "thaw"]); |
| | | const emit = defineEmits(["update:visible", "subtract", "frozen", "thaw"]); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit("update:visible", val); |
| | | }, |
| | | }); |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit("update:visible", val); |
| | | }, |
| | | }); |
| | | |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const total = ref(0); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 20, |
| | | }); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const manufacturerOptions = ref([]); |
| | | const total = ref(0); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 20, |
| | | }); |
| | | |
| | | const getList = () => { |
| | | if (!props.record?.productId || !props.record?.productModelId) { |
| | | tableData.value = []; |
| | | total.value = 0; |
| | | return; |
| | | } |
| | | const getManufacturerName = manufacturerId => { |
| | | return ( |
| | | manufacturerOptions.value.find(item => item.id === manufacturerId)?.name || |
| | | "--" |
| | | ); |
| | | }; |
| | | |
| | | tableLoading.value = true; |
| | | getStockInventoryBatchNoQty({ |
| | | current: page.current, |
| | | size: page.size, |
| | | productId: props.record.productId, |
| | | productModelId: props.record.productModelId, |
| | | }) |
| | | .then((res) => { |
| | | tableData.value = res.data?.records || []; |
| | | total.value = res.data?.total || 0; |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | const fetchManufacturerOptions = () => { |
| | | getManufacturerOptions().then(res => { |
| | | manufacturerOptions.value = res.data || []; |
| | | }); |
| | | }; |
| | | }; |
| | | |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | onMounted(() => { |
| | | fetchManufacturerOptions(); |
| | | }); |
| | | |
| | | const handleSubtract = (row) => { |
| | | emit("subtract", row); |
| | | }; |
| | | |
| | | const handleFrozen = (row) => { |
| | | emit("frozen", row); |
| | | }; |
| | | |
| | | const handleThaw = (row) => { |
| | | emit("thaw", row); |
| | | }; |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | page.current = 1; |
| | | page.size = 20; |
| | | tableData.value = []; |
| | | total.value = 0; |
| | | }; |
| | | |
| | | watch( |
| | | () => props.visible, |
| | | (visible) => { |
| | | if (!visible) { |
| | | const getList = () => { |
| | | if (!props.record?.productId || !props.record?.productModelId) { |
| | | tableData.value = []; |
| | | total.value = 0; |
| | | return; |
| | | } |
| | | page.current = 1; |
| | | |
| | | tableLoading.value = true; |
| | | getStockInventoryBatchNoQty({ |
| | | current: page.current, |
| | | size: page.size, |
| | | productId: props.record.productId, |
| | | productModelId: props.record.productModelId, |
| | | }) |
| | | .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(); |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | }; |
| | | |
| | | const handleSubtract = row => { |
| | | emit("subtract", row); |
| | | }; |
| | | |
| | | const handleFrozen = row => { |
| | | emit("frozen", row); |
| | | }; |
| | | |
| | | const handleThaw = row => { |
| | | emit("thaw", row); |
| | | }; |
| | | |
| | | 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-content { |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: calc(100vh - 170px); |
| | | min-height: 520px; |
| | | } |
| | | |
| | | .detail-table-wrapper { |
| | | flex: 1; |
| | | min-height: 0; |
| | | } |
| | | .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) { |
| | | max-width: calc(100vw - 48px); |
| | | } |
| | | |
| | | :deep(.batch-no-qty-detail-dialog .el-dialog__body) { |
| | | padding-top: 12px; |
| | | } |
| | | :deep(.batch-no-qty-detail-dialog .el-dialog__body) { |
| | | padding-top: 12px; |
| | | } |
| | | </style> |