feat: 下载调整
This commit is contained in:
@ -9,7 +9,7 @@ const isDOM = (obj) => obj instanceof HTMLElement;
|
|||||||
* @param {string} name 文件名
|
* @param {string} name 文件名
|
||||||
*/
|
*/
|
||||||
export const downloadPDF = async (dom, name = '导出文件') => {
|
export const downloadPDF = async (dom, name = '导出文件') => {
|
||||||
if(!isDOM(dom)) return;
|
if (!isDOM(dom)) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 等待一段时间确保所有图表完全渲染
|
// 等待一段时间确保所有图表完全渲染
|
||||||
@ -89,6 +89,9 @@ export function downloadDocWithStyle(textContent) {
|
|||||||
text-align: justify;
|
text-align: justify;
|
||||||
text-justify: inter-character;
|
text-justify: inter-character;
|
||||||
}
|
}
|
||||||
|
.center-subtitle {
|
||||||
|
display: flex;align-items: center;justify-content: space-between; color: red;margin-top: 30px;padding: 0 30px;font-size: 18px;font-weight: 700;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
<div style="border-bottom: 1px #ccc solid;padding-bottom: 30px;">
|
<div style="border-bottom: 1px #ccc solid;padding-bottom: 30px;">
|
||||||
<h1 style="text-align: center;color: red;">{{ nd }}年度林芝市公安战术研判报告</h1>
|
<h1 style="text-align: center;color: red;">{{ nd }}年度林芝市公安战术研判报告</h1>
|
||||||
<div
|
<div
|
||||||
style="display: flex;align-items: center;justify-content: space-between; color: red;margin-top: 30px;padding: 0 30px;font-size: 18px;font-weight: 700;">
|
style="display: flex;align-items: center;justify-content: space-between; color: red;margin-top: 30px;padding: 0 30px;font-size: 18px;font-weight: 700;" class="center-subtitle">
|
||||||
<div>{{ deptId.name }}</div>
|
<div>{{ deptId.name }}</div>
|
||||||
<div>{{ deptId?.ord }}</div>
|
<div>{{ deptId?.ord }}</div>
|
||||||
<div>{{ deptId?.time }}</div>
|
<div>{{ deptId?.time }}</div>
|
||||||
@ -113,8 +113,10 @@
|
|||||||
<p style="min-height: 100px;" v-loading="loading">{{ textContent }} </p>
|
<p style="min-height: 100px;" v-loading="loading">{{ textContent }} </p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <el-button :loading="downLoading" style="position: absolute;bottom: 0;left: 40%;" type="primary" size="default"
|
||||||
|
@click="downLoadPdf">pdf下载</el-button> -->
|
||||||
<el-button :loading="downLoading" style="position: absolute;bottom: 0;left: 45%;" type="primary" size="default"
|
<el-button :loading="downLoading" style="position: absolute;bottom: 0;left: 45%;" type="primary" size="default"
|
||||||
@click="downloadWithStyles">下载</el-button>
|
@click="downloadWithStyles">下载(doc)</el-button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<AddForm ref="addForm" :dict="{ D_GS_XS_LX }" />
|
<AddForm ref="addForm" :dict="{ D_GS_XS_LX }" />
|
||||||
@ -173,7 +175,7 @@ const tabHeightFn = () => {
|
|||||||
/** 以pdf形式下载 */
|
/** 以pdf形式下载 */
|
||||||
const downLoadPdf = async () => {
|
const downLoadPdf = async () => {
|
||||||
downLoading.value = true;
|
downLoading.value = true;
|
||||||
ElMessage.info('下载,会展开所有内容,是正常的。');
|
ElMessage.info('下载界面会展开,是正常的。');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 强制刷新所有图表
|
// 强制刷新所有图表
|
||||||
@ -236,8 +238,7 @@ const downLoadPdf = async () => {
|
|||||||
}
|
}
|
||||||
const downloadWithStyles = async () => {
|
const downloadWithStyles = async () => {
|
||||||
if (!tableBox.value?.innerHTML) return;
|
if (!tableBox.value?.innerHTML) return;
|
||||||
// downloadDocWithStyle(tableBox.value?.innerHTML)
|
downloadDocWithStyle(tableBox.value?.innerHTML)
|
||||||
downLoadPdf()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pageData = reactive({
|
const pageData = reactive({
|
||||||
|
|||||||
Reference in New Issue
Block a user