Files
his/openhis-ui-vue3/src/views/inpatientNurse/drugDistribution/index.vue
赵云 dfe300cc1f Fix Bug #502: 【住院护士站-汇总发药申请】顶部医嘱类型(长期/临时)过滤按钮点击无响应
根因:父组件 index.vue 中 therapyEnum 变量未声明为 ref,且未通过 props 传递给子组件 prescriptionList.vue,
导致点击"长期/临时"按钮时数据流断裂,子组件 API 调用始终使用本地未变化的 therapyEnum 值。

修复:
1. index.vue 新增 const therapyEnum = ref(undefined)
2. index.vue 新增 handleTherapyChange() 调用 handleGetPrescription() 刷新列表
3. index.vue 将 therapyEnum 作为 prop 传入 PrescriptionList
4. prescriptionList.vue 将本地 therapyEnum ref 改为 props 接收
2026-05-11 15:27:18 +08:00

219 lines
6.3 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" @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 />
<!-- <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 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() {
prescriptionRefs.value.handleGetPrescription();
}
function handelSwicthChange() {
if (chooseAll.value) {
proxy.$refs['prescriptionRefs'].selectAllRows();
} else {
proxy.$refs['prescriptionRefs'].clearSelection();
}
}
function handleRadioChange(value) {
if (value == '1') {
handleGetPrescription();
}
}
function handleTherapyChange() {
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>