From decd86b21755979e1e684076918ab32726c6b2b0 Mon Sep 17 00:00:00 2001 From: jiangs <373297395@qq.com> Date: Mon, 27 Oct 2025 18:15:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E9=AA=8C=E9=A1=B9=E7=9B=AE=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eslint.config.js | 67 +++++- package.json | 2 + pnpm-lock.yaml | 185 +++++++++++++++ src/store/modules/dictData.ts | 28 +++ src/views/liswork/labItem/index.vue | 245 ++++++++++++++------ src/views/liswork/labItem/tab/basic.vue | 290 +++++++++++++++++++++++- 6 files changed, 729 insertions(+), 88 deletions(-) create mode 100644 src/store/modules/dictData.ts diff --git a/eslint.config.js b/eslint.config.js index 22436a8..06c1998 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,30 +2,81 @@ import js from "@eslint/js"; import globals from "globals"; import pluginVue from "eslint-plugin-vue"; import { defineConfig } from "eslint/config"; - +// 引入 TypeScript ESLint 插件和解析器 +import tsParser from "@typescript-eslint/parser"; +import tsPlugin from "@typescript-eslint/eslint-plugin"; export default defineConfig([ - { files: ["**/*.{js,mjs,cjs,vue}"], plugins: { js }, extends: ["js/recommended"] }, - { files: ["**/*.{js,mjs,cjs,vue}"], languageOptions: { globals: globals.browser } }, + // 1. 基础 JS 规则(适用于 JS/Vue 文件) + { + files: ["**/*.{js,mjs,cjs,vue}"], + plugins: { js }, + extends: ["js/recommended"] + }, + // 2. 浏览器环境全局变量(适用于 JS/Vue/TS 文件) + { + files: ["**/*.{js,mjs,cjs,vue,ts,tsx}"], + languageOptions: { + globals: globals.browser + } + }, + // 3. Vue 基础规则 pluginVue.configs["flat/essential"], + // 4. Auto-import 插件配置(保持不变) { plugins: { 'auto-import': { - extensions: ['.js', '.mjs', '.jsx', '.vue'], + extensions: ['.js', '.mjs', '.jsx', '.vue', '.ts', '.tsx'], // 增加 TS 扩展名 }, }, }, + // 5. TypeScript 专属配置(核心) + { + // 仅对 TS/TSX 文件生效 + files: ["**/*.{ts,tsx}"], + // 指定 TS 解析器 + languageOptions: { + parser: tsParser, + // 解析器选项(需与 tsconfig.json 匹配) + parserOptions: { + ecmaVersion: "latest", // 支持最新 ES 语法 + sourceType: "module", // 模块类型(ESM) + project: "./tsconfig.json", // 指向项目的 tsconfig.json(启用类型检查) + tsconfigRootDir: process.cwd(), // 确保找到 tsconfig.json 的根目录 + }, + }, + // 引入 TS 插件 + plugins: { + "@typescript-eslint": tsPlugin, + }, + // 继承 TS 推荐规则(可选,按需调整) + extends: [ + "plugin:@typescript-eslint/recommended", // 基础推荐规则 + "plugin:@typescript-eslint/recommended-requiring-type-checking" // 依赖类型检查的规则(需 project 配置) + ], + // TS 专属规则(可自定义) + rules: { + // 示例:禁用某些严格规则(根据需求调整) + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-explicit-any": "warn" + } + }, + // 6. 全局规则(覆盖所有文件) { rules: { - //'auto-import/export': 'error', + // 可在此处添加适用于所有文件的规则 + // 例如关闭不必要的规则 + "no-undef": "off" // TS 已有类型检查,可关闭 JS 的 undef 检查 }, }, + // 7. Auto-import 配置(增加 TS 支持) { settings: { 'auto-import': { - // 自动导入的模块配置,与 unplugin-auto-import 配置一致 - imports: ['vue'], + imports: ['vue', 'vue-router'], // 自动导入的模块 + // 增加 TS 扩展名 + extensions: ['.js', '.mjs', '.jsx', '.vue', '.ts', '.tsx'], }, }, }, -]); +]); \ No newline at end of file diff --git a/package.json b/package.json index e14f884..2948b7a 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,8 @@ "devDependencies": { "@eslint/js": "^9.27.0", "@types/vue": "^2.0.0", + "@typescript-eslint/eslint-plugin": "^8.46.2", + "@typescript-eslint/parser": "^8.46.2", "@vitejs/plugin-vue": "5.0.1", "@vue/compiler-sfc": "3.4.0", "eslint": "^9.27.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3b3c7a9..69720bb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -108,6 +108,12 @@ importers: '@types/vue': specifier: ^2.0.0 version: 2.0.0(typescript@5.9.3) + '@typescript-eslint/eslint-plugin': + specifier: ^8.46.2 + version: 8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.27.0)(typescript@5.9.3))(eslint@9.27.0)(typescript@5.9.3) + '@typescript-eslint/parser': + specifier: ^8.46.2 + version: 8.46.2(eslint@9.27.0)(typescript@5.9.3) '@vitejs/plugin-vue': specifier: 5.0.1 version: 5.0.1(vite@5.0.4(@types/node@22.13.9)(sass@1.69.5))(vue@3.4.0(typescript@5.9.3)) @@ -592,6 +598,65 @@ packages: '@types/web-bluetooth@0.0.20': resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} + '@typescript-eslint/eslint-plugin@8.46.2': + resolution: {integrity: sha512-ZGBMToy857/NIPaaCucIUQgqueOiq7HeAKkhlvqVV4lm089zUFW6ikRySx2v+cAhKeUCPuWVHeimyk6Dw1iY3w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + '@typescript-eslint/parser': ^8.46.2 + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/parser@8.46.2': + resolution: {integrity: sha512-BnOroVl1SgrPLywqxyqdJ4l3S2MsKVLDVxZvjI1Eoe8ev2r3kGDo+PcMihNmDE+6/KjkTubSJnmqGZZjQSBq/g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/project-service@8.46.2': + resolution: {integrity: sha512-PULOLZ9iqwI7hXcmL4fVfIsBi6AN9YxRc0frbvmg8f+4hQAjQ5GYNKK0DIArNo+rOKmR/iBYwkpBmnIwin4wBg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/scope-manager@8.46.2': + resolution: {integrity: sha512-LF4b/NmGvdWEHD2H4MsHD8ny6JpiVNDzrSZr3CsckEgCbAGZbYM4Cqxvi9L+WqDMT+51Ozy7lt2M+d0JLEuBqA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/tsconfig-utils@8.46.2': + resolution: {integrity: sha512-a7QH6fw4S57+F5y2FIxxSDyi5M4UfGF+Jl1bCGd7+L4KsaUY80GsiF/t0UoRFDHAguKlBaACWJRmdrc6Xfkkag==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/type-utils@8.46.2': + resolution: {integrity: sha512-HbPM4LbaAAt/DjxXaG9yiS9brOOz6fabal4uvUmaUYe6l3K1phQDMQKBRUrr06BQkxkvIZVVHttqiybM9nJsLA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/types@8.46.2': + resolution: {integrity: sha512-lNCWCbq7rpg7qDsQrd3D6NyWYu+gkTENkG5IKYhUIcxSb59SQC/hEQ+MrG4sTgBVghTonNWq42bA/d4yYumldQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/typescript-estree@8.46.2': + resolution: {integrity: sha512-f7rW7LJ2b7Uh2EiQ+7sza6RDZnajbNbemn54Ob6fRwQbgcIn+GWfyuHDHRYgRoZu1P4AayVScrRW+YfbTvPQoQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/utils@8.46.2': + resolution: {integrity: sha512-sExxzucx0Tud5tE0XqR0lT0psBQvEpnpiul9XbGUB1QwpWJJAps1O/Z7hJxLGiZLBKMCutjTzDgmd1muEhBnVg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/visitor-keys@8.46.2': + resolution: {integrity: sha512-tUFMXI4gxzzMXt4xpGJEsBsTox0XbNQ1y94EwlD/CuZwFcQP79xfQqMhau9HsRc/J0cAPA/HZt1dZPtGn9V/7w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@vitejs/plugin-vue@5.0.1': resolution: {integrity: sha512-lwvZX5tDhJpRJEKsjoUSWgaD26Lk9X4aDYGAPpr/Q6cLTT3PC8LPu2dsnYEweAZiNgHsbyKL2Svc/CDrFOsbtw==} engines: {node: ^18.0.0 || >=20.0.0} @@ -1170,6 +1235,10 @@ packages: resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint-visitor-keys@4.2.1: + resolution: {integrity: sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint@9.27.0: resolution: {integrity: sha512-ixRawFQuMB9DZ7fjU3iGGganFDp3+45bPOdaRurcFHSXO1e/sYwUX/FtQZpLZJR6SjMoJH8hR2pPEAfDyCoU2Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1388,6 +1457,9 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + has-ansi@2.0.0: resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==} engines: {node: '>=0.10.0'} @@ -1454,6 +1526,10 @@ packages: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} + ignore@7.0.5: + resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} + engines: {node: '>= 4'} + image-size@0.5.5: resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==} engines: {node: '>=0.10.0'} @@ -2394,6 +2470,12 @@ packages: resolution: {integrity: sha512-vxXDZg8/+p3gblxB6BhhG5yWVn1kGRlaL8O78UDXc3wRnPizB5g83dcvWV1jpDMIPnjZjOFuxlMmE82XJ4407w==} engines: {node: '>= 0.4'} + ts-api-utils@2.1.0: + resolution: {integrity: sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==} + engines: {node: '>=18.12'} + peerDependencies: + typescript: '>=4.8.4' + ts-morph@9.1.0: resolution: {integrity: sha512-sei4u651MBenr27sD6qLDXN3gZ4thiX71E3qV7SuVtDas0uvK2LtgZkIYUf9DKm/fLJ6AB/+yhRJ1vpEBJgy7Q==} @@ -2983,6 +3065,99 @@ snapshots: '@types/web-bluetooth@0.0.20': {} + '@typescript-eslint/eslint-plugin@8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.27.0)(typescript@5.9.3))(eslint@9.27.0)(typescript@5.9.3)': + dependencies: + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 8.46.2(eslint@9.27.0)(typescript@5.9.3) + '@typescript-eslint/scope-manager': 8.46.2 + '@typescript-eslint/type-utils': 8.46.2(eslint@9.27.0)(typescript@5.9.3) + '@typescript-eslint/utils': 8.46.2(eslint@9.27.0)(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.46.2 + eslint: 9.27.0 + graphemer: 1.4.0 + ignore: 7.0.5 + natural-compare: 1.4.0 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/parser@8.46.2(eslint@9.27.0)(typescript@5.9.3)': + dependencies: + '@typescript-eslint/scope-manager': 8.46.2 + '@typescript-eslint/types': 8.46.2 + '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.46.2 + debug: 4.4.0 + eslint: 9.27.0 + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/project-service@8.46.2(typescript@5.9.3)': + dependencies: + '@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.9.3) + '@typescript-eslint/types': 8.46.2 + debug: 4.4.0 + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/scope-manager@8.46.2': + dependencies: + '@typescript-eslint/types': 8.46.2 + '@typescript-eslint/visitor-keys': 8.46.2 + + '@typescript-eslint/tsconfig-utils@8.46.2(typescript@5.9.3)': + dependencies: + typescript: 5.9.3 + + '@typescript-eslint/type-utils@8.46.2(eslint@9.27.0)(typescript@5.9.3)': + dependencies: + '@typescript-eslint/types': 8.46.2 + '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) + '@typescript-eslint/utils': 8.46.2(eslint@9.27.0)(typescript@5.9.3) + debug: 4.4.0 + eslint: 9.27.0 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/types@8.46.2': {} + + '@typescript-eslint/typescript-estree@8.46.2(typescript@5.9.3)': + dependencies: + '@typescript-eslint/project-service': 8.46.2(typescript@5.9.3) + '@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.9.3) + '@typescript-eslint/types': 8.46.2 + '@typescript-eslint/visitor-keys': 8.46.2 + debug: 4.4.0 + fast-glob: 3.3.3 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.7.1 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/utils@8.46.2(eslint@9.27.0)(typescript@5.9.3)': + dependencies: + '@eslint-community/eslint-utils': 4.7.0(eslint@9.27.0) + '@typescript-eslint/scope-manager': 8.46.2 + '@typescript-eslint/types': 8.46.2 + '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) + eslint: 9.27.0 + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/visitor-keys@8.46.2': + dependencies: + '@typescript-eslint/types': 8.46.2 + eslint-visitor-keys: 4.2.1 + '@vitejs/plugin-vue@5.0.1(vite@5.0.4(@types/node@22.13.9)(sass@1.69.5))(vue@3.4.0(typescript@5.9.3))': dependencies: vite: 5.0.4(@types/node@22.13.9)(sass@1.69.5) @@ -3707,6 +3882,8 @@ snapshots: eslint-visitor-keys@4.2.0: {} + eslint-visitor-keys@4.2.1: {} + eslint@9.27.0: dependencies: '@eslint-community/eslint-utils': 4.7.0(eslint@9.27.0) @@ -3974,6 +4151,8 @@ snapshots: graceful-fs@4.2.11: {} + graphemer@1.4.0: {} + has-ansi@2.0.0: dependencies: ansi-regex: 2.1.1 @@ -4040,6 +4219,8 @@ snapshots: ignore@5.3.2: {} + ignore@7.0.5: {} + image-size@0.5.5: {} immutable@4.3.7: {} @@ -5081,6 +5262,10 @@ snapshots: typedarray.prototype.slice: 1.0.5 which-typed-array: 1.1.18 + ts-api-utils@2.1.0(typescript@5.9.3): + dependencies: + typescript: 5.9.3 + ts-morph@9.1.0: dependencies: '@dsherret/to-absolute-glob': 2.0.2 diff --git a/src/store/modules/dictData.ts b/src/store/modules/dictData.ts new file mode 100644 index 0000000..20e0799 --- /dev/null +++ b/src/store/modules/dictData.ts @@ -0,0 +1,28 @@ +//字典数据管理 +import { defineStore } from 'pinia' + +// export const useDictDataStore = defineStore('dictData', { +// state: () => ({ +// dictData: { +// XMGL: [], +// ITEMCLASS: [] +// } +// }), +// actions: { +// setDictData(data: any) { +// this.dictData = { ...this.dictData, ...data } +// } +// } +// }) + +//仪器数据 +export const useYQStore = defineStore('yqStore', { + state: () => ({ + yqList: [] as any[], // 存储仪器列表 + }), + actions: { + setYQList(data: any[]) { + this.yqList = data + } + } +}) diff --git a/src/views/liswork/labItem/index.vue b/src/views/liswork/labItem/index.vue index a4b44e3..83dccb6 100644 --- a/src/views/liswork/labItem/index.vue +++ b/src/views/liswork/labItem/index.vue @@ -3,34 +3,40 @@ - - - + + + - - + + - - + + - + - + - + - - 在用 - 停用 - 所有 + + 在用 + 停用 + 所有 - + @@ -42,44 +48,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + +
- 基本资料 - 常用取值 - 使用仪器 - 知识库 - 整体排序 - 常见描述 + 基本资料 + 常用取值 + 使用仪器 + 知识库 + 整体排序 + 常见描述
-
+
@@ -99,58 +88,142 @@ import CommmonlyValues from './tab/commmonlyValues.vue' import UseInstr from './tab/useInstr.vue' import Knowledge from './tab/knowledge.vue' import CommonDescriptions from './tab/commonDescriptions.vue' +import CustomTable from '@/components/elTable/index.vue' import Sort from './tab/sort.vue' import { queryXmInfoNewService } from '@/api/liswork/labItem/LabItem'; //@ts-ignore import { comDict } from '@/utils/dict' +import SelectTable from '@/components/SelectTable/index.vue' +import { getGroupInstrdList } from '@/api/liswork/work/LisWork'; interface DictData { XMGL?: Array; + ITEMCLASS?: Array; + YQDL?: Array; + xmlbList?: Array; [key: string]: any[] | undefined; // 添加索引签名以支持动态访问 } - -const status = ref(1); -const isMIC = ref(false); -const dataList = ref([]) -const tabVisible = ref('1') -const queryParams = ref() +const xmlbList = ref>([ + { label: '数值型', value: '1' }, + { label: '文字型', value: '2' }, + { label: '阴阳性型', value: '3' }, + { label: '数值文字混合型', value: '4' } +]) +const dataList = ref>([]) +const tabVisible = ref('1') +const queryParams = ref({ + xmgl: '', //项目归类 + itemclass: '' , //细菌标志 + yq: '', //仪器代号 + inputcode: '', //快速查找 + yqdl: '', //仪器大类 + xmid: '' , //项目ID + uflag: '0' , //状态 + isMIC: false || null //是否隐藏微生物项目 +}) //字典数据 const dictData = ref({}); +const tableRef = ref() +const tabCheck = ref('1'); +const xmglFields = ref([ + { prop: 'value', label: '代号', width: 80, enablePinyinSearch: true }, + { prop: 'label', label: '名称', enablePinyinSearch: true }, +]) +const itemclassFields = ref([ + { prop: 'value', label: '代号', width: 80, enablePinyinSearch: true }, + { prop: 'label', label: '名称', enablePinyinSearch: true }, +]) +const instrOptions = ref<{ yq: string; yqmc: string }[]>([]) +//table表格列 +const columns = ref([ + { prop: 'xmgl', label: '项目归类', visible: true, align: 'center', slot: 'xmgl', width: 100 }, + { prop: 'xmdh', label: '英文缩写', visible: true, align: 'center'}, + { prop: 'xmmc', label: '名称', visible: true, align: 'center', width: 200 }, + { prop: 'dyckz', label: '参考值', visible: true, align: 'center', width: 100 }, + { prop: 'dw', label: '单位', visible: true, align: 'center', width: 100 }, + { prop: 'xmlb', label: '结果类型', visible: true, align: 'center', slot: 'xmlb', width: 100 }, + { prop: 'jsxm', label: '计算项目', visible: true, align: 'center', width: 100 }, + { prop: 'dyxh', label: '序号', visible: true, align: 'center', width: 100 }, + { prop: 'xs', label: '调整系数', visible: true, align: 'center', width: 100 }, + { prop: 'xsws', label: '小数位数', visible: true, align: 'center', width: 100 }, + { prop: 'xsbs', label: '稀释倍数', visible: true, align: 'center', width: 100 }, + { prop: 'uflag', label: '停用', visible: true, align: 'center', width: 100 }, + { prop: 'yqdl', label: '仪器大类', visible: true, align: 'center', width: 100 }, + { prop: 'xmid', label: '项目ID', visible: true, align: 'center', width: 100 }, + { prop: 'knowledge', label: '项目编码', visible: true, align: 'center', width: 100 }, + { prop: 'val1', label: '外部代码1', visible: true, align: 'center', width: 100 }, + { prop: 'val2', label: '外部代码2', visible: true, align: 'center', width: 100 }, + { prop: 'val3', label: '外部代码3', visible: true, align: 'center', width: 100 }, + { prop: 'yymc', label: '英文名称', visible: true, align: 'center', width: 100 }, + { prop: 'qccv', label: '允许CA(%)', visible: true, align: 'center', width: 100 }, +]) -onMounted(async () => { - // 初始化数据 - const dictRefs = await comDict('XMGL'); - // 从 ref 中获取实际数据 - dictData.value = { - XMGL: toRaw(dictRefs.XMGL.value) || [] - }; +const tableConfig = ref({ + border: true, // 边框 + height: '66vh', // 高度 + highlightCurrentRow: true, // 高亮当前行 + // cellStyle: cellStyleHd +}) +//仪器 +const yqFields = ref([ + { prop: 'yq', label: '代号', width: 80, enablePinyinSearch: true }, + { prop: 'yqmc', label: '名称', width: 150, enablePinyinSearch: true }, +]) +//仪器大类 +const yqdlFields = ref([ + { prop: 'value', label: '代号', width: 80, enablePinyinSearch: true }, + { prop: 'label', label: '名称', width: 150, enablePinyinSearch: true }, +]) +const yqdlList = ref>() +// 仪器选择变化 +const yqHandleChange = (val: any) => { + queryParams.value.yq = val; +} + +// 仪器 +const getYqConfig = () => { + getGroupInstrdList() + .then((res: any) => { + if (res.code == 0) { + instrOptions.value = res.data.map((item: any) => ({ + yq: item.yq.trim(), + yqmc: item.yqmc + })) + } + }) +} + +//获取表格数据 +const getList = () => { queryXmInfoNewService(queryParams.value).then((res: any) => { dataList.value = res.rows; }) - +} + +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 || [] + }; + getList() + getYqConfig(); }) // 引入公共组件的字典格式化方法 const formatDict = (v: string, dictType: string) => { - console.log('传入的值v:', v); - const dictArray = dictData.value[dictType]; - console.log('对应的字典数组dictArray:', dictArray); - dictArray?.forEach(item => { - console.log('数组元素value:', item.value, '类型:', typeof item.value); - }); - const matchedItem = dictArray?.find((item: any) => item.value == v); - console.log('匹配到的item:', matchedItem); // 关键:看是否为undefined - const abc = matchedItem?.label; - console.log('字典数据abc', abc); - return abc; - + return dictData.value[dictType]?.find((item: any) => item.value == v.trim())?.label; } //新增 @@ -175,7 +248,29 @@ const handleSave = () => { //标签切换 const handleTabClick = (tab: string) => { + tabCheck.value = tab; tabVisible.value = tab } - \ No newline at end of file +//退拽属性 +const handleColumnDragEnd = (data: any) => { + // 更新列配置 + columns.value = data.columns; +} + +//状态改变 +const changeStauts = () => { + if(!queryParams.value.isMIC){ + queryParams.value.isMIC = null; + } + getList(); +} + + + + \ No newline at end of file diff --git a/src/views/liswork/labItem/tab/basic.vue b/src/views/liswork/labItem/tab/basic.vue index 6acc781..63d4c42 100644 --- a/src/views/liswork/labItem/tab/basic.vue +++ b/src/views/liswork/labItem/tab/basic.vue @@ -1,16 +1,178 @@ \ No newline at end of file +interface DictData { + XMGL?: Array; + [key: string]: any[] | undefined; // 添加索引签名以支持动态访问 +} + + +const formRef = ref(); +const formData = ref({ + xmgl: '', + xmdh: '', + xmmc: '', + dw: '', + xmlb: '', + mrz: '', + yqdl: '', + qccv: '', + xsbs: '', + whocode: '', + germflag: '', + yymc: '', + xmid: '', + uflag: false, + knowledge: '', + xsws: 0, + dylx: '', + zhbdh: '', + bgdh: '', + jg: 0, + zjf: '', + csff: '', + fzdyxh: 0, + itemclass: '', + ckxx: '', + cksx: '', + dyckz: '', + jsgs: '', + ygxb: false, + ygnl: false, + ygbb: false, + ygzq: false, + ygzd: false, + jsxm: false, + sjx: '', + xjx: '', + jgjg: '', + cp_jgz: '', + hlimt: '', + llimit: '', + redoxx: '', + redosx: '', + val1: '', + val2: '', + val3: '', + val4: '', + val5: '' +} +); +//字典数据 +const dictData = ref({}); + +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){ + case '1': + formData.value.cp_jgz = formData.value.jgz; + break; + case '2': + formData.value.cp_jgz = formData.value.jgz + '%'; + break + } +}); + +onMounted(async () => { + // 初始化数据 + 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; +} + + + + + \ No newline at end of file