|
@@ -102,7 +102,7 @@
|
|
<image class="img" src="../../static/img/green.png"></image>
|
|
<image class="img" src="../../static/img/green.png"></image>
|
|
<font class="wenziT">{{$t('equipmentStatusList.green')}}</font>
|
|
<font class="wenziT">{{$t('equipmentStatusList.green')}}</font>
|
|
</view>
|
|
</view>
|
|
- <view class="titlelist" style="position: relative;" v-for="equipment in equipmentList"
|
|
|
|
|
|
+ <view class="titlelist" style="position: relative;" v-for="(equipment, index) in equipmentList"
|
|
:key="equipment.id">
|
|
:key="equipment.id">
|
|
<span class="status-css" :class="equipment.hasTodayAlarm===true?statusError : statusNormal"></span>
|
|
<span class="status-css" :class="equipment.hasTodayAlarm===true?statusError : statusNormal"></span>
|
|
<uni-collapse-item :title="getEquipmentTitle(equipment)">
|
|
<uni-collapse-item :title="getEquipmentTitle(equipment)">
|
|
@@ -111,14 +111,14 @@
|
|
<view class="swithBox" v-if="equipment.isSleep">
|
|
<view class="swithBox" v-if="equipment.isSleep">
|
|
<view class="swichFont">{{$t('equipmentStatusList.sleep')}}</view>
|
|
<view class="swichFont">{{$t('equipmentStatusList.sleep')}}</view>
|
|
<view class="switch">
|
|
<view class="switch">
|
|
- <switch style="transform:scale(0.65)" checked @change="change(equipment.id,0)" />
|
|
|
|
|
|
+ <switch style="transform:scale(0.65)" checked @change="change(equipment.id,0,index)" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="swithBox" v-else>
|
|
<view class="swithBox" v-else>
|
|
<view class="swichFont">{{$t('equipmentStatusList.unsleep')}}</view>
|
|
<view class="swichFont">{{$t('equipmentStatusList.unsleep')}}</view>
|
|
<view class="switch">
|
|
<view class="switch">
|
|
<switch style="transform:scale(0.65)" :checked="sleepChecked"
|
|
<switch style="transform:scale(0.65)" :checked="sleepChecked"
|
|
- @change="change(equipment.id,1)" />
|
|
|
|
|
|
+ @change="change(equipment.id,1,index)" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="line1"></view>
|
|
<view class="line1"></view>
|
|
@@ -308,6 +308,10 @@
|
|
</view>
|
|
</view>
|
|
</uni-collapse-item>
|
|
</uni-collapse-item>
|
|
</view>
|
|
</view>
|
|
|
|
+ <view v-show="btnShow" class="button-container">
|
|
|
|
+ <button v-show="globalUser.offset != 0" class="left-button" :disabled="isLoading" @click="previousPage">{{$t('equipmentStatusList.previousPage')}}</button>
|
|
|
|
+ <button v-show="this.globalUser.offset + this.globalUser.limit < this.equipmentTotal" class="right-button" :disabled="isLoading" @click="nextPage">{{$t('equipmentStatusList.nextPage')}}</button>
|
|
|
|
+ </view>
|
|
</uni-collapse>
|
|
</uni-collapse>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
@@ -358,28 +362,21 @@
|
|
editBtn:true,
|
|
editBtn:true,
|
|
sleepDesc:null,
|
|
sleepDesc:null,
|
|
descShow:false,
|
|
descShow:false,
|
|
- onReach:true,
|
|
|
|
|
|
+ btnShow:false, // 按钮显示
|
|
|
|
+ equipmentTotal:0, // 设备总数
|
|
|
|
+ isLoading: false, //是否加载中
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState(['loginUser']),
|
|
...mapState(['loginUser']),
|
|
},
|
|
},
|
|
onPullDownRefresh() {
|
|
onPullDownRefresh() {
|
|
- this.equipmentList = [];
|
|
|
|
- this.globalUser.offset = 1;
|
|
|
|
- this.globalUser.limit = 20;
|
|
|
|
this.getEquipmentListData();
|
|
this.getEquipmentListData();
|
|
},
|
|
},
|
|
- onReachBottom() {
|
|
|
|
- if(this.onReach) {
|
|
|
|
- this.globalUser.offset = this.globalUser.offset + this.globalUser.limit;
|
|
|
|
- this.getEquipmentListData();
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
onShow() {
|
|
onShow() {
|
|
this.input = this.input + 1;
|
|
this.input = this.input + 1;
|
|
this.globalUser = uni.getStorageSync("globalUser");
|
|
this.globalUser = uni.getStorageSync("globalUser");
|
|
- this.globalUser.offset = 1;
|
|
|
|
|
|
+ this.globalUser.offset = 0;
|
|
this.globalUser.limit = 20;
|
|
this.globalUser.limit = 20;
|
|
uni.setNavigationBarTitle({
|
|
uni.setNavigationBarTitle({
|
|
title: this.$t('equipmentStatusList.title')
|
|
title: this.$t('equipmentStatusList.title')
|
|
@@ -390,9 +387,7 @@
|
|
});
|
|
});
|
|
var token = uni.getStorageSync("token");
|
|
var token = uni.getStorageSync("token");
|
|
if (token.length > 1) {
|
|
if (token.length > 1) {
|
|
- if(this.equipmentList.length === 0) {
|
|
|
|
- this.getEquipmentListData();
|
|
|
|
- }
|
|
|
|
|
|
+ this.getEquipmentListData();
|
|
} else {
|
|
} else {
|
|
uni.reLaunch({
|
|
uni.reLaunch({
|
|
url: '../Login/Login',
|
|
url: '../Login/Login',
|
|
@@ -409,14 +404,18 @@
|
|
return equipment.name ? equipment.name : '暂无名称';
|
|
return equipment.name ? equipment.name : '暂无名称';
|
|
},
|
|
},
|
|
getEquipmentListData() {
|
|
getEquipmentListData() {
|
|
|
|
+ this.isLoading = true;
|
|
this.getEquipmentListByUser(this.globalUser)
|
|
this.getEquipmentListByUser(this.globalUser)
|
|
.then(data => {
|
|
.then(data => {
|
|
this.merchantList = data;
|
|
this.merchantList = data;
|
|
- if(data[0].equipmentList.length === 0) {
|
|
|
|
- this.onReach = false;
|
|
|
|
|
|
+ // this.equipmentList.push(...data[0].equipmentList);
|
|
|
|
+ this.equipmentList = data[0].equipmentList;
|
|
|
|
+ this.equipmentTotal = this.merchantList[0].equipmentTotal;
|
|
|
|
+ if(this.equipmentTotal > this.globalUser.limit) {
|
|
|
|
+ this.btnShow = true;
|
|
}
|
|
}
|
|
- this.equipmentList.push(...data[0].equipmentList);
|
|
|
|
console.log(this.equipmentList);
|
|
console.log(this.equipmentList);
|
|
|
|
+ this.isLoading = false;
|
|
var listName = data[0].equipmentList;
|
|
var listName = data[0].equipmentList;
|
|
var times = new Map;
|
|
var times = new Map;
|
|
if (this.input == 1) {
|
|
if (this.input == 1) {
|
|
@@ -433,6 +432,16 @@
|
|
uni.stopPullDownRefresh();
|
|
uni.stopPullDownRefresh();
|
|
}, _ => void uni.stopPullDownRefresh());
|
|
}, _ => void uni.stopPullDownRefresh());
|
|
},
|
|
},
|
|
|
|
+ // 点击上一页
|
|
|
|
+ previousPage() {
|
|
|
|
+ this.globalUser.offset = this.globalUser.offset - this.globalUser.limit;
|
|
|
|
+ this.getEquipmentListData();
|
|
|
|
+ },
|
|
|
|
+ // 点击下一页
|
|
|
|
+ nextPage() {
|
|
|
|
+ this.globalUser.offset = this.globalUser.offset + this.globalUser.limit;
|
|
|
|
+ this.getEquipmentListData();
|
|
|
|
+ },
|
|
|
|
|
|
getValue: function(event) {
|
|
getValue: function(event) {
|
|
// 绕过v-model 获取input输入框的值
|
|
// 绕过v-model 获取input输入框的值
|
|
@@ -584,8 +593,8 @@
|
|
if (that.timeAll.get(id) != null) {
|
|
if (that.timeAll.get(id) != null) {
|
|
var stamp = Date.parse(new Date());
|
|
var stamp = Date.parse(new Date());
|
|
var t = (stamp - that.timeAll.get(id)) / 1000;
|
|
var t = (stamp - that.timeAll.get(id)) / 1000;
|
|
- if (t < 30) {
|
|
|
|
- var s = 30 - t;
|
|
|
|
|
|
+ if (t < 15) {
|
|
|
|
+ var s = 15 - t;
|
|
uni.showModal({
|
|
uni.showModal({
|
|
title: that.$t('equipmentStatusList.onoff'),
|
|
title: that.$t('equipmentStatusList.onoff'),
|
|
content: that.$t('equipmentStatusList.remainingtime') + s + "s",
|
|
content: that.$t('equipmentStatusList.remainingtime') + s + "s",
|
|
@@ -654,7 +663,7 @@
|
|
});
|
|
});
|
|
} else if (res.cancel) {
|
|
} else if (res.cancel) {
|
|
that.onffChecked = false;
|
|
that.onffChecked = false;
|
|
- that.getEquipmentListData();
|
|
|
|
|
|
+ // that.getEquipmentListData();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -696,7 +705,7 @@
|
|
title: that.$t('equipmentStatusList.error'),
|
|
title: that.$t('equipmentStatusList.error'),
|
|
content: that.$t('equipmentStatusList.kaijierror'),
|
|
content: that.$t('equipmentStatusList.kaijierror'),
|
|
success: function(res) {
|
|
success: function(res) {
|
|
- that.onffChecked = false;
|
|
|
|
|
|
+ that.equipmentList = [];
|
|
that.getEquipmentListData();
|
|
that.getEquipmentListData();
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -855,9 +864,12 @@
|
|
})
|
|
})
|
|
|
|
|
|
},
|
|
},
|
|
- change(id, code) {
|
|
|
|
|
|
+ change(id, code, index) {
|
|
var that = this;
|
|
var that = this;
|
|
|
|
+ that.sleepChecked = true;
|
|
var code1 = code;
|
|
var code1 = code;
|
|
|
|
+ console.log(index);
|
|
|
|
+ console.log(code);
|
|
if (code1 == 1) {
|
|
if (code1 == 1) {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
title: that.$t('equipmentStatusList.tip'),
|
|
title: that.$t('equipmentStatusList.tip'),
|
|
@@ -880,10 +892,12 @@
|
|
},
|
|
},
|
|
success: (res) => {
|
|
success: (res) => {
|
|
var list = res.data.data;
|
|
var list = res.data.data;
|
|
|
|
+ that.equipmentList[index].isSleep = true;
|
|
that.getEquipmentListData();
|
|
that.getEquipmentListData();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
} else if (res.cancel) {
|
|
} else if (res.cancel) {
|
|
|
|
+ that.equipmentList[index].isSleep = false;
|
|
that.sleepChecked = false;
|
|
that.sleepChecked = false;
|
|
that.getEquipmentListData();
|
|
that.getEquipmentListData();
|
|
}
|
|
}
|
|
@@ -908,6 +922,7 @@
|
|
},
|
|
},
|
|
success: (res) => {
|
|
success: (res) => {
|
|
var list = res.data.data;
|
|
var list = res.data.data;
|
|
|
|
+ that.equipmentList[index].isSleep = false;
|
|
that.getEquipmentListData();
|
|
that.getEquipmentListData();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -1082,4 +1097,12 @@
|
|
height: 3upx;
|
|
height: 3upx;
|
|
background: #000000;
|
|
background: #000000;
|
|
}
|
|
}
|
|
|
|
+ .button-container {
|
|
|
|
+ display: flex;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .left-button,
|
|
|
|
+ .right-button {
|
|
|
|
+ flex: 1;
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|