2025-11-13 18:32:03 +08:00

172 lines
5.3 KiB
Vue

<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="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="SampleTypeName">
<el-select v-model="queryParams.SampleTypeName" placeholder="请选择" clearable>
<el-option v-for="item in regdictList" :label="item.dictName" :value="item.dictCode" />
</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="thHandle(20)">重新采集</el-button>
<el-button type="primary" @click="thHandle(50)">撤销退回</el-button>
<el-button type="primary" @click="thHandle(90)">申请作废</el-button> -->
</div>
<CustomTable ref="tableRefs" :data="tableData" :columns="columns" :config="tableConfig" :pagination="pagination"
@size-change="sizeChange" @page-change="currentChange">
</CustomTable>
</div>
</template>
<script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue'
import { sampleTypeCount } from '@/api/regional/index'
import SelectTable from '@/components/SelectTable/index.vue';
import { classCom } from '@/utils/classCom';
// @ts-ignore
import { listhospital } from "@/api/regional/dict/hospital.js";
// @ts-ignore
import { listregdict } from "@/api/regional/dict/regdict.js";
import { ElMessage } from 'element-plus';
const aotuSize = classCom.useAutoSize();
const queryParams: any = ref({
pageSize: 50,
pageNum: 1,
})
const tableData: any = ref([])
const columns: any = ref([
{ prop: 'srchospname', label: '所属医院', align: 'center', visible: true, },
{ prop: 'sampletypecode', label: '标本代码', align: 'center', visible: true, },
{ prop: 'sampletypename', label: '标本类别', align: 'center', visible: true, },
{ prop: 'sl', label: '数量(份)', align: 'center', visible: true, },
{ prop: 'OrderTime', label: '开单时间', align: 'center', visible: true, },
])
const tableConfig = ref({
border: true, // 边框
height: '75vh', // 高度
highlightCurrentRow: true, // 高亮当前行
summary: true,
summaryField: ['sl'],//计算列总和
sumText: '合计'
})
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 currentChange = (page: { currentPage: number, pageSize: number }) => {
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 resetHandle = () => {
queryParams.value = {
pageSize: 50,
pageNum: 1,
}
handleQuery()
}
const getList = () => {
sampleTypeCount(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: 'BT' }).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 {
.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>