|
|
@@ -87,6 +87,7 @@
|
|
|
</ul>
|
|
|
</div>
|
|
|
<button class="btn btn-info mt-5 w-100 text-white" @click="openRepository()">新增库区</button>
|
|
|
+ <button class="btn btn-success mt-5 w-100 text-white" @click="searchingSelectEq()">批量构建库位</button>
|
|
|
<p class="font-weight-bold p-0 mb-0 mt-1">位置</p>
|
|
|
<div class="row text-muted small">
|
|
|
<small class="col-6">X</small>
|
|
|
@@ -255,6 +256,8 @@
|
|
|
@include("equipment._warehouseDetail")
|
|
|
@include("equipment._repository")
|
|
|
@include("equipment._buildGroup")
|
|
|
+ @include("equipment._locationAttr")
|
|
|
+ @include("equipment._failTipList")
|
|
|
</div>
|
|
|
</body>
|
|
|
<script src="{{ mix('js/app.js') }}"></script>
|
|
|
@@ -311,8 +314,8 @@
|
|
|
grid:false, //设备拖拽是否开启网格
|
|
|
turn:true, //设备是否翻转
|
|
|
isLoadLocation:false, //开启加载库位
|
|
|
- //baseUrl:"http://127.0.0.1:8112/",
|
|
|
- baseUrl:"https://swms.baoshi56.com/",
|
|
|
+ baseUrl:"http://127.0.0.1:8112/",
|
|
|
+ //baseUrl:"https://swms.baoshi56.com/",
|
|
|
current:{}, //当前操作的设备
|
|
|
error:{},
|
|
|
locations:[], //库位信息
|
|
|
@@ -324,6 +327,13 @@
|
|
|
elSeList:[
|
|
|
{id:-1,w:1.2,h:2.4,grid:2,color:"RGB(255,255,0)",describe:"消防栓设施或立柱,不可设库位"},
|
|
|
],//场景元素预设列表
|
|
|
+ locationAttr:null,//库位建立时的可选择属性
|
|
|
+ batchEquipment:{
|
|
|
+
|
|
|
+ },//设备类型 与设备下标的映射
|
|
|
+ batchEquipmentSign:"",//当前选择的batchEquipment下标
|
|
|
+ batchSign:false,//当前是否为批量构建
|
|
|
+ failTipList:{},//构建失败的库位提示信息
|
|
|
},
|
|
|
mounted() {
|
|
|
this.initPage();
|
|
|
@@ -373,6 +383,40 @@
|
|
|
};
|
|
|
},
|
|
|
methods:{
|
|
|
+ //获取库位的可选择属性
|
|
|
+ _getLocationAttr(){
|
|
|
+ if (this.locationAttr!==null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ url : this.baseUrl+"location/getAttr",
|
|
|
+ type : "post",
|
|
|
+ dataType : "JSON",
|
|
|
+ success : (res,status)=>{
|
|
|
+ if (res.code===200){
|
|
|
+ this.locationAttr = res.data;
|
|
|
+ }else{
|
|
|
+ window.toast.error(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error : (err,status)=>{
|
|
|
+ window.toast.error("库位选择属性加载失败");
|
|
|
+ },
|
|
|
+ timeout:3000,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 显示设备编码列表
|
|
|
+ */
|
|
|
+ showEquipmentCode(arr){
|
|
|
+ event.stopPropagation();
|
|
|
+ let obj = {};
|
|
|
+ arr.forEach(index=>{
|
|
|
+ obj[this.equipmentElements[index].code] = "";
|
|
|
+ });
|
|
|
+ this.failTipList = obj;
|
|
|
+ $("#failTipList").modal("show");
|
|
|
+ },
|
|
|
//检索所有元素,获取在指定范围内的元素
|
|
|
searchingSelectEq(){
|
|
|
afterExt = function (){
|
|
|
@@ -392,13 +436,43 @@
|
|
|
}
|
|
|
resolve(result);
|
|
|
}).then(indexArr=>{
|
|
|
- indexArr.forEach(index=>{
|
|
|
- console.log(vue.equipmentElements[index].code);
|
|
|
- });
|
|
|
+ if (indexArr.length===0){
|
|
|
+ toast.error("未选中任何设备");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ vue.batchOperationEquipment(indexArr);
|
|
|
});
|
|
|
}
|
|
|
clipScreenshots();
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 批量选中设备后唤起构建器
|
|
|
+ */
|
|
|
+ batchOperationEquipment(indexArr){
|
|
|
+ this.current = {};
|
|
|
+ let obj = {};
|
|
|
+ indexArr.forEach(index=>{
|
|
|
+ let eq = this.equipmentElements[index];
|
|
|
+ let eqTypeIndex = this._getEqTypeIndex(eq.id);
|
|
|
+ if (!obj[eqTypeIndex])obj[eqTypeIndex] = [];
|
|
|
+ obj[eqTypeIndex].push(index);
|
|
|
+ });
|
|
|
+ this.batchEquipment = obj;
|
|
|
+ $("#locationAttr").modal('show');
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 根据库位类型ID获取库位类型下标
|
|
|
+ */
|
|
|
+ _getEqTypeIndex(id){
|
|
|
+ //当前是ID为下标+1,所以直接ID-1获取下标
|
|
|
+ return id-1;
|
|
|
+ for (let i=0;i<this.equipments.length;i++){
|
|
|
+ if (this.equipments[i].id==id){
|
|
|
+ return i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ },
|
|
|
buildComponent(eq){
|
|
|
let component = {
|
|
|
"x":eq.x,"y":eq.y,"width":eq.turn ? eq.w : eq.h,"height":eq.turn ? eq.h : eq.w,"name":"","color":eq.color,
|
|
|
@@ -798,15 +872,55 @@
|
|
|
let val = event.target.value;
|
|
|
this.currentEl[key] = val ? parseFloat(val) : 0;
|
|
|
},
|
|
|
+ _getObjFirstKey(obj){
|
|
|
+ for(let key in obj){
|
|
|
+ return key;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 构建库位的默认值信息
|
|
|
+ * */
|
|
|
+ _locationAttrDefault(){
|
|
|
+ this.buildPool.usage = this._getObjFirstKey(this.locationAttr.usage);
|
|
|
+ this.buildPool.handling = this._getObjFirstKey(this.locationAttr.handling);
|
|
|
+ this.buildPool.attribute = this._getObjFirstKey(this.locationAttr.attribute);
|
|
|
+ this.buildPool.category = this._getObjFirstKey(this.locationAttr.category);
|
|
|
+ this.buildPool.demand = this._getObjFirstKey(this.locationAttr.demand);
|
|
|
+ this.buildPool.mixFlag = true;
|
|
|
+ this.buildPool.mixLotFlag = false;
|
|
|
+ this.buildPool.loseIdFlag = true;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 批量构建库位时的操作
|
|
|
+ * */
|
|
|
+ nextDetailBatch(index){
|
|
|
+ if (!this.current.children || this.current.children.length===0){
|
|
|
+ window.toast.error("设备信息尚未加载完毕,请稍后重试!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.batchSign = true;
|
|
|
+ this.currentEqChildIndex = index-1;
|
|
|
+ setTimeout(function (){
|
|
|
+ let parentDom = document.getElementById("locationAttr").firstChild.firstChild;
|
|
|
+ let childDom = document.getElementById("locationModal").firstChild.firstChild;
|
|
|
+ childDom.style.minWidth = parentDom.offsetWidth+'px';
|
|
|
+ childDom.style.minHeight = parentDom.offsetHeight+'px';
|
|
|
+ $("#locationModal").modal("show");
|
|
|
+ },20);
|
|
|
+ this._locationAttrDefault();
|
|
|
+ },
|
|
|
//子设备选定时的库位加载
|
|
|
nextDetail(index){
|
|
|
if (!this.current.eqId)return;
|
|
|
+ this.batchSign = false;
|
|
|
this.currentEqChildIndex = index-1;
|
|
|
this.isLoadLocation = true;
|
|
|
+ this._locationAttrDefault();
|
|
|
setTimeout(function (){
|
|
|
let parentDom = document.getElementById("detailInfo").firstChild.firstChild;
|
|
|
let childDom = document.getElementById("locationModal").firstChild.firstChild;
|
|
|
- childDom.style.minWidth = parentDom.offsetWidth+'px';
|
|
|
+ childDom.style.minWidth = (parentDom.offsetWidth+200)+'px';
|
|
|
childDom.style.minHeight = parentDom.offsetHeight+'px';
|
|
|
$("#locationModal").modal("show");
|
|
|
},20);
|
|
|
@@ -820,13 +934,8 @@
|
|
|
switch (res.code){
|
|
|
case 200:
|
|
|
this.locations = res.data[0];
|
|
|
- this.locationMapping = res.data[1];
|
|
|
+ this.locationMapping = res.data[1] ? res.data[1] : {};
|
|
|
this.isLoadLocation = false;
|
|
|
- setTimeout(()=>{
|
|
|
- let parentDom = document.getElementById("detailInfo").firstChild.firstChild;
|
|
|
- let childDom = document.getElementById("locationModal").firstChild.firstChild;
|
|
|
- childDom.children[1].firstChild.style.height = parentDom.children[1].offsetHeight+'px';
|
|
|
- },10);
|
|
|
break;
|
|
|
default:
|
|
|
window.toast.error(res.message);
|
|
|
@@ -840,6 +949,7 @@
|
|
|
})
|
|
|
},
|
|
|
showDetail(equipment){
|
|
|
+ this._getLocationAttr();
|
|
|
if (!this.isNotEdit)return;
|
|
|
this.current = equipment;
|
|
|
setTimeout(()=>{
|
|
|
@@ -849,6 +959,9 @@
|
|
|
this.getChildren(this.current);
|
|
|
},
|
|
|
getChildren(equipment){
|
|
|
+ if (equipment.children && equipment.children.length>0){
|
|
|
+ return;
|
|
|
+ }
|
|
|
$.ajax({
|
|
|
url : this.baseUrl+"equipment/getChildren",
|
|
|
type : "post",
|
|
|
@@ -975,7 +1088,64 @@
|
|
|
timeout:3000,
|
|
|
})
|
|
|
},
|
|
|
+ locationBatchBind(){
|
|
|
+ $("#loading").show();
|
|
|
+ let arr = this.batchEquipment[this.batchEquipmentSign];
|
|
|
+ let request = [];
|
|
|
+ let failTipList = {};
|
|
|
+ arr.forEach(index=>{
|
|
|
+ let eq = this.equipmentElements[index];
|
|
|
+ if (!eq){
|
|
|
+ window.toast.error("异常设备选择");
|
|
|
+ }else if (!eq.children || eq.children.length===0 || !eq.children[this.currentEqChildIndex]){
|
|
|
+ failTipList[eq.code]="详情尚未加载完毕";
|
|
|
+ }else{
|
|
|
+ let item = eq.children[this.currentEqChildIndex];
|
|
|
+ let code = eq.code+'-'+((this.currentEqChildIndex+1)<10 ? '0'+(this.currentEqChildIndex+1) : (this.currentEqChildIndex+1));
|
|
|
+ request.push(Object.assign({id:item.id,code:code},
|
|
|
+ this.buildPool))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ url : this.baseUrl+"location/locationBatchBound",
|
|
|
+ type : "post",
|
|
|
+ dataType : "JSON",
|
|
|
+ data : JSON.stringify(request),
|
|
|
+ headers:{'Content-Type':'application/json;charset=utf8'},
|
|
|
+ success : (res)=>{
|
|
|
+ switch (res.code){
|
|
|
+ case 200:
|
|
|
+ $("#locationModal").modal('hide');
|
|
|
+ window.toast.success("构建完毕!");
|
|
|
+ this.failTipList = Object.assign(failTipList,res.data);
|
|
|
+ if (JSON.stringify(this.failTipList)!=="{}"){
|
|
|
+ $("#failTipList").modal("show");
|
|
|
+ }
|
|
|
+ let ele = document.querySelectorAll("#locationAttr span.el-center")[this.current.layer-1-this.currentEqChildIndex];
|
|
|
+ ele.className += " bg-success";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ window.toast.error(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error : (err)=>{
|
|
|
+ window.tempTip.setIndex(999);
|
|
|
+ window.tempTip.show("网络错误");
|
|
|
+ },
|
|
|
+ complete:(req,status)=>{
|
|
|
+ $("#loading").hide();
|
|
|
+ if (status==='timeout'){
|
|
|
+ window.toast.error("库位批量构建失败,响应超时");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ timeout:3000,
|
|
|
+ });
|
|
|
+ },
|
|
|
locationBind(){
|
|
|
+ if (this.batchSign){
|
|
|
+ this.locationBatchBind();
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (this.isLoadLocation)return;
|
|
|
let eq = this.current.children[this.currentEqChildIndex];
|
|
|
let code = this.current.code+'-'+((this.currentEqChildIndex+1)<10 ? '0'+(this.currentEqChildIndex+1) : (this.currentEqChildIndex+1));
|
|
|
@@ -984,7 +1154,8 @@
|
|
|
url : this.baseUrl+"location/locationBind",
|
|
|
type : "post",
|
|
|
dataType : "JSON",
|
|
|
- data : {id:eq.id,row:this.buildPool.row,column:this.buildPool.column,code:code},
|
|
|
+ headers:{'Content-Type':'application/json;charset=utf8'},
|
|
|
+ data : JSON.stringify(Object.assign({id:eq.id,code:code},this.buildPool)),
|
|
|
success : (res)=>{
|
|
|
switch (res.code){
|
|
|
case 200:
|
|
|
@@ -1129,6 +1300,17 @@
|
|
|
timeout:3000,
|
|
|
})
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 批量构建设备库位时的选中操作
|
|
|
+ * */
|
|
|
+ batchEquipmentSelected(arr,index){
|
|
|
+ this.current = this.equipmentElements[arr[0]];
|
|
|
+ this.batchEquipmentSign = index;
|
|
|
+ arr.forEach(i=>{
|
|
|
+ this.getChildren(this.equipmentElements[i]);
|
|
|
+ })
|
|
|
+ this._getLocationAttr();
|
|
|
+ },
|
|
|
},
|
|
|
filters:{
|
|
|
qty(code){
|