255 lines
9.7 KiB
Vue
Raw Normal View History

2026-02-09 17:37:03 +08:00
<!-- 批量审核 -->
<template>
2026-02-10 17:36:00 +08:00
<div class="app-container">
<el-form ref="form" :model="formData" class="form" label-width="80px" :rules="rules" inline inline-message
size="small">
<el-form-item label="仪器分组" prop="lisgroup" size="small">
<SelectTable v-model:data="formData.lisgroup" :fields="fields" width="100px" dict-type="GROUP" />
</el-form-item>
<el-form-item label="医疗机构" prop="yljg">
<SelectTable v-model:data="formData.yljg" :fields="fields" width="200px" dict-type="HOS" />
</el-form-item>
<el-form-item label="申请科室" prop="ksdh">
<SelectTable v-model:data="formData.ksdh" :fields="fields" width="200px" dict-type="DP" />
</el-form-item>
<el-form-item label="检验仪器" prop="yq">
<YQSelectTable v-model:data="formData.yq" width="200px" clearable @get-data-value="getList"></YQSelectTable>
</el-form-item>
<el-form-item label="标本日期" prop="jyrq">
<el-date-picker v-model="formData.jyrq1" type="date" style="width: 150px;" /> - <el-date-picker
v-model="formData.jyrq2" type="date" style="width: 150px;" />
</el-form-item>
<el-form-item label="检验医师" prop="yhdh">
<el-input placeholder="请填写检验医师" v-model="formData.yhdh"></el-input>
</el-form-item>
<el-form-item label="病人来源" prop="brly">
<SelectTable v-model:data="formData.brly" :fields="fields" width="120px" dict-type="PT" />
</el-form-item>
<el-form-item label="标本号" prop="ybh">
<el-input placeholder="请输入开始标本号" v-model="formData.ybh1" style="width: 120px;"></el-input> - <el-input
placeholder="请输入结束标本号" v-model="formData.ybh2" style="width: 120px;"></el-input>
</el-form-item>
<el-form-item label="审核标志">
<el-select v-model="formData.jgbz" style="width: 120px" clearable>
<el-option v-for="item in jgbzOption" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-checkbox v-model="formData.jzbz" label="急诊报告" true-value="1" false-value="0"></el-checkbox>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList">查询</el-button>
<el-button type="primary" @click="checkData">批量审核</el-button>
<el-button type="primary" @click="cancelCheck">取消审核</el-button>
</el-form-item>
</el-form>
<h3>{{ msg }}</h3>
<div class="table-container">
<CustomTable ref="tableRef" :data="tableData" :columns="columns" :config="tableConfig">
<template #jgbz="{ row }">
<span>{{ displayJGBZ(row.jgbz) }}</span>
</template>
<template #brly="{ row }">
<span>{{ formatDict(row.brly, 'PT') }}</span>
</template>
<template #brxb="{ row }">
<span>{{ displayBRXB(row.brxb) }}</span>
</template>
<template #brnl="{ row }">
<span>{{ displayBRNL(row.nl, row.nldw) }}</span>
</template>
<template #ksdh="{ row }">
<span>{{ formatDict(row.ksdh, 'DP') }}</span>
</template>
<template #sjys="{ row }">
<span>{{ formatDict(row.sjys, 'SRD') }}</span>
</template>
</CustomTable>
</div>
</div>
2026-02-09 17:37:03 +08:00
</template>
<script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue'
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
import SelectTable from '@/components/SelectTable/index.vue';
2026-02-10 17:36:00 +08:00
import { batchCheckService, queryBatchCheckListService, cancelBatchCheckService } from '@/api/liswork/batchCheck/batchCheckApi';
import dayjs from 'dayjs';
import { formatDict, getDictData } from '@/hooks'
import { displayBRNL, displayBRXB } from '@/utils/czUtil/lisUtil'
2026-02-09 17:37:03 +08:00
2026-02-10 17:36:00 +08:00
const formData = ref({
lisgroup: '', //仪器分组
yljg: '', //医疗机构
ksdh: '', //申请科室
yq: '', //检验仪器
jyrq1: '', //标本日期开始
jyrq2: '', //标本日期结束
yhdh: '', //检验医师
brly: '', //病人来源
ybh1: '', //标本号开始
ybh2: '', //标本号结束
jgbz: '0', //审核标志
jzbz: 0 //急诊标志
})
2026-02-09 17:37:03 +08:00
const tableRef = ref();
2026-02-10 17:36:00 +08:00
const form = ref();
const msg = ref('') //审核后结果显示
2026-02-09 17:37:03 +08:00
const tableData = ref()
const columns = ref([
2026-02-10 17:36:00 +08:00
{ type: 'selection', title: '选择', visible: true, align: 'center', width: 40 },
{ prop: 'jgbz', label: '审核标志', visible: true, align: 'center', slot: 'jgbz' },
{ prop: 'yqmc', label: '检验仪器', visible: true, align: 'center', width: 150 },
{ prop: 'jyrq', label: '检验日期', visible: true, align: 'center', width: 150 },
2026-02-09 17:37:03 +08:00
{ prop: 'ybh', label: '样本号', visible: true, align: 'center' },
{ prop: 'brxm', label: '姓名', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'brdh', label: '住院号', visible: true, align: 'center' },
2026-02-09 17:37:03 +08:00
{ prop: 'sqh', label: '申请号', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'brly', label: '病人类型', visible: true, align: 'center', slot: 'brly' },
{ prop: 'brxb', label: '性别', visible: true, align: 'center', slot: 'brxb' },
{ prop: 'brnl', label: '年龄', visible: true, align: 'center', slot: 'brnl' },
{ prop: 'ksdh', label: '科室', visible: true, align: 'center', slot: 'ksdh' },
2026-02-09 17:37:03 +08:00
{ prop: 'ch', label: '床号', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'sjys', label: '送检医生', visible: true, align: 'center', slot: 'sjys' },
{ prop: 'sqsj', label: '申请时间', visible: true, align: 'center', width: 150 },
{ prop: 'cysj', label: '采样时间', visible: true, align: 'center', width: 150 },
{ prop: 'yhdhmc', label: '检验医师', visible: true, align: 'center' },
{ prop: 'dysj', label: '报告日期', visible: true, align: 'center', width: 150 },
2026-02-09 17:37:03 +08:00
{ prop: 'yblx', label: '样本', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'hdysmc', label: '核对医生', visible: true, align: 'center' },
2026-02-09 17:37:03 +08:00
{ prop: 'dybz', label: '打印标志', visible: true, align: 'center' },
{ prop: 'zd', label: '临床诊断', visible: true, align: 'center' },
{ prop: 'bz', label: '备注', visible: true, align: 'center' },
2026-02-10 17:36:00 +08:00
{ prop: 'confirmermc', label: '审核人', visible: true, align: 'center' },
{ prop: 'confirmdt', label: '审核时间', visible: true, align: 'center', width: 150 },
2026-02-09 17:37:03 +08:00
]);
const jgbzOption = ref([
{ value: '0', label: '未审核' },
{ value: '2', label: '已审核' },
{ value: '1', label: '初审' },
{ value: 'A', label: '所有' },
])
const tableConfig = ref({
border: true, // 边框
2026-02-10 17:36:00 +08:00
height: 'calc(100vh - 220px)', // 高度,
2026-02-09 17:37:03 +08:00
highlightCurrentRow: true, // 高亮当前行
// cellStyle: cellStyleHd
})
const fields = ref(
[
{ prop: 'value', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'label', label: '名称', width: 150, enablePinyinSearch: true },
]
)
2026-02-10 17:36:00 +08:00
const displayJGBZ = (jgbz: string) => {
const option = jgbzOption.value.find((opt) => opt.value === jgbz)
return option ? option.label : jgbz
}
const validateYbhRange = (rule: any, value: any, callback: any) => {
const { ybh1, ybh2 } = formData.value // 同时获取两个输入框的值
// 场景1:两个都必填
if (!ybh1 && !ybh2) {
callback(new Error('开始和结束标本号不能为空'))
return
}
if (!ybh1) {
callback(new Error('请输入开始标本号'))
return
}
if (!ybh2) {
callback(new Error('请输入结束标本号'))
return
}
// 校验通过:必须调用空的callback()
callback()
}
2026-02-09 17:37:03 +08:00
2026-02-10 17:36:00 +08:00
const validateJYRQRange = (rule: any, value: any, callback: any) => {
const { jyrq1, jyrq2 } = formData.value
if (!jyrq1 || !jyrq2) {
callback(new Error('标本日期范围不能为空'))
return false
}
if (new Date(jyrq1) > new Date(jyrq2)) {
callback(new Error('标本日期范围不正确,开始日期不能大于结束日期'))
return false
}
return true
2026-02-09 17:37:03 +08:00
}
2026-02-10 17:36:00 +08:00
const rules = ref({
yljg: [{ required: true, message: '请选择医疗机构', trigger: 'blur' }],
ybh: [{ validator: validateYbhRange, trigger: 'blur' }],
yq: [{ required: true, message: '请选择检验仪器', trigger: 'blur' }],
jyrq: [{ validator: validateJYRQRange, trigger: 'blur' }],
})
const getList = async () => {
await form.value.validate()
formData.value.jyrq1 = dayjs(formData.value.jyrq1).format('YYYY-MM-DD HH:mm:ss')
formData.value.jyrq2 = dayjs(formData.value.jyrq2).format('YYYY-MM-DD HH:mm:ss')
const res = await queryBatchCheckListService(formData.value)
tableData.value = res.data
}
const checkData = async () => {
// 从 CustomTable 暴露的方法获取已选中行(兼容直接访问内部 tableRef)
const selected = tableRef.value?.getSelectionRows
? tableRef.value.getSelectionRows()
: (tableRef.value?.tableRef?.getSelectionRows ? tableRef.value.tableRef.getSelectionRows() : [])
const paramList = (selected || []).map((item: any) => ({
userId: "",
yq: String(item.yq).trim(),
jyrq: dayjs(item.jyrq).format('YYYY-MM-DD HH:mm:ss'),
ybh: item.ybh,
}))
if (!paramList.length) {
msg.value = '请先选择要审核的行'
return
}
console.log(paramList)
const ret = await batchCheckService(paramList)
if (ret && ret.code === 200) {
msg.value = '审核成功:' + ret.msg
getList()
}
}
const cancelCheck = async () => {
const paramList = tableRef.value.getSelectedRows()
const ret = await cancelBatchCheckService(paramList)
if (ret.code === 200) {
getList()
}
}
onMounted(() => {
getDictData('DP', 'SRD')
})
2026-02-09 17:37:03 +08:00
</script>
2026-02-10 17:36:00 +08:00
<style scoped lang="scss">
.table-container {
height: calc(100vh - 220px);
overflow: auto;
/* 如果表格高度超出,显示滚动条 */
padding-bottom: 12px;
/* 给底部留出空间,避免被遮挡 */
box-sizing: border-box;
}
</style>