cultivationApp/components/index/chick.vue

323 lines
6.7 KiB
Vue
Raw Normal View History

2023-10-23 17:57:19 +08:00
<template>
<view class="content">
2023-10-27 18:38:25 +08:00
<farmersCard></farmersCard>
2023-10-23 17:57:19 +08:00
<view class="circumstance">
<view class="card-tit">
<view class="">
养殖情况
</view>
</view>
2023-10-25 19:55:18 +08:00
<view class="card" v-for="(item,index) in animalList" :key="index"
@click="navgo(`/pages/poultry/feedDetail?id=${item.id}`)">
2023-10-23 17:57:19 +08:00
<view class="tit">
<view class="">
2023-10-25 19:55:18 +08:00
编号: {{item.code}}
2023-10-23 17:57:19 +08:00
</view>
2023-10-25 19:55:18 +08:00
<view class="" style="color: #00A15E;" v-if='item.status==1'>
2023-10-23 17:57:19 +08:00
健康
</view>
2023-10-25 19:55:18 +08:00
<view class="" style="color: #FFD736;" v-if='item.status==2'>
产蛋期
</view>
<view class="" style="color: #3274F9;" v-if='item.status==4'>
可出栏
</view>
<view class="" style="color: #F84221;" v-if='item.status==3'>
生病隔离中
</view>
2023-10-23 17:57:19 +08:00
</view>
<view class="card-li">
<view class="">
2023-10-30 19:09:40 +08:00
养殖类型: {{item.gender==1?"公":"母"}}
2023-10-23 17:57:19 +08:00
</view>
<view class="">
2023-10-25 19:55:18 +08:00
年龄: {{item.age}}
2023-10-23 17:57:19 +08:00
</view>
<view class="">
2023-10-25 19:55:18 +08:00
体重: {{item.weight}}kg
2023-10-23 17:57:19 +08:00
</view>
</view>
</view>
2023-10-25 19:55:18 +08:00
<view class="check" @click="navgo('/pages/poultry/feedList')">
2023-10-23 17:57:19 +08:00
查看全部养殖动物<u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx"
height="31.54rpx"></u--image>
</view>
</view>
2023-10-25 19:55:18 +08:00
<view class="circumstance" v-for="(item,index) in actionList" :key="index">
<!-- {{item.action_record}} -->
2023-10-23 17:57:19 +08:00
<view class="card-tit">
<view class="">
2023-10-25 19:55:18 +08:00
{{index}}
2023-10-23 17:57:19 +08:00
</view>
2023-10-30 19:09:40 +08:00
<view class="updata-btn" @click="navgo(`/pages/growRecord/chick?type=2&title=${index}`)">
2023-10-25 19:55:18 +08:00
更新{{index.slice(0,-2)}}
2023-10-23 17:57:19 +08:00
</view>
</view>
2023-10-30 19:09:40 +08:00
<myTable :tit='`查看${index.slice(0,-2)}`' :dataList="item.action_record"
:route='`/pages/poultry/allRecording?index=${index}`'>
2023-10-25 19:55:18 +08:00
</myTable>
2023-10-23 17:57:19 +08:00
</view>
2023-10-25 19:55:18 +08:00
<!-- <view class="circumstance">
2023-10-23 17:57:19 +08:00
<view class="card-tit">
<view class="">
消毒情况
</view>
2023-10-25 19:55:18 +08:00
<view class="updata-btn" @click="navgo('/pages/growRecord/index')">
2023-10-23 17:57:19 +08:00
更新消毒情况
</view>
</view>
2023-10-25 19:55:18 +08:00
<myTable tit='查看历史消毒记录' route='/pages/poultry/allRecording'></myTable>
</view> -->
2023-10-23 17:57:19 +08:00
<view class="data">
<view class="tit">
<view class="" style="display: flex;justify-content: space-between;font-size: 29.79rpx;">
<view class="">
环境监测数据
</view>
</view>
<view class="tit-b">
<u--image :src="urlFn('sj')" style="margin: 0 5rpx;" width="28.04rpx" height="28.04rpx"></u--image>
<text>刷新时间: 2022-3-3</text>
</view>
</view>
<view class="data-cont">
<view class="data-cont-li center" v-for="(item,index) in data " :key="index">
<view style="margin:0 20rpx">
<view class="center">
<u--image :src="urlFn(item.icon)" style="margin: 0 5rpx;" width="38.55rpx"
height="38.54rpx"></u--image>
{{item.tit}}
</view>
<view class="b-cls">
<view class="" :style="{color:item.flag?'#0095FF':''}">
<text style=" font-size: 70.09rpx;">
{{baseData[item.cont]}}
</text>{{item.dw}}
</view>
<view class="" style="display: flex;align-items: center;" v-if="item.flag">
<u--image :src="urlFn('D')" style="margin: 0 5rpx;" width="31.54rpx" height="31.54rpx">
</u--image>
<text style="color: #0095FF;">5</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
reactive
} from "vue"
import myTable from "@/components/myTable/index.vue"
2023-10-27 18:38:25 +08:00
import farmersCard from "@/components/poultry/farmersCard.vue"
2023-10-25 19:55:18 +08:00
import {
onLoad
} from "@dcloudio/uni-app"
import {
animalListAPI,
animalEnvDataAPI,
actionsAPI
} from "@/api/chick.js"
const props = defineProps({
userInfo: Object
})
const userInfo = reactive(props.userInfo)
2023-10-23 17:57:19 +08:00
const data = reactive([{
tit: "环境温度",
2023-10-25 19:55:18 +08:00
icon: 'WD',
2023-10-23 17:57:19 +08:00
dw: "℃",
2023-10-25 19:55:18 +08:00
cont: 'hj_temp',
2023-10-23 17:57:19 +08:00
flag: false,
}, {
tit: "环境湿度",
2023-10-25 19:55:18 +08:00
icon: 'JYL',
2023-10-23 17:57:19 +08:00
dw: "%RH",
2023-10-25 19:55:18 +08:00
cont: 'hj_humi',
2023-10-23 17:57:19 +08:00
}, {
tit: "氧气浓度",
icon: 'FX',
2023-10-25 19:55:18 +08:00
cont: 'o_content',
dw: "%",
2023-10-23 17:57:19 +08:00
}, {
tit: "二氧化碳含量",
icon: 'FS',
2023-10-25 19:55:18 +08:00
dw: "mg/L",
cont: 'c_content',
2023-10-23 17:57:19 +08:00
}, {
tit: "光照强度",
icon: 'JYL',
2023-10-25 19:55:18 +08:00
dw: "lux",
cont: 'light',
2023-10-23 17:57:19 +08:00
}, {
tit: "大气压强",
icon: 'GZ',
2023-10-25 19:55:18 +08:00
dw: "hpa",
cont: 'dqy',
2023-10-23 17:57:19 +08:00
}, {
tit: "有害气体",
icon: 'EYHT',
2023-10-25 19:55:18 +08:00
cont: 'yhqt',
2023-10-23 17:57:19 +08:00
},
])
const baseData = reactive({
2023-10-25 19:55:18 +08:00
2023-10-23 17:57:19 +08:00
})
const urlFn = (name) => {
return `/static/img/${name}.png`
}
const img = (w, h, m) => {
return `width:${w}rpx;height:${h};margin:0 ${m}rpx `
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
2023-10-25 19:55:18 +08:00
const animalList = reactive([])
animalListAPI({
user_id: 307,
page_no: 1,
page_size: 3,
}).then(res => {
res.data.forEach(item => {
animalList.push(item)
})
2023-10-28 18:28:10 +08:00
// console.log(animalList)
2023-10-30 19:09:40 +08:00
2023-10-25 19:55:18 +08:00
})
animalEnvDataAPI({
user_id: 307
}).then(res => {
for (let key in res.data) {
baseData[key] = (res.data)[key]
}
})
const actionList = reactive({})
2023-10-26 19:02:26 +08:00
actionsAPI({
type: 2
}).then(res => {
for (let key in res.data) {
actionList[key] = (res.data)[key]
}
})
2023-10-23 17:57:19 +08:00
</script>
<style lang="scss" scoped>
.circumstance {
width: 693.93rpx;
margin: 0 auto;
margin-bottom: 43rpx;
.card-tit {
display: flex;
justify-content: space-between;
margin-bottom: 28rpx;
}
.updata-btn {
font-size: 26.29rpx;
2023-10-25 19:55:18 +08:00
// width: 192.76rpx;
padding: 0 30rpx;
2023-10-23 17:57:19 +08:00
height: 57.83rpx;
border: 1px solid #00A15E;
color: #00A15E;
display: flex;
justify-content: center;
align-items: center;
border-radius: 31.54rpx 31.54rpx 31.54rpx 31.54rpx;
}
.check {
font-size: 29.79rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.tab {
height: 500rpx;
background-color: red;
}
}
.card {
.tit {
display: flex;
justify-content: space-between;
padding-bottom: 20rpx;
border-bottom: 1px solid #EBF1EF;
}
.card-li {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
}
}
.data {
.tit {
.tit-b {
color: #B3B3B3;
font-size: 26.29rpx;
display: flex;
align-items: center;
}
}
.data-alanys {
// background-color: blue;
float: right;
color: white;
}
.data-cont {
// margin: 20rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 30rpx;
box-sizing: border-box;
// padding: 70rpx;
.data-cont-li {
border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx;
width: 310.94rpx;
height: 212.03rpx;
background-color: white;
margin-bottom: 20rpx;
}
}
}
.center {
display: flex;
align-items: center;
}
.b-cls {
display: flex;
align-items: flex-end;
width: 250rpx;
justify-content: space-between;
color: #4CC593;
}
</style>