pdf修改 更改字段

lijinlong
杜函宇 2 years ago
parent eaf38c6d38
commit ac4df80523

@ -168,9 +168,9 @@ export default {
pdfUrl: "", pdfUrl: "",
//========= //=========
queryData: { queryData: {
pageSize: 20, // pageSize: 20,
pageNum: 1, // pageNum: 1,
locationName: "", areaId: "",
}, },
}; };
}, },
@ -252,7 +252,8 @@ export default {
}, },
clickFunc(val) { clickFunc(val) {
console.log(val); console.log(val);
this.queryData.locationName = val.name; this.queryData.areaId = val.area;
console.log(this.queryData);
// //
this.dangerList = []; this.dangerList = [];
departmentList(this.queryData).then((res) => { departmentList(this.queryData).then((res) => {
@ -288,7 +289,6 @@ export default {
if (this.fileExtension == "pdf") { if (this.fileExtension == "pdf") {
this.pdfUrl = process.env.VUE_APP_BASE_API2 + str[0]; this.pdfUrl = process.env.VUE_APP_BASE_API2 + str[0];
this.dialogStatus2 = true; this.dialogStatus2 = true;
// console.log(this.pdfUrl); // console.log(this.pdfUrl);
// const loadingTask = pdf.createLoadingTask({ // const loadingTask = pdf.createLoadingTask({
// url: this.pdfUrl, // url: this.pdfUrl,
@ -374,11 +374,13 @@ export default {
// //
getSDData() { getSDData() {
territorialTB().then((res) => { territorialTB().then((res) => {
console.log(res);
res.data.forEach((value, index) => { res.data.forEach((value, index) => {
this.piedata.push({ this.piedata.push({
name: this.$filterDict('1',`[${value.areaId}]`,true), name: this.$filterDict("1", `[${value.areaId}]`, true),
value: value.count, value: value.count,
percent: value.pt, percent: value.pt,
area: value.area,
img: require(`@/assets/privateOrder/general/${ img: require(`@/assets/privateOrder/general/${
index + 1 > 8 ? 1 : index + 1 index + 1 > 8 ? 1 : index + 1
}.png`), }.png`),

@ -231,14 +231,14 @@
class="file-content" class="file-content"
></div> ></div>
<div v-if="fileExtension === 'pdf'" class="file-content"> <div v-if="fileExtension === 'pdf'" class="file-content">
<!-- <pdf <pdf
v-for="i in numPages" v-for="i in numPages"
ref="pdf" ref="pdf"
:key="i" :key="i"
:src="pdfUrl" :src="pdfUrl"
:page="i" :page="i"
></pdf> --> ></pdf>
<iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> <!-- <iframe style="height: 100%; width: 100%" :src="pdfUrl"></iframe> -->
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -570,7 +570,7 @@ export default {
let str1 = str[0].split('.') let str1 = str[0].split('.')
this.fileExtension = str1[1]; this.fileExtension = str1[1];
if (this.fileExtension == "pdf") { 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; this.dialogDetails = true;
} else if ( } else if (
this.fileExtension === "docx" || this.fileExtension === "docx" ||
@ -591,35 +591,35 @@ export default {
} }
}, },
// getNumPages(url) { getNumPages(url) {
// axios({ axios({
// method: "GET", method: "GET",
// url: url, // url: url, //
// paramsSerializer: function (params) { paramsSerializer: function (params) {
// return qs.stringify(params, { arrayFormat: "brackets" }); return qs.stringify(params, { arrayFormat: "brackets" });
// }, },
// headers: { headers: {
// "Content-Type": "Content-Type":
// "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
// }, },
// responseType: "blob", responseType: "blob",
// }) })
// .then((response) => { .then((response) => {
// this.pdfUrl = this.getObjectURL(response.data); this.pdfUrl = this.getObjectURL(response.data);
// const loadingTask = pdf.createLoadingTask(this.pdfUrl); const loadingTask = pdf.createLoadingTask(this.pdfUrl);
// loadingTask.promise loadingTask.promise
// .then((pdf) => { .then((pdf) => {
// this.numPages = pdf.numPages; this.numPages = pdf.numPages;
// this.dialogDetails = true; this.dialogDetails = true;
// }) })
// .catch((err) => { .catch((err) => {
// console.error("pdf ", err); console.error("pdf 加载失败", err);
// }); });
// }) })
// .catch((error) => { .catch((error) => {
// this.$message.error("" + error); this.$message.error("" + error);
// }); });
// }, },
// url // url
getObjectURL(file) { getObjectURL(file) {
let url = null; let url = null;

Loading…
Cancel
Save