master
fanluyan 10 months ago
parent 08c820384a
commit fb4165a34c

@ -25,7 +25,7 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
//padding: 10px; //padding: 10px;
overflow-y: auto; overflow-y: scroll;
box-sizing: border-box; box-sizing: border-box;
} }
} }

@ -120,24 +120,24 @@ export default {
}, },
created() { created() {
EventBus.$on("currentNodeData", (value) => { EventBus.$on("currentNodeData", (value) => {
//console.log(value); // value ////console.log(value); // value
this.currentNodeData = value; this.currentNodeData = value;
this.selectIndex = -1; this.selectIndex = -1;
}); });
EventBus.$on("perentNode", (value) => { EventBus.$on("perentNode", (value) => {
//console.log(value); // value ////console.log(value); // value
this.parentdata = value; this.parentdata = value;
this.selectIndex = -1; this.selectIndex = -1;
}); });
EventBus.$on("labelMark", (value) => { EventBus.$on("labelMark", (value) => {
this.selectIndex = -1; this.selectIndex = -1;
//console.log(value); // value ////console.log(value); // value
this.labelMarkArrs = value; this.labelMarkArrs = value;
console.log(this.labelMarkArrs); //console.log(this.labelMarkArrs);
this.clearCanvas(); this.clearCanvas();
this.recArrs = []; this.recArrs = [];
for (var i = 0; i < this.labelMarkArrs.length; i++) { for (var i = 0; i < this.labelMarkArrs.length; i++) {
console.log(this.labelMarkArrs[i]); //console.log(this.labelMarkArrs[i]);
// //
this.recArrs.push({ this.recArrs.push({
x: x:
@ -152,20 +152,20 @@ export default {
type: this.labelMarkArrs[i].type, type: this.labelMarkArrs[i].type,
}); });
} }
console.log("aaaaaaaaaaaaaaaaa"); //console.log("aaaaaaaaaaaaaaaaa");
console.log(this.recArrs); //console.log(this.recArrs);
this.drawOldRect(); this.drawOldRect();
}); });
}, },
mounted() { mounted() {
console.log(window.location.host); //console.log(window.location.host);
const isProduction = process.env.NODE_ENV === "production"; const isProduction = process.env.NODE_ENV === "production";
if (isProduction) { if (isProduction) {
// 使IP // 使IP
this.hostName = window.location.origin; this.hostName = window.location.origin;
console.log(this.hostName); //console.log(this.hostName);
console.log("aaaaaaaaaaaa"); //console.log("aaaaaaaaaaaa");
} else { } else {
// 使 target // 使 target
this.hostName = "http://192.168.1.190:88"; // 使 target this.hostName = "http://192.168.1.190:88"; // 使 target
@ -183,7 +183,7 @@ export default {
getTypes() { getTypes() {
getTypesApi() getTypesApi()
.then((res) => { .then((res) => {
console.log(res); //console.log(res);
this.markOptions = res.data; this.markOptions = res.data;
this.typeMap = res.data; this.typeMap = res.data;
}) })
@ -192,16 +192,18 @@ export default {
// //
onImageLoad() { onImageLoad() {
this.updateImageSize(); this.updateImageSize();
console.log("我家在出来了");
}, },
updateImageSize() { updateImageSize() {
const img = this.$refs.imgDiv; const img = this.$refs.imgDiv;
this.imgWidth = img.offsetWidth; this.imgWidth = img.clientWidth;
this.imgHeight = img.offsetHeight; this.imgHeight = img.clientHeight;
console.dir(img);
console.log(this.imgWidth, this.imgHeight); console.log(this.imgWidth, this.imgHeight);
this.clearCanvas(); this.clearCanvas();
this.recArrs = []; this.recArrs = [];
for (var i = 0; i < this.labelMarkArrs.length; i++) { for (var i = 0; i < this.labelMarkArrs.length; i++) {
console.log(this.labelMarkArrs[i]); //console.log(this.labelMarkArrs[i]);
// //
this.recArrs.push({ this.recArrs.push({
x: x:
@ -216,8 +218,8 @@ export default {
type: this.labelMarkArrs[i].type, type: this.labelMarkArrs[i].type,
}); });
} }
console.log("aaaaaaaaaaaaaaaaa"); //console.log("aaaaaaaaaaaaaaaaa");
console.log(this.recArrs); //console.log(this.recArrs);
this.drawOldRect(); this.drawOldRect();
}, },
// // // //
@ -262,7 +264,7 @@ export default {
}, },
// //
moveFunction(e) { moveFunction(e) {
// console.log('', e); // //console.log('', e);
// 线 // 线
this.clearCanvas(); this.clearCanvas();
// 线 // 线
@ -380,7 +382,7 @@ export default {
let limitX = left + width; let limitX = left + width;
let limitY = top + height; let limitY = top + height;
if (x < left || x > limitX || y < top || y > limitY) { if (x < left || x > limitX || y < top || y > limitY) {
console.log("鼠标移出范围, 清除canvas重新绘制"); //console.log(" canvas");
this.clearCanvas(); this.clearCanvas();
this.drawOldRect(); this.drawOldRect();
} }
@ -391,7 +393,7 @@ export default {
let ctx2d = canvasDom.getContext("2d"); let ctx2d = canvasDom.getContext("2d");
const canvasHeight = canvasDom.offsetWidth; const canvasHeight = canvasDom.offsetWidth;
const canvasWidth = canvasDom.offsetWidth; const canvasWidth = canvasDom.offsetWidth;
//console.log(canvasDom); ////console.log(canvasDom);
// //
ctx2d.beginPath(); ctx2d.beginPath();
// //
@ -484,7 +486,7 @@ export default {
var typeColor = colors[this.recArrs[i].type] || "rgb(255, 0, 0)"; var typeColor = colors[this.recArrs[i].type] || "rgb(255, 0, 0)";
var bgcolors = var bgcolors =
bgcolors[this.recArrs[i].type] || "rgba(22, 158, 140, 0.2)"; bgcolors[this.recArrs[i].type] || "rgba(22, 158, 140, 0.2)";
console.log(typeColor); // //console.log(typeColor);
ctx2d.strokeStyle = typeColor; // 线 ctx2d.strokeStyle = typeColor; // 线
ctx2d.fillStyle = bgcolors; // 线 ctx2d.fillStyle = bgcolors; // 线
@ -530,9 +532,9 @@ export default {
}, },
// //
downFunction(e) { downFunction(e) {
console.log("鼠标按下", e); // e.button 0 1 2 //console.log("", e); // e.button 0 1 2
this.curObj.isRightClick = e.button > 1; this.curObj.isRightClick = e.button > 1;
console.log("是否右键", this.curObj.isRightClick); //console.log("", this.curObj.isRightClick);
// x,y // x,y
this.curObj.x = e.offsetX; this.curObj.x = e.offsetX;
@ -541,8 +543,8 @@ export default {
// //
// //
this.curObj.index = this.getEventIndex(this.curObj.x, this.curObj.y); this.curObj.index = this.getEventIndex(this.curObj.x, this.curObj.y);
console.log("落点矩形", this.curObj.index); //console.log("", this.curObj.index);
console.log("我是上面的数组", this.recArrs); //console.log("", this.recArrs);
console.log( console.log(
"我是上面的数组点击的哪一个", "我是上面的数组点击的哪一个",
this.recArrs[this.curObj.index] this.recArrs[this.curObj.index]
@ -566,14 +568,14 @@ export default {
this.curObj.x, this.curObj.x,
this.curObj.y this.curObj.y
); );
console.log("this.curObj.side", this.curObj.side); //console.log("this.curObj.side", this.curObj.side);
if (this.curObj.side < 9) { if (this.curObj.side < 9) {
// //
console.log("在缩放"); //console.log("");
this.curObj.resize = true; this.curObj.resize = true;
} else { } else {
// //
console.log("在拖动"); //console.log("");
this.curObj.drag = true; this.curObj.drag = true;
} }
@ -654,8 +656,8 @@ export default {
// //
getEventArea(index, x, y) { getEventArea(index, x, y) {
const data = this.recArrs[index]; const data = this.recArrs[index];
// console.log("this.recArrs", this.recArrs); // //console.log("this.recArrs", this.recArrs);
// console.log("data", data); // //console.log("data", data);
if ( if (
x > data.x - this.curObj.radious && x > data.x - this.curObj.radious &&
x < data.x + this.curObj.radious x < data.x + this.curObj.radious
@ -738,7 +740,7 @@ export default {
}, },
// //
upFunction(e) { upFunction(e) {
console.log("鼠标抬起", e); //console.log("", e);
if (this.curObj.isRightClick) { if (this.curObj.isRightClick) {
if (this.curObj.index !== -1) { if (this.curObj.index !== -1) {
// //
@ -758,7 +760,7 @@ export default {
this.curObj.draw = false; this.curObj.draw = false;
} }
console.log("鼠标抬起-当前矩形框", this.recArrs); //console.log("-", this.recArrs);
}, },
// //
addToRecs(e) { addToRecs(e) {
@ -774,7 +776,7 @@ export default {
// //
if (rec.w > 2 && rec.h > 2) { if (rec.w > 2 && rec.h > 2) {
this.recArrs.push(rec); this.recArrs.push(rec);
console.log("recArrs", this.recArrs); //console.log("recArrs", this.recArrs);
} }
}, },
// //
@ -793,10 +795,10 @@ export default {
type: this.recArrs[i].type, type: this.recArrs[i].type,
}); });
} }
console.log(params); //console.log(params);
saveLabelsApi(params) saveLabelsApi(params)
.then((res) => { .then((res) => {
console.log(res); //console.log(res);
if (res.success) { if (res.success) {
this.$message({ this.$message({
showClose: true, showClose: true,
@ -826,7 +828,7 @@ export default {
path: this.parentdata.name + "/" + this.currentNodeData.name, path: this.parentdata.name + "/" + this.currentNodeData.name,
}) })
.then((res) => { .then((res) => {
console.log(res); //console.log(res);
this.$message({ this.$message({
type: "success", type: "success",
message: "删除成功!", message: "删除成功!",
@ -845,7 +847,7 @@ export default {
// path: this.parentdata.name + "/" + this.currentNodeData.name, // path: this.parentdata.name + "/" + this.currentNodeData.name,
// }) // })
// .then((res) => { // .then((res) => {
// console.log(res); // //console.log(res);
// this.$message({ // this.$message({
// type: "success", // type: "success",
// message: "!", // message: "!",
@ -914,7 +916,7 @@ export default {
.picCanvans { .picCanvans {
width: 100%; width: 100%;
height: calc(100% - 87px); height: calc(100% - 87px);
overflow: auto; //overflow: auto;
h3 { h3 {
margin-bottom: 12px; margin-bottom: 12px;
font-size: 14px; font-size: 14px;
@ -938,6 +940,10 @@ export default {
} }
.canvas_dom { .canvas_dom {
position: absolute; position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
} }
} }
} }

@ -149,13 +149,13 @@ export default {
return; return;
} }
this.currentNodeKey = node.name; this.currentNodeKey = node.name;
console.log(node); // // console.log(node); //
console.log(data); //console.log(data);
const parentNode = this.findParentNode(data.id, this.piclist); const parentNode = this.findParentNode(data.id, this.piclist);
if (parentNode) { if (parentNode) {
// //
console.log(parentNode); // // console.log(parentNode); //
} else { } else {
// //
console.error("未能找到父节点"); console.error("未能找到父节点");
@ -166,10 +166,11 @@ export default {
EventBus.$emit("perentNode", parentNode); EventBus.$emit("perentNode", parentNode);
this.defaultExpandedKeys = [parentNode.name]; this.defaultExpandedKeys = [parentNode.name];
this.pathParams = parentNode.name + "/" + node.name; this.pathParams = parentNode.name + "/" + node.name;
console.log(this.pathParams); // console.log(this.pathParams);
this.getlabels(); this.getlabels();
localStorage.setItem("currentData", JSON.stringify(node)); localStorage.setItem("currentData", JSON.stringify(node));
this.scrollView(); this.scrollView();
EventBus.$emit("labelMark", this.labelsPoint);
}, },
scrollView() { scrollView() {
if (this.currentData) { if (this.currentData) {
@ -184,11 +185,11 @@ export default {
} }
}, },
findParentNode(childId, treeData) { findParentNode(childId, treeData) {
console.log(childId); //console.log(childId);
console.log(treeData); //console.log(treeData);
// //
return treeData.find((parent) => { return treeData.find((parent) => {
console.log(parent); // console.log(parent);
return ( return (
parent.children && parent.children &&
parent.children.find((child) => child.$treeNodeId === childId) parent.children.find((child) => child.$treeNodeId === childId)
@ -233,7 +234,7 @@ export default {
border-radius: 4px; border-radius: 4px;
.el-tree { .el-tree {
overflow-y: auto; overflow-y: auto;
height: calc(100% - 0px); height: calc(100% - 24px);
.el-tree-node__content { .el-tree-node__content {
height: 32px; height: 32px;
font-size: 14px; font-size: 14px;

Loading…
Cancel
Save