108 库房管理-》领用管理-》领用出库的升级

This commit is contained in:
Ranyunqiao
2026-03-24 10:39:56 +08:00
parent cc51d0b345
commit 059078c264

View File

@@ -125,6 +125,23 @@
/>
</el-select>
</el-form-item>
<el-form-item label="仓库:" prop="headerLocationId">
<el-select
v-model="receiptHeaderForm.headerLocationId"
placeholder="请选择仓库"
clearable
filterable
style="width: 200px"
:disabled="data.isEdit"
>
<el-option
v-for="item in purposeTypeListOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<el-tabs type="border-card">
<el-tab-pane label="领用单据明细">
@@ -158,10 +175,23 @@
>
</el-col>
</el-row>
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
<div></div>
<el-input
v-model="detailSearchKey"
placeholder="请输入项目|厂家/产地|产品批号"
style="width: 280px;"
clearable
>
<template #prefix>
<el-icon><Search /></el-icon>
</template>
</el-input>
</div>
<el-form :model="form" :rules="tableRules" ref="formRef">
<el-table
v-loading="loading"
:data="form.purchaseinventoryList"
:data="filteredPurchaseinventoryList"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
ref="tableRef"
@@ -241,65 +271,8 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="仓库"
align="center"
key="sourceLocationId"
prop="sourceLocationId"
:show-overflow-tooltip="true"
width="180"
>
<template #default="scope">
<el-form-item
:prop="`purchaseinventoryList.${scope.$index}.sourceLocationId`"
:rules="tableRules.sourceLocationId"
required
>
<div class="select_wrapper_div">
<el-select
:disabled="viewStatus == 'view'"
v-model="scope.row.sourceLocationId"
placeholder="请选择仓库"
:class="{ 'error-border': scope.row.error }"
clearable
>
<el-option
v-for="(item, index) in purposeTypeListOptions"
:key="index"
:label="item.name"
:value="item.id"
@click="handleLocationClick(item, scope.row, scope.$index)"
/>
</el-select>
</div>
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="货位"
align="center"
key="locationStoreName"
prop="locationStoreName"
width="180"
>
<template #default="scope">
<el-form-item
:prop="`purchaseinventoryList.${scope.$index}.locationStoreName`"
:rules="tableRules.locationStoreName"
>
<div class="select_wrapper_div">
<el-select
:disabled="viewStatus == 'view'"
v-model="scope.row.locationStoreName"
placeholder="请选择货位"
:class="{ 'error-border': scope.row.error }"
clearable
>
</el-select>
</div>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="单价 " align="center" key="price" prop="price" width="130">
<template #default="scope">
<el-form-item
@@ -489,6 +462,7 @@
</template>
<script setup name="requisitionManagement">
import {computed} from 'vue';
import {
addTransferProduct,
delTransferProduct,
@@ -550,10 +524,6 @@ const props = defineProps({
type: Object,
required: false,
},
purposeTypeListOptions: {
type: Object,
required: false,
},
categoryListOptions: {
type: Object,
required: false,
@@ -601,7 +571,6 @@ const data = reactive({
},
tableRules: {
name: [{ required: true, message: '项目不能为空', trigger: 'change' }],
sourceLocationId: [{ required: true, message: '仓库不能为空', trigger: 'change' }],
unitCode: [{ required: true, message: '计量单位不能为空', trigger: 'change' }],
itemQuantity: [{ required: true, message: '领用数量不能为空', trigger: 'blur' }],
@@ -631,6 +600,20 @@ const tableRef = ref(undefined); // 表格引用
const currentRow = ref(undefined); // 当前操作的行
const medicineSearchKey = ref('');
const itemType = ref('');
const detailSearchKey = ref('');
const filteredPurchaseinventoryList = computed(() => {
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;
});
});
watch(
() => store.currentDataLYCK,
@@ -649,6 +632,21 @@ watch(
},
{ immediate: true }
);
watch(
() => receiptHeaderForm.locationId,
(newVal) => {
if (newVal) {
getPharmacyCabinetList().then((res) => {
purposeTypeListOptions.value = res.data;
});
} else {
purposeTypeListOptions.value = [];
receiptHeaderForm.headerLocationId = undefined;
}
}
);
watch(
() => form.purchaseinventoryList,
(newVlaue) => {
@@ -683,9 +681,6 @@ function addNewRow() {
occurrenceTime: '',
typeEnum_enumText: '',
statusEnum_enumText: '',
// sourceLocationId:"", // 源仓库
// purposeLocationId:"", //目的仓库
// sourceLocationName:"",
purposeLocationName: '',
approverId_dictText: '',
applicantId_dictText: '',
@@ -705,10 +700,7 @@ function addNewRow() {
purposeLocationStoreId: '',
practitionerId: '',
practitionerName: '',
applicantId: '',
traceNo: '',
traceNo: '',
// locationName:"",
ybNo: '',
invoiceNo: '',
startTime: '',
@@ -716,13 +708,11 @@ function addNewRow() {
price: '',
totalPrice: '',
datailJson: '',
supplierId: '',
totalQuantity: '',
// unitList: {unitCode: "2", unitCode_dictText: "盒", minUnitCode: "1", minUnitCode_dictText: "片"},
unitList: {}, // 单位列表
isEditing: true, // 标记当前行是否正在编辑
error: false, // 新增 error 字段
isSave: false, // 当前行是否保存
unitList: {},
isEditing: true,
error: false,
isSave: false,
};
form.purchaseinventoryList.push(newRow);
data.isAdding = true; // 设置标志位为 true表示有未保存的
@@ -751,14 +741,16 @@ function handleBlur(row, index) {
row.busNo = receiptHeaderForm.busNo;
row.occurrenceTime = receiptHeaderForm.occurrenceTime;
// 领用仓库
let sourceLocation = purposeTypeListOptions.value.filter((e) => {
return e.id == row.sourceLocationId;
});
row.sourceLocationId = sourceLocation[0].id;
row.sourceTypeEnum = sourceLocation[0].formEnum;
// 领用仓库(从表头获取)
if (receiptHeaderForm.headerLocationId) {
let sourceLocation = purposeTypeListOptions.value.filter((e) => {
return e.id == receiptHeaderForm.headerLocationId;
});
if (sourceLocation && sourceLocation.length > 0) {
row.sourceLocationId = sourceLocation[0].id;
row.sourceTypeEnum = sourceLocation[0].formEnum;
}
}
// 领用部门
let purposeLocation = issueDepartmentDto.value.filter((e) => {
@@ -795,6 +787,10 @@ function getTransferProductDetails() {
form.purchaseinventoryList[index].statusMaxvalue = false;
e.volume = e.totalVolume;
e.name = e.itemName;
if (e.sourceLocationId) {
// 源仓库(领用仓库)
receiptHeaderForm.headerLocationId = e.sourceLocationId;
}
if (e.purposeLocationId) {
//目的仓库
receiptHeaderForm.locationId = e.purposeLocationId;