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 params: query
}) })
} }
//检测记录模板
export function getTestRecordExport(id) {
return request({
url: `/qm/testrecord/${id}/export/`,
method: 'get'
})
}
//检测记录 //检测记录
export function getTestRecordItem(id) { export function getTestRecordItem(id) {
return request({ return request({

View File

@ -801,7 +801,7 @@
import {createTicket, getWorkflowInit} from "@/api/workflow"; import {createTicket, getWorkflowInit} from "@/api/workflow";
import {getrecordformList, getrffieldList} from "@/api/mtm"; import {getrecordformList, getrffieldList} from "@/api/mtm";
import {getwproductList, wproductPutin, createputins, testInit, scrap, getRetrial} from "@/api/wpm"; 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 Pagination from "@/components/Pagination"; // secondary package based on el-pagination
// import {saveAs} from "file-saver"; // import {saveAs} from "file-saver";
// import htmlDocx from "html-docx-js/dist/html-docx"; // import htmlDocx from "html-docx-js/dist/html-docx";
@ -813,6 +813,7 @@
components: {Pagination, customForm, reviewForm, faceLogin}, components: {Pagination, customForm, reviewForm, faceLogin},
data() { data() {
return { return {
exportFormId:null,
testitem: defaultetestitem, testitem: defaultetestitem,
formbcp: {}, formbcp: {},
form: {remark: "", warehouse: ""}, form: {remark: "", warehouse: ""},
@ -975,13 +976,17 @@
}, },
methods: { methods: {
exportDom() { exportDom() {
htmlToPdf.downloadPDF(document.getElementById('pdfDom'), this.formName); // htmlToPdf.downloadPDF(document.getElementById('pdfDom'), this.formName);
/* let dom = document.querySelector("#showForm .el-dialog"); getTestRecordExport(this.exportFormId).then(res=>{
let str = dom.innerHTML; if(res.code===200){
debugger; debugger;
console.log(str); console.log(res.data.path)
let htmlStr = `<!DOCTYPE html><html lang="en"><body> ${str}</body></html>`; let link = document.createElement('a');
saveAs(htmlDocx.asBlob(htmlStr, {orientation: "landscape"}), "报告.doc");*/ link.href = 'http://49.232.14.174:2222'+res.data.path;
document.body.appendChild(link);
link.click();
}
})
}, },
checkPermission, checkPermission,
@ -1379,6 +1384,7 @@
that.fieldList = []; that.fieldList = [];
that.create_by_ = scope.row.create_by_.name; that.create_by_ = scope.row.create_by_.name;
that.update_time = scope.row.update_time; that.update_time = scope.row.update_time;
that.exportFormId = scope.row.id;
getTestRecordItem(scope.row.id).then((res) => { getTestRecordItem(scope.row.id).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
that.recordFinishedVisible = true; that.recordFinishedVisible = true;