将历史病例中对病例选择的bug修复,现在是单选选中
This commit is contained in:
@@ -10,23 +10,15 @@
|
|||||||
<el-table
|
<el-table
|
||||||
ref="emrHistoryRef"
|
ref="emrHistoryRef"
|
||||||
:data="emrHistory"
|
:data="emrHistory"
|
||||||
row-key="patientId"
|
row-key="id"
|
||||||
highlight-current-row
|
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<!-- @cell-click="clickRow" -->
|
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="主诉" align="left" prop="name" :show-overflow-tooltip="true"/>
|
<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" prop="createTime" width="180" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="操作" align="center" width="80">
|
<el-table-column label="操作" align="center" width="80">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<!-- <el-button
|
<el-button link type="primary" @click.stop="clickRow(scope.row)">复用</el-button>
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
@click.stop="handelDetail(scope.row)"
|
|
||||||
>详情
|
|
||||||
</el-button> -->
|
|
||||||
<el-button link type="primary" @click.stop="clickRow(scope.row)">复用 </el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -43,6 +35,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { formatDate, formatDateymd } from '@/utils/index';
|
import { formatDate, formatDateymd } from '@/utils/index';
|
||||||
import { getEmrHistoryList } from '../api';
|
import { getEmrHistoryList } from '../api';
|
||||||
|
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -51,13 +44,19 @@ const queryParams = ref({
|
|||||||
const selectRow = ref({});
|
const selectRow = ref({});
|
||||||
const emrHistory = ref([]);
|
const emrHistory = ref([]);
|
||||||
const emits = defineEmits(['selectRow']);
|
const emits = defineEmits(['selectRow']);
|
||||||
|
const emrHistoryRef = ref(null);
|
||||||
|
const selectedRows = ref([]);
|
||||||
|
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
getList();
|
getList();
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
if (sessionStorage.getItem('patientId')) {
|
if (sessionStorage.getItem('patientId')) {
|
||||||
queryParams.value.patientId = sessionStorage.getItem('patientId');
|
queryParams.value.patientId = sessionStorage.getItem('patientId');
|
||||||
getEmrHistoryList(queryParams.value).then((res) => {
|
getEmrHistoryList(queryParams.value).then((res) => {
|
||||||
emrHistory.value = res.data.records;
|
emrHistory.value = res.data.records;
|
||||||
|
total.value = res.data.total;
|
||||||
emrHistory.value.map((k) => {
|
emrHistory.value.map((k) => {
|
||||||
k.name = JSON.parse(k.contextJson).chiefComplaint;
|
k.name = JSON.parse(k.contextJson).chiefComplaint;
|
||||||
k.createTime = formatDate(k.createTime);
|
k.createTime = formatDate(k.createTime);
|
||||||
@@ -66,6 +65,20 @@ function getList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
function clickRow(row) {
|
||||||
selectRow.value = JSON.parse(row.contextJson);
|
selectRow.value = JSON.parse(row.contextJson);
|
||||||
emits('selectRow', selectRow.value);
|
emits('selectRow', selectRow.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user