|
@@ -9,9 +9,9 @@
|
|
|
<image :src="rotate" class="rotate-rotate" />
|
|
<image :src="rotate" class="rotate-rotate" />
|
|
|
<image :src="water" class="rotate-water" />
|
|
<image :src="water" class="rotate-water" />
|
|
|
<view class="rotationflow-time">
|
|
<view class="rotationflow-time">
|
|
|
- <view class="rotationflow-time-title">2号灌区</view>
|
|
|
|
|
|
|
+ <view class="rotationflow-time-title">{{ currentFq.name }}</view>
|
|
|
<view class="rotationflow-time-content"> {{ time }}</view>
|
|
<view class="rotationflow-time-content"> {{ time }}</view>
|
|
|
- <view class="rotationflow-time-label">灌溉时长</view>
|
|
|
|
|
|
|
+ <view class="rotationflow-time-label">{{ label }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -22,44 +22,84 @@
|
|
|
:key="item.label"
|
|
:key="item.label"
|
|
|
>
|
|
>
|
|
|
<view class="rotationflow-middle-item-value">{{ item.value }}</view>
|
|
<view class="rotationflow-middle-item-value">{{ item.value }}</view>
|
|
|
- <view class="rotationflow-middle-item-title">{{ item.label }}</view>
|
|
|
|
|
|
|
+ <view class="rotationflow-middle-item-title">{{
|
|
|
|
|
+ item.sfDisplayname || item.sfName
|
|
|
|
|
+ }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="rotationflow-content">
|
|
<view class="rotationflow-content">
|
|
|
<view class="rotationflow-content-top">
|
|
<view class="rotationflow-content-top">
|
|
|
- <view class="rotationflow-content-top-title">灌溉</view>
|
|
|
|
|
|
|
+ <view
|
|
|
|
|
+ :class="
|
|
|
|
|
+ tktype == '0'
|
|
|
|
|
+ ? 'rotationflow-content-top-title'
|
|
|
|
|
+ : 'rotationflow-content-top-title-rever'
|
|
|
|
|
+ "
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ tktype == '0' ? '灌溉' : '水肥' }}
|
|
|
|
|
+ </view>
|
|
|
<view class="rotationflow-content-top-desc">已选灌区</view>
|
|
<view class="rotationflow-content-top-desc">已选灌区</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="rotationflow-content-list">
|
|
<view class="rotationflow-content-list">
|
|
|
- <view class="rotationflow-content-list-wrapper">
|
|
|
|
|
|
|
+ <view class="rotationflow-content-list-wrapper" v-if="tktype == 0">
|
|
|
<view class="rotationflow-content-num">
|
|
<view class="rotationflow-content-num">
|
|
|
- <view class="rotationflow-content-num-title">轮灌次数:1</view>
|
|
|
|
|
<view class="rotationflow-content-num-title"
|
|
<view class="rotationflow-content-num-title"
|
|
|
- >轮灌间隔:10分钟</view
|
|
|
|
|
|
|
+ >轮灌次数:{{ currentFq.lgcs || 0 }}</view
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="rotationflow-content-num-title"
|
|
|
|
|
+ >轮灌间隔:{{ currentFq.lgjg || 0 }} 分钟</view
|
|
|
|
|
+ >
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="rotationflow-content-list-wrapper" v-else>
|
|
|
|
|
+ <view class="rotationflow-content-num">
|
|
|
|
|
+ <view class="rotationflow-content-num-title"
|
|
|
|
|
+ >轮灌次数:{{ currentFq.lgcs || 0 }}</view
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="rotationflow-content-num-title"
|
|
|
|
|
+ >肥前水:{{ currentFq.fqcx || 0 }} 分钟</view
|
|
|
> </view
|
|
> </view
|
|
|
><view class="rotationflow-content-num">
|
|
><view class="rotationflow-content-num">
|
|
|
- <view class="rotationflow-content-num-title">轮灌次数:1</view>
|
|
|
|
|
<view class="rotationflow-content-num-title"
|
|
<view class="rotationflow-content-num-title"
|
|
|
- >轮灌间隔:10分钟</view
|
|
|
|
|
|
|
+ >轮灌次数:{{ currentFq.lgjg || 0 }} 分钟</view
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="rotationflow-content-num-title"
|
|
|
|
|
+ >肥后水:{{ currentFq.fhcx || 0 }} 分钟</view
|
|
|
> </view
|
|
> </view
|
|
|
><view class="rotationflow-content-num">
|
|
><view class="rotationflow-content-num">
|
|
|
- <view class="rotationflow-content-num-title">轮灌次数:1</view>
|
|
|
|
|
- <view class="rotationflow-content-num-title">轮灌间隔:10分钟</view>
|
|
|
|
|
|
|
+ <view class="rotationflow-content-num-title"
|
|
|
|
|
+ >模式选择:{{ getsfmode(currentFq.sfmode) }}</view
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="rotationflow-content-num-title"></view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view
|
|
<view
|
|
|
class="rotationflow-content-list-item"
|
|
class="rotationflow-content-list-item"
|
|
|
- v-for="(item, index) in 30"
|
|
|
|
|
|
|
+ v-for="(item, index) in fqList"
|
|
|
:class="index === 0 ? 'haveYet' : index === 1 ? 'currentYet' : ''"
|
|
:class="index === 0 ? 'haveYet' : index === 1 ? 'currentYet' : ''"
|
|
|
:key="index"
|
|
:key="index"
|
|
|
>
|
|
>
|
|
|
- <view class="rotationflow-content-list-item-title">1号灌区</view>
|
|
|
|
|
- <view class="rotationflow-content-list-item-desc">已灌溉</view>
|
|
|
|
|
|
|
+ <view
|
|
|
|
|
+ class="rotationflow-content-list-item-title"
|
|
|
|
|
+ :class="
|
|
|
|
|
+ item.value === '1' ? 'rotationflow-content-list-item-current' : ''
|
|
|
|
|
+ "
|
|
|
|
|
+ >{{ item.name }}</view
|
|
|
|
|
+ >
|
|
|
|
|
+ <view
|
|
|
|
|
+ class="rotationflow-content-list-item-desc"
|
|
|
|
|
+ :class="
|
|
|
|
|
+ item.value === '1' ? 'rotationflow-content-list-item-current' : ''
|
|
|
|
|
+ "
|
|
|
|
|
+ >{{ item.value == '2' ? '已灌溉' : item.lgjg + '分钟' }}</view
|
|
|
|
|
+ >
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="rotationflow-footer">
|
|
<view class="rotationflow-footer">
|
|
|
- <view class="rotationflow-footer-item">结束灌溉</view>
|
|
|
|
|
|
|
+ <view class="rotationflow-footer-item" @click="rotationflowEnd"
|
|
|
|
|
+ >结束灌溉</view
|
|
|
|
|
+ >
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
@@ -67,6 +107,7 @@
|
|
|
import rotate from './assets/rotate.png';
|
|
import rotate from './assets/rotate.png';
|
|
|
import water from './assets/water.png';
|
|
import water from './assets/water.png';
|
|
|
import autoBtn from './assets/autoBtn.png';
|
|
import autoBtn from './assets/autoBtn.png';
|
|
|
|
|
+import json from './test.js';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'rotationflow',
|
|
name: 'rotationflow',
|
|
@@ -75,34 +116,37 @@ export default {
|
|
|
rotate,
|
|
rotate,
|
|
|
water,
|
|
water,
|
|
|
autoBtn,
|
|
autoBtn,
|
|
|
- time: '',
|
|
|
|
|
- list: [
|
|
|
|
|
- {
|
|
|
|
|
- value: '0.00',
|
|
|
|
|
- label: 'PH值',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- value: '987 us',
|
|
|
|
|
- label: 'EC值',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- value: '20℃',
|
|
|
|
|
- label: '水温',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- value: '20 Pa',
|
|
|
|
|
- label: '管道压力',
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ time: '-',
|
|
|
|
|
+ list: [],
|
|
|
timer: null,
|
|
timer: null,
|
|
|
devBid: '',
|
|
devBid: '',
|
|
|
|
|
+ tktype: 1,
|
|
|
|
|
+ lgcs: 0,
|
|
|
|
|
+ lgjg: 0,
|
|
|
|
|
+ fqList: [],
|
|
|
|
|
+ currentFq: {},
|
|
|
|
|
+ label: '灌溉中.',
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
components: {},
|
|
components: {},
|
|
|
methods: {
|
|
methods: {
|
|
|
- setTime() {
|
|
|
|
|
- let hours = 6 * 60 * 60 * 1000;
|
|
|
|
|
- this.time = '06:00:00';
|
|
|
|
|
|
|
+ formartTime(time) {
|
|
|
|
|
+ if (!time) {
|
|
|
|
|
+ return '-';
|
|
|
|
|
+ }
|
|
|
|
|
+ let hours = time * 60 * 1000;
|
|
|
|
|
+ let h = Math.floor(hours / (60 * 60 * 1000));
|
|
|
|
|
+ let m = Math.floor((hours % (60 * 60 * 1000)) / (60 * 1000));
|
|
|
|
|
+ let s = Math.floor(((hours % (60 * 60 * 1000)) % (60 * 1000)) / 1000);
|
|
|
|
|
+ this.time = `${h < 10 ? '0' + h : h}:${m < 10 ? '0' + m : m}:${
|
|
|
|
|
+ s < 10 ? '0' + s : s
|
|
|
|
|
+ }`;
|
|
|
|
|
+ },
|
|
|
|
|
+ setTime(time) {
|
|
|
|
|
+ if (!time) {
|
|
|
|
|
+ return '-';
|
|
|
|
|
+ }
|
|
|
|
|
+ let hours = time * 60 * 1000;
|
|
|
this.timer = setInterval(() => {
|
|
this.timer = setInterval(() => {
|
|
|
if (hours <= 0) {
|
|
if (hours <= 0) {
|
|
|
clearInterval(this.timer);
|
|
clearInterval(this.timer);
|
|
@@ -117,6 +161,20 @@ export default {
|
|
|
}`;
|
|
}`;
|
|
|
}, 1000);
|
|
}, 1000);
|
|
|
},
|
|
},
|
|
|
|
|
+ getsfmode(mode) {
|
|
|
|
|
+ switch (mode) {
|
|
|
|
|
+ case '0':
|
|
|
|
|
+ return '定时';
|
|
|
|
|
+ case '1':
|
|
|
|
|
+ return '定量';
|
|
|
|
|
+ case '2':
|
|
|
|
|
+ return 'EC调配';
|
|
|
|
|
+ case '3':
|
|
|
|
|
+ return '混肥比例';
|
|
|
|
|
+ default:
|
|
|
|
|
+ return '-';
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
async getRunStatus() {
|
|
async getRunStatus() {
|
|
|
const res = await this.$myRequest({
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/v2/iot/mobile/device/sf/zsrf/task/run/status/',
|
|
url: '/api/v2/iot/mobile/device/sf/zsrf/task/run/status/',
|
|
@@ -125,16 +183,72 @@ export default {
|
|
|
devBid: this.devBid,
|
|
devBid: this.devBid,
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
- console.log(res, 'resresresres');
|
|
|
|
|
|
|
+ const data = res.data || {};
|
|
|
|
|
+ this.list = data?.sensorList || [];
|
|
|
|
|
+ this.tktype = data?.tktype;
|
|
|
|
|
+ this.lgjg = data?.lgjg || 0;
|
|
|
|
|
+ this.lgcs = data?.lgcs || 0;
|
|
|
|
|
+ this.fqList = data?.fqList || [];
|
|
|
|
|
+ this.fqList.forEach((item) => {
|
|
|
|
|
+ if (item.value === '1') {
|
|
|
|
|
+ this.currentFq = item;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ this.formartTime(this.currentFq.lgjg);
|
|
|
|
|
+ this.setTime(this.currentFq.lgjg);
|
|
|
|
|
+ },
|
|
|
|
|
+ rotationflowEnd() {
|
|
|
|
|
+ const payload = {
|
|
|
|
|
+ devBid: this.devBid,
|
|
|
|
|
+ tkid: 0,
|
|
|
|
|
+ status: 0,
|
|
|
|
|
+ tktype: this.tktype,
|
|
|
|
|
+ };
|
|
|
|
|
+ this.postTaskCtl(payload);
|
|
|
|
|
+ },
|
|
|
|
|
+ async postTaskCtl(payload) {
|
|
|
|
|
+ uni.showLoading({
|
|
|
|
|
+ title: '正在执行',
|
|
|
|
|
+ });
|
|
|
|
|
+ const res = await this.$myRequest({
|
|
|
|
|
+ url: '/api/v2/iot/mobile/device/sf/zsrf/task/ctl/',
|
|
|
|
|
+ method: 'post',
|
|
|
|
|
+ data: payload,
|
|
|
|
|
+ header: {
|
|
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ if (res.code === '000000') {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '操作成功',
|
|
|
|
|
+ });
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: `/pages/cb/shuifeizs/detail?devBid=${this.devBid}`,
|
|
|
|
|
+ });
|
|
|
|
|
+ }, 1000);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ title: res.msg,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- mounted() {
|
|
|
|
|
- this.setTime();
|
|
|
|
|
- },
|
|
|
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
|
const { devBid } = options;
|
|
const { devBid } = options;
|
|
|
this.devBid = devBid;
|
|
this.devBid = devBid;
|
|
|
this.getRunStatus();
|
|
this.getRunStatus();
|
|
|
|
|
+ setInterval(() => {
|
|
|
|
|
+ if (this.label === '灌溉中.') {
|
|
|
|
|
+ this.label = '灌溉中..';
|
|
|
|
|
+ } else if (this.label === '灌溉中..') {
|
|
|
|
|
+ this.label = '灌溉中...';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.label = '灌溉中.';
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 500);
|
|
|
},
|
|
},
|
|
|
onUnload() {
|
|
onUnload() {
|
|
|
clearInterval(this.timer);
|
|
clearInterval(this.timer);
|
|
@@ -235,9 +349,9 @@ uni-page-wrapper {
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
}
|
|
}
|
|
|
.rotationflow-time-label {
|
|
.rotationflow-time-label {
|
|
|
- width: 200rpx;
|
|
|
|
|
|
|
+ width: 100rpx;
|
|
|
color: #687a74;
|
|
color: #687a74;
|
|
|
- text-align: center;
|
|
|
|
|
|
|
+ text-align: left;
|
|
|
font-family: 'Source Han Sans CN VF';
|
|
font-family: 'Source Han Sans CN VF';
|
|
|
font-size: 24rpx;
|
|
font-size: 24rpx;
|
|
|
font-weight: 400;
|
|
font-weight: 400;
|
|
@@ -304,6 +418,17 @@ uni-page-wrapper {
|
|
|
line-height: normal;
|
|
line-height: normal;
|
|
|
padding: 4rpx 16rpx;
|
|
padding: 4rpx 16rpx;
|
|
|
}
|
|
}
|
|
|
|
|
+ .rotationflow-content-top-title-rever {
|
|
|
|
|
+ border-radius: 8rpx;
|
|
|
|
|
+ background: #f3a72f1a;
|
|
|
|
|
+ color: #f3a72f;
|
|
|
|
|
+ font-family: 'Source Han Sans CN VF';
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ font-style: normal;
|
|
|
|
|
+ font-weight: 400;
|
|
|
|
|
+ line-height: normal;
|
|
|
|
|
+ padding: 4rpx 16rpx;
|
|
|
|
|
+ }
|
|
|
.rotationflow-content-top-desc {
|
|
.rotationflow-content-top-desc {
|
|
|
color: #333333;
|
|
color: #333333;
|
|
|
font-family: 'Source Han Sans CN VF';
|
|
font-family: 'Source Han Sans CN VF';
|
|
@@ -346,6 +471,9 @@ uni-page-wrapper {
|
|
|
.rotationflow-content-list-item-desc {
|
|
.rotationflow-content-list-item-desc {
|
|
|
margin-right: 32rpx;
|
|
margin-right: 32rpx;
|
|
|
}
|
|
}
|
|
|
|
|
+ .rotationflow-content-list-item-current {
|
|
|
|
|
+ color: #14a478;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
.haveYet {
|
|
.haveYet {
|
|
|
color: #9ba6a3;
|
|
color: #9ba6a3;
|
|
@@ -385,7 +513,7 @@ uni-page-wrapper {
|
|
|
font-size: 32rpx;
|
|
font-size: 32rpx;
|
|
|
font-weight: 500;
|
|
font-weight: 500;
|
|
|
border-radius: 16rpx;
|
|
border-radius: 16rpx;
|
|
|
- background: #14a478;
|
|
|
|
|
|
|
+ background: #ff3546;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|