This commit is contained in:
shijing 2022-04-21 14:54:43 +08:00
parent adab213a45
commit 48d7ebb85c
2 changed files with 21 additions and 8 deletions

View File

@ -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({

View File

@ -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 = `<!DOCTYPE html><html lang="en"><body> ${str}</body></html>`;
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;