报告单对应界面和封装修改

This commit is contained in:
jiangs 2025-10-31 15:22:51 +08:00
parent 6605246539
commit 797cdeaa75
10 changed files with 132 additions and 84 deletions

1
src/hooks/index.ts Normal file
View File

@ -0,0 +1 @@
export * from './lisData/dictData';

View File

@ -21,20 +21,20 @@ export const getYqData = () => {
//'XMGL','ITEMCLASS', 'YQDL' //'XMGL','ITEMCLASS', 'YQDL'
export const getDictData = async (...args: string[]) => { export const getDictData = async (...args: string[]) => {
const dictRefs = await comDict(...args); const dictRefs = await comDict(...args);
// 从 ref 中获取实际数据 if(dictRefs.XMGL != undefined) dictData.value.XMGL = toRaw(dictRefs.XMGL.value) || []
dictData.value = { if(dictRefs.ITEMCLASS != undefined) dictData.value.ITEMCLASS = toRaw(dictRefs.ITEMCLASS.value) || []
XMGL: toRaw(dictRefs.XMGL.value) || [], if(dictRefs.YQDL != undefined) dictData.value.YQDL = toRaw(dictRefs.YQDL.value) || []
ITEMCLASS: toRaw(dictRefs.ITEMCLASS.value) || [],
YQDL: toRaw(dictRefs.YQDL.value) || []
};
} }
// 格式化字典数据方法 //字典数据格式化方法
export const formatDict = async (v: string, dictType: string) => { export const formatDict = (v: string, dictType: string) => {
return dictData.value[dictType]?.find((item: any) => item.value == v.trim())?.label; if(v == undefined) return ;
return dictData.value[dictType]?.find((item: any) => item.value == v.trim())?.label;
} }
//仪器格式化方法 //仪器格式化方法
export const formatInstr = (v: string) => { export const formatInstr = (v: string) => {
return instrOptions.value.find((item: any) => item.yq == v.trim())?.yqmc; return instrOptions.value.find((item: any) => item.yq == v.trim())?.yqmc;
} }
export {dictData}

View File

@ -1 +0,0 @@
export * from './dictData';

60
src/types/Object.d.ts vendored
View File

@ -16,4 +16,64 @@ export interface DictData {
xmlbList?: Array<any>; xmlbList?: Array<any>;
YQ?: Array<any>; YQ?: Array<any>;
[key: string]: any[] | undefined; // 添加索引签名以支持动态访问 [key: string]: any[] | undefined; // 添加索引签名以支持动态访问
}
export class LabInstr {
yq: string; //仪器
yqmc: string; //仪器名称
yqdl: string; //仪器大类
}
export class XmInfoNew {
xmid: string; //项目ID
xmdh: string; //项目代号
xmmc: string; //项目名称
cksx: number;//参考值上限
ckxx: number;//参考值下限
dw: string; //单位
dyckz: string; //对应参考值
dyxh: number; //对应序号
xmlb: string; //项目类别
jsxm: string; //计算项目
yqdl: string; //仪器大类
val1: string; //备用1
val2: string; //备用2
val3: string; //备用3
val4: string; //备用4
val5: string; //备用5
uflag: string; //是否无效
cp_jgz?: string;
jgbz: string;
jgz: string;
xmgl: string;
mrz: string;
qccv: string;
xsbs: string;
whocode: string;
germflag: string;
yymc: string;
knowledge: string;
xsws: string;
dylx: string;
zhbdh: string;
bgdh: string;
jg: string;
zjf: string;
csff: string;
fzdyxh: number;
itemclass: string;
jsgs: string;
ygxb: string;
ygnl: string;
ygbb: string;
ygzq: string;
ygzd: string;
sjx: string;
xjx: string;
jgjg: string;
hlimt: string;
llimit: string;
redoxx: string;
redosx: string;
} }

View File

