This commit is contained in:
wyuu 2025-10-31 15:30:49 +08:00
commit c87e0d428a
10 changed files with 169 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'
export const getDictData = async (...args: string[]) => {
const dictRefs = await comDict(...args);
// 从 ref 中获取实际数据
dictData.value = {
XMGL: toRaw(dictRefs.XMGL.value) || [],
ITEMCLASS: toRaw(dictRefs.ITEMCLASS.value) || [],
YQDL: toRaw(dictRefs.YQDL.value) || []
};
if(dictRefs.XMGL != undefined) dictData.value.XMGL = toRaw(dictRefs.XMGL.value) || []
if(dictRefs.ITEMCLASS != undefined) dictData.value.ITEMCLASS = toRaw(dictRefs.ITEMCLASS.value) || []
if(dictRefs.YQDL != undefined) dictData.value.YQDL = toRaw(dictRefs.YQDL.value) || []
}
// 格式化字典数据方法
export const formatDict = async (v: string, dictType: string) => {
return dictData.value[dictType]?.find((item: any) => item.value == v.trim())?.label;
//字典数据格式化方法
export const formatDict = (v: string, dictType: string) => {
if(v == undefined) return ;
return dictData.value[dictType]?.find((item: any) => item.value == v.trim())?.label;
}
//仪器格式化方法
export const formatInstr = (v: string) => {
return instrOptions.value.find((item: any) => item.yq == v.trim())?.yqmc;
}
}
export {dictData}

View File

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

97
src/types/Object.d.ts vendored Normal file
View File

@ -0,0 +1,97 @@
export interface LabReportInstr {
index?: number; //序号
yq: string; //仪器
xh: number; //序号
bgdh: string; //报告单号
yljg: string; //医疗机构
type: string; //使用类型
condition: string; //使用条件
status?: string; //状态
}
export interface DictData {
XMGL?: Array<any>;
ITEMCLASS?: Array<any>;
YQDL?: Array<any>;
xmlbList?: Array<any>;
YQ?: Array<any>;
[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;
}
// 定义菜单项的类型
export interface ContextMenuItem {
// 菜单项类型:普通项或分隔线
type?: 'item' | 'divider';
// 菜单项显示文本
label?: string;
// 菜单项唯一标识,用于事件处理
action?: string;
// 是否为危险操作(如删除)
danger?: boolean;
// 是否禁用
disabled?: boolean;
// 快捷键提示文本
shortcut?: string;
// 菜单项的子级菜单项
props?: Record<string, any>;
}

View File

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

View File

@ -1,7 +1,7 @@
<template>
<!-- 基本资料 -->
<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>
<el-divider style="margin: 5px 0;"/>
<el-form-item label="项目类别" prop="xmgl">
@ -167,9 +167,8 @@
</template>
<script setup lang="ts">
import { computed, ref,onMounted,toRaw } from 'vue';
//@ts-ignore
import { comDict } from '@/utils/dict'
import { XmInfoNew,DictData } from '@/types';
import { formatDict,getDictData } from '@/hooks';
const props = defineProps({
//是否显示
@ -180,14 +179,9 @@ const props = defineProps({
}
});
interface DictData {
XMGL?: Array<any>;
[key: string]: any[] | undefined; // 添加索引签名以支持动态访问
}
const formRef = ref();
const formData = ref<any>({
const formData = ref<XmInfoNew>({
xmgl: '',
xmdh: '',
xmmc: '',
@ -237,18 +231,6 @@ const formData = ref<any>({
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(() => {
switch(formData.value.jgbz){
@ -261,21 +243,10 @@ computed(() => {
}
});
onMounted(async () => {
// 初始化数据
const dictRefs = await comDict('XMGL');
// 从 ref 中获取实际数据
dictData.value = {
XMGL: toRaw(dictRefs.XMGL.value) || []
};
onMounted(() => {
getDictData('XMGL');
})
// 引入公共组件的字典格式化方法
const formatDict = (v: string, dictType: string) => {
return dictData.value[dictType]?.find((item: any) => item.value == v.trim())?.label;
}
</script>

View File

@ -1,7 +1,10 @@
<template>
<!-- 使用仪器 -->
<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"/>
</div>
</template>
@ -9,6 +12,7 @@
<script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue'
import { LabInstr } from '@/types';
import { ref } from 'vue';
const props = defineProps({
@ -17,13 +21,21 @@ const props = defineProps({
type: Boolean,
required: true,
default: false
},
dataList: {
type: Array<LabInstr>,
required: true,
default: () => []
}
});
const yq = ref<string>('');
const tableRef = ref<any>(null);
const dataList = ref();
const yqList = ref<Array<LabInstr>>(props.dataList);
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: 'zkxm', label: '质控', visible: true, align: 'center', width: 100 }
]);
@ -40,4 +52,17 @@ const handleColumnDragEnd = (data: any) => {
// 更新列配置
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>

View File

@ -42,11 +42,11 @@
</template>
<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 YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
import { ElMessage,ElMessageBox } from 'element-plus';
import { formatInstr,getYqData } from '@/hooks/lisData/index';
import { formatInstr,getYqData } from '@/hooks/index';
const formData = ref({
yq: ''