|
|
@@ -12,7 +12,7 @@
|
|
|
|
|
|
<script>
|
|
|
import Konva from "konva";
|
|
|
-import { getWorkareaInfo } from '@/api/mes/wa/workarea'
|
|
|
+import { getWorkareaInfo,updateWorkarea } from '@/api/mes/wa/workarea'
|
|
|
|
|
|
export default {
|
|
|
name: "KonvaExample",
|
|
|
@@ -26,14 +26,14 @@ export default {
|
|
|
texts: [], // 白色text合集
|
|
|
redrects: [], // 红色rect合集
|
|
|
redtexts: [], // 白色text合集
|
|
|
- value:''
|
|
|
+ value:'',
|
|
|
+ form:{},//拿到单个数据
|
|
|
};
|
|
|
},
|
|
|
watch:{
|
|
|
'$route.query.workareaId':{
|
|
|
handler(newValue){
|
|
|
if(newValue){
|
|
|
- this.value=newValue
|
|
|
this.getWorkAreaInfo()
|
|
|
this.initKonva();
|
|
|
}
|
|
|
@@ -41,8 +41,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.initKonva();
|
|
|
- this.getWorkAreaInfo()
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.getWorkAreaInfo()
|
|
|
+ })
|
|
|
console.log(this.$route.query.workareaId,'workareaId');
|
|
|
},
|
|
|
|
|
|
@@ -51,19 +52,23 @@ export default {
|
|
|
const workareaId=this.$route.query.workareaId;
|
|
|
getWorkareaInfo(workareaId).then(response => {
|
|
|
console.log(response,'工作区域预览接口调用');
|
|
|
-
|
|
|
+ this.form=response.data;
|
|
|
if (response.data.map) {
|
|
|
try {
|
|
|
let map = JSON.parse(response.data.map)
|
|
|
this.value = JSON.stringify(map, null, 4)
|
|
|
} catch (err) {}
|
|
|
}
|
|
|
- console.log(this.value,'Value')
|
|
|
+ this.initKonva();
|
|
|
+ // console.log(this.value,'Value')
|
|
|
})
|
|
|
},
|
|
|
refresh(){
|
|
|
-
|
|
|
this.initKonva();
|
|
|
+ this.form.map=this.value
|
|
|
+ updateWorkarea(this.form).then(response => {
|
|
|
+ console.log(response,'修改车间区域地图');
|
|
|
+ })
|
|
|
},
|
|
|
initKonva() {
|
|
|
// 创建舞台
|
|
|
@@ -142,6 +147,7 @@ export default {
|
|
|
this.redrects = [];
|
|
|
this.redtexts = [];
|
|
|
this.selectedText = [];
|
|
|
+
|
|
|
const positions=JSON.parse(this.value)
|
|
|
// const positions = [
|
|
|
// { row: 2, col: 9, pointName: "E-1" },
|