@ -6,14 +6,17 @@
<el-form inline :model="queryParams" class="mb8" size="small"> <el-form inline :model="queryParams" class="mb8" size="small">
<el-form-item label="项目类别"> <el-form-item label="项目类别">
<SelectTable v-model:data="queryParams.xmgl" :fields="xmglFields" :tableData="dictData.XMGL" label="label" value="value" objKey="value" width="140px" placeholder="项目类别" <SelectTable v-model:data="queryParams.xmgl" :fields="xmglFields" :tableData="dictData.XMGL" label="label" value="value" objKey="value" width="140px" placeholder="项目类别"
size="small"
@getDataValue="getList"/> @getDataValue="getList"/>
</el-form-item> </el-form-item>
<el-form-item label="细菌标志"> <el-form-item label="细菌标志">
<SelectTable v-model:data="queryParams.itemclass" :fields="itemclassFields" :tableData="dictData.ITEMCLASS" label="label" value="value" objKey="value" width="140px" placeholder="细菌标志" <SelectTable v-model:data="queryParams.itemclass" :fields="itemclassFields" :tableData="dictData.ITEMCLASS" label="label" value="value" objKey="value" width="140px" placeholder="细菌标志"
size="small"
@getDataValue="getList"/> @getDataValue="getList"/>
</el-form-item> </el-form-item>
<el-form-item label="仪器代号"> <el-form-item label="仪器代号">
<SelectTable v-model:data="queryParams.yq" :fields="yqFields" :tableData="instrOptions" label="yqmc" value="yq" objKey="yq" :border="true" width="140px" placeholder="请选择仪器" <SelectTable v-model:data="queryParams.yq" :fields="yqFields" :tableData="instrOptions" label="yqmc" value="yq" objKey="yq" :border="true" width="140px" placeholder="请选择仪器"
size="small"
@getDataValue="getList"/> @getDataValue="getList"/>
</el-form-item> </el-form-item>
<el-form-item label="快速查找"> <el-form-item label="快速查找">
@ -21,7 +24,8 @@
@change="getList"/> @change="getList"/>
</el-form-item> </el-form-item>
<el-form-item label="仪器大类"> <el-form-item label="仪器大类">
<SelectTable v-model:data="queryParams.yqdl" :fields="yqdlFields" :tableData="yqdlList" label="label" value="value" objKey="value" :border="true" width="140px" placeholder="仪器大类" <SelectTable v-model:data="queryParams.yqdl" :fields="yqdlFields" :tableData="dictData.YQDL" label="label" value="value" objKey="value" :border="true" width="140px" placeholder="仪器大类"
size="small"
@getDataValue="getList"/> @getDataValue="getList"/>
</el-form-item> </el-form-item>
<el-form-item label="项目ID"> <el-form-item label="项目ID">
@ -78,7 +82,7 @@
<CommmonlyValues :visible="true"/> <CommmonlyValues :visible="true"/>
</template> </template>
<template v-if="activeTab === 3"> <template v-if="activeTab === 3">
<UseInstr :visible="true"/> <UseInstr :visible="true" :dataList="instrOptions"/>
</template> </template>
<template v-if="activeTab === 4"> <template v-if="activeTab === 4">
<Knowledge :visible="true"/> <Knowledge :visible="true"/>
@ -116,22 +120,12 @@ import Sort from './tab/sort.vue'
import Parameter from './tab/parameter.vue'; import Parameter from './tab/parameter.vue';
import ChannelNumber from './tab/channelNumber.vue'; import ChannelNumber from './tab/channelNumber.vue';
import ReferenceValueDetails from './tab/referenceValueDetails.vue'; import ReferenceValueDetails from './tab/referenceValueDetails.vue';
import { queryXmInfoNewService,queryXmInfoNewDetailService } from '@/api/liswork/labItem/LabItem'; import { queryXmInfoNewService,queryXmInfoNewDetailService } from '@/api/liswork/labItem/LabItemApi';
//@ts-ignore
import { comDict } from '@/utils/dict'
import SelectTable from '@/components/SelectTable/index.vue' import SelectTable from '@/components/SelectTable/index.vue'
import { getGroupInstrdList } from '@/api/liswork/work/LisWork'; import { getGroupInstrdList } from '@/api/liswork/work/LisWork';
import tabView from '@/components/tabViews/index.vue'; import tabView from '@/components/tabViews/index.vue';
import { LabInstr,XmInfoNew } from '@/types';
import { formatDict,getDictData,dictData } from '@/hooks';
interface DictData {
XMGL?: Array<any>;
ITEMCLASS?: Array<any>;
YQDL?: Array<any>;
xmlbList?: Array<any>;
[key: string]: any[] | undefined; // 添加索引签名以支持动态访问
}
const xmlbList = ref<Array<any>>([ const xmlbList = ref<Array<any>>([
{ label: '数值型', value: '1' }, { label: '数值型', value: '1' },
@ -140,7 +134,6 @@ const xmlbList = ref<Array<any>>([
{ label: '数值文字混合型', value: '4' } { label: '数值文字混合型', value: '4' }
]) ])
const dataList = ref<Array<any>>([]) const dataList = ref<Array<any>>([])
const tabVisible = ref<string>('1')
const queryParams = ref({ const queryParams = ref({
xmgl: '', //项目归类 xmgl: '', //项目归类
itemclass: '' , //细菌标志 itemclass: '' , //细菌标志
@ -152,7 +145,7 @@ const queryParams = ref({
isMIC: false || null //是否隐藏微生物项目 isMIC: false || null //是否隐藏微生物项目
}) })
//字典数据 //字典数据
const dictData = ref<DictData>({}); //const dictData = ref<DictData>({});
const tableRef = ref() const tableRef = ref()
const xmglFields = ref([ const xmglFields = ref([
{ prop: 'value', label: '代号', width: 80, enablePinyinSearch: true }, { prop: 'value', label: '代号', width: 80, enablePinyinSearch: true },
@ -162,7 +155,7 @@ const itemclassFields = ref([
{ prop: 'value', label: '代号', width: 80, enablePinyinSearch: true }, { prop: 'value', label: '代号', width: 80, enablePinyinSearch: true },
{ prop: 'label', label: '名称', enablePinyinSearch: true }, { prop: 'label', label: '名称', enablePinyinSearch: true },
]) ])
const instrOptions = ref<{ yq: string; yqmc: string }[]>([]) const instrOptions = ref<LabInstr[]>([])
const tabList = ref([ const tabList = ref([
{ label: '基本资料', value: 1 }, { label: '基本资料', value: 1 },
{ label: '常用取值', value: 2 }, { label: '常用取值', value: 2 },
@ -218,6 +211,9 @@ const yqdlFields = ref([
]) ])
const yqdlList = ref<Array<any>>() const yqdlList = ref<Array<any>>()
//tab页数据
const basicTabData = ref<XmInfoNew>();
// 仪器 // 仪器
const getYqConfig = () => { const getYqConfig = () => {
getGroupInstrdList() getGroupInstrdList()
@ -240,25 +236,20 @@ const getList = () => {
onMounted(async () => { onMounted(async () => {
// 初始化数据 // 初始化数据
const dictRefs = await comDict('XMGL','ITEMCLASS', 'YQDL'); // const dictRefs = await comDict('XMGL','ITEMCLASS', 'YQDL');
// 从 ref 中获取实际数据 // // 从 ref 中获取实际数据
dictData.value = { // dictData.value = {
XMGL: toRaw(dictRefs.XMGL.value) || [], // XMGL: toRaw(dictRefs.XMGL.value) || [],
ITEMCLASS: toRaw(dictRefs.ITEMCLASS.value) || [], // ITEMCLASS: toRaw(dictRefs.ITEMCLASS.value) || [],
YQDL: toRaw(dictRefs.YQDL.value) || [], // YQDL: toRaw(dictRefs.YQDL.value) || [],
XMLB: xmlbList.value || [] // XMLB: xmlbList.value || []
}; // };
getDictData('XMGL','ITEMCLASS', 'YQDL');
getList() getList()
getYqConfig(); getYqConfig();
}) })
// 引入公共组件的字典格式化方法
const formatDict = (v: string, dictType: string) => {
return dictData.value[dictType]?.find((item: any) => item.value == v.trim())?.label;
}
//新增 //新增
const handleAdd = () => { const handleAdd = () => {
console.log('新增') console.log('新增')
@ -295,6 +286,7 @@ const changeStauts = () => {
// 选择行变化 // 选择行变化
const rowChange = (row: any) => { const rowChange = (row: any) => {
queryXmInfoNewDetailService(row.xmid,row.yq,row.xmdh).then((res: any) => { queryXmInfoNewDetailService(row.xmid,row.yq,row.xmdh).then((res: any) => {
basicTabData.value = res.data.xmInfoNewRows[0];
console.log('明细数据:', res); console.log('明细数据:', res);
}) })
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<!-- 基本资料 --> <!-- 基本资料 -->
<div v-show="visible"> <div v-show="visible">
<el-form ref="formRef" :model="formData" size="small" class="form-inline" inline :rules="rules" label-width="80px"> <el-form ref="formRef" :model="formData" size="small" class="form-inline" inline label-width="80px">
<span class="text-span">基本参数:</span> <span class="text-span">基本参数:</span>
<el-divider style="margin: 5px 0;"/> <el-divider style="margin: 5px 0;"/>
<el-form-item label="项目类别" prop="xmgl"> <el-form-item label="项目类别" prop="xmgl">
@ -167,9 +167,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref,onMounted,toRaw } from 'vue'; import { XmInfoNew,DictData } from '@/types';
//@ts-ignore import { formatDict,getDictData } from '@/hooks';
import { comDict } from '@/utils/dict'
const props = defineProps({ const props = defineProps({
//是否显示 //是否显示
@ -180,14 +179,9 @@ const props = defineProps({
} }
}); });
interface DictData {
XMGL?: Array<any>;
[key: string]: any[] | undefined; // 添加索引签名以支持动态访问
}
const formRef = ref(); const formRef = ref();
const formData = ref<any>({ const formData = ref<XmInfoNew>({
xmgl: '', xmgl: '',
xmdh: '', xmdh: '',
xmmc: '', xmmc: '',
@ -237,18 +231,6 @@ const formData = ref<any>({
val5: '' val5: ''
} }
); );
//字典数据
const dictData = ref<DictData>({});
const rules = ref({
// name: [
// { required: true, message: '请输入姓名', trigger: 'blur' },
// { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
// ],
// sex: [
// { required: true, message: '请选择性别', trigger: 'change' }
// ]
});
computed(() => { computed(() => {
switch(formData.value.jgbz){ switch(formData.value.jgbz){
@ -261,21 +243,10 @@ computed(() => {
} }
}); });
onMounted(async () => { onMounted(() => {
// 初始化数据 getDictData('XMGL');
const dictRefs = await comDict('XMGL');
// 从 ref 中获取实际数据
dictData.value = {
XMGL: toRaw(dictRefs.XMGL.value) || []
};
}) })
// 引入公共组件的字典格式化方法
const formatDict = (v: string, dictType: string) => {
return dictData.value[dictType]?.find((item: any) => item.value == v.trim())?.label;
}
</script> </script>

View File

@ -1,7 +1,10 @@
<template> <template>
<!-- 使用仪器 --> <!-- 使用仪器 -->
<div v-show="visible"> <div v-show="visible">
<CustomTable ref="tableRef" :data="dataList" :columns="columns" :enable-column-drag="true" @column-drag-end="handleColumnDragEnd" <div>
<span>筛选:</span><input v-model="yq" style="width: 240px;" @change="handInputChange">
</div>
<CustomTable ref="tableRef" :data="yqList" :columns="columns" :enable-column-drag="true" @column-drag-end="handleColumnDragEnd"
:config="tableConfig"/> :config="tableConfig"/>
</div> </div>
</template> </template>
@ -9,6 +12,7 @@
<script setup lang="ts"> <script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue' import CustomTable from '@/components/elTable/index.vue'
import { LabInstr } from '@/types';
import { ref } from 'vue'; import { ref } from 'vue';
const props = defineProps({ const props = defineProps({
@ -17,13 +21,21 @@ const props = defineProps({
type: Boolean, type: Boolean,
required: true, required: true,
default: false default: false
},
dataList: {
type: Array<LabInstr>,
required: true,
default: () => []
} }
}); });
const yq = ref<string>('');
const tableRef = ref<any>(null); const tableRef = ref<any>(null);
const dataList = ref(); const yqList = ref<Array<LabInstr>>(props.dataList);
const columns = ref([ const columns = ref([
{ prop: 'yq', label: '仪器', visible: true, align: 'center', width: 200 }, { prop: 'xz', label: '选择', visible: true, align: 'center', width: 50,type: 'selection' },
{ prop: 'yq', label: '仪器代号', visible: true, align: 'center', width: 150 },
{ prop: 'yqmc', label: '仪器名称', visible: true, align: 'center', width: 200},
{ prop: 'xs', label: '调整系数', visible: true, align: 'center', width: 100 }, { prop: 'xs', label: '调整系数', visible: true, align: 'center', width: 100 },
{ prop: 'zkxm', label: '质控', visible: true, align: 'center', width: 100 } { prop: 'zkxm', label: '质控', visible: true, align: 'center', width: 100 }
]); ]);
@ -40,4 +52,17 @@ const handleColumnDragEnd = (data: any) => {
// 更新列配置 // 更新列配置
columns.value = data.columns; columns.value = data.columns;
} }
const handInputChange = () => {
yqList.value = yqList.value.filter(item => {
return item.yq.includes(yq.value) || item.yqmc.includes(yq.value);
});
if (yq.value === '') {
yqList.value = props.dataList;
}
}
onMounted(() =>{
})
</script> </script>

View File

@ -42,11 +42,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {addReportService,queryReportService,updateReportService,deleteReportService} from '@/api/liswork/xtwh/ReportSetting'; import {addReportService,queryReportService,updateReportService,deleteReportService} from '@/api/liswork/xtwh/ReportSettingApi';
import { LabReportInstr } from '@/types/index'; import { LabReportInstr } from '@/types/index';
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue'; import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
import { ElMessage,ElMessageBox } from 'element-plus'; import { ElMessage,ElMessageBox } from 'element-plus';
import { formatInstr,getYqData } from '@/hooks/lisData/index'; import { formatInstr,getYqData } from '@/hooks/index';
const formData = ref({ const formData = ref({
yq: '' yq: ''