You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1296 lines
38 KiB
Vue

<template>
<div class="alarmHandBox">
<div class="searchMain">
<div class="searchBox">
<el-form :inline="true" :model="formdata" class="demo-form-inline">
<el-form-item label="电压等级" class="dybox">
<el-select v-model="formdata.dyId" @change="getSearchxl">
<el-option
v-for="item in dyOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="线路名称" class="xlbox">
<el-select
v-model="formdata.lineId"
@change="getSearchgt"
filterable
>
<el-option
v-for="item in xlOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="杆塔名称">
<el-select v-model="formdata.towerId" filterable>
<el-option
v-for="item in gtOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="开始日期">
<!-- <el-date-picker
v-model="formdata.timeVal"
type="datetimerange"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="timestamp"
></el-date-picker> -->
<el-date-picker
v-model="formdata.starttime"
type="datetime"
placeholder="开始日期"
value-format="timestamp"
>
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期">
<el-date-picker
v-model="formdata.endtime"
type="datetime"
default-time="23:59:59"
placeholder="结束日期"
value-format="timestamp"
class="ml10"
>
</el-date-picker>
</el-form-item>
<el-form-item label="告警原因" class="gjbox">
<el-select v-model="formdata.label">
<el-option
v-for="item in gjOptions"
:key="item.label"
:label="item.name"
:value="item.label"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-input
v-model="formdata.search"
placeholder="请输入线路/杆塔/设备名称"
clearable
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleListRow">{{
tableShow ? "图片列表" : "表格列表"
}}</el-button>
</el-form-item>
</el-form>
</div>
<div class="alarmContain" v-loading="loading" v-if="tableShow">
<div class="alarmTable">
<el-table
ref="multipleTable"
:data="tableData"
stripe
border
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange"
height="calc(100% - 40px)"
@row-click="handleRowClick"
highlight-current-row
>
<template slot="empty">
<el-empty :image-size="160" description="暂无数据"></el-empty>
</template>
<el-table-column min-width="45" label="序号">
<template slot-scope="scope">
<span>{{ (page - 1) * pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column
prop="alarmTime"
label="告警时间"
min-width="135"
:show-overflow-tooltip="true"
:formatter="dateFormat"
>
</el-table-column>
<!-- <el-table-column
prop="dyLevel"
label="电压等级"
min-width="75"
:show-overflow-tooltip="true"
>
</el-table-column> -->
<el-table-column
prop="lineName"
label="线路名称"
min-width="105"
:show-overflow-tooltip="true"
>
</el-table-column>
<el-table-column
prop="towerName"
label="杆塔名称"
min-width="145"
:show-overflow-tooltip="true"
>
</el-table-column>
<el-table-column
prop="displayName"
label="设备名称"
min-width="145"
:show-overflow-tooltip="true"
>
</el-table-column>
<el-table-column
label="通道"
min-width="75"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">{{
scope.row.alias !== null && scope.row.alias !== ""
? scope.row.alias
: scope.row.channnelName
}}</template>
</el-table-column>
<!-- <el-table-column
prop="termId"
label="设备编号"
min-width="75"
:show-overflow-tooltip="true"
>
</el-table-column> -->
<el-table-column
prop="enname"
label="告警原因"
min-width="155"
:show-overflow-tooltip="true"
>
</el-table-column>
<el-table-column label="是否已读" min-width="95" fixed="right">
<template slot-scope="scope">
<span v-if="scope.row.isread == 1" class="readbox">[已读]</span>
<span v-if="scope.row.isread == 0">[未读]</span>
</template>
</el-table-column>
</el-table>
<div class="pageNation">
<el-pagination
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
:current-page="page"
:page-size="pageSize"
layout="sizes, prev, pager, next, jumper,total"
:total="total"
>
</el-pagination>
</div>
</div>
<div class="alarmPic">
<div
class="imgshow"
v-loading="alarmLoading"
@click="handleBigPicbox(selectRow)"
>
<!-- @click="handleBigPicbox(selectRow)" -->
<div
class="picshow"
v-if="selectRow.path !== '' && tableData.length !== 0"
>
<!-- v-viewer="OptionssalseImg" -->
<img ref="picJpg" class="animImg" :src="photoPic + '!1366x768'" />
<canvas id="myCanvas" class="myCanvas" ref="myCanvas"></canvas>
</div>
<img
ref="picJpg"
src="../../assets/img/nopic.jpg"
v-if="
selectRow.path == '' ||
selectRow.path == null ||
tableData.length == 0
"
/>
</div>
<div class="editorBtn">
<el-button
type="primary"
:loading="btnpicloading"
@click="handleCommandpic"
:disabled="tableData.length == 0"
>主动拍照</el-button
>
<el-button
type="primary"
@click="handleHistory(selectRow)"
:disabled="tableData.length == 0"
>历史图片</el-button
>
</div>
</div>
</div>
<div class="pictureBox" v-else v-loading="loading">
<div class="piclist" v-if="tableData.length !== 0">
<div
class="box-card imgList"
v-for="(item, index) in tableData"
:key="index"
:class="current === index ? 'bgColor' : ''"
>
<div class="bigpic">
<div class="toolsBtn">
<el-button
title="主动拍照"
type="primary"
icon="el-icon-camera"
@click.stop="handlePicList(item)"
></el-button>
<el-button
title="历史图片"
type="primary"
icon="el-icon-picture-outline"
@click.stop="handlePicHistory(item)"
></el-button>
</div>
<div class="picshow" @click="handlePicAlarm(item)">
<img
v-if="item.path == '' || null"
src="../../assets/img/nodatapic2.jpg"
/>
<img
v-else
:id="'img' + index"
:ref="'imgref' + index"
:src="item.path + '!1366x768'"
ref="picJpg"
/>
<canvas
:ref="'canvansref' + index"
:id="'canvas_' + index"
class="canvasAll"
></canvas>
</div>
<div class="caption">
<p class="infoTop">
<span v-if="item.isread == 1" class="readbox">[已读]</span>
<span v-if="item.isread == 0">[未读]</span>
<span>
{{ item.lineName }} /
{{
item.displayName !== null && item.displayName !== ""
? item.towerName
: item.displayName
}}
/
{{
item.alias !== null && item.alias !== ""
? item.alias
: item.channnelName
}}
</span>
</p>
<p class="infoBottom">
<span>{{
$moment(item.alarmTime).format("YYYY-MM-DD HH:mm:ss")
}}</span>
<span class="alarmInfo">({{ item.enname }})</span>
</p>
</div>
</div>
</div>
</div>
<div class="piclist" v-else>
<el-empty description="暂无数据"></el-empty>
</div>
<div class="pageNation">
<el-pagination
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
:current-page="page"
:page-size="pageSize"
layout="sizes, prev, pager, next, jumper,total"
:total="total"
>
</el-pagination>
</div>
</div>
</div>
<!-- 点击出现大图 -->
<div v-if="showBigpic" class="showPic" v-loading="canvasloading">
<div
class="picboxI"
@mousewheel.prevent="rollImg"
:style="{ transform: 'scale(' + zoomD + ')' }"
@mousedown="move"
>
<img
@load="imgOnload"
id="bigimg"
ref="bigimgref"
class="maskPic img"
:src="bigPhotoPic"
/>
<canvas id="bigCanvas" class="myCanvas" ref="myCanvasbig"></canvas>
</div>
<div class="viewClose" @click="closePic">
<i class="el-icon-close"></i>
</div>
</div>
<historyimg ref="historyimg_ref"></historyimg>
</div>
</template>
<script>
import {
getSearchInfo,
getAlarmList,
getAlarmTypeList,
// getLatestPhotoJoggle,
// getReturnedPhotoJoggle,
getTermStatus,
takePicJoggle,
getTakePicPhotoStatusJoggle,
getTakePicStatusJoggle,
readAlarm,
} from "@/utils/api/index";
import historyimg from "./components/historyimg.vue";
import moment from "moment";
export default {
components: {
historyimg,
},
data() {
return {
OptionssalseImg: {
inline: false,
button: true,
navbar: false,
title: false,
toolbar: false,
tooltip: false,
zoomable: true,
url: "src",
},
dyOptions: [{ id: -1, name: "全部" }], //电压数据
xlOptions: [{ id: -1, name: "全部" }], //线路数据
gtOptions: [{ id: -1, name: "全部" }], //杆塔数据
gjOptions: [{ id: -1, label: -1, name: "全部" }], //告警数据
formdata: {
dyId: -1,
lineId: -1,
towerId: -1,
label: -1,
search: "",
// timeVal: "",
},
photoPic: "",
tableData: [],
multipleSelection: [],
page: 1, // 当前页数
pageSize: 20, // 每页数量
total: 0, //总条数
loading: false,
btnpicloading: false,
timer: null,
i: 0,
isreadshow: false,
showBigpic: false,
textInfo: "",
bigPhotoPic: "", //大图路径
selectRow: {},
alarmLoading: false,
canvasloading: false,
tableShow: false, //表格展示
zoomD: 1,
canvansdata: "",
current: 0,
requestId: "", //请求拍照返回的requestid
picTime: "", //请求拍照返回的时间
};
},
created() {
var that = this;
document.onkeydown = function (e) {
var key = window.event.keyCode;
if (key === 13) {
that.onSubmit(); // 触发事件
}
};
},
mounted() {
// this.$set(this.formdata, "timeVal", [
// new Date(new Date().toLocaleDateString()).getTime(),
// new Date().getTime(),
// ]);
// $("#elementToZoomOn").smartZoom({
// maxScale: 2,
// });
this.$set(
this.formdata,
"starttime",
new Date(new Date().toLocaleDateString()).getTime()
);
this.$set(this.formdata, "endtime", new Date().getTime());
this.getSearchdy();
this.getTableList();
},
methods: {
//移动demo
move(e) {
console.log(e);
e.preventDefault();
// 获取元素
var personBox = document.querySelector(".picboxI");
var img = document.querySelector(".img");
var x = e.pageX - img.offsetLeft;
var y = e.pageY - img.offsetTop;
// 添加鼠标移动事件
personBox.addEventListener("mousemove", move);
console.log(personBox.addEventListener("mousemove", move));
console.log(personBox.style);
function move(e) {
console.log(personBox.style.left);
personBox.style.left = e.pageX - x + "px";
personBox.style.top = e.pageY - y + "px";
}
// 添加鼠标抬起事件,鼠标抬起,将事件移除
img.addEventListener("mouseup", function () {
personBox.removeEventListener("mousemove", move);
});
// 鼠标离开父级元素,把事件移除
personBox.addEventListener("mouseout", function () {
personBox.removeEventListener("mousemove", move);
});
},
// 缩放图片
rollImg(e) {
let direction = e.deltaY > 0 ? "down" : "up";
if (direction === "up") {
// 滑轮向上滚动
this.large();
} else {
// 滑轮向下滚动
this.Small();
}
},
//大
large() {
this.$nextTick(() => {
if (this.zoomD < 6) {
this.zoomD += 0.1;
}
document.querySelector(
".picboxI"
).style.transform = `matrix(${this.zoomD}, 0, 0,${this.zoomD}, 0, 0)`;
});
},
// 小
Small() {
this.$nextTick(() => {
if (this.zoomD > 0.3) {
this.zoomD -= 0.1;
}
document.querySelector(
".picboxI"
).style.transform = `matrix(${this.zoomD}, 0, 0, ${this.zoomD}, 0, 0)`;
});
},
handleBigPicbox(val) {
this.canvasloading = true;
this.canvansdata = val;
if (val.path !== "" && this.tableData.length !== 0) {
this.bigPhotoPic = val.path;
this.showBigpic = true;
setTimeout(() => {
this.$nextTick(() => {
this.drawline2(val);
});
}, 100);
}
},
closePic() {
this.showBigpic = false;
this.zoomD = 1;
},
//获取电压信息
getSearchdy() {
getSearchInfo({ type: 1 })
.then((res) => {
this.dyOptions = this.dyOptions.concat(res.data.list);
this.formdata.dyId = this.dyOptions[0].id;
this.getSearchxl();
})
.catch((err) => {});
},
//获取线路数据
getSearchxl() {
getSearchInfo({ type: 2, id: this.formdata.dyId })
.then((res) => {
this.xlOptions = [{ id: -1, name: "全部" }];
this.xlOptions = this.xlOptions.concat(res.data.list);
this.formdata.lineId = this.xlOptions[0].id;
this.getSearchgt();
})
.catch((err) => {});
},
//获取杆塔数据
getSearchgt() {
getSearchInfo({ type: 3, id: this.formdata.lineId })
.then((res) => {
this.gtOptions = [{ id: -1, name: "全部" }];
this.gtOptions = this.gtOptions.concat(res.data.list);
this.formdata.towerId = this.gtOptions[0].id;
this.getSearchgj();
})
.catch((err) => {});
},
//获取告警原因
getSearchgj() {
getAlarmTypeList()
.then((res) => {
this.gjOptions = [{ id: -1, label: -1, name: "全部" }];
this.gjOptions = this.gjOptions.concat(res.data.list);
console.log(this.gjOptions);
this.formdata.label = this.gjOptions[0].label;
console.log(this.formdata.label);
})
.catch((err) => {});
},
//获取数据
getTableList() {
this.loading = true;
this.$set(this.formdata, "pageindex", this.page);
this.$set(this.formdata, "pagesize", this.pageSize);
// this.$set(this.formdata, "starttime", this.formdata.timeVal[0]);
// this.$set(this.formdata, "endtime", this.formdata.timeVal[1]);
getAlarmList(this.formdata)
.then((res) => {
this.loading = false;
this.tableData = res.data.list.filter((item) => item.path);
this.total = res.data.total;
this.photoPic = res.data.list[0].path;
this.selectRow = res.data.list[0];
console.log(this.selectRow);
if (this.tableShow) {
this.$nextTick(() => {
this.$refs.multipleTable.setCurrentRow(this.selectRow);
this.handleRowClick(this.selectRow);
});
} else {
this.$nextTick(() => {
this.drawlineListAll(this.tableData);
});
}
})
.catch((err) => {
console.log(err);
});
},
//查询
onSubmit() {
if (this.formdata.starttime > this.formdata.endtime) {
return this.$message({
duration: 1500,
showClose: true,
message: "开始日期不能大于结束日期",
type: "warning",
});
}
this.getTableList();
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
//点击分页
handleCurrentChange(val) {
this.page = val;
this.tableData = [];
this.getTableList();
},
//每页条数
handleSizeChange(val) {
this.pageSize = val;
this.tableData = [];
this.getTableList();
},
//绘制告警区域
drawline(data) {
this.canvas = this.$refs.myCanvas;
this.imgpic = this.$refs.picJpg;
this.textInfo = data.enname;
this.canvas.width = this.imgpic.offsetWidth; //设置画布大小
this.canvas.height = this.imgpic.offsetHeight; //设置画布大小
this.ctx = this.canvas.getContext("2d");
this.ctx.beginPath();
//设置线条颜色,必须放在绘制之前
this.ctx.strokeStyle = "#ff0000";
// 线宽设置,必须放在绘制之前
this.ctx.lineWidth = 1;
// 绘制矩形
var scaleX = this.canvas.width / data.photoWidth, //this.iw图片的宽
scaleY = this.canvas.height / data.photoHeight; //this.ih图片的高
console.log(scaleX, scaleY);
var top = data.x * scaleX,
left = data.y * scaleY,
width = data.width * scaleX,
height = data.height * scaleY;
// this.ctx.strokeStyle = "red"; //线的颜色
this.ctx.strokeRect(top, left, width, height); //绘制路径矩形
//this.ctx.strokeRect(data.x, data.y, data.width, data.height);
this.ctx.font = "16px normal";
this.ctx.fillStyle = "#ff0000";
console.log(top, left, width, height);
console.log(this.canvas.width, this.canvas.height);
//距离上面有空间
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();
},
//绘制大图告警区域
drawline2(data) {
console.log(data);
console.log(document.getElementById("bigCanvas"));
console.log(document.getElementById("bigimg"));
this.canvas = document.getElementById("bigCanvas");
this.imgpic = document.getElementById("bigimg");
console.log(this.canvas);
console.log(this.imgpic);
this.textInfo = data.enname;
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 / data.photoWidth, //this.iw图片的宽
scaleY = this.canvas.height / data.photoHeight; //this.ih图片的高
console.log(scaleX, scaleY);
var top = data.x * scaleX,
left = data.y * scaleY,
width = data.width * scaleX,
height = data.height * scaleY;
console.log(top, left, width, height);
// this.ctx.strokeStyle = "red"; //线的颜色
this.ctx.strokeRect(top, left, width, height); //绘制路径矩形
//this.ctx.strokeRect(data.x, data.y, data.width, data.height);
this.ctx.font = "14px 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();
},
//绘制所有的图片告警区域
drawlineListAll(val) {
for (let i = 0; i < val.length; i++) {
console.log(i);
console.log(document.getElementById("canvas_" + i));
console.log(document.getElementById("img" + i));
this.canvas = document.getElementById("canvas_" + i);
this.imgpic = document.getElementById("img" + i);
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();
}
},
//点击当前行
handleRowClick(row) {
//this.$refs.multipleTable.toggleRowSelection(row);
console.log(this.$refs.picJpg.complete);
this.alarmLoading = true;
if (row.path == "" || row.path == null) {
this.alarmLoading = false;
}
this.photoPic = row.path;
this.selectRow = row;
//未读变已读
if (row.isread == 0) {
setTimeout(function () {
readAlarm({
id: row.id,
})
.then((res) => {
console.log(res);
row.isread = 1;
console.log(row.isread);
})
.catch((err) => {
console.log(err);
});
}, 300);
}
this.$nextTick(() => {
this.drawline(row);
this.imgOnload();
});
},
//主动拍照
handleCommandpic() {
getTermStatus({ termId: this.selectRow.termId }).then((res) => {
console.log(res);
if (res.data.isonline) {
takePicJoggle({
captureType: 0,
channel: this.selectRow.channelId,
termId: this.selectRow.termId,
preset: 255,
})
.then((res) => {
console.log(res);
this.requestId = res.data.requestId; //获取requestid 判断装置是否下发
this.picTime = res.data.taketime; //获取时间 判断获取最新图片
console.log(this.requestId);
this.btnpicloading = true;
this.statusTimer = window.setInterval(() => {
this.getTakePicStatus(res.data);
this.statusNum++;
}, 3000);
})
.catch((err) => {
console.log(err); //代码错误、请求失败捕获
});
} else {
this.$message({
duration: 1500,
showClose: true,
message: "装置下线,发送指令失败",
type: "error",
});
}
});
},
//获取装置是否下发状态
getTakePicStatus(data) {
console.log(data);
getTakePicStatusJoggle({
requestid: data.requestId,
termId: this.selectRow.termId,
photoTime: new Date(data.taketime).getTime(),
})
.then((res) => {
console.log(res);
//res.data 0 状态未知 1 成功 2失败
if (
res.data.cmaStatus == 0 &&
res.data.picStatus == false &&
this.statusNum >= 5
) {
this.statusNum = 0;
clearInterval(this.statusTimer);
this.statusTimer = null;
this.btnpicloading = false;
this.btnvideoloading = false;
this.$message({
duration: 1500,
showClose: true,
message: "下发指令超时,请重试!",
type: "warning",
});
} else if (res.data.cmaStatus == 1 || res.data.picStatus == true) {
this.$message({
duration: 1500,
showClose: true,
message: "下发指令成功!",
type: "success",
});
this.statusNum = 0;
clearInterval(this.statusTimer);
this.statusTimer = null;
this.timer = window.setInterval(() => {
this.newPicApi();
this.i++;
}, 8000);
} else if (res.data == 2) {
this.statusNum = 0;
clearInterval(this.statusTimer);
this.statusTimer = null;
this.$message({
duration: 1500,
showClose: true,
message: "下发指令失败!",
type: "error",
});
}
})
.catch((err) => {
console.log(err); //代码错误、请求失败捕获
});
},
//获取最新图片
newPicApi() {
getTakePicPhotoStatusJoggle({
photoTime: new Date(this.picTime).getTime(),
termId: this.selectRow.termId,
requestid: this.requestId,
}).then((res) => {
console.log(res.data);
if (res.data == true && this.i < 10) {
clearInterval(this.timer);
this.timer = null;
this.i = 0;
this.btnpicloading = false;
this.$notify({
title: "通知信息",
message: "已返回最新图片",
type: "success",
position: "bottom-right",
});
} else if (res.data == false && this.i > 10) {
clearInterval(this.timer);
this.timer = null;
this.i = 0;
this.btnpicloading = false;
this.$notify({
title: "通知信息",
message: "装置暂无响应,请稍后再试!",
type: "warning",
position: "bottom-right",
});
}
});
},
//历史图片
handleHistory(val) {
this.$refs.historyimg_ref.display(val);
this.$refs.historyimg_ref.getdataform(this.selectRow);
},
//切换图片
handleListRow() {
this.tableShow = !this.tableShow;
this.zoomD = 1;
if (!this.tableShow) {
this.$nextTick(() => {
this.drawlineListAll(this.tableData);
});
} else {
this.$nextTick(() => {
this.$refs.multipleTable.setCurrentRow(this.selectRow);
this.handleRowClick(this.selectRow);
});
}
},
//在图片列表也执行 自动拍照和 查看历史图片
handlePicList(val) {
console.log(val);
this.selectRow = val;
this.handleCommandpic();
},
handlePicHistory(val) {
console.log(val);
this.selectRow = val;
this.handleHistory(val);
},
handlePicAlarm(val, index) {
console.log(val, index);
this.current = index;
this.canvasloading = true;
this.canvansdata = val;
if (val.path !== "" && this.tableData.length !== 0) {
console.log(val);
this.bigPhotoPic = val.path;
this.showBigpic = true;
setTimeout(() => {
this.$nextTick(() => {
this.drawline2(val);
});
}, 100);
//未读变已读
if (val.isread == 0) {
setTimeout(function () {
readAlarm({
id: val.id,
})
.then((res) => {
console.log(res);
val.isread = 1;
console.log(val.isread);
})
.catch((err) => {
console.log(err);
});
}, 300);
}
}
},
dateFormat(row, column) {
var date = row[column.property];
if (date == undefined) {
return "";
}
return moment(date).format("YYYY-MM-DD HH:mm:ss");
},
imgOnload() {
console.log("加载完成");
this.alarmLoading = false;
this.canvasloading = false;
},
},
};
</script>
<style lang="less">
.alarmHandBox {
width: calc(100% - 24px);
height: calc(100% - 24px);
padding: 12px 12px;
background: #ffffff;
.showPic {
position: fixed;
background-color: rgba(0, 0, 0, 50%);
bottom: 0;
left: 0;
overflow: hidden;
right: 0;
top: 0;
z-index: 9999;
width: 100%;
height: 100%;
display: flex;
cursor: pointer;
.picboxI {
position: relative;
width: 85%;
height: 85%;
margin: auto;
animation-name: scaleDraw;
/**/
animation-timing-function: ease;
/*线*/
animation-iteration-count: 1;
/**/
animation-duration: 0.65s;
display: flex;
align-items: center;
justify-content: center;
img {
max-width: 100%;
max-height: 100%;
margin: auto;
position: absolute;
cursor: grab;
}
.myCanvas {
position: absolute;
// top: 0;
// left: 0;
max-width: 100%;
max-height: 100%;
margin: 0 auto;
cursor: pointer;
pointer-events: none;
}
}
.viewClose {
-webkit-app-region: no-drag;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 50%;
cursor: pointer;
height: 80px;
overflow: hidden;
position: absolute;
right: -40px;
top: -40px;
transition: background-color 0.15s;
width: 80px;
.el-icon-close {
bottom: 16px;
left: 16px;
position: absolute;
color: #fff;
font-size: 18px;
}
}
}
.searchMain {
border: 1px solid #dddddd;
height: calc(100% - 22px);
max-height: calc(100% - 22px);
padding: 12px;
border-radius: 4px;
.searchBox {
.ml10 {
margin-left: 10px;
}
.el-form {
.dybox {
.el-form-item__content {
width: 120px;
}
}
.xlbox {
.el-form-item__content {
width: 160px;
}
}
.gjbox {
.el-form-item__content {
width: 140px;
}
}
}
}
}
.alarmTop {
padding: 0px 8px 16px 8px;
}
.alarmContain {
display: flex;
height: calc(100% - 98px);
padding: 0px 8px;
.alarmTable {
width: 50%;
height: 100%;
.el-table__body tr {
cursor: pointer;
}
.el-table__body tr.current-row > td {
background-color: rgba(18, 128, 113, 0.2);
}
.readbox {
color: #169e8c;
}
}
.pageNation {
margin-top: 8px;
justify-content: flex-start;
}
.alarmPic {
width: 50%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
.imgshow {
width: 100%;
height: 100%;
position: relative;
.picshow {
width: 100%;
height: 100%;
position: relative;
}
.nosee {
position: absolute;
width: 100%;
height: 100%;
background-size: 100% 100%;
z-index: 2;
}
.bigimgView {
position: absolute;
width: 100%;
height: 100%;
z-index: 3;
opacity: 0;
}
img {
width: 100%;
height: 100%;
}
.myCanvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
z-index: 2;
pointer-events: none;
}
}
.editorBtn {
margin-top: 8px;
// border: 1px solid @border-color-base;
padding-top: 5px;
// border-radius: 4px;
}
.editorBtn {
display: flex;
justify-content: flex-start;
}
}
}
.pictureBox {
height: calc(100% - 136px);
max-height: calc(100% - 136px);
.el-empty {
margin: auto;
}
.piclist {
// display: flex;
// // justify-content: space-around;
// flex-wrap: wrap;
overflow: auto;
border: 1px solid #eee;
height: calc(100% - 2px);
}
.imgList {
width: calc((100% - 40px) / 4);
position: relative;
display: inline-block;
margin: 2px;
position: relative;
border-radius: 3px;
background: #fff;
height: 30%;
border: 2px solid transparent;
.bigpic {
width: 100%;
height: 100%;
background-size: 100% 100%;
position: relative;
.picshow {
position: relative;
height: 100%;
img {
cursor: pointer;
width: 100%;
height: 100%;
}
.canvasAll {
position: absolute;
width: 100%;
height: 100%;
z-index: 2;
left: 0;
top: 0;
pointer-events: none;
}
}
.caption {
padding: 6px;
color: #fff;
position: absolute;
left: 0;
bottom: 0px;
background: rgba(0, 0, 0, 0.5);
width: calc(100% - 12px);
z-index: 4;
.alarmInfo {
color: #fff;
}
.infoTop {
font-size: 14px;
color: #fff;
font-weight: normal;
margin-top: 2px;
padding-left: 5px;
padding-right: 5px;
.readbox {
color: #169e8c;
}
}
.infoBottom {
color: #fff;
font-size: 12px;
font-weight: normal;
margin-top: 6px;
padding-left: 5px;
padding-right: 5px;
display: flex;
justify-content: space-between;
.el-button--small {
margin-left: 24px;
padding: 4px;
width: 78px;
}
.el-button + .el-button {
margin-left: 10px;
}
}
}
.toolsBtn {
position: absolute;
right: 4px;
top: 4px;
z-index: 2;
.el-button {
width: auto;
background: rgba(0, 0, 0, 0.5);
border: 1px solid transparent;
color: #fff;
font-size: 20px;
padding: 2px;
}
}
}
}
.bgColor {
border: 2px solid #169e8c;
}
}
}
</style>