From c3866e113415d0f81e78ade733bc0b66245ac294 Mon Sep 17 00:00:00 2001 From: zoujiandong <10130823232@qq.com> Date: Mon, 7 Sep 2026 15:26:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=AF=E6=88=BF=E6=9F=A5=E8=AF=A2=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/basic/pharmacy.js | 26 ++ .../components/pharmacyDoctorDrawer.vue | 400 ++++++++++++++++++ src/views/basic/pharmacy/index.vue | 21 +- .../components/doctorPharmacyDrawer.vue | 4 +- src/views/doctor/doctor-list/index.vue | 4 +- 5 files changed, 452 insertions(+), 3 deletions(-) create mode 100644 src/views/basic/pharmacy/components/pharmacyDoctorDrawer.vue diff --git a/src/api/basic/pharmacy.js b/src/api/basic/pharmacy.js index 798871e..afde052 100644 --- a/src/api/basic/pharmacy.js +++ b/src/api/basic/pharmacy.js @@ -90,3 +90,29 @@ export function deletePharmacy(pharmacy_id) { method: 'delete', }); } + +/** + * 获取药房绑定的医生列表-分页 + * @param {Object} data - { pharmacy_id: string, page?: number, page_size?: number, doctor_name?: string, mobile?: string } + * @returns {Promise} + */ +export function getPharmacyDoctorPage(data) { + return request({ + url: '/admin/basic/pharmacy/doctor/page', + method: 'post', + data, + }); +} + +/** + * 获取药房绑定的医生列表(全部/不分页) + * @param {String} pharmacy_id - 药房 ID + * @returns {Promise} + */ +export function getPharmacyDoctorList(pharmacy_id) { + return request({ + url: `/admin/basic/pharmacy/doctor/${pharmacy_id}`, + method: 'get', + }); +} + diff --git a/src/views/basic/pharmacy/components/pharmacyDoctorDrawer.vue b/src/views/basic/pharmacy/components/pharmacyDoctorDrawer.vue new file mode 100644 index 0000000..8fe1895 --- /dev/null +++ b/src/views/basic/pharmacy/components/pharmacyDoctorDrawer.vue @@ -0,0 +1,400 @@ + + + + + diff --git a/src/views/basic/pharmacy/index.vue b/src/views/basic/pharmacy/index.vue index 27c132f..f8b08da 100644 --- a/src/views/basic/pharmacy/index.vue +++ b/src/views/basic/pharmacy/index.vue @@ -219,6 +219,15 @@ 修改 + + + 关联医生 + + + + @@ -246,6 +258,7 @@ import { usePermissionStore } from '@/store/permission'; import { getPharmacyPage, updatePharmacyStatus, deletePharmacy } from '@/api/basic/pharmacy'; import { getAdminAreaList } from '@/api/basic/list'; import PharmacyModal from './components/pharmacyModal.vue'; +import PharmacyDoctorDrawer from './components/pharmacyDoctorDrawer.vue'; const permissionStore = usePermissionStore(); @@ -257,6 +270,7 @@ const hasPermission = (permission) => { const queryFormRef = ref(null); const modalRef = ref(null); +const doctorDrawerRef = ref(null); const tableLoading = ref(false); const tableData = ref([]); @@ -306,7 +320,7 @@ const columns = [ { title: '地址', slotName: 'full_address', minWidth: 240 }, { title: '状态', slotName: 'status', width: 100, align: 'center' }, { title: '创建时间', dataIndex: 'created_at', width: 180 }, - { title: '操作', slotName: 'action', width: 260, fixed: 'right', align: 'center' }, + { title: '操作', slotName: 'action', width: 280, fixed: 'right', align: 'center' }, ]; // 获取区域信息 @@ -445,6 +459,11 @@ const handleEdit = (record) => { modalRef.value?.open('edit', record.pharmacy_id); }; +// 关联医生 +const handleOpenDoctorDrawer = (record) => { + doctorDrawerRef.value?.open(record); +}; + // 状态切换 const handleStatusToggle = async (record, val) => { const newStatus = val ? 1 : 0; diff --git a/src/views/doctor/doctor-list/components/doctorPharmacyDrawer.vue b/src/views/doctor/doctor-list/components/doctorPharmacyDrawer.vue index 9ac8ffe..5c29ccc 100644 --- a/src/views/doctor/doctor-list/components/doctorPharmacyDrawer.vue +++ b/src/views/doctor/doctor-list/components/doctorPharmacyDrawer.vue @@ -299,11 +299,13 @@ const open = async (doctor) => { currentDoctor.value = doctor; visible.value = true; await fetchDoctorPharmacies(); - fetchAllPharmacies(); }; // 打开新增绑定弹窗 const openAddModal = () => { + if (allPharmacies.value.length === 0) { + fetchAllPharmacies(); + } addForm.pharmacy_id = undefined; // 若当前尚未绑定任何药房,默认勾选设为默认 addForm.is_default = pharmacyList.value.length === 0 ? 1 : 0; diff --git a/src/views/doctor/doctor-list/index.vue b/src/views/doctor/doctor-list/index.vue index 211c60d..6a32b5f 100644 --- a/src/views/doctor/doctor-list/index.vue +++ b/src/views/doctor/doctor-list/index.vue @@ -832,6 +832,7 @@ const handleOpenPharmacyDrawer = (record) => { pharmacyDrawerRef.value?.open(record); }; const loadPharmacyOptions = async () => { + if (pharmacyOptions.value.length > 0) return; try { const res = await getPharmacyList({ status: 1 }); if (res.code === 200 && res.data) { @@ -1183,6 +1184,7 @@ const changeSelect = (value) => { // 新增Satus const handleAdd = () => { + loadPharmacyOptions(); modalVisible.value = true; modalTitle.value = '新增医生'; modalSatus.value = 'add'; @@ -1279,6 +1281,7 @@ const handleDetail = async (record) => { }; // 修改 const handleUpdate = async (record) => { + loadPharmacyOptions(); modalVisible.value = true; modalTitle.value = '修改医生'; modalSatus.value = 'edit'; @@ -1868,7 +1871,6 @@ onMounted(() => { handlExpertiseList(); handelAreaList("", "", 2); handleBankList(); - loadPharmacyOptions(); });