249 lines
8.7 KiB
Vue
Raw Normal View History

2026-03-09 18:04:16 +08:00
<template>
<div class="app-container">
<div class="compact-form">
<el-form :model="queryParams" ref="queryRef" label-width="5rem" style="width: 100%;" :size="aotuSize">
<el-row :gutter="10">
<el-col :span="5">
<el-form-item label="委托机构:" prop="SrcHospName">
<SelectTable v-model:data="queryParams.SrcHospName" :fields="ksdhFields" :tableData="hosList"
label="label" :size="aotuSize" value="value" objKey="value" :border="true" placeholder="请选择委托机构" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="检测医院:" prop="DstHospName">
<SelectTable v-model:data="queryParams.DstHospName" :fields="ksdhFields" :tableData="hosList"
label="label" :size="aotuSize" value="label" objKey="label" :border="true" placeholder="请选择" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="条码号:" prop="Barcode">
<el-input v-model="queryParams.Barcode" placeholder="请输入条码号" clearable />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="姓名:" prop="PatName">
<el-input v-model="queryParams.PatName" placeholder="请输入姓名" clearable />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="申请项目:" prop="checkPUR">
<el-input v-model="queryParams.checkPUR" placeholder="请输入申请项目" clearable />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="时间类型:" prop="DateType">
<el-select v-model="queryParams.DateType" placeholder="请选择">
<el-option label="登记时间" value="登记时间" />
<el-option label="采样时间" value="采样时间" />
<el-option label="送出时间" value="送出时间" />
<el-option label="签收时间" value="签收时间" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="日期:" prop="times">
<el-date-picker v-model="queryParams.times" type="daterange" range-separator="-" start-placeholder="开始时间"
end-placeholder="结束时间" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-button type="primary" @click="handleQuery">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-col>
</el-row>
</el-form>
</div>
<div class="mb10">
<el-button type="primary" @click="qsHandle(50)">标本签收</el-button>
<el-button type="primary" @click="qsHandle(110)">标本拒签</el-button>
<el-button type="primary" plain @click="bbThHandle">标本退回</el-button>
</div>
<div style="height: calc(100% - 180px)">
<CustomTable ref="tableRefs" :data="tableData" :columns="columns" :config="tableConfig" :pagination="pagination"
@selection-change="handleSelectionChange" @size-change="sizeChange" @page-change="currentChange">
<template #patAge="{ row }">
{{ row.patAge }}{{ row.ageUnit }}
</template>
<template #status="{ row }">
{{ formatDict(row.status, regdictList) }}
</template>
<template #patSex="{ row }">
{{ row.patSex == 1 ? '男' : '女' }}
</template>
</CustomTable>
</div>
</div>
</template>
<script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue'
import { querySampleSign, sampleSign } from '@/api/regional/index'
import SelectTable from '@/components/SelectTable/index.vue';
// @ts-ignore
import { listhospital } from "@/api/regional/dict/hospital.js";
// @ts-ignore
import { listregdict } from "@/api/regional/dict/regdict.js";
import { classCom } from '@/utils/classCom';
import { ElMessage, ElMessageBox } from 'element-plus';
const aotuSize = classCom.useAutoSize();
import { useRouter } from 'vue-router'
const router = useRouter()
const queryParams: any = ref({
pageSize: 50,
pageNum: 1
})
const tableData: any = ref([])
const columns: any = ref([
{ type: 'selection', align: 'center', visible: true, width: 40 },
{ prop: 'barcode', label: '条码号', align: 'center', visible: true, width: 150 },
{ prop: 'srcHospName', label: '委托机构', align: 'center', visible: true, width: 250 },
{ prop: 'patName', label: '姓名', align: 'center', visible: true, width: 70 },
{ prop: 'patSex', label: '性别', align: 'center', visible: true, width: 60, slot: "patSex" },
{ prop: 'patAge', label: '年龄', align: 'center', visible: true, slot: "patAge", width: 60 },
{ prop: 'checkPUR', label: '申请项目', align: 'center', visible: true, width: 250 },
{ prop: 'sampleTypeName', label: '标本类型', align: 'center', visible: true, },
{ prop: 'tubeName', label: '采集容器', align: 'center', visible: true, },
{ prop: 'status', label: '标本状态', align: 'center', visible: true, slot: "status" },
// { prop: 'moveStateName', label: '流转状态', align: 'center', visible: true, },
{ prop: 'affirmUserName', label: '采样人', align: 'center', visible: true, },
{ prop: 'affirmTime', label: '采样时间', align: 'center', visible: true, width: 150 },
{ prop: 'dstHospName', label: '检测机构名称', align: 'center', visible: true, width: 150 },
])
const tableConfig = ref({
border: true, // 边框
height: '100%', // 高度
highlightCurrentRow: true, // 高亮当前行
// fit: true, // 列宽自适应
})
const pagination = ref({
show: true,
total: 0,
pageSize: 50,
currentPage: 1,
})
const ksdhFields = ref([
{ prop: 'label', label: '名称', width: 150, enablePinyinSearch: true },
{ prop: 'value', label: '代号', width: 120, enablePinyinSearch: true },
])
const barcodes = ref([])
const tableRefs = ref(null)
const handleSelectionChange = (val: any) => {
barcodes.value = val.map((item: any) => item.barcode)
}
const backReasons = ref('')
const bbThHandle = () => {
if (!barcodes.value.length) return ElMessage.warning('请选择数据!')
ElMessageBox.prompt('请输入退回理由:', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputPattern: /\S+/,
inputErrorMessage: '请输入退回理由',
})
.then(({ value }) => {
backReasons.value = value
qsHandle(100)
}).catch(() => {
backReasons.value = ''
});
}
//标本签收
const qsHandle = (val: number) => {
if (!barcodes.value.length) return ElMessage.warning('请选择数据!')
sampleSign({ status: val, barcode: barcodes.value, backReasons: backReasons.value }).then((res: any) => {
if (res.code == 0) {
ElMessage.success('操作成功!')
backReasons.value = ''
handleQuery()
}
})
}
const goThPage = () => {
router.push('/regional/circulation/bbth')
}
const resetHandle = () => {
queryParams.value = {
pageSize: 50,
pageNum: 1,
}
handleQuery()
}
const currentChange = (page: { currentPage: number, pageSize: number }) => {
console.log('page==>', page);
queryParams.value.pageNum = page.currentPage
handleQuery()
}
const sizeChange = (page: { currentPage: number, pageSize: number }) => {
queryParams.value.pageSize = page.pageSize
handleQuery()
}
const handleQuery = () => {
if (queryParams.value.times && queryParams.value.times.length > 0) {
queryParams.value.DateStart = queryParams.value.times[0]
queryParams.value.DateEnd = queryParams.value.times[1]
} else {
queryParams.value.DateStart = ''
queryParams.value.DateEnd = ''
}
getList()
}
const getList = () => {
querySampleSign(queryParams.value).then((res: any) => {
tableData.value = res.rows
pagination.value.total = res.total
})
}
const hosList = ref([])
const regdictList: any = ref([])
onMounted(() => {
getList()
listhospital().then((res: any) => {
hosList.value = res.rows.map((item: any) => {
return {
label: item.hospitalName,
value: item.hospitalCode
}
})
})
listregdict({ pageSize: 100, pageNum: 1, dictType: 'ZT' }).then((res: any) => {
regdictList.value = res.rows;
})
})
const formatDict = (v: string, arr: Array<any>) => {
return arr.find((item: any) => item.dictCode == v)?.dictName || v;
};
</script>
<style scoped lang="scss">
.compact-form {
height: 5rem;
.el-form-item {
margin-bottom: 5px;
}
}
.btns {
display: flex;
flex-direction: column;
justify-content: space-around;
&>button {
width: 100%;
margin-left: 0;
margin-bottom: 5px;
}
}
</style>