[bug]修改仓库字段下拉别表无内容bug
This commit is contained in:
@@ -87,23 +87,38 @@ export function getCount(queryParams) {
|
||||
})
|
||||
}
|
||||
|
||||
// 获取药房列表
|
||||
// 获取药房列表(权限过滤)
|
||||
export function getPharmacyList() {
|
||||
return request({
|
||||
url: '/app-common/inventory-pharmacy-list',
|
||||
// '/app-common/pharmacy-list',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 获取药库列表
|
||||
// 获取药库列表(权限过滤)
|
||||
export function getDispensaryList() {
|
||||
return request({
|
||||
url: '/app-common/inventory-cabinet-list',
|
||||
// '/app-common/cabinet-list',
|
||||
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',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批驳回
|
||||
*/
|
||||
|
||||
@@ -635,6 +635,8 @@ import {
|
||||
getInitBusNo,
|
||||
purchaseInventoryApproved,
|
||||
reject,
|
||||
getPharmacyListAll,
|
||||
getDispensaryListAll,
|
||||
} from './components/api';
|
||||
const route = useRoute();
|
||||
import PopoverList from '@/components/OpenHis/popoverList/index.vue';
|
||||
@@ -821,7 +823,8 @@ function addNewRow() {
|
||||
remake: '',
|
||||
supplierId: '',
|
||||
purposeTypeEnum: '',
|
||||
purposeLocationId: null,
|
||||
// 使用表头的仓库作为新增行默认值,减少重复选择
|
||||
purposeLocationId: receiptHeaderForm.purposeLocationId || null,
|
||||
purposeLocationStoreId: null,
|
||||
practitionerId: '',
|
||||
traceNo: '',
|
||||
@@ -1124,11 +1127,25 @@ function changeValEnd(val, index) {
|
||||
function handleChangeLocationType(value) {
|
||||
if (value == 16) {
|
||||
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) {
|
||||
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;
|
||||
getPurchaseinventoryTypeList();
|
||||
getInitBusNo().then((res) => {
|
||||
if (res.data && res.data.busNo) {
|
||||
receiptHeaderForm.busNo = res.data.busNo;
|
||||
}
|
||||
});
|
||||
// supplierListOptions.value = props.supplierListOptions;
|
||||
// itemTypeOptions.value = props.itemTypeOptions;
|
||||
@@ -1428,6 +1447,11 @@ function edit() {
|
||||
// itemTypeOptions.value = props.itemTypeOptions;
|
||||
// practitionerListOptions.value = props.practitionerListOptions;
|
||||
// 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.busNo = editData.value.editRow.supplyBusNo;
|
||||
receiptHeaderForm.supplierId = editData.value.editRow.supplierId;
|
||||
@@ -1463,6 +1487,10 @@ function edit() {
|
||||
volume: item.totalVolume,
|
||||
manufacturer: item.supplierName,
|
||||
quantity: item.totalQuantity,
|
||||
// 确保仓库字段回显
|
||||
purposeLocationId: item.purposeLocationId || editData.value.editRow?.purposeLocationId || null,
|
||||
locationStoreName: item.locationStoreName || '',
|
||||
purposeLocationStoreId: item.purposeLocationStoreId || null,
|
||||
// locationInventoryList: locationList.value,
|
||||
startTime: formatDateymd(item.startTime),
|
||||
endTime: formatDateymd(item.endTime),
|
||||
@@ -1475,6 +1503,27 @@ function edit() {
|
||||
console.log(form.purchaseinventoryList, 'purchaseinventoryList.value');
|
||||
console.log(receiptHeaderForm, 'receiptHeaderForm');
|
||||
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() {
|
||||
@@ -1485,7 +1534,7 @@ function getPurchaseinventoryTypeList() {
|
||||
});
|
||||
}
|
||||
|
||||
// 驳回
|
||||
// reject
|
||||
function handleReject() {
|
||||
reject(route.query.supplyBusNo).then((res) => {
|
||||
if (res.code == 200) {
|
||||
|
||||
Reference in New Issue
Block a user