项目组合、统计模块

This commit is contained in:
wyuu 2026-08-27 18:04:22 +08:00
parent a329c96704
commit 54662297d4
11 changed files with 1107 additions and 154 deletions

View File

@ -51,4 +51,100 @@ export function deleteDetail(query?: Object) {
data: query,
});
}
// 查询项目组合
export function xmCompQuery(query?: Object) {
return request({
url: '/xmComp/query',
method: 'get',
params: query,
});
}
// 增加项目组合
export function addxmComp(query?: Object) {
return request({
url: '/xmComp/add',
method: 'post',
data: query,
});
}
// 修改项目组合
export function editxmComp(query?: Object) {
return request({
url: '/xmComp/update',
method: 'post',
data: query,
});
}
// 删除项目组合
export function delxmComp(query?: Object) {
return request({
url: '/xmComp/del',
method: 'get',
params: query,
});
}
// 查询明细数据
export function queryDetailComp(query?: Object) {
return request({
url: '/xmComp/queryDetail',
method: 'get',
params: query,
});
}
// 删除明细数据
export function deleteDetailComp(query?: Object) {
return request({
url: '/xmComp/deleteDetail',
method: 'post',
data: query,
});
}
// 查询仪器组合列表
export function queryInstrgroupList(query?: Object) {
return request({
url: '/instrgroup/query',
method: 'get',
params: query,
});
}
// 新增仪器组合
export function addInstrgroup(query?: Object) {
return request({
url: '/instrgroup/add',
method: 'post',
data: query,
});
}
// 修改仪器组合
export function updateInstrgroup(query?: Object) {
return request({
url: '/instrgroup/update',
method: 'post',
data: query,
});
}
// 删除仪器组合
export function deleteInstrgroup(query?: Object) {
return request({
url: '/instrgroup/delete',
method: 'get',
params: query,
});
}
// 查询明细数据
export function queryDetailInstrgroup(query?: Object) {
return request({
url: '/instrgroup/queryDetail',
method: 'get',
params: query,
});
}
// 删除明细数据
export function delDetailInstrgroup(query?: Object) {
return request({
url: '/instrgroup/deleteDetail',
method: 'post',
data: query,
});
}

View File

@ -62,4 +62,20 @@ export function getstatsQuery(params: any) {
data: params
})
}
// 打印模板数据
export function printTemplate(params: any) {
return request({
url: '/stats/print',
method: 'post',
data: params
})
}
// 导出excel
export function exportTemplate(params: any) {
return request({
url: '/stats/exportExcel',
method: 'post',
data: params
})
}

View File

@ -468,4 +468,49 @@ aside {
border-bottom: 1px solid #ccc !important;
background-color: #eff6fa !important;
}
}
.el-input.is-disabled .el-input__wrapper {
background-color: #dee1e5 !important;
}
.el-select__wrapper.is-disabled {
background-color: #dee1e5 !important;
}
.el-select__wrapper.is-disabled .el-select__selected-item {
color: #606266 !important;
}
.el-date-editor.is-disabled,
.el-date-editor.is-disabled .el-input__wrapper {
background-color: #dee1e5 !important;
}
.el-radio__input.is-disabled+span.el-radio__label,
.el-checkbox.is-disabled {
color: #606266 !important;
}
.el-radio__input.is-disabled.is-checked .el-radio__inner {
background: #1f6dd3;
border-color: #1f6dd3;
&::after {
background: #dee1e5;
}
}
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
background: #00a5ff;
&::after {
border-color: #fff;
}
}
.el-checkbox__input.is-disabled+span.el-checkbox__label {
color: #606266 !important;
}

View File

@ -90,17 +90,15 @@
color: inherit;
}
.el-form .el-form-item__label {
font-weight: 700;
}
.el-form--inline .el-form-item {
margin-right: .9375rem;
}
.el-form-item__label {
font-weight: 400;
font-size: .875rem;
// font-weight: 700;
// font-size: 14px;
color: #08355E;
}

View File

