diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/common/appservice/impl/CommonServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/common/appservice/impl/CommonServiceImpl.java index 64be7d94..ddaae5d0 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/common/appservice/impl/CommonServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/common/appservice/impl/CommonServiceImpl.java @@ -8,6 +8,7 @@ import java.util.stream.Collectors; import javax.annotation.Resource; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -78,6 +79,7 @@ public class CommonServiceImpl implements ICommonService { public List getPharmacyList() { List pharmacyList = locationService.getPharmacyList(); + List locationDtoList = new ArrayList<>(); LocationDto locationDto; for (Location location : pharmacyList) { @@ -85,6 +87,8 @@ public class CommonServiceImpl implements ICommonService { BeanUtils.copyProperties(location, locationDto); locationDtoList.add(locationDto); } + + return locationDtoList; } diff --git a/openhis-ui-vue3/package-lock.json b/openhis-ui-vue3/package-lock.json index feed423d..ad03573e 100644 --- a/openhis-ui-vue3/package-lock.json +++ b/openhis-ui-vue3/package-lock.json @@ -910,6 +910,7 @@ "version": "4.17.12", "resolved": "https://registry.npmmirror.com/@types/lodash-es/-/lodash-es-4.17.12.tgz", "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", + "peer": true, "dependencies": { "@types/lodash": "*" } @@ -919,6 +920,7 @@ "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.13.10.tgz", "integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==", "dev": true, + "peer": true, "dependencies": { "undici-types": "~6.20.0" } @@ -2324,6 +2326,7 @@ "version": "3.0.0", "resolved": "https://registry.npmmirror.com/d3-selection/-/d3-selection-3.0.0.tgz", "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "peer": true, "engines": { "node": ">=12" } @@ -4215,7 +4218,8 @@ "node_modules/jquery": { "version": "3.7.1", "resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", + "peer": true }, "node_modules/js-base64": { "version": "2.6.4", @@ -4345,12 +4349,14 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "peer": true }, "node_modules/lodash-es": { "version": "4.17.21", "resolved": "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "peer": true }, "node_modules/lodash-unified": { "version": "1.0.3", @@ -5079,6 +5085,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", @@ -5480,6 +5487,7 @@ "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.35.0.tgz", "integrity": "sha512-kg6oI4g+vc41vePJyO6dHt/yl0Rz3Thv0kJeVQ3D1kS3E5XSuKbPc29G4IpT/Kv1KQwgHVcN+HtyS+HYLNSvQg==", "dev": true, + "peer": true, "dependencies": { "@types/estree": "1.0.6" }, @@ -5644,6 +5652,7 @@ "resolved": "https://registry.npmmirror.com/sass/-/sass-1.69.5.tgz", "integrity": "sha512-qg2+UCJibLr2LCVOt3OlPhr/dqVHWOa9XtZf2OjbLs/T4VPSJ00udtgJxH3neXZm+QqX8B+3cU7RaLqp1iVfcQ==", "dev": true, + "peer": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0", "immutable": "^4.0.0", @@ -5666,6 +5675,7 @@ "version": "2.0.3", "resolved": "https://registry.npmmirror.com/segmentit/-/segmentit-2.0.3.tgz", "integrity": "sha512-7mn2XL3OdTUQ+AhHz7SbgyxLTaQRzTWQNVwiK+UlTO8aePGbSwvKUzTwE4238+OUY9MoR6ksAg35zl8sfTunQQ==", + "peer": true, "dependencies": { "preval.macro": "^4.0.0" } @@ -7023,6 +7033,7 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.4.tgz", "integrity": "sha512-RzAr8LSvM8lmhB4tQ5OPcBhpjOZRZjuxv9zO5UcxeoY2bd3kP3Ticd40Qma9/BqZ8JS96Ll/jeBX9u+LJZrhVg==", "dev": true, + "peer": true, "dependencies": { "esbuild": "^0.19.3", "postcss": "^8.4.31", @@ -7116,6 +7127,7 @@ "version": "3.5.13", "resolved": "https://registry.npmmirror.com/vue/-/vue-3.5.13.tgz", "integrity": "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==", + "peer": true, "dependencies": { "@vue/compiler-dom": "3.5.13", "@vue/compiler-sfc": "3.5.13", @@ -7894,6 +7906,7 @@ "version": "4.17.12", "resolved": "https://registry.npmmirror.com/@types/lodash-es/-/lodash-es-4.17.12.tgz", "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", + "peer": true, "requires": { "@types/lodash": "*" } @@ -7903,6 +7916,7 @@ "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.13.10.tgz", "integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==", "dev": true, + "peer": true, "requires": { "undici-types": "~6.20.0" } @@ -8957,7 +8971,8 @@ "d3-selection": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/d3-selection/-/d3-selection-3.0.0.tgz", - "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==" + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "peer": true }, "d3-shape": { "version": "3.2.0", @@ -10316,7 +10331,8 @@ "jquery": { "version": "3.7.1", "resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", + "peer": true }, "js-base64": { "version": "2.6.4", @@ -10424,12 +10440,14 @@ "lodash": { "version": "4.17.21", "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "peer": true }, "lodash-es": { "version": "4.17.21", "resolved": "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "peer": true }, "lodash-unified": { "version": "1.0.3", @@ -10934,6 +10952,7 @@ "version": "8.5.3", "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.3.tgz", "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", + "peer": true, "requires": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", @@ -11238,6 +11257,7 @@ "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.35.0.tgz", "integrity": "sha512-kg6oI4g+vc41vePJyO6dHt/yl0Rz3Thv0kJeVQ3D1kS3E5XSuKbPc29G4IpT/Kv1KQwgHVcN+HtyS+HYLNSvQg==", "dev": true, + "peer": true, "requires": { "@rollup/rollup-android-arm-eabi": "4.35.0", "@rollup/rollup-android-arm64": "4.35.0", @@ -11351,6 +11371,7 @@ "resolved": "https://registry.npmmirror.com/sass/-/sass-1.69.5.tgz", "integrity": "sha512-qg2+UCJibLr2LCVOt3OlPhr/dqVHWOa9XtZf2OjbLs/T4VPSJ00udtgJxH3neXZm+QqX8B+3cU7RaLqp1iVfcQ==", "dev": true, + "peer": true, "requires": { "chokidar": ">=3.0.0 <4.0.0", "immutable": "^4.0.0", @@ -11367,6 +11388,7 @@ "version": "2.0.3", "resolved": "https://registry.npmmirror.com/segmentit/-/segmentit-2.0.3.tgz", "integrity": "sha512-7mn2XL3OdTUQ+AhHz7SbgyxLTaQRzTWQNVwiK+UlTO8aePGbSwvKUzTwE4238+OUY9MoR6ksAg35zl8sfTunQQ==", + "peer": true, "requires": { "preval.macro": "^4.0.0" } @@ -12422,6 +12444,7 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.4.tgz", "integrity": "sha512-RzAr8LSvM8lmhB4tQ5OPcBhpjOZRZjuxv9zO5UcxeoY2bd3kP3Ticd40Qma9/BqZ8JS96Ll/jeBX9u+LJZrhVg==", "dev": true, + "peer": true, "requires": { "esbuild": "^0.19.3", "fsevents": "~2.3.3", @@ -12468,6 +12491,7 @@ "version": "3.5.13", "resolved": "https://registry.npmmirror.com/vue/-/vue-3.5.13.tgz", "integrity": "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==", + "peer": true, "requires": { "@vue/compiler-dom": "3.5.13", "@vue/compiler-sfc": "3.5.13", diff --git a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockBatch/components/api.js b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockBatch/components/api.js index fa9eb859..25034146 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockBatch/components/api.js +++ b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockBatch/components/api.js @@ -46,10 +46,11 @@ export function getDetailInit() { } // 生成批量盘点 -export function getStocktakingReceiptBatch() { +export function getStocktakingReceiptBatch(params) { return request({ url: '/inventory-manage/stocktaking/stocktaking-receipt-batch', - method: 'get' + method: 'get', + params: params }) } //保存批量盘点 @@ -119,4 +120,4 @@ export function getDispensaryList() { url: '/app-common/cabinet-list', method: 'get', }) -} \ No newline at end of file +} diff --git a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockBatch/index.vue b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockBatch/index.vue index f0a9df07..0e922743 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockBatch/index.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockBatch/index.vue @@ -53,7 +53,7 @@ clearable style="width: 150px" :disabled="data.isEdit" - @change="handleChangePurposeTypeEnum" + @change="(value) => handleChangePurposeTypeEnum(value, 0)" > item.formEnum === receiptHeaderForm.purposeTypeEnum) // 盘点仓库列表 @@ -2107,24 +2104,46 @@ function totalQuantityChange(rowData,index,value) { } // 切换仓库类型获取药房/药库列表 目的仓库切换 function handleChangePurposeTypeEnum(value,type) { - if (value == 16) { - getPharmacyList().then((res) => { - purposeTypeListOptions.value = res.data - if(!route.query.supplyBusNo&&!type){ - receiptHeaderForm.purposeLocationId = '' - receiptHeaderForm.purposeLocationId1 = '' - } - // getinitValue() - }); - } else if (value == 11) { - getDispensaryList().then((res) => { - purposeTypeListOptions.value = res.data - if(!route.query.supplyBusNo&&!type){ - receiptHeaderForm.purposeLocationId = '' - receiptHeaderForm.purposeLocationId1 = '' - } - // getinitValue() + // 确保value是数字类型 + const numValue = Number(value); + + // 清空已选择的盘点仓库 + if(!route.query.supplyBusNo&&!type){ + receiptHeaderForm.purposeLocationId = '' + receiptHeaderForm.purposeLocationId1 = '' + } + + // 根据选择的仓库类型调用不同的API获取对应类型的仓库列表 + if (numValue === 16 || numValue === 11) { + // 使用统一接口获取药房或药库列表 + getpharmacyCabinetList().then((res) => { + // 过滤出符合当前类型的仓库列表 + const filteredList = res.data.filter(item => item.formEnum === numValue); + purposeTypeListOptions.value = filteredList; + // 调用getinitValue设置默认仓库和货位 + getinitValue(); + }).catch((error) => { + console.error('获取仓库列表失败:', error); + purposeTypeListOptions.value = []; + freightListOptions.value = []; }); + } else if (numValue === 17) { + // 处理耗材库类型 + // 参考采购订单模块的实现,硬编码设置中心耗材库信息 + purposeTypeListOptions.value = [ + { + id: "1", + name: "中心耗材库", + formEnum: 17, + children: [] + } + ]; + // 设置默认仓库和货位 + getinitValue(); + } else { + console.log('未知的仓库类型值:', value); + purposeTypeListOptions.value = []; + freightListOptions.value = []; } } // 获取默认值 diff --git a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockPart/components/api.js b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockPart/components/api.js index 5ff3300e..88d98398 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockPart/components/api.js +++ b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockPart/components/api.js @@ -46,10 +46,11 @@ export function getDetailInit() { } // 生成批量盘点 -export function getStocktakingReceiptBatch() { +export function getStocktakingReceiptBatch(params) { return request({ url: '/inventory-manage/stocktaking/stocktaking-receipt-batch', - method: 'get' + method: 'get', + params: params }) } //保存批量盘点 diff --git a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockPart/index.vue b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockPart/index.vue index 466a80d7..eccb979a 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockPart/index.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/chkstockPart/index.vue @@ -58,7 +58,7 @@ clearable style="width: 150px" :disabled="data.isEdit" - @change="handleChangePurposeTypeEnum" + @change="(value) => handleChangePurposeTypeEnum(value, false)" > { receiptHeaderForm.startTime = route.query.startTime || ''; receiptHeaderForm.endTime = route.query.endTime || ''; } + // 初始化数据,加载仓库列表 + getStockReceiptTypeList(); }); // 卸载时移除事件 @@ -971,7 +975,7 @@ function getTransferProductDetails(type) { receiptHeaderForm.purposeTypeEnum = item.label; } }); - handleChangePurposeTypeEnum(e.purposeTypeEnum); + handleChangePurposeTypeEnum(e.purposeTypeEnum, true); } if (e.purposeLocationId) { @@ -1103,7 +1107,7 @@ function getTransferProductDetails(type) { receiptHeaderForm.purposeTypeEnum = item.label; } }); - handleChangePurposeTypeEnum(e.purposeTypeEnum); + handleChangePurposeTypeEnum(e.purposeTypeEnum, true); } if (e.purposeLocationId) { receiptHeaderForm.purposeLocationId = e.purposeLocationId; @@ -2105,23 +2109,51 @@ function handleTraceNo(value, row) { // 切换仓库类型获取药房/药库列表 目的仓库切换 function handleChangePurposeTypeEnum(value, type) { - if (value == 16) { - getPharmacyList().then((res) => { - purposeTypeListOptions.value = res.data; - if (!route.query.supplyBusNo && !type) { - receiptHeaderForm.purposeLocationId = ''; - } - // getinitValue() - }); - } else if (value == 11) { - getDispensaryList().then((res) => { - purposeTypeListOptions.value = res.data; - if (!route.query.supplyBusNo && !type) { - receiptHeaderForm.purposeLocationId = ''; - } - // getinitValue() - }); + console.log('handleChangePurposeTypeEnum called with value:', value, 'type:', type); + const numValue = Number(value); + + // 清空已选择的仓库和货位 + if (!route.query.supplyBusNo && !type) { + receiptHeaderForm.purposeLocationId = ''; + receiptHeaderForm.purposeLocation = ''; } + + if (numValue === 16 || numValue === 11) { + console.log('Calling getpharmacyCabinetList for warehouse type:', numValue); + // 使用统一接口获取药房或药库列表 + getpharmacyCabinetList().then((res) => { + console.log('getPharmacyCabinetList response:', res); + // 过滤出符合当前类型的仓库列表 + const filteredList = res.data.filter(item => item.formEnum === numValue); + purposeTypeListOptions.value = filteredList; + console.log('purposeTypeListOptions set to filtered list:', purposeTypeListOptions.value); + // 设置默认仓库和货位 + getinitValue(); + }).catch((error) => { + console.error('getPharmacyCabinetList error:', error); + purposeTypeListOptions.value = []; + freightListOptions.value = []; + }); + } else if (numValue === 17) { + console.log('Setting hardcoded consumable warehouse'); + // 处理耗材库类型 + // 参考采购订单模块的实现,硬编码设置中心耗材库信息 + purposeTypeListOptions.value = [ + { + id: "1", + name: "中心耗材库", + formEnum: 17, + children: [] + } + ]; + console.log('purposeTypeListOptions set to:', purposeTypeListOptions.value); + // 设置默认仓库和货位 + getinitValue(); + } else { + console.log('Unknown value:', value); + purposeTypeListOptions.value = []; + freightListOptions.value = []; + } } // 获取默认值 function getinitValue() { @@ -2146,8 +2178,13 @@ function getStockReceiptTypeList() { getInit().then((response) => { // categoryListOptions.value = response.data.categoryListOptions; // 药品类型 profitReasonOptions.value = response.data.profitReasonOptions; // 盈亏原因 - // receiptHeaderForm.purposeTypeEnum = warehous_type.value[0].value // 仓库类型默认值 - // handleChangePurposeTypeEnum(receiptHeaderForm.purposeTypeEnum) + // 设置仓库类型默认值 + if (warehous_type.value.length > 0) { + receiptHeaderForm.purposeTypeEnum = warehous_type.value[0].value; // 仓库类型默认值 + console.log('Setting default warehouse type to:', receiptHeaderForm.purposeTypeEnum); + // 初始化时加载对应的仓库列表 + handleChangePurposeTypeEnum(receiptHeaderForm.purposeTypeEnum, true); + } // cabinetListOptionsBk.value = response.data.purposeTypeListOptions; // 盘点仓库列表(未过滤) // purposeTypeListOptions.value = cabinetListOptionsBk.value.filter(item => item.formEnum === receiptHeaderForm.purposeTypeEnum) // 盘点仓库列表 @@ -2198,19 +2235,45 @@ function getStockReceiptTypeList() { // 切换仓库类型获取药房/药库列表 -20250414 function handlePurposeType(value) { + // 清空已选择的仓库和货位 receiptHeaderForm.purposeLocationId = ''; receiptHeaderForm.purposeLocation = ''; - purposeTypeListOptions.value = cabinetListOptionsBk.value.filter( - (item) => item.formEnum === Number(value) - ); // 盘点仓库列表 - if (purposeTypeListOptions.value.length > 0) { - // 判断是否有盘点仓库 - receiptHeaderForm.purposeLocationId = purposeTypeListOptions.value[0].id; // 盘点仓库默认值 - if (purposeTypeListOptions.value[0].children.length > 0) { - // 判断盘点仓库内是否有货位 - freightListOptions.value = purposeTypeListOptions.value[0].children; - receiptHeaderForm.purposeLocation = purposeTypeListOptions.value[0].children[0].name; - } + + // 根据选择的仓库类型调用不同的API获取对应类型的仓库列表 + if (Number(value) === 16) { + getPharmacyList().then((res) => { + purposeTypeListOptions.value = res.data; + if (purposeTypeListOptions.value.length > 0) { + // 判断是否有盘点仓库 + receiptHeaderForm.purposeLocationId = purposeTypeListOptions.value[0].id; // 盘点仓库默认值 + if (purposeTypeListOptions.value[0].children && purposeTypeListOptions.value[0].children.length > 0) { + // 判断盘点仓库内是否有货位 + freightListOptions.value = purposeTypeListOptions.value[0].children; + receiptHeaderForm.purposeLocation = purposeTypeListOptions.value[0].children[0].name; + } + } + }).catch((error) => { + console.error('获取药房列表失败:', error); + purposeTypeListOptions.value = []; + freightListOptions.value = []; + }); + } else if (Number(value) === 11) { + getDispensaryList().then((res) => { + purposeTypeListOptions.value = res.data; + if (purposeTypeListOptions.value.length > 0) { + // 判断是否有盘点仓库 + receiptHeaderForm.purposeLocationId = purposeTypeListOptions.value[0].id; // 盘点仓库默认值 + if (purposeTypeListOptions.value[0].children && purposeTypeListOptions.value[0].children.length > 0) { + // 判断盘点仓库内是否有货位 + freightListOptions.value = purposeTypeListOptions.value[0].children; + receiptHeaderForm.purposeLocation = purposeTypeListOptions.value[0].children[0].name; + } + } + }).catch((error) => { + console.error('获取药库列表失败:', error); + purposeTypeListOptions.value = []; + freightListOptions.value = []; + }); } } // 切换仓库获取货位列表 -20250414 diff --git a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/components/api.js b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/components/api.js index dba0f61a..4e59adce 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/chkstock/components/api.js +++ b/openhis-ui-vue3/src/views/medicationmanagement/chkstock/components/api.js @@ -123,6 +123,14 @@ export function getDispensaryList() { method: 'get', }) } + +// 获取仓库药房列表 +export function getpharmacyCabinetList() { + return request({ + url: '/app-common/pharmacy-cabinet-list', + method: 'get', + }) +} /** * 审批驳回 */