From ac4df805230b9bdda195976b2d8362896433bdd3 Mon Sep 17 00:00:00 2001 From: dhy1725534722 <1725534722@qq.com> Date: Wed, 30 Aug 2023 14:56:36 +0800 Subject: [PATCH] =?UTF-8?q?pdf=E4=BF=AE=E6=94=B9=20=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ReportingStatistics.vue | 14 ++-- .../sentiment/components/componentRight.vue | 66 +++++++++---------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/views/privateOrder/security/components/ReportingStatistics.vue b/src/views/privateOrder/security/components/ReportingStatistics.vue index 3b430ba..758f417 100644 --- a/src/views/privateOrder/security/components/ReportingStatistics.vue +++ b/src/views/privateOrder/security/components/ReportingStatistics.vue @@ -168,9 +168,9 @@ export default { pdfUrl: "", //========= queryData: { - pageSize: 20, - pageNum: 1, - locationName: "", + // pageSize: 20, + // pageNum: 1, + areaId: "", }, }; }, @@ -252,7 +252,8 @@ export default { }, clickFunc(val) { console.log(val); - this.queryData.locationName = val.name; + this.queryData.areaId = val.area; + console.log(this.queryData); //点击之后弹出框显示列表 this.dangerList = []; departmentList(this.queryData).then((res) => { @@ -288,7 +289,6 @@ export default { if (this.fileExtension == "pdf") { this.pdfUrl = process.env.VUE_APP_BASE_API2 + str[0]; this.dialogStatus2 = true; - // console.log(this.pdfUrl); // const loadingTask = pdf.createLoadingTask({ // url: this.pdfUrl, @@ -374,11 +374,13 @@ export default { //属地通报 getSDData() { territorialTB().then((res) => { + console.log(res); res.data.forEach((value, index) => { this.piedata.push({ - name: this.$filterDict('1',`[${value.areaId}]`,true), + name: this.$filterDict("1", `[${value.areaId}]`, true), value: value.count, percent: value.pt, + area: value.area, img: require(`@/assets/privateOrder/general/${ index + 1 > 8 ? 1 : index + 1 }.png`), diff --git a/src/views/privateOrder/sentiment/components/componentRight.vue b/src/views/privateOrder/sentiment/components/componentRight.vue index f8a1004..02239e8 100644 --- a/src/views/privateOrder/sentiment/components/componentRight.vue +++ b/src/views/privateOrder/sentiment/components/componentRight.vue @@ -231,14 +231,14 @@ class="file-content" >
- - + > +
@@ -570,7 +570,7 @@ export default { let str1 = str[0].split('.') this.fileExtension = str1[1]; if (this.fileExtension == "pdf") { - this.pdfUrl = process.env.VUE_APP_BASE_API2 + str[0]; + this.getNumPages(process.env.VUE_APP_BASE_API2 + str[0]) this.dialogDetails = true; } else if ( this.fileExtension === "docx" || @@ -591,35 +591,35 @@ export default { } }, - // getNumPages(url) { - // axios({ - // method: "GET", - // url: url, // 后台接口 - // paramsSerializer: function (params) { - // return qs.stringify(params, { arrayFormat: "brackets" }); - // }, - // headers: { - // "Content-Type": - // "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - // }, - // responseType: "blob", - // }) - // .then((response) => { - // this.pdfUrl = this.getObjectURL(response.data); - // const loadingTask = pdf.createLoadingTask(this.pdfUrl); - // loadingTask.promise - // .then((pdf) => { - // this.numPages = pdf.numPages; - // this.dialogDetails = true; - // }) - // .catch((err) => { - // console.error("pdf 加载失败", err); - // }); - // }) - // .catch((error) => { - // this.$message.error("" + error); - // }); - // }, + getNumPages(url) { + axios({ + method: "GET", + url: url, // 后台接口 + paramsSerializer: function (params) { + return qs.stringify(params, { arrayFormat: "brackets" }); + }, + headers: { + "Content-Type": + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + }, + responseType: "blob", + }) + .then((response) => { + this.pdfUrl = this.getObjectURL(response.data); + const loadingTask = pdf.createLoadingTask(this.pdfUrl); + loadingTask.promise + .then((pdf) => { + this.numPages = pdf.numPages; + this.dialogDetails = true; + }) + .catch((err) => { + console.error("pdf 加载失败", err); + }); + }) + .catch((error) => { + this.$message.error("" + error); + }); + }, // 文件流转url getObjectURL(file) { let url = null;