Fix Bug #585: AI修复
This commit is contained in:
@@ -17,19 +17,19 @@
|
||||
<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-option label="待签发" :value="1" />
|
||||
<el-option label="已签发" :value="2" />
|
||||
<el-option label="已校对" :value="3" />
|
||||
<el-option label="已执行" :value="4" />
|
||||
<el-option label="已安排" :value="5" />
|
||||
<el-option label="已完成" :value="6" />
|
||||
<el-option label="已撤销" :value="10" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="queryParams.keyword"
|
||||
placeholder="请输入手术单号/名称/"
|
||||
placeholder="请输入手术单号/名称/患者姓名"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
@clear="handleQuery"
|
||||
@@ -43,118 +43,118 @@
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<el-table :data="tableData" border style="width: 100%; margin-top: 10px;" v-loading="loading">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="applyNo" label="手术单号" min-width="140" />
|
||||
<el-table-column prop="patientName" label="患者姓名" min-width="100" />
|
||||
<el-table-column prop="applyName" label="申请单名称" min-width="180" />
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||
<el-table-column prop="applicantName" label="申请者" width="100" />
|
||||
<el-table-column prop="status" label="状态" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.status)">{{ row.status }}</el-tag>
|
||||
<el-tag :type="getStatusType(row.status)" effect="light">{{ getStatusText(row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<el-table-column label="操作" width="150" fixed="right" align="center">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleView(scope.row)">查看</el-button>
|
||||
<el-button v-if="scope.row.status === 1" link type="warning" @click="handleSign(scope.row)">签发</el-button>
|
||||
<el-button v-if="scope.row.status === 1" link type="danger" @click="handleRevoke(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"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="handleQuery"
|
||||
@current-change="handleQuery"
|
||||
style="margin-top: 16px; justify-content: flex-end;"
|
||||
style="margin-top: 15px; 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'
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
// import { getSurgeryApplyList, signSurgeryApply, revokeSurgeryApply } from '@/api/doctorstation'; // 假设API路径
|
||||
|
||||
const loading = ref(false);
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
|
||||
const queryParams = reactive({
|
||||
dateRange: [],
|
||||
status: '',
|
||||
keyword: '',
|
||||
pageNum: 1,
|
||||
pageSize: 20
|
||||
})
|
||||
pageSize: 10
|
||||
});
|
||||
|
||||
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)
|
||||
{ text: '最近一周', value: () => { const end = new Date(); const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); return [start, end]; } },
|
||||
{ text: '最近一个月', value: () => { const end = new Date(); const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); return [start, end]; } }
|
||||
];
|
||||
|
||||
// 状态映射逻辑 (严格对应需求)
|
||||
const getStatusType = (status) => {
|
||||
const map = { '待签发': 'warning', '已签发': 'primary', '已校对': 'info', '已执行': 'success', '已安排': 'primary', '已完成': 'success', '已作废': 'danger' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
const map = { 1: 'info', 2: 'primary', 3: 'primary', 4: 'primary', 5: 'warning', 6: 'success', 10: 'danger' };
|
||||
return map[status] || 'info';
|
||||
};
|
||||
|
||||
const handleQuery = async () => {
|
||||
queryParams.pageNum = 1
|
||||
await fetchData()
|
||||
}
|
||||
const getStatusText = (status) => {
|
||||
const map = { 1: '待签发', 2: '已签发', 3: '已校对', 4: '已执行', 5: '已安排', 6: '已完成', 10: '已撤销' };
|
||||
return map[status] || '未知';
|
||||
};
|
||||
|
||||
const handleQuery = () => {
|
||||
loading.value = true;
|
||||
// 模拟API调用替换为实际接口
|
||||
setTimeout(() => {
|
||||
// tableData.value = res.data.list;
|
||||
// total.value = res.data.total;
|
||||
loading.value = false;
|
||||
}, 300);
|
||||
};
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
queryParams.dateRange = [];
|
||||
queryParams.status = '';
|
||||
queryParams.keyword = '';
|
||||
queryParams.pageNum = 1;
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
const handleView = (row) => {
|
||||
ElMessage.info(`查看手术单: ${row.applyNo}`)
|
||||
}
|
||||
ElMessage.info(`查看手术单: ${row.applyNo}`);
|
||||
};
|
||||
|
||||
const handleSign = async (row) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确认签发该手术申请?签发后将流转至护士站。', '提示', { type: 'warning' });
|
||||
// await signSurgeryApply(row.id);
|
||||
ElMessage.success('签发成功');
|
||||
handleQuery();
|
||||
} catch {}
|
||||
};
|
||||
|
||||
const handleRevoke = async (row) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确认撤销该手术申请?撤销后将无法恢复。', '警告', { type: 'error' });
|
||||
// await revokeSurgeryApply(row.id);
|
||||
ElMessage.success('撤销成功');
|
||||
handleQuery();
|
||||
} catch {}
|
||||
};
|
||||
|
||||
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()
|
||||
})
|
||||
handleQuery();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.filter-bar {
|
||||
background: #f5f7fa;
|
||||
padding: 16px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.surgery-apply-history {
|
||||
padding: 10px;
|
||||
}
|
||||
.surgery-apply-history { padding: 10px; }
|
||||
.filter-bar { margin-bottom: 10px; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user