配送产品打印代码提交

wang
郑明梁 3 years ago
parent b572af8676
commit 7f09d20130

@ -142,6 +142,17 @@ export function printSupCertManufacturer(data) {
});
}
export function printSupCertProduction(data) {
return axios({
url: "/sup/info/printSupCertProduction",
method: "post",
headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
responseType: 'arraybuffer', //一定要设置响应类型否则页面会是空白pdf
data: data
});
}

@ -343,7 +343,7 @@
</template>
<script>
import {getSupComapnys, delSupComapnys, printSupCert, verifyTemplateFile,filterCompanyCertIdList,printSupCertManufacturer} from "@/api/purchase/supCompany";
import {getSupComapnys, delSupComapnys, printSupCert, verifyTemplateFile,filterCompanyCertIdList,printSupCertManufacturer,printSupCertProduction} from "@/api/purchase/supCompany";
import supCompanyEditAdudit from "./supCompanyAduditDialog";
import supManufacturerAuditDialog from "@/views/purchase/supManufacturerAuditDialog";
import {deleteCompany, getCompanyList} from "@/api/purchase/supManufacturer";
@ -753,6 +753,48 @@ export default {
this.$message.error(error.message);
})
},
//
printSupCertProductionPdf(row) {
debugger
let query = {moduleId: 10};
this.loading = true;
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
//id
var supCertQuery={
customerId:row.customerId,
type:2
};
filterCompanyCertIdList(supCertQuery).then((req) => {
if(req.code===20000){
let printParams = {
templateId: res.data,
ids: req.data,
id: row.id
};
printSupCertProduction(printParams).then((response) => {
//pdfurl
const binaryData = [];
binaryData.push(response);
//blob
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: "application/pdf"})
);
this.loading = false;
window.open(url);//pdf
})
}
})
} else {
this.loading = false;
this.$message.error(res.message);
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
})
},
},
components: {

@ -577,6 +577,10 @@ export default {
certLists.forEach(item => {
selectIds.push(item.id);
})
if(selectIds.length==0){
this.$message.error("请先选择打印的证书!");
return
}
let query = {moduleId: 8};
this.loading = true;
verifyTemplateFile(query).then((res) => {

@ -740,6 +740,10 @@ export default {
certLists.forEach(item => {
selectIds.push(item.id);
})
if(selectIds.length==0){
this.$message.error("请先选择打印的证书!");
return
}
let query = {moduleId: 9};
this.loading = true;
verifyTemplateFile(query).then((res) => {

@ -10,8 +10,9 @@
<el-card class="el-card">
<div style="display: flex;" v-if="editType==2">
<div style="display: flex;">
<el-button
v-if="editType==2"
type="primary"
size="mini"
icon="search"
@ -20,6 +21,7 @@
</el-button
>
<el-button
v-if="editType==2"
type="primary"
size="mini"
icon="search"
@ -27,6 +29,14 @@
>审核拒绝
</el-button
>
<el-button
v-if="editType==1"
type="primary"
size="mini"
icon="search"
@click="printSupCertAll"
>打印
</el-button>
</div>
<el-row :gutter="20" class="el-row" type="flex" style="margin-top: 20px">
@ -204,7 +214,9 @@
<el-card class="el-card">
<el-table v-loading="certLoading"
:data="certList"
ref="certTable"
style="width: 100%">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="证书名称" prop="name"></el-table-column>
<el-table-column label="证书编号" prop="code"></el-table-column>
@ -234,6 +246,14 @@
>预览
</el-button
>
<el-button
v-if="editType==1"
type="text"
size="small"
@click.native="printSupCert(scope.row)"
>打印
</el-button
>
<el-button
type="text"
size="small"
@ -296,7 +316,11 @@ import {
TextToCode,
} from "element-china-area-data";
import draggable from "vuedraggable";
import {getSupComapnys} from "@/api/purchase/supCompany";
import {
getSupComapnys,
printSupCertProduction,
verifyTemplateFile
} from "@/api/purchase/supCompany";
import {addOrModifyCompany, getCompanyList} from "@/api/purchase/supManufacturer";
import {auditSupCert, deleteCompanyCert, filterCompanyCert} from "@/api/purchase/companyCert";
import companyAddCert from "@/views/purchase/supCertAddDialog";
@ -638,6 +662,76 @@ export default {
}
});
},
printSupCert(row) {
var selectIds=[row.id];
let query = {moduleId: 10};
this.loading = true;
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
let printParams = {
templateId: res.data,
ids: selectIds,
id: this.inputQuery.id
};
printSupCertProduction(printParams).then((response) => {
//pdfurl
const binaryData = [];
binaryData.push(response);
//blob
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: "application/pdf"})
);
this.loading = false;
window.open(url);//pdf
})
} else {
this.loading = false;
this.$message.error(res.message);
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
})
},
printSupCertAll() {
var certLists=this.$refs.certTable.selection;
var selectIds=[];
certLists.forEach(item => {
selectIds.push(item.id);
})
if(selectIds.length==0){
this.$message.error("请先选择打印的证书!");
return
}
let query = {moduleId: 10};
this.loading = true;
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
let printParams = {
templateId: res.data,
ids: selectIds,
id: this.inputQuery.id
};
printSupCertProduction(printParams).then((response) => {
//pdfurl
const binaryData = [];
binaryData.push(response);
//blob
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: "application/pdf"})
);
this.loading = false;
window.open(url);//pdf
})
} else {
this.loading = false;
this.$message.error(res.message);
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
})
},
},
filters: {
statusFilterType(status) {

Loading…
Cancel
Save