From 91829bdc784608fc36a1f5d13a544563e9bcd601 Mon Sep 17 00:00:00 2001 From: pengjun <158915633@qq.com> Date: Fri, 20 Mar 2026 17:06:10 +0800 Subject: [PATCH] seo --- .../customerReport/positiveResultsList.vue | 184 +++++++++++------- src/views/customerReport/unitSettlement.vue | 2 +- src/views/report/report.vue | 125 ++++++++++-- 3 files changed, 223 insertions(+), 88 deletions(-) diff --git a/src/views/customerReport/positiveResultsList.vue b/src/views/customerReport/positiveResultsList.vue index 74a903c..a5d16c0 100644 --- a/src/views/customerReport/positiveResultsList.vue +++ b/src/views/customerReport/positiveResultsList.vue @@ -60,78 +60,94 @@ 打印 -
+
+
+
阳性结果人员清单
+
{{ "开始时间: " + (summary.startDate || '') + " 结束时间: " + (summary.endDate || '') }}
+
+
{{ "阳性人数:男性:" + summary.maleCount + "人 女性: " + summary.femaleCount + "人;共:" + + (summary.maleCount + summary.femaleCount) + "人。" }}
+
{{ "检查人数:男性:" + + summary.registerMaleCount + "人 女性: " + summary.registerFemaleCount + "人;共:" + + (summary.registerMaleCount + summary.registerFemaleCount) + "人。" }}
+
+
- - - -
-
+
+
+
阳性结果人员清单
+
{{ "开始时间: " + (summary.startDate || '') + " 结束时间: " + (summary.endDate || '') }}
+
+
{{ "阳性人数:男性:" + summary.maleCount + "人 女性: " + summary.femaleCount + "人;共:" + + (summary.maleCount + summary.femaleCount) + "人。" }}
+
{{ "检查人数:男性:" + + summary.registerMaleCount + "人 女性: " + summary.registerFemaleCount + "人;共:" + + (summary.registerMaleCount + summary.registerFemaleCount) + "人。" }}
+
+
- - - - - - - - - - - + + + + + + + + + + + +
@@ -154,6 +170,7 @@ import moment from "moment"; import { mapState, mapActions } from "vuex"; import { getapi, postapi, putapi, deletapi } from "@/api/api"; import { exportToExcel } from "../../utlis/Export2Excel"; +import FileSaver from 'file-saver'; import html2canvas from "html2canvas"; import printJs from "print-js"; import { @@ -208,6 +225,14 @@ export default { methods: { moment, dddw, + + // 强制将单元格值转换为字符串 + forceStringFormatter(row, column, cellValue) { + // console.log('row, column, cellValue',row, column.property, cellValue) + // 如果 cellValue 存在,则转为字符串;否则返回原值 + return cellValue ? "\u200C" + String(cellValue) : cellValue + }, + //数据初始化 dictInit() { //体检中心 @@ -455,6 +480,8 @@ export default { this.summary.endDate = res.data.endDate; this.summary.femaleCount = res.data.femaleCount; this.summary.maleCount = res.data.maleCount; + this.summary.registerMaleCount = res.data.registerMaleCount; + this.summary.registerFemaleCount = res.data.registerFemaleCount; this.$nextTick(() => { this.$refs.standardTableData.doLayout(); }); @@ -497,18 +524,37 @@ page-break-before: avoid;}}`, // 去除页眉页脚 }); }, handleExport() { - if (this.format == 0) { - let index = 3; - let list = []; - list.push(index); - for (let i = 0; i < this.dataList.length - 1; i++) { - index += this.dataList[i].patientRegisters.length + 4; - list.push(index); - } - exportToExcel("#projectTableData", "阳性结果人员清单", true, list); - } else if (this.format == 1) { - exportToExcel("#standardTableData", "阳性结果人员清单", false); - } + // if (this.format == 0) { + // let index = 3; + // let list = []; + // list.push(index); + // for (let i = 0; i < this.dataList.length - 1; i++) { + // index += this.dataList[i].patientRegisters.length + 4; + // list.push(index); + // } + // exportToExcel("#projectTableData", "阳性结果人员清单", true, list); + // } else if (this.format == 1) { + // exportToExcel("#standardTableData", "阳性结果人员清单", false); + // } + + //通用导出 + // 获取HTML元素(表格) + // let table = document.getElementById(elId); //.cloneNode(true) + this.$nextTick(() => { + // let refsTable = this.$refs[elId] //.cloneNode(true) true + let table = document.getElementById('imageDom' + String(this.format)) + // console.log('table,refsTable', table, refsTable) + + let tableData = table.innerHTML + let fileName = moment(new Date()).format('yyyyMMDDHHmmss') + + let blob = new Blob([tableData], { type: "text/plain;charset=utf-8" }); + + FileSaver.saveAs(blob, fileName + '.xls'); + + }) + + }, }, diff --git a/src/views/customerReport/unitSettlement.vue b/src/views/customerReport/unitSettlement.vue index f81c38f..f0df4fa 100644 --- a/src/views/customerReport/unitSettlement.vue +++ b/src/views/customerReport/unitSettlement.vue @@ -365,7 +365,7 @@ page-break-before: avoid;}}`, // 去除页眉页脚 // 强制将单元格值转换为字符串 forceStringFormatter(row, column, cellValue) { - console.log('row, column, cellValue',row, column.property, cellValue) + // console.log('row, column, cellValue',row, column.property, cellValue) // 如果 cellValue 存在,则转为字符串;否则返回原值 return cellValue ? "\u200C" + String(cellValue) : cellValue }, diff --git a/src/views/report/report.vue b/src/views/report/report.vue index eb659f6..9638bb5 100644 --- a/src/views/report/report.vue +++ b/src/views/report/report.vue @@ -23,7 +23,7 @@
@@ -33,7 +33,7 @@ :type="dragCol[index].type" :min-width="dragCol[index].minWidth" :align="dragCol[index].align" :label="dragCol[index].type ? '' : item.label" :prop="dragCol[index].prop" :sortable="dragCol[index].type || dragCol[index].prop == 'sn' ? false : true" - :sort-method="(a, b) => chineseSort(a, b, dragCol[index].prop)" + :sort-method="(a, b) => chineseSort(a, b, dragCol[index].prop)" :show-overflow-tooltip="dragCol[index].showTooltip"> @@ -75,8 +75,6 @@
- -
+
test
@@ -421,25 +419,60 @@ export default { // } // }, + // 配合虚拟表导出 + handleSortChange({column, prop, order}) { + // column: 当前列配置 + // prop: 排序的字段名(对应列 prop) + // order: 排序顺序,可选值:'ascending', 'descending', null(取消排序) + console.log('排序变化:', column, prop, order) + + // 执行自定义排序逻辑 + if (order) { + this.tableDatas.sort((a, b) => { + let valA = a[prop], valB = b[prop] + if (typeof valA == 'string') { + if (['patientName', 'org', 'dept', 'address', 'remark'].includes(prop)) { + if (order === 'ascending') { + return valA.localeCompare(valB, 'zh'); + } else { + return valB.localeCompare(valA, 'zh'); + } + } else { + if (order === 'ascending') { + return valA.localeCompare(valB); + } else { + return valB.localeCompare(valA); + } + } + } else { + if (order === 'ascending') { + return valB > valB ? 1 : -1 + } else { + return valA < valB ? 1 : -1 + } + } + }) + } + }, + // 如果不想预处理,也可以在排序方法中动态计算 chineseSort(a, b, colName) { // console.log('a, b', a, b) // const pinyinA = pinyin(a[colName], { style: pinyin.STYLE_NORMAL }).join(''); // const pinyinB = pinyin(b[colName], { style: pinyin.STYLE_NORMAL }).join(''); - let valA = a[colName],valB = b[colName] - if (typeof valA == 'string'){ + let valA = a[colName], valB = b[colName] + if (typeof valA == 'string') { // 单位、部门、姓名、地址、备注 - if(['patientName','org','dept','address','remark'].includes(colName)){ - return valA.localeCompare(valB,'zh'); - }else{ + if (['patientName', 'org', 'dept', 'address', 'remark'].includes(colName)) { + return valA.localeCompare(valB, 'zh'); + } else { return valA.localeCompare(valB); } - - }else{ + } else { return valA - valB - } + } }, - + btnTest() { console.log('this.tableDatas3', this.tableDatas) @@ -1123,7 +1156,8 @@ export default { this.upTsjh() break; default: //lis - this.btnExport('report_tjbg') + this.btnExport('report_tjbg') // 非虚拟表导出 + this.btnExportV() // 非虚拟表导出 break; } }, @@ -1645,7 +1679,7 @@ export default { return rd; }, - //通用导出 + //通用导出(此方法,不适用虚拟表格) btnExport(elId) { let table = document.getElementById(elId); let tableData = table.innerHTML @@ -1653,7 +1687,62 @@ export default { let blob = new Blob([tableData], { type: "text/plain;charset=utf-8" }); FileSaver.saveAs(blob, fileName); }, - + + + btnExportV() { + + require.ensure([], () => { + const tHeader = []; + const filterVal = []; + this.dragCol.forEach((e) => { + tHeader.push(e.label); + filterVal.push(e.prop); + }); + const list = this.tableDatas.map((row, index) => { + const newRow = { ...row }; // 创建副本,避免修改原数据 + // 使用对象映射优化数据转换 + newRow.sn = index + 1; + if (newRow.completeFlag) + newRow.completeFlag = + newRow.isAudit == "Y" + ? "已审核" + : dddw( + this.dict.completeFlag, + "id", + newRow.completeFlag, + "displayName" + ); + + newRow.isReportPrint = newRow.isReportPrint == "Y" ? "√" : ""; + if (newRow.idNo) newRow.idNo = "\u200C" + newRow.idNo; + if (newRow.patientRegisterNo) + newRow.patientRegisterNo = "\u200C" + newRow.patientRegisterNo; + if (newRow.patientNo) newRow.patientNo = "\u200C" + newRow.patientNo; + if (newRow.isLock) newRow.isLock = newRow.isLock == "Y" ? "√" : ""; + if (newRow.isVip) newRow.isVip = newRow.isVip == "Y" ? "√" : ""; + if (newRow.isUpload) + newRow.isUpload = newRow.isUpload == "Y" ? "√" : ""; + if (newRow.isUploadAppoint) + newRow.isUploadAppoint = newRow.isUploadAppoint == "Y" ? "√" : ""; + if (newRow.isReceiveReport) + newRow.isReceiveReport = newRow.isReceiveReport == "Y" ? "√" : ""; + + + if (newRow.birthDate) + newRow.birthDate = moment(newRow.birthDate).format("yyyy-MM-DD"); + + return newRow; + }); + const data = list.map((v) => filterVal.map((j) => v[j])); + exportJsonToExcel( + tHeader, + data, + "人员列表" + moment(new Date()).format("yyyyMMDDHHmmss") + ); //"列表excel" 是下载后的表名 可修改 + }); + + }, + }, //监听事件