画布重叠问题bug修复

This commit is contained in:
hongchao 2024-12-25 17:31:00 +08:00
parent 0242282372
commit b488e2727d
1 changed files with 13 additions and 23 deletions

View File

@ -574,7 +574,7 @@
<div slot="footer" class="dialog-footer" style="text-align: center"> <div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="handleExportCheck">导出</el-button> <el-button type="primary" @click="handleExportCheck">导出</el-button>
<el-button type="primary" @click="printCheck"> </el-button> <el-button type="primary" @click="printCheck"> </el-button>
<el-button @click="openPrint = false"> </el-button> <el-button @click="closeDialogAndRefresh"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -959,7 +959,6 @@ export default {
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -1183,8 +1182,6 @@ export default {
this.printTableData = res.data.leaseOutVoList; this.printTableData = res.data.leaseOutVoList;
setTimeout(() => { setTimeout(() => {
//
this.clearCanvas();
this.chapter('机具检验专用章', this.checkDataInfo.leaseUnit) this.chapter('机具检验专用章', this.checkDataInfo.leaseUnit)
}, 200); }, 200);
this.openPrint = true; this.openPrint = true;
@ -1200,16 +1197,6 @@ export default {
); );
}, },
//
clearCanvas() {
const canvas = document.getElementById("canvas");
if (canvas) {
const context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
}
},
// //
async handleLld(row) { async handleLld(row) {
this.open = true; this.open = true;
@ -1286,12 +1273,18 @@ export default {
printView() { printView() {
// this.$refs.remarksPrintRef.print(); // this.$refs.remarksPrintRef.print();
}, },
chapter(text, companyName) { //
closeDialogAndRefresh() {
this.openPrint = false;
},
chapter(text, companyName) {
let canvas = document.getElementById("canvas"); let canvas = document.getElementById("canvas");
if(canvas){
let context = canvas.getContext("2d"); let context = canvas.getContext("2d");
canvas.width = canvas.width;
context.height = canvas.height;
// //
// context.clearRect(0, 0, canvas.width, canvas.height);
//let text = "XXX"; //let text = "XXX";
//let companyName = "XXX"; //let companyName = "XXX";
@ -1305,7 +1298,7 @@ export default {
context.stroke(); context.stroke();
// //
create5star(context, width, height, 20, "#f00", 0); this.create5star(context, width, height, 20, "#f00", 0);
// //
context.font = "14px 宋体"; context.font = "14px 宋体";
@ -1336,9 +1329,10 @@ export default {
context.strokeText(c, 0, 0); // context.strokeText(c, 0, 0); //
context.restore(); context.restore();
} }
},
// //
function create5star(context, sx, sy, radius, color, rotato) { create5star(context, sx, sy, radius, color, rotato) {
context.save(); context.save();
context.fillStyle = color; context.fillStyle = color;
context.translate(sx, sy); // context.translate(sx, sy); //
@ -1358,11 +1352,7 @@ export default {
context.fill(); context.fill();
context.restore(); context.restore();
} }
}
}, },
},
watch: { watch: {
$route: { $route: {