From 8a8a61799f9c13004c3e6632dd628c62bf62017d Mon Sep 17 00:00:00 2001 From: wyuu Date: Mon, 26 Jan 2026 17:41:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=A1=E7=A0=81=E6=89=93=E5=8D=B0=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/checkCode/index.ts | 16 +++ src/assets/styles/index.scss | 1 - src/plugins/download.js | 2 +- src/utils/hiprintPrinter.ts | 12 +- src/utils/printHelper.ts | 50 ++++++++ src/views/checkCode/index.vue | 110 +++++++--------- src/views/checkCode/report/index.vue | 14 +-- src/views/lisquery/reportQuery/index.vue | 6 +- .../qualityControl/indoorStatistics/index.vue | 17 ++- .../liswork/qualityControl/qcgraph/index.vue | 63 ++++++++-- src/views/regional/circulation/zycy/index.vue | 119 ++++++++++-------- .../inspectionReport/report/index.vue | 6 +- 12 files changed, 261 insertions(+), 155 deletions(-) create mode 100644 src/utils/printHelper.ts diff --git a/src/api/checkCode/index.ts b/src/api/checkCode/index.ts index 8565d27..c7e25da 100644 --- a/src/api/checkCode/index.ts +++ b/src/api/checkCode/index.ts @@ -99,4 +99,20 @@ export function reportFsresult(query?: Object) { data: query, }); } +// 打印机插件检查 +export function printcheck(query?: Object) { + return request({ + url: '/zyreq/printcheck', + method: 'get', + params: query, + }); +} +// 打印机插件设置 +export function printsetup(query?: Object) { + return request({ + url: '/zyreq/printsetup', + method: 'get', + params: query, + }); +} diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss index f298b78..2ec7bcb 100644 --- a/src/assets/styles/index.scss +++ b/src/assets/styles/index.scss @@ -125,7 +125,6 @@ aside { .app-container { padding: 10px 10px 0 10px; height: calc(100vh - 5.25rem); - overflow: auto; } .components-container { diff --git a/src/plugins/download.js b/src/plugins/download.js index 17584f9..7653a31 100644 --- a/src/plugins/download.js +++ b/src/plugins/download.js @@ -29,7 +29,7 @@ export default { 'Authorization': 'Bearer ' + getToken() }, onDownloadProgress: (progressEvent) => { - console.log(progressEvent) + // console.log(progressEvent) //progressEvent.loaded 下载文件的当前大小 //progressEvent.total 下载文件的总大小 如果后端没有返回 请让他加上 let progressPercent = Math.round((progressEvent.loaded / progressEvent.total) * 100); diff --git a/src/utils/hiprintPrinter.ts b/src/utils/hiprintPrinter.ts index a748ec2..213c7b0 100644 --- a/src/utils/hiprintPrinter.ts +++ b/src/utils/hiprintPrinter.ts @@ -69,7 +69,7 @@ function initSocket(onPrinterUpdate?: OnPrinterUpdate) { socket.on("connect_error", (err: Error) => { console.log('连接错误', err); ElMessageBox.alert( - `连接失败!
请确保目标服务器已下载安装 并 运行 打印服务!`, + `连接失败!
请确保目标服务器已下载安装 并 运行 打印服务!`, "客户端未连接", { dangerouslyUseHTMLString: true, @@ -83,10 +83,10 @@ function initSocket(onPrinterUpdate?: OnPrinterUpdate) { } -const downExe = () => { +const downExehiprint = () => { // 下载逻辑实现 // console.log('开始下载打印服务'); - Download.name('hiprint_win_x64-1.0.13.exe', false) + // Download.name('hiprint_win_x64-1.0.13.exe', false) }; const yxHiprint = () => { // 唤起客户端 @@ -94,7 +94,7 @@ const yxHiprint = () => { }; // 挂载到window,使其能被全局访问 -(window as any).downExe = downExe; +(window as any).downExehiprint = downExehiprint; (window as any).yxHiprint = yxHiprint; @@ -183,7 +183,7 @@ export const HiprintPrinter = { }; // onUnmounted(() => { -// if ('downExe' in window) { -// delete (window as any).downExe; +// if ('downExehiprint' in window) { +// delete (window as any).downExehiprint; // } // }); \ No newline at end of file diff --git a/src/utils/printHelper.ts b/src/utils/printHelper.ts new file mode 100644 index 0000000..88ae907 --- /dev/null +++ b/src/utils/printHelper.ts @@ -0,0 +1,50 @@ +/** + * @file printHelper.ts 检查打印服务连接状态 + * @author: w + * @since: 2026-01-26 + */ + +import { ElMessageBox, ElMessage } from 'element-plus' +import { printcheck } from '@/api/checkCode/index' +// @ts-ignore +import Download from '@/plugins/download' + + +export const checkPrintService = async (): Promise => { //连接成功返回true,失败返回false + try { + const res = await printcheck() + if (res.code == 0) { + return true + } else { + await showPrintServiceError(res.msg) + return false + } + } catch (error) { + console.error('打印服务检查失败:', error) + await showPrintServiceError('打印服务连接异常') + return false + } +} + + +export const showPrintServiceError = async (msg: string) => { + // 挂载downExe方法到window,供提示框内的onclick调用 + if (!(window as any).downExe) { + (window as any).downExe = () => { + Download.name('lisprintsetup.exe', false) + } + } + + await ElMessageBox.alert( + `${msg}!
请确保目标服务器已下载安装 并运行打印服务!`, + "客户端未连接", + { + dangerouslyUseHTMLString: true, + } + ) +} + +//触发打印服务安装包下载 +export const downloadPrintSetup = () => { + Download.name('lisprintsetup.exe', false) +} \ No newline at end of file diff --git a/src/views/checkCode/index.vue b/src/views/checkCode/index.vue index aa64449..7718ee5 100644 --- a/src/views/checkCode/index.vue +++ b/src/views/checkCode/index.vue @@ -47,7 +47,8 @@ - 生成条码 + 生成条码 选中所有未打印 @@ -72,9 +73,6 @@ 打印机设置 - @@ -173,9 +171,10 @@ import CustomTable from '@/components/elTable/index.vue' import CustomVxeTable from '@/components/vxeTable/index.vue' import { useRouter, useRoute } from 'vue-router' import { usePrintStore } from '@/store/modules/printStore' +import { checkPrintService, downloadPrintSetup } from '@/utils/printHelper' // @ts-ignore import { getUserName } from '@/api/system/user.js' -import { fetchCodeList, addObj, fetchCodeDetail, fetchCodeExec, fetchCodeReqmain, printSendSample } from '@/api/checkCode/index' +import { fetchCodeList, addObj, fetchCodeDetail, fetchCodeExec, fetchCodeReqmain, printSendSample, printcheck, printsetup } from '@/api/checkCode/index' const aotuSize = classCom.useAutoSize(); //@ts-ignore import useUserStore from '@/store/modules/user' @@ -195,7 +194,6 @@ import { getDicts } from '@/api/system/dict/data' //@ts-ignore const { proxy } = getCurrentInstance(); const { lis_reqcx_type } = proxy.useDict("lis_reqcx_type"); //参数类别 -const printName = ref(printStore.defaultPrinter || ''); const lisReqs: any = ref([]) @@ -355,10 +353,9 @@ const timelineItems = ref( [ { title: '检验申请', time: '' }, { title: '标本采集', time: '' }, - { title: '上机检验', time: '' }, { title: '标本送检', time: '' }, - // { title: '检验接收', time: '' }, { title: '标本签收', time: '' }, + { title: '上机检验', time: '' }, { title: '结果审核', time: '' }, ] ); @@ -381,10 +378,9 @@ const rowHandle = (row: any) => { [ { title: '检验申请', time: row.sqsj }, { title: '标本采集', time: row.cysj }, - { title: '上机检验', time: row.zxsj }, { title: '标本送检', time: row.bbsjsj }, - // { title: '检验接收', time: row.jssj}, { title: '标本签收', time: row.jssj }, + { title: '上机检验', time: row.sjsj }, { title: '结果审核', time: row.confirmtime }, ] Info.value = row @@ -586,7 +582,7 @@ const cancelHandle = () => { }).catch(() => { }); } - +// 清单打印 const sendSampleHandle = () => { const selections = tableRef.value.allSelection() if (selections.length <= 0) return ElMessage.warning('请选择数据!') @@ -601,31 +597,18 @@ const sendSampleHandle = () => { }) } -const visibleChange = (visible: boolean) => { - if (visible) { - if (!printerList.value.length) { - HiprintPrinter.initSocket() - } - } -}; +// 打印机设置 const changePrinter = (value: string) => { - // printStore.setDefaultPrinter(value); - - const link = document.createElement('a'); - link.href = 'lisbarprint://setup'; - link.style.display = 'none'; - document.body.appendChild(link); - - // 模拟点击 - link.click(); - - // 移除创建的标签(清理DOM) - document.body.removeChild(link); - - + checkPrintService().then((isConnected) => { + if (isConnected) { + printsetup() + } + }) }; + + const timeDate = () => { // 获取当前日期(当天) const today = dayjs(); @@ -690,8 +673,11 @@ const handletime = (val: Array) => { // if (dayDiff > 7) return ElMessage.warning('查询时间范围不能超过7天,请重新选择'); } + +const btnLoading = ref(false); // 生成条码 const printHandle = () => { + btnLoading.value = true; const data = { dept: queryParams.ksdh, userid: queryParams.userid, @@ -704,6 +690,8 @@ const printHandle = () => { if (res.code == 0) { getList() } + }).finally(() => { + btnLoading.value = false; }) } // 计算两个日期的天数差(支持带时分秒) @@ -766,42 +754,34 @@ const selectStatusRows = () => { // 打印pdf const printPdf = () => { - // if (!printName.value) return ElMessage.warning("未设置打印机,请先设置打印机!"); - const selections = tableRef.value.allSelection() - if (selections.length <= 0) return ElMessage.warning('请选择数据!') - ElMessageBox.confirm(`确定打印选中的数据吗?`, "提示", { - confirmButtonText: "确认", - cancelButtonText: "取消", - beforeClose: async (action, instance, done) => { - if (action === "confirm") { - const requests = selections.map((item: any) => { return item.sqh }); - fetchCodeExec({ - sqh: requests.join(','), - userid: queryParams.userid, - status: 11, - yljg: queryParams.yljg - }).then((res: any) => { + checkPrintService().then((isConnected) => { + if (!isConnected) return + + const selections = tableRef.value.allSelection() + if (selections.length <= 0) return ElMessage.warning('请选择数据!') + + ElMessageBox.confirm(`确定打印选中的数据吗?`, "提示", { + confirmButtonText: "确认", + cancelButtonText: "取消", + beforeClose: async (action, instance, done) => { + if (action === "confirm") { + const requests = selections.map((item: any) => item.sqh) + const res = await fetchCodeExec({ + sqh: requests.join(','), + userid: queryParams.userid, + status: 11, + yljg: queryParams.yljg + }) if (res.code == 0) { - done(); - // HiprintPrinter.silentPrint(res.data, printName.value); - const link = document.createElement('a'); - link.href = `lisbarprint://${res.data}`; - link.style.display = 'none'; - document.body.appendChild(link); - - // 模拟点击 - link.click(); - - // 移除创建的标签(清理DOM) - document.body.removeChild(link); + done() getList() } - }) - } else { - done(); - } - }, - }).catch(() => { }); + } else { + done() + } + }, + }).catch(() => { }) + }) } diff --git a/src/views/checkCode/report/index.vue b/src/views/checkCode/report/index.vue index e8778f1..602fe27 100644 --- a/src/views/checkCode/report/index.vue +++ b/src/views/checkCode/report/index.vue @@ -262,10 +262,9 @@ const timelineItems = ref( [ { title: '检验申请', time: '' }, { title: '标本采集', time: '' }, - { title: '上机检验', time: '' }, { title: '标本送检', time: '' }, - // { title: '检验接收', time: '' }, { title: '标本签收', time: '' }, + { title: '上机检验', time: '' }, { title: '结果审核', time: '' }, ] ); @@ -345,10 +344,9 @@ const rowHandle = (row: any) => { [ { title: '检验申请', time: row.sqsj }, { title: '标本采集', time: row.cysj }, - { title: '上机检验', time: row.zxsj }, { title: '标本送检', time: row.bbsjsj }, - // { title: '检验接收', time: row.jssj}, { title: '标本签收', time: row.jssj }, + { title: '上机检验', time: row.sjsj }, { title: '结果审核', time: row.confirmtime }, ] @@ -873,10 +871,10 @@ onMounted(async () => { // 计算前6天的日期(当天 + 前6天 = 7天) const startOfWeek = today.subtract(6, 'day'); - // queryParams.st = route.query.startdate ? String(route.query.startdate) : startOfWeek.format('YYYY-MM-DD'); - // queryParams.et = route.query.endate ? String(route.query.endate) : today.format('YYYY-MM-DD'); - queryParams.st = '2025-08-07' - queryParams.et = '2025-08-14' + queryParams.st = route.query.startdate ? String(route.query.startdate) : startOfWeek.format('YYYY-MM-DD'); + queryParams.et = route.query.endate ? String(route.query.endate) : today.format('YYYY-MM-DD'); + // queryParams.st = '2025-08-07' + // queryParams.et = '2025-08-14' queryParams.ksdh = (route.query.deptcode as string) ? (route.query.deptcode as string) : ''; diff --git a/src/views/lisquery/reportQuery/index.vue b/src/views/lisquery/reportQuery/index.vue index 4c2ec01..a863a4e 100644 --- a/src/views/lisquery/reportQuery/index.vue +++ b/src/views/lisquery/reportQuery/index.vue @@ -320,10 +320,9 @@ const timelineItems = ref( [ { title: '检验申请', time: '' }, { title: '标本采集', time: '' }, - { title: '上机检验', time: '' }, { title: '标本送检', time: '' }, - // { title: '检验接收', time: '' }, { title: '标本签收', time: '' }, + { title: '上机检验', time: '' }, { title: '结果审核', time: '' }, ] ); @@ -419,10 +418,9 @@ const rowHandle = (row: any) => { [ { title: '检验申请', time: row.sqsj }, { title: '标本采集', time: row.cysj }, - { title: '上机检验', time: row.zxsj }, { title: '标本送检', time: row.bbsjsj }, - // { title: '检验接收', time: row.jssj}, { title: '标本签收', time: row.jssj }, + { title: '上机检验', time: row.sjsj }, { title: '结果审核', time: row.confirmtime }, ] diff --git a/src/views/liswork/qualityControl/indoorStatistics/index.vue b/src/views/liswork/qualityControl/indoorStatistics/index.vue index b716ac2..993e237 100644 --- a/src/views/liswork/qualityControl/indoorStatistics/index.vue +++ b/src/views/liswork/qualityControl/indoorStatistics/index.vue @@ -92,6 +92,7 @@ import { getmonthst, getmonthpj, savemonthpj, getmonthskzj, savemonthskzj } from import { getComDicts } from "@/api/liswork/dict/ComDict"; import { getGroupInstrdList } from "@/api/liswork/work/LisWork"; import dayjs from 'dayjs'; +import { ElMessage } from 'element-plus' const userStore = useUserStore() const mbStore = useCommonStore(); const tableData = ref([]) @@ -117,16 +118,16 @@ const viewHandle = () => { } const skHandle = () => { - getmonthskzj(queryParams).then((res) => { - + getmonthskzj({ ...queryParams, ksrq: queryParams.zkrq + '-01' }).then((res) => { + inputValue.value = res.data }); title.value = '失控总结' dialogVisible.value = true } const byHandle = () => { - getmonthpj(queryParams).then((res) => { - + getmonthpj({ ...queryParams, ksrq: queryParams.zkrq + '-01', }).then((res) => { + inputValue.value = res.data }); title.value = '本月总结' dialogVisible.value = true @@ -136,18 +137,22 @@ const subHandle = () => { if (title.value == '失控总结') { savemonthskzj({ ...queryParams, - skzj: inputValue.value + ksrq: queryParams.zkrq + '-01', + bz1: inputValue.value }).then((res) => { if (res.code == 0) { + ElMessage.success('保存成功') dialogVisible.value = false } }); } else if (title.value == '本月总结') { savemonthpj({ ...queryParams, - monthpj: inputValue.value + ksrq: queryParams.zkrq + '-01', + bz1: inputValue.value }).then((res) => { if (res.code == 0) { + ElMessage.success('保存成功') dialogVisible.value = false } }); diff --git a/src/views/liswork/qualityControl/qcgraph/index.vue b/src/views/liswork/qualityControl/qcgraph/index.vue index a1db6a8..a8eac67 100644 --- a/src/views/liswork/qualityControl/qcgraph/index.vue +++ b/src/views/liswork/qualityControl/qcgraph/index.vue @@ -49,16 +49,33 @@ -
- 仪器:{{ yqmc }}   质控项目:{{ xmInfo.xmdh }} {{ xmInfo.xmmc }}   - 区间:{{ queryParams.st }} - {{ queryParams.et }} -
-
-
-
+ + + + + +
+
+ 仪器:{{ yqmc }}   质控项目:{{ xmInfo.xmdh }} {{ xmInfo.xmmc }}   + 区间:{{ queryParams.st }} - {{ queryParams.et }}
-
+
+
+
+
+
+
+
+ +
+ + + + + + +
@@ -73,6 +90,19 @@ import { useCommonStore } from '@/store/modules/commonStore'; const mbStore = useCommonStore(); import * as echarts from 'echarts'; +const tableData = ref([ + { zkrq: '2024-01-01', avg0: 1.2, sd0: 0.1, avg1: 2.3, sd1: 0.2, avg2: 3.4, sd2: 0.3, avg3: 4.5, sd3: 0.4 }, + { zkrq: '2024-01-02', avg0: 1.3, sd0: 0.1, avg1: 2.4, sd1: 0.2, avg2: 3.5, sd2: 0.3, avg3: 4.6, sd3: 0.4 }, + { zkrq: '2024-01-03', avg0: 1.1, sd0: 0.1, avg1: 2.2, sd1: 0.2, avg2: 3.3, sd2: 0.3, avg3: 4.4, sd3: 0.4 }, + { zkrq: '2024-01-04', avg0: 1.4, sd0: 0.1, avg1: 2.5, sd1: 0.2, avg2: 3.6, sd2: 0.3, avg3: 4.7, sd3: 0.4 }, + { zkrq: '2024-01-05', avg0: 1.2, sd0: 0.1, avg1: 2.3, sd1: 0.2, avg2: 3.4, sd2: 0.3, avg3: null, sd3: null }, +]); + +const selectedLevelColumns = computed(() => { + // 排序保证列展示顺序和水平数字一致 + return selectedLevels.value.slice().sort((a, b) => a - b); +}); +const activeName = ref('1'); const isMultiChart = ref(false); // 原始水平图表数据 const chartData = ref([ @@ -137,6 +167,14 @@ const getXmList = async (row) => { }); }; +const tabClick = (val) => { + if (val.paneName == '1') { + nextTick(() => { + getEcharts(); + }); + } +}; + // 单/多图表容器 const myEcharts = ref(); const multiEcharts = ref([]); @@ -245,6 +283,7 @@ const getEcharts = () => { splitLine: { show: true, lineStyle: { type: 'dashed' } }, axisLabel: { formatter: '{value}', color: '#474747', fontSize: 14 }, axisTick: { show: false }, + interval: 1, }], series: seriesData, }; @@ -352,6 +391,7 @@ const getEcharts = () => { // axisLine: { show: true, lineStyle: { color: '#305cd0' } }, axisLabel: { formatter: '{value}', color: '#474747', fontSize: 14 }, axisTick: { show: false }, + interval: 1, }], series: seriesData, }; @@ -363,13 +403,14 @@ const getEcharts = () => { //水平复选框变化时重新渲染图表 const handleLevelChange = () => { - getEcharts(); + if (activeName.value === '1') { + getEcharts(); + } }; getBatchList(); const getDataValue = (value) => { - console.log('value==>', value); yqmc.value = value.yqmc; }; diff --git a/src/views/regional/circulation/zycy/index.vue b/src/views/regional/circulation/zycy/index.vue index 3982d4b..32be0b8 100644 --- a/src/views/regional/circulation/zycy/index.vue +++ b/src/views/regional/circulation/zycy/index.vue @@ -41,13 +41,14 @@ - 生成条码 + 生成条码 选中所有未打印 - 打印 + 打印条码 采样登记 @@ -62,16 +63,11 @@ 条码作废 - 打印机设置 + 清单打印 - 清单打印 + 打印机设置 - + +