149 lines
5.0 KiB
Vue
149 lines
5.0 KiB
Vue
<template>
|
||
<div class="surgery-request-container">
|
||
<el-card>
|
||
<template #header>
|
||
<div class="card-header">
|
||
<span class="title">住院医生工作站 - 手术申请</span>
|
||
</div>
|
||
</template>
|
||
|
||
<el-table :data="requestList" border style="width: 100%" v-loading="loading" row-key="id">
|
||
<el-table-column prop="id" label="申请单号" width="120" />
|
||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||
<el-table-column prop="status" label="状态" width="100">
|
||
<template #default="{ row }">
|
||
<el-tag :type="statusTagType(row.status)">
|
||
{{ statusMap[row.status] || row.status }}
|
||
</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="createTime" label="申请时间" width="160" />
|
||
<el-table-column label="操作" width="240" fixed="right">
|
||
<template #default="{ row }">
|
||
<el-button type="primary" size="small" @click="handleDetails(row)">详情</el-button>
|
||
|
||
<!-- 待签发:编辑、删除 -->
|
||
<template v-if="row.status === 'PENDING_SIGN'">
|
||
<el-button type="warning" size="small" @click="handleEdit(row)">编辑</el-button>
|
||
<el-popconfirm
|
||
title="确认删除该笔手术申请单吗?删除后数据还原将无法恢复。"
|
||
confirm-button-text="确认"
|
||
cancel-button-text="取消"
|
||
confirm-button-type="danger"
|
||
@confirm="handleDelete(row)"
|
||
>
|
||
<template #reference>
|
||
<el-button type="danger" size="small">删除</el-button>
|
||
</template>
|
||
</el-popconfirm>
|
||
</template>
|
||
|
||
<!-- 已签发:撤回 -->
|
||
<template v-else-if="row.status === 'SIGNED'">
|
||
<el-button type="warning" size="small" @click="handleRevoke(row)">撤回</el-button>
|
||
</template>
|
||
|
||
<!-- 已校对/已执行/已安排/已完成:打印 -->
|
||
<template v-else-if="['VERIFIED', 'EXECUTED', 'SCHEDULED', 'COMPLETED'].includes(row.status)">
|
||
<el-button type="success" size="small" @click="handlePrint(row)">打印</el-button>
|
||
</template>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</el-card>
|
||
|
||
<!-- 编辑/详情弹窗 (复用临床医嘱-手术界面) -->
|
||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="800px" destroy-on-close>
|
||
<div class="dialog-content">
|
||
<p>当前操作:{{ dialogType === 'edit' ? '编辑' : '查看' }}手术申请单</p>
|
||
<p>申请单ID:{{ currentRow?.id }}</p>
|
||
<!-- 此处嵌入临床医嘱-手术组件 -->
|
||
</div>
|
||
<template #footer>
|
||
<el-button @click="dialogVisible = false">取消</el-button>
|
||
<el-button v-if="dialogType === 'edit'" type="primary" @click="handleSave">确认</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, onMounted } from 'vue'
|
||
import { ElMessage } from 'element-plus'
|
||
import { getSurgeryRequestList, deleteSurgeryRequest, revokeSurgeryRequest, printSurgeryRequest } from '@/api/inpatient/surgeryRequest'
|
||
|
||
const loading = ref(false)
|
||
const requestList = ref([])
|
||
const statusMap = {
|
||
PENDING_SIGN: '待签发', SIGNED: '已签发', VERIFIED: '已校对',
|
||
EXECUTED: '已执行', SCHEDULED: '已安排', COMPLETED: '已完成', CANCELLED: '已作废'
|
||
}
|
||
const statusTagType = (status) => {
|
||
const map = { PENDING_SIGN: 'info', SIGNED: 'warning', VERIFIED: 'primary', EXECUTED: 'success', SCHEDULED: 'success', COMPLETED: 'success', CANCELLED: 'danger' }
|
||
return map[status] || 'info'
|
||
}
|
||
|
||
const dialogVisible = ref(false)
|
||
const dialogTitle = ref('')
|
||
const dialogType = ref('')
|
||
const currentRow = ref(null)
|
||
|
||
const loadData = async () => {
|
||
loading.value = true
|
||
try {
|
||
const res = await getSurgeryRequestList()
|
||
requestList.value = res.data || []
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
const handleDetails = (row) => {
|
||
dialogType.value = 'details'
|
||
dialogTitle.value = '手术申请详情'
|
||
currentRow.value = row
|
||
dialogVisible.value = true
|
||
}
|
||
|
||
const handleEdit = (row) => {
|
||
dialogType.value = 'edit'
|
||
dialogTitle.value = '编辑手术申请'
|
||
currentRow.value = row
|
||
dialogVisible.value = true
|
||
}
|
||
|
||
const handleSave = async () => {
|
||
// 调用保存接口逻辑
|
||
ElMessage.success('保存成功')
|
||
dialogVisible.value = false
|
||
loadData()
|
||
}
|
||
|
||
const handleDelete = async (row) => {
|
||
try {
|
||
await deleteSurgeryRequest(row.id)
|
||
ElMessage.success('删除成功')
|
||
loadData()
|
||
} catch (e) {
|
||
ElMessage.error(e.message || '删除失败')
|
||
}
|
||
}
|
||
|
||
const handleRevoke = async (row) => {
|
||
try {
|
||
await revokeSurgeryRequest(row.id)
|
||
ElMessage.success('撤回成功')
|
||
loadData()
|
||
} catch (e) {
|
||
ElMessage.error(e.message || '撤回失败')
|
||
}
|
||
}
|
||
|
||
const handlePrint = (row) => {
|
||
printSurgeryRequest(row.id)
|
||
ElMessage.success('已触发打印')
|
||
}
|
||
|
||
onMounted(loadData)
|
||
</script>
|