Files
his/openhis-ui-vue3/src/views/outpatient/WriteMedicalRecord.vue
2026-05-27 07:18:18 +08:00

50 lines
1.2 KiB
Vue
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 class="write-record">
<el-table :data="orderList" style="width: 100%" v-loading="loading">
<!-- 表头列略 -->
</el-table>
<el-pagination
v-if="total > pageSize"
background
layout="prev, pager, next, jumper"
:current-page="pageNum"
:page-size="pageSize"
:total="total"
@current-change="handlePageChange" />
</div>
</template>
<script setup>
import { ref, onMounted, watch } from 'vue'
import { getPendingOrders } from '@/api/outpatient'
const props = defineProps({
patientId: { type: [String, Number], required: true }
})
const orderList = ref([])
const loading = ref(false)
const pageNum = ref(1)
const pageSize = ref(20)
const total = ref(0)
const fetchOrders = async () => {
loading.value = true
try {
const res = await getPendingOrders(props.patientId, pageNum.value, pageSize.value)
orderList.value = res.data
total.value = res.total || orderList.value.length // 若后端未返回 total使用列表长度
} finally {
loading.value = false
}
}
const handlePageChange = (newPage) => {
pageNum.value = newPage
fetchOrders()
}
onMounted(fetchOrders)
watch(() => props.patientId, fetchOrders)
</script>