药品列表增加药房的显示

This commit is contained in:
zoujiandong
2026-09-08 10:56:03 +08:00
parent 7e1d67bf07
commit 1795adb7c3
5 changed files with 138 additions and 52 deletions
+41
View File
@@ -15,6 +15,16 @@
<a-form-item field="product_pharmacy_code" label="药店编码">
<a-input :style="{ width: '182px' }" v-model="queryForm.product_pharmacy_code" placeholder="请输入药品编码" @press-enter="handleQuery" />
</a-form-item>
<a-form-item field="pharmacy_id" label="所属药房">
<a-select v-model="queryForm.pharmacy_id" placeholder="请选择所属药房" allow-clear allow-search :style="{ width: '182px' }">
<a-option v-for="item in pharmacyList" :key="item.pharmacy_id" :value="item.pharmacy_id">
{{ item.pharmacy_name }}
</a-option>
</a-select>
</a-form-item>
<a-form-item field="pharmacy_code" label="药房编码">
<a-input :style="{ width: '182px' }" v-model="queryForm.pharmacy_code" placeholder="请输入药房编码" @press-enter="handleQuery" />
</a-form-item>
<a-form-item field="manufacturer" label="生产企业">
<a-input :style="{ width: '182px' }" v-model="queryForm.manufacturer" placeholder="请输入生产企业" @press-enter="handleQuery" />
</a-form-item>
@@ -69,6 +79,7 @@
<!-- table -->
<a-table :columns="columns" :data="tableData"
:scroll="{ x: 2000 }"
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
:pagination="{ 'show-total': true, 'show-jumper': true, 'show-page-size': true, total: pager.total, current: currentPage }"
row-key="product_id" @selection-change="(selection) => {deleteData = selection;console.log(selection)}"
@@ -76,6 +87,12 @@
<template #doctor_id="{record,rowIndex}">
<div>{{(rowIndex+1)+(pager.page-1)*pager.page_size}}</div>
</template>
<template #pharmacy_name="{record}">
<div>{{ record.pharmacy_name || '-' }}</div>
<div v-if="record.pharmacy_code" style="font-size: 12px; color: #86909c;">
{{ record.pharmacy_code }}
</div>
</template>
<template #product_status="{record}">
<a-tag v-if="record.product_status == 1" color="green">{{formatProductStatus(record.product_status)}}</a-tag>
<a-tag v-else-if="record.product_status == 2" color="red">{{formatProductStatus(record.product_status)}}</a-tag>
@@ -113,8 +130,10 @@
<script setup>
import { reactive, ref, getCurrentInstance, onMounted, nextTick, watch, computed } from 'vue';
import { getSysMedinceList,getSysMedinceDetail,exportProduct} from '@/api/medince/list';
import { getPharmacyList } from '@/api/basic/pharmacy';
import { downloadFile } from '@/utils/downloadFile';
import {formatProductStatus} from '@/utils/format';
const pharmacyList = ref([]);
// Akiraka 20230210 删除数据
const deleteData = ref([])
// Akiraka 20230210 删除对话框
@@ -142,6 +161,8 @@
};
// form
const queryForm = reactive({
pharmacy_id: undefined,
pharmacy_code: '',
order:{
stock:''
}
@@ -174,6 +195,7 @@
{ title: '药品名称', dataIndex: 'product_name',width:200 },
{ title: '通用名称', dataIndex: 'common_name',width:200 },
{ title: '规格', dataIndex: 'product_spec',width:200 },
{ title: '所属药房', dataIndex: 'pharmacy_name', slotName: 'pharmacy_name', width: 170, ellipsis: true },
{ title: '单价(元)', dataIndex: 'product_price', slotName: 'product_price',width: 150 },
{ title: '批准文号', dataIndex: 'license_number',width:200 },
{ title: '生产厂家', dataIndex: 'manufacturer',width:200 },
@@ -196,6 +218,9 @@
modalTitle.value = '新增药品';
modalSatus.value = 'add';
modalForm.product_id ='';
modalForm.pharmacy_id = '';
modalForm.pharmacy_name = '';
modalForm.pharmacy_code = '';
modalForm.frequency_use =null;
modalForm.available_days =null;
modalForm.product_name ='';
@@ -296,6 +321,8 @@
// 重置搜索
const handleResetQuery = () => {
proxy.$refs.queryFormRef.resetFields();
queryForm.pharmacy_id = undefined;
queryForm.pharmacy_code = '';
queryForm.order.stock='';
getMedinceInfo(queryForm);
}
@@ -339,8 +366,22 @@
}
proxy.$loading.hide();
}
// 获取药房下拉数据
const fetchPharmacyList = async () => {
try {
const res = await getPharmacyList();
if (res.code === 200) {
pharmacyList.value = res.data || [];
}
} catch (e) {
console.error('获取药房列表异常:', e);
}
};
onMounted(() => {
getMedinceInfo(pager);
fetchPharmacyList();
});
</script>