This commit is contained in:
home孙 2025-09-13 16:29:49 +08:00
parent c0309dafef
commit 86e4aae012
4 changed files with 314 additions and 24 deletions

View File

@ -16,7 +16,8 @@ const variable = {
name: "", //应用名字 name: "", //应用名字
whatType: type, //判断当前是哪端 whatType: type, //判断当前是哪端
// baseUrl: "http://jiaxingtest.a1.luyouxia.net:19159", //本地测试接口的基础路径 // baseUrl: "http://jiaxingtest.a1.luyouxia.net:19159", //本地测试接口的基础路径
baseUrl: "https://api.lihe-control.com", //线上接口的基础路径 // baseUrl: "https://api.lihe-control.com", //线上接口的基础路径
baseUrl: "http://jiaxingtest.f1.luyouxia.net:13996", //线上接口的基础路径
mapKey: "", //jsapi mapKey: "", //jsapi

View File

@ -6,8 +6,8 @@
<view class="content"> <view class="content">
<view class="output_valve"> <view class="output_valve">
<view class="title"> <view class="title">
<image src="../../static/output_valve.png" mode=""></image> <text> <image src="../../static/output_valve.png" mode=""></image>
<text>输出电磁阀</text> <text>输出电磁阀</text></text>
</view> </view>
<view class="detail"> <view class="detail">
<template v-for="(item,index) in 64"> <template v-for="(item,index) in 64">
@ -81,7 +81,30 @@
<view :class="right2Index.indexOf(index + 4) != -1?'item_act':'item'" v-for="(item,index) in rightList2.slice(4, 8)" :key="index">{{item}}</view> <view :class="right2Index.indexOf(index + 4) != -1?'item_act':'item'" v-for="(item,index) in rightList2.slice(4, 8)" :key="index">{{item}}</view>
</view> </view>
</view> </view>
<view class="output_valve stir-value" v-if="fertilizerType==1">
<view class="title">
<text>搅拌配置</text>
<template>
<view class="u-flex">
<text>启动方式:{{openTypeStir}}</text>
<view class="right" @click="showStir()">
<text class="set-text">设置</text>
<image src="../../static/downArrow.png" mode=""></image>
</view>
</view>
</template>
</view>
<view class="detail">
<template v-for="(item,index) in stirListShow">
<view class="item" :class="stirList[index]==1?'active':''" :key="index">
{{ item.name }}
</view>
</template>
</view>
</view>
<view class="set"> <view class="set">
<view class="item" v-for="(item,index) in readFs_byid_name_list" :key="index" @click="showPop(index+1)"> <view class="item" v-for="(item,index) in readFs_byid_name_list" :key="index" @click="showPop(index+1)">
<view class="left"> <view class="left">
@ -105,6 +128,7 @@
<view class="control_model"> <view class="control_model">
<view class="control"> <view class="control">
控制模式: 控制模式:
</view> </view>
<view class="model"> <view class="model">
<text @click="change00(1)" :class="topActive==1?'stop_act':'stop'" <text @click="change00(1)" :class="topActive==1?'stop_act':'stop'"
@ -205,7 +229,7 @@
</view> </view>
<view class="line_pop"></view> <view class="line_pop"></view>
<view class="changeMoreBtn" @click="toWebView(indexs)"> <view class="changeMoreBtn" @click="toWebView(indexs,'irrigateSet')">
<image src="../../static/changeMore.png" mode=""></image> <image src="../../static/changeMore.png" mode=""></image>
<text>修改更多参数</text> <text>修改更多参数</text>
</view> </view>
@ -214,6 +238,65 @@
<image src="../../static/closed.png" mode="" @click="closePop"></image> <image src="../../static/closed.png" mode="" @click="closePop"></image>
</view> </view>
</u-popup> </u-popup>
<!-- 搅拌程序弹窗 -->
<u-popup v-model="stirshow" mode="center" :mask-close-able='false' width="640rpx"
:closeable='false'>
<view class="contentPop">
<view class="contentPop_box">
<view class="title">
搅拌配置
</view>
<view class="control_model">
<view class="control">
控制模式: <view class="model">
<text @click="changeOpen(0)" :class="inputData2['600'] == 0?'stop':'stop_act'"
class="stop">{{inputData2['600'] == 0?'无效':'有效'}}</text>
</view>
</view>
<view class="model">
<text @click="change600(2)" :class="topActive2[2] == 1?'stop_act':'stop'"
class="stop">停止</text>
<text @click="change600(1)" :class="topActive2[1] == 1?'hand_act':'hand'" class="hand"
style="width: 140rpx;">手动启动</text>
<text @click="change600(0)" :class="topActive2[0] == 1?'auto_act':'auto'">自动</text>
</view>
</view>
<view class="line_pop"></view>
<view class="irrigate_time1">
手动启动时间
<view class="irrigate_input">
<input v-model="inputData2['601']"
@blur="changeData10('601', $event)" type="digit" placeholder="0"
step="0.1" />
<!-- <u-input v-model="inputData[10 + (indexs - 1) + '01']" type="text" :border="false" input-align='center'
height='66' :clearable='false' /> -->
</view>
分钟
</view>
<view class="line_pop"></view>
<view class="output_valve stir-value-popup">
<view class="title">手自动启动搅拌电机选择:</view>
<view class="detail">
<template v-for="(item,index) in stirListShow">
<view @click="changeIndexOpen1(index)" class="item" :class="stirpopupList[index]==1?'active':''" :key="index">
{{ item.name }}
</view>
</template>
</view>
</view>
<view class="line_pop"></view>
<view class="changeMoreBtn" @click="toWebView(0,'stir')">
<image src="../../static/changeMore.png" mode=""></image>
<text>修改更多参数</text>
</view>
</view>
<image src="../../static/closed.png" mode="" @click="closeStirPop"></image>
</view>
</u-popup>
</view> </view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
@ -310,7 +393,37 @@
'solenoidSixteen' 'solenoidSixteen'
], ],
readFs_byid_name:'', readFs_byid_name:'',
actList1:["0","0","0","0"] actList1:["0","0","0","0"],
//
openTypeStir:'',
stirListShow:[ {
name: 'A肥',
}, {
name: 'B肥',
}, {
name: 'C肥',
}, {
name: 'D肥',
}, {
name: 'E肥',
}, {
name: 'F肥',
}, {
name: 'G肥',
}, {
name: 'H肥',
}, {
name: '酸',
},],
stirList:[],
stirshow:false,
//
inputData2:[],
inputData2New:[],
stirpopupList:[],
topActive2: [],
fertilizerType:0,
}; };
}, },
watch: { watch: {
@ -318,6 +431,7 @@
}, },
onLoad(option) { onLoad(option) {
this.deviceId = option.id this.deviceId = option.id
this.fertilizerType=option.fertilizerType?option.fertilizerType:0
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
@ -342,12 +456,13 @@
}, },
methods: { methods: {
toWebView(id) { toWebView(id,url) {
// console.log(id); // console.log(id);
uni.navigateTo({ uni.navigateTo({
url: '/pages/web_view/web_view?id=' + id + '&deviceId=' + this.deviceId url: '/pages/web_view/web_view?id=' + id + '&deviceId=' + this.deviceId+ '&url=' + url
}) })
}, },
countData10(data) { countData10(data) {
if (data) { if (data) {
return data / 10 return data / 10
@ -376,8 +491,12 @@
this.inputData = res.data; this.inputData = res.data;
this.getData30() //30/ this.getData30() //30/
this.getData29() //29 / this.getData29() //29 /
this.getDataInfo2() this.getDataInfo2()
this.getcenterBottom() // this.getcenterBottom() //
//
this.getStirList()
this.getData81()
} else { } else {
that.$refs.uToast.show({ that.$refs.uToast.show({
title: res.msg, title: res.msg,
@ -388,7 +507,24 @@
}, },
//
getData81() {
var number = this.padString(this.inputData['81'].toString(2), 4)
var openListNew = []
openListNew = number.split("")
var stirList = openListNew.reverse();
this.openTypeStir = this.getType81(stirList)
},
getStirList() {
// var num = this.inputData['82']
var num = this.inputData['82']
var num1 = this.padString(num.toString(2), 8)
var openListNew = []
openListNew = num1.split("")
this.stirList = openListNew.reverse();
},
// //
getReadFs_byid(){ getReadFs_byid(){
let deviceId = this.deviceId; let deviceId = this.deviceId;
@ -489,6 +625,7 @@
} }
}) })
}, },
padString(str, length) { padString(str, length) {
return str.padStart(length, '0'); return str.padStart(length, '0');
}, },
@ -713,6 +850,21 @@
return '无' return '无'
} }
}, },
getType81(list) {
if(list[0]==1){
return '定时启动'
}else if(list[1]==1){
return '间隔启动'
}else if(list[2]==1){
return '联动启动'
}else if(list[3]==1){
return '手动启动'
}else{
return '无'
}
},
//countType //countType
//0 //0
//1-400 //1-400
@ -754,7 +906,97 @@
signalHandler(index) { signalHandler(index) {
this.signalCurrent = index this.signalCurrent = index
}, },
showStir(){
this.stirshow=true
var data = {
equipmentId: this.deviceId,
pattern: 600, // //6ph-
regNum: 36,
};
this.$http({
url: this.api.readFs_reg,
data: data
}).then((res) => {
if (res.code == 200) {
this.inputData2 = res.data;
this.inputData2New = JSON.parse(JSON.stringify(res.data));
this.getType600();
this.getActive1();
// this.inputData2New[603] = this.getData1(this.inputData2[603]);
this.inputData2[601] = this.countData10(this.inputData2[601]);
// this.inputData2[604] = this.countData10(this.inputData2[604]);
// this.inputData2[615] = this.countData10(this.inputData2[615]);
}
});
},
//
changeOpen(index) {
this.inputData2['600'] = index;
var dataNum = {
target: {
value: index,
},
};
this.getType600();
this.changeBtn('600', dataNum);
},
change600(index) {
var list = ["0", "0", "0"];
list[index] = "1";
this.topActive2 = list;
this.$forceUpdate();
var revList = list.slice().reverse();
var num = revList.join("");
var dataNum = {
target: {
value: parseInt(num, 2),
},
};
this.inputData2['600']=parseInt(num, 2)
this.changeBtn("600", dataNum);
},
getType600() {
var number = this.padString(this.inputData2["600"].toString(2), 3);
var openListNew = [];
openListNew = number.split("");
this.topActive2 = openListNew.reverse();
},
changeIndexOpen1(active) {
if (this.stirpopupList[active] == "1") {
this.stirpopupList[active] = "0";
} else {
this.stirpopupList[active] = "1";
}
this.$forceUpdate();
var revList = this.stirpopupList.slice().reverse();
var num = revList.join("");
var dataNum = {
target: {
value: parseInt(num, 2),
},
};
this.changeBtn(602, dataNum);
},
getActive1() {
this.stirpopupList = [];
var num = this.inputData2["602"];
var num1 = this.padString(num.toString(2), 8);
var openListNew = [];
openListNew = num1.split("");
this.stirpopupList = openListNew.reverse();
},
closeStirPop() {
// this.dataInit();
// this.getReg();
this.stirshow = false
},
showPop(index) { showPop(index) {
this.show = true this.show = true
this.indexs = index this.indexs = index
@ -848,25 +1090,60 @@
border-radius: 20rpx; border-radius: 20rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 20rpx; padding: 20rpx;
margin-top: 10rpx;
&.stir-value-popup{
width: 100%;
.title{
border-bottom: unset!important;
}
.detail{
width: 100%;
.item{
width: 100rpx;
}
}
}
.title { .title {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
>image { image {
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
margin-right: 16rpx; margin-right: 16rpx;
} }
>text { text {
font-size: 30rpx; font-size: 30rpx;
font-family: PingFang-SC-Bold; font-family: PingFang-SC-Bold;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
} }
.right {
display: flex;
align-items: center;
.set-text {
font-size: 30rpx;
font-family: PingFang-SC-Bold;
font-weight: bold;
color: #999999;
margin-right: 20rpx;
margin-left: 40rpx;
}
>image {
width: 16rpx;
height: 8rpx;
}
}
}
&.stir-value{
.detail .item{
width: 115rpx;
}
} }
.detail { .detail {
margin-top: 16rpx; margin-top: 16rpx;
display: flex; display: flex;
@ -888,6 +1165,10 @@
align-items: center; align-items: center;
margin: 5rpx 8rpx; margin: 5rpx 8rpx;
flex-shrink: 0; flex-shrink: 0;
&.active{
background: #24B383;
color: #fff;
}
} }
} }
} }
@ -1249,7 +1530,7 @@
} }
.control_model { .control_model {
height: 172rpx; // height: 172rpx;
// border-bottom: 1rpx solid #DDDDDD; // border-bottom: 1rpx solid #DDDDDD;
box-sizing: border-box; box-sizing: border-box;
padding: 30rpx; padding: 30rpx;
@ -1259,6 +1540,11 @@
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
display: flex;
align-items: center;
.model{
width: auto;
}
} }
.model { .model {

View File

@ -5,7 +5,7 @@
<view class="content"> <view class="content">
<template v-for="item,index in deviceList"> <template v-for="item,index in deviceList">
<view class="item" :key="index" v-if="item.equipmentName==1||item.equipmentName==20"> <view class="item" :key="index" v-if="item.deviceName==1||item.deviceName==20">
<image src="../../static/icon_precise.png" mode=""></image> <image src="../../static/icon_precise.png" mode=""></image>
<view class="center"> <view class="center">
<text>{{item.deviceTypeName}}</text> <text>{{item.deviceTypeName}}</text>
@ -86,7 +86,7 @@
}) })
}else{ }else{
uni.navigateTo({ uni.navigateTo({
url: '/pages/fertilizer_machine/fertilizer_machine?id=' + item.deviceId url: '/pages/fertilizer_machine/fertilizer_machine?id=' + item.deviceId+'&fertilizerType='+item.fertilizerType
}) })
} }
@ -96,15 +96,16 @@
getEquipmentInfo(userid) { getEquipmentInfo(userid) {
let that = this let that = this
this.$http({ this.$http({
url: this.api.sel_eqbyid + userid, url: this.api.sel_userbyid + userid,
method: 'GET' method: 'GET'
}).then(res => { }).then(res => {
// console.log(res, 'id'); // console.log(res, 'id');
if (res.code == 200) { if (res.code == 200) {
uni.hideLoading() uni.hideLoading()
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
this.deviceList = res.data; this.deviceList = res.data.devices;
this.deviceList = this.deviceList.filter(e=>e.equipmentName == 1||e.equipmentName == 20).sort((a,b)=>a.equipmentStatu - b.equipmentStatu) this.deviceList = this.deviceList.filter(e=>e.deviceName == 1||e.deviceName == 20).sort((a,b)=>a.equipmentStatu - b.equipmentStatu)
}else { }else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.msg, title: res.msg,

View File

@ -10,14 +10,16 @@
id:'', id:'',
src:'', src:'',
userid:'', userid:'',
deviceId:'' deviceId:'',
url:''
}; };
}, },
onLoad(options) { onLoad(options) {
// console.log('options',options); // console.log('options',options);
if(options){ if(options){
this.id = options.id; this.id = options.id;
this.deviceId = options.deviceId this.deviceId = options.deviceId;
this.url=options.url
} }
let that = this let that = this
uni.getStorage({ uni.getStorage({
@ -29,7 +31,7 @@
key:'userid', key:'userid',
success:function(res){ success:function(res){
that.userid = res.data that.userid = res.data
that.src = `https://portal.lihe-control.com/#/irrigateSet?id=${that.id}&token=${that.token}&userid=${that.userid}&deviceId=${that.deviceId}` that.src = `https://portal.lihe-control.com/#/${options.url}?id=${that.id}&token=${that.token}&userid=${that.userid}&deviceId=${that.deviceId}`
// console.log(that.src); // console.log(that.src);
} }
}) })