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

wang
郑明梁 3 years ago
parent acda1b581b
commit c9372c3947

@ -93,6 +93,7 @@ export function getSubCompany(query) {
} }
); );
} }
export function verifyTemplateFile(data) { export function verifyTemplateFile(data) {
return axios({ return axios({
url: "/sup/info/verifyTemplateFile", url: "/sup/info/verifyTemplateFile",
@ -110,6 +111,7 @@ export function printSupCert(data) {
data: data data: data
}); });
} }
export function bindCorp(query) { export function bindCorp(query) {
return axios( return axios(
{ {
@ -119,16 +121,27 @@ export function bindCorp(query) {
} }
); );
} }
export function filterCompanyCertIdList(query) { export function filterCompanyCertIdList(query) {
return axios( return axios(
{ {
url: "/sup/info/filterCompanyCertIdList", url: "/sup/info/filterCompanyCertIdList",
method: "post", method: "post",
data: query 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)" @click.native.stop="addInfoDialog(scope.row)"
>详情 >详情
</el-button> </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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -329,7 +337,7 @@
</template> </template>
<script> <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 supCompanyEditAdudit from "./supCompanyAduditDialog";
import supManufacturerAuditDialog from "@/views/purchase/supManufacturerAuditDialog"; import supManufacturerAuditDialog from "@/views/purchase/supManufacturerAuditDialog";
import {deleteCompany, getCompanyList} from "@/api/purchase/supManufacturer"; import {deleteCompany, getCompanyList} from "@/api/purchase/supManufacturer";
@ -699,6 +707,46 @@ export default {
this.$message.error(error.message); 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: { components: {

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

@ -9,8 +9,9 @@
> >
<el-card class="el-card"> <el-card class="el-card">
<div style="display: flex;" v-if="editType==2"> <div style="display: flex;">
<el-button <el-button
v-if="editType==2"
type="primary" type="primary"
size="mini" size="mini"
icon="search" icon="search"
@ -19,6 +20,7 @@
</el-button </el-button
> >
<el-button <el-button
v-if="editType==2"
type="primary" type="primary"
size="mini" size="mini"
icon="search" icon="search"
@ -26,6 +28,14 @@
>审核拒绝 >审核拒绝
</el-button </el-button
> >
<el-button
v-if="editType==1"
type="primary"
size="mini"
icon="search"
@click="printSupCertAll"
>打印
</el-button>
</div> </div>
<el-row :gutter="20" class="el-row" type="flex" style="margin-top: 20px"> <el-row :gutter="20" class="el-row" type="flex" style="margin-top: 20px">
<el-col :span="10" class="el-col"> <el-col :span="10" class="el-col">
@ -190,7 +200,9 @@
</div> </div>
<el-table v-loading="certLoading" <el-table v-loading="certLoading"
:data="certList" :data="certList"
ref="certTable"
style="width: 100%"> 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 type="index" label="序号" width="50"></el-table-column>
<el-table-column label="证书名称" prop="name"></el-table-column> <el-table-column label="证书名称" prop="name"></el-table-column>
<el-table-column label="证书编号" prop="code"></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="expireDate"></el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column> <el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="证书状态" prop="status"> <el-table-column label="证书状态" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
{{ supStatus[scope.row.status] }} {{ supStatus[scope.row.status] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="审核状态" prop="auditStatus" width="120"> <el-table-column label="审核状态" prop="auditStatus" width="120">
@ -227,6 +239,14 @@
>审核 >审核
</el-button </el-button
> >
<el-button
v-if="editType==1"
type="text"
size="small"
@click.native="printSupCert(scope.row)"
>打印
</el-button
>
<el-button <el-button
type="text" type="text"
size="small" size="small"
@ -280,7 +300,11 @@ import {filterCompanyCert, deleteCompanyCert, auditSupCert} from "../../api/purc
import companyAddCert from "./supCertAddDialog"; import companyAddCert from "./supCertAddDialog";
import draggable from "vuedraggable"; import draggable from "vuedraggable";
import {getBasicUnitMaintains} from "@/api/basic/basicUnitMaintain"; 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"; import {getUUID} from "@/utils/strUtil";
export default { export default {
@ -427,9 +451,9 @@ export default {
this.selectedOptions = this.inputQuery.placeAreaCode.split(","); this.selectedOptions = this.inputQuery.placeAreaCode.split(",");
if(this.inputQuery.productionAreaCode!=null){ if (this.inputQuery.productionAreaCode != null) {
this.selectedOptions2 = this.inputQuery.productionAreaCode.split(","); this.selectedOptions2 = this.inputQuery.productionAreaCode.split(",");
} }
this.getCompanyCertList(); this.getCompanyCertList();
this.findMethod(); this.findMethod();
@ -496,7 +520,7 @@ export default {
this.getCompanyCertList(); this.getCompanyCertList();
}, },
getCompanyCertList() { getCompanyCertList() {
if(this.editType!=2 && this.editType!=0){ if (this.editType != 2 && this.editType != 0) {
this.certQuery.auditStatus = 20; this.certQuery.auditStatus = 20;
} }
this.certLoading = true; this.certLoading = true;
@ -505,7 +529,7 @@ export default {
.then((response) => { .then((response) => {
this.certLoading = false; this.certLoading = false;
this.certList = response.data.list || []; this.certList = response.data.list || [];
this.certTotal=response.data.total; this.certTotal = response.data.total;
}) })
.catch(() => { .catch(() => {
this.certLoading = false; this.certLoading = false;
@ -679,6 +703,72 @@ export default {
uploadHandleError() { 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: { filters: {
statusFilterType(status) { statusFilterType(status) {

Loading…
Cancel
Save