检验项目优化

This commit is contained in:
wyuu 2026-04-10 17:51:19 +08:00
parent 29990c0ba9
commit f256dd5d34
4 changed files with 43 additions and 31 deletions

View File

@ -3,28 +3,30 @@
<div>
<div>
<el-button type="primary" @click="onClickAdd">新增</el-button>
<el-button type="primary" @click="onClickDel">删除</el-button>
</div>
<CustomTable ref="tableRef" :data="modelParam.userInstrData" :columns="columns" :enable-column-drag="true"
@column-drag-end="handleColumnDragEnd" :config="tableConfig" @row-click="onRowClick">
@column-drag-end="handleColumnDragEnd" :config="tableConfig">
<template #yq="{ row }">
<SelectTable v-model:data="row.yq" :fields="yqFields" :tableData="instrOptions" label="yqmc" value="yq"
objKey="yq" :border="true" placeholder="请选择仪器" :clearable="false" class="full-width-input" />
objKey="yq" placeholder="请选择仪器" :clearable="false" class="full-width-input" />
</template>
<template #xs="{ row }">
<el-input v-model="row.xs" class="full-width-input" />
</template>
<template #zkxm="{ row }">
<el-checkbox :checked="row.zkxm === '1'" @change="(val: any) => row.zkxm = val ? 1 : 0" />
<el-checkbox v-model="row.zkxm" true-value="1" false-value="0" />
</template>
<template #ckxx="{ row }">
<el-input v-model="row.ckxx" class="full-width-input"></el-input>
<el-input v-model="row.ckxx" class="full-width-input" />
</template>
<template #cksx="{ row }">
<el-input v-model="row.cksx" class="full-width-input"></el-input>
<el-input v-model="row.cksx" class="full-width-input" />
</template>
<template #dyckz="{ row }">
<el-input :model-value="getDyckz(row)" disabled class="full-width-input"></el-input>
<el-input :model-value="getDyckz(row)" disabled class="full-width-input" />
</template>
<template #action="{ row, $index }">
<el-button type="danger" text @click="onClickDel(row, $index)">删除</el-button>
</template>
</CustomTable>
</div>
@ -43,8 +45,8 @@ const modelParam = defineModel<any>()
const tableRef = ref<any>();
const columns = ref([
{ prop: 'vsid', label: '对照编码', visible: false, align: 'center' },
{ prop: 'yq', label: '仪器代号', visible: true, align: 'center', slot: 'yq', width: 200, showOverflowTooltip: false },
{ prop: 'xs', label: '调整系数', visible: true, align: 'center', slot: 'xs', showOverflowTooltip: false },
{ prop: 'yq', label: '仪器代号', visible: true, align: 'center', slot: 'yq', width: 160, showOverflowTooltip: false },
{ prop: 'xs', label: '调整系数', visible: true, align: 'center', slot: 'xs', width: 80, showOverflowTooltip: false },
{ prop: 'zkxm', label: '质控', visible: true, align: 'center', slot: 'zkxm', width: 40 },
{ prop: 'ckxx', label: '参考下限', visible: true, align: 'center', slot: 'ckxx', showOverflowTooltip: false },
{ prop: 'cksx', label: '参考上限', visible: true, align: 'center', slot: 'cksx', showOverflowTooltip: false },
@ -53,7 +55,8 @@ const columns = ref([
const tableConfig = ref({
border: true, // 边框
height: '78vh', // 高度
highlightCurrentRow: true, // 高亮当前行
highlightCurrentRow: false, // 高亮当前行
actionWidth: 60, // 操作列宽度
// cellStyle: cellStyleHd
})
@ -88,22 +91,23 @@ const onClickAdd = () => {
modelParam.value.userInstrData.push(newData)
}
const onClickDel = () => {
if (!selectRow.value.vsid) return ElMessage.warning('请选择要删除的行!')
ElMessageBox.confirm('是否要删除选中的数据?', '警告',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
await deleteXmInfoVs({ vsid: selectRow.value.vsid || 0 })
emit('refreshTabData', modelParam.value.basicData)
})
const onClickDel = (row, index) => {
if (!row.vsid) {
modelParam.value.userInstrData.splice(index, 1)
} else {
ElMessageBox.confirm('是否要删除选中的数据?', '警告',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
await deleteXmInfoVs({ vsid: row.vsid })
emit('refreshTabData', modelParam.value.basicData)
})
}
}
const onRowClick = (row: any) => {
selectRow.value = row
}
const getDyckz = (row: XmInfoVs) => {
if (!row.cksx && !row.ckxx) {

View File

@ -727,7 +727,7 @@ const fetchlabPatList = () => {
}
} else {
labInfo.value = {}
labPat.value = { ybh: '1' }
labPat.value = {}
zbLabResuts.value = []
handleCreate()
}

View File

@ -341,7 +341,7 @@ const getColor = (type: string) => {
}
const formInfoRefs = useTemplateRef('formInfoRefs')
const currentTarget = ref(null);
const currentTarget = ref<HTMLElement | null>(null);
// 回车跳转到下一个表单元素
const nextFocus = (e?: Event, idx?: number) => {
if (e) e.preventDefault() // 禁止回车提交表单
@ -364,8 +364,12 @@ const nextFocus = (e?: Event, idx?: number) => {
// 找到当前触发元素在列表中的位置
currentTarget.value = e?.target as HTMLElement;
// 兼容 SelectTable:如果点击的是组件外层,定位到内部输入框
if (currentTarget.value.closest('.select-table-container')) {
currentTarget.value = currentTarget.value.closest('.select-table-container').querySelector('.el-select__input');
const container = currentTarget.value.closest('.select-table-container');
if (container) {
const input = container.querySelector('.el-select__input');
if (input) {
currentTarget.value = input as HTMLElement;
}
}
index = arr.findIndex((item: any) => item === currentTarget.value || item.contains(currentTarget.value));

View File

@ -334,7 +334,7 @@ const getColor = (type: string) => {
}
const formInfoRefs = useTemplateRef('formInfoRefs')
const currentTarget = ref(null);
const currentTarget = ref<HTMLElement | null>(null);
// 回车跳转到下一个表单元素
const nextFocus = (e?: Event, idx?: number) => {
if (e) e.preventDefault() // 禁止回车提交表单
@ -357,8 +357,12 @@ const nextFocus = (e?: Event, idx?: number) => {
// 找到当前触发元素在列表中的位置
currentTarget.value = e?.target as HTMLElement;
// 兼容 SelectTable:如果点击的是组件外层,定位到内部输入框
if (currentTarget.value.closest('.select-table-container')) {
currentTarget.value = currentTarget.value.closest('.select-table-container').querySelector('.el-select__input');
const conatiner = currentTarget.value.closest('.select-table-container') as HTMLElement;
if (conatiner) {
const input = conatiner.querySelector('.el-select__input');
if (input) {
currentTarget.value = input as HTMLElement;
}
}
index = arr.findIndex((item: any) => item === currentTarget.value || item.contains(currentTarget.value));