质控批号、样本号

This commit is contained in:
wyuu 2025-12-31 17:28:54 +08:00
parent 92b55c83dc
commit e6c48e426a
9 changed files with 672 additions and 309 deletions

View File

@ -41,3 +41,19 @@ export function queryQcSample(data?: Object) {
params: data
})
}
// 查询质控品数据
export function saveQcSample(data?: Object) {
return request({
url: '/qc/saveQcSample',
method: 'post',
data
})
}
// -删除普通标本和质控标本对应关系
export function deleteQcSample(data?: Object) {
return request({
url: '/qc/deleteQcSample',
method: 'get',
params: data
})
}

View File

@ -147,7 +147,7 @@
</div>
</template>
<script setup lang="ts">
<script setup lang="ts" name="Micro">
import { ref, nextTick, onMounted, toRaw } from 'vue';
import LabPat from './labpat.vue';
import SelectTable from '@/components/SelectTable/index.vue';

View File

@ -0,0 +1,206 @@
/**
* @file index.vue 批号管理
* @author: w
* @since: 2025-12-31
*/
<template>
<div class="app-container">
<div class="table-toolbar mb5">
<el-row>
<el-col :span="8">
<el-button type="primary" plain icon="Check" @click="handleSave">保存</el-button>
<el-button type="primary" @click="addHandle">新增</el-button>
<el-button type="danger">删除</el-button>
</el-col>
<el-col :span="16">
<span class="tips">靶值列表</span> &nbsp;
<el-button type="primary" plain>复制第一个开始日期到每日项目</el-button>
</el-col>
</el-row>
</div>
<el-row :gutter="10" class="table-row">
<el-col :span="8" class="table-col left-table">
<CustomTable ref="leftTableRef" :data="tableData" :columns="columns"
:config="{ border: true, highlightCurrentRow: true, height: '100%' }"></CustomTable>
</el-col>
<el-col :span="16" class="table-col">
<div style="height:59%" class="mb8">
<CustomTable ref="leftTableRef" :data="topTableData" :columns="topColumns" @row-click="rowClick"
:config="{ border: true, highlightCurrentRow: true, height: '100%' }">
<template #xmdh="{ row }">
{{ row.xmdh }} {{ row.xmmc }}
</template>
<template #qcuselog="{ row }">
<el-checkbox :model-value="row.qcuselog == 1" readonly></el-checkbox>
</template>
<template #qcusepos="{ row }">
<el-checkbox :model-value="row.qcusepos == 1" readonly></el-checkbox>
</template>
</CustomTable>
</div>
<div style="height:40%">
<CustomTable ref="rightTableRef" :data="bottomTableData" :columns="bottomColumns" :enableColumnDrag="true"
@column-drag-end="columnDragEnd" :config="{ border: true, highlightCurrentRow: true, height: '100%' }">
</CustomTable>
</div>
</el-col>
</el-row>
<el-dialog title="批号" v-model="visible" width="30vw" :close-on-click-modal="false" :draggable="true">
<el-form :model="formData" ref="queryRef" :rules="rules" label-position="right" label-width="auto">
<el-form-item label="质控批号" prop="zkph">
<el-input v-model="formData.zkph" />
</el-form-item>
<el-form-item label="水平" prop="xmdh">
<el-select v-model="formData.ff" placeholder="请选择">
<el-option />
</el-select>
</el-form-item>
<el-form-item label="浓度" prop="ff">
<el-select v-model="formData.ff" placeholder="请选择">
<el-option />
</el-select>
</el-form-item>
<el-form-item label="批号(瓶子上的)" prop="ff">
<el-input v-model="formData.zkph" />
</el-form-item>
<el-form-item label="有效期" prop="ff">
<el-date-picker v-model="formData.jyrq" type="date" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="启用日期" prop="ff">
<el-date-picker v-model="formData.jyrq" type="date" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="结束日期" prop="ff">
<el-date-picker v-model="formData.jyrq" type="date" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="质控厂商" prop="ff">
<el-select v-model="formData.ff" placeholder="请选择">
<el-option />
</el-select>
</el-form-item>
<el-form-item label="校准品厂商" prop="ff">
<el-select v-model="formData.ff" placeholder="请选择">
<el-option />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="bz">
<el-input v-model="formData.bz" type="textarea" :row="5" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">取消</el-button>
<el-button type="primary">确定</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { queryOldxminfo } from '@/api/liswork/xtwh/xmReqItemVsApi'
import { queryDataFromSample, queryQcSample, } from '@/api/liswork/qualityControl'
const yq = defineModel<string>()
const visible = ref(false)
const selectedRow = ref()
const formData = ref({})
const rules = ref([])
const tableData = ref([])
const columns = ref([
{ label: '质控批号', prop: 'zkpph', visible: true, align: 'center' },
{ label: '水平', prop: 'zkpph', visible: true, align: 'center' },
{ label: '浓度', prop: 'ld', visible: true, align: 'center' },
{ label: '在用', prop: 'zkbz', visible: true, align: 'center' },
{ label: '启用日期', prop: 'ksrq', visible: true, align: 'center' },
{ label: '停用日期', prop: 'endrq', visible: true, align: 'center' },
{ label: '批号(瓶子上的)', prop: 'zkph', visible: true, align: 'center', width: 100 },
{ label: '有效期', prop: 'endrq', visible: true, align: 'center' },
{ label: '质控来源', prop: 'cv', visible: true, align: 'center' },
{ label: '校准品厂商', prop: 'standsrc', visible: true, align: 'center' },
{ label: '备注', prop: 'qccv', visible: true, align: 'center' },
])
const topTableData = ref([])
const topColumns = [
{ label: '项目代号', prop: 'xmdh', visible: true, slot: 'xmdh', width: 150 },
{ label: '靶值', prop: 'zkbz', visible: true, align: 'center', },
{ label: 'Sd', prop: 'qcusepos', visible: true, align: 'center', },
{ label: 'Cv', prop: 'cv', visible: true, align: 'center', },
{ label: '开始日期', prop: 'ksrq', visible: true, align: 'center', },
{ label: '结束日期', prop: 'endrq', visible: true, align: 'center', },
{ label: '波长', prop: 'bc', visible: true, align: 'center', },
{ label: '方法', prop: 'ff', visible: true, align: 'center', },
{ label: '试剂', prop: 'sjph', visible: true, align: 'center', },
{ label: '目标CV(%)', prop: 'qccv', visible: true, align: 'center', },
]
const bottomTableData = ref([])
const bottomColumns = ref([
{ label: '项目代号', prop: 'xmdh', visible: true, slot: 'xmdh', width: 150 },
{ label: '靶值', prop: 'zkbz', visible: true, align: 'center', },
{ label: 'Sd', prop: 'qcusepos', visible: true, align: 'center', },
{ label: 'Cv', prop: 'cv', visible: true, align: 'center', },
{ label: '开始日期', prop: 'ksrq', visible: true, align: 'center', },
{ label: '结束日期', prop: 'endrq', visible: true, align: 'center', },
{ label: '波长', prop: 'bc', visible: true, align: 'center', },
{ label: '方法', prop: 'ff', visible: true, align: 'center', },
{ label: '试剂', prop: 'sjph', visible: true, align: 'center', },
{ label: '目标CV(%)', prop: 'qccv', visible: true, align: 'center', },
])
const columnDragEnd = (data: any) => {
bottomColumns.value = data.columns
}
const rowClick = (row: any) => {
selectedRow.value = row
const data = {
xmdh: row.xmdh,
yq: yq.value,
}
queryQcSample(data).then((res: any) => {
bottomTableData.value = res.data
})
}
const addHandle = () => {
visible.value = true
}
const getXmList = () => {
queryOldxminfo({ yq: yq.value, }).then((res: any) => {
topTableData.value = res.data
rowClick(topTableData.value[0])
})
}
const handleSave = () => { }
watch(yq, (val) => {
if (val) {
getXmList()
}
}, { immediate: true })
</script>
<style scoped lang="scss">
.tips {
font-family: SourceHanSansCN, SourceHanSansCN;
font-size: 16px;
color: #409eff;
font-weight: 600;
height: 32px;
}
.table-row {
height: calc(100% - 105px);
.table-col {
height: 100%;
}
.left-table {
height: 100%;
}
}
</style>

