修复了药房/库房的删除的报错

This commit is contained in:
叶锦涛
2025-10-30 15:38:51 +08:00
parent d5c8ae8d45
commit 87409d0c93
2 changed files with 31 additions and 9 deletions

View File

@@ -36,8 +36,12 @@ export function updateWarehouse(data) {
// 删除 // 删除
export function deleteWarehouse(data) { export function deleteWarehouse(data) {
return request({ return request({
url: '/base-data-manage/location/location?locationId=' + data.locationId, url: '/base-data-manage/location/location',
method: 'delete', method: 'delete',
params: {
locationId: data.locationId,
busNo: data.busNo
}
}) })
} }

View File

@@ -173,7 +173,7 @@ const { warehous_type } = proxy.useDict('warehous_type');
const rules = ref({ const rules = ref({
busNo: [{ required: false, message: '请输入科室编号', trigger: 'change' }], busNo: [{ required: false, message: '请输入科室编号', trigger: 'change' }],
name: [ name: [
{ required: true, message: '请输入仓库名称', trigger: 'change' }, { required: true, message: '请输入', trigger: 'change' },
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'change' }, { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'change' },
], ],
formEnum: [{ required: true, message: '请选择仓库类型', trigger: 'change' }], formEnum: [{ required: true, message: '请选择仓库类型', trigger: 'change' }],
@@ -211,7 +211,7 @@ function resetQuery() {
} }
function handleEnable(row) { function handleEnable(row) {
enableLocation([row.id]).then((res) => { enableLocation({ locationId: row.id, busNo: row.busNo }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
proxy.$modal.msgSuccess('启用成功'); proxy.$modal.msgSuccess('启用成功');
handleQuery(); handleQuery();
@@ -220,7 +220,7 @@ function handleEnable(row) {
} }
function handleUnable(row) { function handleUnable(row) {
unableLocation([row.id]).then((res) => { unableLocation({ locationId: row.id, busNo: row.busNo }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
proxy.$modal.msgSuccess('停用成功'); proxy.$modal.msgSuccess('停用成功');
handleQuery(); handleQuery();
@@ -294,11 +294,29 @@ function submitForm() {
// 删除 // 删除
function handelDelete(data) { function handelDelete(data) {
loading.value = true; proxy.$modal.confirm('是否确认删除该仓库位置?', '提示', {
deleteWarehouse({ locationId: data.id }).then((res) => { confirmButtonText: '确定',
proxy.$modal.msgSuccess('操作成功'); cancelButtonText: '取消',
loading.value = false; type: 'warning'
getPageList(); }).then(() => {
loading.value = true;
deleteWarehouse({ locationId: data.id, busNo: data.busNo }).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('删除成功');
getPageList();
} else {
// 检查错误信息是否与药品数据关联有关
if (res.msg && res.msg.includes('药品')) {
proxy.$modal.msgError('该仓库名称已有药品信息请核对确认');
} else {
proxy.$modal.msgError('删除失败:' + (res.msg || '未知错误'));
}
}
}).catch(() => {
proxy.$modal.msgError('删除失败');
}).finally(() => {
loading.value = false;
});
}); });
} }
// // 停用 // // 停用