From 22d73e5b44003514aae517e1cd5d9edc063a5753 Mon Sep 17 00:00:00 2001
From: Ranyunqiao <2499115710@qq.com>
Date: Tue, 24 Mar 2026 15:58:53 +0800
Subject: [PATCH] =?UTF-8?q?110=20=E5=BA=93=E6=88=BF=E7=AE=A1=E7=90=86-?=
=?UTF-8?q?=E3=80=8B=E9=A2=86=E7=94=A8=E7=AE=A1=E7=90=86-=E3=80=8B?=
=?UTF-8?q?=E9=A2=86=E7=94=A8=E9=80=80=E5=BA=93=E7=9A=84=E5=8D=87=E7=BA=A7?=
=?UTF-8?q?=EF=BC=88=E5=8F=AF=E5=8F=82=E8=80=83=E5=BC=80=E6=BA=90=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E7=A7=BB=E6=A4=8D=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../returningInventory/index.vue | 327 ++++++++----------
1 file changed, 145 insertions(+), 182 deletions(-)
diff --git a/openhis-ui-vue3/src/views/medicationmanagement/requisitionManagement/returningInventory/index.vue b/openhis-ui-vue3/src/views/medicationmanagement/requisitionManagement/returningInventory/index.vue
index 97ffda92..bed709fd 100644
--- a/openhis-ui-vue3/src/views/medicationmanagement/requisitionManagement/returningInventory/index.vue
+++ b/openhis-ui-vue3/src/views/medicationmanagement/requisitionManagement/returningInventory/index.vue
@@ -125,6 +125,23 @@
/>
+
+
+
+
+
+
-->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{
+ if (!detailSearchKey.value) {
+ return form.purchaseinventoryList;
+ }
+ const searchKey = detailSearchKey.value.toLowerCase();
+ return form.purchaseinventoryList.filter((item) => {
+ const nameMatch = item.name ? item.name.toLowerCase().includes(searchKey) : false;
+ const manufacturerMatch = item.manufacturerText ? item.manufacturerText.toLowerCase().includes(searchKey) : false;
+ const lotNumberMatch = item.lotNumber ? item.lotNumber.toLowerCase().includes(searchKey) : false;
+ return nameMatch || manufacturerMatch || lotNumberMatch;
+ });
+});
// 挂载时绑定事件
onMounted(() => {
document.addEventListener('click', handleClickOutside);
+ getTransferProductTypeList();
+ getPharmacyCabinetList().then((res) => {
+ purposeTypeListOptions.value = res.data || [];
+ });
});
// 卸载时移除事件
@@ -719,8 +693,7 @@ function addNewRow() {
occurrenceTime: '',
typeEnum_enumText: '',
statusEnum_enumText: '',
- purposeLocationId: '', // 源仓库
- purposeLocationId: '', //目的仓库
+ purposeLocationId: '',
sourceLocationName: '',
purposeLocationName: '',
approverId_dictText: '',
@@ -730,13 +703,6 @@ function addNewRow() {
itemTable: '',
itemQuantity: '',
itemId: '',
- unitCode: '',
- remake: '',
- supplierId: '',
- purposeTypeEnum: '',
- purposeLocationId: '',
- purposeLocationStoreId: '',
- practitionerId: '',
ybNo: '',
invoiceNo: '',
startTime: '',
@@ -744,7 +710,6 @@ function addNewRow() {
price: '',
totalPrice: '',
objQuantity: '',
- itemQuantity: '',
// sellPrice: "",
// minSellPrice: "",
unitList: {}, // 单位列表
@@ -775,49 +740,40 @@ function handleBlur(row, index) {
}
}
- // 单据号
row.busNo = receiptHeaderForm.busNo;
- // 申请时间
row.occurrenceTime = receiptHeaderForm.occurrenceTime;
- // 部门
- let sourceLocation = issueDepartmentDto.value.filter((e) => {
- return (
- e.locationId == receiptHeaderForm.sourceLocationId ||
- e.locationId == receiptHeaderForm.sourceLocationId1
- );
- });
- console.log(
- 'sourceLocation',
- issueDepartmentDto,
- receiptHeaderForm.sourceLocationId,
- sourceLocation
- );
- // 部门
- row.sourceLocationId = sourceLocation[0].locationId;
- // 源仓库类型
- row.sourceTypeEnum = sourceLocation[0].typeEnum;
+ if (receiptHeaderForm.sourceLocationId) {
+ let sourceLocation = issueDepartmentDto.value.filter((e) => {
+ return e.locationId == receiptHeaderForm.sourceLocationId;
+ });
+ if (sourceLocation && sourceLocation.length > 0) {
+ row.purposeLocationId = sourceLocation[0].locationId;
+ row.purposeTypeEnum = sourceLocation[0].typeEnum;
+ }
+ }
- // 目的仓库
+ if (receiptHeaderForm.practitionerId) {
+ let practitioner = practitionerListOptions.value.filter((e) => {
+ return e.value == receiptHeaderForm.practitionerId;
+ });
+ if (practitioner && practitioner.length > 0) {
+ row.practitionerId = practitioner[0].value;
+ row.practitionerName = practitioner[0].label;
+ }
+ }
- let purposeLocation = purposeTypeListOptions.value.filter((e) => {
- return e.id == row.purposeLocationId;
- });
- console.log(purposeTypeListOptions.value, row.purposeLocationId, 1212121, purposeLocation);
- // 目的仓库id
- row.purposeLocationId = purposeLocation[0].id;
- // 目的仓库类型
- row.purposeTypeEnum = purposeLocation[0].formEnum;
-
- // 部门经手人
- let practitioner = practitionerListOptions.value.filter((e) => {
- return e.value == receiptHeaderForm.practitionerId;
- });
- console.log('practitioner', practitioner);
- row.practitionerId = practitioner[0].value;
- row.practitionerName = practitioner[0].label;
- // 申请人
row.applicantId = userStore.id;
+
+ if (receiptHeaderForm.warehouseId) {
+ let warehouse = purposeTypeListOptions.value.filter((e) => {
+ return e.id == receiptHeaderForm.warehouseId;
+ });
+ if (warehouse && warehouse.length > 0) {
+ row.sourceLocationId = warehouse[0].id;
+ row.sourceTypeEnum = warehouse[0].formEnum;
+ }
+ }
}
/**
@@ -836,8 +792,12 @@ function getTransferProductDetails() {
e.name = e.itemName;
if (e.sourceLocationId) {
- receiptHeaderForm.sourceLocationId = e.sourceLocationId;
- receiptHeaderForm.sourceLocationName = e.sourceLocationName;
+ // 退库仓库
+ receiptHeaderForm.warehouseId = e.sourceLocationId;
+ }
+ if (e.purposeLocationId) {
+ // 退库部门
+ receiptHeaderForm.sourceLocationId = e.purposeLocationId;
}
if (e.practitionerId) {
receiptHeaderForm.practitionerId = e.practitionerId;
@@ -845,11 +805,12 @@ function getTransferProductDetails() {
if (e.itemType) {
receiptHeaderForm.medicationType = e.itemType;
- // let medicationType1 = purchase_type.value.filter(k=>{
- // return k.label == e.itemType
- // })
}
+ getPharmacyCabinetList().then((res) => {
+ purposeTypeListOptions.value = res.data;
+ });
+
form.purchaseinventoryList[index].totalQuantity = form.purchaseinventoryList[index]
.totalQuantity
? form.purchaseinventoryList[index].totalQuantity
@@ -1051,6 +1012,7 @@ function handleSearch(value) {
medicineSearchKey.value = value;
}
+
// 选择药品
function selectRow(rowValue, index) {
rowIndex.value = index;
@@ -1321,67 +1283,69 @@ function handleScan(row,index){
currentIndex.value = index
}
-function handleSave(row, index) {
+function handleSave() {
+ if (!receiptHeaderForm.sourceLocationId) {
+ proxy.$message.warning('请选择部门');
+ return;
+ }
+ if (!receiptHeaderForm.practitionerId) {
+ proxy.$message.warning('请选择部门经手人');
+ return;
+ }
+ if (!receiptHeaderForm.medicationType) {
+ proxy.$message.warning('请选择药品类型');
+ return;
+ }
+ if (!receiptHeaderForm.warehouseId) {
+ proxy.$message.warning('请选择仓库');
+ return;
+ }
+ if (!form.purchaseinventoryList || form.purchaseinventoryList.length === 0) {
+ proxy.$message.warning('请添加明细数据');
+ return;
+ }
+
rowList.value = [];
- form.purchaseinventoryList.map((row, index) => {
+ form.purchaseinventoryList.forEach((row) => {
if (row) {
- handleBlur(row);
- proxy.$refs['receiptHeaderRef'].validate((valid) => {
- if (valid) {
- proxy.$refs['formRef'].validate((valid) => {
- if (valid) {
- let rows = JSON.parse(JSON.stringify(row));
- delete rows.itemMaxQuantity;
- if (rows.unitCode == rows.unitList.minUnitCode) {
- rows.itemQuantity = form.purchaseinventoryList[index].olditemQuantity
- ? form.purchaseinventoryList[index].olditemQuantity
- : form.purchaseinventoryList[index].itemQuantity;
- } else {
- rows.itemQuantity = form.purchaseinventoryList[index].itemMaxQuantity
- ? form.purchaseinventoryList[index].itemMaxQuantity
- : form.purchaseinventoryList[index].itemQuantity;
- }
- if (rows.unitCode == rows.unitCode_dictText) {
- if (rows.unitCode_dictText == rows.unitList.minUnitCode_dictText) {
- rows.unitCode = rows.unitList.minUnitCode;
- console.log(rows.unitCode_dictText, 2323232);
- } else {
- rows.unitCode = rows.unitList.unitCode;
- rows.unitCode_dictText = rows.unitList.unitCode_dictText;
- console.log(rows.unitCode_dictText, 23232326565);
- }
- }
- rowList.value.push(JSON.parse(JSON.stringify(rows)));
- if (
- rowList._rawValue &&
- rowList._rawValue.length == form.purchaseinventoryList.length
- ) {
- addTHTransferProducts(rowList._rawValue);
- }
- }
- });
- }
- });
+ console.log('row data:', row.name, row.unitCode, row.itemQuantity, row);
+ if (row.name && row.unitCode && row.itemQuantity) {
+ handleBlur(row);
+ let rows = JSON.parse(JSON.stringify(row));
+ delete rows.itemMaxQuantity;
+ rowList.value.push(rows);
+ }
}
});
+
+ console.log('rowList:', rowList.value);
+ if (rowList.value.length > 0) {
+ addTHTransferProducts(rowList.value);
+ } else {
+ proxy.$message.warning('请检查表格数据是否填写完整');
+ }
}
function addTHTransferProducts(rowList) {
- addTHTransferProduct(JSON.parse(JSON.stringify(rowList))).then((res) => {
- // 当前行没有id视为首次新增
- // if (!row.id) {
- // data.isAdding = false; // 允许新增下一行
- // }
- if (res.data) {
- proxy.$message.success('保存成功!');
- form.purchaseinventoryList.map((row, index) => {
- form.purchaseinventoryList[index].id = res.data[index];
- form.purchaseinventoryList[index].isSave = true;
- });
- // form.purchaseinventoryList[index].id = res.data;
- // form.purchaseinventoryList[index].isSave = true;
- }
- });
+ addTHTransferProduct(JSON.parse(JSON.stringify(rowList)))
+ .then((res) => {
+ console.log('保存响应:', res);
+ if (res.code === 200 || res.data) {
+ proxy.$message.success('保存成功!');
+ form.purchaseinventoryList.forEach((row, index) => {
+ if (res.data && res.data[index]) {
+ form.purchaseinventoryList[index].id = res.data[index];
+ form.purchaseinventoryList[index].isSave = true;
+ }
+ });
+ } else {
+ proxy.$message.error(res.msg || '保存失败');
+ }
+ })
+ .catch((err) => {
+ console.error('保存错误:', err);
+ proxy.$message.error('保存失败,请重试');
+ });
}
/** 选择条数 */
function handleSelectionChange(selection) {
@@ -1594,7 +1558,6 @@ function getTransferProductTypeList() {
});
}
-const locationList = ref([]);
function getBusNoInitList() {
if (route.query.supplyBusNo) {
receiptHeaderForm.busNo = route.query.supplyBusNo;