[bug]修改仓库字段下拉别表无内容bug

This commit is contained in:
Auora
2025-10-31 09:01:35 +08:00
parent 87409d0c93
commit a1be7fdbfd
2 changed files with 75 additions and 11 deletions

View File

@@ -87,23 +87,38 @@ export function getCount(queryParams) {
}) })
} }
// 获取药房列表 // 获取药房列表(权限过滤)
export function getPharmacyList() { export function getPharmacyList() {
return request({ return request({
url: '/app-common/inventory-pharmacy-list', url: '/app-common/inventory-pharmacy-list',
// '/app-common/pharmacy-list',
method: 'get', method: 'get',
}) })
} }
// 获取药库列表 // 获取药库列表(权限过滤)
export function getDispensaryList() { export function getDispensaryList() {
return request({ return request({
url: '/app-common/inventory-cabinet-list', url: '/app-common/inventory-cabinet-list',
// '/app-common/cabinet-list',
method: 'get', method: 'get',
}) })
} }
// 获取药房列表(不受权限过滤,作为回退)
export function getPharmacyListAll() {
return request({
url: '/app-common/pharmacy-list',
method: 'get',
})
}
// 获取药库列表(不受权限过滤,作为回退)
export function getDispensaryListAll() {
return request({
url: '/app-common/cabinet-list',
method: 'get',
})
}
/** /**
* 审批驳回 * 审批驳回
*/ */

View File

@@ -635,6 +635,8 @@ import {
getInitBusNo, getInitBusNo,
purchaseInventoryApproved, purchaseInventoryApproved,
reject, reject,
getPharmacyListAll,
getDispensaryListAll,
} from './components/api'; } from './components/api';
const route = useRoute(); const route = useRoute();
import PopoverList from '@/components/OpenHis/popoverList/index.vue'; import PopoverList from '@/components/OpenHis/popoverList/index.vue';
@@ -821,7 +823,8 @@ function addNewRow() {
remake: '', remake: '',
supplierId: '', supplierId: '',
purposeTypeEnum: '', purposeTypeEnum: '',
purposeLocationId: null, // 使用表头的仓库作为新增行默认值,减少重复选择
purposeLocationId: receiptHeaderForm.purposeLocationId || null,
purposeLocationStoreId: null, purposeLocationStoreId: null,
practitionerId: '', practitionerId: '',
traceNo: '', traceNo: '',
@@ -1124,11 +1127,25 @@ function changeValEnd(val, index) {
function handleChangeLocationType(value) { function handleChangeLocationType(value) {
if (value == 16) { if (value == 16) {
getPharmacyList().then((res) => { getPharmacyList().then((res) => {
locationList.value = res.data; const list = res?.data || [];
if (!list.length) {
getPharmacyListAll().then((res2) => {
locationList.value = res2?.data || [];
});
} else {
locationList.value = list;
}
}); });
} else if (value == 11) { } else if (value == 11) {
getDispensaryList().then((res) => { getDispensaryList().then((res) => {
locationList.value = res.data; const list = res?.data || [];
if (!list.length) {
getDispensaryListAll().then((res2) => {
locationList.value = res2?.data || [];
});
} else {
locationList.value = list;
}
}); });
} }
} }
@@ -1406,7 +1423,9 @@ function show() {
visible.value = true; visible.value = true;
getPurchaseinventoryTypeList(); getPurchaseinventoryTypeList();
getInitBusNo().then((res) => { getInitBusNo().then((res) => {
if (res.data && res.data.busNo) {
receiptHeaderForm.busNo = res.data.busNo; receiptHeaderForm.busNo = res.data.busNo;
}
}); });
// supplierListOptions.value = props.supplierListOptions; // supplierListOptions.value = props.supplierListOptions;
// itemTypeOptions.value = props.itemTypeOptions; // itemTypeOptions.value = props.itemTypeOptions;
@@ -1428,6 +1447,11 @@ function edit() {
// itemTypeOptions.value = props.itemTypeOptions; // itemTypeOptions.value = props.itemTypeOptions;
// practitionerListOptions.value = props.practitionerListOptions; // practitionerListOptions.value = props.practitionerListOptions;
// receiptHeaderForm.busNo = props.busNoAdd; // receiptHeaderForm.busNo = props.busNoAdd;
// 确保数据存在
if (!editData.value.item || editData.value.item.length === 0) {
proxy.$message.warning('没有可编辑的数据');
return;
}
receiptHeaderForm.value = editData.value.item.length > 0 ? editData.value.item[0] : {}; receiptHeaderForm.value = editData.value.item.length > 0 ? editData.value.item[0] : {};
receiptHeaderForm.busNo = editData.value.editRow.supplyBusNo; receiptHeaderForm.busNo = editData.value.editRow.supplyBusNo;
receiptHeaderForm.supplierId = editData.value.editRow.supplierId; receiptHeaderForm.supplierId = editData.value.editRow.supplierId;
@@ -1463,6 +1487,10 @@ function edit() {
volume: item.totalVolume, volume: item.totalVolume,
manufacturer: item.supplierName, manufacturer: item.supplierName,
quantity: item.totalQuantity, quantity: item.totalQuantity,
// 确保仓库字段回显
purposeLocationId: item.purposeLocationId || editData.value.editRow?.purposeLocationId || null,
locationStoreName: item.locationStoreName || '',
purposeLocationStoreId: item.purposeLocationStoreId || null,
// locationInventoryList: locationList.value, // locationInventoryList: locationList.value,
startTime: formatDateymd(item.startTime), startTime: formatDateymd(item.startTime),
endTime: formatDateymd(item.endTime), endTime: formatDateymd(item.endTime),
@@ -1475,6 +1503,27 @@ function edit() {
console.log(form.purchaseinventoryList, 'purchaseinventoryList.value'); console.log(form.purchaseinventoryList, 'purchaseinventoryList.value');
console.log(receiptHeaderForm, 'receiptHeaderForm'); console.log(receiptHeaderForm, 'receiptHeaderForm');
loading.value = false; loading.value = false;
// 使用 Promise 确保数据加载完成
Promise.resolve().then(() => {
form.purchaseinventoryList = editData.value.item.map((item) => {
return {
...item,
name: item.itemName,
volume: item.totalVolume,
manufacturer: item.supplierName,
quantity: item.totalQuantity,
// 仓库字段回显Promise 阶段再保障一次)
purposeLocationId: item.purposeLocationId || editData.value.editRow?.purposeLocationId || null,
locationStoreName: item.locationStoreName || '',
purposeLocationStoreId: item.purposeLocationStoreId || null,
startTime: formatDateymd(item.startTime),
endTime: formatDateymd(item.endTime),
applyTime: formatDate(item.applyTime),
isSave: true,
};
});
});
} }
function getPurchaseinventoryTypeList() { function getPurchaseinventoryTypeList() {
@@ -1485,7 +1534,7 @@ function getPurchaseinventoryTypeList() {
}); });
} }
// 驳回 // reject
function handleReject() { function handleReject() {
reject(route.query.supplyBusNo).then((res) => { reject(route.query.supplyBusNo).then((res) => {
if (res.code == 200) { if (res.code == 200) {