仓库bug

This commit is contained in:
2025-12-09 09:52:20 +08:00
parent eaa681c9ff
commit 19702c25e5
7 changed files with 188 additions and 68 deletions

View File

@@ -46,10 +46,11 @@ export function getDetailInit() {
}
// 生成批量盘点
export function getStocktakingReceiptBatch() {
export function getStocktakingReceiptBatch(params) {
return request({
url: '/inventory-manage/stocktaking/stocktaking-receipt-batch',
method: 'get'
method: 'get',
params: params
})
}
//保存批量盘点
@@ -119,4 +120,4 @@ export function getDispensaryList() {
url: '/app-common/cabinet-list',
method: 'get',
})
}
}

View File

@@ -53,7 +53,7 @@
clearable
style="width: 150px"
:disabled="data.isEdit"
@change="handleChangePurposeTypeEnum"
@change="(value) => handleChangePurposeTypeEnum(value, 0)"
>
<el-option
v-for="dict in warehous_type"
@@ -736,16 +736,15 @@ import {
submitApproval,
getInit,
delProductStocktaking,
getPharmacyList,
getCount,
getDispensaryList,
getMedicineList,
getDetailInit,
getstocktakingDetail, //查询盘点详情
getStocktakingReceiptBatch, //生成批量盘点
addBatch, //保存批量盘点
productStocktakingApproved,
reject
reject,
getpharmacyCabinetList
} from "../components/api";
import PopoverList from "@/components/OpenHis/popoverList/index.vue";
import MedicineList from "../components/medicineList.vue";
@@ -2015,8 +2014,6 @@ function getStockReceiptTypeList() {
// categoryListOptions.value = response.data.categoryListOptions; // 药品类型
profitReasonOptions.value = response.data.profitReasonOptions; // 盈亏原因
// receiptHeaderForm.purposeTypeEnum = warehous_type.value[0].value // 仓库类型默认值
// handleChangePurposeTypeEnum(receiptHeaderForm.purposeTypeEnum)
// cabinetListOptionsBk.value = response.data.purposeTypeListOptions; // 盘点仓库列表(未过滤)
// purposeTypeListOptions.value = cabinetListOptionsBk.value.filter(item => item.formEnum === receiptHeaderForm.purposeTypeEnum) // 盘点仓库列表
@@ -2107,24 +2104,46 @@ function totalQuantityChange(rowData,index,value) {
}
// 切换仓库类型获取药房/药库列表 目的仓库切换
function handleChangePurposeTypeEnum(value,type) {
if (value == 16) {
getPharmacyList().then((res) => {
purposeTypeListOptions.value = res.data
if(!route.query.supplyBusNo&&!type){
receiptHeaderForm.purposeLocationId = ''
receiptHeaderForm.purposeLocationId1 = ''
}
// getinitValue()
});
} else if (value == 11) {
getDispensaryList().then((res) => {
purposeTypeListOptions.value = res.data
if(!route.query.supplyBusNo&&!type){
receiptHeaderForm.purposeLocationId = ''
receiptHeaderForm.purposeLocationId1 = ''
}
// getinitValue()
// 确保value是数字类型
const numValue = Number(value);
// 清空已选择的盘点仓库
if(!route.query.supplyBusNo&&!type){
receiptHeaderForm.purposeLocationId = ''
receiptHeaderForm.purposeLocationId1 = ''
}
// 根据选择的仓库类型调用不同的API获取对应类型的仓库列表
if (numValue === 16 || numValue === 11) {
// 使用统一接口获取药房或药库列表
getpharmacyCabinetList().then((res) => {
// 过滤出符合当前类型的仓库列表
const filteredList = res.data.filter(item => item.formEnum === numValue);
purposeTypeListOptions.value = filteredList;
// 调用getinitValue设置默认仓库和货位
getinitValue();
}).catch((error) => {
console.error('获取仓库列表失败:', error);
purposeTypeListOptions.value = [];
freightListOptions.value = [];
});
} else if (numValue === 17) {
// 处理耗材库类型
// 参考采购订单模块的实现,硬编码设置中心耗材库信息
purposeTypeListOptions.value = [
{
id: "1",
name: "中心耗材库",
formEnum: 17,
children: []
}
];
// 设置默认仓库和货位
getinitValue();
} else {
console.log('未知的仓库类型值:', value);
purposeTypeListOptions.value = [];
freightListOptions.value = [];
}
}
// 获取默认值

View File

@@ -46,10 +46,11 @@ export function getDetailInit() {
}
// 生成批量盘点
export function getStocktakingReceiptBatch() {
export function getStocktakingReceiptBatch(params) {
return request({
url: '/inventory-manage/stocktaking/stocktaking-receipt-batch',
method: 'get'
method: 'get',
params: params
})
}
//保存批量盘点

View File

@@ -58,7 +58,7 @@
clearable
style="width: 150px"
:disabled="data.isEdit"
@change="handleChangePurposeTypeEnum"
@change="(value) => handleChangePurposeTypeEnum(value, false)"
>
<!-- handlePurposeType原方法 -->
<el-option
@@ -622,6 +622,7 @@ import {
getstocktakingDetail,
productStocktakingApproved,
reject,
getpharmacyCabinetList
} from '../components/api';
import PopoverList from '@/components/OpenHis/popoverList/index.vue';
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
@@ -629,6 +630,7 @@ import MedicineList from '../components/medicineList.vue';
import { formatDate, formatDateymd } from '@/utils/index';
import useUserStore from '@/store/modules/user';
import { useRoute } from 'vue-router';
import { ref, reactive, watch, onMounted, onUnmounted, toRefs, defineEmits, getCurrentInstance } from 'vue';
import { useStore } from '@/store/store';
import useTagsViewStore from '@/store/modules/tagsView';
import { debounce } from 'lodash-es';
@@ -714,7 +716,7 @@ const data = reactive({
},
});
const { queryParams, rules, tableRules } = toRefs(data);
const purposeTypeListOptions = ref(undefined); // 仓库列表
const purposeTypeListOptions = ref([]); // 仓库列表
const cabinetListOptionsBk = ref(undefined); // 仓库列表(未过滤的)
const freightListOptions = ref(undefined); // 货位列表
const categoryListOptions = ref(undefined); // 药品类型
@@ -771,6 +773,8 @@ onMounted(() => {
receiptHeaderForm.startTime = route.query.startTime || '';
receiptHeaderForm.endTime = route.query.endTime || '';
}
// 初始化数据,加载仓库列表
getStockReceiptTypeList();
});
// 卸载时移除事件
@@ -971,7 +975,7 @@ function getTransferProductDetails(type) {
receiptHeaderForm.purposeTypeEnum = item.label;
}
});
handleChangePurposeTypeEnum(e.purposeTypeEnum);
handleChangePurposeTypeEnum(e.purposeTypeEnum, true);
}
if (e.purposeLocationId) {
@@ -1103,7 +1107,7 @@ function getTransferProductDetails(type) {
receiptHeaderForm.purposeTypeEnum = item.label;
}
});
handleChangePurposeTypeEnum(e.purposeTypeEnum);
handleChangePurposeTypeEnum(e.purposeTypeEnum, true);
}
if (e.purposeLocationId) {
receiptHeaderForm.purposeLocationId = e.purposeLocationId;
@@ -2105,23 +2109,51 @@ function handleTraceNo(value, row) {
// 切换仓库类型获取药房/药库列表 目的仓库切换
function handleChangePurposeTypeEnum(value, type) {
if (value == 16) {
getPharmacyList().then((res) => {
purposeTypeListOptions.value = res.data;
if (!route.query.supplyBusNo && !type) {
receiptHeaderForm.purposeLocationId = '';
}
// getinitValue()
});
} else if (value == 11) {
getDispensaryList().then((res) => {
purposeTypeListOptions.value = res.data;
if (!route.query.supplyBusNo && !type) {
receiptHeaderForm.purposeLocationId = '';
}
// getinitValue()
});
console.log('handleChangePurposeTypeEnum called with value:', value, 'type:', type);
const numValue = Number(value);
// 清空已选择的仓库和货位
if (!route.query.supplyBusNo && !type) {
receiptHeaderForm.purposeLocationId = '';
receiptHeaderForm.purposeLocation = '';
}
if (numValue === 16 || numValue === 11) {
console.log('Calling getpharmacyCabinetList for warehouse type:', numValue);
// 使用统一接口获取药房或药库列表
getpharmacyCabinetList().then((res) => {
console.log('getPharmacyCabinetList response:', res);
// 过滤出符合当前类型的仓库列表
const filteredList = res.data.filter(item => item.formEnum === numValue);
purposeTypeListOptions.value = filteredList;
console.log('purposeTypeListOptions set to filtered list:', purposeTypeListOptions.value);
// 设置默认仓库和货位
getinitValue();
}).catch((error) => {
console.error('getPharmacyCabinetList error:', error);
purposeTypeListOptions.value = [];
freightListOptions.value = [];
});
} else if (numValue === 17) {
console.log('Setting hardcoded consumable warehouse');
// 处理耗材库类型
// 参考采购订单模块的实现,硬编码设置中心耗材库信息
purposeTypeListOptions.value = [
{
id: "1",
name: "中心耗材库",
formEnum: 17,
children: []
}
];
console.log('purposeTypeListOptions set to:', purposeTypeListOptions.value);
// 设置默认仓库和货位
getinitValue();
} else {
console.log('Unknown value:', value);
purposeTypeListOptions.value = [];
freightListOptions.value = [];
}
}
// 获取默认值
function getinitValue() {
@@ -2146,8 +2178,13 @@ function getStockReceiptTypeList() {
getInit().then((response) => {
// categoryListOptions.value = response.data.categoryListOptions; // 药品类型
profitReasonOptions.value = response.data.profitReasonOptions; // 盈亏原因
// receiptHeaderForm.purposeTypeEnum = warehous_type.value[0].value // 仓库类型默认值
// handleChangePurposeTypeEnum(receiptHeaderForm.purposeTypeEnum)
// 设置仓库类型默认值
if (warehous_type.value.length > 0) {
receiptHeaderForm.purposeTypeEnum = warehous_type.value[0].value; // 仓库类型默认值
console.log('Setting default warehouse type to:', receiptHeaderForm.purposeTypeEnum);
// 初始化时加载对应的仓库列表
handleChangePurposeTypeEnum(receiptHeaderForm.purposeTypeEnum, true);
}
// cabinetListOptionsBk.value = response.data.purposeTypeListOptions; // 盘点仓库列表(未过滤)
// purposeTypeListOptions.value = cabinetListOptionsBk.value.filter(item => item.formEnum === receiptHeaderForm.purposeTypeEnum) // 盘点仓库列表
@@ -2198,19 +2235,45 @@ function getStockReceiptTypeList() {
// 切换仓库类型获取药房/药库列表 -20250414
function handlePurposeType(value) {
// 清空已选择的仓库和货位
receiptHeaderForm.purposeLocationId = '';
receiptHeaderForm.purposeLocation = '';
purposeTypeListOptions.value = cabinetListOptionsBk.value.filter(
(item) => item.formEnum === Number(value)
); // 盘点仓库列表
if (purposeTypeListOptions.value.length > 0) {
// 判断是否有盘点仓库
receiptHeaderForm.purposeLocationId = purposeTypeListOptions.value[0].id; // 盘点仓库默认值
if (purposeTypeListOptions.value[0].children.length > 0) {
// 判断盘点仓库内是否有货位
freightListOptions.value = purposeTypeListOptions.value[0].children;
receiptHeaderForm.purposeLocation = purposeTypeListOptions.value[0].children[0].name;
}
// 根据选择的仓库类型调用不同的API获取对应类型的仓库列表
if (Number(value) === 16) {
getPharmacyList().then((res) => {
purposeTypeListOptions.value = res.data;
if (purposeTypeListOptions.value.length > 0) {
// 判断是否有盘点仓库
receiptHeaderForm.purposeLocationId = purposeTypeListOptions.value[0].id; // 盘点仓库默认值
if (purposeTypeListOptions.value[0].children && purposeTypeListOptions.value[0].children.length > 0) {
// 判断盘点仓库内是否有货位
freightListOptions.value = purposeTypeListOptions.value[0].children;
receiptHeaderForm.purposeLocation = purposeTypeListOptions.value[0].children[0].name;
}
}
}).catch((error) => {
console.error('获取药房列表失败:', error);
purposeTypeListOptions.value = [];
freightListOptions.value = [];
});
} else if (Number(value) === 11) {
getDispensaryList().then((res) => {
purposeTypeListOptions.value = res.data;
if (purposeTypeListOptions.value.length > 0) {
// 判断是否有盘点仓库
receiptHeaderForm.purposeLocationId = purposeTypeListOptions.value[0].id; // 盘点仓库默认值
if (purposeTypeListOptions.value[0].children && purposeTypeListOptions.value[0].children.length > 0) {
// 判断盘点仓库内是否有货位
freightListOptions.value = purposeTypeListOptions.value[0].children;
receiptHeaderForm.purposeLocation = purposeTypeListOptions.value[0].children[0].name;
}
}
}).catch((error) => {
console.error('获取药库列表失败:', error);
purposeTypeListOptions.value = [];
freightListOptions.value = [];
});
}
}
// 切换仓库获取货位列表 -20250414

View File

@@ -123,6 +123,14 @@ export function getDispensaryList() {
method: 'get',
})
}
// 获取仓库药房列表
export function getpharmacyCabinetList() {
return request({
url: '/app-common/pharmacy-cabinet-list',
method: 'get',
})
}
/**
* 审批驳回
*/