View File

@ -1,288 +1,254 @@
/**
* @file index.vue 参数配置
* @file index.vue 参数设置
* @author: w
* @since: 2025-12-29
* @since: 2025-12-31
*/
<template>
<div class="app-container">
<div class="table-toolbar">
<div class="sys_box">
<el-row :gutter="10" class="table-toolbar">
<el-col :span="1.5">
<el-button type="primary" plain icon="Check" @click="handleSave">保存</el-button>
</div>
<div class="tips">说明: 本软件支持每天最多做6个质控品,质控品号固定为1-6,如果仪器上的质控标本号不是1-6,请在下面设定它们的对应关系,这样系统在采集仪器数据时,质控标本号据时能够自动转换!</div>
<div class="bb_box">
<el-row>
<el-col :span="14">
<div>
<span class="text"> 每日质控标本个数: </span>
<el-radio-group v-model="zkphValue" @change="zkphChange">
<el-radio value="1">1</el-radio>
<el-radio value="2">2</el-radio>
<el-radio value="3">3</el-radio>
<el-radio value="4">4</el-radio>
<el-radio value="5">5</el-radio>
<el-radio value="6">6</el-radio>
</el-radio-group>
</div>
<div>
<span class="text"> 模式: </span>
<el-radio-group v-model="radio2" @change="radioChange">
<el-radio value="1">SD模式(WestGuard)</el-radio>
<el-radio value="2">CV模式(WestGuard)</el-radio>
<el-radio value="3">Gurbbs+Tn界值法</el-radio>
</el-radio-group>
</div>
<div class="check-box">
<el-checkbox v-model="check1" label="质控图显示其他非画点图" value="1" />
<el-checkbox v-model="check2" label="质控图是否画虚线" value="1" />
<el-checkbox v-model="check3" label="质控图累计SD/CV值通过批号计算" value="1" />
</div>
<div class="bbh-box">
<span class="text">每日参考对照标本号: </span>
<el-input v-model="input" style="width:200px" />
</div>
</el-col>
<el-col :span="2" class="text_btn">
<el-button type="primary" @click="addItem">新增</el-button>
<el-button type="danger" @click="delItem">删除</el-button>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" @click="handleCancelEdit">取消修改</el-button>
</el-col>
<el-col :span="8">
<CustomTable ref="tableRef" :data="tableData" :columns="columns" :config="tableConfig"
@row-click="rowYbhClick">
<template #ybh="{ row }">
<el-input v-model="row.ybh" class="full-width-input" />
</template>
<template #zkph="{ row }">
<el-input v-model="row.zkph" class="full-width-input" />
</template>
<template #cs="{ row }">
<el-input v-model="row.cs" class="full-width-input" />
</template>
</CustomTable>
<el-col :span="1.5">
<el-button type="danger" plain icon="RefreshRight" @click="handleRestoreDefault">还原默认</el-button>
</el-col>
</el-row>
<!-- 三列表格容器 -->
<div class="triple-table-wrapper">
<!-- 第一列表格 -->
<div class="table-panel table-1">
<el-table v-loading="loading" :data="tableData1" @selection-change="handleSelectionChange" class="config-table"
border height="100%">
<el-table-column label="序号" align="center" prop="configSort" width="50" />
<el-table-column :label="`${menuname}名称`" align="left" prop="configName" show-overflow-tooltip width="250" />
<el-table-column label="参数值" align="center" prop="configDefvalue" show-overflow-tooltip>
<template #default="scope">
<DynamicInput :type="scope.row.configOptiontype" v-model="scope.row.configDefvalue"
:dict-data="scope.row.remark" :placeholder="`请输入${scope.row.configName}值`" class="edit-input" />
</template>
</el-table-column>
<el-table-column label="值码" align="center" prop="configDefvalue" v-if="false" show-overflow-tooltip />
</el-table>
</div>
<el-row :gutter="10" class="table-row">
<el-col :span="5" class="table-col">
<div class="tips">指标设定</div>
<CustomTable ref="leftTableRef" :data="leftTableData" :columns="leftColumns" @row-click="rowClick"
:config="{ border: true, highlightCurrentRow: true, height: '100%' }">
<template #xmdh="{ row }">
{{ row.xmdh }} {{ row.xmmc }}
<!-- 第二列表格 -->
<div class="table-panel table-2">
<el-table v-loading="loading" :data="tableData2" @selection-change="handleSelectionChange" class="config-table"
border height="100%">
<el-table-column label="序号" align="center" prop="configSort" width="50" />
<el-table-column :label="`${menuname}名称`" align="left" prop="configName" show-overflow-tooltip width="250" />
<el-table-column label="参数值" align="center" prop="configDefvalue" show-overflow-tooltip>
<template #default="scope">
<DynamicInput :type="scope.row.configOptiontype" v-model="scope.row.configDefvalue"
:dict-data="scope.row.remark" :placeholder="`请输入${scope.row.configName}值`" class="edit-input" />
</template>
<template #qcuselog="{ row }">
<el-checkbox :model-value="row.qcuselog == 1" readonly></el-checkbox>
</template>
<template #qcusepos="{ row }">
<el-checkbox :model-value="row.qcusepos == 1" readonly></el-checkbox>
</template>
</CustomTable>
</el-col>
<el-col :span="19" class="table-col">
<el-button type="primary">新增</el-button>
<el-button type="danger">删除</el-button>
<el-button>取消改动</el-button>
<CustomTable ref="rightTableRef" :data="rightTableData" :columns="rightTolumns" :enableColumnDrag="true"
@column-drag-end="columnDragEnd" :config="{ border: true, highlightCurrentRow: true, height: '100%' }">
</CustomTable>
</el-col>
</el-row>
</el-table-column>
<el-table-column label="值码" align="center" prop="configDefvalue" v-if="false" show-overflow-tooltip />
</el-table>
</div>
<!-- 第三列表格 -->
<div class="table-panel table-3">
<el-table v-loading="loading" :data="tableData3" @selection-change="handleSelectionChange" class="config-table"
style="width: 100%" border height="100%">
<el-table-column label="序号" align="center" prop="configSort" width="50" />
<el-table-column :label="`${menuname}名称`" align="left" prop="configName" show-overflow-tooltip width="250" />
<el-table-column label="参数值" align="center" prop="configDefvalue" show-overflow-tooltip>
<template #default="scope">
<DynamicInput :type="scope.row.configOptiontype" v-model="scope.row.configDefvalue"
:dict-data="scope.row.remark" :placeholder="`请输入${scope.row.configName}值`" class="edit-input" />
</template>
</el-table-column>
<el-table-column label="值码" align="center" prop="configDefvalue" v-if="false" show-overflow-tooltip />
</el-table>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { queryOldxminfo } from '@/api/liswork/xtwh/xmReqItemVsApi'
import { queryDataFromSample, queryQcSample, } from '@/api/liswork/qualityControl'
import { ElMessage } from 'element-plus'
import { ElMessage, ElTree, TreeNode, ElMessageBox, ElBadge } from 'element-plus'
import { paramList, paramTree, getdef, updateParam } from '@/api/liswork/xtwh/ComOpt'
import { getFirstLetter } from '@/utils/pinyin'
// @ts-ignore
import DynamicInput from "@/views/liswork/xtwh/localconfig/components/DynamicInput.vue"
const emits = defineEmits(['updateTree'])
const yq = defineModel<string>()
const zkphValue = ref('1')
const radio2 = ref('1')
const check1 = ref(false)
const check2 = ref(false)
const check3 = ref(false)
const input = ref('')
const selectedRow = ref()
interface ybhItem {
ybh: string
zkph: string
cs: string
}
const tableData = ref<ybhItem[]>([])
const columns = [
{ label: '普通标准号', prop: 'ybh', visible: true, align: 'center', slot: 'ybh' },
{ label: '对应质控品号', prop: 'zkph', visible: true, align: 'center', slot: 'zkph' },
{ label: '次数', prop: 'cs', visible: true, align: 'center', slot: 'cs' },
]
const tableConfig = {
border: true,
highlightCurrentRow: true,
height: '200px'
interface RegDictItem {
configId: string | number
configSort: number
configCode: string
configName: string
configDefvalue: string | number
configOptiontype: string
remark: string
}
const tableRef = ref()
const ybhInfo = ref()
const rowYbhClick = (row: ybhItem) => {
ybhInfo.value = row
// 列表相关
const optiontype = ref<string>("QC")
const menuname = ref<string>("质控参数")
const regdictList = ref<RegDictItem[]>([])
const originRegdictList = ref<RegDictItem[]>([])
const loading = ref<boolean>(false)
const total = ref<number>(0)
// 选择相关
const ids = ref<(string | number)[]>([])
const single = ref<boolean>(true)
const multiple = ref<boolean>(true)
// ========== 核心:拆分三列表格数据 ==========
const tableData1 = computed<RegDictItem[]>(() => {
const splitSize = Math.ceil(total.value / 3) // 每列基础行数
return regdictList.value.slice(0, splitSize)
})
const tableData2 = computed<RegDictItem[]>(() => {
const splitSize = Math.ceil(total.value / 3)
return regdictList.value.slice(splitSize, splitSize * 2)
})
const tableData3 = computed<RegDictItem[]>(() => {
const splitSize = Math.ceil(total.value / 3)
return regdictList.value.slice(splitSize * 2)
})
const getList = async (): Promise<void> => {
loading.value = true
try {
const response = await paramList({ yq: yq.value, optiontype: optiontype.value })
regdictList.value = JSON.parse(JSON.stringify(response.data))
originRegdictList.value = JSON.parse(JSON.stringify(response.data))
total.value = response.data.length
} catch (error) {
ElMessage.error(`获取列表异常:${(error as Error).message}`)
} finally {
loading.value = false
}
}
const addItem = () => {
tableData.value.push({
ybh: '',
zkph: '',
cs: ''
})
nextTick(() => {
tableRef.value.setScrollTop(tableData.value.length)
const handleSelectionChange = (val: RegDictItem[]): void => {
ids.value = val.map(item => item.configId)
single.value = val.length === 1
multiple.value = val.length > 1
}
const handleSave = async (): Promise<void> => {
try {
loading.value = true
// 合并三列表格数据提交
const allData = [...tableData1.value, ...tableData2.value, ...tableData3.value]
const res = await updateParam(allData)
if (res.code == 0) {
ElMessage.success(res.msg || "保存成功")
originRegdictList.value = JSON.parse(JSON.stringify(allData))
// 更新树结构状态
emits('updateTree')
}
} catch (error) {
ElMessage.error(`保存失败:${(error as Error).message}`)
} finally {
loading.value = false
}
}
const handleCancelEdit = (): void => {
ElMessageBox.confirm(
"是否确认取消所有修改,恢复原始数据?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
regdictList.value = JSON.parse(JSON.stringify(originRegdictList.value))
ElMessage.success("已恢复原始数据!")
})
}
const delItem = () => {
const index = tableData.value.indexOf(ybhInfo.value)
tableData.value.splice(index, 1)
}
const leftTableData = ref([])
const leftColumns = [
{ label: '项目代号', prop: 'xmdh', visible: true, slot: 'xmdh', },
{ label: '值取对数', prop: 'qcuselog', visible: true, align: 'center', slot: 'qcuselog', width: 60 },
{ label: '半定量值', prop: 'qcusepos', visible: true, align: 'center', slot: 'qcusepos', width: 60 },
]
const rightTableData = ref([])
const rightTolumns = ref([
{ label: '启用日期', prop: 'ksrq', visible: true, align: 'center' },
{ label: '质控品', prop: 'zkph', visible: true, align: 'center' },
{ label: '批号', prop: 'zkpph', visible: true, align: 'center' },
{ label: '浓度', prop: 'ld', visible: true, align: 'center' },
{ label: '靶值', prop: 'zkbz', visible: true, align: 'center' },
{ label: '有效期至', prop: 'endrq', visible: true, align: 'center' },
{ label: 'CV(%)', prop: 'cv', visible: true, align: 'center' },
{ label: '目标CV(%)', prop: 'qccv', visible: true, align: 'center' },
{ label: '试剂', prop: 'sjph', visible: true, align: 'center' },
{ label: '质控品厂商', prop: 'qcsrc', visible: true, align: 'center' },
{ label: '波长', prop: 'bc', visible: true, align: 'center' },
{ label: '方法', prop: 'ff', visible: true, align: 'center' },
{ label: '校准品厂商', prop: 'standsrc', visible: true, align: 'center' },
])
const columnDragEnd = (data: any) => {
rightTolumns.value = data.columns
}
const zkphChange = (val: string) => {
rowClick(selectedRow.value)
}
const radioChange = (val: string) => {
if (val == "1") {
rightTolumns.value[6].label = 'Sd'
rightTolumns.value[6].visible = true
const handleRestoreDefault = async (): Promise<void> => {
ElMessageBox.confirm(
"是否确认还原所有默认值?此操作会覆盖当前修改!",
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "error"
}
if (val == "2") {
rightTolumns.value[6].label = 'CV(%)'
rightTolumns.value[6].visible = true
).then(async () => {
loading.value = true
try {
const res = await getdef({ optiontype: optiontype.value })
regdictList.value = JSON.parse(JSON.stringify(res.data))
originRegdictList.value = JSON.parse(JSON.stringify(res.data))
total.value = res.data.length
ElMessage.success("还原默认值成功!")
} catch (error) {
ElMessage.error(`还原失败:${(error as Error).message}`)
} finally {
loading.value = false
}
if (val == "3") {
rightTolumns.value[6].visible = false
}
}
watch(zkphValue, (val) => {
if (val) {
radioChange(zkphValue.value)
}
}, { immediate: true })
const rowClick = (row: any) => {
selectedRow.value = row
const data = {
xmdh: row.xmdh,
yq: yq.value,
zkph: zkphValue.value,
}
queryQcSample(data).then((res: any) => {
rightTableData.value = res.data
})
}
const handleSave = () => {
}
const getParamsInfo = () => {
queryDataFromSample({ yq: yq.value }).then((res: any) => {
tableData.value = res.data
})
}
const getXmList = () => {
queryOldxminfo({ yq: yq.value, }).then((res: any) => {
leftTableData.value = res.data
rowClick(leftTableData.value[0])
})
}
watch(yq, (val) => {
if (val) {
getParamsInfo()
getXmList()
watch(yq, (newVal) => {
if (newVal !== undefined) {
getList()
}
}, { immediate: true })
}, {
immediate: true,
deep: true
})
</script>
<style scoped lang="scss">
.tips {
font-family: SourceHanSansCN, SourceHanSansCN;
font-size: 16px;
color: #409eff;
font-weight: 600;
height: 32px;
.sys_box {
height: calc(100% - 58px);
}
.bb_box {
border-bottom: 1px solid #ccc;
padding-bottom: 10px;
margin-bottom: 10px;
.table-toolbar {
margin-bottom: 8px;
height: 36px;
line-height: 36px;
}
.text {
font-family: SourceHanSansCN, SourceHanSansCN;
font-size: 14px;
color: #409eff;
display: inline-block;
width: 140px;
text-align: right;
margin-right: 10px;
}
.text_btn {
// 三列表格容器
.triple-table-wrapper {
flex: 1;
height: calc(100% - 45px); // 减去标题行+工具栏高度
display: flex;
flex-direction: column;
align-items: center;
gap: 0px; // 表格间间距
overflow: hidden;
.el-button {
margin-left: 0;
margin-bottom: 10px;
}
}
}
.check-box {
display: flex;
align-items: center;
margin-bottom: 5px;
}
.bbh-box {
padding-top: 10px;
}
.table-row {
height: calc(100% - 385px);
.table-col {
// 单个表格面板
.table-panel {
flex: 1; // 三列均等分
height: 100%;
overflow: hidden;
background: #fff;
border: 1px solid #e6e6e6;
border-radius: 4px;
// 细微间距优化
&.table-1 {
margin-right: 0px;
}
&.table-2 {
margin: 0 0px;
}
&.table-3 {
margin-left: 0px;
}
}
}
</style>

View File

@ -0,0 +1,159 @@
/**
* @file index.vue 样本号对应
* @author: w
* @since: 2025-12-29
*/
<template>
<div class="app-container">
<div class="table-toolbar mb5">
<el-button type="primary" plain icon="Check" @click="handleSave">保存</el-button>
<el-button type="primary" @click="addItem">新增</el-button>
<el-button type="danger" @click="delItem">删除</el-button>
</div>
<div class="table-row">
<CustomTable ref="tableRef" :data="tableData" :columns="columns" :config="tableConfig" @row-click="rowYbhClick">
<template #ybh="{ row }">
<el-input v-model="row.ybh" class="full-width-input" />
</template>
<template #zkph="{ row }">
<el-input v-model="row.zkph" class="full-width-input" />
</template>
<template #cs="{ row }">
<el-input v-model="row.cs" class="full-width-input" />
</template>
</CustomTable>
</div>
</div>
</template>
<script setup lang="ts">
import { deleteQcSample, queryDataFromSample, saveQcSample, } from '@/api/liswork/qualityControl'
import { ElMessage } from 'element-plus'
const yq = defineModel<string>()
interface ybhItem {
ybh: string
zkph: string
cs: string,
yq?: string
}
const tableData = ref<ybhItem[]>([])
const columns = [
{ label: '普通标准号', prop: 'ybh', visible: true, align: 'center', slot: 'ybh' },
{ label: '对应质控品号', prop: 'zkph', visible: true, align: 'center', slot: 'zkph' },
{ label: '次数', prop: 'cs', visible: true, align: 'center', slot: 'cs' },
]
const tableConfig = {
border: true,
highlightCurrentRow: true,
height: '100%'
}
const tableRef = ref()
const ybhInfo: any = ref(null)
const rowYbhClick = (row: ybhItem) => {
ybhInfo.value = row
}
const addItem = () => {
tableData.value.push({
ybh: '',
zkph: '',
cs: '',
yq: yq.value,
})
nextTick(() => {
tableRef.value.setScrollTop(tableData.value.length)
})
}
const delItem = () => {
if (!ybhInfo.value) return ElMessage.warning('请选择要删除的行')
deleteQcSample(ybhInfo.value).then((res: any) => {
if (res.code == 0) {
ElMessage.success('删除成功')
ybhInfo.value = null
const index = tableData.value.findIndex(item => item == ybhInfo.value)
tableData.value.splice(index, 1)
}
})
}
const handleSave = () => {
saveQcSample({ qcFrmsmplList: tableData.value }).then((res: any) => {
if (res.code == 0) {
ElMessage.success('保存成功')
getSampleList()
}
})
}
const getSampleList = () => {
queryDataFromSample({ yq: yq.value }).then((res: any) => {
tableData.value = res.data
})
}
watch(yq, (val) => {
if (val) {
getSampleList()
}
}, { immediate: true })
</script>
<style scoped lang="scss">
.tips {
font-family: SourceHanSansCN, SourceHanSansCN;
font-size: 16px;
color: #409eff;
font-weight: 600;
height: 32px;
}
.bb_box {
border-bottom: 1px solid #ccc;
padding-bottom: 10px;
margin-bottom: 10px;
.text {
font-family: SourceHanSansCN, SourceHanSansCN;
font-size: 14px;
color: #409eff;
display: inline-block;
width: 140px;
text-align: right;
margin-right: 10px;
}
.text_btn {
display: flex;
flex-direction: column;
align-items: center;
.el-button {
margin-left: 0;
margin-bottom: 10px;
}
}
}
.check-box {
display: flex;
align-items: center;
margin-bottom: 5px;
}
.bbh-box {
padding-top: 10px;
}
.table-row {
height: calc(100% - 105px);
.table-col {
height: 100%;
}
}
</style>

View File

@ -45,15 +45,20 @@
</div>
</template>
<script setup name="ComOpt" lang="ts">
<script setup lang="ts">
import { ref, watch, nextTick, computed } from 'vue'
import { ElMessage, ElTree, TreeNode, ElMessageBox, ElBadge } from 'element-plus'
import { paramList, paramTree, getdef, updateParam } from '@/api/liswork/xtwh/ComOpt'
import { getFirstLetter } from '@/utils/pinyin'
import { formatDict, getDictData, dictData } from '@/hooks';
import { useCommonStore } from '@/store/modules/commonStore';
import SetRule from './components/setRule/index.vue';
import SetProject from './components/setProject/index.vue';
import SetParams from './components/setParams/index.vue';
import SetBatch from './components/setBatch/index.vue';
import SetSample from './components/setSample/index.vue';
const mbStore = useCommonStore();
// ========== TypeScript 类型定义 ==========
interface InstrTreeNode {
id: string
@ -107,32 +112,25 @@ const queryParams = ref<QueryParams>({
const tabList = [
{ key: 'SetRule', label: '质控规则设定', component: SetRule },
{ key: 'SetProject', label: '质控项目设定', component: SetProject },
{ key: 'SetParams', label: '质控品参数设定', component: SetParams }
{ key: 'SetParams', label: '质控品参数设置', component: SetParams },
{ key: 'SetSample', label: '质控品样本号对应', component: SetSample },
{ key: 'SetBatch', label: '质控品批号管理', component: SetBatch },
]
const activeName = ref('SetParams')
const activeName = ref('SetBatch')
// 计算当前要渲染的组件
const currentComponent = computed(() => {
return tabList.find(tab => tab.key === activeName.value)?.component || 'SetRule'
})
const result: any = ref([])
const treeData = ref<InstrTreeNode[]>([])
const radioChange = (val: string) => {
if (val == "1") {
deptOptions.value = treeData.value
} else {
const result = [];
// 遍历外层数组的每个分组
for (let i = 0; i < treeData.value.length; i++) {
const group = treeData.value[i];
if (group.children && Array.isArray(group.children)) {
for (let j = 0; j < group.children.length; j++) {
result.push(group.children[j]);
}
}
}
deptOptions.value = result
deptOptions.value = result.value
}
}
@ -206,12 +204,26 @@ watch(deptName, debounceFilter, { immediate: false })
const getDeptTree = async (): Promise<void> => {
try {
const response = await paramTree() as ParamTreeResponse
result.value = []
if (response.code === "0" && response.data) {
for (let i = 0; i < response.data.length; i++) {
const group = response.data[i];
if (group.children && Array.isArray(group.children)) {
for (let j = 0; j < group.children.length; j++) {
result.value.push(group.children[j]);
}
}
}
treeData.value = response.data
radioChange('1')
if (!expandedKeys.value.length) {
// 默认展开第一个一级节点的子级
nextTick(() => {
if (mbStore.defaultConfig.defaultinstr) {
queryParams.value.yq = mbStore.defaultConfig.defaultinstr
yqmc.value = result.value.find((item: any) => item.id === queryParams.value.yq)?.label
deptTreeRef.value?.setCurrentKey(queryParams.value.yq)
} else {
if (deptOptions.value.length > 0) {
const firstLevelNode = deptOptions.value[0]
if (firstLevelNode && firstLevelNode.children && firstLevelNode.children.length > 0) {
@ -219,10 +231,11 @@ const getDeptTree = async (): Promise<void> => {
const firstChildNode = firstLevelNode.children[0]
queryParams.value.yq = firstChildNode.id
yqmc.value = firstChildNode.label
deptTreeRef.value?.setCurrentKey(queryParams.value.yq)
}
}
}
deptTreeRef.value?.setCurrentKey(firstChildNode.id)
}
}
})
}
} else {

View File

@ -116,7 +116,7 @@
</div>
</template>
<script setup lang="ts">
<script setup lang="ts" name="Work">
import { ref, nextTick, onMounted, toRaw } from 'vue';
import LabPat from './labpat.vue';
import SelectTable from '@/components/SelectTable/index.vue';

View File

@ -45,13 +45,14 @@ import { ElMessage, ElTree, TreeNode, ElMessageBox, ElBadge } from 'element-plus
import { paramList, paramTree, getdef, updateParam } from '@/api/liswork/xtwh/ComOpt'
import { getFirstLetter } from '@/utils/pinyin'
import { formatDict, getDictData, dictData } from '@/hooks';
import { useCommonStore } from '@/store/modules/commonStore';
import SysGlobal from './components/sysGlobal/index.vue'
import SysInput from './components/sysInput/index.vue'
import SysReport from './components/sysReport/index.vue'
import SysParameter from './components/sysParameter/index.vue'
import SysChannel from './components/sysChannel/index.vue'
import SysSort from './components/sysSort/index.vue'
const mbStore = useCommonStore();
// ========== TypeScript 类型定义 ==========
interface InstrTreeNode {
id: string
@ -118,24 +119,14 @@ const activeName = ref('SysGlobal')
const currentComponent = computed(() => {
return tabList.find(tab => tab.key === activeName.value)?.component || 'SysGlobal'
})
const result: any = ref([]);
const treeData = ref<InstrTreeNode[]>([])
const radioChange = (val: string) => {
if (val == "1") {
deptOptions.value = treeData.value
} else {
const result = [];
// 遍历外层数组的每个分组
for (let i = 0; i < treeData.value.length; i++) {
const group = treeData.value[i];
if (group.children && Array.isArray(group.children)) {
for (let j = 0; j < group.children.length; j++) {
result.push(group.children[j]);
}
}
}
deptOptions.value = result
deptOptions.value = result.value
}
}
@ -209,12 +200,26 @@ watch(deptName, debounceFilter, { immediate: false })
const getDeptTree = async (): Promise<void> => {
try {
const response = await paramTree() as ParamTreeResponse
result.value = []
if (response.code === "0" && response.data) {
for (let i = 0; i < response.data.length; i++) {
const group = response.data[i];
if (group.children && Array.isArray(group.children)) {
for (let j = 0; j < group.children.length; j++) {
result.value.push(group.children[j]);
}
}
}
treeData.value = response.data
radioChange('1')
if (!expandedKeys.value.length) {
// 默认展开第一个一级节点的子级
nextTick(() => {
if (mbStore.defaultConfig.defaultinstr) {
queryParams.value.yq = mbStore.defaultConfig.defaultinstr
yqmc.value = result.value.find((item: any) => item.id === queryParams.value.yq)?.label
deptTreeRef.value?.setCurrentKey(queryParams.value.yq)
} else {
if (deptOptions.value.length > 0) {
const firstLevelNode = deptOptions.value[0]
if (firstLevelNode && firstLevelNode.children && firstLevelNode.children.length > 0) {
@ -222,8 +227,8 @@ const getDeptTree = async (): Promise<void> => {
const firstChildNode = firstLevelNode.children[0]
queryParams.value.yq = firstChildNode.id
yqmc.value = firstChildNode.label
deptTreeRef.value?.setCurrentKey(firstChildNode.id)
deptTreeRef.value?.setCurrentKey(queryParams.value.yq)
}
}
}
})

View File

@ -145,6 +145,7 @@
</template>
<script setup name="configdict">
import { listData, } from "@/api/system/dict/data";
import {
addconfigdict, delconfigdict,
getconfigdict,
@ -153,18 +154,12 @@ import {
} from "@/api/liswork/xtwh/configdictApi.ts";
import DynamicInput from "@/views/liswork/xtwh/localconfig/components/DynamicInput.vue"
// 1. 定义类别下拉选项(根据实际业务调整)
const configTypeOptions = ref([
{ label: "仪器全局设置", value: "SYSTEM", color: "#E6A23C" },
{ label: "仪器界面设置", value: "INPUT", color: "#67C23A" },
{ label: "本地选项设置", value: "LOCAL", color: "#409EFF" },
{ label: "本院特殊设置", value: "HISOPT", color: "#909399" },
{ label: "门诊采血设置", value: "_MZCX_", color: "#C74127" }
]);
// 2. 定义获取类别对应颜色的方法
function getConfigTypeColor(type) {
// 匹配对应类别的颜色,无匹配时用默认色
const item = configTypeOptions.value.find(item => item.value === type);
return item?.color || "#909399"; // 默认灰色
return item?.elTagClass || "#909399"; // 默认灰色
}
// 2. 定义参数类别下拉选项(根据实际业务调整)
const configOptiontypeOptions = ref([
@ -185,6 +180,9 @@ function getconfigOptionTypeColor(type) {
}
const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const { lis_opt_type } = proxy.useDict("lis_opt_type"); //参数类别
const configTypeOptions = lis_opt_type
const regdictList = ref([]);
const open = ref(false);
const loading = ref(true);