formImage

This commit is contained in:
shijing 2021-12-03 09:56:53 +08:00
parent 90586a7d7d
commit b939fd9ca7
3 changed files with 91 additions and 91 deletions

View File

@ -44,5 +44,7 @@ export default {
top: 15px; top: 15px;
right: 18px; right: 18px;
} }
.bigDialog .el-dialog{
width: 70%!important;
}
</style> </style>

View File

@ -115,9 +115,10 @@
<el-row v-show="hasPicture"> <el-row v-show="hasPicture">
<el-form-item label="图表"> <el-form-item label="图表">
<div> <div>
<img id="canvasImg" src="./../../assets/glass.png" style="width:300px;height: 200px;display: none"> <img id="canvasImg" src="./../../assets/glass.png" style="width:500px;height: 300px;display: none">
<div style="position: relative;display: flex"> <div style="position: relative;display: flex;flex-direction: column;
<canvas id="canvas" width="300" height="200"> border: 1px solid #DCDFE6;">
<canvas id="canvas" width="500" height="300">
您的浏览器不支持绘图请升级或更换浏览器 您的浏览器不支持绘图请升级或更换浏览器
</canvas> </canvas>
<input type="text" value="" class="hide" id="txt" placeholder="请输入文字"> <input type="text" value="" class="hide" id="txt" placeholder="请输入文字">
@ -134,6 +135,11 @@
</div> </div>
</el-form-item> </el-form-item>
</el-row> </el-row>
<div style="text-align: right">
<el-button type="primary" @click="judgeForm">
合格验证
</el-button>
</div>
</el-form> </el-form>
</div> </div>
</template> </template>
@ -295,9 +301,9 @@
}, },
draw(){ draw(){
let canvasImg = document.getElementById("canvasImg"); let canvasImg = document.getElementById("canvasImg");
canvasImg.style.width = '300px'; canvasImg.style.width = '500px';
canvasImg.style.height = '200px'; canvasImg.style.height = '300px';
this.ctx.drawImage(canvasImg,0,0,300,200); this.ctx.drawImage(canvasImg,0,0,500,300);
}, },
// 叉号 // 叉号
error1(){ error1(){
@ -473,8 +479,6 @@
let that = this , let that = this ,
reg = /\{(.+?)\}/g, reg = /\{(.+?)\}/g,
judgeList = this.judgeList; judgeList = this.judgeList;
// debugger;
// console.log(judgeList);
for(let i=0;i<judgeList.length;i++){ for(let i=0;i<judgeList.length;i++){
let arr = [],str = ''; let arr = [],str = '';
let item = judgeList[i].rule_expression.replace(/`/g,''); let item = judgeList[i].rule_expression.replace(/`/g,'');
@ -485,16 +489,12 @@
}else{ }else{
arr.push(item); arr.push(item);
} }
// debugger;
// console.log(arr);
//对每个条件进行判定如果符合 //对每个条件进行判定如果符合
for (let i = 0;i<arr.length;i++){ for (let i = 0;i<arr.length;i++){
//获取判断依据 //获取判断依据
let a = '`'+ arr[i]+'`'; let a = '`'+ arr[i]+'`';
let tem =a.match(reg)[0]; let tem =a.match(reg)[0];
let ky = tem.replace(/\{|\}/g, '');//qipao let ky = tem.replace(/\{|\}/g, '');//qipao
// debugger;
// console.log(that.checkForm[ky]);
//有值时进行判断 //有值时进行判断
if(that.checkForm[ky]!==''&&that.checkForm[ky]!==null&&that.checkForm[ky]!==undefined){ if(that.checkForm[ky]!==''&&that.checkForm[ky]!==null&&that.checkForm[ky]!==undefined){
//替换变量 //替换变量
@ -508,8 +508,6 @@
} }
} }
} }
// debugger;
// console.log(str);
if(str.indexOf('true')>-1){ if(str.indexOf('true')>-1){
that.judgeList[i].judge = true; that.judgeList[i].judge = true;
}else{ }else{
@ -519,9 +517,6 @@
let real = that.judgeList.filter(item=>{ let real = that.judgeList.filter(item=>{
return item.judge==true; return item.judge==true;
}); });
// debugger;
// console.log(that.judgeList);
// console.log(real);
if(real.length>0){ if(real.length>0){
alert("检验不合格!") alert("检验不合格!")
}else{ }else{
@ -533,5 +528,67 @@
</script> </script>
<style scoped> <style scoped>
canvas {
width:500px!important;
/*border: 1px solid #000000;*/
cursor: crosshair;
margin: auto;
}
.canvasBtnWrap {
display: flex;
/*flex-direction: column;*/
/*width: 80px;*/
/*padding-left: 20px;*/
justify-content: flex-end;
}
.canvasBtn {
width: 70px;
height: 35px;
line-height: 35px;
border: 1px solid #aaaaaa;
text-align: center;
border-radius: 15px;
margin-right: 10px;
margin-bottom: 10px;
}
.hide {
display: none;
}
#txt {
position: absolute;
top: 1%;
left: 1%;
width: 150px;
height: 30px;
border: 1px solid #e42343;
}
#word {
position: absolute;
width: 200px;
height: 70px;
padding: 0 2px;
background: none;
color: #e42343;
border: 1px dashed #b9b9b9;
}
#word::-webkit-input-placeholder {
color: #e42343;
}
#word::-moz-placeholder {
color: #e42343;
}
#word::placeholder {
color: #e42343;
}
#res {
display: inline-block;
}
</style> </style>

