放大图片

hn2.0
fanluyan 2 years ago
parent 6d00825f1c
commit d57577ddc2

11953
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -12,6 +12,7 @@
"core-js": "^3.8.3",
"echarts": "^5.4.2",
"element-ui": "^2.15.13",
"jquery": "^3.7.0",
"moment": "^2.29.4",
"update-element-ui-theme": "^1.0.0",
"v-viewer": "^1.6.4",

@ -53,11 +53,11 @@ export default {
return {
activeIndex: "/realTimeMonitor",
items: [
// {
// icon: "el-icon-s-home",
// index: "stritl",
// title: "",
// },
{
icon: "el-icon-s-home",
index: "/videoHistory",
title: "首页",
},
{
icon: "el-icon-camera",
index: "/realTimeMonitor",

@ -11,9 +11,9 @@ Vue.use(ElementUI, {
size: "small",
});
// 引入Echarts
// import * as echarts from "echarts";
// Vue.prototype.$echarts = echarts;
//引入Echarts;
import * as echarts from "echarts";
Vue.prototype.$echarts = echarts;
// // 引入 vue-awesome-swiper
// import VueAwesomeSwiper from "vue-awesome-swiper";
@ -43,7 +43,9 @@ Vue.use(Viewer);
Viewer.setDefaults({
zIndexInline: 9999,
});
//使用jq
import jquery from "jquery";
Vue.prototype.$ = jquery;
//使用钩子函数对路由进行权限跳转
router.beforeEach((to, from, next) => {
document.title = `${to.meta.title} | 视频监控可视化平台`;

@ -154,14 +154,14 @@ const routes = [
// ),
// meta: { title: "监控视频", icon: "el-icon-video-camera" },
// },
// {
// path: "/videoHistory",
// component: () =>
// import(
// /* webpackChunkName: "tabs" */ "../views/videoMonitor/videoHistory.vue"
// ),
// meta: { title: "视频回放", icon: "el-icon-video-camera" },
// },
{
path: "/videoHistory",
component: () =>
import(
/* webpackChunkName: "tabs" */ "../views/videoMonitor/videoHistory.vue"
),
meta: { title: "视频回放" },
},
// {
// path: "/groupInformation",

@ -77,11 +77,11 @@
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
</el-form-item>
<!-- <el-form-item>
<el-form-item>
<el-button type="primary" @click="handleListRow">{{
tableShow ? "图片列表" : "表格列表"
}}</el-button>
</el-form-item> -->
</el-form-item>
</el-form>
</div>
@ -187,13 +187,17 @@
</div>
</div>
<div class="alarmPic">
<div class="imgshow" v-loading="alarmLoading">
<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"
>
<!-- v-viewer="OptionssalseImg" -->
<!-- <div
class="nosee"
:style="'backgroundImage:url(' + photoPic + '!1366x768)'"
@ -237,7 +241,7 @@
</div>
</div>
</div>
<div class="pictureBox" v-else>
<div class="pictureBox" v-else v-loading="loading">
<div class="piclist" v-if="tableData.length !== 0">
<el-card
class="box-card imgList"
@ -245,10 +249,10 @@
:key="index"
>
<div class="bigpic">
<div class="picshow">
<div class="picshow" @click="handlePicAlarm(item)">
<img :src="item.path + '!1366x768'" :ref="'picJpg' + index" />
<canvas
id="myCanvas"
:id="'myCanvas' + index"
class="myCanvas"
:ref="'myCanvas' + index"
></canvas>
@ -305,15 +309,15 @@
</div>
</div>
<!-- 点击出现大图 -->
<div v-if="showBigpic" class="showPic" v-loading="canvasloading">
<div
v-if="showBigpic"
class="showPic"
@click="closePic"
v-loading="canvasloading"
class="picboxI"
@mousewheel.prevent="rollImg"
:style="{ transform: 'scale(' + zoomD + ')' }"
@mousedown="move"
>
<div class="picboxI">
<img @load="imgOnload" class="maskPic" :src="bigPhotoPic" />
<canvas id="myCanvas" class="myCanvas" ref="myCanvas2"></canvas>
<img @load="imgOnload" class="maskPic img" :src="bigPhotoPic" />
<canvas id="myCanvas" class="myCanvas" ref="myCanvasbig"></canvas>
</div>
<div class="viewClose">
<i @click="closePic" class="el-icon-close"></i>
@ -379,6 +383,8 @@ export default {
alarmLoading: false,
canvasloading: false,
tableShow: true, //
zoomD: 1,
canvansdata: "",
};
},
mounted() {
@ -386,6 +392,10 @@ export default {
// new Date(new Date().toLocaleDateString()).getTime(),
// new Date().getTime(),
// ]);
// $("#elementToZoomOn").smartZoom({
// maxScale: 2,
// });
this.$set(
this.formdata,
"starttime",
@ -396,8 +406,69 @@ export default {
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);
function move(e) {
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)`;
this.drawline2(this.canvansdata);
});
},
//
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)`;
this.drawline2(this.canvansdata);
});
},
handleBigPicbox(val) {
this.canvasloading = true;
this.canvansdata = val;
if (val.path !== "" && this.tableData.length !== 0) {
console.log(val);
this.bigPhotoPic = val.path;
@ -409,6 +480,7 @@ export default {
},
closePic() {
this.showBigpic = false;
this.zoomD = 1;
},
//
getSearchdy() {
@ -495,11 +567,13 @@ export default {
//
handleCurrentChange(val) {
this.page = val;
this.tableData = [];
this.getTableList();
},
//
handleSizeChange(val) {
this.pageSize = val;
this.tableData = [];
this.getTableList();
},
//
@ -527,15 +601,15 @@ export default {
// 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 = "24px normal";
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 - 14);
this.ctx.fillText(this.textInfo, top, left - 4);
} else if (this.canvas.height - left + height > 32) {
this.ctx.fillText(this.textInfo, top, height - 14);
this.ctx.fillText(this.textInfo, top, height - 4);
}
this.ctx.closePath();
@ -543,11 +617,12 @@ export default {
},
//
drawline2(data) {
this.canvas = this.$refs.myCanvas2;
this.canvas = this.$refs.myCanvasbig;
this.imgpic = this.$refs.picJpg;
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();
//线
@ -567,9 +642,15 @@ export default {
// 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 = "24px normal";
this.ctx.font = "16px normal";
this.ctx.fillStyle = "#ff0000";
this.ctx.fillText(this.textInfo, top, left + 24);
//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();
},
@ -676,6 +757,18 @@ export default {
this.selectRow = val;
this.handleHistory();
},
handlePicAlarm(val) {
console.log(val);
this.canvasloading = true;
if (val.path !== "" && this.tableData.length !== 0) {
console.log(val);
this.bigPhotoPic = val.path;
this.showBigpic = true;
// this.$nextTick(() => {
// this.drawline2(val);
// });
}
},
dateFormat(row, column) {
var date = row[column.property];
if (date == undefined) {
@ -710,8 +803,8 @@ export default {
cursor: pointer;
.picboxI {
position: relative;
max-width: 1366px;
max-height: 768px;
width: 1366px;
height: 768px;
margin: auto;
animation-name: scaleDraw;
/*关键帧名称*/
@ -720,11 +813,15 @@ export default {
animation-iteration-count: 1;
/*动画播放的次数*/
animation-duration: 0.65s;
display: flex;
align-items: center;
justify-content: center;
img {
max-width: 1366px;
max-height: 768px;
margin: auto;
position: absolute;
cursor: grab;
}
.myCanvas {
position: absolute;
@ -890,7 +987,7 @@ export default {
border-radius: 3px;
background: #fff;
height: fit-content;
height: 320px;
height: auto;
.el-card__body {
padding: 0px;
}
@ -924,7 +1021,7 @@ export default {
color: #e49e61;
}
.infoTop {
font-size: 16px;
font-size: 14px;
color: #000;
font-weight: normal;
margin-top: 2px;

@ -594,6 +594,7 @@ export default {
line-height: 60px;
width: 40px;
height: 40px;
z-index: 4;
&:hover {
color: @color-primary;
}

@ -233,7 +233,7 @@
<el-table-column
fixed="right"
label="操作"
width="520"
width="540"
v-if="roleUser != 2"
>
<template slot-scope="scope">
@ -299,15 +299,15 @@
<el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button
<el-button
type="text"
class="deleteText"
@click.native.stop="handleDelete(scope.row)"
>删除</el-button
> -->
>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="320" v-else>
<el-table-column fixed="right" label="操作" width="340" v-else>
<template slot-scope="scope">
<el-button
@click.native.stop="handleRevisePhoto(scope.row)"
@ -343,12 +343,12 @@
<el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button
<el-button
type="text"
class="deleteText"
@click.native.stop="handleDelete(scope.row)"
>删除</el-button
> -->
>
</template>
</el-table-column>
</el-table>

@ -26,6 +26,14 @@
scope.row.bsManufacturer
}}</template>
</el-table-column>
<el-table-column
prop="dyLevelname"
label="电压等级名称"
show-overflow-tooltip
min-width="120"
>
</el-table-column>
<!-- <el-table-column
prop="id"
label="线路编号"
@ -41,14 +49,6 @@
>
</el-table-column>
<el-table-column
prop="dyLevelname"
label="电压等级名称"
show-overflow-tooltip
min-width="120"
>
</el-table-column>
<el-table-column fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button

@ -99,7 +99,7 @@
</el-form>
</div>
<div class="pictureBox" v-loading="loading">
<div v-if="picList.length !== 0">
<div v-if="picList.length !== 0" style="width: 100%">
<el-card
class="box-card imgList"
v-for="(item, index) in picList"
@ -339,6 +339,7 @@ export default {
//
handleCurrentChange(val) {
this.page = val;
this.picList = [];
this.getPicData();
},
//

@ -1,31 +1,45 @@
<template>
<div style="padding: 20px">
<el-card
><el-tabs type="border-card" v-model="tabName" @tab-click="handleClick"
><el-tab-pane label="用户管理" name="用户管理"
><div class="echart-top">
<div class="echartsPage">
<div class="echart-top">
<el-card class="box-card">
<div id="echart1" style="width: 100%; height: 100%"></div>
<div id="echart2" style="width: 100%; height: 100%"></div></div></el-tab-pane
><el-tab-pane label="配置管理" name="配置管理"
><div class="echart-top">
</el-card>
<el-card class="box-card">
<div id="echart2" style="width: 100%; height: 100%"></div>
</el-card>
</div>
<div class="echart-top">
<el-card class="box-card">
<div id="echart3" style="width: 100%; height: 100%"></div>
<div id="echart4" style="width: 100%; height: 100%"></div></div></el-tab-pane></el-tabs
></el-card>
</el-card>
<el-card class="box-card">
<div id="echart4" style="width: 100%; height: 100%"></div>
</el-card>
</div>
<!-- <el-card>
<el-tabs type="border-card" v-model="tabName" @tab-click="handleClick"
><el-tab-pane label="用户管理" name="用户管理"></el-tab-pane
><el-tab-pane label="配置管理" name="配置管理"></el-tab-pane></el-tabs
></el-card> -->
</div>
</template>
<script>
export default {
name: '',
name: "",
data() {
return { tabName: '配置管理', myChart1: '', myChart2: '', myChart3: '', myChart4: '' };
return {
tabName: "配置管理",
myChart1: "",
myChart2: "",
myChart3: "",
myChart4: "",
};
},
mounted() {
this.init();
},
watch: {
'$store.state.collapse'(val) {
"$store.state.collapse"(val) {
console.log(val);
setTimeout(() => {
//echarts
@ -34,7 +48,7 @@ export default {
this.myChart3.resize();
this.myChart4.resize();
}, 300);
}
},
},
methods: {
init() {
@ -44,8 +58,8 @@ export default {
this.getEchart4();
},
handleClick(value) {
console.log('value', value);
if (value.name === '用户管理') {
console.log("value", value);
if (value.name === "用户管理") {
this.getEchart1();
this.getEchart2();
} else {
@ -54,115 +68,173 @@ export default {
},
getEchart1() {
this.$nextTick(() => {
this.$echarts.init(document.getElementById('echart1')).dispose();
this.myChart1 = this.$echarts.init(document.getElementById('echart1'));
this.$echarts.init(document.getElementById("echart1")).dispose();
this.myChart1 = this.$echarts.init(document.getElementById("echart1"));
let option = {
legend: { top: 'bottom' },
title: {
text: "装置数量统计",
},
legend: { top: "bottom" },
toolbox: {
show: true,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
restore: { show: true },
saveAsImage: { show: true }
}
},
series: [
{
name: '面积模式',
type: 'pie',
radius: [50, 250],
center: ['50%', '50%'],
roseType: 'area',
name: "面积模式",
type: "pie",
radius: [50, 120],
center: ["50%", "50%"],
roseType: "area",
itemStyle: { borderRadius: 8 },
data: [
{ value: 40, name: 'rose 1' },
{ value: 38, name: 'rose 2' },
{ value: 32, name: 'rose 3' },
{ value: 30, name: 'rose 4' },
{ value: 28, name: 'rose 5' },
{ value: 26, name: 'rose 6' },
{ value: 22, name: 'rose 7' },
{ value: 18, name: 'rose 8' }
]
}
]
{ value: 40, name: "rose 1" },
{ value: 38, name: "rose 2" },
{ value: 32, name: "rose 3" },
{ value: 30, name: "rose 4" },
{ value: 28, name: "rose 5" },
{ value: 26, name: "rose 6" },
{ value: 22, name: "rose 7" },
{ value: 18, name: "rose 8" },
],
},
],
};
this.myChart1.setOption(option);
window.addEventListener('resize', () => {
window.addEventListener("resize", () => {
this.myChart1.resize();
});
});
},
getEchart2() {
this.$nextTick(() => {
this.$echarts.init(document.getElementById('echart2')).dispose();
this.myChart2 = this.$echarts.init(document.getElementById('echart2'));
this.$echarts.init(document.getElementById("echart2")).dispose();
this.myChart2 = this.$echarts.init(document.getElementById("echart2"));
let option = {
xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
yAxis: { type: 'value' },
title: {
text: "隐患分类统计",
},
xAxis: {
type: "category",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
},
yAxis: { type: "value" },
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
type: "bar",
showBackground: true,
backgroundStyle: { color: 'rgba(180, 180, 180, 0.2)' }
}
]
backgroundStyle: { color: "rgba(180, 180, 180, 0.2)" },
},
],
};
this.myChart2.setOption(option);
window.addEventListener('resize', () => {
window.addEventListener("resize", () => {
this.myChart2.resize();
});
});
},
getEchart3() {
this.$nextTick(() => {
this.$echarts.init(document.getElementById('echart3')).dispose();
this.myChart3 = this.$echarts.init(document.getElementById('echart3'));
this.$echarts.init(document.getElementById("echart3")).dispose();
this.myChart3 = this.$echarts.init(document.getElementById("echart3"));
let option = {
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
yAxis: { type: 'value' },
series: [{ data: [820, 932, 901, 934, 1290, 1330, 1320], type: 'line', areaStyle: {} }]
title: {
text: "装置信息统计",
},
xAxis: {
type: "category",
boundaryGap: false,
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
},
yAxis: { type: "value" },
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: "line",
areaStyle: {},
},
],
};
this.myChart3.setOption(option);
window.addEventListener('resize', () => {
window.addEventListener("resize", () => {
this.myChart3.resize();
});
});
},
getEchart4() {
this.$nextTick(() => {
this.$echarts.init(document.getElementById('echart4')).dispose();
this.myChart4 = this.$echarts.init(document.getElementById('echart4'));
this.$echarts.init(document.getElementById("echart4")).dispose();
this.myChart4 = this.$echarts.init(document.getElementById("echart4"));
let option = {
xAxis: {},
yAxis: {},
title: {
text: "装置在线统计",
},
tooltip: {
trigger: "item",
},
legend: {
top: "5%",
left: "center",
},
series: [
{
type: "pie",
radius: ["40%", "70%"],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: "#fff",
borderWidth: 2,
},
label: {
show: false,
position: "center",
},
emphasis: {
label: {
show: true,
fontSize: 40,
fontWeight: "bold",
},
},
labelLine: {
show: false,
},
data: [
[10, 40],
[50, 100],
[40, 20]
{ value: 1048, name: "在线" },
{ value: 735, name: "离线" },
],
},
],
type: 'line'
}
]
};
this.myChart4.setOption(option);
window.addEventListener('resize', () => {
window.addEventListener("resize", () => {
this.myChart4.resize();
});
});
}
}
},
},
};
</script>
<style scoped>
<style lang="less">
.echartsPage {
height: calc(100% - 32px);
padding: 16px;
display: flex;
flex-direction: column;
justify-content: space-around;
.echart-top {
display: flex;
height: 48%;
justify-content: space-between;
width: 100%;
height: 500px;
.el-card {
width: 48%;
height: 100%;
.el-card__body {
height: calc(100% - 40px);
}
}
}
}
</style>

@ -1,5 +1,6 @@
const { defineConfig } = require("@vue/cli-service");
const path = require("path");
const webpack = require("webpack");
module.exports = defineConfig({
//打包清除console
chainWebpack(config) {
@ -37,4 +38,14 @@ module.exports = defineConfig({
},
},
},
chainWebpack: (config) => {
config.plugin("provide").use(webpack.ProvidePlugin, [
{
$: "jquery",
jquery: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
},
]);
},
});

Loading…
Cancel
Save