diff --git a/openhis-ui-vue3/src/views/basicmanage/warehouseLocation/components/api.js b/openhis-ui-vue3/src/views/basicmanage/warehouseLocation/components/api.js index e28adfe8..55fa4bd6 100644 --- a/openhis-ui-vue3/src/views/basicmanage/warehouseLocation/components/api.js +++ b/openhis-ui-vue3/src/views/basicmanage/warehouseLocation/components/api.js @@ -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 + } }) } diff --git a/openhis-ui-vue3/src/views/basicmanage/warehouseLocation/index.vue b/openhis-ui-vue3/src/views/basicmanage/warehouseLocation/index.vue index a71209e7..391fa168 100644 --- a/openhis-ui-vue3/src/views/basicmanage/warehouseLocation/index.vue +++ b/openhis-ui-vue3/src/views/basicmanage/warehouseLocation/index.vue @@ -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) { - loading.value = true; - deleteWarehouse({ locationId: data.id }).then((res) => { - proxy.$modal.msgSuccess('操作成功'); - loading.value = false; - getPageList(); + proxy.$modal.confirm('是否确认删除该仓库位置?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).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; + }); }); } // // 停用