master
fanluyan 2 years ago
parent 8296da3fd2
commit 093d98e630

@ -4,10 +4,10 @@ import VueRouter from "vue-router";
Vue.use(VueRouter); Vue.use(VueRouter);
const routes = [ const routes = [
{ // {
path: "/", // path: "/",
redirect: "/realTimeMonitor", // redirect: "/realTimeMonitor",
}, // },
{ {
path: "/", path: "/",
component: () => component: () =>

@ -99,7 +99,7 @@ export default {
this.token = this.$md5(this.userInfo.password); //token this.token = this.$md5(this.userInfo.password); //token
this.$store.commit("SET_TOKEN", this.token); //tokenvuex this.$store.commit("SET_TOKEN", this.token); //tokenvuex
this.$store.commit("SET_USERINFO", this.userInfo.username); //vuex this.$store.commit("SET_USERINFO", this.userInfo.username); //vuex
this.$router.push("/"); this.$router.push("/realTimeMonitor");
this.$message.success("登录成功"); this.$message.success("登录成功");
} else { } else {
this.$message.error("请输入账号和密码"); this.$message.error("请输入账号和密码");

@ -12,7 +12,8 @@
bigPicPath ? 'backgroundImage:url(' + bigPicPath + '!128x72)' : '' bigPicPath ? 'backgroundImage:url(' + bigPicPath + '!128x72)' : ''
" "
> >
<img class="animImg" :src="bigPicPath + '!1280x720'" /> <img ref="picJpg" class="animImg" :src="bigPicPath + '!1280x720'" />
<canvas id="myCanvas" class="myCanvas" ref="myCanvas"></canvas>
<!-- <p class="mark"> <!-- <p class="mark">
{{ bigPicPath }} {{ bigPicPath }}
<span>{{ this.activeSmall }}</span> <span>{{ this.activeSmall }}</span>
@ -168,6 +169,13 @@ export default {
page: 1, // page: 1, //
pagesize: 5, // pagesize: 5, //
total: 0, // total: 0, //
localPoints: [], //
canvas: null,
ctx: null,
imgpic: null,
color: "#FF0000",
num: 5,
}; };
}, },
mounted() { mounted() {
@ -176,6 +184,16 @@ export default {
this.fiveList = this.terminalPhoto.slice(this.page - 1, this.pagesize); this.fiveList = this.terminalPhoto.slice(this.page - 1, this.pagesize);
this.total = this.terminalPhoto.length / this.pagesize; this.total = this.terminalPhoto.length / this.pagesize;
console.log("this.bigPicPath"); console.log("this.bigPicPath");
this.$nextTick(function () {
// codeing
console.log(localStorage.getItem("piclinePoints"));
});
this.localPoints = JSON.parse(localStorage.getItem("piclinePoints"));
console.log(this.localPoints);
if (this.localPoints !== "") {
this.drawline();
}
}, },
watch: { watch: {
terminalPhoto: function (newVal, oldVal) { terminalPhoto: function (newVal, oldVal) {
@ -184,8 +202,31 @@ export default {
this.total = this.terminalPhoto.length / this.pagesize; this.total = this.terminalPhoto.length / this.pagesize;
}, },
}, },
created() {},
methods: { methods: {
drawline() {
this.canvas = this.$refs.myCanvas;
this.imgpic = this.$refs.picJpg;
console.log(this.canvas);
console.log(this.imgpic);
this.canvas.width = this.imgpic.offsetWidth; //
this.canvas.height = this.imgpic.offsetHeight; //
this.ctx = this.canvas.getContext("2d");
console.log(this.localPoints);
console.log(this.ctx);
this.ctx.beginPath();
//线
this.ctx.strokeStyle = this.color;
// 线
this.ctx.lineWidth = this.num;
for (var i = 0; i < this.localPoints.length; i++) {
this.ctx.moveTo(this.localPoints[i].x1, this.localPoints[i].y1);
this.ctx.lineTo(this.localPoints[i].x2, this.localPoints[i].y2);
}
this.ctx.closePath();
this.ctx.stroke();
},
getphotoList() { getphotoList() {
this.fiveList = this.terminalPhoto.slice( this.fiveList = this.terminalPhoto.slice(
(this.page - 1) * this.pagesize, (this.page - 1) * this.pagesize,
@ -289,6 +330,14 @@ export default {
//opacity: 0; //opacity: 0;
transition: bottom 2s ease 0s; transition: bottom 2s ease 0s;
} }
.myCanvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
} }
img { img {
width: 100%; width: 100%;

@ -98,7 +98,7 @@ export default {
let validCmid = (rule, value, callback) => { let validCmid = (rule, value, callback) => {
let reg = /^[0-9A-Za-z]{17}$/; let reg = /^[0-9A-Za-z]{17}$/;
if (!reg.test(value)) { if (!reg.test(value)) {
callback(new Error("装置id17位编码")); callback(new Error("装置id17位编码"));
} else { } else {
callback(); callback();
} }

@ -0,0 +1,301 @@
<template>
<el-dialog
class="pictureTagsDialog"
title="图片绘制"
:visible.sync="isShow"
:close-on-click-modal="false"
width="1262px"
>
<div class="picPannel">
<div class="imgbox">
<img
ref="picJpg"
src="http://47.96.238.157/photos/2023/05/22/06/XYIGQ10C221000006_1_FF_20230522094507.jpg"
/>
<canvas
id="myCanvas"
class="myCanvas"
ref="myCanvas"
@mousedown="mousedown"
@mouseup="mouseup"
@mousemove="mousemove"
></canvas>
</div>
<div class="setBox">
<div class="infoCompany">
<!-- <p><label>电压等级</label><span>220kv</span></p> -->
<p>
<label>线路名称</label><span>{{ pictureData.linename }}</span>
</p>
<p>
<label>杆塔名称</label><span>{{ pictureData.towername }}</span>
</p>
<p>
<label>装置名称</label><span>{{ pictureData.cmdid }}</span>
</p>
<p>
<label>选择通道</label>
<el-select v-model="picvalue" placeholder="请选择">
<el-option
v-for="item in picoptions"
:key="item.id"
:label="item.name"
:value="item.name"
>
</el-option>
</el-select>
</p>
</div>
<div class="setColor">
<p>
<label>颜色</label
><el-color-picker v-model="color"></el-color-picker>
</p>
<p>
<label>线宽</label>
<el-input-number
v-model="num"
controls-position="right"
@change="handleChange"
:min="1"
:max="10"
></el-input-number>
</p>
<p>
<el-button type="primary" @click="restCanvas"></el-button>
<el-button type="primary" @click="saveCanvas"></el-button>
</p>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="isShow = false"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
</template>
<script>
export default {
props: {
title: String,
},
data() {
return {
canvas: null,
ctx: null,
imgpic: null,
drawingSurfaceImageData: "",
color: "#FF0000",
num: 5,
flag: false,
x: 0,
y: 0,
isShow: false,
fileList: [],
pictureData: "",
picoptions: [],
picvalue: "",
linePoints: [],
localPoints: [],
};
},
mounted() {},
methods: {
//线
handleChange(value) {
console.log(value);
},
//
submitForm() {
this.isShow = false;
},
display(val) {
this.isShow = true;
console.log(val);
this.pictureData = val; //
this.picoptions = val.list; //
this.picvalue = val.list[0].name; //
console.log("this.canvas");
this.$nextTick(function () {
// codeing
this.canvas = this.$refs.myCanvas;
this.imgpic = this.$refs.picJpg;
console.log(this.canvas);
console.log(this.imgpic);
this.canvas.width = this.imgpic.offsetWidth; //
this.canvas.height = this.imgpic.offsetHeight; //
this.ctx = this.canvas.getContext("2d");
console.log(localStorage.getItem("piclinePoints"));
this.localPoints = JSON.parse(localStorage.getItem("piclinePoints"));
if (this.localPoints !== "") {
this.drawline();
}
});
},
hide() {
this.isShow = false;
this.pictureData = "";
this.picoptions = [];
this.picvalue = "";
},
mousedown(e) {
console.log("鼠标落下");
this.saveDrawingSurface();
this.flag = true;
this.x = e.offsetX; // X
this.y = e.offsetY; // Y
console.log(this.x, this.y);
console.log(this.flag);
},
mouseup(e) {
console.log("鼠标抬起");
console.log(this.x, this.y, e.offsetX, e.offsetY);
this.drawRect(e);
this.flag = false;
this.linePoints.push({
x1: this.x,
y1: this.y,
x2: e.offsetX,
y2: e.offsetY,
});
console.log(this.linePoints);
},
//
saveDrawingSurface() {
this.drawingSurfaceImageData = this.ctx.getImageData(
0,
0,
this.canvas.width,
this.canvas.height
);
},
restoreDrawingSurface() {
this.ctx.putImageData(this.drawingSurfaceImageData, 0, 0);
},
mousemove(e) {
console.log("鼠标移动");
if (this.flag) {
this.restoreDrawingSurface();
this.drawRect(e);
}
},
drawRect(e) {
if (this.flag) {
console.log("绘制图形");
let x = this.x;
let y = this.y;
// ctx.save();
this.ctx.beginPath();
//线
this.ctx.strokeStyle = this.color;
// 线
this.ctx.lineWidth = this.num;
// console.log(x, y, e.offsetX, e.offsetY);
// this.ctx.strokeRect(x, y, e.offsetX - x, e.offsetY - y);
this.ctx.moveTo(x, y);
this.ctx.lineTo(e.offsetX, e.offsetY);
// this.ctx.moveTo(this.defult[0].x1, this.defult[0].y1);
// this.ctx.lineTo(this.defult[0].x2, this.defult[0].y2);
this.ctx.closePath();
this.ctx.stroke();
} else {
console.log("aaaaaaaa");
}
},
drawline() {
console.log(this.localPoints);
this.ctx.beginPath();
//线
this.ctx.strokeStyle = this.color;
// 线
this.ctx.lineWidth = this.num;
for (var i = 0; i < this.localPoints.length; i++) {
this.ctx.moveTo(this.localPoints[i].x1, this.localPoints[i].y1);
this.ctx.lineTo(this.localPoints[i].x2, this.localPoints[i].y2);
}
// this.ctx.moveTo(x, y);
// this.ctx.lineTo(e.offsetX, e.offsetY);
this.ctx.closePath();
this.ctx.stroke();
},
//
saveCanvas() {
console.log(this.linePoints);
localStorage.setItem("piclinePoints", JSON.stringify(this.linePoints));
},
restCanvas() {
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
this.linePoints = [];
console.log(this.linePoints);
},
},
};
</script>
<style lang="less">
.pictureTagsDialog {
.el-dialog {
height: 672px;
.el-dialog__body {
height: 540px;
}
}
.picPannel {
display: flex;
flex-direction: row;
justify-content: space-between;
position: relative;
height: 100%;
.imgbox {
//flex: 1;
width: 960px;
height: 540px;
position: relative;
img {
width: 100%;
height: 100%;
}
.myCanvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
}
.setBox {
width: 230px;
padding: 12px;
border: 3px solid #2d8cf0;
.infoCompany {
display: flex;
flex-direction: column;
line-height: 32px;
margin-bottom: 16px;
}
}
.setColor {
display: flex;
flex-direction: column;
line-height: 32px;
p {
display: flex;
align-items: center;
margin-bottom: 16px;
}
}
}
}
</style>

@ -40,8 +40,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lineid" label="线路编号"> </el-table-column> <el-table-column prop="linename" label="线路编号"> </el-table-column>
<el-table-column prop="towerid" label="杆塔编号"> </el-table-column> <el-table-column prop="towername" label="杆塔编号"> </el-table-column>
<el-table-column prop="hasPan" label="是否带云台"> <el-table-column prop="hasPan" label="是否带云台">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.hasPan == 0"></span> <span v-if="scope.row.hasPan == 0"></span>
@ -93,21 +93,25 @@
> >
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" width="520"> <el-table-column fixed="right" label="操作" width="400">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@click.native.stop="handleRevisePhoto(scope.row)" @click.native.stop="handleRevisePhoto(scope.row)"
type="text" type="text"
>修改</el-button >修改</el-button
> >
<el-button
type="text"
@click.native.stop="handlepicture(scope.row)"
>线缆绘制</el-button
>
<el-button <el-button
type="text" type="text"
@click.native.stop="handleDeviceReset(scope.row)" @click.native.stop="handleDeviceReset(scope.row)"
>装置复位</el-button >装置复位</el-button
> >
<!-- <el-button type="text">远程升级</el-button> --> <!-- <el-button type="text">远程升级</el-button> -->
<el-button <!-- <el-button
type="text" type="text"
@click.native.stop="handleShowGPS(scope.row)" @click.native.stop="handleShowGPS(scope.row)"
>获取GPS位置</el-button >获取GPS位置</el-button
@ -124,8 +128,8 @@
<el-dropdown-item command="open">开启GPS</el-dropdown-item> <el-dropdown-item command="open">开启GPS</el-dropdown-item>
<el-dropdown-item command="close">关闭GPS</el-dropdown-item> <el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown> -->
<!--<el-button type="text">GPS开关</el-button> -->
<el-button <el-button
type="text" type="text"
@click.native.stop="handleImageCapture(scope.row)" @click.native.stop="handleImageCapture(scope.row)"
@ -158,6 +162,7 @@
ref="addPhotoDialogref" ref="addPhotoDialogref"
></addPhotoDialog> ></addPhotoDialog>
<imageCapture ref="imageCaptureref"></imageCapture> <imageCapture ref="imageCaptureref"></imageCapture>
<pictureTags ref="picturetagsref"></pictureTags>
</div> </div>
</template> </template>
<script> <script>
@ -171,10 +176,12 @@ import {
import moment from "moment"; import moment from "moment";
import addPhotoDialog from "./components/addPhotoDialog.vue"; import addPhotoDialog from "./components/addPhotoDialog.vue";
import imageCapture from "./components/imageCapture.vue"; import imageCapture from "./components/imageCapture.vue";
import pictureTags from "./components/pictureTags.vue";
export default { export default {
components: { components: {
addPhotoDialog, addPhotoDialog,
imageCapture, imageCapture,
pictureTags,
}, },
data() { data() {
return { return {
@ -185,7 +192,7 @@ export default {
multipleSelection: [], // multipleSelection: [], //
formphotoInfo: {}, // formphotoInfo: {}, //
page: 1, // page: 1, //
pageSize: 20, // pageSize: 30, //
total: 0, // total: 0, //
loading: true, loading: true,
}; };
@ -238,6 +245,12 @@ export default {
}, },
// //
handleDeviceReset(data) { handleDeviceReset(data) {
this.$confirm("此操作将复位装置, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
resetTerminalApi({ cmId: data.cmdid }) resetTerminalApi({ cmId: data.cmdid })
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -247,6 +260,13 @@ export default {
} }
}) })
.catch((err) => {}); .catch((err) => {});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
}, },
//GPS //GPS
handleShowGPS(data) { handleShowGPS(data) {
@ -308,6 +328,10 @@ export default {
this.$refs.imageCaptureref.getSingleAccess(data); this.$refs.imageCaptureref.getSingleAccess(data);
this.$refs.imageCaptureref.getRatio(); this.$refs.imageCaptureref.getRatio();
}, },
//线
handlepicture(data) {
this.$refs.picturetagsref.display(data);
},
// //handleAddPhoto // //handleAddPhoto
// handleAddPhoto() { // handleAddPhoto() {

@ -1,172 +0,0 @@
<template>
<el-dialog
class="pictureTagsDialog"
title="图片绘制"
:visible.sync="isShow"
:close-on-click-modal="false"
width="1000px"
>
<div class="picPannel">
<div class="imgbox">
<img
src="http://47.96.238.157/image/2023/04/24/01/DSH10H00000000001_1_FF_20230424192442.jpg"
/>
<!-- <canvas
id="myCanvas"
class="myCanvas"
ref="myCanvas"
@mousedown="mousedown"
@mouseup="mouseup"
@mousemove="mousemove"
></canvas> -->
</div>
<div class="setBox">
<div class="infoCompany">
<p><label>电压等级</label><span>220kv</span></p>
<p><label>线路名称</label><span>i1测试线路-SH</span></p>
<p><label>装置名称</label><span>XY-SIMULATOR-0001</span></p>
</div>
<div class="setColor">
<p>
<label>颜色</label
><el-color-picker v-model="color"></el-color-picker>
</p>
<p>
<label>线宽</label>
<el-input-number
v-model="num"
controls-position="right"
@change="handleChange"
:min="1"
:max="10"
></el-input-number>
</p>
<p>
<el-button type="primary">重新绘制</el-button>
<el-button type="primary">保存绘制</el-button>
</p>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="isShow = false"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
</template>
<script>
export default {
props: {
title: String,
},
data() {
return {
color: "#409EFF",
num: 1,
flag: false,
x: 0,
y: 0,
isShow: false,
fileList: [],
};
},
mounted() {},
methods: {
//线
handleChange(value) {
console.log(value);
},
//
submitForm() {
this.isShow = false;
},
display() {
this.isShow = true;
},
hide() {
this.isShow = false;
},
mousedown(e) {
console.log("鼠标落下");
this.flag = true;
this.x = e.offsetX; // X
this.y = e.offsetY; // Y
console.log(this.x, this.y);
},
mouseup(e) {
console.log("鼠标抬起");
this.flag = false;
},
mousemove(e) {
console.log("鼠标移动");
this.drawRect(e);
},
drawRect(e) {
if (this.flag) {
console.log("绘制图形");
const canvas = this.$refs.myCanvas;
var ctx = canvas.getContext("2d");
let x = this.x;
let y = this.y;
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
//线
ctx.strokeStyle = this.color;
// 线
ctx.lineWidth = this.num;
console.log(x, y, e.offsetX - x, e.offsetY - y);
ctx.strokeRect(x, y, e.offsetX - x, e.offsetY - y);
}
},
},
};
</script>
<style lang="less">
.pictureTagsDialog {
.picPannel {
display: flex;
flex-direction: row;
justify-content: space-between;
position: relative;
.imgbox {
width: 698px;
position: relative;
img {
width: 100%;
height: 100%;
}
.myCanvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.setBox {
width: 230px;
padding: 12px;
border: 3px solid #2d8cf0;
.infoCompany {
display: flex;
flex-direction: column;
line-height: 32px;
margin-bottom: 16px;
}
}
.setColor {
display: flex;
flex-direction: column;
line-height: 32px;
p {
display: flex;
align-items: center;
margin-bottom: 16px;
}
}
}
}
</style>

@ -181,14 +181,12 @@ import { mapState } from "vuex";
import carouselChart from "../components/carouselChart.vue"; import carouselChart from "../components/carouselChart.vue";
import setschedule from "./components/setschedule.vue"; import setschedule from "./components/setschedule.vue";
import deviceUpgrade from "./components/deviceUpgrade.vue"; import deviceUpgrade from "./components/deviceUpgrade.vue";
import pictureTags from "./components/pictureTags.vue";
import infoDialog from "./components/infoDialog.vue"; import infoDialog from "./components/infoDialog.vue";
export default { export default {
components: { components: {
carouselChart, carouselChart,
setschedule, setschedule,
deviceUpgrade, deviceUpgrade,
pictureTags,
infoDialog, infoDialog,
}, },
data() { data() {
@ -196,7 +194,7 @@ export default {
btnpicloading: false, btnpicloading: false,
btnvideoloading: false, btnvideoloading: false,
flag: true, flag: true,
onlinestatus: "", // onlinestatus: "", //
showBigPic: true, showBigPic: true,
defaultKey: "", defaultKey: "",
lineTreeData: [], lineTreeData: [],

Loading…
Cancel
Save