[bug]解决选中药库或药房对应的源仓库或目的仓库无下拉数据
This commit is contained in:
@@ -797,6 +797,25 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
document.addEventListener("click", handleClickOutside);
|
||||||
|
|
||||||
|
// 获取源仓库列表(假设 getPharmacyList 返回仓库数据)
|
||||||
|
getPharmacyList({ type: 'source' }).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
sourceTypeListOptions.value = res.data; // 格式需为 [{id, name}, ...]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取目的仓库列表
|
||||||
|
getPharmacyList({ type: 'purpose' }).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
purposeTypeListOptions.value = res.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化默认仓库数据,使用药房类型(16)
|
||||||
|
handleChangeLocationType(16);
|
||||||
|
|
||||||
console.log(route, '!1212');
|
console.log(route, '!1212');
|
||||||
if (route.query.view) {
|
if (route.query.view) {
|
||||||
viewStatus.value = route.query.view;
|
viewStatus.value = route.query.view;
|
||||||
@@ -1138,7 +1157,7 @@ function handleChangeLocationType(value) {
|
|||||||
locationList.value = list;
|
locationList.value = list;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (value == 11) {
|
} else if (value == 17) {
|
||||||
getDispensaryList().then((res) => {
|
getDispensaryList().then((res) => {
|
||||||
const list = res?.data || [];
|
const list = res?.data || [];
|
||||||
if (!list.length) {
|
if (!list.length) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container" v-loading="pageLoading" loading-text="审批中...">
|
<div class="app-container" v-loading="pageLoading" loading-text="审批中...">
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8" v-if="viewStatus">
|
<el-row :gutter="10" class="mb8" v-if="viewStatus">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -144,7 +145,6 @@
|
|||||||
style="width: 150px"
|
style="width: 150px"
|
||||||
:disabled="data.isEdit"
|
:disabled="data.isEdit"
|
||||||
>
|
>
|
||||||
<!-- purchase_type -->
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="supplier in sourceTypeListOptions"
|
v-for="supplier in sourceTypeListOptions"
|
||||||
:key="supplier.id"
|
:key="supplier.id"
|
||||||
@@ -198,7 +198,6 @@
|
|||||||
style="width: 150px"
|
style="width: 150px"
|
||||||
:disabled="data.isEdit"
|
:disabled="data.isEdit"
|
||||||
>
|
>
|
||||||
<!-- purchase_type -->
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="supplier in purposeTypeListOptions"
|
v-for="supplier in purposeTypeListOptions"
|
||||||
:key="supplier.id"
|
:key="supplier.id"
|
||||||
@@ -208,6 +207,21 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- purposeLocationStoreName -->
|
<!-- purposeLocationStoreName -->
|
||||||
|
<el-form-item label="目的货位:" prop="purposeLocationStoreId">
|
||||||
|
<el-select
|
||||||
|
v-model="receiptHeaderForm.purposeLocationStoreId"
|
||||||
|
placeholder="请选择目的货位"
|
||||||
|
style="width: 150px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="supplier in purposeLocationStoreIdListOptions"
|
||||||
|
:key="supplier.value"
|
||||||
|
:label="supplier.label"
|
||||||
|
:value="supplier.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- purposeLocationStoreName -->
|
||||||
<el-form-item label="目的货位:" prop="purposeLocationStoreId">
|
<el-form-item label="目的货位:" prop="purposeLocationStoreId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="receiptHeaderForm.purposeLocationStoreId"
|
v-model="receiptHeaderForm.purposeLocationStoreId"
|
||||||
@@ -769,6 +783,7 @@ import useUserStore from "@/store/modules/user";
|
|||||||
import { useStore } from '@/store/store';
|
import { useStore } from '@/store/store';
|
||||||
import useTagsViewStore from '@/store/modules/tagsView';
|
import useTagsViewStore from '@/store/modules/tagsView';
|
||||||
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue'
|
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue'
|
||||||
|
import { nextTick } from 'vue';
|
||||||
const tagsViewStore = useTagsViewStore();
|
const tagsViewStore = useTagsViewStore();
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -831,6 +846,11 @@ const forms = reactive({
|
|||||||
const receiptHeaderForm = reactive({
|
const receiptHeaderForm = reactive({
|
||||||
busNo: undefined,
|
busNo: undefined,
|
||||||
occurrence_time: formatDate(new Date()),
|
occurrence_time: formatDate(new Date()),
|
||||||
|
sourceTypeEnum: 16, // 默认药房类型
|
||||||
|
purposeTypeEnum: 16, // 默认药房类型
|
||||||
|
sourceLocationId: '',
|
||||||
|
purposeLocationId: '',
|
||||||
|
medicationType: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
@@ -886,8 +906,18 @@ const data = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { queryParams, rules, tableRules } = toRefs(data);
|
const { queryParams, rules, tableRules } = toRefs(data);
|
||||||
const purposeTypeListOptions = ref(undefined);
|
const purposeTypeListOptions = ref([]);
|
||||||
const sourceTypeListOptions = ref(undefined);
|
const sourceTypeListOptions = ref([]);
|
||||||
|
// 立即初始化模拟仓库数据
|
||||||
|
const mockWarehouses = [
|
||||||
|
{ id: '1', name: '药房1号' },
|
||||||
|
{ id: '2', name: '药房2号' },
|
||||||
|
{ id: '3', name: '药房3号' },
|
||||||
|
{ id: '4', name: '中心药房' },
|
||||||
|
{ id: '5', name: '门诊药房' }
|
||||||
|
];
|
||||||
|
// 设置模拟数据到仓库列表选项
|
||||||
|
// 通过onMounted中调用的handleChangeSourceTypeEnum和handleChangePurposeTypeEnum函数动态获取仓库数据
|
||||||
const sourceLocationStoreIdListOptions = ref(undefined);
|
const sourceLocationStoreIdListOptions = ref(undefined);
|
||||||
const purposeLocationStoreIdListOptions = ref(undefined);
|
const purposeLocationStoreIdListOptions = ref(undefined);
|
||||||
const categoryListOptions = ref(undefined);
|
const categoryListOptions = ref(undefined);
|
||||||
@@ -941,6 +971,9 @@ watch(
|
|||||||
// 挂载时绑定事件
|
// 挂载时绑定事件
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.addEventListener("click", handleClickOutside);
|
document.addEventListener("click", handleClickOutside);
|
||||||
|
// 初始化仓库数据,默认加载药房类型(16)的仓库
|
||||||
|
handleChangeSourceTypeEnum(receiptHeaderForm.sourceTypeEnum, 1);
|
||||||
|
handleChangePurposeTypeEnum(receiptHeaderForm.purposeTypeEnum, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 卸载时移除事件
|
// 卸载时移除事件
|
||||||
@@ -975,11 +1008,11 @@ function addNewRow() {
|
|||||||
itemId: "",
|
itemId: "",
|
||||||
unitCode: "",
|
unitCode: "",
|
||||||
remake: "",
|
remake: "",
|
||||||
// supplierId: "",
|
supplierId: "",
|
||||||
purposeTypeEnum: "",
|
purposeTypeEnum: "",
|
||||||
purposeLocationId: null,
|
purposeLocationId: null,
|
||||||
purposeLocationStoreId: null,
|
purposeLocationStoreId: null,
|
||||||
// practitionerId: "",
|
practitionerId: "",
|
||||||
traceNo: "",
|
traceNo: "",
|
||||||
invoiceNo: "",
|
invoiceNo: "",
|
||||||
startTime: "",
|
startTime: "",
|
||||||
@@ -1018,6 +1051,7 @@ function handleBlur(row, index) {
|
|||||||
if (receiptHeaderForm.medicationType == 1) {
|
if (receiptHeaderForm.medicationType == 1) {
|
||||||
row.itemTable = "med_medication_definition";
|
row.itemTable = "med_medication_definition";
|
||||||
} else {
|
} else {
|
||||||
|
console.log('Unknown warehouse type:', value);
|
||||||
row.itemTable = "adm_device_definition";
|
row.itemTable = "adm_device_definition";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1206,42 +1240,66 @@ function handleLocationClick(id,purposeLocationId,itemId, index) {
|
|||||||
}
|
}
|
||||||
// 切换仓库类型获取药房/药库列表 目的仓库切换
|
// 切换仓库类型获取药房/药库列表 目的仓库切换
|
||||||
function handleChangePurposeTypeEnum(value,type) {
|
function handleChangePurposeTypeEnum(value,type) {
|
||||||
if (value == 16) {
|
console.log('handleChangePurposeTypeEnum called with value:', value, 'type:', type);
|
||||||
getPharmacyList().then((res) => {
|
receiptHeaderForm.purposeLocationId = '';
|
||||||
|
if(value === 16){ // 药房类型
|
||||||
|
getPharmacyList().then(res => {
|
||||||
|
console.log('getPharmacyList response:', res);
|
||||||
|
if (res && res.data) {
|
||||||
purposeTypeListOptions.value = res.data;
|
purposeTypeListOptions.value = res.data;
|
||||||
if(!route.query.supplyBusNo&&!type){
|
if(!type && res.data.length > 0) {
|
||||||
receiptHeaderForm.purposeLocationId = ''
|
receiptHeaderForm.purposeLocationId = res.data[0].id;
|
||||||
receiptHeaderForm.purposeLocationId1 = ''
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('Error fetching pharmacy list:', error);
|
||||||
});
|
});
|
||||||
} else if (value == 11) {
|
} else if(value === 17){ // 药库类型
|
||||||
getDispensaryList().then((res) => {
|
getDispensaryList().then(res => {
|
||||||
|
console.log('getDispensaryList response:', res);
|
||||||
|
if (res && res.data) {
|
||||||
purposeTypeListOptions.value = res.data;
|
purposeTypeListOptions.value = res.data;
|
||||||
if(!route.query.supplyBusNo&&!type){
|
if(!type && res.data.length > 0) {
|
||||||
receiptHeaderForm.purposeLocationId = ''
|
receiptHeaderForm.purposeLocationId = res.data[0].id;
|
||||||
receiptHeaderForm.purposeLocationId1 = ''
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('Error fetching dispensary list:', error);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
purposeTypeListOptions.value = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 源仓库切换
|
// 源仓库切换
|
||||||
function handleChangeSourceTypeEnum(value,type) {
|
function handleChangeSourceTypeEnum(value,type) {
|
||||||
if (value == 16) {
|
console.log('handleChangeSourceTypeEnum called with value:', value, 'type:', type);
|
||||||
getPharmacyList().then((res) => {
|
receiptHeaderForm.sourceLocationId = '';
|
||||||
|
if(value === 16){ // 药房类型
|
||||||
|
getPharmacyList().then(res => {
|
||||||
|
console.log('getPharmacyList response:', res);
|
||||||
|
if (res && res.data) {
|
||||||
sourceTypeListOptions.value = res.data;
|
sourceTypeListOptions.value = res.data;
|
||||||
if(!route.query.supplyBusNo&&!type){
|
if(!type && res.data.length > 0) {
|
||||||
receiptHeaderForm.sourceLocationId = ''
|
receiptHeaderForm.sourceLocationId = res.data[0].id;
|
||||||
receiptHeaderForm.sourceLocationId1 = ''
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('Error fetching pharmacy list:', error);
|
||||||
});
|
});
|
||||||
} else if (value == 11) {
|
} else if(value === 17){ // 药库类型
|
||||||
getDispensaryList().then((res) => {
|
getDispensaryList().then(res => {
|
||||||
|
console.log('getDispensaryList response:', res);
|
||||||
|
if (res && res.data) {
|
||||||
sourceTypeListOptions.value = res.data;
|
sourceTypeListOptions.value = res.data;
|
||||||
if(!route.query.supplyBusNo&&!type){
|
if(!type && res.data.length > 0) {
|
||||||
receiptHeaderForm.sourceLocationId = ''
|
receiptHeaderForm.sourceLocationId = res.data[0].id;
|
||||||
receiptHeaderForm.sourceLocationId1 = ''
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('Error fetching dispensary list:', error);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
sourceTypeListOptions.value = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function editBatchTransfer(index){
|
function editBatchTransfer(index){
|
||||||
@@ -1857,8 +1915,19 @@ function getBusNoInitList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTransferProductTypeList();
|
// 初始化函数
|
||||||
getBusNoInitList()
|
function initComponent() {
|
||||||
|
console.log('initComponent called');
|
||||||
|
getTransferProductTypeList();
|
||||||
|
getBusNoInitList();
|
||||||
|
|
||||||
|
console.log('组件初始化完成,仓库列表数据已预先设置');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 调用初始化函数
|
||||||
|
initComponent();
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.custom-tree-node {
|
.custom-tree-node {
|
||||||
|
|||||||
@@ -110,8 +110,7 @@ export function getCount(queryParams) {
|
|||||||
// 获取药房列表
|
// 获取药房列表
|
||||||
export function getPharmacyList() {
|
export function getPharmacyList() {
|
||||||
return request({
|
return request({
|
||||||
url: '/app-common/inventory-pharmacy-list',
|
url: '/app-common/pharmacy-list',
|
||||||
// '/app-common/pharmacy-list',
|
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -119,8 +118,7 @@ export function getPharmacyList() {
|
|||||||
// 获取药库列表
|
// 获取药库列表
|
||||||
export function getDispensaryList() {
|
export function getDispensaryList() {
|
||||||
return request({
|
return request({
|
||||||
url:'/app-common/inventory-cabinet-list',
|
url: '/app-common/cabinet-list',
|
||||||
// '/app-common/cabinet-list',
|
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user