diff --git a/src/api/liswork/xtwh/AntibioticBreakpointApi.ts b/src/api/liswork/xtwh/AntibioticBreakpointApi.ts new file mode 100644 index 0000000..e8c46f2 --- /dev/null +++ b/src/api/liswork/xtwh/AntibioticBreakpointApi.ts @@ -0,0 +1,55 @@ +// 抗生素折点范围字典 API +import request from '@/utils/request' + +// 获取菌属列表(从 xm_meddetail 表) +export function getGermClassList(params?: any) { + return request({ + url: '/xm/meddetail/germclass/list', + method: 'get', + params + }) +} + +// 获取抗生素字典列表(从 xm_med 表) +export function getAntibioticList(params?: any) { + return request({ + url: '/xm/med/list', + method: 'get', + params + }) +} + +// 获取折点范围数据 +export function getBreakpointList(params: any) { + return request({ + url: '/xm/breakpoint/list', + method: 'get', + params + }) +} + +// 保存折点范围 +export function saveBreakpoint(data: any) { + return request({ + url: '/xm/breakpoint', + method: 'post', + data + }) +} + +// 批量保存折点范围 +export function batchSaveBreakpoint(data: any[]) { + return request({ + url: '/xm/breakpoint/batch', + method: 'post', + data + }) +} + +// 删除折点范围 +export function deleteBreakpoint(id: number) { + return request({ + url: `/xm/breakpoint/${id}`, + method: 'delete' + }) +} diff --git a/src/router/index.js b/src/router/index.js index f1858b8..0043562 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -222,6 +222,28 @@ export const dynamicRoutes = [{ } } ] + }, + // ========== 抗生素折点范围字典 ========== + { + path: '/liswork/xtwh/antibioticBreakpoint', + component: Layout, + hidden: false, + permissions: ['liswork:xtwh:antibioticBreakpoint:list'], + meta: { + title: '抗生素折点范围字典', + icon: 'el-icon-menu' + }, + children: [ + { + path: '', + name: 'AntibioticBreakpoint', + component: () => import('@/views/liswork/xtwh/antibioticBreakpoint/index'), + meta: { + title: '抗生素折点范围字典', + noCache: true + } + } + ] } ] diff --git a/src/utils/classCom.ts b/src/utils/classCom.ts index 40b75ec..dc9767a 100644 --- a/src/utils/classCom.ts +++ b/src/utils/classCom.ts @@ -101,34 +101,38 @@ function base64ToBlob(base64: string, mimeType: string) { * @param type 可选,'pdf' | 'excel',不传默认 pdf * @param fileName 可选,excel下载文件名 */ -function printBase64PDF(base64: string, type: 'pdf' | 'excel' = 'pdf', fileName: string = '文件') { - if (type === 'pdf') { - // PDF打印逻辑 - const blob = base64ToBlob(base64, 'application/pdf'); - const pdfUrl = URL.createObjectURL(blob); - const iframe = document.createElement('iframe'); - iframe.style.display = 'none'; - iframe.src = pdfUrl; - document.body.appendChild(iframe); - iframe.onload = () => { - iframe.contentWindow?.print(); - setTimeout(() => { - URL.revokeObjectURL(pdfUrl); - iframe.remove(); // 修复原代码iframe残留dom - }, 1000); - }; - } else if (type === 'excel') { - // excel导出下载逻辑 - const blob = base64ToBlob(base64, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - const downloadUrl = URL.createObjectURL(blob); - const a = document.createElement('a'); - a.href = downloadUrl; - a.download = encodeURIComponent(fileName + '.xlsx'); - document.body.appendChild(a); - a.click(); - a.remove(); - URL.revokeObjectURL(downloadUrl); - } +function printBase64PDF(base64: string) { + // PDF打印逻辑 + const blob = base64ToBlob(base64, 'application/pdf'); + const pdfUrl = URL.createObjectURL(blob); + const iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + iframe.src = pdfUrl; + document.body.appendChild(iframe); + iframe.onload = () => { + iframe.contentWindow?.print(); + setTimeout(() => { + URL.revokeObjectURL(pdfUrl); + iframe.remove(); // 修复原代码iframe残留dom + }, 1000); + }; +} + +/** + * 后端返回Blob文件流 + * @param pdfBlob 后端接口返回的文件流blob,responseType:blob + */ +function printBlobPDF(pdfBlob: Blob, fileName: string) { + + const pdfUrl = URL.createObjectURL(pdfBlob); + const iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + iframe.src = pdfUrl; + document.body.appendChild(iframe); + iframe.onload = () => { + iframe.contentWindow?.print(); + setTimeout(() => URL.revokeObjectURL(pdfUrl), 1000); // 释放内存 + }; } @@ -209,5 +213,35 @@ function calcMeanWithSymbols(arr) { // 保留2位小数返回 return Math.round(avg * 100) / 100 } +/** + * 导出文件(Excel下载) + * @param blob 文件二进制blob + * @param fileName 文件名 + */ +function exportFile(blob: Blob, fileName: string) { + const a = document.createElement('a') + const url = URL.createObjectURL(blob) + a.href = url + a.download = fileName + document.body.appendChild(a) + a.click() + // 释放内存 + URL.revokeObjectURL(url) + a.remove() +} -export const classCom = { decimalToHexColor, convertHexToNumber, getContrastTextColor, printBase64PDF, printPDF, useAutoSize, getDayDiff, calcMeanWithSymbols } + + + +export const classCom = { + decimalToHexColor, + convertHexToNumber, + getContrastTextColor, + printBase64PDF, + printPDF, + useAutoSize, + getDayDiff, + calcMeanWithSymbols, + exportFile, + printBlobPDF +} diff --git a/src/views/liswork/Issueorder/components/info.vue b/src/views/liswork/Issueorder/components/info.vue index 4e789c5..0c9bd37 100644 --- a/src/views/liswork/Issueorder/components/info.vue +++ b/src/views/liswork/Issueorder/components/info.vue @@ -77,7 +77,6 @@ + + diff --git a/src/views/liswork/xtwh/statstemplate/data.vue b/src/views/liswork/xtwh/statstemplate/data.vue index 7b728c5..ca1df9f 100644 --- a/src/views/liswork/xtwh/statstemplate/data.vue +++ b/src/views/liswork/xtwh/statstemplate/data.vue @@ -130,7 +130,8 @@ - + @@ -233,9 +234,8 @@ import { updatestatsparam } from "@/api/liswork/xtwh/StatsparameterApi.ts"; import { liststatstemp, copyParameter } from "@/api/liswork/xtwh/StatstemplateApi.ts"; -import { copy } from "clipboard"; + const route = useRoute(); -// ========== 基础变量声明(避免提前访问) ========== // 菜单名称 const menuname = ref("参数"); const statsCode = ref("1"); @@ -349,7 +349,6 @@ const multiple = ref(true); // 是否多选 const total = ref(0); // 总条数 const title = ref(""); // 对话框标题 -// ========== 工具方法 ========== // 获取类别颜色 function getparamTypeColor(type) { const item = paramTypeOptions.value.find(item => item.value === type); @@ -380,7 +379,6 @@ function resetForm() { } } -// ========== 核心业务方法 ========== // 查询列表 function getList() { loading.value = true; @@ -389,18 +387,12 @@ function getList() { .then(response => { regdictList.value = response?.rows || []; total.value = response?.total || 0; - }) - .catch(() => { - regdictList.value = []; - total.value = 0; - proxy && proxy.$modal.msgError("数据加载失败"); - }) - .finally(() => { + }).finally(() => { loading.value = false; }); - - liststatstemp().then(response => { + //获取模板数据 + liststatstemp({ pageSize: 100, pageNum: 1 }).then(response => { copyTemplateOptions.value = response?.rows || []; }) }