点击放大图片

hn2.0
fanluyan 2 years ago
parent c50af173f9
commit 2d400baf14

@ -74,6 +74,12 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item>
<el-input
v-model="formdata.search"
placeholder="请输入线路/杆塔/设备名称"
></el-input>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="onSubmit"></el-button>
</el-form-item> </el-form-item>
@ -85,7 +91,7 @@
</el-form> </el-form>
</div> </div>
<div class="alarmContain" v-loading="loading" v-if="!tableShow"> <div class="alarmContain" v-loading="loading" v-if="tableShow">
<div class="alarmTable"> <div class="alarmTable">
<el-table <el-table
ref="multipleTable" ref="multipleTable"
@ -255,7 +261,11 @@
<div class="bigpic"> <div class="bigpic">
<div class="picshow" @click="handlePicAlarm(item, index)"> <div class="picshow" @click="handlePicAlarm(item, index)">
<img :src="item.path + '!1366x768'" ref="picJpg" /> <img :src="item.path + '!1366x768'" ref="picJpg" />
<canvas id="myCanvas" class="myCanvas" ref="myCanvas"></canvas> <!-- <canvas
id="myCanvas"
class="myCanvas"
:ref="'myCanvas' + index"
></canvas> -->
</div> </div>
<div class="caption"> <div class="caption">
@ -316,7 +326,7 @@
:style="{ transform: 'scale(' + zoomD + ')' }" :style="{ transform: 'scale(' + zoomD + ')' }"
@mousedown="move" @mousedown="move"
> >
<img @load="imgOnload" class="maskPic img" :src="bigPhotoPic" /> <img @load="imgOnload" class="maskPic img" :src="bigPhotoPic" ref="" />
<canvas id="myCanvas" class="myCanvas" ref="myCanvasbig"></canvas> <canvas id="myCanvas" class="myCanvas" ref="myCanvasbig"></canvas>
</div> </div>
<div class="viewClose" @click="closePic"> <div class="viewClose" @click="closePic">
@ -539,7 +549,6 @@ export default {
this.photoPic = res.data.list[0].path; this.photoPic = res.data.list[0].path;
this.selectRow = res.data.list[0]; this.selectRow = res.data.list[0];
console.log(this.selectRow); console.log(this.selectRow);
this.$refs.multipleTable.setCurrentRow(this.selectRow); this.$refs.multipleTable.setCurrentRow(this.selectRow);
this.handleRowClick(this.selectRow); this.handleRowClick(this.selectRow);
}) })
@ -642,7 +651,7 @@ export default {
// this.ctx.strokeStyle = "red"; //线 // this.ctx.strokeStyle = "red"; //线
this.ctx.strokeRect(top, left, width, height); // this.ctx.strokeRect(top, left, width, height); //
//this.ctx.strokeRect(data.x, data.y, data.width, data.height); //this.ctx.strokeRect(data.x, data.y, data.width, data.height);
this.ctx.font = "16px normal"; this.ctx.font = "12px normal";
this.ctx.fillStyle = "#ff0000"; this.ctx.fillStyle = "#ff0000";
//this.ctx.fillText(this.textInfo, top, left + 24); //this.ctx.fillText(this.textInfo, top, left + 24);
// //
@ -654,6 +663,53 @@ export default {
this.ctx.closePath(); this.ctx.closePath();
this.ctx.stroke(); this.ctx.stroke();
}, },
//
drawlineListAll(val) {
for (let i = 0; i < val.length; i++) {
console.log(i);
console.log(this.$refs.myCanvas);
console.log(this.$refs.picJpg);
this.canvas = this.$refs.myCanvas;
this.imgpic = this.$refs.picJpg;
this.textInfo = val[i].enname;
console.log(this.textInfo);
console.log(this.imgpic.offsetWidth);
console.log(this.canvas);
this.canvas.width = this.imgpic.offsetWidth; //
this.canvas.height = this.imgpic.offsetHeight; //
console.log(this.canvas.width, this.canvas.height);
this.ctx = this.canvas.getContext("2d");
this.ctx.beginPath();
//线
this.ctx.strokeStyle = "#ff0000";
// 线
this.ctx.lineWidth = 1;
//
var scaleX = this.canvas.width / val[i].photoWidth, //this.iw
scaleY = this.canvas.height / val[i].photoHeight; //this.ih
console.log(scaleX, scaleY);
var top = val[i].x * scaleX,
left = val[i].y * scaleY,
width = val[i].width * scaleX,
height = val[i].height * scaleY;
console.log(top, left, width, height);
// this.ctx.strokeStyle = "red"; //线
this.ctx.strokeRect(top, left, width, height); //
//this.ctx.strokeRect(val[i].x, val[i].y, val[i].width, val[i].height);
this.ctx.font = "16px normal";
this.ctx.fillStyle = "#ff0000";
//this.ctx.fillText(this.textInfo, top, left + 24);
//
if (left > 32) {
this.ctx.fillText(this.textInfo, top, left - 4);
} else if (this.canvas.height - left + height > 32) {
this.ctx.fillText(this.textInfo, top, height - 4);
}
this.ctx.closePath();
this.ctx.stroke();
}
},
// //
drawlineList(data, index) { drawlineList(data, index) {
console.log(data); console.log(data);
@ -685,7 +741,7 @@ export default {
// this.ctx.strokeStyle = "red"; //线 // this.ctx.strokeStyle = "red"; //线
this.ctx.strokeRect(top, left, width, height); // this.ctx.strokeRect(top, left, width, height); //
//this.ctx.strokeRect(data.x, data.y, data.width, data.height); //this.ctx.strokeRect(data.x, data.y, data.width, data.height);
this.ctx.font = "16px normal"; this.ctx.font = "12px normal";
this.ctx.fillStyle = "#ff0000"; this.ctx.fillStyle = "#ff0000";
//this.ctx.fillText(this.textInfo, top, left + 24); //this.ctx.fillText(this.textInfo, top, left + 24);
// //
@ -787,6 +843,10 @@ export default {
// //
handleListRow() { handleListRow() {
this.tableShow = !this.tableShow; this.tableShow = !this.tableShow;
this.zoomD = 1;
if (!this.tableShow) {
this.drawlineListAll(this.tableData);
}
}, },
// //
@ -935,7 +995,7 @@ export default {
} }
.alarmContain { .alarmContain {
display: flex; display: flex;
height: calc(100% - 90px); height: calc(100% - 98px);
padding: 0px 8px; padding: 0px 8px;
.alarmTable { .alarmTable {
width: 50%; width: 50%;
@ -1011,8 +1071,8 @@ export default {
} }
} }
.pictureBox { .pictureBox {
height: calc(100% - 90px); height: calc(100% - 136px);
max-height: calc(100% - 90px); max-height: calc(100% - 136px);
.el-empty { .el-empty {
margin: auto; margin: auto;
} }

Loading…
Cancel
Save