| | |
| | | style="width: 240px" |
| | | placeholder="请输入" |
| | | clearable/> |
| | | <span class="search_title ml10">质检状态:</span> |
| | | <el-select v-model="searchForm.type" |
| | | style="width: 240px" |
| | | placeholder="请选择"> |
| | | <el-option label="合格" :value="0" /> |
| | | <el-option label="不合格" :value="1" /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button> |
| | | <el-button @click="handleReset">重置</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="isShowNewModal = true">新增库存</el-button> |
| | |
| | | <el-table-column label="规格型号" prop="model" show-overflow-tooltip /> |
| | | <el-table-column label="单位" prop="unit" show-overflow-tooltip /> |
| | | <el-table-column label="库存数量" prop="qualitity" show-overflow-tooltip /> |
| | | <el-table-column label="质检状态" |
| | | show-overflow-tooltip |
| | | width="100"> |
| | | <template #default="scope"> |
| | | <el-tag :type="searchForm.type == 0 ? 'success' : 'danger'" size="small"> |
| | | {{ searchForm.type == 0 ? '合格' : '不合格' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="冻结数量" prop="lockedQuantity" 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="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="showSubtractModal(scope.row)" :disabled="scope.row.qualitity === 0">领用</el-button> |
| | | <el-button link type="primary" size="small" @click="showSubtractModal(scope.row)" :disabled="scope.row.unLockedQuantity === 0">领用</el-button> |
| | | <el-button link type="primary" size="small" v-if="scope.row.unLockedQuantity > 0" @click="showFrozenModal(scope.row)">冻结</el-button> |
| | | <el-button link type="primary" size="small" v-if="scope.row.lockedQuantity > 0" @click="showThawModal(scope.row)">解冻</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </div> |
| | | <new-stock-inventory v-if="isShowNewModal" |
| | | v-model:visible="isShowNewModal" |
| | | type="qualified" |
| | | :type="searchForm.type === 0 ? 'qualified' : 'unqualified'" |
| | | @completed="handleQuery" /> |
| | | |
| | | <subtract-stock-inventory v-if="isShowSubtractModal" |
| | | v-model:visible="isShowSubtractModal" |
| | | :record="record" |
| | | :type="searchForm.type === 0 ? 'qualified' : 'unqualified'" |
| | | @completed="handleQuery" /> |
| | | <!-- 导入库存--> |
| | | <import-stock-inventory v-if="isShowImportModal" |
| | | v-model:visible="isShowImportModal" |
| | | type="qualified" |
| | | :type="searchForm.type === 0 ? 'qualified' : 'unqualified'" |
| | | @uploadSuccess="handleQuery" /> |
| | | <!-- 冻结/解冻库存--> |
| | | <frozen-and-thaw-stock-inventory v-if="isShowFrozenAndThawModal" |
| | | v-model:visible="isShowFrozenAndThawModal" |
| | | :record="record" |
| | | :operation-type="operationType" |
| | | :type="searchForm.type === 0 ? 'qualified' : 'unqualified'" |
| | | @completed="handleQuery" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue' |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance, watch, computed } from 'vue' |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import { getStockInventoryListPage } from "@/api/inventoryManagement/stockInventory.js"; |
| | | import { getStockUninventoryListPage } from "@/api/inventoryManagement/stockUninventory.js"; |
| | | const NewStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/New.vue")); |
| | | const SubtractStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/Subtract.vue")); |
| | | const ImportStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/Import.vue")); |
| | | const FrozenAndThawStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/FrozenAndThaw.vue")); |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | const props = defineProps({ |
| | | type: { |
| | | type: Number, |
| | | required: true, |
| | | default: 1 |
| | | } |
| | | }) |
| | | |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const record = ref({}) |
| | |
| | | const isShowNewModal = ref(false) |
| | | // 是否显示领用弹框 |
| | | const isShowSubtractModal = ref(false) |
| | | // 是否显示冻结/解冻弹框 |
| | | const isShowFrozenAndThawModal = ref(false) |
| | | // 操作类型 |
| | | const operationType = ref('frozen') |
| | | // 是否显示导入弹框 |
| | | const isShowImportModal = ref(false) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | productName: '', |
| | | type: 0, |
| | | } |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | |
| | | const qualityType = computed(() => { |
| | | return searchForm.value.type === 0 ? 'qualified' : 'unqualified'; |
| | | }) |
| | | |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | /** 重置按钮操作 */ |
| | | const handleReset = () => { |
| | | searchForm.value.productName = ''; |
| | | searchForm.value.type = 0; |
| | | handleQuery(); |
| | | } |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | getStockInventoryListPage({ ...searchForm.value, ...page }).then(res => { |
| | | const params = { ...searchForm.value, ...page, productType: props.type }; |
| | | params.type = searchForm.value.type; |
| | | |
| | | const apiCall = searchForm.value.type === 0 ? getStockInventoryListPage : getStockUninventoryListPage; |
| | | const exportApi = searchForm.value.type === 0 ? "/stockInventory/exportStockInventory" : "/stockUninventory/exportStockUninventory"; |
| | | |
| | | apiCall(params).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | |
| | | isShowSubtractModal.value = true |
| | | } |
| | | |
| | | // 点击冻结 |
| | | const showFrozenModal = (row) => { |
| | | record.value = row |
| | | isShowFrozenAndThawModal.value = true |
| | | operationType.value = 'frozen' |
| | | } |
| | | |
| | | // 点击解冻 |
| | | const showThawModal = (row) => { |
| | | record.value = row |
| | | isShowFrozenAndThawModal.value = true |
| | | operationType.value = 'thaw' |
| | | } |
| | | |
| | | // 表格选择数据 |
| | | const handleSelectionChange = (selection) => { |
| | | // 过滤掉子数据 |
| | |
| | | |
| | | // 表格行类名 |
| | | const tableRowClassName = ({ row }) => { |
| | | const stock = Number(row?.inboundNum0 ?? 0); |
| | | const stock = Number(row?.unLockedQuantity ?? 0); |
| | | const warn = Number(row?.warnNum ?? 0); |
| | | if (!Number.isFinite(stock) || !Number.isFinite(warn)) { |
| | | return ''; |
| | |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/stockInventory/exportStockInventory", {}, '合格库存信息.xlsx') |
| | | const fileNameMap = { |
| | | 1: '自制库存信息.xlsx', |
| | | 2: '外购库存信息.xlsx', |
| | | 3: '委外库存信息.xlsx' |
| | | }; |
| | | const exportApi = searchForm.value.type === 0 ? "/stockInventory/exportStockInventory" : "/stockUninventory/exportStockUninventory"; |
| | | proxy.download(exportApi, {productType: props.type}, fileNameMap[props.type] || '库存信息.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已取消") |
| | | }) |
| | |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | |
| | | watch(() => props.type, () => { |
| | | page.current = 1 |
| | | getList() |
| | | }) |
| | | |
| | | watch(() => searchForm.value.type, () => { |
| | | page.current = 1 |
| | | getList() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |