|
@@ -91,6 +91,12 @@
|
|
|
|
|
|
</u-popup>
|
|
|
</view>
|
|
|
+ <view class="pagination">
|
|
|
+ <uni-pagination :total="page.total" :pageSize="page.pageSize" :current="page.current" @change="pageTatble"
|
|
|
+ style="width: 750rpx;
|
|
|
+ height: 150rpx;">
|
|
|
+ </uni-pagination>
|
|
|
+ </view>
|
|
|
<u-toast ref="uToast"></u-toast>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -107,9 +113,9 @@
|
|
|
return {
|
|
|
page: {
|
|
|
total: 80, //数据总量
|
|
|
- pageSize: 15, //每页的数据量
|
|
|
+ pageSize: 10, //每页的数据量
|
|
|
current: 1, //当前页数
|
|
|
- thrifty: false ,//节流阀
|
|
|
+ thrifty: false, //节流阀
|
|
|
},
|
|
|
openShow: false,
|
|
|
shutShow: false,
|
|
@@ -223,7 +229,7 @@
|
|
|
divide: {
|
|
|
publicId: 0,
|
|
|
publicName: '',
|
|
|
- groupIndex:0,//当前的分组下标
|
|
|
+ groupIndex: 0, //当前的分组下标
|
|
|
},
|
|
|
//设备信息
|
|
|
device: {
|
|
@@ -265,29 +271,15 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ setInterval(this.renovate,15000)
|
|
|
},
|
|
|
- //上拉加载
|
|
|
- twoload() {
|
|
|
- var that = this
|
|
|
- const current = that.page.current
|
|
|
- const pageSize = that.page.pageSize
|
|
|
- const groupId = that.divide.publicId
|
|
|
- that.page.thrifty = true
|
|
|
- list(groupId, current, pageSize).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- let records = res.data.records
|
|
|
- let children = records[0].children
|
|
|
- uni.showToast({
|
|
|
- title:'数据加载中',
|
|
|
- duration:1000,
|
|
|
- icon:'loading'
|
|
|
- })
|
|
|
- setTimeout(function(){
|
|
|
- that.tworacords = [...that.tworacords, ...children]
|
|
|
- },1000)
|
|
|
- }
|
|
|
+ //过度动画
|
|
|
+ cartoon(title, duration) {
|
|
|
+ uni.showToast({
|
|
|
+ title: title,
|
|
|
+ icon: 'loading',
|
|
|
+ duration: duration
|
|
|
})
|
|
|
- that.page.thrifty = false
|
|
|
},
|
|
|
//切换分组
|
|
|
selectItem(index) {
|
|
@@ -313,7 +305,7 @@
|
|
|
}
|
|
|
this.openShow = true
|
|
|
},
|
|
|
- shut(ever, publicId, publicName,index2) {
|
|
|
+ shut(ever, publicId, publicName, index2) {
|
|
|
this.distinguish.shutsh = ever
|
|
|
if (ever == 1) {
|
|
|
this.device.publicId = publicId
|
|
@@ -350,17 +342,7 @@
|
|
|
fontSize: 15,
|
|
|
})
|
|
|
},
|
|
|
- //延时请求(全开)
|
|
|
- delayedOpen(publicId,records){
|
|
|
- var that = this
|
|
|
- var index = that.divide.groupIndex
|
|
|
- list(publicId,1,15).then(res => {
|
|
|
- if(res.code == 200){
|
|
|
- that.page.current = 1
|
|
|
- let children = records[index].children
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ //开启
|
|
|
openControl(handSwitch, handType) {
|
|
|
var that = this
|
|
|
const openTime = that.openTime
|
|
@@ -368,7 +350,7 @@
|
|
|
const openRemarks = that.openRemarks
|
|
|
var opensh = that.distinguish.opensh
|
|
|
var tworacords = that.tworacords
|
|
|
- var index2 = that.device.index2
|
|
|
+ var tworacords = []
|
|
|
if (openTime == '') {
|
|
|
that.exError()
|
|
|
} else {
|
|
@@ -390,20 +372,7 @@
|
|
|
//publicName(分组/设备名称)
|
|
|
Control(handSwitch, handType, publicId, openTime, duration, openRemarks, publicName).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- if(opensh == 1){
|
|
|
- tworacords[index2].lightControlState = "1"
|
|
|
- that.tworacords = tworacords
|
|
|
- that.Success('开灯成功')
|
|
|
- }else{
|
|
|
- uni.showToast({
|
|
|
- title:'发送指令中',
|
|
|
- duration:10000,
|
|
|
- icon:'loading',
|
|
|
- })
|
|
|
- setTimeout(function(){
|
|
|
- that.load()
|
|
|
- },10000)
|
|
|
- }
|
|
|
+ that.Success('开灯成功')
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -411,41 +380,30 @@
|
|
|
shutModify(index, item) {
|
|
|
this.shutTime = index >= 0 ? item.value : ''
|
|
|
},
|
|
|
+ //关闭
|
|
|
shutControl(handSwitch, handType) {
|
|
|
var that = this
|
|
|
const shutTime = that.shutTime
|
|
|
const shutRemarks = that.shutRemarks
|
|
|
var tworacords = that.tworacords
|
|
|
var index2 = that.device.index2
|
|
|
- var opensh = that.distinguish.opensh
|
|
|
+ var shutsh = that.distinguish.shutsh
|
|
|
if (shutTime == '') {
|
|
|
that.exError()
|
|
|
} else {
|
|
|
var publicId = 0
|
|
|
var publicName = ''
|
|
|
- if (opensh == 1) {
|
|
|
+ if (shutsh == 1) {
|
|
|
publicId = that.device.publicId
|
|
|
publicName = that.device.publicName
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
publicId = that.divide.publicId
|
|
|
publicName = that.divide.publicName
|
|
|
}
|
|
|
Control(handSwitch, handType, publicId, shutTime, 0, shutRemarks, publicName).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- if(opensh == 1){
|
|
|
- tworacords[index2].lightControlState = '2'
|
|
|
- that.tworacords = tworacords
|
|
|
- }else{
|
|
|
- uni.showToast({
|
|
|
- title:'发送指令中',
|
|
|
- duration:10000,
|
|
|
- icon:'loading',
|
|
|
- })
|
|
|
- setTimeout(function(){
|
|
|
- that.delayedOpen(publicId,that.records,)
|
|
|
- },10000)
|
|
|
- }
|
|
|
+ that.Success('关灯成功')
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -464,39 +422,37 @@
|
|
|
url: '/pages/Tactics/Tactics?publicName=' + publicName + '&publicId=' + publicId +
|
|
|
'&relationType=' + relationType + '&lightName=' + lightName
|
|
|
})
|
|
|
- // let poraryObj = {
|
|
|
- // publicName:publicName,
|
|
|
- // publicId:publicId,
|
|
|
- // relationType:relationType,
|
|
|
- // lightName:lightName,
|
|
|
- // index:index2,
|
|
|
- // pageSize:this.page.pageSize,
|
|
|
- // current:this.page.current
|
|
|
- // }
|
|
|
- // uni.navigateTo({
|
|
|
- // url:'/pages/Tactics/Tactics?data=' + ${encodeURIComponent(JSON.stringify(temporaryObj))}
|
|
|
- // })
|
|
|
},
|
|
|
lightDate() {
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/Lighting_data/Lighting_data'
|
|
|
})
|
|
|
- }
|
|
|
- },
|
|
|
- //触底事件(如果节流阀打开则不执行加载)
|
|
|
- onReachBottom() {
|
|
|
- if (this.page.current * this.page.pageSize >= this.page.total) {
|
|
|
- this.$refs.uToast.show({
|
|
|
- type: 'default',
|
|
|
- message: '数据加载完毕',
|
|
|
- duration: 2000
|
|
|
+ },
|
|
|
+ //分页器页数改变
|
|
|
+ pageTatble(e) {
|
|
|
+ var that = this
|
|
|
+ var publicId = that.divide.publicId
|
|
|
+ var pageSize = that.page.pageSize
|
|
|
+ that.page.current = e.current
|
|
|
+ list(publicId, e.current, pageSize).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ that.tworacords = res.data.records[0].children
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //定时刷新
|
|
|
+ renovate(){
|
|
|
+ var that = this
|
|
|
+ var publicId = that.divide.publicId
|
|
|
+ var current = that.page.current
|
|
|
+ var pageSize = that.page.pageSize
|
|
|
+ list(publicId,current,pageSize).then(res => {
|
|
|
+ if(res.code == 200){
|
|
|
+ that.tworacords = res.data.records[0].children
|
|
|
+ }
|
|
|
})
|
|
|
- return
|
|
|
}
|
|
|
- if (this.page.thrifty == true) return
|
|
|
- this.page.current = this.page.current + 1
|
|
|
- this.twoload()
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -676,4 +632,10 @@
|
|
|
font-size: 36rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .pagination {
|
|
|
+ width: 750rpx;
|
|
|
+ height: 80rpx;
|
|
|
+ margin-top: 40rpx;
|
|
|
+ }
|
|
|
</style>
|