|
|
|
@ -420,7 +420,7 @@ export default { |
|
|
|
// }, |
|
|
|
|
|
|
|
// 配合虚拟表导出 |
|
|
|
handleSortChange({column, prop, order}) { |
|
|
|
handleSortChange({ column, prop, order }) { |
|
|
|
// column: 当前列配置 |
|
|
|
// prop: 排序的字段名(对应列 prop) |
|
|
|
// order: 排序顺序,可选值:'ascending', 'descending', null(取消排序) |
|
|
|
@ -1156,7 +1156,7 @@ export default { |
|
|
|
this.upTsjh() |
|
|
|
break; |
|
|
|
default: //lis |
|
|
|
this.btnExport('report_tjbg') // 非虚拟表导出 |
|
|
|
// this.btnExport('report_tjbg') // 非虚拟表导出 |
|
|
|
this.btnExportV() // 非虚拟表导出 |
|
|
|
break; |
|
|
|
} |
|
|
|
@ -1689,57 +1689,65 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
btnExportV() { |
|
|
|
btnExportV() { |
|
|
|
let table = `<table border="1" cellspacing="0" bordercolor="#000000" style="border-collapse:collapse">` |
|
|
|
let thead = `<thead><tr>` |
|
|
|
let th = '' |
|
|
|
|
|
|
|
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; |
|
|
|
// 生成表头标题 |
|
|
|
this.dragCol.forEach(e => { |
|
|
|
if (e.prop) { |
|
|
|
if (th) { |
|
|
|
th += `<th>${e.label}</th>` |
|
|
|
} else { |
|
|
|
th = `<th>${e.label}</th>` |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
thead += th + `</tr></thead>` |
|
|
|
|
|
|
|
// 生成表体 |
|
|
|
let tr = '' |
|
|
|
this.tableDatas.forEach((row, i) => { |
|
|
|
let newRow = Object.assign({}, row) |
|
|
|
let tds = '' |
|
|
|
this.dragCol.forEach(e => { |
|
|
|
let td = '<td></td>' |
|
|
|
if (e.prop) { |
|
|
|
if (e.prop == 'sn') { |
|
|
|
td = `<td>${i + 1}</td>` |
|
|
|
} else if (['isVip', 'isUpload', 'isUploadAppoint', 'isReceiveReport', 'isPushThirdResult'].includes(e.prop)) { |
|
|
|
if (newRow[e.prop] == 'Y') { |
|
|
|
td = `<td>√</td>` |
|
|
|
} else { |
|
|
|
td = `<td></td>` |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (newRow[e.prop]) { |
|
|
|
newRow[e.prop] = `\u200C${newRow[e.prop]}` |
|
|
|
} |
|
|
|
td = `<td>${newRow[e.prop]}</td>` |
|
|
|
} |
|
|
|
} |
|
|
|
if(tds){ |
|
|
|
tds += td |
|
|
|
}else{ |
|
|
|
tds = td |
|
|
|
} |
|
|
|
}); |
|
|
|
const data = list.map((v) => filterVal.map((j) => v[j])); |
|
|
|
exportJsonToExcel( |
|
|
|
tHeader, |
|
|
|
data, |
|
|
|
"人员列表" + moment(new Date()).format("yyyyMMDDHHmmss") |
|
|
|
); //"列表excel" 是下载后的表名 可修改 |
|
|
|
if(tr){ |
|
|
|
tr += `<tr>${tds}</tr>` |
|
|
|
}else{ |
|
|
|
tr = `<tr>${tds}</tr>` |
|
|
|
} |
|
|
|
}); |
|
|
|
let tbody = `<tbody>${tr}</tbody>` |
|
|
|
|
|
|
|
table += thead + tbody + '</table>' |
|
|
|
|
|
|
|
let fileName = moment(new Date()).format('yyyyMMDDHHmmss') + '.xlsx' |
|
|
|
let blob = new Blob([table], { type: "text/plain;charset=utf-8" }); |
|
|
|
FileSaver.saveAs(blob, fileName); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|