Files
his/openhis-ui-vue3/src/views/doctorstation/components/emr/emrhistory.vue

86 lines
2.4 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>
<!-- <el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd"
>新增
</el-button>
</el-col>
</el-row> -->
<el-table
ref="emrHistoryRef"
:data="emrHistory"
row-key="id"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column label="主诉" align="left" prop="name" :show-overflow-tooltip="true"/>
<el-table-column label="时间" align="center" prop="createTime" width="180" :show-overflow-tooltip="true"/>
<el-table-column label="操作" align="center" width="80">
<template #default="scope">
<el-button link type="primary" @click.stop="clickRow(scope.row)">复用</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script setup>
import { formatDate, formatDateymd } from '@/utils/index';
import { getEmrHistoryList } from '../api';
const queryParams = ref({
pageNum: 1,
pageSize: 10,
patientId: '',
});
const selectRow = ref({});
const emrHistory = ref([]);
const emits = defineEmits(['selectRow']);
const emrHistoryRef = ref(null);
const selectedRows = ref([]);
const total = ref(0);
getList();
function getList() {
if (sessionStorage.getItem('patientId')) {
queryParams.value.patientId = sessionStorage.getItem('patientId');
getEmrHistoryList(queryParams.value).then((res) => {
emrHistory.value = res.data.records;
total.value = res.data.total;
emrHistory.value.map((k) => {
k.name = JSON.parse(k.contextJson).chiefComplaint;
k.createTime = formatDate(k.createTime);
});
});
}
}
function handleSelectionChange(selection) {
selectedRows.value = selection;
// 如果选择的行数大于1只保留最后一行
if (selection.length > 1) {
// 清除所有选择
emrHistoryRef.value?.clearSelection();
// 只选择最后一行
const lastSelected = selection[selection.length - 1];
emrHistoryRef.value?.toggleRowSelection(lastSelected, true);
selectedRows.value = [lastSelected];
}
}
function clickRow(row) {
selectRow.value = JSON.parse(row.contextJson);
emits('selectRow', selectRow.value);
}
</script>