Files
his/openhis-ui-vue3/src/views/inpatient/OrderList.vue
2026-05-26 23:46:04 +08:00

49 lines
1.5 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="order-list-container">
<el-table :data="orderList" border v-loading="loading">
<el-table-column prop="orderNo" label="医嘱号" width="120" />
<el-table-column prop="itemName" label="药品名称" />
<el-table-column prop="statusName" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="getStatusTagType(row.status)">{{ row.statusName }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="开立时间" width="180" />
</el-table>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { getOrderStatusName } from '@/utils/orderStatusMapper'
import request from '@/utils/request'
const props = defineProps({
node: { type: String, default: 'nurse' } // nurse | pharmacy
})
const orderList = ref([])
const loading = ref(false)
const fetchOrders = async () => {
loading.value = true
try {
const res = await request.get('/api/inpatient/orders', { params: { node: props.node } })
// 修复 Bug #569前端统一使用映射工具转换状态名称杜绝硬编码
orderList.value = res.data.map(item => ({
...item,
statusName: getOrderStatusName(item.status, props.node)
}))
} finally {
loading.value = false
}
}
const getStatusTagType = (code) => {
const map = { 0: 'info', 1: 'warning', 2: 'primary', 3: 'success', 4: 'success', 5: 'warning', 6: 'success', 7: 'success' }
return map[code] || 'info'
}
onMounted(fetchOrders)
</script>