Fix Bug #512: [住院护士站-汇总发药申请] 全选开关功能失效 - 增加nextTick确保DOM就绪后操作表格选择,修复handleExecute始终调用prescriptionRefs的问题
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getCurrentInstance, ref} from 'vue';
|
||||
import {getCurrentInstance, nextTick, ref} from 'vue';
|
||||
import {useRouter} from 'vue-router';
|
||||
import PatientList from '../components/patientList.vue';
|
||||
import PrescriptionList from './components/prescriptionList.vue';
|
||||
@@ -173,15 +173,29 @@ function handleGetPrescription() {
|
||||
}
|
||||
}
|
||||
|
||||
function handelSwicthChange(value) {
|
||||
if (!prescriptionRefs.value) {
|
||||
chooseAll.value = false;
|
||||
return;
|
||||
}
|
||||
if (value) {
|
||||
prescriptionRefs.value.selectAllRows();
|
||||
async function handelSwicthChange(value) {
|
||||
if (isDetails.value == '1') {
|
||||
if (!prescriptionRefs.value) {
|
||||
chooseAll.value = false;
|
||||
return;
|
||||
}
|
||||
await nextTick();
|
||||
if (value) {
|
||||
prescriptionRefs.value.selectAllRows();
|
||||
} else {
|
||||
prescriptionRefs.value.clearSelection();
|
||||
}
|
||||
} else {
|
||||
prescriptionRefs.value.clearSelection();
|
||||
if (!summaryMedicineRefs.value) {
|
||||
chooseAll.value = false;
|
||||
return;
|
||||
}
|
||||
await nextTick();
|
||||
if (value) {
|
||||
summaryMedicineRefs.value.selectAllRows();
|
||||
} else {
|
||||
summaryMedicineRefs.value.clearSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +212,11 @@ function handleTherapyChange() {
|
||||
}
|
||||
|
||||
function handleExecute() {
|
||||
proxy.$refs['prescriptionRefs'].handleMedicineSummary();
|
||||
if (isDetails.value == '1') {
|
||||
prescriptionRefs.value?.handleMedicineSummary();
|
||||
} else {
|
||||
summaryMedicineRefs.value?.handleExecute();
|
||||
}
|
||||
}
|
||||
|
||||
function handleBack() {
|
||||
@@ -206,7 +224,11 @@ function handleBack() {
|
||||
}
|
||||
|
||||
provide('handleGetPrescription', (value) => {
|
||||
prescriptionRefs.value.handleGetPrescription();
|
||||
if (isDetails.value == '1') {
|
||||
prescriptionRefs.value?.handleGetPrescription();
|
||||
} else {
|
||||
summaryMedicineRefs.value?.handleGetPrescription();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user