|
|
@@ -73,7 +73,7 @@
|
|
|
<a role="menuitem" tabindex="-1" style="cursor: pointer" class="ml-3"
|
|
|
@click="selectedWarehouse(warehouse)">@{{ warehouse.name }}</a>
|
|
|
</li>
|
|
|
- <li role="presentation" class="text-center" @click="addWarehouseDetail()">
|
|
|
+ <li role="presentation" class="text-center" @click="showAddWarehouseDetail()">
|
|
|
<a role="menuitem" tabindex="-1" style="cursor: pointer" class="ml-3 text-primary"
|
|
|
><i class="fa fa-plus"></i> 新增</a>
|
|
|
</li>
|
|
|
@@ -197,7 +197,7 @@
|
|
|
</div>
|
|
|
<div class="col-10 p-0">
|
|
|
<div class="w-100 bg-secondary" id="canvasApp" style="height: 100vh;overflow: auto;user-select: none;">
|
|
|
- <div id="canvas" :style="[{width:container.width*(scale/100)+'px'},{height:container.height*(scale/100)+'px'},{transform: 'scale('+(scale/100)+')'}]"
|
|
|
+ <div id="canvas" v-if="isLoad" :style="[{width:container.width*(scale/100)+'px'},{height:container.height*(scale/100)+'px'},{transform: 'scale('+(scale/100)+')'}]"
|
|
|
style="position: relative;transform-origin: 0 0" class="bg-white"
|
|
|
@mousedown="contentOnmousedown" @mousemove="contentOnmousemove" @mouseup="contentOnmouseup">
|
|
|
<vue-drag-resize v-for="(element,index) in elements"
|
|
|
@@ -242,7 +242,7 @@
|
|
|
</div>
|
|
|
</body>
|
|
|
<script src="{{ mix('js/app.js') }}"></script>
|
|
|
-<script src="{{ mix('js/utilities/toast.js') }}"></script>
|
|
|
+<script src="{{ asset('js/utilities/toast.js') }}"></script>
|
|
|
<script type="text/javascript">
|
|
|
var vue = new Vue({
|
|
|
el:"#container",
|
|
|
@@ -259,6 +259,7 @@
|
|
|
ratio:20, //设备大小缩放比例值
|
|
|
name:"", //当前选中的仓库NAME
|
|
|
isNotEdit:true, //是否允许编辑
|
|
|
+ isLoad:true, //是否加载
|
|
|
currentEl:{}, //当前选中的元素
|
|
|
coordsMapping:{ //元素信息映射
|
|
|
"居中":"h-100 w-100 el-center",
|
|
|
@@ -343,11 +344,14 @@
|
|
|
success : (res,status)=>{
|
|
|
this.warehouses = res.data;
|
|
|
//这里获取warehouses
|
|
|
- let record = localStorage.getItem("equipment:warehouse");
|
|
|
- if (record){
|
|
|
- let recordObj = JSON.parse(record);
|
|
|
- this.selectedWarehouse(recordObj);
|
|
|
- }else{
|
|
|
+ let id = localStorage.getItem("equipment:warehouse");
|
|
|
+ if (!id || !this.warehouses.some(warehouse=>{
|
|
|
+ if (warehouse.id == id){
|
|
|
+ this.selectedWarehouse(warehouse);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ){
|
|
|
if (this.warehouses.length>0)this.selectedWarehouse(this.warehouses[0]);
|
|
|
}
|
|
|
$("#loading").hide();
|
|
|
@@ -486,44 +490,48 @@
|
|
|
},
|
|
|
//仓库切换
|
|
|
selectedWarehouse(warehouse){
|
|
|
- this.selected = warehouse.id;
|
|
|
- this.name = warehouse.name;
|
|
|
- this.ratio = warehouse.ratio;
|
|
|
- this.container = {width:warehouse.length*this.ratio,height:warehouse.width*this.ratio};
|
|
|
- localStorage.setItem("equipment:warehouse", JSON.stringify(warehouse));
|
|
|
- $.ajax({
|
|
|
- url : this.baseUrl+"warehouse/detail/getCoordsInfo",
|
|
|
- type : "post",
|
|
|
- dataType : "JSON",
|
|
|
- data : {id:warehouse.id},
|
|
|
- success : (res,status)=>{
|
|
|
- this.elements = res.data[0] ? JSON.parse(res.data[0]) : [];
|
|
|
- if(res.data[1] && res.data[1].length>0){
|
|
|
- let equipmentElements = [];
|
|
|
- res.data[1].forEach(eq=>{
|
|
|
- let coords = JSON.parse(eq.info);
|
|
|
- let selfInfo = this.equipments[coords.id-1];
|
|
|
- equipmentElements.push(Object.assign({
|
|
|
- eqId:eq.id,
|
|
|
- code:eq.code,
|
|
|
- width:eq.width,
|
|
|
- depth:eq.depth,
|
|
|
- repository:eq.repositoryId,
|
|
|
- x:coords.x,
|
|
|
- y:coords.y,
|
|
|
- turn:!!coords.turn,
|
|
|
- },selfInfo));
|
|
|
- });
|
|
|
- this.equipmentElements = equipmentElements;
|
|
|
- }else this.equipmentElements = [];
|
|
|
- this.repositories = res.data[2];
|
|
|
- this.isNotEdit = true;
|
|
|
- },
|
|
|
- error : (err,status)=>{
|
|
|
- window.tempTip.show("坐标信息加载失败");
|
|
|
- },
|
|
|
- timeout:3000,
|
|
|
- })
|
|
|
+ this.isLoad = false;
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.selected = warehouse.id;
|
|
|
+ this.name = warehouse.name;
|
|
|
+ this.ratio = warehouse.ratio;
|
|
|
+ this.container = {width:warehouse.length*this.ratio,height:warehouse.width*this.ratio};
|
|
|
+ localStorage.setItem("equipment:warehouse", warehouse.id);
|
|
|
+ $.ajax({
|
|
|
+ url : this.baseUrl+"warehouse/detail/getCoordsInfo",
|
|
|
+ type : "post",
|
|
|
+ dataType : "JSON",
|
|
|
+ data : {id:warehouse.id},
|
|
|
+ success : (res,status)=>{
|
|
|
+ this.elements = res.data[0] ? JSON.parse(res.data[0]) : [];
|
|
|
+ if(res.data[1] && res.data[1].length>0){
|
|
|
+ let equipmentElements = [];
|
|
|
+ res.data[1].forEach(eq=>{
|
|
|
+ let coords = JSON.parse(eq.info);
|
|
|
+ let selfInfo = this.equipments[coords.id-1];
|
|
|
+ equipmentElements.push(Object.assign({
|
|
|
+ eqId:eq.id,
|
|
|
+ code:eq.code,
|
|
|
+ width:eq.width,
|
|
|
+ depth:eq.depth,
|
|
|
+ repository:eq.repositoryId,
|
|
|
+ x:coords.x,
|
|
|
+ y:coords.y,
|
|
|
+ turn:!!coords.turn,
|
|
|
+ },selfInfo));
|
|
|
+ });
|
|
|
+ this.equipmentElements = equipmentElements;
|
|
|
+ }else this.equipmentElements = [];
|
|
|
+ this.repositories = res.data[2];
|
|
|
+ this.isNotEdit = true;
|
|
|
+ this.isLoad = true;
|
|
|
+ },
|
|
|
+ error : (err,status)=>{
|
|
|
+ window.tempTip.show("坐标信息加载失败");
|
|
|
+ },
|
|
|
+ timeout:3000,
|
|
|
+ })
|
|
|
+ },200);
|
|
|
},
|
|
|
//文本类属性改变
|
|
|
changeText(key){
|
|
|
@@ -757,7 +765,7 @@
|
|
|
$("#warehouseDetail").modal("show");
|
|
|
break;
|
|
|
default:
|
|
|
- window.toast.error("仓库建立失败");
|
|
|
+ window.toast.error("仓库获取失败");
|
|
|
}
|
|
|
},
|
|
|
error : (err)=>{
|