2025-10-21 17:43:57 +08:00
|
|
|
<template>
|
|
|
|
|
<!-- 使用仪器 -->
|
2025-11-04 17:54:29 +08:00
|
|
|
<div>
|
2025-10-31 15:22:51 +08:00
|
|
|
<div>
|
2025-11-17 17:42:09 +08:00
|
|
|
<el-button type="primary" @click="onClickAdd">新增</el-button>
|
|
|
|
|
<el-button type="primary" @click="onClickDel">删除</el-button>
|
2025-10-31 15:22:51 +08:00
|
|
|
</div>
|
2025-11-17 17:42:09 +08:00
|
|
|
<CustomTable ref="tableRef" :data="yqList" :columns="columns" :enable-column-drag="true" @column-drag-end="handleColumnDragEnd"
|
2025-11-18 18:12:25 +08:00
|
|
|
:config="tableConfig" @row-click="onRowClick">
|
|
|
|
|
<template #yq="{row}">
|
|
|
|
|
<YQSelectTable v-model:data="row.yq" placeholder="请输入仪器名称"/>
|
|
|
|
|
</template>
|
|
|
|
|
<template #xs="{row}">
|
|
|
|
|
<el-input v-model="row.xs" class="full-width-input"/>
|
|
|
|
|
</template>
|
|
|
|
|
<template #zkxm="{row}">
|
|
|
|
|
<el-checkbox v-model="row.zkxm" />
|
|
|
|
|
</template>
|
|
|
|
|
<template #cksx="{row}">
|
|
|
|
|
<el-input v-model="row.cksx" class="full-width-input"></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
<template #ckxx="{row}">
|
|
|
|
|
<el-input v-model="row.ckxx" class="full-width-input"></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
<template #dyckz="{row}">
|
|
|
|
|
<el-input v-model="row.dyckz" class="full-width-input"></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</CustomTable>
|
2025-10-28 16:22:44 +08:00
|
|
|
</div>
|
2025-10-21 17:43:57 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
2025-10-24 15:37:24 +08:00
|
|
|
<script setup lang="ts">
|
2025-10-28 16:22:44 +08:00
|
|
|
import CustomTable from '@/components/elTable/index.vue'
|
2025-11-18 18:12:25 +08:00
|
|
|
import { XmInfoVs } from '@/types';
|
|
|
|
|
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue'
|
|
|
|
|
import {ElMessageBox} from 'element-plus'
|
2025-10-21 17:43:57 +08:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
2025-11-17 17:42:09 +08:00
|
|
|
// 显示数据
|
2025-10-31 15:22:51 +08:00
|
|
|
dataList: {
|
2025-11-18 18:12:25 +08:00
|
|
|
type: Array<XmInfoVs>,
|
2025-10-31 15:22:51 +08:00
|
|
|
required: true,
|
|
|
|
|
default: () => []
|
2025-11-18 18:12:25 +08:00
|
|
|
},
|
|
|
|
|
formData: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: false,
|
|
|
|
|
default: {}
|
2025-10-21 17:43:57 +08:00
|
|
|
}
|
|
|
|
|
});
|
2025-10-28 16:22:44 +08:00
|
|
|
|
2025-11-17 17:42:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//const yq = ref<string>('');
|
|
|
|
|
const tableRef = ref<any>();
|
2025-11-18 18:12:25 +08:00
|
|
|
const yqList = ref<Array<XmInfoVs>>([]);
|
2025-10-28 16:22:44 +08:00
|
|
|
const columns = ref([
|
2025-11-18 18:12:25 +08:00
|
|
|
{ prop: 'yq', label: '仪器代号', visible: true, align: 'center', slot: 'yq', width: 150 },
|
|
|
|
|
{ prop: 'xs', label: '调整系数', visible: true, align: 'center', slot: 'xs', width: 100 },
|
|
|
|
|
{ prop: 'zkxm', label: '质控', visible: true, align: 'center', slot: 'zkxm', width: 40 },
|
|
|
|
|
{ prop: 'cksx', label: '参考上限', visible: true, align: 'center',slot: 'cksx', width: 100 },
|
|
|
|
|
{ prop: 'ckxx', label: '参考下限', visible: true, align: 'center',slot: 'ckxx', width: 100 },
|
|
|
|
|
{ prop: 'dyckz', label: '打印参考值', visible: true, align: 'center',slot: 'dyckz', width: 100 },
|
2025-10-28 16:22:44 +08:00
|
|
|
]);
|
|
|
|
|
const tableConfig = ref({
|
|
|
|
|
border: true, // 边框
|
|
|
|
|
height: '85vh', // 高度
|
|
|
|
|
highlightCurrentRow: true, // 高亮当前行
|
|
|
|
|
// cellStyle: cellStyleHd
|
|
|
|
|
})
|
2025-11-18 18:12:25 +08:00
|
|
|
const selectRow = ref<XmInfoVs>({
|
|
|
|
|
yq: '',
|
|
|
|
|
xmid: 0
|
|
|
|
|
})
|
2025-10-28 16:22:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//退拽属性
|
2025-11-17 17:42:09 +08:00
|
|
|
const handleColumnDragEnd = (data: any) => {
|
|
|
|
|
// 更新列配置
|
|
|
|
|
columns.value = data.columns;
|
|
|
|
|
}
|
2025-10-31 15:22:51 +08:00
|
|
|
|
|
|
|
|
const handInputChange = () => {
|
2025-11-07 17:50:06 +08:00
|
|
|
// yqList.value = yqList.value.filter(item => {
|
|
|
|
|
// return item.yq.includes(yq.value) || item.yqmc.includes(yq.value);
|
|
|
|
|
// });
|
|
|
|
|
// if (yq.value === '') {
|
|
|
|
|
// yqList.value = props.dataList;
|
|
|
|
|
// }
|
2025-10-31 15:22:51 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-17 17:42:09 +08:00
|
|
|
const onClickAdd = () => {
|
2025-11-18 18:12:25 +08:00
|
|
|
const newData: XmInfoVs = {
|
|
|
|
|
yq: '',
|
|
|
|
|
xmid: props.formData.xmid,
|
|
|
|
|
}
|
|
|
|
|
yqList.value.push(newData)
|
2025-11-17 17:42:09 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-18 18:12:25 +08:00
|
|
|
const onClickDel = async () => {
|
|
|
|
|
if(selectRow.value){
|
|
|
|
|
await ElMessageBox.confirm('是否要删除选中的数据?','Warning',
|
|
|
|
|
{
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning',
|
|
|
|
|
});
|
|
|
|
|
yqList.value = yqList.value.filter(item => item.yq != selectRow.value.yq);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-11-17 17:42:09 +08:00
|
|
|
|
2025-11-18 18:12:25 +08:00
|
|
|
const onRowClick = (row: any) => {
|
|
|
|
|
selectRow.value = row
|
2025-11-17 17:42:09 +08:00
|
|
|
}
|
2025-10-31 15:22:51 +08:00
|
|
|
|
2025-11-17 17:42:09 +08:00
|
|
|
onActivated(() =>{
|
2025-11-18 18:12:25 +08:00
|
|
|
yqList.value = Array.isArray(props.dataList) ? props.dataList : [];
|
2025-10-31 15:22:51 +08:00
|
|
|
})
|
2025-11-28 18:02:07 +08:00
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
userInstrData: yqList
|
|
|
|
|
})
|
|
|
|
|
|
2025-10-21 17:43:57 +08:00
|
|
|
</script>
|