From 4be4bf155f57de4a90a8ecdf35cadb9464922ce7 Mon Sep 17 00:00:00 2001 From: wyuu Date: Thu, 22 Jan 2026 17:39:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/liswork/qualityControl/index.ts | 16 + src/store/modules/printStore.ts | 12 +- src/store/modules/user.js | 12 +- src/utils/hiprintPrinter.ts | 16 +- src/views/checkCode/index.vue | 30 +- src/views/checkCode/report/index.vue | 61 ++- src/views/lisquery/reportQuery/index.vue | 385 ++++++++++++------ .../components/setBatch/index.vue | 23 +- .../qualityControl/indoorStatistics/index.vue | 173 ++++++++ .../liswork/qualityControl/qcgraph/index.vue | 372 +++++++++++++++++ src/views/regional/circulation/zycy/index.vue | 24 +- 11 files changed, 966 insertions(+), 158 deletions(-) create mode 100644 src/views/liswork/qualityControl/indoorStatistics/index.vue create mode 100644 src/views/liswork/qualityControl/qcgraph/index.vue diff --git a/src/api/liswork/qualityControl/index.ts b/src/api/liswork/qualityControl/index.ts index f165c50..870a1d5 100644 --- a/src/api/liswork/qualityControl/index.ts +++ b/src/api/liswork/qualityControl/index.ts @@ -163,3 +163,19 @@ export function copyQcSample(data?: Object) { params: data }) } +//删除靶值 +export function delQcSample(data?: Object) { + return request({ + url: '/qc/delQcSample', + method: 'delete', + params: data + }) +} +//查询质控室内数据(月统计) +export function getmonthst(data?: Object) { + return request({ + url: '/qcstat/getmonthst', + method: 'get', + params: data + }) +} diff --git a/src/store/modules/printStore.ts b/src/store/modules/printStore.ts index 2002197..f410c28 100644 --- a/src/store/modules/printStore.ts +++ b/src/store/modules/printStore.ts @@ -17,10 +17,20 @@ export const usePrintStore = defineStore('printStore', { }, setPrinterList(list: any[]) { this.printerList = list - this.defaultPrinter = list.find((p) => p.isDefault)?.name || '' }, + setDefaultPrinter(printerName: string) { this.defaultPrinter = printerName } + }, + + // 持久化配置 + persist: { + // 指定要持久化的状态字段 + pick: ['defaultPrinter',], + // 可选配置:自定义存储键名(默认是store的id) + // key: 'common_store', + // 可选配置:指定存储位置(默认是localStorage 也可以用sessionStorage) + storage: localStorage, } }) \ No newline at end of file diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 394dd66..3db813a 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -21,7 +21,8 @@ const useUserStore = defineStore( roleName: '', avatar: '', roles: [], - permissions: [] + permissions: [], + sysLoginParam: {}, // 登录参数 }), actions: { // 单点登录 @@ -48,9 +49,9 @@ const useUserStore = defineStore( const password = userInfo.password const code = userInfo.code const uuid = userInfo.uuid - const loginParam=userInfo.loginParam + const loginParam = userInfo.loginParam return new Promise((resolve, reject) => { - login(username, password, code, uuid,loginParam).then(res => { + login(username, password, code, uuid, loginParam).then(res => { setToken(res.token) this.token = res.token resolve() @@ -65,8 +66,9 @@ const useUserStore = defineStore( getInfo().then(res => { const user = res.user const rolelist = user.roles + this.sysLoginParam = user.sysLoginParam if (rolelist && rolelist.length > 0) { - this.roleName=rolelist[0].roleName + this.roleName = rolelist[0].roleName } const avatar = (user.avatar == "" || user.avatar == null) ? defAva : import.meta.env.VITE_APP_BASE_API + user.avatar; @@ -78,7 +80,7 @@ const useUserStore = defineStore( } this.id = user.userId this.name = user.userName - this.nickName= user.nickName + this.nickName = user.nickName this.avatar = avatar resolve(res) }).catch(error => { diff --git a/src/utils/hiprintPrinter.ts b/src/utils/hiprintPrinter.ts index e980e59..a748ec2 100644 --- a/src/utils/hiprintPrinter.ts +++ b/src/utils/hiprintPrinter.ts @@ -110,12 +110,11 @@ interface PrintOptions { * @param urls PDF文件URL数组 * @param options 打印选项(可选) */ -function silentPrint(urls: string[], options?: PrintOptions) { +function silentPrint(urls: string[], printName: string, options?: PrintOptions) { if (urls.length === 0) return ElMessage.error('没有打印数据'); const printStore = usePrintStore(); const handlePrint = () => { - ElMessage.success('正在打印文件,请稍候...'); - urls.forEach(url => silentPrintPdf(url, options)); + urls.forEach(url => silentPrintPdf(url, printName, options)); }; // 已连接直接打印,未连接则初始化后打印 @@ -133,14 +132,11 @@ function silentPrint(urls: string[], options?: PrintOptions) { } //静默打印单个PDF文件 -function silentPrintPdf(url: string, options?: PrintOptions) { +function silentPrintPdf(url: string, printName: string, options?: PrintOptions) { const printStore = usePrintStore(); const templateId = `pdf-print-${Date.now()}`; - const targetPrinter = printStore.defaultPrinter; - if (!targetPrinter) { - console.log("未检测到打印机,请先连接打印机!"); - return; - } + const targetPrinter = printName; + ElMessage.success('正在打印文件,请稍候...'); socket?.emit("news", { client: clientInfo, printer: targetPrinter, @@ -148,7 +144,7 @@ function silentPrintPdf(url: string, options?: PrintOptions) { templateId: templateId, pdf_path: url, }); - // console.log(`🚀 PDF打印请求已发送,任务ID:${templateId},打印机:${targetPrinter}`); + console.log(`🚀 PDF打印请求已发送,任务ID:${templateId},打印机:${targetPrinter}`); } // 销毁 diff --git a/src/views/checkCode/index.vue b/src/views/checkCode/index.vue index 9fc28e5..dc1ee45 100644 --- a/src/views/checkCode/index.vue +++ b/src/views/checkCode/index.vue @@ -67,12 +67,14 @@ 条码作废 - 清单打印 + + + + + printStore.printerList); //@ts-ignore import { getDicts } from '@/api/system/dict/data' //@ts-ignore const { proxy } = getCurrentInstance(); const { lis_reqcx_type } = proxy.useDict("lis_reqcx_type"); //参数类别 -const compactForm = ref(null); +const printName = ref(printStore.defaultPrinter || ''); + + const lisReqs: any = ref([]) const nickName = ref('') const dialogVisible = ref(false) @@ -213,7 +218,7 @@ const queryParams = reactive({ st: '2025-07-18', et: '2025-07-18', yljg: '1', - zt: '2', + zt: '1', queryType: '', queryValue: '', ksdh: '', @@ -595,6 +600,18 @@ const sendSampleHandle = () => { }) } +const visibleChange = (visible: boolean) => { + if (visible) { + if (!printerList.value.length) { + HiprintPrinter.initSocket() + } + } +}; + +const changePrinter = (value: string) => { + printStore.setDefaultPrinter(value); +}; + const timeDate = () => { // 获取当前日期(当天) const today = dayjs(); @@ -735,6 +752,7 @@ 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(`确定打印选中的数据吗?`, "提示", { @@ -752,7 +770,7 @@ const printPdf = () => { if (res.code == 0) { done(); getList() - HiprintPrinter.silentPrint(res.data); + HiprintPrinter.silentPrint(res.data, printName.value); } }) } else { diff --git a/src/views/checkCode/report/index.vue b/src/views/checkCode/report/index.vue index 344c5bc..e8778f1 100644 --- a/src/views/checkCode/report/index.vue +++ b/src/views/checkCode/report/index.vue @@ -88,15 +88,12 @@ 打印报告 - - + ref="tableRefs" :row-style="rowClassNameHd" :cell-style="cellStyleHd" @selection-change="selectionChange" + :config="tableConfig" :enable-column-drag="true" @column-drag-end="handleColumnDragEnd"> @@ -186,6 +183,8 @@ import { HiprintPrinter } from '@/utils/hiprintPrinter'; import * as echarts from 'echarts'; //@ts-ignore import { comDict } from '@/utils/dict' +//@ts-ignore +import { getDicts } from '@/api/system/dict/data' import { usePrintStore } from '@/store/modules/printStore' //@ts-ignore import useUserStore from '@/store/modules/user' @@ -194,7 +193,7 @@ const route = useRoute() const aotuSize = classCom.useAutoSize(); const userStore = useUserStore() const compactForm = ref(null); -const heightForm = ref(90); +const lisReqs: any = ref([]) const dialogVisible = ref(false) const tableRefs = ref() const diaTableRef = ref() @@ -413,13 +412,35 @@ const cellStyleHd = ({ row, column, rowIndex, columnIndex }: { rowIndex: number; columnIndex: number; }) => { - // console.log(row, column, rowIndex, columnIndex); - if (column.title == "急" && row.jzbz == "1") { - return { color: '#f00' }; + // // console.log(row, column, rowIndex, columnIndex); + // if (column.title == "急" && row.jzbz == "1") { + // return { color: '#f00' }; + // } + // if (column.title == "危" && row.alarmflag == "1") { + // return { color: '#f00' }; + // } +}; + +const rowClassNameHd = ({ row, rowIndex }: { + row: any; + rowIndex: number; +}) => { + // 最高优先级:警告/异常 + if (row.jzbz == "1" || row.alarmflag == "1") { + return { + backgroundColor: '#f00 !important', + color: '#000 !important', + }; } - if (column.title == "危" && row.alarmflag == "1") { - return { color: '#f00' }; + + if (row.jgbz == '2') { + return { background: '#C0FFC0 !important' }; } + + if (row.dybz == '1') { + return { background: '#C0C0C0 !important' }; + } + return 'custom-row-class'; // 返回自定义类名 }; // 表格配置 @@ -852,8 +873,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 = 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) : ''; @@ -863,6 +886,16 @@ onMounted(async () => { // 进入页面单点登录 const result = await userStore.loginAnonymous({ name: queryParams.userid, yljg: queryParams.yljg }) if (result) { + // 获取状态字典 + getDicts('lis_req_type').then((resp: any) => { + lisReqs.value = resp.data.map((p: any) => ({ + label: p.dictLabel, + value: p.dictValue, + elTagType: p.listClass, + elTagClass: p.cssClass + })) + + }) getList() } @@ -1044,5 +1077,7 @@ const getList = () => { pointer-events: auto; /* 允许鼠标交互 */ cursor: default; + font-size: .875rem; + margin-top: .3125rem; } \ No newline at end of file diff --git a/src/views/lisquery/reportQuery/index.vue b/src/views/lisquery/reportQuery/index.vue index a0d5433..4c2ec01 100644 --- a/src/views/lisquery/reportQuery/index.vue +++ b/src/views/lisquery/reportQuery/index.vue @@ -2,62 +2,141 @@
- + - - - + + + - - - - - - - - - - - - - - - - + + + - - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + +   -   + + + + + + + + + + + + + +   + + @@ -116,6 +195,20 @@
+ + +
+
+
+ +
+
+
{{ i + 1 }}
+
{{ item.title }}
+
{{ item.time }}
+
+
+
@@ -129,23 +222,30 @@ import SelectTable from '@/components/SelectTable/index.vue'; import { ElMessage, ElMessageBox } from 'element-plus' import { classCom } from '@/utils/classCom' import { HiprintPrinter } from '@/utils/hiprintPrinter'; -import * as echarts from 'echarts'; -//@ts-ignore -import { comDict } from '@/utils/dict' +import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue'; +// @ts-ignore +import { listhospital } from "@/api/regional/dict/hospital.js"; +// @ts-ignore +import { listUser } from '@/api/system/user.js' import { usePrintStore } from '@/store/modules/printStore' //@ts-ignore import useUserStore from '@/store/modules/user' import { useRoute, useRouter } from 'vue-router' +import { getComDicts } from '@/api/liswork/dict/ComDict'; +import { getGroupInstrdList, queryXmInfo } from '@/api/liswork/work/LisWork'; const route = useRoute() const router = useRouter(); const aotuSize = classCom.useAutoSize(); - +const userStore = useUserStore() const tableRefs = ref() - interface QueryParams { - times: string[]; // 明确类型为字符串元组 + // times: string[]; // 明确类型为字符串元组 + instrGroup: string; + yq: string; + st: string; + et: string; alarmflag: boolean, jzbz: boolean, ksdh: string, @@ -157,14 +257,25 @@ interface QueryParams { sqh: string, userid: string, yljg: string, + bz: string, + yblx: string, + yhdh: string, + sjys: string, + brly: string, + jgbz: string, + dcny: string } // 提交表单数据 const queryParams = reactive({ - times: ['2025-08-19', '2025-08-19'], + // times: ['2025-08-19', '2025-08-19'], + instrGroup: '', + yq: '', + st: '', + et: '', ksdh: '0210', brlyname: '', - sqh: '25080109476', + sqh: '', alarmflag: false, jzbz: false, brxm: '', @@ -172,7 +283,14 @@ const queryParams = reactive({ ch: '', dybz: '', userid: '', - yljg: '1' + yljg: userStore.sysLoginParam.loginYLJG, + bz: '', + yblx: '', + yhdh: '', + sjys: '', + brly: '', + jgbz: '', + dcny: '' }); const single = ref(true); @@ -187,18 +305,39 @@ const Info = ref({}) const queryRules = ref({ }) - +const ysFields = ref([ + { prop: 'userName', label: '用户代号', width: 80, enablePinyinSearch: true }, + { prop: 'nickName', label: '用户姓名', width: 150, enablePinyinSearch: true }, +]) const handletime = (val: Array) => { - // console.log('时间', val); // 校验日期格式 - const dayDiff = getDayDiff(val[0], val[1]); - if (dayDiff === -1) return ElMessage.warning('请选择有效的日期范围'); - //校验是否超过7天 - if (dayDiff > 7) return ElMessage.warning('查询时间范围不能超过7天,请重新选择'); + const dayDiff = getDayDiff(queryParams.st, queryParams.et); + if (dayDiff === -1 || dayDiff === -2) return ElMessage.warning('请选择有效的日期范围'); } +// 时间线数据 +const timelineItems = ref( + [ + { title: '检验申请', time: '' }, + { title: '标本采集', time: '' }, + { title: '上机检验', time: '' }, + { title: '标本送检', time: '' }, + // { title: '检验接收', time: '' }, + { title: '标本签收', time: '' }, + { title: '结果审核', time: '' }, + ] +); +// 计算最后一个有时间的节点索引 +const lastTimeIndex = computed(() => { + const lastIndex = timelineItems.value.findLastIndex(item => item.time); + if (lastIndex === -1) { + return -1 + } else { + return lastIndex; + } +}); const handleQuery = async () => { const valid = await queryRef.value.validate().catch(() => { }); @@ -245,7 +384,7 @@ const columns = ref([ { field: 'hdys', title: '核对医生', align: 'center', resizable: true, width: 60 }, { field: 'zd', title: '临床诊断', align: 'center', resizable: true, width: 100 }, { field: 'bz', title: '备注', align: 'center', resizable: true, width: 100 }, - { field: 'sjysname', title: '审核人', align: 'center', resizable: true, width: 60 }, + { field: 'shysname', title: '审核人', align: 'center', resizable: true, width: 60 }, { field: 'confirmtime', title: '审核时间', align: 'center', resizable: true, width: 80 }, { field: 'zh', title: '最后修改人', align: 'center', resizable: true, width: 100 }, { field: 'zhtime', title: '最后修改时间', align: 'center', resizable: true, width: 100 }, @@ -276,6 +415,16 @@ const rowHandle = (row: any) => { rightColumns.value[6].visible = false } + timelineItems.value = + [ + { 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.confirmtime }, + ] Info.value = row const data = { @@ -416,18 +565,22 @@ const jzbzHandle = (val: boolean) => { getList() } - - -const ksdhFields = ref([ - { prop: 'value', label: '代号', width: 80, enablePinyinSearch: true }, - { prop: 'label', label: '名称', enablePinyinSearch: true }, -]) - -const brlxFields = ref([ - { prop: 'value', label: '代号', width: 80, enablePinyinSearch: true }, - { prop: 'label', label: '名称', enablePinyinSearch: true }, -]) - +const xmList = ref([]) +const getXmList = () => { + const data = { + yq: queryParams.yq, + pageSize: 1000, + pageNum: 1 + } + queryXmInfo(data).then((res: any) => { + xmList.value = res.data.map((item: any) => { + return { + label: item.xmmc, + value: item.xmdh + } + }) + }) +} // 右侧数据源 @@ -472,7 +625,7 @@ const rightTableConfig = ref( { // stripe: true, // 斑马纹 border: true, // 边框 - height: '68vh', // 高度 + height: '63vh', // 高度 highlightCurrentRow: true, // 高亮当前行 cellStyle: rightCellStyleHd } @@ -512,7 +665,7 @@ const xmrowHandle = (row: any) => { }); } else { nextTick(() => { - rightTableConfig.value.height = `68vh` + rightTableConfig.value.height = `63vh` rightTableRef.value?.doLayout && rightTableRef.value.doLayout(); }); } @@ -520,12 +673,6 @@ const xmrowHandle = (row: any) => { }) } -const periods = ref([]) - -const compareTableData = ref([]) - - - // 右侧数据源 const bottomTableData = ref([]) // 配置项 @@ -554,63 +701,83 @@ const bottomTableConfig = ref( { // stripe: true, // 斑马纹 border: true, // 边框 - height: '37vh', // 高度 + height: '32vh', // 高度 highlightCurrentRow: true, // 高亮当前行 cellStyle: botCellStyleHd } ) -interface DictData { - DP?: Array; - PT?: Array; - [key: string]: any[] | undefined; // 添加索引签名以支持动态访问 + + +const instrGroupOptions = ref([]) +const instrGroupFields = ref([ + { prop: 'zddh', label: '代号', width: 80, enablePinyinSearch: true }, + { prop: 'zdmc', label: '名称', width: 150, enablePinyinSearch: true }, +]) +// 部门 +const getinstrGroupOptions = () => { + getComDicts({ zdlb: 'GROUP' }).then((res: any) => { + instrGroupOptions.value = res.data + instrGroupOptions.value.push({ zddh: 'ALL', zdmc: '所有仪器' }) + // getYqConfig() + }); } - - -// 字典数据存储 -const dictData = ref({}); - - +const instrOptions = ref([]) +// 仪器 +const getYqConfig = () => { + getGroupInstrdList({ lisgroup: queryParams.instrGroup }) + .then((res: any) => { + if (res.code == 0) { + instrOptions.value = res.data.map((item: any) => ({ + value: item.yq.trim(), + label: item.yqmc + })) + } + }) +} +const userList = ref([]); +const hosList = ref([]); onMounted(async () => { + const data = { status: 0, del_flag: 0, pageSize: 1000, pageNum: 1 } + listUser(data).then((res: any) => { + userList.value = res.rows; + }); + getinstrGroupOptions() // 获取当前日期(当天) const today = dayjs(); // 计算前6天的日期(当天 + 前6天 = 7天) const startOfWeek = today.subtract(6, 'day'); - const startDate = route.query.startdate ? String(route.query.startdate) : startOfWeek.format('YYYY-MM-DD'); - const endDate = route.query.endate ? String(route.query.endate) : today.format('YYYY-MM-DD'); + 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.times = [startDate, endDate]; + listhospital().then((res: any) => { + hosList.value = res.rows.map((item: any) => { + return { + label: item.hospitalName, + value: item.hospitalId.toString() + } + }) + }) + getList() - - // 加载病人来源字典 - const dictRefs = await comDict('PT', 'DP'); - - // 从 ref 中获取实际数据 - dictData.value = { - PT: toRaw(dictRefs.PT.value) || [], - DP: toRaw(dictRefs.DP.value) || [], - }; }); -const formatDict = (v: string, dictType: string) => { - return dictData.value[dictType]?.find((item: any) => item.value == v)?.label || v; -}; // 计算两个日期的天数差(支持带时分秒) const getDayDiff = (start: string, end: string): number => { const startTime = new Date(start).getTime(); const endTime = new Date(end).getTime(); - // 校验日期有效性 if (isNaN(startTime) || isNaN(endTime)) { - return -1; // 无效日期 + return -2; // -2 表示日期无效 } - // 计算毫秒差 → 转换为天数(向上取整,避免因时分秒导致的误差) - return Math.ceil((endTime - startTime) / (24 * 60 * 60 * 1000)); + const dayDiff = Math.ceil((endTime - startTime) / (24 * 60 * 60 * 1000)); + return dayDiff < 0 ? -1 : dayDiff; // -1 表示结束时间早于开始时间,>=0 为正常天数 }; const getList = () => { @@ -624,27 +791,17 @@ const getList = () => { brdh: queryParams.brdh, ch: queryParams.ch, userid: queryParams.userid, - st: '', - et: '', + st: queryParams.st, + et: queryParams.et, yljg: queryParams.yljg, } if (!data.ksdh) return ElMessage.error('科室代号不能为空'); if (!data.yljg) return ElMessage.error('医疗机构yljg不能为空'); // 校验日期格式 - const dayDiff = getDayDiff(queryParams.times[0], queryParams.times[1]); - if (dayDiff === -1) return ElMessage.warning('请选择有效的日期范围'); + const dayDiff = getDayDiff(queryParams.st, queryParams.et); + if (dayDiff === -1 || dayDiff === -2) return ElMessage.warning('请选择有效的日期范围'); - //校验是否超过7天 - if (dayDiff > 7) return ElMessage.warning('查询时间范围不能超过7天,请重新选择'); - - if (queryParams.times && queryParams.times.length) { - data.st = queryParams.times[0] - data.et = queryParams.times[1] - } else { - data.st = '' - data.et = '' - } loading.value = true reportList(data).then((res: any) => { if (res.code == 0) { @@ -667,7 +824,7 @@ const getList = () => { \ No newline at end of file diff --git a/src/views/liswork/qualityControl/qcgraph/index.vue b/src/views/liswork/qualityControl/qcgraph/index.vue new file mode 100644 index 0000000..eb44c48 --- /dev/null +++ b/src/views/liswork/qualityControl/qcgraph/index.vue @@ -0,0 +1,372 @@ + + + + + \ No newline at end of file diff --git a/src/views/regional/circulation/zycy/index.vue b/src/views/regional/circulation/zycy/index.vue index a1a5013..166b0cf 100644 --- a/src/views/regional/circulation/zycy/index.vue +++ b/src/views/regional/circulation/zycy/index.vue @@ -67,8 +67,11 @@ 清单打印 - + + + + + printStore.printerList); +const printName = ref(printStore.defaultPrinter || ''); const compactForm = ref(null); const heightForm = ref(90); const dialogVisible = ref(false) @@ -543,6 +548,18 @@ const cancelHandle = () => { } +const visibleChange = (visible: boolean) => { + if (visible) { + if (!printerList.value.length) { + HiprintPrinter.initSocket() + } + } +}; + +const changePrinter = (value: string) => { + printStore.setDefaultPrinter(value); +}; + const hosList = ref([]) onMounted(async () => { // 初始化3天区间(今天-前两天) @@ -653,6 +670,7 @@ const selectStatusRows = () => { // 打印pdf const printPdf = () => { + if (!printName.value) return ElMessage.warning("未设置打印机,请先设置打印机!"); if (sqhs.value.length <= 0) return ElMessage.warning('请选择数据!') ElMessageBox.confirm(`确定打印选中的数据吗?`, "提示", { confirmButtonText: "确认", @@ -669,7 +687,7 @@ const printPdf = () => { if (res.code == 0) { done(); getList() - HiprintPrinter.silentPrint(res.data); + HiprintPrinter.silentPrint(res.data, printName.value); } }) } else {