Files
his/openhis-ui-vue3/src/views/inpatientNurse/drugDistribution/index.vue
关羽 db05a30795 Fix Bug #502: 【住院护士站-汇总发药申请】顶部医嘱类型(长期/临时)过滤按钮点击无响应
根因:汇总视图(SummaryMedicineList)没有ref属性,handleGetPrescription()只调用了prescriptionRefs.value?.handleGetPrescription(),
当isDetails=='2'时PrescriptionList被v-if隐藏,prescriptionRefs.value为null,导致汇总列表不刷新。

修复:1. 给SummaryMedicineList添加ref="summaryMedicineRefs"
      2. handleGetPrescription()根据isDetails值调用对应的子组件刷新方法

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 06:06:36 +08:00

236 lines
6.7 KiB
Vue
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div style="display: flex; justify-content: space-between">
<div style="width: 20%; height: 90vh; border-right: solid 2px #e4e7ed">
<div
style="
height: 40px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: solid 2px #e4e7ed;
padding: 0 10px;
"
>
<!-- <el-icon style="cursor: pointer; font-size: 20px" @click="handleBack">
<ArrowLeft />
</el-icon> -->
<el-icon @click="refresh" class="refresh-icon" style="cursor: pointer; font-size: 20px">
<Refresh />
</el-icon>
</div>
<el-tabs v-model="active" class="demo-tabs centered-tabs tab-header" @tab-click="handleClick">
<el-tab-pane label="在科" name="first" style="padding: 15px 10px">
<PatientList />
</el-tab-pane>
<!-- 隐藏转科列表
<el-tab-pane label="转科" name="second" style="padding: 0 10px">
<PatientList />
</el-tab-pane>
-->
</el-tabs>
</div>
<div style="width: 100%">
<!-- <NurseNavBar :navs="navigationButtons" /> -->
<div
style="
height: 50px;
border-bottom: 2px solid #e4e7ed;
display: flex;
align-items: center;
justify-content: space-between;
"
>
<div>
<el-radio-group class="ml10" v-model="drugType">
<el-radio-button label="西药" value="1" />
<el-radio-button label="中药" value="2" />
</el-radio-group>
<el-radio-group class="ml20" v-model="isDetails" @change="handleRadioChange">
<el-radio-button label="明细" value="1" />
<el-radio-button label="汇总" value="2" />
</el-radio-group>
<span class="descriptions-item-label">截止时间</span>
<el-date-picker
v-model="deadline"
type="datetime"
format="YYYY/MM/DD HH:mm:ss"
value-format="YYYY/MM/DD HH:mm:ss"
:clearable="false"
@change="handleGetPrescription"
/>
<el-radio-group v-model="therapyEnum" class="ml20" @change="handleTherapyChange">
<el-radio :value="undefined">全部</el-radio>
<el-radio :value="1">长期</el-radio>
<el-radio :value="2">临时</el-radio>
</el-radio-group>
<el-button class="ml20" type="primary" plain @click="handleGetPrescription">
查询
</el-button>
</div>
<div>
<span class="descriptions-item-label">全选</span>
<el-switch
v-model="chooseAll"
:disabled="isDetails != '1'"
@change="handelSwicthChange"
/>
<el-button class="ml20 mr20" type="primary" @click="handleExecute"> 汇总领药 </el-button>
</div>
</div>
<PrescriptionList
v-if="isDetails == 1"
ref="prescriptionRefs"
:exeStatus="exeStatus"
:requestStatus="requestStatus"
:deadline="deadline"
:therapyEnum="therapyEnum"
/>
<SummaryMedicineList v-else ref="summaryMedicineRefs" :therapyEnum="therapyEnum" />
<!-- <el-tabs v-model="activeName" class="demo-tabs centered-tabs" @tab-change="handleClick">
<el-tab-pane
v-for="tab in prescriptionTabs"
:key="tab.name"
:lazy="true"
:label="tab.label"
:name="tab.name"
>
<PrescriptionList
:exeStatus="exeStatus"
:requestStatus="requestStatus"
:ref="(el) => setPrescriptionRef(el, tab.name)"
/>
</el-tab-pane>
</el-tabs> -->
</div>
</div>
</template>
<script setup>
import {getCurrentInstance, ref} from 'vue';
import {useRouter} from 'vue-router';
import PatientList from '../components/patientList.vue';
import PrescriptionList from './components/prescriptionList.vue';
import SummaryMedicineList from './components/summaryMedicineList.vue';
import {inpatientNurseNavs} from '../constants/navigation';
import { RequestStatus } from '@/utils/medicalConstants';
const { proxy } = getCurrentInstance();
const router = useRouter();
const activeName = ref('preparation');
const active = ref('first');
const exeStatus = ref(1);
const deadline = ref(proxy.formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
const requestStatus = ref(RequestStatus.COMPLETED);
const chooseAll = ref(false);
const drugType = ref('1');
const isDetails = ref('1');
const therapyEnum = ref(undefined);
// 存储子组件引用的对象
const prescriptionRefs = ref();
const summaryMedicineRefs = ref();
const navigationButtons = inpatientNurseNavs;
// 定义处方列表tabs配置
const prescriptionTabs = [
{ label: '待执行', name: 'preparation' },
{ label: '已执行', name: 'completed' },
{ label: '不执行', name: 'stopped' },
{ label: '取消执行', name: 'cancel' },
];
function handleClick(tabName) {
// tabName是tab的name属性值
const activeTabName = tabName || activeName.value;
switch (activeTabName) {
case 'preparation':
// 执行状态待执行
exeStatus.value = 1;
// 请求状态已校对
requestStatus.value = 3;
break;
case 'completed':
exeStatus.value = 6;
break;
case 'stopped':
exeStatus.value = 5;
break;
case 'cancel':
exeStatus.value = 9;
break;
}
}
function handleGetPrescription() {
chooseAll.value = false;
if (isDetails.value == '1') {
prescriptionRefs.value?.handleGetPrescription();
} else {
summaryMedicineRefs.value?.handleGetPrescription();
}
}
function handelSwicthChange(value) {
if (!prescriptionRefs.value) {
chooseAll.value = false;
return;
}
if (value) {
prescriptionRefs.value.selectAllRows();
} else {
prescriptionRefs.value.clearSelection();
}
}
function handleRadioChange(value) {
chooseAll.value = false;
if (value == '1') {
handleGetPrescription();
}
}
function handleTherapyChange() {
chooseAll.value = false;
handleGetPrescription();
}
function handleExecute() {
proxy.$refs['prescriptionRefs'].handleMedicineSummary();
}
function handleBack() {
router.back();
}
provide('handleGetPrescription', (value) => {
prescriptionRefs.value.handleGetPrescription();
});
</script>
<style scoped>
.centered-tabs :deep(.el-tabs__nav-wrap) {
display: flex;
justify-content: center;
}
.centered-tabs :deep(.el-tabs__nav-scroll) {
display: flex;
justify-content: center;
}
.tab-header :deep(.el-tabs__item) {
height: 50px !important;
}
.centered-tabs :deep(.el-tabs__nav) {
display: flex;
justify-content: center;
}
:deep(.el-tabs__header) {
margin: 0;
}
</style>