|
|
@@ -23,20 +23,63 @@
|
|
|
<view class="facilitystate-top__item-text">{{ item.title }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <Base :dataList="dataList" />
|
|
|
- <facilitystate
|
|
|
- :devBid="devBid"
|
|
|
- :ggbCurrent="ggbCurrent"
|
|
|
- :sfbCurrent="sfbCurrent"
|
|
|
- :irrigatedAreaList="irrigatedAreaList"
|
|
|
- :webSockedData="webSockedData"
|
|
|
- :alreadyfertilizerBucketList="alreadyfertilizerBucketList"
|
|
|
- />
|
|
|
+ <view class="irrMode">
|
|
|
+ <view class="irrMode__header">
|
|
|
+ <view @click="changeMode('1')" :class="workStatus == '1' ? 'active' : ''">施肥模式</view>
|
|
|
+ <view @click="changeMode('0')" :class="workStatus == '0' ? 'active' : ''">灌溉模式</view>
|
|
|
+ </view>
|
|
|
+ <view class="irrMode__content">
|
|
|
+ <view class="irrMode__content-header">
|
|
|
+ <view class="irrMode__content-header-list" v-if="runTitle">
|
|
|
+ <view class="irrMode__content-header-title">
|
|
|
+ <image class="header-item-icon" :src="rain" />
|
|
|
+ {{ runTitle }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="irrMode__content-item">
|
|
|
+ <view class="irrMode__content-item-raduis" :class="runStatus == '1' ? 'active-radius' : ''" @click="changeActive('1')">
|
|
|
+ <image class="item-icon" :src="runStatus=='1'?mediaPlayFill:mediaPlay" />
|
|
|
+ <view class="item-text">启动</view>
|
|
|
+ </view>
|
|
|
+ <view class="irrMode__content-item-raduis" :class="runStatus == '2' ? 'active-radius' : ''" @click="changeActive('2')">
|
|
|
+ <image class="item-icon" :src="runStatus=='2'?mediaPauseFill:mediaPause" />
|
|
|
+ <view class="item-text">暂停</view>
|
|
|
+ </view>
|
|
|
+ <view class="irrMode__content-item-raduis" :class="runStatus == '0' ? 'active-radius' : ''" @click="changeActive('0')" style="margin-right:0">
|
|
|
+ <image class="item-icon" :src="runStatus=='0'?stopFill:stop" />
|
|
|
+ <view class="item-text">停止</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="irr-run-list">
|
|
|
+ <text v-for="(item, index) in selectAreaList" :key="index">
|
|
|
+ {{ item.group_name }}
|
|
|
+ <text v-if="index != selectAreaList.length - 1">、</text>
|
|
|
+ </text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <Base :dataList="dataList" />
|
|
|
+ <facilitystate
|
|
|
+ :devBid="devBid"
|
|
|
+ :ggbCurrent="ggbCurrent"
|
|
|
+ :sfbCurrent="sfbCurrent"
|
|
|
+ :irrigatedAreaList="irrigatedAreaList"
|
|
|
+ :webSockedData="webSockedData"
|
|
|
+ :alreadyfertilizerBucketList="alreadyfertilizerBucketList"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import manualControl from './assets/manualControl.png';
|
|
|
+import mediaPause from './assets/media-pause.png';
|
|
|
+import mediaPauseFill from './assets/media-pause-fill.png';
|
|
|
+import mediaPlay from './assets/media-play.png';
|
|
|
+import mediaPlayFill from './assets/media-play-fill.png';
|
|
|
+import rain from './assets/rain.png';
|
|
|
+import stop from './assets/stop.png';
|
|
|
+import stopFill from './assets/stop-fill.png';
|
|
|
import wheelIrrigation from './assets/wheelIrrigation.png';
|
|
|
import time from './assets/timing.png';
|
|
|
import formulaSetting from './assets/formulaSetting.png';
|
|
|
@@ -47,6 +90,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
ws: null,
|
|
|
+ currentMode: '1',
|
|
|
title: '水肥一体机',
|
|
|
manualControl,
|
|
|
devBid: '',
|
|
|
@@ -55,6 +99,13 @@ export default {
|
|
|
dataList: [],
|
|
|
irrigatedAreaList: [],
|
|
|
alreadyfertilizerBucketList: [],
|
|
|
+ mediaPause,
|
|
|
+ mediaPauseFill,
|
|
|
+ mediaPlay,
|
|
|
+ mediaPlayFill,
|
|
|
+ rain,
|
|
|
+ stop,
|
|
|
+ stopFill,
|
|
|
deviceList: [
|
|
|
{
|
|
|
icon: manualControl,
|
|
|
@@ -93,6 +144,12 @@ export default {
|
|
|
dataArray:[],
|
|
|
webSockedData: {},
|
|
|
reconnectCount: 0,
|
|
|
+ isActive: '0',
|
|
|
+ runStatus: -1,
|
|
|
+ workStatus: -1,
|
|
|
+ clearIrr: {},
|
|
|
+ selectAreaList: [],
|
|
|
+ runTitle: '',
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
|
@@ -129,6 +186,72 @@ export default {
|
|
|
this.ws.close();
|
|
|
},
|
|
|
methods: {
|
|
|
+ isAutoRun(childrenList) {
|
|
|
+ for (let i = 0; i < childrenList.length; i++) {
|
|
|
+ const item = childrenList[i];
|
|
|
+ if (item.value === 1) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ },
|
|
|
+ async initsfyunshangAutoConfigInfo() {
|
|
|
+ const selectAreaList = [];
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url:'/api/v2/iot/device/sf/yunshang/auto/config/info/',
|
|
|
+ method:'post',
|
|
|
+ data: {
|
|
|
+ devBid: String(this.devBid),
|
|
|
+ },
|
|
|
+ })
|
|
|
+ const list = res;
|
|
|
+ const group_list = list.group_list || [];
|
|
|
+ group_list.forEach((item) => {
|
|
|
+ if (item.group_value == 1) {
|
|
|
+ selectAreaList.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.selectAreaList = selectAreaList;
|
|
|
+ },
|
|
|
+ async devctlContorl(data){
|
|
|
+ const params = {
|
|
|
+ devBid: Number(this.devBid),
|
|
|
+ data,
|
|
|
+ };
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/api/v2/iot/mobile/device/sf/devctl/',
|
|
|
+ method: 'post',
|
|
|
+ data:params,
|
|
|
+ header: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ },
|
|
|
+ });
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changeActive(active) {
|
|
|
+ this.runStatus = active;
|
|
|
+ const params = {
|
|
|
+ IrrStatus:active
|
|
|
+ }
|
|
|
+ this.devctlContorl(params);
|
|
|
+ },
|
|
|
+ changeMode(mode) {
|
|
|
+ if(this.runStatus == '1' || this.runStatus == '2'){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请先停止运行',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.currentMode = mode;
|
|
|
+ const params = {
|
|
|
+ IrrMode:mode
|
|
|
+ }
|
|
|
+ this.devctlContorl(params);
|
|
|
+ },
|
|
|
initWebSocket() {
|
|
|
const url = 'wss://things.ysiot.net:18080/api/ws';
|
|
|
this.ws = uni.connectSocket({
|
|
|
@@ -153,7 +276,7 @@ export default {
|
|
|
],
|
|
|
authCmd: {
|
|
|
cmdId: 0,
|
|
|
- token: this.sfToken
|
|
|
+ token: this.sfToken,
|
|
|
}
|
|
|
};
|
|
|
console.log('发送测试参数:', testParams);
|
|
|
@@ -178,7 +301,6 @@ export default {
|
|
|
this.mergeTwoObject(this.dataArray,this.webSockedData?.data);
|
|
|
this.initData(this.dataArray);
|
|
|
}
|
|
|
- // this.$refs.facilRightItem && this.$refs.facilRightItem.init();
|
|
|
} catch (e) {
|
|
|
console.error('WebSocket 消息解析失败', e);
|
|
|
}
|
|
|
@@ -252,6 +374,7 @@ export default {
|
|
|
this.getdeviceSfStatus();
|
|
|
await this.getpeifangRefresh();
|
|
|
this.getsfrhinfo();
|
|
|
+ this.initsfyunshangAutoConfigInfo();
|
|
|
await this.getRunStatus();
|
|
|
},
|
|
|
async getpeifangRefresh() {
|
|
|
@@ -275,10 +398,8 @@ export default {
|
|
|
|
|
|
if (data == '{}') {
|
|
|
this.isRun = true;
|
|
|
- // this.deviceList[1].url = `/pages/cb/shuifeizsFirst/automation?devBid=${this.devBid}&devName=${this.devName}&devStatus=${this.devStatus}`;
|
|
|
} else {
|
|
|
this.isRun = false;
|
|
|
- // this.deviceList[1].url = `/pages/cb/shuifeizsFirst/rotationflow?devBid=${this.devBid}&devName=${this.devName}&devStatus=${this.devStatus}`;
|
|
|
}
|
|
|
},
|
|
|
initData(res){
|
|
|
@@ -296,8 +417,26 @@ export default {
|
|
|
this.dataList.push(item);
|
|
|
} else if (item.sfType === '7') {
|
|
|
this.irrigatedAreaList.push(item);
|
|
|
+ } else if (item.sfType === '9') {
|
|
|
+ if (item.sfCode === 'IrrStatus') {
|
|
|
+ this.runStatus = item.value;
|
|
|
+ } else if (item.sfCode === 'IrrMode') {
|
|
|
+ this.workStatus = item.value;
|
|
|
+ } else if (item.sfCode === 'WaterFlowSum:Value') {
|
|
|
+ this.clearIrr = item;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
+ this.runTitle = '';
|
|
|
+ if(this.runStatus == '1'){
|
|
|
+ this.irrigatedAreaList.forEach((item) => {
|
|
|
+ if (this.isAutoRun(item.childrenList)) {
|
|
|
+ this.runTitle += item.sfDisplayname;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.runTitle = '';
|
|
|
+ }
|
|
|
},
|
|
|
async getdeviceSfStatus() {
|
|
|
const res = await this.$myRequest({
|
|
|
@@ -311,6 +450,15 @@ export default {
|
|
|
this.initData(this.dataArray);
|
|
|
},
|
|
|
nativeTo(item) {
|
|
|
+ if(item.className == 'manualControl'){
|
|
|
+ if(this.runStatus == '1' || this.runStatus == '2'){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请先停止运行',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
uni.navigateTo({
|
|
|
url: item.url,
|
|
|
});
|
|
|
@@ -323,6 +471,122 @@ uni-page-body {
|
|
|
position: relative;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+.irrMode{
|
|
|
+ margin-top: 30rpx;
|
|
|
+ border-radius: 32rpx 32rpx 0 0;
|
|
|
+ background: linear-gradient(180deg, #edfbfb 0%, #d2f2ed 100%);
|
|
|
+ margin-bottom: 30rpx;
|
|
|
+ padding: 32rpx;
|
|
|
+ border: 3rpx solid #FFF;
|
|
|
+ .irrMode__header{
|
|
|
+ display: flex;
|
|
|
+ width:320rpx;
|
|
|
+ padding:0 10rpx;
|
|
|
+ align-items: center;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 12rpx;
|
|
|
+ margin-bottom: 24rpx;
|
|
|
+ font-family: "Source Han Sans CN VF";
|
|
|
+ font-size: 28rpx;
|
|
|
+ font-style: normal;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: normal;
|
|
|
+ color:#999999;
|
|
|
+ height: 68rpx;
|
|
|
+ line-height: 68rpx;
|
|
|
+ view{
|
|
|
+ width: 160rpx;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ color: #ffffff;
|
|
|
+ background: #0BBC58;
|
|
|
+ height: 56rpx;
|
|
|
+ }
|
|
|
+ .irrMode__content{
|
|
|
+ margin-top: 24rpx;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ padding: 16rpx;
|
|
|
+ background: linear-gradient(180deg, #FFF 0%, #F5F6FA 100%);
|
|
|
+ .irrMode__content-header{
|
|
|
+ width: calc(100% - 32rpx);
|
|
|
+ padding: 16rpx 16rpx 16rpx 16rpx;
|
|
|
+ border-radius: 12rpx;
|
|
|
+ background: linear-gradient(180deg, #BBF1EA 0%, #E6F4F9 100%);
|
|
|
+ .irrMode__content-header-list{
|
|
|
+ display:flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 12rpx;
|
|
|
+ }
|
|
|
+ .irrMode__content-header-title{
|
|
|
+ color: #020305;
|
|
|
+ text-align: right;
|
|
|
+ font-family: "Source Han Sans CN VF";
|
|
|
+ font-size: 30rpx;
|
|
|
+ font-weight: 500;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ .header-item-icon{
|
|
|
+ width: 48rpx;
|
|
|
+ height: 48rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .irrMode__content-header-desc{
|
|
|
+ color: #999999;
|
|
|
+ text-align: right;
|
|
|
+ font-family: "Source Han Sans CN VF";
|
|
|
+ font-size: 28rpx;
|
|
|
+ font-weight: 400;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .irrMode__content-item{
|
|
|
+ display:flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ padding: 16rpx 0;
|
|
|
+ border-radius: 12rpx;
|
|
|
+ .irrMode__content-item-raduis{
|
|
|
+ display: flex;
|
|
|
+ height: 88rpx;
|
|
|
+ padding: 0rpx 32rpx;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ flex: 1 0 0;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ margin-right: 16rpx;
|
|
|
+ border: 2rpx solid #0BBC58;
|
|
|
+ color: #0bbc58;
|
|
|
+ text-align: right;
|
|
|
+ font-family: "Source Han Sans CN VF";
|
|
|
+ font-size: 20rpx;
|
|
|
+ image{
|
|
|
+ width: 48rpx;
|
|
|
+ height: 48rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .active-radius{
|
|
|
+ background: #0BBC58;
|
|
|
+ color:#ffffff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .irr-run-list{
|
|
|
+ padding: 16rpx;
|
|
|
+ font-family: "Source Han Sans CN VF";
|
|
|
+ color: #999999;
|
|
|
+ font-family: "Source Han Sans CN VF";
|
|
|
+ font-size: 24rpx;
|
|
|
+ font-weight: 400;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
.online {
|
|
|
height: 32rpx;
|
|
|
line-height: 32rpx;
|
|
|
@@ -373,8 +637,7 @@ uni-page-body {
|
|
|
position: relative;
|
|
|
}
|
|
|
.facilitystate-page {
|
|
|
- background: linear-gradient(180deg, #ffffff00 0%, #fff 23.64%, #fff 100%),
|
|
|
- linear-gradient(102deg, #bfeadd 6.77%, #b8f1e7 40.15%, #b9eef5 84.02%);
|
|
|
+ background: linear-gradient(180deg, #f5f6fa00 0%, #F5F6FA 23.46%, #FFF 25.24%, #FFF 100%), linear-gradient(102deg, #BFEADD 6.77%, #B8F1E7 40.15%, #B9EEF5 84.02%);
|
|
|
height: 100%;
|
|
|
width: 100%;
|
|
|
overflow-x: hidden;
|