生产企业资质打印功能代码提交

wang
郑明梁 3 years ago
parent acda1b581b
commit c9372c3947

@ -93,6 +93,7 @@ export function getSubCompany(query) {
}
);
}
export function verifyTemplateFile(data) {
return axios({
url: "/sup/info/verifyTemplateFile",
@ -110,6 +111,7 @@ export function printSupCert(data) {
data: data
});
}
export function bindCorp(query) {
return axios(
{
@ -119,16 +121,27 @@ export function bindCorp(query) {
}
);
}
export function filterCompanyCertIdList(query) {
return axios(
{
url: "/sup/info/filterCompanyCertIdList",
method: "post",
data: query
}
return axios(
{
url: "/sup/info/filterCompanyCertIdList",
method: "post",
data: query
}
);
}
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
});
}

@ -191,6 +191,14 @@
@click.native.stop="addInfoDialog(scope.row)"
>详情
</el-button>
<el-button
type="text"
size="small"
v-if="scope.row.auditStatus !=6 && scope.row.auditStatus !=3"
@click.native="printSupCertProductionPdf(scope.row)"
>打印
</el-button>
</template>
</el-table-column>
</el-table>
@ -329,7 +337,7 @@
</template>
<script>
import {getSupComapnys, delSupComapnys, printSupCert, verifyTemplateFile,filterCompanyCertIdList} from "@/api/purchase/supCompany";
import {getSupComapnys, delSupComapnys, printSupCert, verifyTemplateFile,filterCompanyCertIdList,printSupCertProduction} from "@/api/purchase/supCompany";
import supCompanyEditAdudit from "./supCompanyAduditDialog";
import supManufacturerAuditDialog from "@/views/purchase/supManufacturerAuditDialog";
import {deleteCompany, getCompanyList} from "@/api/purchase/supManufacturer";
@ -699,6 +707,46 @@ export default {
this.$message.error(error.message);
})
},
//
printSupCertProductionPdf(row) {
let query = {moduleId: 9};
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: {

@ -177,14 +177,14 @@
>预览
</el-button
>
<el-button
v-if="editType==1"
type="text"
size="small"
@click.native="printSupCert(scope.row)"
>打印
</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"

@ -9,8 +9,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"
@ -19,6 +20,7 @@
</el-button
>
<el-button
v-if="editType==2"
type="primary"
size="mini"
icon="search"
@ -26,6 +28,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">
<el-col :span="10" class="el-col">
@ -190,7 +200,9 @@
</div>
<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>
@ -198,8 +210,8 @@
<el-table-column label="失效期" prop="expireDate"></el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="证书状态" prop="status">
<template slot-scope="scope">
{{ supStatus[scope.row.status] }}
<template slot-scope="scope">
{{ supStatus[scope.row.status] }}
</template>
</el-table-column>
<el-table-column label="审核状态" prop="auditStatus" width="120">
@ -227,6 +239,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"
@ -280,7 +300,11 @@ import {filterCompanyCert, deleteCompanyCert, auditSupCert} from "../../api/purc
import companyAddCert from "./supCertAddDialog";
import draggable from "vuedraggable";
import {getBasicUnitMaintains} from "@/api/basic/basicUnitMaintain";
import {getSupComapnys, modifyCompany} from "@/api/purchase/supCompany";
import {
getSupComapnys,
printSupCertProduction,
verifyTemplateFile
} from "@/api/purchase/supCompany";
import {getUUID} from "@/utils/strUtil";
export default {
@ -427,9 +451,9 @@ export default {
this.selectedOptions = this.inputQuery.placeAreaCode.split(",");
if(this.inputQuery.productionAreaCode!=null){
this.selectedOptions2 = this.inputQuery.productionAreaCode.split(",");
}
if (this.inputQuery.productionAreaCode != null) {
this.selectedOptions2 = this.inputQuery.productionAreaCode.split(",");
}
this.getCompanyCertList();
this.findMethod();
@ -496,7 +520,7 @@ export default {
this.getCompanyCertList();
},
getCompanyCertList() {
if(this.editType!=2 && this.editType!=0){
if (this.editType != 2 && this.editType != 0) {
this.certQuery.auditStatus = 20;
}
this.certLoading = true;
@ -505,7 +529,7 @@ export default {
.then((response) => {
this.certLoading = false;
this.certList = response.data.list || [];
this.certTotal=response.data.total;
this.certTotal = response.data.total;
})
.catch(() => {
this.certLoading = false;
@ -679,6 +703,72 @@ export default {
uploadHandleError() {
},
printSupCert(row) {
var selectIds=[row.id];
let query = {moduleId: 9};
this.loading = true;
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
let printParams = {
templateId: res.data,
ids: selectIds,
customerId: row.customerId
};
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);
})
let query = {moduleId: 9};
this.loading = true;
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
let printParams = {
templateId: res.data,
ids: selectIds,
customerId: this.inputQuery.customerId
};
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