加入iccid

This commit is contained in:
home孙 2025-06-10 17:32:16 +08:00
parent 102f062f97
commit 190da084da
3 changed files with 136 additions and 42 deletions

View File

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

View File

@ -16,6 +16,10 @@ let api = {
getFs_rtdata: "/getFs/rtdata", //主页查看施肥机实时数据
selFs_time: "/selFs/time", //主页查看施肥机历史数据
sel_eqbyid: "/sel/eqbyid/", //根据用户id查询对应的设备数据
sel_userbyid: "/sel/userbyid/", //根据用户id查询对应的设备数据
qibenGeticcid: "/qiben/geticcid", //获取物联网卡号
popupwindow: "/qiben/popupwindow", //获取物联网卡号是否弹窗
chart_fsdata: "/chart/fsdata", //实时数据折线图
user_update_pwd: "/user/update/pwd", //用户修改密码

View File

@ -28,8 +28,8 @@
<template v-for="item0 in weatherList">
<view class="waterAndFertilizerParams" :key="item0.id">
<view class="nav">
<image src="../../static/PH.png" mode=""></image>
<text>{{item0.deviceName}}</text>
<view class="name"><image src="../../static/PH.png" mode=""></image>
<text>{{item0.deviceName}}</text></view>
</view>
<view class="detail">
<view class="item" v-for="item,index in item0.weatherListChild" :key="index"
@ -58,9 +58,11 @@
<template v-for="item0 in equipmentName30List">
<view class="waterAndFertilizerParams" :key="item0.id">
<view class="nav">
<view class="name">
<image src="../../static/PH.png" mode=""></image>
<text>{{item0.deviceTypeName}}</text>
</view>
</view>
<view class="detail">
<view class="item" v-for="item,index in item0.equipmentName30ListChild" :key="index"
@click="toTarget_water_fertilizer_PH(item.equipmentId,item.environmentData,item.environmentDataId,item.equipmentNumber,item.targetValue,getTypeList(item.formula),item.equipmentName,1)">
@ -86,10 +88,14 @@
<!-- 智能灌溉 -->
<template v-for="item0 in equipmentName20List">
<view class="waterAndFertilizerParams" :key="item0.id">
<view class="nav">
<view class="nav iccid-nav">
<view class="name">
<image src="../../static/PH.png" mode=""></image>
<text>{{item0.deviceTypeName}}</text>
</view>
<view class="iccid">卡号:{{item0.iccidcode}}<br>
到期时间:<text :class="getPackageTimeColor(item0.iccidcode)?'color-red':''">{{getPackageTime(item0.iccidcode)}}<text v-if="getPackageTimeColor(item0.iccidcode)">(即将到期)</text></text></view>
</view>
<view class="detail">
<view class="item" v-for="item,index in item0.equipmentName20ListChild" :key="index"
@click="toTarget_water_fertilizer_PH(item.equipmentId,item.environmentData,item.environmentDataId,item.equipmentNumber,item.targetValue,getTypeList(item.formula),item.equipmentName,2)">
@ -114,9 +120,13 @@
</template>
<view class="waterAndFertilizerParams" v-for="(item1,index1) in waterAndFertilizerParamsList" :key="index1">
<view class="nav">
<view class="nav iccid-nav">
<view class="name">
<image src="../../static/PH.png" mode=""></image>
<text>{{ item1.deviceTypeName }}</text>
</view>
<view class="iccid">卡号:{{item1.iccidcode}}<br>
到期时间:<text :class="getPackageTimeColor(item1.iccidcode)?'color-red':''">{{getPackageTime(item1.iccidcode)}}<text v-if="getPackageTimeColor(item1.iccidcode)">(即将到期)</text></text></view>
</view>
<view class="detail">
<view class="item" v-for="(item2,index2) in item1.childList_mubiao" :key="index2"
@ -368,10 +378,14 @@
<!-- 数据采集器 -->
<template v-for="item0 in equipmentName40List">
<view class="waterAndFertilizerParams" :key="item0.id">
<view class="nav">
<view class="nav iccid-nav">
<view class="name">
<image src="../../static/PH.png" mode=""></image>
<text>{{item0.deviceTypeName}}</text>
</view>
<view class="iccid">卡号:{{item0.iccidcode}}<br>
到期时间:<text :class="getPackageTimeColor(item0.iccidcode)?'color-red':''">{{getPackageTime(item0.iccidcode)}}<text v-if="getPackageTimeColor(item0.iccidcode)">(即将到期)</text></text></view>
</view>
<view class="detail">
<view class="item" v-for="item,index in item0.equipmentName40ListChild" :key="index"
@click="toTarget_water_fertilizer_PH(item.equipmentId,item.environmentData,item.environmentDataId,item.equipmentNumber,item.targetValue,getTypeList(item.formula),item.equipmentName,2)">
@ -394,7 +408,7 @@
</view>
</view>
</template>
<u-toast ref="uToast" />
</view>
</view>
</template>
@ -403,6 +417,8 @@
export default {
data() {
return {
// iccid
iccidList:[],
//
background: {
backgroundColor: 'transparent',
@ -545,7 +561,7 @@
uni.getStorage({
key: 'token',
success: function(res) {
that.getEquipmentInfo(uni.getStorageSync('userid'));
that.getEquipmentInfo(uni.getStorageSync('userid'),true);
that.getcontrol_geteqetdata(uni.getStorageSync('userid'))
},
fail: function(err) {
@ -563,7 +579,7 @@
uni.getStorage({
key: 'token',
success: function(res) {
that.getEquipmentInfo(uni.getStorageSync('userid'))
that.getEquipmentInfo(uni.getStorageSync('userid'),false)
that.getcontrol_geteqetdata(uni.getStorageSync('userid'))
},
})
@ -581,7 +597,7 @@
uni.getStorage({
key: 'token',
success: function(res) {
that.getEquipmentInfo(uni.getStorageSync('userid'))
that.getEquipmentInfo(uni.getStorageSync('userid'),true)
that.getcontrol_geteqetdata(uni.getStorageSync('userid'))
},
})
@ -607,30 +623,34 @@
},
methods: {
// id
getEquipmentInfo(userid) {
getEquipmentInfo(userid,selTrue) {
let that = this
// uni.showLoading({
// title: '...'
// });
this.$http({
url: this.api.sel_eqbyid + userid,
url: this.api.sel_userbyid + userid,
// url: this.api.sel_eqbyid + '1730755572975824896',
method: 'GET'
}).then(res => {
}).then(res1 => {
// console.log(res, 'id');
if (res.code == 200) {
if (res1.code == 200) {
this.equipmentName30List = [];
this.equipmentName20List = [];
res.data.forEach(el => {
// id
if(selTrue){
this.getQibenGeticcid(res1.data.devices)
}
res1.data.devices.forEach(el => {
//
if (el.equipmentName == 30) {
if (el.deviceName == 30) {
this.equipmentName30List.push(el)
}
if (el.equipmentName == 20) {
if (el.deviceName == 20) {
this.equipmentName20List.push(el)
}
//
if (el.equipmentName == 40) {
if (el.deviceName == 40) {
this.equipmentName40List.push(el)
}
})
@ -645,7 +665,7 @@
if (this.equipmentName20List.length != 0) {
this.getFi_rtdata()
}
this.waterAndFertilizerParamsList = res.data.map((item, index) => {
this.waterAndFertilizerParamsList = res1.data.devices.map((item, index) => {
return {
...item,
childList: [],
@ -757,22 +777,71 @@
})
// equipmentName==1
let waterAndFertilizerParamsList_1 = this.waterAndFertilizerParamsList.filter(e => e
.equipmentName == 1).sort((a, b) => a.equipmentStatu - b.equipmentStatu)
.deviceName == 1).sort((a, b) => a.equipmentStatu - b.equipmentStatu)
// equipmentName==10
let waterAndFertilizerParamsList_10 = this.waterAndFertilizerParamsList.filter(e => e
.equipmentName == 10).sort((a, b) => a.equipmentStatu - b.equipmentStatu);
.deviceName == 10).sort((a, b) => a.equipmentStatu - b.equipmentStatu);
// console.log(waterAndFertilizerParamsList_1,waterAndFertilizerParamsList_10,'00000000000');
this.waterAndFertilizerParamsList = [...waterAndFertilizerParamsList_1, ...
waterAndFertilizerParamsList_10
];
// console.log(this.waterAndFertilizerParamsList, 'this.waterAndFertilizerParamsList');
}
})
},
getQibenGeticcid(devicesList){
var data=devicesList.map(device => ({
deviceId: device.deviceId,
iccid: device.iccidcode,
deviceName: device.deviceTypeName
}));
var iccidList=[]
this.$http({
url: this.api.popupwindow,
data: {userId:uni.getStorageSync('userid')},
method: 'GET'
}).then(res1=>{
data.forEach((el,index)=>{
this.$http({
url: this.api.qibenGeticcid ,
data: el,
method: 'POST'
}).then(res=>{
if(res.code==200){
iccidList.push(res.data)
this.iccidList=iccidList
if(res1.data&&res.data.expired){
setTimeout(() => {
this.$refs.uToast.show({
title: `${res.data.deviceName}卡号为${res.data.iccid},物联网卡即将到期,剩余时间${res.data.daysDifference}天,请联系管理员。`,
type: 'default',
duration:10000
})
}, 10);
}
}
})
})
})
},
getPackageTime(iccidcode){
var item= this.iccidList.find(item=>item.iccid==iccidcode)
return item? item.packageTime:'无数据'
},
getPackageTimeColor(iccidcode){
var item= this.iccidList.find(item=>item.iccid==iccidcode)
return item? item.expired:false
},
// 线
toTarget_water_fertilizer_PH(id, data, name, equipmentNumber, targetValue, unit, equipmentName, flag) {
uni.navigateTo({
@ -1006,6 +1075,9 @@
</script>
<style lang="scss" scoped>
.color-red{
color: red!important;
}
.timeEnvironment {
width: 100%;
min-height: 100vh;
@ -1088,18 +1160,36 @@
display: flex;
align-items: center;
border-bottom: 1rpx solid #DDDDDD;
>image {
&.iccid-nav{
display: flex;
align-items: center;
justify-content: space-between;
}
.name{
image {
width: 50rpx;
height: 50rpx;
margin-right: 16rpx;
}
>text {
font-size: 30rpx;
text {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: bold;
color: #333333;
white-space: nowrap;
}
display: flex;
align-items: center;
}
.iccid{
display: block;
font-size: 24rpx;
text{
font-weight: normal;
}
}
}