|
@@ -92,26 +92,25 @@
|
|
|
</view> -->
|
|
</view> -->
|
|
|
<!-- 桶 -->
|
|
<!-- 桶 -->
|
|
|
<view class="colList">
|
|
<view class="colList">
|
|
|
- <view class="preClo" v-for="item, index in buttonList" v-if="(index + 1) % 2 == 1"
|
|
|
|
|
- :key="`fei${index}`">
|
|
|
|
|
|
|
+ <view class="preClo" v-for="item, index in pickBtnList" :key="`fei${index}`">
|
|
|
<view>
|
|
<view>
|
|
|
- 肥料{{ (index + 1) / 2 > 1 ? (index + 2) / 2 : 1 }}
|
|
|
|
|
|
|
+ 肥料{{ index + 1}}
|
|
|
</view>
|
|
</view>
|
|
|
- <image src="../../static/images/waterandfernew/colNew.png" v-if="buttonList.length == 2">
|
|
|
|
|
|
|
+ <image src="../../static/images/waterandfernew/colNew.png" v-if="pickBtnList.length == 1">
|
|
|
</image>
|
|
</image>
|
|
|
<image src="../../static/images/waterandfernew/colLeft.png"
|
|
<image src="../../static/images/waterandfernew/colLeft.png"
|
|
|
- v-else-if="buttonList.length > 2 && index == 0"></image>
|
|
|
|
|
|
|
+ v-else-if="pickBtnList.length > 1 && index == 0"></image>
|
|
|
<image src="../../static/images/waterandfernew/colRight.png"
|
|
<image src="../../static/images/waterandfernew/colRight.png"
|
|
|
- v-else-if="buttonList.length > 2 && index == buttonList.length - 2"></image>
|
|
|
|
|
|
|
+ v-else-if="pickBtnList.length > 1 && index == 1"></image>
|
|
|
<image src="../../static/images/waterandfernew/colCenter.png" v-else></image>
|
|
<image src="../../static/images/waterandfernew/colCenter.png" v-else></image>
|
|
|
- <view class="jiaoBtn" v-if="facilityvalve.length > 0">
|
|
|
|
|
- <u-switch v-model="facilityvalve[`${index == 0 ? 10 : index == 2 ? 9 : 8}`]['off']"
|
|
|
|
|
|
|
+ <view class="jiaoBtn" v-if="resultBan.length > 0">
|
|
|
|
|
+ <u-switch v-model="item['off']"
|
|
|
active-color="#14A478" inactive-color="#AEB4C2"
|
|
active-color="#14A478" inactive-color="#AEB4C2"
|
|
|
- :loading="facilityvalve[`${index == 0 ? 10 : index == 2 ? 9 : 8}`]['disabled']"
|
|
|
|
|
- @change="switchchange($event, facilityvalve[`${index == 0 ? 10 : index == 2 ? 9 : 8}`]['number'], facilityvalve[`${index == 0 ? 10 : index == 2 ? 9 : 8}`], index == 0 ? 10 : index == 2 ? 9 : 8)"></u-switch>
|
|
|
|
|
|
|
+ :loading="resultBan[index]['disabled']"
|
|
|
|
|
+ @change="switchchange($event, resultBan[index]['number'], resultBan[index], index)"></u-switch>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="shanBox" v-if="facilityvalve.length > 0">
|
|
|
|
|
- <image v-if="!facilityvalve[`${index == 0 ? 10 : index == 2 ? 9 : 8}`]['off']"
|
|
|
|
|
|
|
+ <view class="shanBox" v-if="resultBan.length > 0">
|
|
|
|
|
+ <image v-if="!resultBan[index]['off']"
|
|
|
src="../../static/images/waterandfernew/shan.png"></image>
|
|
src="../../static/images/waterandfernew/shan.png"></image>
|
|
|
<image v-else class="circleAnm"
|
|
<image v-else class="circleAnm"
|
|
|
src="../../static/images/waterandfernew/shanannimate.png"></image>
|
|
src="../../static/images/waterandfernew/shanannimate.png"></image>
|
|
@@ -128,7 +127,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
<!-- 注肥泵 -->
|
|
<!-- 注肥泵 -->
|
|
|
<view class="feiLight"
|
|
<view class="feiLight"
|
|
|
- @click="switchchange(!feiBeng, facilityvalve[6].number, facilityvalve[6], 6)">
|
|
|
|
|
|
|
+ @click="switchchange(!feiBeng, facilityvalve[feiBengIndex].number, facilityvalve[feiBengIndex], feiBengIndex)">
|
|
|
<image v-if="feiBeng" src="../../static/images/waterandfernew/feiAllopen.png"></image>
|
|
<image v-if="feiBeng" src="../../static/images/waterandfernew/feiAllopen.png"></image>
|
|
|
<image v-else src="../../static/images/waterandfernew/feiAllclose.png"></image>
|
|
<image v-else src="../../static/images/waterandfernew/feiAllclose.png"></image>
|
|
|
</view>
|
|
</view>
|
|
@@ -139,7 +138,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
<!-- 进水泵 -->
|
|
<!-- 进水泵 -->
|
|
|
<view class="warterIn"
|
|
<view class="warterIn"
|
|
|
- @click="switchchange(!mainBeng, facilityvalve[7].number, facilityvalve[7], 7)">
|
|
|
|
|
|
|
+ @click="switchchange(!mainBeng, facilityvalve[mainBengIndex].number, facilityvalve[mainBengIndex], mainBengIndex)">
|
|
|
<image v-if="mainBeng" src="../../static/images/waterandfernew/feiopen.png"></image>
|
|
<image v-if="mainBeng" src="../../static/images/waterandfernew/feiopen.png"></image>
|
|
|
<image v-else src="../../static/images/waterandfernew/feiclose.png"></image>
|
|
<image v-else src="../../static/images/waterandfernew/feiclose.png"></image>
|
|
|
</view>
|
|
</view>
|
|
@@ -169,10 +168,10 @@
|
|
|
</image>
|
|
</image>
|
|
|
<image class="status" v-else src="../../static/images/waterandfernew/close.png"></image>
|
|
<image class="status" v-else src="../../static/images/waterandfernew/close.png"></image>
|
|
|
</view> -->
|
|
</view> -->
|
|
|
- <view class="preBen" v-for="item, index in facilityvalve" v-if="index > 10"
|
|
|
|
|
|
|
+ <view class="preBen" v-for="item, index in faList"
|
|
|
@click="switchchange(!item.off, item.number, item, index)">
|
|
@click="switchchange(!item.off, item.number, item, index)">
|
|
|
<image class="daoguan" src="../../static/images/waterandfernew/bottomNew.png"
|
|
<image class="daoguan" src="../../static/images/waterandfernew/bottomNew.png"
|
|
|
- v-if="index > 10"></image>
|
|
|
|
|
|
|
+ v-if="index < 4"></image>
|
|
|
<view class="info">
|
|
<view class="info">
|
|
|
{{item.name}}
|
|
{{item.name}}
|
|
|
</view>
|
|
</view>
|
|
@@ -221,13 +220,26 @@
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ typeObj:{
|
|
|
|
|
+ 1:'控制柜',
|
|
|
|
|
+ 2:'灌溉泵',
|
|
|
|
|
+ 3:'搅拌机',
|
|
|
|
|
+ 4:'注肥泵',
|
|
|
|
|
+ 5:'阀控器',
|
|
|
|
|
+ 6:'施肥桶'
|
|
|
|
|
+ }, //阀控器类型对应
|
|
|
|
|
+ pickBtnList:[], // 肥料开关列表
|
|
|
|
|
+ resultBan:[], // 搅拌机开关列表
|
|
|
|
|
+ faList:[], // 发空气开关列表
|
|
|
alertTipColor: {
|
|
alertTipColor: {
|
|
|
color: '#1890FF',
|
|
color: '#1890FF',
|
|
|
fontSize: "12px"
|
|
fontSize: "12px"
|
|
|
},
|
|
},
|
|
|
device_id: '',
|
|
device_id: '',
|
|
|
|
|
+ mainBengIndex: 0, // 进水泵的位置
|
|
|
mainBeng: false,
|
|
mainBeng: false,
|
|
|
- feiBeng: false,
|
|
|
|
|
|
|
+ feiBeng: false,
|
|
|
|
|
+ feiBengIndex: 0, // 施肥泵的位置
|
|
|
calendarshow: false,
|
|
calendarshow: false,
|
|
|
historyTime: {},
|
|
historyTime: {},
|
|
|
cWidth: '350',
|
|
cWidth: '350',
|
|
@@ -490,6 +502,70 @@
|
|
|
})
|
|
})
|
|
|
// console.log(this.ElementList)
|
|
// console.log(this.ElementList)
|
|
|
},
|
|
},
|
|
|
|
|
+ // 当前配置的元素列表
|
|
|
|
|
+ async getPickList() {
|
|
|
|
|
+ // e_type类型对应
|
|
|
|
|
+ // 1:'控制柜',
|
|
|
|
|
+ // 2:'灌溉泵',
|
|
|
|
|
+ // 3:'搅拌机',
|
|
|
|
|
+ // 4:'注肥泵',
|
|
|
|
|
+ // 5:'阀控器',
|
|
|
|
|
+ // 6:'施肥桶'
|
|
|
|
|
+ let res = await this.$myRequest({
|
|
|
|
|
+ url: "/api/api_gateway?method=xphsp.views.sf_valve_location_list",
|
|
|
|
|
+ data: {
|
|
|
|
|
+ sf_device_id: this.device_id,
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ let pickList = [];
|
|
|
|
|
+ let pickBtnList = []; // 肥料开关
|
|
|
|
|
+ let pickBanList = []; // 肥料搅拌机开关
|
|
|
|
|
+ let faList = []; // 管道阀开关
|
|
|
|
|
+ this.facilityvalve.forEach(item => {
|
|
|
|
|
+ res.forEach((pick, index) => {
|
|
|
|
|
+ if(pick.e_key == item.type) {
|
|
|
|
|
+ let pickObj = Object.assign(item, pick);
|
|
|
|
|
+ // 获取当前灌溉泵位置
|
|
|
|
|
+ if(pick.e_type == 2) {
|
|
|
|
|
+ this.mainBengIndex = pickList.length;
|
|
|
|
|
+ this.mainBeng = pickObj.off;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取当前施肥泵位置
|
|
|
|
|
+ if(pick.e_type == 4) {
|
|
|
|
|
+ this.feiBengIndex = pickList.length;
|
|
|
|
|
+ this.feiBeng = pickObj.off;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取肥料开关列表
|
|
|
|
|
+ if(pick.e_type == 6) {
|
|
|
|
|
+ pickBtnList.push(pickObj)
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取搅拌机开关列表
|
|
|
|
|
+ if(pick.e_type == 3) {
|
|
|
|
|
+ pickBanList.push(pickObj)
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取管道阀开关列表
|
|
|
|
|
+ if(pick.e_type == 1 || pick.e_type == 5) {
|
|
|
|
|
+ faList.push(pickObj)
|
|
|
|
|
+ }
|
|
|
|
|
+ pickList.push(pickObj)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ // 把肥料和搅拌机位置对应起来(根据创建时间)
|
|
|
|
|
+ let resultBan = [];
|
|
|
|
|
+ pickBtnList.forEach(fei => {
|
|
|
|
|
+ pickBanList.forEach(ban => {
|
|
|
|
|
+ if(fei.create_time == ban.create_time) {
|
|
|
|
|
+ resultBan.push(ban)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ this.pickBtnList = pickBtnList;
|
|
|
|
|
+ this.resultBan = resultBan;
|
|
|
|
|
+ this.faList = faList;
|
|
|
|
|
+ console.log(pickBtnList, pickBanList, resultBan, faList)
|
|
|
|
|
+ },
|
|
|
|
|
+ // 元素状态
|
|
|
async getEquipstatus() {
|
|
async getEquipstatus() {
|
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
|
title: '加载中'
|
|
title: '加载中'
|
|
@@ -564,17 +640,6 @@
|
|
|
this.facilityvalve.push(arr1[i]);
|
|
this.facilityvalve.push(arr1[i]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- this.facilityvalve.forEach(item => {
|
|
|
|
|
- item.disabled = false;
|
|
|
|
|
- if (item.type == 'j9' && item.off == true) {
|
|
|
|
|
- // 判断注水泵是否打开
|
|
|
|
|
- this.mainBeng = true;
|
|
|
|
|
- }
|
|
|
|
|
- if (item.type == 'j10' && item.off == true) {
|
|
|
|
|
- // 判断施肥阀是否打开
|
|
|
|
|
- this.feiBeng = true;
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
let feiNum = 0; // 记录废料桶占据通道个数,两个通道为一个肥料桶
|
|
let feiNum = 0; // 记录废料桶占据通道个数,两个通道为一个肥料桶
|
|
|
this.buttonList = [];
|
|
this.buttonList = [];
|
|
|
this.facilityvalve.forEach((item, index) => {
|
|
this.facilityvalve.forEach((item, index) => {
|
|
@@ -582,16 +647,9 @@
|
|
|
feiNum++;
|
|
feiNum++;
|
|
|
this.buttonList.push(item);
|
|
this.buttonList.push(item);
|
|
|
}
|
|
}
|
|
|
- if (item.type == 'j10' && item.off == true) {
|
|
|
|
|
- // 判断注水泵是否打开
|
|
|
|
|
- this.mainBeng = true;
|
|
|
|
|
- }
|
|
|
|
|
- if (item.type == 'j9' && item.off == true) {
|
|
|
|
|
- // 判断施肥阀是否打开
|
|
|
|
|
- this.feiBeng = true;
|
|
|
|
|
- }
|
|
|
|
|
})
|
|
})
|
|
|
this.feiNum = feiNum;
|
|
this.feiNum = feiNum;
|
|
|
|
|
+ this.getPickList();
|
|
|
console.log(this.facilityvalve)
|
|
console.log(this.facilityvalve)
|
|
|
},
|
|
},
|
|
|
async getEquipcontrol(num, state, double_order) {
|
|
async getEquipcontrol(num, state, double_order) {
|
|
@@ -673,7 +731,7 @@
|
|
|
} else {
|
|
} else {
|
|
|
this.status = 'loadmore'
|
|
this.status = 'loadmore'
|
|
|
}
|
|
}
|
|
|
- console.log(this.tableData);
|
|
|
|
|
|
|
+ // console.log(this.tableData);
|
|
|
},
|
|
},
|
|
|
switchchange(e, state, item, index, isfeiButton) {
|
|
switchchange(e, state, item, index, isfeiButton) {
|
|
|
// 是否是肥料开关,是的话 两个合并为一个
|
|
// 是否是肥料开关,是的话 两个合并为一个
|
|
@@ -744,6 +802,7 @@
|
|
|
this.getEquipstatus();
|
|
this.getEquipstatus();
|
|
|
this.getElmentInfo();
|
|
this.getElmentInfo();
|
|
|
this.getEquipcontroldata();
|
|
this.getEquipcontroldata();
|
|
|
|
|
+ // this.getPickList();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
@@ -1118,7 +1177,7 @@
|
|
|
width: 22rpx;
|
|
width: 22rpx;
|
|
|
height: 20rpx;
|
|
height: 20rpx;
|
|
|
top: 360rpx;
|
|
top: 360rpx;
|
|
|
- right: 252rpx;
|
|
|
|
|
|
|
+ right: 251rpx;
|
|
|
z-index: 2;
|
|
z-index: 2;
|
|
|
|
|
|
|
|
image {
|
|
image {
|