View File

@ -85,6 +85,7 @@
</el-dialog> </el-dialog>
<!--表格展示--> <!--表格展示-->
<el-dialog <el-dialog
class="bigDialog"
:visible.sync="dialogVisibleForm" :visible.sync="dialogVisibleForm"
:close-on-click-modal="false" :close-on-click-modal="false"
:title="tableForm.name" :title="tableForm.name"
@ -225,11 +226,11 @@
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form>--> </el-form>-->
<div style="text-align: right"> <!--<div style="text-align: right">-->
<el-button type="primary" @click="judgeForm"> <!--<el-button type="primary" @click="judgeForm">-->
合格验证 <!--合格验证-->
</el-button> <!--</el-button>-->
</div> <!--</div>-->
</el-dialog> </el-dialog>
</el-card> </el-card>
</el-col> </el-col>
@ -821,14 +822,14 @@
that.$set(that.checkForm, key, '') that.$set(that.checkForm, key, '')
} }
that.dialogVisibleForm = true; that.dialogVisibleForm = true;
setTimeout(function () { /* setTimeout(function () {
that.canvasInit(); that.canvasInit();
}, 500); }, 500);*/
} }
}); });
that.fieldLists(); that.fieldLists();
}, },
canvasInit() { /*canvasInit() {
let that = this; let that = this;
preDrawAry = []; preDrawAry = [];
that.canvas = document.getElementById('canvas'); that.canvas = document.getElementById('canvas');
@ -841,7 +842,7 @@
setTimeout(function () { setTimeout(function () {
that.draw(); that.draw();
}, 500); }, 500);
}, },*/
checkPermission, checkPermission,
handleCurrentChange(row) { handleCurrentChange(row) {
@ -883,7 +884,7 @@
} }
}); });
}, },
draw() { /*draw() {
let canvasImg = document.getElementById("canvasImg"); let canvasImg = document.getElementById("canvasImg");
canvasImg.style.width = '300px'; canvasImg.style.width = '300px';
canvasImg.style.height = '200px'; canvasImg.style.height = '200px';
@ -1020,13 +1021,13 @@
} }
}, },
/* // 删除批注 /!* // 删除批注
restuya(){ restuya(){
this.word.style.display="none"; this.word.style.display="none";
this.Txt.style.display="none"; this.Txt.style.display="none";
this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height); this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
window.location.reload(); window.location.reload();
},*/ },*!/
// 撤销 // 撤销
back() { back() {
@ -1128,7 +1129,7 @@
} else { } else {
alert("检验合格!") alert("检验合格!")
} }
}, },*/
//新增记录表 //新增记录表
handleCreate() { handleCreate() {
this.recordform = Object.assign({}, defaultrecordform); this.recordform = Object.assign({}, defaultrecordform);
@ -1274,64 +1275,4 @@
background: #fde2e2; background: #fde2e2;
} }
canvas {
border: 1px solid #000000;
cursor: crosshair;
}
.canvasBtnWrap {
display: flex;
flex-direction: column;
width: 80px;
padding-left: 20px;
justify-content: space-between;
}
.canvasBtn {
width: 70px;
height: 35px;
line-height: 35px;
border: 1px solid #aaaaaa;
text-align: center;
border-radius: 15px;
}
.hide {
display: none;
}
#txt {
position: absolute;
top: 1%;
left: 1%;
width: 150px;
height: 30px;
border: 1px solid #e42343;
}
#word {
position: absolute;
width: 150px;
height: 70px;
padding: 0 2px;
background: none;
color: #e42343;
border: 1px dashed #b9b9b9;
}
#word::-webkit-input-placeholder {
color: #e42343;
}
#word::-moz-placeholder {
color: #e42343;
}
#word::placeholder {
color: #e42343;
}
#res {
display: inline-block;
}
</style> </style>