Fix Bug #586: AI修复
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<div class="surgery-apply-history">
|
||||
<!-- 筛选/查询控制栏 -->
|
||||
<el-form :model="queryParams" inline class="filter-bar" @submit.prevent="handleQuery">
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="queryParams.dateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
:shortcuts="dateShortcuts"
|
||||
@change="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请状态">
|
||||
<el-select v-model="queryParams.status" placeholder="全部" clearable @change="handleQuery">
|
||||
<el-option label="全部" value="" />
|
||||
<el-option label="待签发" value="PENDING_SIGN" />
|
||||
<el-option label="已签发" value="SIGNED" />
|
||||
<el-option label="已校对" value="VERIFIED" />
|
||||
<el-option label="已执行" value="EXECUTED" />
|
||||
<el-option label="已安排" value="SCHEDULED" />
|
||||
<el-option label="已完成" value="COMPLETED" />
|
||||
<el-option label="已作废" value="CANCELLED" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="queryParams.keyword"
|
||||
placeholder="请输入手术单号/名称/"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
@clear="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">查询</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<el-table :data="tableData" border style="width: 100%; margin-top: 10px;" v-loading="loading">
|
||||
<el-table-column prop="applyNo" label="手术单号" min-width="140" />
|
||||
<el-table-column prop="applyName" label="申请单名称" min-width="180" />
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.status)">{{ row.status }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleView(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:total="total"
|
||||
layout="total, prev, pager, next"
|
||||
@current-change="handleQuery"
|
||||
style="margin-top: 16px; justify-content: flex-end;"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
// 假设的API路径,实际项目中请替换为真实接口
|
||||
import { querySurgeryApplyHistory } from '@/api/doctorstation/surgery'
|
||||
|
||||
const queryParams = reactive({
|
||||
dateRange: [],
|
||||
status: '',
|
||||
keyword: '',
|
||||
pageNum: 1,
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
const dateShortcuts = [
|
||||
{ text: '今天', value: () => { const d = new Date(); return [d, d] } },
|
||||
{ text: '近7天', value: () => { const end = new Date(); const start = new Date(); start.setDate(start.getDate() - 6); return [start, end] } },
|
||||
{ text: '近30天', value: () => { const end = new Date(); const start = new Date(); start.setDate(start.getDate() - 29); return [start, end] } }
|
||||
]
|
||||
|
||||
const tableData = ref([])
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
|
||||
const getStatusType = (status) => {
|
||||
const map = { '待签发': 'warning', '已签发': 'primary', '已校对': 'info', '已执行': 'success', '已安排': 'primary', '已完成': 'success', '已作废': 'danger' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
const handleQuery = async () => {
|
||||
queryParams.pageNum = 1
|
||||
await fetchData()
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
queryParams.dateRange = []
|
||||
queryParams.status = ''
|
||||
queryParams.keyword = ''
|
||||
queryParams.pageNum = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
const fetchData = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const params = {
|
||||
startDate: queryParams.dateRange?.[0] || '',
|
||||
endDate: queryParams.dateRange?.[1] || '',
|
||||
status: queryParams.status,
|
||||
keyword: queryParams.keyword,
|
||||
pageNum: queryParams.pageNum,
|
||||
pageSize: queryParams.pageSize
|
||||
}
|
||||
const res = await querySurgeryApplyHistory(params)
|
||||
if (res.code === 200) {
|
||||
tableData.value = res.data.list || []
|
||||
total.value = res.data.total || 0
|
||||
}
|
||||
} catch (e) {
|
||||
ElMessage.error('查询失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleView = (row) => {
|
||||
ElMessage.info(`查看手术单: ${row.applyNo}`)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 默认近7天
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setDate(start.getDate() - 6)
|
||||
queryParams.dateRange = [start.toISOString().split('T')[0], end.toISOString().split('T')[0]]
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.filter-bar {
|
||||
background: #f5f7fa;
|
||||
padding: 16px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.surgery-apply-history {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user