Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
2026-03-19 15:53:06 +08:00

View File

@@ -94,6 +94,7 @@
style="width: 150px"
:disabled="viewStatus == 'view' || viewStatus == 'apply'"
v-if="viewStatus != 'apply' && viewStatus != 'view'"
@change="handleSupplierChange"
>
<el-option
v-for="supplier in supplierListOptions"
@@ -117,12 +118,7 @@
clearable
filterable
style="width: 150px"
:disabled="disabledForm"
@change="
(value) => {
itemType = value;
}
"
@change="handleMedicationTypeChange"
>
<el-option
v-for="itemType in purchase_type"
@@ -138,21 +134,38 @@
placeholder=""
clearable
style="width: 150px"
:disabled="disabledForm"
@visible-change="handlePurposeTypeEnumVisibleChange"
@change="handleChangeLocationType"
>
<el-option
v-for="dict in warehous_type"
:key="dict.value"
:label="dict.label"
:disabled="disabledForm"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="仓库:" prop="headerLocationId">
<el-select
v-model="receiptHeaderForm.headerLocationId"
placeholder="请选择仓库"
clearable
filterable
style="width: 200px"
@visible-change="handleHeaderLocationVisibleChange"
>
<el-option
v-for="item in locationList"
: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="入库单明细">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
<el-row :gutter="10" class="mb8" v-if="!viewStatus">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="addNewRow"
@@ -170,6 +183,19 @@
>
</el-col>
</el-row>
<div style="display: flex; gap: 10px;">
<el-input
v-model="detailSearchKey"
placeholder="请输入项目|厂家/产地|产品批号"
style="width: 280px;"
clearable
>
<template #prefix>
<el-icon><Search /></el-icon>
</template>
</el-input>
</div>
</div>
<el-form
:model="form"
:rules="tableRules"
@@ -182,7 +208,7 @@
<el-table
row-key="rowKey"
v-loading="loading"
:data="form.purchaseinventoryList"
:data="filteredPurchaseinventoryList"
@selection-change="handleSelectionChange"
ref="tableRef"
@cell-mouse-leave="handleMouseLeave"
@@ -257,50 +283,7 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="仓库"
align="center"
key="purposeLocationId"
prop="purposeLocationId"
:show-overflow-tooltip="true"
width="180"
>
<template #default="scope">
<el-form-item
:prop="`purchaseinventoryList.${scope.$index}.purposeLocationId`"
:rules="tableRules.purposeLocationId"
>
<div class="select_wrapper_div">
<el-select
v-if="viewStatus !== 'view'"
v-model="scope.row.purposeLocationId"
placeholder="请选择仓库"
:class="{ 'error-border': scope.row.error }"
clearable
>
<el-option
v-for="(item, index) in locationList"
:key="index"
:label="item.name"
:value="item.id"
@click="handleLocationClick(item, scope.row, scope.$index)"
/>
</el-select>
<!-- 非编辑状态下显示为只读输入框 -->
<el-input
v-else
:model-value="getLocationNameById(scope.row.purposeLocationId)"
readonly
disabled
:placeholder="'-'"
class="readonly-input" style="pointer-events: none;"
/>
</div>
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="采购数量"
align="center"
@@ -579,31 +562,6 @@
</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
v-model="scope.row.locationStoreName"
placeholder="请选择货位"
:class="{ 'error-border': scope.row.error }"
clearable
:disabled="viewStatus == 'view'"
>
</el-select>
</div>
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="总库存数量"
align="center"
@@ -708,10 +666,11 @@ import TraceNoDialog from "@/components/OpenHis/TraceNoDialog/index.vue";
import {formatDate, formatDateymd} from "@/utils/index";
import {useStore} from "@/store/store";
import useUserStore from "@/store/modules/user";
import {ElMessage} from "element-plus";
import {nextTick, onMounted, onUnmounted, ref, watch} from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { Search } from "@element-plus/icons-vue";
import { nextTick, onMounted, onUnmounted, ref, watch, computed } from "vue";
import useTagsViewStore from "@/store/modules/tagsView";
import {isEqual} from "lodash";
import { isEqual } from "lodash";
import templateJson from "./components/templateJson.json";
import {hiprint} from "vue-plugin-hiprint";
@@ -776,6 +735,7 @@ const rowIndex = ref(-1);
const totalAmount = ref(0);
const editData = ref({});
const pageLoading = ref(false);
const detailSearchKey = ref('');
const form = reactive({
purchaseinventoryList: [],
});
@@ -786,6 +746,7 @@ const receiptHeaderForm = reactive({
busNo: undefined,
occurrenceTime: formatDate(new Date()),
practitionerId: userUserStore.practitionerId,
headerLocationId: null,
});
const data = reactive({
@@ -811,7 +772,7 @@ const data = reactive({
itemId: [{ required: true, message: '项目不能为空', trigger: 'blur' }],
statusEnum_enumText: [{ required: true, message: '规格不能为空', trigger: 'blur' }],
unitCode: [{ required: true, message: '计量单位不能为空', trigger: 'blur' }],
purposeLocationId: [{ required: true, message: '目的仓库不能为空', trigger: 'blur' }],
// purposeLocationId 仓库已移至表头,此处不再校验
lotNumber: [{ required: true, message: '产品批号不能为空', trigger: 'change' }],
startTime: [{ required: true, message: '开始时间不能为空', trigger: 'blur' }],
endTime: [{ required: true, message: '结束时间不能为空', trigger: 'blur' }],
@@ -839,6 +800,19 @@ const currentRowId = ref("");
const disabledForm = computed(() => {
return form.purchaseinventoryList.length > 0;
});
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);
const manufacturerMatch = item.manufacturerText && item.manufacturerText.toLowerCase().includes(searchKey);
const lotNumberMatch = item.lotNumber && item.lotNumber.toLowerCase().includes(searchKey);
return nameMatch || manufacturerMatch || lotNumberMatch;
});
});
const rowList = ref([]);
const saveRowObject = ref({});
@@ -937,7 +911,8 @@ function addNewRow() {
if (!row.unitCode) {
errors.push('计量单位');
}
if (!row.purposeLocationId) {
// 仓库校验改为检查表头
if (!receiptHeaderForm.headerLocationId) {
errors.push('仓库');
}
if (!row.itemQuantity || row.itemQuantity === '' || row.itemQuantity === 0) {
@@ -1057,6 +1032,7 @@ function handleBlur(row, index) {
row.occurrenceTime = receiptHeaderForm.occurrenceTime;
row.supplierId = receiptHeaderForm.supplierId;
row.purposeTypeEnum = receiptHeaderForm.purposeTypeEnum;
row.purposeLocationId = receiptHeaderForm.headerLocationId;
}
const handleMouseEnter = (row, column, cell, event) => {};
@@ -1231,8 +1207,109 @@ function changeValEnd(val, index) {
}
}
}
// 切换供应商前检查
function handleSupplierChange(value) {
if (form.purchaseinventoryList.length > 0 && value !== receiptHeaderForm.supplierId) {
ElMessageBox.confirm(
'切换供应商将清空当前表格数据,是否继续?',
'系统提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
confirmButtonClass: 'el-button--primary',
cancelButtonClass: 'el-button',
type: 'warning',
}
).then(() => {
receiptHeaderForm.supplierId = value;
form.purchaseinventoryList = [];
}).catch(() => {
// 取消操作,什么都不做
});
} else {
receiptHeaderForm.supplierId = value;
}
}
// 切换药品类型前检查
function handleMedicationTypeChange(value) {
if (form.purchaseinventoryList.length > 0 && value !== receiptHeaderForm.medicationType) {
ElMessageBox.confirm(
'切换药品类型将清空当前表格数据,是否继续?',
'系统提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
confirmButtonClass: 'el-button--primary',
cancelButtonClass: 'el-button',
type: 'warning',
}
).then(() => {
receiptHeaderForm.medicationType = value;
itemType.value = value;
form.purchaseinventoryList = [];
}).catch(() => {
// 取消操作,什么都不做
});
} else {
receiptHeaderForm.medicationType = value;
itemType.value = value;
}
}
// 点击仓库类型下拉框展开时检查
function handlePurposeTypeEnumVisibleChange(visible) {
if (visible && form.purchaseinventoryList.length > 0) {
ElMessageBox.confirm(
'切换仓库类型将清空当前表格数据,是否继续?',
'系统提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
confirmButtonClass: 'el-button--primary',
cancelButtonClass: 'el-button',
type: 'warning',
closeOnClickModal: false,
}
).then(() => {
receiptHeaderForm.purposeTypeEnum = null;
receiptHeaderForm.headerLocationId = null;
form.purchaseinventoryList = [];
}).catch(() => {
receiptHeaderForm.purposeTypeEnum = receiptHeaderForm.purposeTypeEnum;
});
}
}
// 点击仓库下拉框展开时检查
function handleHeaderLocationVisibleChange(visible) {
if (visible && form.purchaseinventoryList.length > 0) {
ElMessageBox.confirm(
'切换仓库将清空当前表格数据,是否继续?',
'系统提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
confirmButtonClass: 'el-button--primary',
cancelButtonClass: 'el-button',
type: 'warning',
closeOnClickModal: false,
}
).then(() => {
receiptHeaderForm.headerLocationId = null;
form.purchaseinventoryList = [];
}).catch(() => {
receiptHeaderForm.headerLocationId = receiptHeaderForm.headerLocationId;
});
}
}
// 切换仓库类型获取药房/药库/耗材库列表
function handleChangeLocationType(value) {
// 切换仓库类型时清空已选仓库
receiptHeaderForm.headerLocationId = null;
// 确保locationList变量已初始化
if (!locationList) {
console.warn("locationList未初始化");
@@ -1373,7 +1450,7 @@ function handleSave(row, index) {
rowList.value.push(JSON.parse(JSON.stringify(row)));
if (
rowList._rawValue &&
rowList._rawValue.length == form.purchaseinventoryList.length
rowList._rawValue.length === form.purchaseinventoryList.length
) {
addPurchaseinventorys(rowList._rawValue);
}
@@ -1739,7 +1816,10 @@ function reset() {
supplierId: undefined,
medicationType: "1",
purposeTypeEnum: undefined,
headerLocationId: null,
});
// 重置搜索关键字
detailSearchKey.value = '';
// 重置编辑数据
editData.value = {};
}
@@ -1775,6 +1855,7 @@ function edit() {
: editData.value.item[0].purposeTypeEnum.toString();
receiptHeaderForm.medicationType =
editData.value.item[0].itemTable == "med_medication_definition" ? "1" : "2";
receiptHeaderForm.headerLocationId = editData.value.editRow?.purposeLocationId || null;
total.value = form.purchaseinventoryList.length;
handleChangeLocationType(
editData.value.editRow.purposeTypeEnum