@ -82,29 +82,56 @@ function printPDF(pdfUrl: string) {
};
}
// 打印base64 pdf
function printBase64PDF(base64: string) {
const blob = base64ToBlob(base64);
const pdfUrl = URL.createObjectURL(blob);
const iframe = document.createElement('iframe');
iframe.style.display = 'none';
iframe.src = pdfUrl;
document.body.appendChild(iframe);
iframe.onload = () => {
iframe.contentWindow?.print();
setTimeout(() => URL.revokeObjectURL(pdfUrl), 1000); // 释放内存
};
}
function base64ToBlob(base64: string) {
/**
* base64转blob
* @param base64 纯base64,不带data前缀
* @param mimeType mime类型
*/
function base64ToBlob(base64: string, mimeType: string) {
const binaryString = atob(base64.replace(/[\n\r]/g, ''));
const bytes = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return new Blob([bytes], { type: 'application/pdf' });
return new Blob([bytes], { type: mimeType });
}
/**
* @param base64 base64字符串
* @param type 可选,'pdf' | 'excel',不传默认 pdf
* @param fileName 可选,excel下载文件名
*/
function printBase64PDF(base64: string, type: 'pdf' | 'excel' = 'pdf', fileName: string = '文件') {
if (type === 'pdf') {
// PDF打印逻辑
const blob = base64ToBlob(base64, 'application/pdf');
const pdfUrl = URL.createObjectURL(blob);
const iframe = document.createElement('iframe');
iframe.style.display = 'none';
iframe.src = pdfUrl;
document.body.appendChild(iframe);
iframe.onload = () => {
iframe.contentWindow?.print();
setTimeout(() => {
URL.revokeObjectURL(pdfUrl);
iframe.remove(); // 修复原代码iframe残留dom
}, 1000);
};
} else if (type === 'excel') {
// excel导出下载逻辑
const blob = base64ToBlob(base64, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = downloadUrl;
a.download = encodeURIComponent(fileName + '.xlsx');
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(downloadUrl);
}
}
// 计算两个日期的天数差(支持带时分秒)
const getDayDiff = (start: string, end: string): number => {
const startTime = new Date(start).getTime();

View File

@ -10,7 +10,7 @@
<el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="queryParams.yq" width="200px" clearable @get-data-value="getList" />
</el-form-item>
<el-form-item label="模板名称" prop="xmdh">
<el-form-item label="模板名称" prop="mbmc">
<el-input placeholder="请输入模板名称" v-model="queryParams.mbmc" style="width: 200px;" clearable
@keyup.enter="getList" />
</el-form-item>
@ -18,12 +18,14 @@
<div class="mb5">
<el-button type="primary" icon="Search" @click="getList">查询</el-button>
<el-button type="primary" icon="Plus" plain @click="handleAdd">新增</el-button>
<el-button type="success" icon="Check" plain :loading="saveLoading" @click="handleSave">保存</el-button>
</div>
<el-row class="table-row" style="margin-top: 10px;">
<el-col :span="24" class="table-col">
<CustomTable ref="tableRef" v-model:data="tableData" :columns="columns" :config="tableConfig">
<el-row :gutter="10" class="table-row" style="margin-top: 10px;">
<el-col :span="16" class="table-col">
<CustomTable ref="tableRef" v-model:data="tableData" :columns="columns" :config="tableConfig"
@row-click="handleRowClick">
<template #yq="{ row }">
{{ formatInstr(row.yq) }}
</template>
@ -34,66 +36,60 @@
<el-checkbox :model-value="row.zdsr == 'Y'" />
</template>
<template #action="{ row }">
<el-button type="primary" icon="Edit" link @click="handleEdit(row)">编辑</el-button>
<el-button type="primary" icon="Delete" link @click="handleDel(row)">删除</el-button>
</template>
</CustomTable>
</el-col>
<el-dialog :title="title" v-model="visible" width="50vw" :close-on-click-modal="false" :draggable="true">
<el-row :gutter="15">
<el-col :span="10">
<el-form ref="formRef" :model="formData" label-width="150px">
<el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="formData.yq" :disabled="disabled" @get-data-value="getOldXminfoList()" />
</el-form-item>
<el-form-item label="模板名称" prop="mbmc">
<el-input v-model="formData.mbmc" />
</el-form-item>
<el-form-item label="输入编号" prop="srbh">
<el-input v-model="formData.srbh" />
</el-form-item>
<el-form-item label="标本类型" prop="yblx">
<SelectTable v-model:data="formData.yblx" :tableData="regdictList" />
</el-form-item>
<el-form-item label="" prop="zdsr">
<el-checkbox v-model="formData.zdsr" label="自动输入" true-value="Y" false-value="N" />
</el-form-item>
<el-form-item label="自动输入起始标本号" prop="qsybh">
<el-input v-model="formData.qsybh" />
</el-form-item>
<el-form-item label="自动输入结束标本号" prop="jsybh">
<el-input v-model="formData.jsybh" />
</el-form-item>
</el-form>
</el-col>
<el-col :span="14">
<div class="mb10">
<el-button type="success" icon="Check" plain @click="handleSave">保存</el-button>
<el-button type="primary" icon="Plus" plain @click="addItem">新增</el-button>
<el-button type="danger" icon="Delete" plain @click="delItem">删除</el-button>
</div>
<div style="height: 400px">
<CustomTable ref="tableRefRight" :data="rightTableData" :columns="rightColumns" :config="tableConfig"
@row-click="xmrowHandle">
<template #xmdh="{ row, $index }">
<SelectTable v-model:data="row.xmdh" :tableData="xmList" class="full-width-input" :keyValue="true"
@get-data-value="getXmInfo(row, $index)" />
</template>
<template #mrz="{ row }">
<el-input v-model="row.mrz" class="full-width-input" />
</template>
</CustomTable>
</div>
</el-col>
</el-row>
</el-dialog>
<el-col :span="8" class="table-col right-col">
<el-form ref="formRef" :model="formData" label-width="auto" :rules="rules" :show-message="false"
style="padding-right: 150px;">
<el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="formData.yq" :disabled="disabled" @get-data-value="getOldXminfoList()" />
</el-form-item>
<el-form-item label="模板名称" prop="mbmc">
<el-input v-model="formData.mbmc" />
</el-form-item>
<el-form-item label="输入编号" prop="srbh">
<el-input v-model="formData.srbh" />
</el-form-item>
<el-form-item label="标本类型" prop="yblx">
<SelectTable v-model:data="formData.yblx" :tableData="regdictList" />
</el-form-item>
<el-form-item label=" " prop="zdsr">
<el-checkbox v-model="formData.zdsr" label="自动输入" true-value="Y" false-value="N" />
</el-form-item>
<el-form-item label="自动输入起始标本号" prop="qsybh">
<el-input v-model="formData.qsybh" />
</el-form-item>
<el-form-item label="自动输入结束标本号" prop="jsybh">
<el-input v-model="formData.jsybh" />
</el-form-item>
</el-form>
<div class="mb10">
<el-button type="primary" icon="Plus" plain @click="addItem">新增明细</el-button>
</div>
<div class="tableRight">
<CustomTable ref="tableRefRight" :data="rightTableData" :columns="rightColumns" :config="tableConfig"
@row-click="xmrowHandle">
<template #xmdh="{ row, $index }">
<SelectTable v-model:data="row.xmdh" :tableData="xmList" class="full-width-input" :keyValue="true"
@get-data-value="getXmInfo(row, $index)" />
</template>
<template #mrz="{ row }">
<el-input v-model="row.mrz" class="full-width-input" />
</template>
<template #action="{ row, $index }">
<el-button type="primary" icon="Delete" link @click="delItem(row, $index)">删除</el-button>
</template>
</CustomTable>
</div>
</el-col>
</el-row>
</div>
</template>
<script setup lang="ts">
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
// @ts-ignore
import { listregdict } from "@/api/regional/dict/regdict.js";
import { queryMbList, queryDetail, addXmInfo, deleteDetail, updateXmInfo, deleteXmInfo } from '@/api/liswork/xmmb';
import { formatInstr, getYqData } from '@/hooks'
@ -116,12 +112,20 @@ const formData = ref({
jsybh: '',
oldMbmc: '',
})
const formRef = useTemplateRef('formRef')
const rules = {
yq: [{ required: true, message: '请选择仪器', trigger: 'change' },],
mbmc: [{ required: true, message: '请输入模板名称', trigger: 'change' },],
}
const xmList = ref([])
const title = ref('')
const visible = ref(false)
const tableRef = useTemplateRef('tableRef')
const saveLoading = ref(false)
const tableData = ref([])
const columns = ref([
{ prop: 'yq', label: '仪器', visible: true, align: 'center', slot: 'yq' },
{ prop: 'yq', label: '仪器', visible: true, align: 'center', width: 200, slot: 'yq' },
{ prop: 'mbmc', label: '输入模板', visible: true, align: 'center', },
{ prop: 'srbh', label: '输入编号', visible: true, align: 'center', },
{ prop: 'yblx', label: '样本类型', visible: true, align: 'center', slot: 'yblx' },
@ -134,7 +138,7 @@ const tableConfig = ref({
height: '100%', // 高度
border: true, // 边框
highlightCurrentRow: true, // 当前行高亮
actionWidth: 180,
actionWidth: 120,
})
const regdictList = ref<Array<{ value: string, label: string }>>([])
const rightTableData = ref<Array<{ xmdh: string, mrz: string }>>([])
@ -165,19 +169,18 @@ const handleAdd = () => {
}
disabled.value = false
rightTableData.value = []
title.value = '新增模板'
visible.value = true
}
const handleEdit = (row: any) => {
const handleRowClick = (row: any) => {
getDetailsList(row)
row.yq = row.yq.trim()
row.oldMbmc = row.mbmc
formData.value = row
const copyRow = { ...row }
copyRow.yq = copyRow.yq?.trim()
copyRow.oldMbmc = copyRow.mbmc
formData.value = copyRow
getOldXminfoList()
disabled.value = true
title.value = '编辑模板'
visible.value = true
}
const getDetailsList = (row: any) => {
@ -186,29 +189,41 @@ const getDetailsList = (row: any) => {
})
}
const handleSave = () => {
rightTableData.value = rightTableData.value.filter((item: any) => item.xmdh)
const arr = rightTableData.value.map((item: any, index: number) => {
return {
...item,
mbmc: formData.value.mbmc,
oldMbmc: formData.value.oldMbmc,
yq: formData.value.yq,
xh: item.xh ? item.xh : index + 1,
formRef.value.validate((valid: boolean) => {
if (!formData.value.mbmc || !formData.value.yq) return ElMessage.error('请填写必填项')
if (valid) {
rightTableData.value = rightTableData.value.filter((item: any) => item.xmdh)
const arr = rightTableData.value.map((item: any, index: number) => {
return {
...item,
mbmc: formData.value.mbmc,
oldMbmc: formData.value.oldMbmc,
yq: formData.value.yq,
xh: item.xh ? item.xh : index + 1,
}
})
saveLoading.value = true
if (disabled.value) {
updateXmInfo({ labInputmdl: formData.value, labInputmdlDetailList: arr }).then((res) => {
if (res.code == 0) {
ElMessage.success(res.msg)
getList()
}
}).finally(() => {
saveLoading.value = false
})
} else {
addXmInfo({ labInputmdl: formData.value, labInputmdlDetailList: arr }).then((res) => {
if (res.code == 0) {
ElMessage.success(res.msg)
getList()
}
}).finally(() => {
saveLoading.value = false
})
}
}
})
if (disabled.value) {
updateXmInfo({ labInputmdl: formData.value, labInputmdlDetailList: arr }).then(() => {
ElMessage.success('修改成功')
getList()
visible.value = false
})
} else {
addXmInfo({ labInputmdl: formData.value, labInputmdlDetailList: arr }).then(() => {
ElMessage.success('新增成功')
getList()
visible.value = false
})
}
}
const xmInfo = ref<any>(null)
const xmrowHandle = (row: any) => {
@ -231,18 +246,16 @@ const getXmInfo = (row: any, currentIndex: any) => {
const addItem = () => {
rightTableData.value.push({ xmdh: '', mrz: '', })
}
const delItem = () => {
if (!xmInfo.value) return ElMessage.warning('请选择要删除的行!')
if (xmInfo.value.yq) {
deleteDetail([xmInfo.value]).then((res: any) => {
const delItem = (row, index: number) => {
if (row.yq) {
deleteDetail([row]).then((res: any) => {
if (res.code == 0) {
getDetailsList(formData.value)
}
})
} else {
rightTableData.value = rightTableData.value.filter(item => item.xmdh != xmInfo.value.xmdh)
rightTableData.value.splice(index, 1)
}
xmInfo.value = null
}
const handleDel = (row) => {
ElMessageBox.confirm('确定要删除选中的数据吗?', '提示', {
@ -257,6 +270,26 @@ const handleDel = (row) => {
const getList = () => {
queryMbList(queryParams.value).then((res: any) => {
tableData.value = res.data
if (res.data.length) {
nextTick(() => {
tableRef.value.setCurrentRow(res.data[0])
handleRowClick(res.data[0])
})
} else {
rightTableData.value = []
formData.value = {
yq: '',
mbmc: '',
srbh: '',
yblx: '',
zdsr: '',
qsybh: '',
jsybh: '',
oldMbmc: '',
}
disabled.value = false
}
})
}
@ -288,8 +321,20 @@ const formatYblx = (v: string) => {
}
.right-col {
padding-top: 5px;
border: 1px solid #ccc;
border: 1px solid #4b8ee6;
border-radius: 5px;
padding: 10px 10px 5px;
display: flex;
flex-direction: column;
.el-form-item {
margin-bottom: 5px;
}
.tableRight {
flex: 1;
min-height: 0;
}
}
}

View File

@ -0,0 +1,313 @@
/**
* @file index.vue
* @description: 项目组合
* @author: w
* @since: 2026-08-20
*/
<template>
<div class="app-container">
<el-form ref="form" :model="queryParams" inline class="query-form">
<el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="queryParams.yq" width="200px" clearable @get-data-value="getList" />
</el-form-item>
<el-form-item label="组合名称" prop="zhmc">
<el-input placeholder="请输入组合名称" v-model="queryParams.zhmc" style="width: 200px;" clearable
@keyup.enter="getList" />
</el-form-item>
</el-form>
<div class="mb5">
<el-button type="primary" icon="Search" @click="getList">查询</el-button>
<el-button type="primary" icon="Plus" plain @click="handleAdd">新增</el-button>
<el-button type="success" icon="Check" plain :loading="saveLoading" @click="handleSave">保存</el-button>
</div>
<el-row :gutter="10" class="table-row" style="margin-top: 10px;">
<el-col :span="16" class="table-col">
<CustomTable ref="tableRef" v-model:data="tableData" :columns="columns" :config="tableConfig"
@row-click="handleRowClick">
<template #yq="{ row }">
{{ formatInstr(row.yq) }}
</template>
<template #zhlx="{ row }">
{{ formatDict(row.zhlx, 'ZHLB') }}
</template>
<template #action="{ row }">
<el-button type="primary" icon="Delete" link @click="handleDel(row)">删除</el-button>
</template>
</CustomTable>
</el-col>
<el-col :span="8" class="table-col right-col">
<el-form ref="formRef" :model="formData" label-width="auto" :rules="rules" :show-message="false"
style="padding-right: 150px;">
<el-form-item label="组合类别" prop="zhlx">
<SelectTable v-model:data="formData.zhlx" :tableData="dictData.ZHLB" />
</el-form-item>
<el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="formData.yq" @get-data-value="getOldXminfoList()" />
</el-form-item>
<el-form-item label="组合名称" prop="zhmc">
<el-input v-model="formData.zhmc" />
</el-form-item>
</el-form>
<div class="mb10">
<el-button type="primary" icon="Plus" plain @click="addItem">新增明细</el-button>
</div>
<div class="tableRight">
<CustomTable ref="tableRefRight" :data="rightTableData" :columns="rightColumns" :config="tableConfig"
@row-click="xmrowHandle">
<template #xmdh="{ row, $index }">
<SelectTable v-model:data="row.xmdh" :tableData="xmList" class="full-width-input" :keyValue="true"
@get-data-value="getXmInfo(row, $index)" />
</template>
<template #bz="{ row }">
<el-input v-model="row.bz" class="full-width-input" />
</template>
<template #seq="{ row }">
<el-input v-model="row.seq" class="full-width-input" />
</template>
<template #action="{ row, $index }">
<el-button type="primary" icon="Delete" link @click="delItem(row, $index)">删除</el-button>
</template>
</CustomTable>
</div>
</el-col>
</el-row>
</div>
</template>
<script setup lang="ts">
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
import { xmCompQuery, queryDetailComp, addxmComp, deleteDetailComp, editxmComp, delxmComp } from '@/api/liswork/xmmb';
import { formatInstr, getYqData, getDictData, formatDict, dictData } from '@/hooks'
import { queryOldxminfo } from '@/api/liswork/xtwh/xmReqItemVsApi'
import { ElMessage, ElMessageBox } from 'element-plus';
const queryParams = ref({
yq: '',
zhmc: '',
})
const disabled = ref(false)
const formData = ref({
yq: '',
zhmc: '',
zhlx: '',
zhlxold: '',
zhmcold: '',
})
const formRef = useTemplateRef('formRef')
const rules = {
yq: [{ required: true, message: '请选择仪器', trigger: 'change' },],
zhmc: [{ required: true, message: '请输入组合名称', trigger: 'change' },],
}
const xmList = ref([])
const tableRef = useTemplateRef('tableRef')
const saveLoading = ref(false)
const tableData = ref([])
const columns = ref([
{ prop: 'zhlx', label: '组合类别', visible: true, align: 'center', slot: 'zhlx' },
{ prop: 'yq', label: '仪器', visible: true, align: 'center', slot: 'yq' },
{ prop: 'zhmc', label: '组合名称', visible: true, align: 'center', },
])
const tableConfig = ref({
height: '100%', // 高度
border: true, // 边框
highlightCurrentRow: true, // 当前行高亮
actionWidth: 120,
})
const rightTableData = ref<Array<{ xmdh: string, bz: string }>>([])
const rightColumns = ref([
{ prop: 'xmdh', label: '检验项目', visible: true, align: 'center', slot: 'xmdh', showOverflowTooltip: false },
{ prop: 'bz', label: '备注', visible: true, align: 'center', slot: 'bz', showOverflowTooltip: false },
{ prop: 'seq', label: '序号', visible: true, align: 'center', slot: 'seq', showOverflowTooltip: false, width: 60 },
])
const getOldXminfoList = async () => {
const res = await queryOldxminfo({ yq: formData.value.yq })
xmList.value = res.data.map((item: any) => {
return {
label: item.xmmc,
value: item.xmdh,
}
})
}
const handleAdd = () => {
formData.value = {
yq: '',
zhmc: '',
zhlx: '',
zhlxold: '',
zhmcold: '',
}
disabled.value = false
rightTableData.value = []
}
const handleRowClick = (row: any) => {
getDetailsList(row)
const copyRow = { ...row }
copyRow.yq = copyRow.yq?.trim()
copyRow.zhlxold = copyRow.zhlx
copyRow.zhmcold = copyRow.zhmc
formData.value = copyRow
getOldXminfoList()
disabled.value = true
}
const getDetailsList = (row: any) => {
queryDetailComp({ yq: row.yq, zhmc: row.zhmc }).then((res: any) => {
rightTableData.value = res.data
})
}
const handleSave = () => {
formRef.value.validate((valid: boolean) => {
if (!formData.value.zhmc || !formData.value.yq) return ElMessage.error('请填写必填项')
if (valid) {
rightTableData.value = rightTableData.value.filter((item: any) => item.xmdh)
const arr = rightTableData.value.map((item: any, index: number) => {
return {
...item,
zhmc: formData.value.zhmc,
yq: formData.value.yq,
zhlx: formData.value.zhlx,
seq: item.seq ? item.seq : index + 1,
zhlxold: formData.value.zhlxold,
zhmcold: formData.value.zhmcold,
}
})
saveLoading.value = true
if (disabled.value) {
editxmComp({ xmComp: formData.value, xmCompList: arr }).then((res) => {
if (res.code == 0) {
ElMessage.success(res.msg)
getList()
}
}).finally(() => {
saveLoading.value = false
})
} else {
addxmComp({ xmComp: formData.value, xmCompList: arr }).then((res) => {
if (res.code == 0) {
ElMessage.success(res.msg)
getList()
}
}).finally(() => {
saveLoading.value = false
})
}
}
})
}
const xmInfo = ref<any>(null)
const xmrowHandle = (row: any) => {
xmInfo.value = row
}
const getXmInfo = (row: any, currentIndex: any) => {
const prevXmdhList = rightTableData.value
.filter((_, index) => index < currentIndex)
.map(row => row.xmdh)
.filter(xmdh => !!xmdh);
if (prevXmdhList.includes(row.xmdh)) {
ElMessage.error(`当前项目编号【${row.xmdh}】与前面行重复,请重新选择!`);
rightTableData.value[currentIndex].xmdh = '';
}
}
const addItem = () => {
rightTableData.value.push({ xmdh: '', bz: '', })
}
const delItem = (row, index: number) => {
if (row.yq) {
deleteDetailComp([row]).then((res: any) => {
if (res.code == 0) {
getDetailsList(formData.value)
}
})
} else {
rightTableData.value.splice(index, 1)
}
}
const handleDel = (row) => {
ElMessageBox.confirm('确定要删除选中的数据吗?', '提示', {
type: 'warning'
}).then(() => {
delxmComp(row).then(() => {
ElMessage.success('删除成功')
getList()
})
})
}
const getList = () => {
xmCompQuery(queryParams.value).then((res: any) => {
tableData.value = res.data
if (res.data.length) {
nextTick(() => {
tableRef.value.setCurrentRow(res.data[0])
handleRowClick(res.data[0])
})
} else {
rightTableData.value = []
formData.value = {
yq: '',
zhmc: '',
zhlx: '',
zhlxold: '',
zhmcold: '',
}
disabled.value = false
}
})
}
getList()
onMounted(() => {
getYqData()
getDictData('ZHLB')
})
</script>
<style scoped lang="scss">
.table-row {
height: calc(100% - 100px);
.table-col {
height: 100%;
}
.right-col {
border: 1px solid #4b8ee6;
border-radius: 5px;
padding: 10px 10px 5px;
display: flex;
flex-direction: column;
.el-form-item {
margin-bottom: 5px;
}
.tableRight {
flex: 1;
min-height: 0;
}
}
}
.el-form-item {
margin-bottom: 10px;
}
</style>

View File

@ -84,6 +84,12 @@
</template>
</el-table-column>
<el-table-column label="表格排序" align="center" prop="paramSequence" width="80" />
<el-table-column label="子窗体显示" align="center" prop="paramZct" width="80">
<template #default="scope">
{{ scope.row.paramZct == 1 ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column label="子窗体指向" align="center" prop="paramPoint" width="80" />
<el-table-column label="排序" align="center" prop="paramSort" width="80" />
<el-table-column label="列宽" align="center" prop="paramWidth" width="80" />
<el-table-column label="状态" align="center" prop="status" width="80">
@ -149,22 +155,46 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="表格排序" prop="paramSequence">
<el-input-number v-model="form.paramSequence" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="条件顺序" prop="paramSort">
<el-input-number v-model="form.paramSort" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="列宽" prop="paramWidth">
<el-input-number v-model="form.paramWidth" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.value">
{{ dict.label }}
</el-radio>
<el-form-item label="子窗体显示" prop="paramZct">
<el-radio-group v-model="form.paramZct">
<el-radio label="1"> 是 </el-radio>
<el-radio label="0"> 否 </el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="子窗体指向" prop="paramPoint">
<el-select v-model="form.paramPoint" placeholder="请选择子窗体指向" style="width: 100%" clearable>
<el-option v-for="item in copyTemplateOptions" :key="item.value"
:label="item.statsName + ' ' + item.statsCode" :value="item.statsCode" />
</el-select>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="表格排序" prop="paramSequence">
<el-input-number v-model="form.paramSequence" controls-position="right" :min="0" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="条件顺序" prop="paramSort">
<el-input-number v-model="form.paramSort" controls-position="right" :min="0" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="列宽" prop="paramWidth">
<el-input-number v-model="form.paramWidth" controls-position="right" :min="0" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.value">
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12"></el-col>
</el-row>
<el-form-item label="值域" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" :rows="3" />
</el-form-item>
@ -296,7 +326,7 @@ const queryParams = ref({
paramType: undefined,
status: undefined,
pageNum: 1,
pageSize: 17
pageSize: 20
});
// 表单校验规则

View File

@ -35,10 +35,11 @@
<!-- 数据表格 -->
<div class="table-container">
<el-table v-loading="loading" :data="regdictList" @selection-change="handleSelectionChange" border height="100%">
<el-table v-loading="loading" :data="regdictList" @selection-change="handleSelectionChange" border height="100%"
show-overflow-tooltip highlight-current-row>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="`${menuname}编号`" align="center" prop="statsId" v-if="false" />
<el-table-column :label="`${menuname}类别`" align="center" prop="statsType" width="100" show-overflow-tooltip>
<el-table-column :label="`${menuname}类别`" align="center" prop="statsType" width="120">
<template #default="scope">
<span class="stats-type-cell" :style="{
backgroundColor: getstatsTypeColor(scope.row.statsType),
@ -48,30 +49,30 @@
</span>
</template>
</el-table-column>
<el-table-column :label="`${menuname}编码`" align="center" prop="statsCode" show-overflow-tooltip>
<el-table-column :label="`${menuname}编码`" align="center" prop="statsCode">
<template #default="scope">
<router-link :to="`/liswork/xtwh/statstemplate/data?statsCode=${scope.row.statsCode}`" class="link-type">
<span>{{ scope.row.statsCode }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column :label="`${menuname}名称`" align="left" prop="statsName" show-overflow-tooltip />
<el-table-column label="表头" align="left" prop="statsTitle" width="150" show-overflow-tooltip />
<el-table-column label="图表类型" align="left" prop="statsGraph" width="80" show-overflow-tooltip>
<el-table-column :label="`${menuname}名称`" align="left" prop="statsName" />
<el-table-column label="表头" align="left" prop="statsTitle" />
<el-table-column label="图表类型" align="left" prop="statsGraph" width="80">
<template #default="scope">
<span>
{{statsGraphOptions.find(item => item.value === scope.row.statsGraph)?.label || scope.row.statsGraph}}
</span>
</template>
</el-table-column>
<el-table-column label="备注" align="left" prop="remark" width="100" show-overflow-tooltip />
<el-table-column label="备注" align="left" prop="remark" width="100" />
<el-table-column label="排序" align="center" prop="statsSort" width="80" />
<el-table-column label="状态" align="center" prop="status" width="80">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="150" show-overflow-tooltip>
<el-table-column label="创建时间" align="center" prop="createTime" width="150">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
@ -162,7 +163,8 @@ const statsTypeOptions = ref([
{ label: "查询表", value: "1", color: "#67C23A" },
{ label: "图表", value: "2", color: "#FF443F" },
{ label: "仪表盘", value: "3", color: "#7E84F7" },
{ label: "混合", value: "4", color: "#909399" }
{ label: "混合", value: "4", color: "#909399" },
{ label: "子窗体", value: "5", color: "#8929F8" },
]);
// 图表类型选项

View File

@ -0,0 +1,307 @@
/**
* @file index.vue
* @description: 仪器组合
* @author: w
* @since: 2026-08-20
*/
<template>
<div class="app-container">
<el-form ref="form" :model="queryParams" inline class="query-form">
<!-- <el-form-item label="仪器" prop="yq">
<YQSelectTable v-model:data="queryParams.yq" width="200px" clearable @get-data-value="getList" />
</el-form-item> -->
<el-form-item label="分组名称" prop="fzmc">
<el-input placeholder="请输入分组名称" v-model="queryParams.fzmc" style="width: 200px;" clearable
@keyup.enter="getList" />
</el-form-item>
</el-form>
<div class="mb5">
<el-button type="primary" icon="Search" @click="getList">查询</el-button>
<el-button type="primary" icon="Plus" plain @click="handleAdd">新增</el-button>
<el-button type="success" icon="Check" plain :loading="saveLoading" @click="handleSave">保存</el-button>
</div>
<el-row :gutter="10" class="table-row" style="margin-top: 10px;">
<el-col :span="16" class="table-col">
<CustomTable ref="tableRef" v-model:data="tableData" :columns="columns" :config="tableConfig"
@row-click="handleRowClick">
<template #tjFlag="{ row }">
<el-checkbox :modelValue="row.tj_flag == '1'"></el-checkbox>
</template>
<template #yljg="{ row }">
{{ formatDict(row.yljg, 'HOS') }}
</template>
<template #action="{ row }">
<el-button type="primary" icon="Delete" link @click="handleDel(row)">删除</el-button>
</template>
</CustomTable>
</el-col>
<el-col :span="8" class="table-col right-col">
<el-form ref="formRef" :model="formData" label-width="auto" :rules="rules" :show-message="false"
style="padding-right: 150px;">
<el-form-item label="分组代号" prop="fzdh">
<el-input v-model="formData.fzdh" />
</el-form-item>
<el-form-item label="医疗机构" prop="yljg">
<SelectTable v-model:data="formData.yljg" :tableData="dictData.HOS" />
</el-form-item>
<el-form-item label="分组名称" prop="fzmc">
<el-input v-model="formData.fzmc" />
</el-form-item>
<el-form-item label="备注" prop="bz">
<el-input v-model="formData.bz" type="textarea" :rows="2" />
</el-form-item>
<el-form-item label=" " prop="tjFlag">
<el-checkbox v-model="formData.tjFlag" true-value="1" false-value="0">室内质量统计</el-checkbox>
</el-form-item>
</el-form>
<div class="mb10">
<el-button type="primary" icon="Plus" plain @click="addItem">新增明细</el-button>
</div>
<div class="tableRight">
<CustomTable ref="tableRefRight" :data="rightTableData" :columns="rightColumns" :config="tableConfig"
@row-click="xmrowHandle">
<template #yq="{ row, $index }">
<SelectTable v-model:data="row.yq" :tableData="instrOptions" class="full-width-input" clearable
:fields="yqFields" label="yqmc" value="yq" objKey="yq" @get-data-value="getYqInfo(row, $index)" />
</template>
<template #seq="{ row }">
<el-input v-model="row.seq" class="full-width-input" />
</template>
<template #action="{ row, $index }">
<el-button type="primary" icon="Delete" link @click="delItem(row, $index)">删除</el-button>
</template>
</CustomTable>
</div>
</el-col>
</el-row>
</div>
</template>
<script setup lang="ts">
import { queryInstrgroupList, queryDetailInstrgroup, addInstrgroup, delDetailInstrgroup, updateInstrgroup, deleteInstrgroup } from '@/api/liswork/xmmb';
import { instrOptions, getYqData, getDictData, formatDict, dictData } from '@/hooks'
import { ElMessage, ElMessageBox } from 'element-plus';
const queryParams = ref({
// yq: '',
fzmc: '',
})
const disabled = ref(false)
const formData = ref({
fzdh: '',
fzmc: '',
tjFlag: '',
bz: '',
yljg: '',
})
const formRef = useTemplateRef('formRef')
const rules = {
fzdh: [{ required: true, message: '请输入分组代号', trigger: 'change' },],
fzmc: [{ required: true, message: '请输入分组名称', trigger: 'change' },],
}
const tableRef = useTemplateRef('tableRef')
const saveLoading = ref(false)
const tableData = ref([])
const columns = ref([
{ prop: 'yljg', label: '医疗机构', visible: true, align: 'center', slot: 'yljg' },
{ prop: 'fzdh', label: '分组代号', visible: true, align: 'center', },
{ prop: 'fzmc', label: '分组名称', visible: true, align: 'center', },
{ prop: 'bz', label: '备注', visible: true, align: 'center', },
{ prop: 'tjFlag', label: '质量统计', visible: true, align: 'center', slot: 'tjFlag' },
])
const tableConfig = ref({
height: '100%', // 高度
border: true, // 边框
highlightCurrentRow: true, // 当前行高亮
actionWidth: 120,
})
const rightTableData = ref<Array<{ yq: string, seq: string }>>([])
const rightColumns = ref([
{ prop: 'yq', label: '仪器', visible: true, align: 'center', slot: 'yq', showOverflowTooltip: false },
{ prop: 'seq', label: '序号', visible: true, align: 'center', slot: 'seq', showOverflowTooltip: false, width: 100 },
])
const handleAdd = () => {
formData.value = {
fzdh: '',
fzmc: '',
tjFlag: '',
bz: '',
yljg: '',
}
disabled.value = false
rightTableData.value = []
}
const yqFields = ref([
{ prop: 'yq', label: '代号', enablePinyinSearch: true },
{ prop: 'yqmc', label: '名称', enablePinyinSearch: true },
])
const handleRowClick = (row: any) => {
getDetailsList(row)
const copyRow = { ...row }
copyRow.yq = copyRow.yq?.trim()
// copyRow.oldMbmc = copyRow.fzmc
formData.value = copyRow
formData.value.tjFlag = copyRow.tj_flag
disabled.value = true
}
const getDetailsList = (row: any) => {
queryDetailInstrgroup({ yljg: row.yljg, fzdh: row.fzdh }).then((res: any) => {
rightTableData.value = res.data
})
}
const handleSave = () => {
formRef.value.validate((valid: boolean) => {
if (!formData.value.fzmc || !formData.value.fzdh) return ElMessage.error('请填写必填项')
if (valid) {
rightTableData.value = rightTableData.value.filter((item: any) => item.yq)
const arr = rightTableData.value.map((item: any, index: number) => {
return {
...item,
fzdh: formData.value.fzdh,
yljg: formData.value.yljg,
seq: item.seq ? item.seq : index + 1,
}
})
saveLoading.value = true
if (disabled.value) {
updateInstrgroup({ labInstrgroupmain: formData.value, labInstrgroupdetailList: arr }).then((res) => {
if (res.code == 0) {
ElMessage.success(res.msg)
getList()
}
}).finally(() => {
saveLoading.value = false
})
} else {
addInstrgroup({ labInstrgroupmain: formData.value, labInstrgroupdetailList: arr }).then((res) => {
if (res.code == 0) {
ElMessage.success(res.msg)
getList()
}
}).finally(() => {
saveLoading.value = false
})
}
}
})
}
const xmInfo = ref<any>(null)
const xmrowHandle = (row: any) => {
xmInfo.value = row
}
const getYqInfo = (row: any, currentIndex: any) => {
const prevXmdhList = rightTableData.value
.filter((_, index) => index < currentIndex)
.map(row => row.yq)
.filter(yq => !!yq);
if (prevXmdhList.includes(row.yq)) {
ElMessage.error(`当前仪器【${row.yq}】与前面行重复,请重新选择!`);
rightTableData.value[currentIndex].yq = '';
}
}
const addItem = () => {
rightTableData.value.push({ yq: '', seq: '', })
}
const delItem = (row, index: number) => {
if (row.yq) {
delDetailInstrgroup([row]).then((res: any) => {
if (res.code == 0) {
getDetailsList(formData.value)
}
})
} else {
rightTableData.value.splice(index, 1)
}
}
const handleDel = (row) => {
ElMessageBox.confirm('确定要删除选中的数据吗?', '提示', {
type: 'warning'
}).then(() => {
deleteInstrgroup(row).then(() => {
ElMessage.success('删除成功')
getList()
})
})
}
const getList = () => {
queryInstrgroupList(queryParams.value).then((res: any) => {
tableData.value = res.data
if (res.data.length) {
nextTick(() => {
tableRef.value.setCurrentRow(res.data[0])
handleRowClick(res.data[0])
})
} else {
rightTableData.value = []
formData.value = {
fzdh: '',
fzmc: '',
tjFlag: '',
bz: '',
yljg: '',
}
disabled.value = false
}
})
}
getList()
onMounted(() => {
getYqData()
getDictData('HOS')
})
</script>
<style scoped lang="scss">
.table-row {
height: calc(100% - 100px);
.table-col {
height: 100%;
}
.right-col {
border: 1px solid #4b8ee6;
border-radius: 5px;
padding: 10px 10px 5px;
display: flex;
flex-direction: column;
.el-form-item {
margin-bottom: 5px;
}
.tableRight {
flex: 1;
min-height: 0;
}
}
}
.el-form-item {
margin-bottom: 10px;
}
</style>

View File

@ -6,11 +6,12 @@
<template>
<div class="app-container">
<div class="mb8">
<el-button type="primary" icon="Search" @click="search" size="default">查询</el-button>
<el-button type="warning" icon="Printer" @click="print" size="default">打印</el-button>
<el-button type="primary" icon="Search" @click="search">查询</el-button>
<el-button type="warning" icon="Printer" plain @click="print">打印</el-button>
<el-button type="primary" icon="Download" plain @click="exportHandle">导出Excel</el-button>
</div>
<el-form ref="form" :model="queryParams" inline size="small" class="stats-form">
<el-form ref="form" :model="queryParams" inline size="small" class="stats-form" label-width="auto">
<el-row :gutter="10" class="stats-form-row">
<el-col :span="checkBoxs.length ? 16 : 24">
<div class="form-panel">
@ -18,22 +19,32 @@
<div class="panel-content panel-content-left">
<template v-for="item in Parameter">
<el-form-item :label="item.paramOptiontype == '0' ? '' : item.paramName"
:class="{ 'checkbox-form-item': item.paramOptiontype == '0' }">
:class="{ 'checkbox-form-item': item.paramOptiontype == '0' }"
:label-width="item.paramName == '-' ? '0px' : 'auto'">
<template v-if="item.paramOptiontype == '0'">
<el-checkbox v-model="item.paramDefvalue" :label="item.paramName" true-value="1" false-value="0" />
</template>
<template v-if="item.paramOptiontype == '1'">
<el-select v-model="item.paramDefvalue" style="width:120px">
<el-select v-model="item.paramDefvalue" style="width:150px">
<el-option v-for="item in item.remark" :label="item.label" :value="item.value" />
</el-select>
</template>
<template v-if="item.paramOptiontype == '2'">
<SelectTable v-model:data="item.paramDefvalue" :dictType="item.remark" :optionselect="true"
placeholder="请选择" style="width:150px" size="small" />
<template v-if="item.paramName == '检验项目'">
<SelectTable v-model:data="item.paramDefvalue" :tableData="xmList" placeholder="请选择"
style="width:150px" size="small" />
</template>
<template v-else>
<SelectTable v-model:data="item.paramDefvalue" :dictType="item.remark" :optionselect="true"
placeholder="请选择" style="width:150px" size="small"
@getDataValue="(val) => { getSelectValue(val, item.paramName) }" />
</template>
</template>
<template v-if="item.paramOptiontype == '3'">
<el-select v-model="item.paramDefvalue" multiple filterable style="width:200px">
<el-select v-model="item.paramDefvalue" multiple filterable style="width:150px" collapse-tags
collapse-tags-tooltip>
<el-option v-for="item in dictData[item.remark]" :label="item.label" :value="item.value" />
</el-select>
</template>
@ -90,7 +101,8 @@
<div class="table-container bb_table" :style="{ height: `calc(100% - ${statsTitle ? '70px' : '15px'})` }">
<vxe-table :data="tableData" border v-loading="loading" height="100%"
:tooltip-config="{ appendToBody: true, zIndex: 3000 }" show-footer :footer-method="getSummaries"
:scroll-y="{ enabled: true, rSize: 30, height: '100%', oSize: 20, gt: 30, }" show-footer-overflow>
:scroll-y="{ enabled: true, rSize: 30, height: '100%', oSize: 20, gt: 30, }" show-footer-overflow
@cell-dblclick="cellDblclickEvent">
<vxe-column v-for="col in tableColumns" :key="col.prop" :title="col.label" :field="col.prop"
:width="col.paramWidth" show-overflow align="center">
<template #default="scope">
@ -106,6 +118,11 @@
</div>
</div>
</div>
<el-dialog v-model="openDetail" title="明细" width="1200px" @close="openDetail = false">
<el-table :data="mxtableData" border height="500">
</el-table>
</el-dialog>
</div>
</template>
@ -113,8 +130,8 @@
import { getComDicts, } from "@/api/liswork/dict/ComDict";
import { useCommonStore } from '@/store/modules/commonStore';
import { classCom } from '@/utils/classCom';
import { getstatsTemplate, getstatsQuery } from "@/api/liswork/xtwh/StatsparameterApi";
import { listUser } from '@/api/system/user.js'
import { getstatsTemplate, getstatsQuery, printTemplate, exportTemplate } from "@/api/liswork/xtwh/StatsparameterApi";
import { queryXmInfo } from '@/api/liswork/work/LisWork'
import useUserStore from '@/store/modules/user'
import { getDictData, formatDict, dictData } from '@/hooks'
import { ElMessage } from "element-plus";
@ -122,6 +139,9 @@ const userStore = useUserStore()
const mbStore = useCommonStore();
const route = useRoute();
const openDetail = ref(false)
const mxtableData = ref([])
const queryParams = ref({
// 'cp_samplecnt', 'cp_cnt', 'cp_amt', 'cp_rs',
statItems: []
@ -235,6 +255,12 @@ const handleCheckBoxChange = (val) => {
}
})
};
// 列双击
const cellDblclickEvent = ({ row }) => {
console.log("🚀 ~ cellDblclickEvent ~ row:", row)
openDetail.value = true
mxtableData.value = []
}
// 查询
const search = () => {
originalColumn.value.forEach(item => {
@ -271,9 +297,57 @@ const getPrintFooterText = (col, idx) => {
return sum
}
// iframe打印核心方法
// 打印
const print = () => {
// classCom.printBase64PDF()
originalColumn.value.forEach(item => {
const matchTabCol = tableColumns.value.find(col => col.prop == item.paramCode)
if (matchTabCol) {
item.paramSequence = matchTabCol.paramSequence
} else {
item.paramSequence = 0
}
})
const data = {
Parameter: Parameter.value,
Column: originalColumn.value,
Template: Template.value
};
printTemplate(data).then(res => {
classCom.printBase64PDF(res.data)
})
}
const exportHandle = () => {
originalColumn.value.forEach(item => {
const matchTabCol = tableColumns.value.find(col => col.prop == item.paramCode)
if (matchTabCol) {
item.paramSequence = matchTabCol.paramSequence
} else {
item.paramSequence = 0
}
})
const data = {
Parameter: Parameter.value,
Column: originalColumn.value,
Template: Template.value
};
exportTemplate(data).then(res => {
classCom.printBase64PDF(res.data, 'excel', '统计报表')
})
}
const xmList = ref([])
//根据仪器选择获取检验项目
const getSelectValue = (val, selectName) => {
if (!val.value) return;
queryXmInfo({ yq: val.value }).then(res => {
xmList.value = res.data.map(item => {
return {
label: item.xmmc,
value: item.xmdh
}
})
})
}