|
@@ -4,7 +4,10 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import Konva from "konva";
|
|
import Konva from "konva";
|
|
|
-import { selectIsIsolationPointById,getIsIsolationPointPage } from "@/api/mes/spm/segregationPoint";
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ selectIsIsolationPointById,
|
|
|
|
|
+ getIsIsolationPointPage,
|
|
|
|
|
+} from "@/api/mes/spm/segregationPoint";
|
|
|
import { mapGetters } from "vuex";
|
|
import { mapGetters } from "vuex";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -34,11 +37,16 @@ export default {
|
|
|
console.log(
|
|
console.log(
|
|
|
this.getSelectSopPoints,
|
|
this.getSelectSopPoints,
|
|
|
this.getSopEdit,
|
|
this.getSopEdit,
|
|
|
|
|
+ this.getSopLook,
|
|
|
"getSopEdit - getSelectSopPoints"
|
|
"getSopEdit - getSelectSopPoints"
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
- ...mapGetters("sopSelectPoints", ["getSelectSopPoints", "getSopEdit"]),
|
|
|
|
|
|
|
+ ...mapGetters("sopSelectPoints", [
|
|
|
|
|
+ "getSelectSopPoints",
|
|
|
|
|
+ "getSopEdit",
|
|
|
|
|
+ "getSopLook",
|
|
|
|
|
+ ]),
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
initKonva() {
|
|
initKonva() {
|
|
@@ -126,6 +134,7 @@ export default {
|
|
|
const isLocked = this.getSelectSopPoints.length > 0;
|
|
const isLocked = this.getSelectSopPoints.length > 0;
|
|
|
|
|
|
|
|
// 添加或移除全局点击事件监听器 this.getSopEdit这是vuex里判断是否可以选择隔离点的操作
|
|
// 添加或移除全局点击事件监听器 this.getSopEdit这是vuex里判断是否可以选择隔离点的操作
|
|
|
|
|
+
|
|
|
if (isLocked && this.getSopEdit == true) {
|
|
if (isLocked && this.getSopEdit == true) {
|
|
|
this.layer.on("click", (e) => {
|
|
this.layer.on("click", (e) => {
|
|
|
e.cancelBubble = true; // 阻止事件冒泡
|
|
e.cancelBubble = true; // 阻止事件冒泡
|
|
@@ -152,7 +161,7 @@ export default {
|
|
|
draggable: false,
|
|
draggable: false,
|
|
|
});
|
|
});
|
|
|
// 添加点击事件,仅当 getSopEdit 为 true 时才允许点击a
|
|
// 添加点击事件,仅当 getSopEdit 为 true 时才允许点击a
|
|
|
- if (this.getSopEdit == true) {
|
|
|
|
|
|
|
+ if (this.getSopEdit == true && this.getSopLook == false) {
|
|
|
knovaImage.on("click", () => {
|
|
knovaImage.on("click", () => {
|
|
|
// 切换选中状态,基于文本内容
|
|
// 切换选中状态,基于文本内容
|
|
|
this.selectedStates[labelText] = !this.selectedStates[labelText];
|
|
this.selectedStates[labelText] = !this.selectedStates[labelText];
|
|
@@ -174,7 +183,10 @@ export default {
|
|
|
// 获取隔离点信息,并将选中的 labelText 推入数组
|
|
// 获取隔离点信息,并将选中的 labelText 推入数组
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
- if(this.$route.query.sopId!==null||this.$route.query.ticketId!==null){
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.$route.query.sopId !== null ||
|
|
|
|
|
+ this.$route.query.ticketId !== null
|
|
|
|
|
+ ) {
|
|
|
selectIsIsolationPointById(pos.pointId).then((res) => {
|
|
selectIsIsolationPointById(pos.pointId).then((res) => {
|
|
|
this.selectedText.push({
|
|
this.selectedText.push({
|
|
|
pointName: res.data.pointName,
|
|
pointName: res.data.pointName,
|
|
@@ -182,11 +194,10 @@ export default {
|
|
|
pointType: res.data.pointType,
|
|
pointType: res.data.pointType,
|
|
|
powerType: res.data.powerType,
|
|
powerType: res.data.powerType,
|
|
|
});
|
|
});
|
|
|
- console.log(this.selectedText,'$emit');
|
|
|
|
|
|
|
+ console.log(this.selectedText, "$emit");
|
|
|
this.$emit("selection-changed", this.selectedText);
|
|
this.$emit("selection-changed", this.selectedText);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
// 取消选中状态,恢复普通矩形和文字,切换为未选中的图片
|
|
// 取消选中状态,恢复普通矩形和文字,切换为未选中的图片
|
|
@@ -214,7 +225,6 @@ export default {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
this.layer.add(knovaImage);
|
|
this.layer.add(knovaImage);
|
|
|
|
|
|
|
|
// 普通矩形
|
|
// 普通矩形
|
|
@@ -287,39 +297,42 @@ export default {
|
|
|
knovaImage.image(selectedImage); // 更新图像
|
|
knovaImage.image(selectedImage); // 更新图像
|
|
|
this.layer.draw(); // 更新图层
|
|
this.layer.draw(); // 更新图层
|
|
|
};
|
|
};
|
|
|
- // 将选中的 labelText 推入数组
|
|
|
|
|
|
|
+ // 将选中的 labelText 推入数组
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
- getIsIsolationPointPage({ current: 1, size: 100 }).then((res) => {
|
|
|
|
|
- const allPoints = res.data.records; // 假设返回的数据结构是 { records: [点数据] }
|
|
|
|
|
-
|
|
|
|
|
- // 根据 pos.pointId 查找对应的 pointType 和 powerType
|
|
|
|
|
- const pointInfo = allPoints.find(point => point.pointId == pos.pointId);
|
|
|
|
|
-
|
|
|
|
|
- if (pointInfo) {
|
|
|
|
|
- this.selectedText.push({
|
|
|
|
|
- pointName: labelText,
|
|
|
|
|
- pointId: pos.pointId,
|
|
|
|
|
- pointType: pointInfo.pointType,
|
|
|
|
|
- powerType: pointInfo.powerType,
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果没有找到对应的点信息,可以处理这种情况
|
|
|
|
|
- console.warn(`未找到 pointId 为 ${pos.pointId} 的点信息`);
|
|
|
|
|
- this.selectedText.push({
|
|
|
|
|
- pointName: labelText,
|
|
|
|
|
- pointId: pos.pointId,
|
|
|
|
|
- pointType: '',
|
|
|
|
|
- powerType: '',
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- // console.log(this.selectedText,'默认拿到的points')
|
|
|
|
|
- // 触发父组件的 selection-changed 事件
|
|
|
|
|
- this.$emit("selection-changed", this.selectedText);
|
|
|
|
|
- }).catch((error) => {
|
|
|
|
|
- console.error("获取隔离点信息失败", error);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ getIsIsolationPointPage({ current: 1, size: 100 })
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ const allPoints = res.data.records; // 假设返回的数据结构是 { records: [点数据] }
|
|
|
|
|
+
|
|
|
|
|
+ // 根据 pos.pointId 查找对应的 pointType 和 powerType
|
|
|
|
|
+ const pointInfo = allPoints.find(
|
|
|
|
|
+ (point) => point.pointId == pos.pointId
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ if (pointInfo) {
|
|
|
|
|
+ this.selectedText.push({
|
|
|
|
|
+ pointName: labelText,
|
|
|
|
|
+ pointId: pos.pointId,
|
|
|
|
|
+ pointType: pointInfo.pointType,
|
|
|
|
|
+ powerType: pointInfo.powerType,
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果没有找到对应的点信息,可以处理这种情况
|
|
|
|
|
+ console.warn(`未找到 pointId 为 ${pos.pointId} 的点信息`);
|
|
|
|
|
+ this.selectedText.push({
|
|
|
|
|
+ pointName: labelText,
|
|
|
|
|
+ pointId: pos.pointId,
|
|
|
|
|
+ pointType: "",
|
|
|
|
|
+ powerType: "",
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // console.log(this.selectedText,'默认拿到的points')
|
|
|
|
|
+ // 触发父组件的 selection-changed 事件
|
|
|
|
|
+ this.$emit("selection-changed", this.selectedText);
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((error) => {
|
|
|
|
|
+ console.error("获取隔离点信息失败", error);
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.layer.draw();
|
|
this.layer.draw();
|