|
@@ -2059,34 +2059,38 @@
|
|
|
data =>{
|
|
|
// console.log(data,'公司列表')
|
|
|
console.log(init)
|
|
|
- if(init){
|
|
|
- if(type == 0){
|
|
|
- if(data.data.length>0){
|
|
|
+ let storage = window.localStorage;
|
|
|
+ let companyId = storage.getItem("companyId");
|
|
|
+ let projectId = storage.getItem("projectId")
|
|
|
+ if(type == 0){
|
|
|
+ if(data.data.length>0){
|
|
|
+ if(projectId){
|
|
|
+ this.projectId = projectId;
|
|
|
+ }else{
|
|
|
this.projectId = data.data[0].id;
|
|
|
- this.getProjectData(data.data[0].id)
|
|
|
- this.getFields();
|
|
|
- this.networkGet();
|
|
|
- for(let key in data.data){
|
|
|
- this.$set(data.data[key],'isOpen',false)
|
|
|
+ }
|
|
|
+ this.getProjectData(this.projectId)
|
|
|
+ this.getFields();
|
|
|
+ this.networkGet();
|
|
|
+ for(let key in data.data){
|
|
|
+ this.$set(data.data[key],'isOpen',false)
|
|
|
+ if(data.data[key].id == this.projectId){
|
|
|
+ this.$set(data.data[key],'isOpen',true)
|
|
|
}
|
|
|
- this.$set(data.data[0],'isOpen',true)
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- }else{
|
|
|
- if(data.data.length>0){
|
|
|
- for(let key in data.data){
|
|
|
- this.$set(data.data[key],'isOpen',false)
|
|
|
- if(data.data[0].projectList.length>0){
|
|
|
- for(let d of data.data[0].projectList){
|
|
|
- this.$set(d,'isOpen',true)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- this.$set(data.data[0],'isOpen',true)
|
|
|
- this.companyId = data.data[0].cId;
|
|
|
+ }else{
|
|
|
+ if(data.data.length>0){
|
|
|
+ if(companyId){
|
|
|
+ this.companyId = companyId;
|
|
|
if(data.data[0].projectList.length>0){
|
|
|
- this.projectId = data.data[0].projectList[0].id;
|
|
|
- this.$set(data.data[0].projectList[0],'isOpen',true)
|
|
|
+ if(projectId){
|
|
|
+ this.projectId = projectId;
|
|
|
+ }else{
|
|
|
+ this.projectId = data.data[0].projectList[0].id;
|
|
|
+ }
|
|
|
+ // this.$set(data.data[0].projectList[0],'isOpen',true)
|
|
|
this.getProjectData(this.projectId)
|
|
|
this.getFields();
|
|
|
this.networkGet();
|
|
@@ -2104,53 +2108,14 @@
|
|
|
this.fault = 0;
|
|
|
}
|
|
|
}else{
|
|
|
- this.companyId = null
|
|
|
- this.projectId = null;
|
|
|
- this.deviceTotalData = {
|
|
|
- light_num:0,
|
|
|
- online_num:0,
|
|
|
- fault_count:0,
|
|
|
- network_num:0
|
|
|
- };
|
|
|
- this.deviceList = [];
|
|
|
- this.total = 0;
|
|
|
- this.count = 0;
|
|
|
- this.fault = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(type == 0){
|
|
|
- if(data.data.length>0){
|
|
|
- this.projectId = data.data[0].id;
|
|
|
- this.getProjectData(data.data[0].id)
|
|
|
- this.getFields();
|
|
|
- this.networkGet();
|
|
|
- for(let key in data.data){
|
|
|
- this.$set(data.data[key],'isOpen',false)
|
|
|
- }
|
|
|
- this.$set(data.data[0],'isOpen',true)
|
|
|
- }
|
|
|
-
|
|
|
- }else{
|
|
|
- if(data.data.length>0){
|
|
|
- for(let key in data.data){
|
|
|
- this.$set(data.data[key],'isOpen',false)
|
|
|
- if(data.data[0].projectList.length>0){
|
|
|
- for(let d of data.data[0].projectList){
|
|
|
- this.$set(d,'isOpen',true)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- this.$set(data.data[0],'isOpen',true)
|
|
|
this.companyId = data.data[0].cId;
|
|
|
if(data.data[0].projectList.length>0){
|
|
|
this.projectId = data.data[0].projectList[0].id;
|
|
|
- this.$set(data.data[0].projectList[0],'isOpen',true)
|
|
|
+ // this.$set(data.data[0].projectList[0],'isOpen',true)
|
|
|
this.getProjectData(this.projectId)
|
|
|
this.getFields();
|
|
|
this.networkGet();
|
|
|
}else{
|
|
|
- this.projectId = null;
|
|
|
this.projectId = null;
|
|
|
this.deviceTotalData = {
|
|
|
light_num:0,
|
|
@@ -2163,20 +2128,34 @@
|
|
|
this.count = 0;
|
|
|
this.fault = 0;
|
|
|
}
|
|
|
- }else{
|
|
|
- this.companyId = null;
|
|
|
- this.projectId = null;
|
|
|
- this.deviceTotalData = {
|
|
|
- light_num:0,
|
|
|
- online_num:0,
|
|
|
- fault_count:0,
|
|
|
- network_num:0
|
|
|
- };
|
|
|
- this.deviceList = [];
|
|
|
- this.total = 0;
|
|
|
- this.count = 0;
|
|
|
- this.fault = 0;
|
|
|
}
|
|
|
+ for(let key in data.data){
|
|
|
+ this.$set(data.data[key],'isOpen',false)
|
|
|
+ if(data.data[key].cId == this.companyId){
|
|
|
+ this.$set(data.data[key],'isOpen',true)
|
|
|
+ }
|
|
|
+ if(data.data[0].projectList.length>0){
|
|
|
+ for(let d of data.data[0].projectList){
|
|
|
+ this.$set(d,'isOpen',true)
|
|
|
+ if(d.id == this.projectId){
|
|
|
+ this.$set(d,'isOpen',true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.companyId = null
|
|
|
+ this.projectId = null;
|
|
|
+ this.deviceTotalData = {
|
|
|
+ light_num:0,
|
|
|
+ online_num:0,
|
|
|
+ fault_count:0,
|
|
|
+ network_num:0
|
|
|
+ };
|
|
|
+ this.deviceList = [];
|
|
|
+ this.total = 0;
|
|
|
+ this.count = 0;
|
|
|
+ this.fault = 0;
|
|
|
}
|
|
|
}
|
|
|
console.log(this.companyId)
|
|
@@ -2214,9 +2193,9 @@
|
|
|
}else{
|
|
|
this.$set(data,'isOpen',false)
|
|
|
}
|
|
|
- console.log(type,data)
|
|
|
+ console.log(type,data,d)
|
|
|
storage.setItem('projectId',data.id);
|
|
|
- if(this.sideBarCompanyType != 0){
|
|
|
+ if(type != 0){
|
|
|
if(d.cId != this.companyId){
|
|
|
this.companyId = d.cId;
|
|
|
storage.setItem('companyId',d.cId);
|
|
@@ -2278,6 +2257,9 @@
|
|
|
}
|
|
|
},
|
|
|
batchProcessingFun(type){
|
|
|
+ if(this.loading.batchProcessingFun){
|
|
|
+ return
|
|
|
+ }
|
|
|
let lampIds = '';
|
|
|
if(type == 'on'){
|
|
|
this.lampcontrolOperationType = '-1';
|
|
@@ -2336,7 +2318,7 @@
|
|
|
if(oldBoolean){
|
|
|
this.lampProtocoltype = '0';
|
|
|
baseApi.ajax_post(
|
|
|
- allUrl.device.workmode,
|
|
|
+ allUrl.project.workmode,
|
|
|
{
|
|
|
username:this.username,
|
|
|
client_key:this.client_key,
|
|
@@ -2452,7 +2434,7 @@
|
|
|
}
|
|
|
this_.loading.batchProcessingFun = true;
|
|
|
|
|
|
- baseApi.websocket1(allUrl.home.wss,data=>{
|
|
|
+ baseApi.websocket1(allUrl.websocket.wss,data=>{
|
|
|
if(data.data.status == '1'){
|
|
|
baseApi.ajax_post_ws(
|
|
|
allUrl.gisMap.lampcontrolDimming,
|
|
@@ -2490,7 +2472,7 @@
|
|
|
if(i >= ids_length){
|
|
|
this_.loading.batchProcessingFun = false;
|
|
|
this_.batchProcessing = type;
|
|
|
- this_.getData(this_.currentPage);
|
|
|
+ this_.getLightList(this_.currentPage);
|
|
|
websocket.close();
|
|
|
}
|
|
|
}else{
|
|
@@ -2509,7 +2491,7 @@
|
|
|
if(i >= ids_length){
|
|
|
this_.loading.batchProcessingFun = false;
|
|
|
this_.batchProcessing = type;
|
|
|
- this_.getData(this_.currentPage);
|
|
|
+ this_.getLightList(this_.currentPage);
|
|
|
websocket.close();
|
|
|
}
|
|
|
}
|
|
@@ -2556,30 +2538,23 @@
|
|
|
type: 'success'
|
|
|
});
|
|
|
this.batchProcessing = type;
|
|
|
- this.getData(this.currentPage);
|
|
|
+ this.getLightList(this.currentPage);
|
|
|
this.networkSectionList();
|
|
|
this.loading.batchProcessingFun = false;
|
|
|
},
|
|
|
this)
|
|
|
}).catch(() => {
|
|
|
- if(this.version == 0){
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: this.version == 0?'已取消删除':'Canceled deleting'
|
|
|
- });
|
|
|
- }else{
|
|
|
- this.$message({
|
|
|
+ this.$message({
|
|
|
type: 'info',
|
|
|
message: 'Undeleted'
|
|
|
- });
|
|
|
- }
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
}else if(this.lampcontrolOperationType == '-1'){
|
|
|
if(this.version == 0){
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
- message:this.version == 0?'请先选中修改类型':'Please select the modified type first',
|
|
|
+ message:'Please select the modified type first',
|
|
|
type: 'warning'
|
|
|
});
|
|
|
}else{
|
|
@@ -2593,7 +2568,7 @@
|
|
|
if(this.multipleSelection.length == 0){
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
- message:this.version==0?'请先选中灯控':'Please select the light control first',
|
|
|
+ message:'Please select the light control first',
|
|
|
type: 'warning'
|
|
|
});
|
|
|
}else{
|
|
@@ -2620,9 +2595,9 @@
|
|
|
message:data.msg,
|
|
|
type: 'success'
|
|
|
});
|
|
|
- this.policyName = this.version=='0'?'策略':'policy'
|
|
|
+ this.policyName = 'policy'
|
|
|
this.batchProcessing = type;
|
|
|
- this.getData(this.currentPage);
|
|
|
+ this.getLightList(this.currentPage);
|
|
|
this.loading.batchProcessingFun = false;
|
|
|
},
|
|
|
this)
|
|
@@ -2632,7 +2607,7 @@
|
|
|
if(this.multipleSelection.length == 0){
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
- message:this.version==0?'请先选中灯控':'Please select the light control first',
|
|
|
+ message:'Please select the light control first',
|
|
|
type: 'warning'
|
|
|
});
|
|
|
}else{
|
|
@@ -2652,11 +2627,11 @@
|
|
|
ids+=','+d.id;
|
|
|
}
|
|
|
}
|
|
|
- baseApi.websocket1(allUrl.home.wss,(data,websocket)=>{
|
|
|
+ baseApi.websocket1(allUrl.websocket.wss,(data,websocket)=>{
|
|
|
this_.loading.batchProcessingFun = true;
|
|
|
if(data.data.status == '1'){
|
|
|
baseApi.ajax_post_ws(
|
|
|
- allUrl.device.lampcontrolTurnonoff,
|
|
|
+ allUrl.project.lampcontrolTurnonoff,
|
|
|
{
|
|
|
username:this_.username,
|
|
|
client_key:this_.client_key,
|
|
@@ -2668,17 +2643,17 @@
|
|
|
},
|
|
|
this_
|
|
|
)
|
|
|
- }else if(data.data.status == '2'){
|
|
|
- if(data.data.code == '0000'){
|
|
|
+ }else if(data.status == '2'){
|
|
|
+ if(data.code == '0000'){
|
|
|
this_.$notify({
|
|
|
- title: this_.version==0?'操作成功':'Successful operation',
|
|
|
- message: this_.version==0?'路灯 '+data.data.data.number:'lamp '+data.data.data.number,
|
|
|
+ title: 'Successful operation',
|
|
|
+ message: 'lamp '+data.data.number,
|
|
|
type: 'success'
|
|
|
});
|
|
|
this_.giveCommandJournal.push({
|
|
|
time:this_.GMTToZero2(new Date()),
|
|
|
- text:data.data.msg,
|
|
|
- number:data.data.data.number,
|
|
|
+ text:data.msg,
|
|
|
+ number:data.data.number,
|
|
|
type:true
|
|
|
})
|
|
|
i++;
|
|
@@ -2687,26 +2662,18 @@
|
|
|
if(i >= ids_length){
|
|
|
this_.loading.batchProcessingFun = false;
|
|
|
this_.batchProcessing = type;
|
|
|
- this_.getData(this_.currentPage);
|
|
|
+ this_.getLightList(this_.currentPage);
|
|
|
websocket.close();
|
|
|
}
|
|
|
}else{
|
|
|
- console.log(2,'--------')
|
|
|
- if(this_.version == 0){
|
|
|
- this_.$notify.error({
|
|
|
- title: '操作失败',
|
|
|
- message: this_.version==0?'路灯 '+data.data.data.number+':'+data.data.msg:'lamp '+data.data.data.number+':'+data.data.msg
|
|
|
- });
|
|
|
- }else{
|
|
|
- this_.$notify.error({
|
|
|
- title: 'operation failed',
|
|
|
- message: 'Lamp'+data.data.data.number+':'+data.data.msg
|
|
|
- });
|
|
|
- }
|
|
|
+ this_.$notify.error({
|
|
|
+ title: 'operation failed',
|
|
|
+ message: 'Lamp'+data.data.number+':'+data.msg
|
|
|
+ });
|
|
|
this_.giveCommandJournal.push({
|
|
|
time:this_.GMTToZero2(new Date()),
|
|
|
- text:data.data.msg,
|
|
|
- number:data.data.data.number,
|
|
|
+ text:data.msg,
|
|
|
+ number:data.data.number,
|
|
|
type:false
|
|
|
})
|
|
|
i++;
|
|
@@ -2715,7 +2682,7 @@
|
|
|
if(i >= ids_length){
|
|
|
this_.loading.batchProcessingFun = false;
|
|
|
this_.batchProcessing = type;
|
|
|
- this_.getData(this_.currentPage);
|
|
|
+ this_.getLightList(this_.currentPage);
|
|
|
websocket.close();
|
|
|
}
|
|
|
}
|
|
@@ -2727,6 +2694,18 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ GMTToZero2(time){
|
|
|
+ let now = new Date(time);
|
|
|
+ let hour = now.getHours();//得到小时
|
|
|
+ let minu = now.getMinutes();//得到分钟
|
|
|
+ let sec = now.getSeconds();//得到秒
|
|
|
+ if (hour < 10) hour = "0" + hour;
|
|
|
+ if (minu < 10) minu = "0" + minu;
|
|
|
+ if (sec < 10) sec = "0" + sec;
|
|
|
+ let times = "";
|
|
|
+ times = hour + ":" + minu + ":" + sec;
|
|
|
+ return times
|
|
|
+ },
|
|
|
/*获取表格字段*/
|
|
|
getFields(){
|
|
|
baseApi.ajax_post(
|
|
@@ -5240,7 +5219,7 @@
|
|
|
.el-slider{
|
|
|
position: relative;
|
|
|
top: 0;
|
|
|
- width: 8rem;
|
|
|
+ width: 5rem;
|
|
|
.el-slider__runway{
|
|
|
margin: 0.7rem 0 0.7rem 1rem;
|
|
|
height: 0.6rem;
|
|
@@ -5292,6 +5271,15 @@
|
|
|
color: #666666;
|
|
|
}
|
|
|
}
|
|
|
+ .el-loading-spinner{
|
|
|
+ height: 100%;
|
|
|
+ top: 0;
|
|
|
+ margin-top: 0;
|
|
|
+ .circular{
|
|
|
+ height: 100%;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.table_top_r{
|