diff --git a/src/api/liswork/xtwh/ReportSetting.ts b/src/api/liswork/xtwh/ReportSetting.ts index 573ca98..79081fc 100644 --- a/src/api/liswork/xtwh/ReportSetting.ts +++ b/src/api/liswork/xtwh/ReportSetting.ts @@ -9,4 +9,31 @@ export function addReportService(LabReportInstr: Object){ method: 'post', data: LabReportInstr }) +} + +//查询数据 +export function queryReportService(LabReportInstr: Object){ + return request({ + url: '/labReportinstr/query', + method: 'get', + params: LabReportInstr + }) +} + +//修改数据 +export function updateReportService(LabReportInstr: Object){ + return request({ + url: '/labReportinstr/update', + method: 'post', + data: LabReportInstr + }) +} + +//删除数据 +export function deleteReportService(LabReportInstr: Object){ + return request({ + url: '/labReportinstr/del', + method: 'get', + params: LabReportInstr + }) } \ No newline at end of file diff --git a/src/components/SelectTable/YQSelectTable/index.vue b/src/components/SelectTable/YQSelectTable/index.vue index 95e15ea..9175153 100644 --- a/src/components/SelectTable/YQSelectTable/index.vue +++ b/src/components/SelectTable/YQSelectTable/index.vue @@ -1,31 +1,33 @@ - + \ No newline at end of file diff --git a/src/components/SelectTable/index.vue b/src/components/SelectTable/index.vue index 30ca499..0f3c14f 100644 --- a/src/components/SelectTable/index.vue +++ b/src/components/SelectTable/index.vue @@ -49,29 +49,8 @@ import { getFirstLetter } from '@/api/pinyin.js'; import { ElEmpty } from 'element-plus'; // @ts-ignore import { comDict } from '@/utils/dict' -interface Field { - prop: string; - label: string; - width?: number; - enablePinyinSearch?: boolean; //是否参与拼音搜索 -} +import { Emits, Props } from '@/types'; -interface Props { - data: any; - fields: Field[]; - tableData?: object[]; - label?: string; - value?: string; - objKey?: string; - isHighlight?: boolean; - size?: string; - placeholder?: string; - border?: boolean; - width?: string | number; - disabled?: boolean; - dictType?: string; - clearable?: boolean; -} const props = withDefaults(defineProps(), { placeholder: "请选择", size: "default", @@ -84,10 +63,7 @@ const props = withDefaults(defineProps(), { clearable: true }); -interface Emits { - (e: "update:data", val: any): void; - (e: "getDataValue", val: any): void; -} + const emits = defineEmits(); const searchKey = ref(''); const tableRef = ref(); diff --git a/src/hooks/lisData/dictData.ts b/src/hooks/lisData/dictData.ts new file mode 100644 index 0000000..375e16c --- /dev/null +++ b/src/hooks/lisData/dictData.ts @@ -0,0 +1,40 @@ +//仪器,字典数据自动格式化类 +import { DictData } from '@/types/index'; +import { getGroupInstrdList } from '@/api/liswork/work/LisWork'; +//@ts-ignore +import { comDict } from '@/utils/dict' + +const dictData = ref({}); +const instrOptions = ref<{ yq: string; yqmc: string }[]>([]) + +export const getYqData = () => { + getGroupInstrdList() + .then((res: any) => { + if (res.code == 0) { + instrOptions.value = res.data.map((item: any) => ({ + yq: item.yq.trim(), + yqmc: item.yqmc + })) + } + }) +} +//'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) || [] + }; +} + +// 格式化字典数据方法 +export const formatDict = async (v: string, dictType: string) => { + 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; +} \ No newline at end of file diff --git a/src/hooks/lisData/index.ts b/src/hooks/lisData/index.ts new file mode 100644 index 0000000..779dcd0 --- /dev/null +++ b/src/hooks/lisData/index.ts @@ -0,0 +1 @@ +export * from './dictData'; \ No newline at end of file diff --git a/src/types/Object.d.ts b/src/types/Object.d.ts index 28c9482..62a1c54 100644 --- a/src/types/Object.d.ts +++ b/src/types/Object.d.ts @@ -1,4 +1,5 @@ export interface LabReportInstr { + index?: number; //序号 yq: string; //仪器 xh: number; //序号 bgdh: string; //报告单号 @@ -6,4 +7,13 @@ export interface LabReportInstr { type: string; //使用类型 condition: string; //使用条件 status?: string; //状态 +} + +export interface DictData { + XMGL?: Array; + ITEMCLASS?: Array; + YQDL?: Array; + xmlbList?: Array; + YQ?: Array; + [key: string]: any[] | undefined; // 添加索引签名以支持动态访问 } \ No newline at end of file diff --git a/src/types/SelectTable.d.ts b/src/types/SelectTable.d.ts new file mode 100644 index 0000000..20cacdd --- /dev/null +++ b/src/types/SelectTable.d.ts @@ -0,0 +1,29 @@ +export interface Emits { + (e: "update:data", val: any): void; + (e: "getDataValue", val: any): void; +} + +export interface Props { + data: any; + fields: Field[]; + tableData?: object[]; + label?: string; + value?: string; + objKey?: string; + isHighlight?: boolean; + size?: string; + placeholder?: string; + border?: boolean; + width?: string | number; + disabled?: boolean; + dictType?: string; + clearable?: boolean; +} + + +export interface Field { + prop: string; + label: string; + width?: number; + enablePinyinSearch?: boolean; //是否参与拼音搜索 +} \ No newline at end of file diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 74f3072..76b63b7 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -1,4 +1,6 @@ //聚合文件,导出所有的类型定义 //对象文件 -export * from './Object'; \ No newline at end of file +export * from './Object'; + +export * from './SelectTable'; \ No newline at end of file diff --git a/src/views/liswork/xtwh/reportsetting/index.vue b/src/views/liswork/xtwh/reportsetting/index.vue index 853dd2f..d3c6783 100644 --- a/src/views/liswork/xtwh/reportsetting/index.vue +++ b/src/views/liswork/xtwh/reportsetting/index.vue @@ -2,21 +2,25 @@ - + - 新增 - 删除 - 保存 + 新增 + 删除 + 保存 - - + + + + - \ No newline at end of file