205 lines
6.3 KiB
Vue
Raw Normal View History

2025-11-06 18:22:18 +08:00
<template>
2025-11-07 17:50:06 +08:00
<!-- 危急值特定判断条件 -->
<el-dialog title="危急值特定判断条件" width="700px" v-model="visible" @open="onOpen">
<el-row class="row-up">
<div class="top-button">
<el-button type="primary" @click="bClickAdd">增加</el-button>
<el-button type="primary" @click="bClickDel">删除</el-button>
<el-button type="primary" @click="bClickSave">保存</el-button>
</div>
<CustomTable ref="tableRefs" :data="tableDataUp" :columns="columnsUp" :config="tableConfigUp"
@row-click="rowHandleUp" :enableColumnDrag="true"
@column-drag-end="handleColumnDragEnd">
<template #samplecondition="{ row }">
<el-input v-model="row.samplecondition" class="full-width-input"></el-input>
</template>
<template #resultcondition="{ row }">
<el-input v-model="row.resultcondition" class="full-width-input"></el-input>
</template>
</CustomTable>
</el-row>
<el-row class="row-down">
<el-col :span="12">
<CustomTable ref="tableRefs" :data="tableDataDown" :columns="columnsDown" :config="tableConfigDown"
@row-click="rowHandleDown" :enableColumnDrag="true"
@column-drag-end="handleColumnDragEnd"/>
</el-col>
<el-col :span="12" class="rigth-col">
<el-button type="primary" @click="bClickDept" size="small">科室</el-button>
<el-button type="primary" @click="bClickDiag" size="small">诊断</el-button>
<el-button type="primary" @click="bClickPre" size="small">初报</el-button>
<el-button type="primary" @click="bClickResult" size="small">结果</el-button>
<el-button type="primary" @click="bClickSample" size="small">样本状态</el-button>
<h4>1公式举例:科室诊断条件:[科室] = '血液科' or [诊断] ='白血病' 当前结果判断条件:[结果] &gt; 20 or [结果] &lt;2 or [结果] ='阳性'</h4>
<h4>2公式举例:科室诊断条件(其他项目代号如):[WBC] = '阳性' or [WBC] &gt; 20 or [WBC] &lt;20 当前结果判断条件: [结果] &gt; 20 or [结果] &lt;2</h4>
<h4>3公式举例:只发一次危急值病人条件:[初报] = 'brdh' and [初报] = 'brxm' 当前结果判断条件:[结果] &gt; 20 or [结果] &lt;2 or [结果] ='阳性'</h4>
<h4>只要符合科室或诊断条件的,就不会再断默认的危机值标准了</h4>
<h4>注意科室用中文,结果如果是字符型用单引号引起来</h4>
</el-col>
</el-row>
</el-dialog>
2025-11-06 18:22:18 +08:00
</template>
<script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue'
2025-11-07 17:50:06 +08:00
import { queryXmInfoNew,queryXmAlarmdetailNew,addXmAlarmdetailNew,delXmAlarmdetailNew } from '@/api/liswork/labItem/labItemApi'
import {XmAlarmdetailNew} from '@/types'
import { ElMessageBox,ElMessage } from 'element-plus'
2025-11-06 18:22:18 +08:00
const columnsUp = ref([
2025-11-07 17:50:06 +08:00
{ prop: 'seq', label: '序号', align: 'center', visible: true, width: 50 },
{ prop: 'samplecondition', label: '科室或诊断条件', align: 'center', visible: true, slot: 'samplecondition', width: 300 },
{ prop: 'resultcondition', label: '结果判断条件', align: 'center', visible: true, slot: 'resultcondition', width: 300 }
2025-11-06 18:22:18 +08:00
])
const columnsDown = ref([
{ prop: 'xmdh', label: '项目代号', align: 'center', visible: true, width: 100 },
2025-11-07 17:50:06 +08:00
{ prop: 'xmmc', label: '项目名称', align: 'center', visible: true, width: 220 }
2025-11-06 18:22:18 +08:00
])
2025-11-07 17:50:06 +08:00
const tableDataUp = ref<Array<XmAlarmdetailNew>>([])
2025-11-06 18:22:18 +08:00
const tableDataDown = ref()
2025-11-07 17:50:06 +08:00
const selectRowUp = ref<XmAlarmdetailNew>()
const visible = defineModel()
const props = defineProps({
formData:{
type: Object,
default: {}
}
})
2025-11-06 18:22:18 +08:00
// 表格配置
2025-11-07 17:50:06 +08:00
const tableConfigUp = ref(
{
// stripe: true, // 斑马纹
border: true, // 边框
height: '200', // 高度
highlightCurrentRow: true, // 高亮当前行
fit: true
}
)
const tableConfigDown = ref(
2025-11-06 18:22:18 +08:00
{
// stripe: true, // 斑马纹
border: true, // 边框
2025-11-07 17:50:06 +08:00
height: '400', // 高度
2025-11-06 18:22:18 +08:00
highlightCurrentRow: true, // 高亮当前行
fit: true
}
)
2025-11-07 17:50:06 +08:00
//序号最大值
const maxXh = computed(() => {
return tableDataUp.value.length > 0 ? Math.max(...tableDataUp.value.map((item: { seq: number }) => item.seq)) : 0;
});
2025-11-06 18:22:18 +08:00
const handleColumnDragEnd = (newColumns: any) => {
columnsUp.value = newColumns.columns
columnsDown.value = newColumns.columns
}
2025-11-07 17:50:06 +08:00
const rowHandleUp = (row:any) => {
selectRowUp.value = row
}
const rowHandleDown = (row:any) => {
if (selectRowUp.value) {
selectRowUp.value.samplecondition += `[${row.xmdh}]`
}
}
const onOpen = async () => {
let res = await queryXmInfoNew(props.formData.xmgl);
tableDataDown.value = res.data;
res = await queryXmAlarmdetailNew(props.formData.xmid);
tableDataUp.value = res.data;
}
const bClickAdd = () => {
const newData: XmAlarmdetailNew = {
xmid: props.formData.xmid,
seq: maxXh.value + 1,
samplecondition: '',
resultcondition: ''
}
tableDataUp.value.push(newData);
}
const bClickDel = async () => {
if(selectRowUp.value){
await ElMessageBox.confirm('是否要删除选中的数据?','Warning',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
});
const xmid = selectRowUp.value.xmid
const seq = selectRowUp.value.seq
await delXmAlarmdetailNew(xmid,seq)
await queryXmAlarmdetailNew(props.formData.xmid);
ElMessage.success('删除成功!')
}
}
2025-11-06 18:22:18 +08:00
2025-11-07 17:50:06 +08:00
const bClickSave = async() => {
await addXmAlarmdetailNew(tableDataUp.value);
await queryXmAlarmdetailNew(props.formData.xmid);
ElMessage.success('保存成功!')
}
const bClickDept = () => {
if(selectRowUp.value){
selectRowUp.value.samplecondition += '[科室]'
}
}
const bClickDiag = () => {
if(selectRowUp.value){
selectRowUp.value.samplecondition += '[诊断]'
}
2025-11-06 18:22:18 +08:00
}
2025-11-07 17:50:06 +08:00
const bClickPre = () => {
if(selectRowUp.value){
selectRowUp.value.samplecondition += '[初报]'
}
}
2025-11-06 18:22:18 +08:00
2025-11-07 17:50:06 +08:00
//结果
const bClickResult = () => {
if(selectRowUp.value){
selectRowUp.value.resultcondition += '[结果]'
}
2025-11-06 18:22:18 +08:00
}
2025-11-07 17:50:06 +08:00
const bClickSample = () => {
if(selectRowUp.value){
selectRowUp.value.samplecondition += '[样本状态]'
}
}
2025-11-06 18:22:18 +08:00
</script>
<style scoped lang="scss">
2025-11-07 17:50:06 +08:00
.row-up {
margin-bottom: 5px;
}
.top-button {
margin-bottom: 5px;
}
.row-down {
.rigth-col {
padding-left: 10px;
}
}
2025-11-06 18:22:18 +08:00
</style>