1087 lines
34 KiB
Vue
Raw Normal View History

2025-05-20 16:34:38 +08:00
<template>
2025-09-26 17:26:06 +08:00
<div class="result-container">
<div class="flex-between mb10">
<div>
2025-10-29 18:02:33 +08:00
<el-button class="btn_green" :size="aotuSize" @click="handleCheck(1)">初审</el-button>
<el-button class="btn_green" :size="aotuSize" v-if="labPat.jgbz != 2" @click="handleCheck(2)">审核</el-button>
<el-button class="btn_green" :size="aotuSize" v-if="labPat.jgbz == 2" @click="handleCheck(3)">取消审核</el-button>
<el-button type="primary" :size="aotuSize" plain :disabled="labPat.jgbz != null && labPat.jgbz != 0"
2025-09-29 17:30:02 +08:00
@click="openItemDictDialog">新增</el-button>
2025-10-29 18:02:33 +08:00
<el-button type="primary" :size="aotuSize" :disabled="labPat.jgbz != null && labPat.jgbz != 0" plain
2025-09-29 17:30:02 +08:00
@click="handleBatchDelete">删除</el-button>
2025-09-26 17:26:06 +08:00
</div>
<div>
2025-10-29 18:02:33 +08:00
<el-button type="primary" plain icon="Files" :size="aotuSize" @click="printHandle">打印</el-button>
<el-button type="primary" plain icon="View" :size="aotuSize" @click="previewHandle">预览</el-button>
2025-09-26 17:26:06 +08:00
</div>
</div>
2025-10-31 15:24:11 +08:00
<ContextMenu :items="contextMenuItems" @select="handleMenuSelect">
<CustomTable ref="tableRef" :data="tableData" :columns="columns" :config="tableConfig" :enable-column-drag="true"
@row-click="handleRowClick" @column-drag-end="handleColumnDragEnd" class="custom-table-container">
<template #index="{ row, $index }">
<el-popover effect="dark" v-if="row.cp_modify == 1" @before-enter="beforeEnter(row)" width="300">
<template #reference>
<div style="width: 100%;">{{ $index + 1 }}</div>
</template>
<template #default>
<el-row>
<el-col>修改前结果:{{ lastResult.csjg }}</el-col>
<el-col>修改日期:{{ lastResult.xgrq }}</el-col>
<el-col>修改人:{{ formatYs(lastResult.xgr) }}</el-col>
<el-col>上次审核时间:{{ lastResult.shsj }}</el-col>
<el-col>上次审核人:{{ formatYs(lastResult.shys) }}</el-col>
</el-row>
</template>
</el-popover>
<span v-else>{{ $index + 1 }}</span>
</template>
2025-09-26 17:26:06 +08:00
2025-10-31 15:24:11 +08:00
<template #csjg="{ row }">
<el-input v-model="row.csjg" v-if="labPat.jgbz == 0 || labPat.jgbz == null" size="small"
class="full-width-input" @change="handleCsjgEnter(row)" @dblclick="handleInputFocus(row)" />
<span v-else>{{ row.csjg }}</span>
</template>
<template #cp_compa="{ column, $index }">
{{ lastjyrq }}
</template>
<template #refs="{ row }">
{{ row.refs }}{{ row.dw }}
</template>
<template #od="{ row }">
<el-input v-model="row.od" v-if="labPat.jgbz == 0 || labPat.jgbz == null" size="small"
class="full-width-input" @change="handleCsjgEnter(row)" />
<span v-else>{{ row.od }}</span>
</template>
<template #cutoff="{ row }">
<el-input v-model="row.cutoff" v-if="labPat.jgbz == 0 || labPat.jgbz == null" size="small"
class="full-width-input" @change="handleCsjgEnter(row)" />
<span v-else>{{ row.cutoff }}</span>
</template>
</CustomTable>
</ContextMenu>
2025-09-26 17:26:06 +08:00
<!-- <div class="flex-between mt10">
<div>
<el-button class="btn_green" @click=" ">初报</el-button>
<el-button class="btn_green" @click=" ">二报</el-button>
<el-button class="btn_green" @click=" ">锁定</el-button>
</div>
<div>
</div>
</div> -->
2025-10-13 17:28:33 +08:00
<!-- csjg弹窗 -->
<projectsJg ref="csjgRef" :tableData='csjgTableData' :dialog-title="'项目常用结果选择'" @selectItem="selectItem"
label="qz" />
2025-09-26 17:26:06 +08:00
<!-- 新增明细 -->
2025-11-03 12:12:47 +08:00
<ProjectDetails ref="itemDictRef" :dialog-title="'选择检验项目'" :tableKey="tableKey" @select="handleItemSelect" />
2025-09-26 17:26:06 +08:00
<!-- 校验用户 -->
<el-dialog v-model="checkShow" title="用户身份验证" width="500" :close-on-click-modal="false" :draggable="true"
@close="resetForm">
<el-form ref="ruleFormRef" style="max-width: 600px" :model="ruleForm" :rules="rules" label-width="auto">
<el-form-item label="用户工号:" prop="yhdh">
<el-input v-model.trim="ruleForm.yhdh" placeholder="请输入用户工号" maxlength="20" @keyup.enter="submitForm" />
</el-form-item>
<el-form-item label="密码:" prop="mm">
<el-input v-model.trim="ruleForm.mm" placeholder="请输入密码" type="mm" maxlength="20" show-password
@keyup.enter="submitForm" />
</el-form-item>
<el-form-item>
<div style="text-align: center; width: 100%;">
<el-button type="primary" @click="submitForm()"> 确认 </el-button>
<el-button @click="resetForm">取消</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
<!-- 危急值结果上报 -->
<el-dialog v-model="showuploadwarning" title="危急值结果上报" width="500" :close-on-click-modal="false" :draggable="true"
@close="warningResetForm">
<div class="red-static-text">{{ warningMsgdata }}</div>
<el-form ref="warningFormRef" style="max-width: 600px" :model="warningForm" :rules="wrules" label-width="auto">
<el-form-item label="上报方式:" prop="uploadTp">
<el-radio-group v-model="warningForm.uploadTp" size="default">
<el-radio value="1">系统通知</el-radio>
<el-radio value="2">电话通知</el-radio>
</el-radio-group>
</el-form-item>
<template v-if="warningForm.uploadTp == 2">
<el-form-item label="电话通知人:" prop="userId">
<el-input v-model.trim="warningForm.userId" class="form-input" placeholder="请输入医生工号" @keyup.enter=" " />
</el-form-item>
<el-form-item label="联系电话:" prop="phone">
<el-input v-model="warningForm.phone" class="form-input" placeholder="请输入联系电话" @keyup.enter=" " />
</el-form-item>
</template>
<el-form-item>
<div style="text-align: center; width: 100%;">
<el-button type="primary" @click="handleWarningSuccess()"> 确认 </el-button>
<el-button @click="warningResetForm">取消</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
<!-- 操作原因 -->
<el-dialog v-model="unCheckshow" title="操作原因" width="500" :close-on-click-modal="false" :draggable="true"
@close="unconfirmlogCancel">
<div class="dialog-body mb10">
2025-10-13 17:28:33 +08:00
<p class="reason-text mb5">{{ reasonText }} </p>
2025-09-26 17:26:06 +08:00
<el-form ref="uncheckFormRef" style="max-width: 600px" :model="uncheckForm" :rules="rules" label-width="auto">
<template v-if="tableKey.problemId == 4">
<el-input type="textarea" v-model="uncheckForm.reason" class="reason-input" placeholder="请输入操作原因..."
:rows="4"></el-input>
</template>
<template v-if="tableKey.problemId == 6">
<el-form-item label="用户工号:" prop="yhdh">
<el-input v-model.trim="uncheckForm.yhdh" placeholder="请输入用户工号" maxlength="20"
@keyup.enter="submitForm" />
</el-form-item>
<el-form-item label="密码:" prop="mm">
<el-input v-model.trim="uncheckForm.mm" placeholder="请输入密码" type="mm" maxlength="20" show-password
@keyup.enter="submitForm" />
</el-form-item>
</template>
</el-form>
</div>
<div style="text-align: center; width: 100%;">
<el-button type="primary" @click="unconfirmlogConfirm()"> 确认 </el-button>
<el-button @click="unconfirmlogCancel">取消</el-button>
</div>
</el-dialog>
2025-11-03 18:07:51 +08:00
<!-- 合并当前病人其他结果 -->
<el-dialog v-model="jgShow" title="绑定其他结果" width="40vw" :close-on-click-modal="false" :draggable="true">
<el-row>
<el-col :span="8">
<el-radio-group v-model="radio2">
<el-radio value="1">5天内</el-radio>
<el-radio value="2">10天内</el-radio>
<el-radio value="2">20天内</el-radio>
<el-radio value="2">30天内</el-radio>
</el-radio-group>
</el-col>
<el-col :span="4">
<el-radio-group v-model="radio2">
<el-radio value="1">复制</el-radio>
<el-radio value="2">移动</el-radio>
</el-radio-group>
</el-col>
<el-col :span="4">
<el-radio-group v-model="radio2">
<el-radio value="1">覆盖</el-radio>
<el-radio value="2">不覆盖</el-radio>
</el-radio-group>
</el-col>
<el-col :span="8">
<div> <el-checkbox>只显示同一申请单号</el-checkbox> </div>
<div>
2025-11-04 17:58:12 +08:00
<el-button type="primary">合并</el-button>
2025-11-03 18:07:51 +08:00
<el-button>取消</el-button>
</div>
</el-col>
</el-row>
2025-11-04 17:58:12 +08:00
<CustomTable :data="mTableData" :columns="mColumns" :config="mTableConfig" :enable-column-drag="true"
@column-drag-end="mDragEnd" @selection-change="mSelectionChange">
<template #brxb="{ row }">
{{ formatDict(row.brxb, 'SX') }}
</template>
<template #nldw="{ row }">
{{ formatDict(row.nldw, 'AU') }}
</template>
</CustomTable>
2025-11-03 18:07:51 +08:00
</el-dialog>
2025-11-04 17:58:12 +08:00
<!-- 用户校验 -->
<userVerification ref="formRef" :title="verTitle" :form-value="formData" :userList="userList"
@confirm="handleConfirm" @cancel="handleCancel" />
2025-11-03 18:07:51 +08:00
2025-11-04 17:58:12 +08:00
<!-- 双工流水线 -->
<el-dialog v-model="dlShow" title="双工流水线申请单列表" width="40vw" :close-on-click-modal="false" :draggable="true">
<div class="mb10">
<el-button type="primary" @clcick="getDlList">刷新</el-button>
<el-button type="primary" @click="cfHandle">重发申请单</el-button>
<el-button @click="closeHandle">取消申请单</el-button>
</div>
<CustomTable :data="dlTableData" :columns="dlColumns" :config="dlTableConfig" :enable-column-drag="true"
@column-drag-end="dlDragEnd" @selection-change="dlSelectionChange">
<template #instrid="{ row }">
{{ row.instrid ? dlObj[row.instrid] : '未发送指令' }}
</template>
<template #brxb="{ row }">
{{ formatDict(row.brxb, 'SX') }}
</template>
<template #nldw="{ row }">
{{ formatDict(row.nldw, 'AU') }}
</template>
</CustomTable>
<div class="mt5" style="text-align: center;color:blue;">样本总数:{{ dlTableData.length }}</div>
</el-dialog>
2025-11-03 18:07:51 +08:00
2025-05-20 16:34:38 +08:00
</div>
</template>
<script setup>
2025-10-31 15:24:11 +08:00
import { ref, toRefs, watch, nextTick, onMounted, computed } from "vue";
2025-11-04 17:58:12 +08:00
import userVerification from "@/components/userVerification/index.vue";
2025-10-24 17:36:06 +08:00
import {
2025-11-04 17:58:12 +08:00
check1, check2, uncheck2, unconfirmlog, checkuser, reglimit, deleteresult, changeresult, allPatquery, emrquery, datalink, changeLinkList,
2025-11-03 18:07:51 +08:00
newresult, queryXmVal, printListwork, getresultchangelog, setinputmdl, saveResult, lockSample, unLockSample
2025-10-24 17:36:06 +08:00
} from "@/api/liswork/work/LisWork";
2025-09-17 10:19:20 +08:00
import { ElMessageBox, ElMessage } from "element-plus";
2025-11-03 12:12:47 +08:00
import ProjectDetails from "@/components/projectDetails/index.vue";
2025-10-13 17:28:33 +08:00
import projectsJg from "@/components/projectsjg/index.vue"
2025-09-29 17:30:02 +08:00
import { classCom } from '@/utils/classCom'
2025-10-21 09:55:56 +08:00
import CustomTable from '@/components/elTable/index.vue'
import dayjs from 'dayjs';
2025-10-24 17:36:06 +08:00
// @ts-ignore
import { listUser } from '@/api/system/user.js'
2025-10-28 17:22:53 +08:00
import emitter from "@/utils/mitt";
import { useCommonStore } from "@/store/modules/commonStore";
2025-10-31 15:24:11 +08:00
import ContextMenu from "@/components/contextMenu/index.vue";
2025-10-28 17:22:53 +08:00
2025-09-17 10:19:20 +08:00
// 组件属性定义
2025-05-20 16:34:38 +08:00
const props = defineProps({
2025-10-21 09:55:56 +08:00
resultSysList: { type: Array, required: true },
2025-09-17 10:19:20 +08:00
tableData: { type: Array, default: () => [] },
2025-10-13 17:28:33 +08:00
tableKey: {
type: Object, default: () => { }
},
2025-09-26 17:26:06 +08:00
labPat: { type: Object, required: true },
2025-11-03 18:07:51 +08:00
userList: { type: Array, default: () => [] },
2025-11-04 17:58:12 +08:00
dictData: { type: Object, default: () => ({}) }
2025-09-26 17:26:06 +08:00
});
2025-10-13 17:28:33 +08:00
// 解构props
2025-11-03 18:07:51 +08:00
const { tableData, tableKey, labPat, userList } = toRefs(props);
2025-10-13 17:28:33 +08:00
const selectedRows = ref([]);
2025-10-21 09:55:56 +08:00
const lastjyrq = ref('');
2025-10-28 17:22:53 +08:00
const mbStore = useCommonStore();
2025-10-29 18:02:33 +08:00
const aotuSize = classCom.useAutoSize();
2025-11-03 18:07:51 +08:00
const radio2 = ref('1');
const jgShow = ref(false);
2025-10-28 17:22:53 +08:00
2025-09-26 17:26:06 +08:00
watch(() => props.tableData, (newVal) => {
selectedRows.value = [];
2025-10-21 09:55:56 +08:00
if (newVal) {
const index = newVal.findIndex((item) => item.cp_lastjyrq)
if (index !== -1) {
lastjyrq.value = dayjs(newVal[index].cp_lastjyrq).format('YY/MM/DD');
} else {
lastjyrq.value = '上次结果'
}
}
2025-10-28 17:22:53 +08:00
if (props.labPat.jgbz != null && props.labPat.jgbz != 0 && props.labPat.jgbz != 'C') return;
// console.log('mbStore==>', mbStore.lxsrs);
if (mbStore.lxsrs.length > 0) {
mbStore.lxsrs.forEach((mbmc) => {
const data = {
...tableKey.value,
mbmc: mbmc,
}
setinputmdl(data).then((res) => {
if (res.code == 0) {
const existingNames = new Set(tableData.value.map(item => item.xmdh))
res.data?.forEach(item => {
if (!existingNames.has(item.xmdh)) {
tableData.value.push(item)
existingNames.add(item.xmdh)
}
})
}
});
});
}
2025-05-20 16:34:38 +08:00
});
2025-09-17 10:19:20 +08:00
2025-10-21 09:55:56 +08:00
watch(() => props.resultSysList, (newVal) => {
// 深拷贝原避免直接修改响应式对象的引用
const newColumns = JSON.parse(JSON.stringify(columns.value));
newVal.forEach(v => {
const column = newColumns.find(item => item.prop === v.zdmc);
if (column) {
column.visible = (v.kj === '1' ? true : false);
}
});
columns.value = newColumns;
// 强制表格重新渲染
nextTick(() => {
if (tableRef.value?.doLayout) {
tableRef.value.doLayout();
}
});
}, { deep: true });
2025-10-31 15:24:11 +08:00
// 右键菜单配置
const contextMenuItems = computed(() => [
{ label: '打印预览', action: 'view', shortcut: 'V', },
{ label: 'PDF报告预览', action: 'bgyl', shortcut: 'P', },
{ label: '合并病人当前其他结果', action: 'merge', shortcut: 'B', },
{ type: 'divider' },
{ label: '锁定报告', action: 'Lock', shortcut: 'L', },
{ label: '解除报告锁定', action: 'lift', shortcut: 'W', },
{ type: 'divider' },
2025-11-03 18:07:51 +08:00
// { label: '删除记录', action: 'delete', danger: true, shortcut: 'd', },
2025-11-04 17:58:12 +08:00
{ label: '查看电子病历', action: 'emrquery', shortcut: 'E', },
{ label: '查看360全景视图', action: 'patquery', shortcut: 'Y', },
{ label: '双工流水线', action: 'datalink', shortcut: 'F', },
2025-10-31 15:24:11 +08:00
]);
2025-10-21 09:55:56 +08:00
2025-10-31 15:24:11 +08:00
// 处理菜单选择
const handleMenuSelect = (item) => {
switch (item.action) {
case 'view':
2025-11-03 12:12:47 +08:00
printHandle() //打印预览
2025-10-31 15:24:11 +08:00
break;
case 'bgyl':
2025-11-03 12:12:47 +08:00
previewHandle() //PDF报告预览
2025-10-31 15:24:11 +08:00
break;
case 'merge':
2025-11-04 17:58:12 +08:00
mergeHandle()
2025-11-03 18:07:51 +08:00
// alert(`合并病人当前其他结果`);
2025-10-31 15:24:11 +08:00
break;
case 'Lock':
2025-11-04 17:58:12 +08:00
lockHandle(); //锁定
2025-10-31 15:24:11 +08:00
break;
case 'lift':
2025-11-04 17:58:12 +08:00
unlockHandle() //解锁
break;
case 'emrquery':
emrqueryHandle() //电子病历查询
break;
case 'patquery':
patqueryHandle() //360视图
break;
case 'datalink':
datalinkHandle() //流水线
2025-10-31 15:24:11 +08:00
break;
case 'delete':
if (confirm(`确定要删除患者的记录吗?`)) {
2025-10-21 09:55:56 +08:00
2025-10-31 15:24:11 +08:00
}
break;
}
};
2025-11-04 17:58:12 +08:00
const mTableData = ref([])
const mColumns = ref([
{ label: "选择", type: 'selection', align: 'center', width: 40, visible: true, },
{ label: "仪器", prop: "yq", visible: true, },
{ label: "检验日期", prop: "jyrq", visible: true, },
{ label: "样本号", prop: "ybh", visible: true, },
{ label: "病历号", prop: "brdh", visible: true, },
{ label: "病人姓名", prop: "brxm", visible: true, },
{ label: "年", prop: "nl", width: 40, visible: true, },
{ label: "龄", prop: "nldw", width: 30, visible: true, slot: "nldw" },
{ label: "检验项目", prop: "xmdh", visible: true, },
{ label: "检验结果", prop: "csjg", width: 60, visible: true, },
{ label: "申请号", prop: "sqh", visible: true, },
])
const mTableConfig = {
border: true
}
const mDragEnd = (data) => {
mColumns.value = data.columns
}
const mSelectionChange = (data) => {
}
const mergeHandle = () => {
jgShow.value = true;
};
const emrqueryHandle = () => {
emrquery(tableKey.value).then(res => {
if (res.data) {
window.open(res.data)
}
})
};
const patqueryHandle = () => {
allPatquery(tableKey.value).then(res => {
if (res.data) {
window.open(res.data)
}
})
};
const dlObj = {
0: '申请发送',
1: '已发送指令',
2: '申请撤销中'
}
const dlShow = ref(false)
const dlTableData = ref([])
const dlColumns = ref([
{ label: "选择", type: 'selection', align: 'center', width: 40, visible: true, },
{ label: "动作状态", prop: "instrid", align: 'center', visible: true, slot: 'instrid' },
{ label: "申请号", prop: "sqh", align: 'center', visible: true, },
{ label: "样本号", prop: "ybh", align: 'center', visible: true, },
{ label: "姓名", prop: "brxm", align: 'center', visible: true, },
{ label: "性别", prop: "brxb", width: 30, align: 'center', visible: true, slot: 'brxb' },
{ label: "年", prop: "nl", width: 30, align: 'center', visible: true, },
{ label: "龄", prop: "nldw", width: 30, align: 'center', visible: true, slot: "nldw" },
{ label: "检验目的", prop: "jymd", width: 180, visible: true, },
])
const dlTableConfig = ref({
border: true,
maxHeight: 500,
cellStyle: ({ row, column }) => {
if (row.instrid == 1) {
return { background: '#c0c0c0 !important' }
}
},
})
const dlDragEnd = (data) => {
dlColumns.value = data.columns
}
const dlList = ref([])
const dlSelectionChange = (selection) => {
dlList.value = selection
}
const datalinkHandle = () => {
getDlList()
dlShow.value = true;
};
const getDlList = () => {
datalink(tableKey.value).then(res => {
dlTableData.value = res.data;
})
}
const cfHandle = () => {
if (dlList.value.length < 0) return ElMessage.warning('请选择数据')
const arr = dlList.value.filter(item => item.instrid == 1)
arr.forEach(v => {
v.instrid = null
})
changeLinkList(arr).then(res => {
if (res.code == 0) {
getDlList()
}
})
}
const closeHandle = () => {
dlList.value.forEach(v => {
v.instrid = 2
})
changeLinkList(dlList.value).then(res => {
if (res.code == 0) {
getDlList()
}
})
}
2025-11-03 18:07:51 +08:00
const formRef = ref();
const formData = ref({
yhdh: '',
userName: '',
mm: '',
})
2025-11-04 17:58:12 +08:00
const verTitle = ref('请输入锁定人员账号密码')
2025-11-03 18:07:51 +08:00
const lockType = ref(1)
// 锁定报告
const lockHandle = () => {
2025-11-04 17:58:12 +08:00
if (props.labPat.jgbz != 0) return ElMessage.warning('样本已审核,不能锁定!')
2025-11-03 18:07:51 +08:00
lockType.value = 1
formRef.value.open()
2025-11-04 17:58:12 +08:00
verTitle.value = '请输入锁定人员账号密码'
2025-11-03 18:07:51 +08:00
}
2025-11-04 17:58:12 +08:00
// 解除锁定报告
2025-11-03 18:07:51 +08:00
const unlockHandle = () => {
2025-11-04 17:58:12 +08:00
if (props.labPat.jgbz != 5) return ElMessage.warning('目标标本未锁定,不可解除锁定!')
2025-11-03 18:07:51 +08:00
lockType.value = 2
2025-11-04 17:58:12 +08:00
verTitle.value = '请输入解除锁定人员账号密码'
2025-11-03 18:07:51 +08:00
formRef.value.open()
}
// 锁定样本
const handleConfirm = (data) => {
const obj = {
yhdh: data.yhdh,
...tableKey.value
}
if (lockType.value == 1) {
lockSample(obj).then((res) => {
if (res.code == 0) {
formRef.value?.cancel()
ElMessage.success(res.msg)
2025-11-04 17:58:12 +08:00
emits('fetchLabResults')
2025-11-03 18:07:51 +08:00
}
});
} else {
unLockSample(obj).then((res) => {
if (res.code == 0) {
formRef.value?.cancel()
ElMessage.success(res.msg)
2025-11-04 17:58:12 +08:00
emits('fetchLabResults')
2025-11-03 18:07:51 +08:00
}
});
}
}
const handleCancel = () => {
formData.value = {
yhdh: '',
userName: '',
mm: '',
}
}
2025-10-21 09:55:56 +08:00
const columns = ref([
2025-10-24 15:23:13 +08:00
{ label: 'No', prop: 'index', width: 30, align: 'center', visible: true, slot: "index" },
2025-10-21 09:55:56 +08:00
{ label: "复", prop: "redo_flag", width: 30, align: 'center', visible: true, },
2025-10-24 15:23:13 +08:00
{ label: "项目", prop: "xmdh", width: 50, visible: true, },
2025-10-21 09:55:56 +08:00
{ label: "名称", prop: "xmmc", width: 180, visible: true, },
2025-10-24 17:36:06 +08:00
{ label: "结果", prop: "csjg", width: 60, visible: true, slot: "csjg" },
2025-10-24 15:23:13 +08:00
{ label: "上次结果", prop: "cp_compa", width: 60, visible: true, headerSlot: "cp_compa" },
2025-10-21 09:55:56 +08:00
{ label: "OD", prop: "od", width: 80, visible: true, slot: "od" },
{ label: "CUTOFF", prop: "cutoff", width: 80, visible: true, slot: "cutoff" },
2025-10-24 15:23:13 +08:00
{ label: "参考值", prop: "refs", width: 100, visible: true, slot: "refs" },
// { label: "单位", prop: "dw", width: 80, visible: true, },
{ label: "子模块", prop: "bz1", visible: true, },
2025-10-21 09:55:56 +08:00
])
const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
if (column.label == "结果" && (row.alarm_flag ?? "").trim().length > 0) {
return { background: '#f00 !important', color: '#FFF' };
}
if (column.label == "结果" && row.jgbz == "H") {
return { background: '#ffc0c0 !important', color: '#606266' };
}
if (column.label == "结果" && row.jgbz == "L") {
return { background: '#8080ff !important', color: '#fff' };
}
if (column.label == "结果" && row.jgbz == "P") {
return { background: '#ffc0c0 !important', color: '#606266' };
}
if (column.label == "结果" && row.jgbz == "Q") {
return { background: '#ffff80 !important', color: '#FFF' };
}
2025-10-24 17:36:06 +08:00
if (column.label == "上次结果" && row.cp_lastflag == "J") {
2025-10-21 09:55:56 +08:00
return { background: '#f00 !important', color: '#FFF' };
}
if (column.label == "上次结果" && row.cp_lastflag == "H") {
return { background: '#ffc0c0 !important', color: '#606266' };
}
if (column.label == "上次结果" && row.cp_lastflag == "L") {
return { background: '#8080ff !important', color: '#fff' };
}
if (column.label == "上次结果" && row.cp_lastflag == "P") {
return { background: '#ffc0c0 !important', color: '#606266' };
}
if (column.label == "上次结果" && row.cp_lastflag == "Q") {
return { background: '#ffff80 !important', color: '#FFF' };
}
if (column.label == "复" && row.redo_flag == "1") {
return { background: '#f00 !important', color: '#FFF' };
}
if (column.label == "No" && row.cp_modify == "1") {
return { background: '#ff00ff !important', color: '#FFF' };
}
};
const tableConfig = ref({
border: true, // 边框
height: '100%', // 高度
2025-10-31 15:24:11 +08:00
maxHeight: '78vh', // max高度
2025-10-21 09:55:56 +08:00
highlightCurrentRow: true, // 高亮当前行
cellStyle: cellStyle,
})
const handleColumnDragEnd = (data) => {
columns.value = data.columns;
};
2025-10-24 17:36:06 +08:00
const lastResult = ref({});
const beforeEnter = (row) => {
console.log('row==>', row);
const data = {
...tableKey.value,
xmdh: row.xmdh,
}
getresultchangelog(data).then(res => {
lastResult.value = res.data || {}
})
};
2025-10-21 09:55:56 +08:00
2025-09-26 17:26:06 +08:00
const warningForm = ref({
userId: '',
phone: '',
uploadTp: '1'
})
const uncheckForm = ref({
reason: '',
yhdh: '',
mm: '',
})
const wrules = ref({
userId: [{ required: true, message: "请输入用户工号", trigger: "blur" },
{ min: 3, max: 20, message: "长度在 3 到 20 个字符", trigger: "blur" }
],
phone: [{ required: true, message: "请输入联系电话", trigger: "blur" },
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }
]
})
const unCheckshow = ref(false);
const inputValue = ref('');
const reasonText = ref('');
const warningMsgdata = ref('');
const showuploadwarning = ref(false);
const checkuserid = ref()
const checkShow = ref(false);
const ruleForm = ref({
yhdh: '',
mm: ''
});
const rules = ref(
{
yhdh: [{ required: true, message: "请输入用户工号", trigger: "blur" },
{ min: 3, max: 20, message: "长度在 3 到 20 个字符", trigger: "blur" }
],
mm: [{ required: true, message: "请输入密码", trigger: "blur" },
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }
]
}
);
2025-10-13 17:28:33 +08:00
const csjgRef = ref();
2025-09-26 17:26:06 +08:00
const itemDictRef = ref(); // DictInput组件引用
2025-11-03 12:12:47 +08:00
const tableRef = ref();
2025-09-26 17:26:06 +08:00
const handleCheck = (checkType) => {
// yhdh = checkuserid.value
switch (checkType) {
case 1: // 初审
2025-11-03 18:07:51 +08:00
check1({ ...tableKey.value, yhdh: props.labPat.yhdh }).then(res => {
2025-09-26 17:26:06 +08:00
emits("changeStatus", props.labPat);
})
break;
case 2: // 审核
tableKey.value.problemId = 0
shHandleCheck()
break;
case 3: // 取消审核
tableKey.value.problemId = 0
unShHandle()
break;
default:
break;
}
};
2025-10-13 17:28:33 +08:00
2025-10-21 09:55:56 +08:00
2025-10-13 17:28:33 +08:00
2025-09-26 17:26:06 +08:00
const shHandleCheck = () => {
2025-11-03 18:07:51 +08:00
check2({ ...props.tableKey, yhdh: props.labPat.yhdh }).then(res => {
2025-09-26 17:26:06 +08:00
emits("changeStatus", props.labPat);
if (res.code == "4" && res.problemId === 4) {
tableKey.value.problemId = res.problemId;
warningMsgdata.value = res.msg;
showuploadwarning.value = true;
}
})
};
const warningFormRef = ref(null);
const warningResetForm = () => {
warningForm.value.userId = '';
warningForm.value.phone = '';
warningForm.value.uploadTp = '1';
warningFormRef.value.resetFields();
showuploadwarning.value = false;
};
// 处理危急值登记
const handleWarningSuccess = async () => {
if (warningForm.value.uploadTp == 2) {
const valid = await warningFormRef.value.validate().catch(() => { });
if (!valid) return false;
}
reglimit({ ...tableKey.value, qrr: warningForm.value.userId, tzfs: warningForm.value.uploadTp, phone: warningForm.value.phone }).then(response => {
showuploadwarning.value = false;
if (response.code == 0) {
shHandleCheck();
}
if (response.code == 4) {
ElMessageBox.confirm(response.msg, '系统提示', { confirmButtonText: '是', cancelButtonText: '否', type: 'warning' }).then(() => {
tableKey.value.problemId = tableKey.value.problemId + 1;
handleWarningSuccess();
}).catch(() => {
shHandleCheck();
});
}
})
};
const unShHandle = () => {
2025-11-03 18:07:51 +08:00
uncheck2({ ...tableKey.value, yhdh: props.labPat.yhdh }).then(res => {
2025-09-26 17:26:06 +08:00
if (res.code == "4") {
tableKey.value.problemId = res.problemId;
reasonText.value = res.msg;
unCheckshow.value = true;
}
emits("changeStatus", props.labPat);
})
};
const uncheckFormRef = ref();
// 取消审核原因
const unconfirmlogConfirm = async () => {
if (tableKey.value.problemId == 4) {
if (!uncheckForm.value.inputValue) return ElMessage.warning("请输入操作原因")
} else if (tableKey.value.problemId == 6) {
const valid = await uncheckFormRef.value.validate().catch(() => { });
if (!valid) return false;
}
unconfirmlog({ ...tableKey.value, ...uncheckForm.value }).then(response => {
if (response.code == "0") {
unCheckshow.value = false;
unShHandle();
}
})
};
const unconfirmlogCancel = () => {
unCheckshow.value = false;
uncheckForm.value.reason = '';
uncheckForm.value.yhdh = '';
uncheckForm.value.mm = '';
uncheckFormRef.value.resetFields();
}
const ruleFormRef = ref(null);
const submitForm = () => {
ruleFormRef.value.validate((valid) => {
if (valid) {
checkuser(ruleForm.value).then(res => {
if (res.code == 0) {
checkuserid.value = ruleForm.value.yhdh
checkShow.value = false;
ElMessage.success("验证成功");
}
})
} else {
return false;
}
});
}
const resetForm = () => {
checkShow.value = false;
ruleForm.value.userId = '';
ruleForm.value.mm = '';
ruleFormRef.value.resetFields();
};
// 2. 打开项目选择弹窗
const openItemDictDialog = () => {
2025-11-03 12:12:47 +08:00
itemDictRef.value.openDictSelector();
2025-09-26 17:26:06 +08:00
};
// 3. 处理项目选择结果:传递给labresult子组件新增行
const handleItemSelect = async (selectedItem) => {
// 1. 构造新增行数据
const newRow = {
id: `temp_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`,
xmdh: selectedItem.value,
xmmc: selectedItem.label,
dw: selectedItem.dw || "",
refs: selectedItem.refs || "",
jyrq: tableKey.value.jyrq,
yq: tableKey.value.yq,
ybh: tableKey.value.ybh,
};
addRowFromDict(newRow);
// ElMessage.success(`已新增项目:${newRow.xmmc}`);
};
2025-11-03 12:12:47 +08:00
// 新增行核心方法:接收父组件传递的项目数据
const addRowFromDict = async (rowData) => {
if (!rowData.xmdh) return ElMessage.error("新增失败:项目编码不能为空");
const isDuplicate = tableData.value.some(item => item.xmdh === rowData.xmdh);
if (isDuplicate) return ElMessage.warning(`项目【${rowData.xmmc}】已存在`);
const newRow = { ...rowData, csjg: "" };
tableData.value.push(newRow);
// 5. 自动聚焦
nextTick(() => {
selectedRows.value = [newRow];
tableRef.value.setCurrentRow(newRow);
2025-11-03 18:07:51 +08:00
tableRef.value.setScrollTo(tableData.value.length - 1)
2025-11-03 12:12:47 +08:00
// 聚焦到新行的输入框
const inputs = document.querySelectorAll('.full-width-input .el-input__inner');
if (inputs.length > 0) {
inputs[inputs.length - 1].focus();
}
});
};
2025-09-17 10:19:20 +08:00
// 事件定义
2025-05-20 16:34:38 +08:00
const emits = defineEmits([
2025-09-17 10:19:20 +08:00
'fetchLabResults',
2025-09-26 17:26:06 +08:00
'changeStatus',
2025-09-29 17:30:02 +08:00
'previewHandle'
2025-05-20 16:34:38 +08:00
]);
2025-09-17 10:19:20 +08:00
2025-10-13 17:28:33 +08:00
const csjgTableData = ref([]);
// const dbRow = ref({});
const handleInputFocus = (row) => {
// dbRow.value = row
queryXmVal({ yq: tableKey.value.yq, xmdh: row.xmdh }).then(res => {
if (res.code == 0) {
csjgTableData.value = res.data
}
nextTick(() => {
csjgRef.value.open()
})
})
2025-09-17 10:19:20 +08:00
};
2025-10-13 17:28:33 +08:00
const selectItem = (row) => {
// 查找修改行
const index = tableData.value.findIndex(item => item.xmdh == row.xmdh)
tableData.value[index].csjg = row.qz
handleCsjgEnter(tableData.value[index])
2025-09-17 10:19:20 +08:00
};
/**
2025-10-13 17:28:33 +08:00
* csjg输入框回车触发保存
*/
2025-10-10 17:35:28 +08:00
2025-09-17 10:19:20 +08:00
const handleCsjgEnter = async (row) => {
2025-10-28 17:22:53 +08:00
// 判断数据中包含模板新增的数据 flag
if (tableData.value.length == 0) return
const flag = tableData.value.some(item => item.changeflag == 2)
if (flag) {
saveResult(tableData.value).then((res) => {
if (res.code == 0) {
emitter.emit('saveResult');
}
})
2025-10-10 17:35:28 +08:00
} else {
2025-11-03 18:07:51 +08:00
if (row && row.id) {
2025-10-28 17:22:53 +08:00
emitter.emit('saveResult');
newresult(row).then(response => {
ElMessage.success("结果保存成功");
emits('fetchLabResults');
}).catch(error => {
emits('fetchLabResults');
});
} else {
changeresult(row).then(response => {
ElMessage.success("结果保存成功");
emits('fetchLabResults');
}).catch(error => {
emits('fetchLabResults');
});
}
nextTick(() => {
const input = document.activeElement;
if (input.tagName === "INPUT") input.blur();
2025-10-10 17:35:28 +08:00
});
}
};
2025-09-17 10:19:20 +08:00
/**
* 处理选择变化
*/
2025-09-26 17:26:06 +08:00
const handleRowClick = (row) => {
selectedRows.value = [row];
2025-10-29 18:02:33 +08:00
emitter.emitWithCache('refreshClinical', row);
2025-05-20 16:34:38 +08:00
};
2025-09-17 10:19:20 +08:00
/**
* 新增行
*/
2025-05-20 16:34:38 +08:00
const handleAdd = () => {
const newRow = {
2025-09-17 10:19:20 +08:00
// 生成临时ID确保唯一性
id: `temp_${Date.now()}`,
jyrq: tableKey.value?.jyrq,
yq: tableKey.value?.yq,
ybh: tableKey.value?.ybh,
csjg: ""
2025-05-20 16:34:38 +08:00
};
2025-09-17 10:19:20 +08:00
2025-05-20 16:34:38 +08:00
tableData.value.push(newRow);
2025-09-17 10:19:20 +08:00
2025-05-20 16:34:38 +08:00
nextTick(() => {
2025-09-17 10:19:20 +08:00
const tableBody = document.querySelector('.el-table__body-wrapper');
if (tableBody) {
tableBody.scrollTop = tableBody.scrollHeight;
2025-05-20 16:34:38 +08:00
}
2025-09-17 10:19:20 +08:00
// 聚焦到新行的输入框
const inputs = document.querySelectorAll('.full-width-input .el-input__inner');
2025-05-20 16:34:38 +08:00
if (inputs.length > 0) {
2025-09-17 10:19:20 +08:00
inputs[inputs.length - 1].focus();
2025-05-20 16:34:38 +08:00
}
2025-09-17 10:19:20 +08:00
});
2025-05-20 16:34:38 +08:00
};
2025-09-26 17:26:06 +08:00
2025-09-17 10:19:20 +08:00
/**
* 批量删除
*/
2025-09-26 17:26:06 +08:00
const handleBatchDelete = () => {
if (selectedRows.value.length === 0) return ElMessage.warning("请先选择要删除的记录");
const arr = selectedRows.value.filter(row => !row.id);
ElMessageBox.confirm(
`确定要删除选中的 ${selectedRows.value.length} 条记录吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
if (arr.length == 0) {
const index = tableData.value.findIndex(item => item.xmdh === selectedRows.value[0].xmdh);
if (index > -1) tableData.value.splice(index, 1);
selectedRows.value = [];
} else {
deleteresult(arr).then(res => {
if (res.code == 0) {
ElMessage.success('删除成功');
emits('fetchLabResults');
2025-09-17 10:19:20 +08:00
}
2025-09-26 17:26:06 +08:00
})
2025-09-17 10:19:20 +08:00
}
2025-09-26 17:26:06 +08:00
}).catch(() => {
});
2025-09-17 10:19:20 +08:00
};
2025-05-20 16:34:38 +08:00
2025-09-26 17:26:06 +08:00
const printHandle = () => {
2025-09-29 17:30:02 +08:00
const data = {
jyrq: tableKey.value.jyrq,
yq: tableKey.value.yq,
ybh: tableKey.value.ybh,
sqh: tableKey.value.sqh
}
printListwork(data).then(res => {
2025-09-26 17:26:06 +08:00
if (res.code == 0) {
2025-09-29 17:30:02 +08:00
classCom.printBase64PDF(res.data)
2025-09-26 17:26:06 +08:00
}
})
2025-05-20 16:34:38 +08:00
};
2025-09-26 17:26:06 +08:00
const previewHandle = () => {
2025-09-29 17:30:02 +08:00
const data = {
jyrq: tableKey.value.jyrq,
yq: tableKey.value.yq,
ybh: tableKey.value.ybh,
sqh: tableKey.value.sqh
}
printListwork(data).then(res => {
if (res.code == 0) {
emits('previewHandle', res.data);
}
})
2025-09-17 10:19:20 +08:00
};
2025-05-20 16:34:38 +08:00
2025-09-26 17:26:06 +08:00
2025-09-17 10:19:20 +08:00
/**
* 获取行号
*/
2025-05-20 16:34:38 +08:00
const getRowIndex = (index) => {
return index + 1;
};
2025-10-28 17:22:53 +08:00
2025-11-03 18:07:51 +08:00
onMounted(() => {
2025-10-28 17:22:53 +08:00
// 获取模板项目
emitter.on('dbMbHandle', (info) => {
// console.log('data==>', info);
if (props.labPat.jgbz != null && props.labPat.jgbz != 0 && props.labPat.jgbz != 'C') return ElMessage.warning('已审核结果不可添加模板项目');
const data = {
...tableKey.value,
mbmc: info.mbmc,
}
setinputmdl(data).then((res) => {
if (res.code == 0) {
const existingNames = new Set(tableData.value.map(item => item.xmdh))
res.data?.forEach(item => {
if (!existingNames.has(item.xmdh)) {
tableData.value.push(item)
existingNames.add(item.xmdh)
}
})
handleCsjgEnter(null)
}
});
})
// 监听病人信息修改同时保存病人结果
emitter.on('saveLab', () => {
handleCsjgEnter(null)
})
2025-09-17 10:19:20 +08:00
});
2025-10-10 17:35:28 +08:00
2025-10-24 17:36:06 +08:00
const formatYs = (v) => {
return userList.value.find((item) => item.userName == v)?.nickName || v
};
2025-05-20 16:34:38 +08:00
2025-11-04 17:58:12 +08:00
const formatDict = (v, dictType) => {
return props.dictData[dictType]?.find((item) => item.value == v)?.label || v;
}
2025-05-20 16:34:38 +08:00
</script>
2025-09-26 17:26:06 +08:00
<style scoped lang="scss">
.result-container {
2025-10-31 15:24:11 +08:00
height: calc(90vh - 4.3rem);
2025-09-26 17:26:06 +08:00
display: flex;
flex-direction: column;
overflow: hidden;
2025-05-20 16:34:38 +08:00
}
2025-09-26 17:26:06 +08:00
.flex-between {
2025-10-29 18:02:33 +08:00
// height: 32px;
margin-bottom: 0.5rem;
2025-05-20 16:34:38 +08:00
}
2025-09-26 17:26:06 +08:00
.custom-table-container {
2025-10-31 15:24:11 +08:00
height: 100%;
2025-09-26 17:26:06 +08:00
}
2025-09-17 10:19:20 +08:00
</style>