From 20c663592d418ba38ca566ce14ffb2420ca30dd7 Mon Sep 17 00:00:00 2001 From: wyuu Date: Sat, 28 Feb 2026 17:56:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/liswork/xtwh/StatsparameterApi.ts | 10 +++ src/views/checkCode/index.vue | 19 +++-- .../statisticalAnalysis/report/index.vue | 79 +++++++++++++------ 3 files changed, 78 insertions(+), 30 deletions(-) diff --git a/src/api/liswork/xtwh/StatsparameterApi.ts b/src/api/liswork/xtwh/StatsparameterApi.ts index c6f5be8..c302caa 100644 --- a/src/api/liswork/xtwh/StatsparameterApi.ts +++ b/src/api/liswork/xtwh/StatsparameterApi.ts @@ -53,3 +53,13 @@ export function getstatsTemplate(params: any) { params }) } + +// 模板参数查询详细信息 +export function getstatsQuery(params: any) { + return request({ + url: '/stats/query', + method: 'post', + data: params + }) +} + diff --git a/src/views/checkCode/index.vue b/src/views/checkCode/index.vue index b9da1fc..77270fa 100644 --- a/src/views/checkCode/index.vue +++ b/src/views/checkCode/index.vue @@ -54,7 +54,7 @@ 选中所有未打印 - 打印条码 + 打印条码 采样登记 @@ -723,6 +723,7 @@ const handletime = (val: Array) => { const btnLoading = ref(false); +const dybtnLoading = ref(false); // 生成条码 const printHandle = () => { btnLoading.value = true; @@ -809,19 +810,23 @@ const printPdf = () => { ElMessageBox.confirm(`确定打印选中的数据吗?`, "提示", { confirmButtonText: "确认", cancelButtonText: "取消", - beforeClose: async (action, instance, done) => { + beforeClose: (action, instance, done) => { if (action === "confirm") { + dybtnLoading.value = true; const requests = selections.map((item: any) => item.sqh) - const res = await fetchCodeExec({ + fetchCodeExec({ sqh: requests.join(','), userid: queryParams.userid, status: 11, yljg: queryParams.yljg + }).then((res: any) => { + if (res.code == 0) { + done() + getList() + } + }).finally(() => { + dybtnLoading.value = false; }) - if (res.code == 0) { - done() - getList() - } } else { done() } diff --git a/src/views/statisticalAnalysis/report/index.vue b/src/views/statisticalAnalysis/report/index.vue index 98779ae..9f1455a 100644 --- a/src/views/statisticalAnalysis/report/index.vue +++ b/src/views/statisticalAnalysis/report/index.vue @@ -69,8 +69,7 @@ import { getComDicts, } from "@/api/liswork/dict/ComDict"; import { useCommonStore } from '@/store/modules/commonStore'; import { classCom } from '@/utils/classCom'; -import { listhospital } from "@/api/regional/dict/hospital.js"; -import { getstatsTemplate } from "@/api/liswork/xtwh/StatsparameterApi"; +import { getstatsTemplate, getstatsQuery } from "@/api/liswork/xtwh/StatsparameterApi"; import { listUser } from '@/api/system/user.js' import useUserStore from '@/store/modules/user' import { getDictData, formatDict } from '@/hooks' @@ -92,7 +91,7 @@ const coloums = ref([]) //固定列 const checkBoxs = ref([]) const tableColumns = ref([]); - +const Template = ref({}) const instrGroupOptions = ref([]) @@ -115,39 +114,72 @@ const loadinstrGroupOptions = () => { } const handletime = () => { - const dayDiff = classCom.getDayDiff(queryParams.st, queryParams.et) - if (dayDiff === -1 || dayDiff === -2) return ElMessage.warning('请选择有效的日期范围'); + // const dayDiff = classCom.getDayDiff(queryParams.st, queryParams.et) + // if (dayDiff === -1 || dayDiff === -2) return ElMessage.warning('请选择有效的日期范围'); } const search = () => { - console.log('Parameter==>', Parameter.value); + const checkedCols = [...coloums.value, ...checkBoxs.value]; + console.log('checkedCols==>', checkedCols); + const arr = []; + + tableColumns.value.forEach((tableItem, tableIndex) => { + const matchItem = checkedCols.find( + (checkItem) => checkItem.paramName === tableItem.label + ); + if (matchItem) { + arr.push({ + ...matchItem, + paramSort: tableIndex, + }); + } + }); + + const unmatchedItems = checkedCols.filter( + (checkItem) => !tableColumns.value.some((tableItem) => tableItem.label === checkItem.paramName) + ); + + unmatchedItems.forEach((item, unmatchIndex) => { + arr.push({ + ...item, + paramSort: tableColumns.value.length + unmatchIndex, + }); + }); + + const data = { + Parameter: Parameter.value, + Column: arr, + Template: Template.value + }; + console.log('data==>', data); + getstatsQuery(data).then(res => { + tableData.value = res.data + }) }; const print = () => { }; const handleCheckBoxChange = (val) => { - tableColumns.value = val.map(paramCode => { + + const checkedCols = val.map(paramCode => { const matchItem = checkBoxs.value.find(item => item.paramCode === paramCode); - return matchItem ? { - label: matchItem.paramName, - prop: matchItem.paramCode, - } : null; - }) - const arr = coloums.value.map(item => { - return { - label: item.paramName, - prop: item.paramCode, - } - }) - tableColumns.value = tableColumns.value.concat(arr) + return matchItem ? { label: matchItem.paramName, prop: matchItem.paramCode } : null; + }).filter(Boolean); // 过滤null + + + const fixedCols = coloums.value.map(item => ({ + label: item.paramName, + prop: item.paramCode, + })); + + + tableColumns.value = [...checkedCols, ...fixedCols]; } - - - +// 获取模板参数 const getParams = () => { - getstatsTemplate({ statsCode: route.query && route.query.statsCode, }).then(res => { + getstatsTemplate({ StatsCode: route.query && route.query.statsCode, }).then(res => { Parameter.value = res.data.Parameter tableColumns.value = res.data.Column.filter(item => item.paramType == '6').map(item => { return { @@ -160,6 +192,7 @@ const getParams = () => { coloums.value = res.data.Column.filter(item => item.paramType == '6') checkBoxs.value = res.data.Column.filter(item => item.paramType != '6') + Template.value = res.data.Template statsTitle.value = res.data.Template.statsTitle }) };