|
|
@@ -59,11 +59,21 @@
|
|
|
<view class="consoleBox">
|
|
|
<view class="swichBox">
|
|
|
<u-row :gutter="16" justify="space-between">
|
|
|
- <u-col span="6" v-for="item in facilityvalve">
|
|
|
+ <u-col span="6" v-for="(item, index) in buttonList" v-if="(index + 1) % 2 == 1">
|
|
|
+ <view class="preSwich">
|
|
|
+ <view>肥料{{ (index + 1) / 2 > 1 ? (index + 2) / 2 : 1 }}</view>
|
|
|
+ <u-switch v-model="item.off" active-color="#14A478" inactive-color="#AEB4C2"
|
|
|
+ :loading="item.disabled"
|
|
|
+ @change="switchchange($event, item.number, item, index, true)"></u-switch>
|
|
|
+ </view>
|
|
|
+ </u-col>
|
|
|
+ <u-col span="6" v-for="(item, index) in facilityvalve"
|
|
|
+ v-if="index > buttonList.length - 1">
|
|
|
<view class="preSwich">
|
|
|
<view>{{item.name}}</view>
|
|
|
- <u-switch v-model="item.off" active-color="#14A478"
|
|
|
- inactive-color="#AEB4C2"></u-switch>
|
|
|
+ <u-switch v-model="item.off" active-color="#14A478" inactive-color="#AEB4C2"
|
|
|
+ :loading="item.disabled"
|
|
|
+ @change="switchchange($event, item.number, item, index)"></u-switch>
|
|
|
</view>
|
|
|
</u-col>
|
|
|
</u-row>
|
|
|
@@ -92,7 +102,8 @@
|
|
|
<view class="fengBox">
|
|
|
<view class="relativeBox">
|
|
|
<image src="../../static/images/waterandfernew/fengmain.png"></image>
|
|
|
- <image src="../../static/images/waterandfernew/fengleafs.png"></image>
|
|
|
+ <image :class="feiBeng ? 'circleAnm' : ''"
|
|
|
+ src="../../static/images/waterandfernew/fengleafs.png"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 水管控制阀 -->
|
|
|
@@ -138,7 +149,7 @@
|
|
|
<view>操作内容</view>
|
|
|
<view>操作时间</view>
|
|
|
</view>
|
|
|
- <view class="tableList" v-for="item in tableData" :key="item.uptime">
|
|
|
+ <view class="tableList" v-for="(item, index) in tableData" :key="item.uptime + index">
|
|
|
<view>{{item.device_name}}</view>
|
|
|
<view>{{item.operation_content}}</view>
|
|
|
<view>{{item.uptime}}</view>
|
|
|
@@ -282,6 +293,9 @@
|
|
|
},
|
|
|
// 历史数据
|
|
|
async getHistoryData() {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ });
|
|
|
const {
|
|
|
historyTime
|
|
|
} = this;
|
|
|
@@ -296,7 +310,7 @@
|
|
|
end: end,
|
|
|
},
|
|
|
})
|
|
|
- console.log(res);
|
|
|
+ uni.hideLoading();
|
|
|
var conf = res.conf.eleName;
|
|
|
var dat = res.dat;
|
|
|
//console.log(dat);
|
|
|
@@ -378,12 +392,16 @@
|
|
|
},
|
|
|
// 获取要素实时数据
|
|
|
async getElmentInfo() {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ });
|
|
|
let res = await this.$myRequest({
|
|
|
url: "/api/api_gateway?method=xphsp.views.device_elements",
|
|
|
data: {
|
|
|
device_id: this.device_id,
|
|
|
},
|
|
|
})
|
|
|
+ uni.hideLoading();
|
|
|
var conf = res.conf.eleName.split('/');
|
|
|
var dataList = [res.data.device_data];
|
|
|
if (dataList.length == 0) return
|
|
|
@@ -401,6 +419,9 @@
|
|
|
// console.log(this.ElementList)
|
|
|
},
|
|
|
async getEquipstatus() {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ });
|
|
|
this.facilityvalve = [];
|
|
|
let res = await this.$myRequest({
|
|
|
url: "/api/api_gateway?method=xphsp.views.device_info",
|
|
|
@@ -408,7 +429,7 @@
|
|
|
device_id: this.device_id,
|
|
|
},
|
|
|
})
|
|
|
- console.log(res)
|
|
|
+ uni.hideLoading();
|
|
|
var conf = res.conf.relayName;
|
|
|
var dataobj = res.device_status;
|
|
|
var relayNum = res.conf.relayNum;
|
|
|
@@ -500,27 +521,32 @@
|
|
|
this.feiNum = feiNum;
|
|
|
console.log(this.facilityvalve)
|
|
|
},
|
|
|
- async getEquipcontrol(num, state) {
|
|
|
+ async getEquipcontrol(num, state,double_order) {
|
|
|
//设备控制
|
|
|
+ uni.showLoading({
|
|
|
+ title: '正在下发指令'
|
|
|
+ });
|
|
|
let res = await this.$myRequest({
|
|
|
url: "/api/api_gateway?method=xphsp.views.control_order",
|
|
|
data: {
|
|
|
device_id: this.device_id,
|
|
|
relayNum: num,
|
|
|
relayState: state,
|
|
|
+ double_order
|
|
|
},
|
|
|
})
|
|
|
- if(res.controlState) {
|
|
|
- uni.showToast({
|
|
|
- title: '指令下发成功',
|
|
|
- duration: 2000,
|
|
|
- icon:'none'
|
|
|
- });
|
|
|
+ uni.hideLoading();
|
|
|
+ if (res.controlState) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '指令下发成功',
|
|
|
+ duration: 2000,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
- title:res.message,
|
|
|
+ title: res.message,
|
|
|
duration: 2000,
|
|
|
- icon:'none'
|
|
|
+ icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
@@ -540,6 +566,9 @@
|
|
|
},
|
|
|
//操作记录
|
|
|
async getEquipcontroldata() {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ });
|
|
|
const {
|
|
|
consoleTime
|
|
|
} = this;
|
|
|
@@ -558,6 +587,7 @@
|
|
|
sys_control: this.current - 1
|
|
|
},
|
|
|
})
|
|
|
+ uni.hideLoading();
|
|
|
// this.tableData = [];
|
|
|
var record = res.result;
|
|
|
this.tableData = [...this.tableData, ...record];
|
|
|
@@ -572,16 +602,17 @@
|
|
|
switchchange(e, state, item, index, isfeiButton) {
|
|
|
// 是否是肥料开关,是的话 两个合并为一个
|
|
|
if (isfeiButton) {
|
|
|
+ item.off = e;
|
|
|
item.disabled = true;
|
|
|
this.changeTimeStatus(item, index);
|
|
|
// 当前是打开
|
|
|
if (e) {
|
|
|
// 打开通道传1,关闭通道传0
|
|
|
- this.getEquipcontrol(state, 1);
|
|
|
- this.getEquipcontrol(state + 1, 0);
|
|
|
+ this.getEquipcontrol(state, 1, 1);
|
|
|
+ // this.getEquipcontrol(state + 1, 0);
|
|
|
} else {
|
|
|
- this.getEquipcontrol(state + 1, 0);
|
|
|
- this.getEquipcontrol(state, 1);
|
|
|
+ // this.getEquipcontrol(state + 1, 0);
|
|
|
+ this.getEquipcontrol(state, 0, 1);
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
@@ -940,6 +971,21 @@
|
|
|
height: 44rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .circleAnm {
|
|
|
+ animation: ancirle 2s linear infinite;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 旋转
|
|
|
+ @keyframes ancirle {
|
|
|
+ 0% {
|
|
|
+ transform: rotate(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ 100% {
|
|
|
+ transform: rotate(360deg);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|