修复了药房/库房的删除的报错
This commit is contained in:
@@ -36,8 +36,12 @@ export function updateWarehouse(data) {
|
||||
// 删除
|
||||
export function deleteWarehouse(data) {
|
||||
return request({
|
||||
url: '/base-data-manage/location/location?locationId=' + data.locationId,
|
||||
url: '/base-data-manage/location/location',
|
||||
method: 'delete',
|
||||
params: {
|
||||
locationId: data.locationId,
|
||||
busNo: data.busNo
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ const { warehous_type } = proxy.useDict('warehous_type');
|
||||
const rules = ref({
|
||||
busNo: [{ required: false, message: '请输入科室编号', trigger: 'change' }],
|
||||
name: [
|
||||
{ required: true, message: '请输入仓库名称', trigger: 'change' },
|
||||
{ required: true, message: '请输入', trigger: 'change' },
|
||||
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'change' },
|
||||
],
|
||||
formEnum: [{ required: true, message: '请选择仓库类型', trigger: 'change' }],
|
||||
@@ -211,7 +211,7 @@ function resetQuery() {
|
||||
}
|
||||
|
||||
function handleEnable(row) {
|
||||
enableLocation([row.id]).then((res) => {
|
||||
enableLocation({ locationId: row.id, busNo: row.busNo }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
proxy.$modal.msgSuccess('启用成功');
|
||||
handleQuery();
|
||||
@@ -220,7 +220,7 @@ function handleEnable(row) {
|
||||
}
|
||||
|
||||
function handleUnable(row) {
|
||||
unableLocation([row.id]).then((res) => {
|
||||
unableLocation({ locationId: row.id, busNo: row.busNo }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
proxy.$modal.msgSuccess('停用成功');
|
||||
handleQuery();
|
||||
@@ -294,11 +294,29 @@ function submitForm() {
|
||||
|
||||
// 删除
|
||||
function handelDelete(data) {
|
||||
proxy.$modal.confirm('是否确认删除该仓库位置?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
deleteWarehouse({ locationId: data.id }).then((res) => {
|
||||
proxy.$modal.msgSuccess('操作成功');
|
||||
loading.value = false;
|
||||
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;
|
||||
});
|
||||
});
|
||||
}
|
||||
// // 停用
|
||||
|
||||
Reference in New Issue
Block a user