diff --git a/hb_client/src/api/qm.js b/hb_client/src/api/qm.js index 32ddc26..d18d4e2 100644 --- a/hb_client/src/api/qm.js +++ b/hb_client/src/api/qm.js @@ -65,6 +65,13 @@ export function getTestRecord(query) { params: query }) } +//检测记录模板 +export function getTestRecordExport(id) { + return request({ + url: `/qm/testrecord/${id}/export/`, + method: 'get' + }) +} //检测记录 export function getTestRecordItem(id) { return request({ diff --git a/hb_client/src/views/wpm/need.vue b/hb_client/src/views/wpm/need.vue index 1a29bcf..3f4f087 100644 --- a/hb_client/src/views/wpm/need.vue +++ b/hb_client/src/views/wpm/need.vue @@ -801,7 +801,7 @@ import {createTicket, getWorkflowInit} from "@/api/workflow"; import {getrecordformList, getrffieldList} from "@/api/mtm"; import {getwproductList, wproductPutin, createputins, testInit, scrap, getRetrial} from "@/api/wpm"; - import {getTestRecord, getTestRecordItem, putTestRecordItem, delTestRecordItem, subTestRecordItem} from "@/api/qm"; + import {getTestRecord, getTestRecordItem, putTestRecordItem, delTestRecordItem, subTestRecordItem,getTestRecordExport} from "@/api/qm"; import Pagination from "@/components/Pagination"; // secondary package based on el-pagination // import {saveAs} from "file-saver"; // import htmlDocx from "html-docx-js/dist/html-docx"; @@ -813,6 +813,7 @@ components: {Pagination, customForm, reviewForm, faceLogin}, data() { return { + exportFormId:null, testitem: defaultetestitem, formbcp: {}, form: {remark: "", warehouse: ""}, @@ -975,13 +976,17 @@ }, methods: { exportDom() { - htmlToPdf.downloadPDF(document.getElementById('pdfDom'), this.formName); - /* let dom = document.querySelector("#showForm .el-dialog"); - let str = dom.innerHTML; - debugger; - console.log(str); - let htmlStr = ` ${str}`; - saveAs(htmlDocx.asBlob(htmlStr, {orientation: "landscape"}), "报告.doc");*/ + // htmlToPdf.downloadPDF(document.getElementById('pdfDom'), this.formName); + getTestRecordExport(this.exportFormId).then(res=>{ + if(res.code===200){ + debugger; + console.log(res.data.path) + let link = document.createElement('a'); + link.href = 'http://49.232.14.174:2222'+res.data.path; + document.body.appendChild(link); + link.click(); + } + }) }, checkPermission, @@ -1379,6 +1384,7 @@ that.fieldList = []; that.create_by_ = scope.row.create_by_.name; that.update_time = scope.row.update_time; + that.exportFormId = scope.row.id; getTestRecordItem(scope.row.id).then((res) => { if (res.code >= 200) { that.recordFinishedVisible = true;