From 1e1853149b2e7d869f7bd1a7640290545cb9f161 Mon Sep 17 00:00:00 2001 From: jiangs <373297395@qq.com> Date: Thu, 30 Oct 2025 11:33:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ts=E8=87=AA=E5=8A=A8=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=92=8Cselect=E7=BB=84=E4=BB=B6=E7=9A=84=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/styles/ruoyi.scss | 14 ++- src/auto-imports.d.ts | 87 +++++++++++++++++++ .../SelectTable/YQSelectTable/index.vue | 46 ++++++++++ .../liswork/xtwh/reportsetting/index.vue | 38 ++++---- vite/plugins/auto-import.js | 3 +- 5 files changed, 168 insertions(+), 20 deletions(-) create mode 100644 src/auto-imports.d.ts create mode 100644 src/components/SelectTable/YQSelectTable/index.vue diff --git a/src/assets/styles/ruoyi.scss b/src/assets/styles/ruoyi.scss index 0ec4717..8827267 100644 --- a/src/assets/styles/ruoyi.scss +++ b/src/assets/styles/ruoyi.scss @@ -322,8 +322,8 @@ border-color: #aef5ef; } - // 表格input宽度 - .full-width-input .el-input__inner { + // 表格input宽度,表格select宽度 + .full-width-input .el-input__inner .el-select__inner { width: 100%; height: 100%; @@ -339,6 +339,16 @@ padding: 0 !important; outline: none; + &:hover { + box-shadow: none !important; + } + } + .el-select__wrapper { + box-shadow: none; + background: transparent !important; + padding: 0 !important; + outline: none; + &:hover { box-shadow: none !important; } diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts new file mode 100644 index 0000000..a606bd4 --- /dev/null +++ b/src/auto-imports.d.ts @@ -0,0 +1,87 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +export {} +declare global { + const EffectScope: typeof import('vue')['EffectScope'] + const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] + const computed: typeof import('vue')['computed'] + const createApp: typeof import('vue')['createApp'] + const createPinia: typeof import('pinia')['createPinia'] + const customRef: typeof import('vue')['customRef'] + const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] + const defineComponent: typeof import('vue')['defineComponent'] + const defineStore: typeof import('pinia')['defineStore'] + const effectScope: typeof import('vue')['effectScope'] + const getActivePinia: typeof import('pinia')['getActivePinia'] + const getCurrentInstance: typeof import('vue')['getCurrentInstance'] + const getCurrentScope: typeof import('vue')['getCurrentScope'] + const h: typeof import('vue')['h'] + const inject: typeof import('vue')['inject'] + const isProxy: typeof import('vue')['isProxy'] + const isReactive: typeof import('vue')['isReactive'] + const isReadonly: typeof import('vue')['isReadonly'] + const isRef: typeof import('vue')['isRef'] + const mapActions: typeof import('pinia')['mapActions'] + const mapGetters: typeof import('pinia')['mapGetters'] + const mapState: typeof import('pinia')['mapState'] + const mapStores: typeof import('pinia')['mapStores'] + const mapWritableState: typeof import('pinia')['mapWritableState'] + const markRaw: typeof import('vue')['markRaw'] + const nextTick: typeof import('vue')['nextTick'] + const onActivated: typeof import('vue')['onActivated'] + const onBeforeMount: typeof import('vue')['onBeforeMount'] + const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave'] + const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate'] + const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] + const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] + const onDeactivated: typeof import('vue')['onDeactivated'] + const onErrorCaptured: typeof import('vue')['onErrorCaptured'] + const onMounted: typeof import('vue')['onMounted'] + const onRenderTracked: typeof import('vue')['onRenderTracked'] + const onRenderTriggered: typeof import('vue')['onRenderTriggered'] + const onScopeDispose: typeof import('vue')['onScopeDispose'] + const onServerPrefetch: typeof import('vue')['onServerPrefetch'] + const onUnmounted: typeof import('vue')['onUnmounted'] + const onUpdated: typeof import('vue')['onUpdated'] + const onWatcherCleanup: typeof import('vue')['onWatcherCleanup'] + const provide: typeof import('vue')['provide'] + const reactive: typeof import('vue')['reactive'] + const readonly: typeof import('vue')['readonly'] + const ref: typeof import('vue')['ref'] + const resolveComponent: typeof import('vue')['resolveComponent'] + const setActivePinia: typeof import('pinia')['setActivePinia'] + const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix'] + const shallowReactive: typeof import('vue')['shallowReactive'] + const shallowReadonly: typeof import('vue')['shallowReadonly'] + const shallowRef: typeof import('vue')['shallowRef'] + const storeToRefs: typeof import('pinia')['storeToRefs'] + const toRaw: typeof import('vue')['toRaw'] + const toRef: typeof import('vue')['toRef'] + const toRefs: typeof import('vue')['toRefs'] + const toValue: typeof import('vue')['toValue'] + const triggerRef: typeof import('vue')['triggerRef'] + const unref: typeof import('vue')['unref'] + const useAttrs: typeof import('vue')['useAttrs'] + const useCssModule: typeof import('vue')['useCssModule'] + const useCssVars: typeof import('vue')['useCssVars'] + const useId: typeof import('vue')['useId'] + const useLink: typeof import('vue-router')['useLink'] + const useModel: typeof import('vue')['useModel'] + const useRoute: typeof import('vue-router')['useRoute'] + const useRouter: typeof import('vue-router')['useRouter'] + const useSlots: typeof import('vue')['useSlots'] + const useTemplateRef: typeof import('vue')['useTemplateRef'] + const watch: typeof import('vue')['watch'] + const watchEffect: typeof import('vue')['watchEffect'] + const watchPostEffect: typeof import('vue')['watchPostEffect'] + const watchSyncEffect: typeof import('vue')['watchSyncEffect'] +} +// for type re-export +declare global { + // @ts-ignore + export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' + import('vue') +} diff --git a/src/components/SelectTable/YQSelectTable/index.vue b/src/components/SelectTable/YQSelectTable/index.vue new file mode 100644 index 0000000..95e15ea --- /dev/null +++ b/src/components/SelectTable/YQSelectTable/index.vue @@ -0,0 +1,46 @@ + + + + \ 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 866eb6a..853dd2f 100644 --- a/src/views/liswork/xtwh/reportsetting/index.vue +++ b/src/views/liswork/xtwh/reportsetting/index.vue @@ -1,8 +1,8 @@ \ No newline at end of file diff --git a/vite/plugins/auto-import.js b/vite/plugins/auto-import.js index a5d3576..ec09020 100644 --- a/vite/plugins/auto-import.js +++ b/vite/plugins/auto-import.js @@ -7,6 +7,7 @@ export default function createAutoImport() { 'vue-router', 'pinia' ], - dts: false + // 2. 生成类型声明文件(解决TS类型报错) + dts: 'src/auto-imports.d.ts', // 生成的.d.ts文件路径(会自动创建) }) } From d233336e634268c9f721c89ee28e64ce58c5ebf4 Mon Sep 17 00:00:00 2001 From: jiangs <373297395@qq.com> Date: Thu, 30 Oct 2025 18:15:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=95=B4=E5=90=88=EF=BC=8C=E6=8A=A5=E5=91=8A=E5=8D=95=E5=AF=B9?= =?UTF-8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/liswork/xtwh/ReportSetting.ts | 27 ++++++ .../SelectTable/YQSelectTable/index.vue | 66 +++++++++++--- src/components/SelectTable/index.vue | 28 +----- src/hooks/lisData/dictData.ts | 40 +++++++++ src/hooks/lisData/index.ts | 1 + src/types/Object.d.ts | 10 +++ src/types/SelectTable.d.ts | 29 +++++++ src/types/index.d.ts | 4 +- .../liswork/xtwh/reportsetting/index.vue | 85 +++++++++++++------ 9 files changed, 225 insertions(+), 65 deletions(-) create mode 100644 src/hooks/lisData/dictData.ts create mode 100644 src/hooks/lisData/index.ts create mode 100644 src/types/SelectTable.d.ts 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