cultivationApp/pages/plantAdmin/breedDetail.vue

438 lines
11 KiB
Vue
Raw Normal View History

2023-12-20 18:13:01 +08:00
<template>
<view class="box">
<view class="content">
<view class="" style="display: flex;justify-content: space-between;margin-bottom: 20rpx;">
<view class="tit" style="margin-bottom: 0;">
栏舍监控数据
</view>
<view class="" style="display: flex;align-items: center;">
<u-icon name="clock" style="margin-right: 10rpx;"></u-icon>
<text style="color: #ACACAC;font-size: 25rpx;">刷新时间: {{getNowTimeFn()}} </text>
</view>
</view>
<view class="video" @click="navTo('/pages/live/live')">
<u--image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg" width="100%"
height="300rpx"></u--image>
</view>
<breedInfo :info='dataobj'></breedInfo>
<view class="add-btn">
<view class="add-thing" @click="addshowPicke(2)" style="width: 694rpx;">
新增喂养
</view>
</view>
<view class="">
<view class="tit tit-more" style="margin: 20rpx 0;">
<view>喂养信息</view>
<view class="more">查看更多 <u-icon name="arrow-right"></u-icon> </view>
</view>
<block class="" v-if="feedDataList.length>0">
<view class="thing-card" v-for="(item,index) in feedDataList" :key="index">
<view class="card_body">
<view class="left">
<u--image @click="perviewFn(item.img)" radius='10' :src="item.img" width="200rpx"
height="200rpx"></u--image>
</view>
<u--image src="/static/main/house/xia_yi_ji_btn.png" class="next" width="38rpx" height="38rpx"></u--image>
<view class="right" style="color: #7B7B7B;" @click="navtoForm(item,i)">
<view class="r-item">
<view class="item-title">操作类型:</view>
<view>喂食</view>
</view>
<view class="r-item">
<view class="item-title">操作人员:</view>
<view>赵桑</view>
</view>
<view class="r-item">
<view class="item-title">操作日期:</view>
<view>2023-12-20</view>
</view>
<view class="r-item" style="height: 80rpx;">
<view class="item-title">备注:</view>
<view class="row2">栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号栏舍一号</view>
</view>
</view>
</view>
</view>
</block>
<view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
</view>
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="selectList" title="请选择"
@close="show = false" @select="selectOne">
</u-action-sheet>
</view>
</view>
</template>
<script setup>
import breedInfo from "@/components/plant/breedInfo.vue"
import {
ref,
reactive
} from "vue"
import {
plantlist,
landdetail
} from '@/api/api.js'
import {
onLoad,
onShow
} from "@dcloudio/uni-app"
const dataList = reactive([{
name: '栏舍一号',
img: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg',
animal_name: '山羊',
animal_type: '哺乳动物',
capacity: '50只',
create_by: '张三',
create_time: '2023-12-19',
qr_code: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/76751202312201347169905.png',
showCode: false
}])
const feedDataList = reactive([{
name: '栏舍一号',
img: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg',
animal_name: '山羊',
animal_type: '哺乳动物',
capacity: '50只',
create_by: '张三',
create_time: '2023-12-19',
qr_code: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/76751202312201347169905.png',
showCode: false
}])
const dataobj = reactive({})
const typeID = ref('')
const columns = reactive([
[{
label: '种植',
route: "/pages/husbandryForm/sow"
}, {
label: '施肥',
route: "/pages/husbandryForm/fertilize"
}, {
label: '除草',
route: "/pages/husbandryForm/weeding"
}, {
label: '灌溉',
route: "/pages/husbandryForm/irrigate"
}, {
label: '除虫',
route: "/pages/husbandryForm/Pest"
}, {
label: '收获',
route: "/pages/husbandryForm/harvest"
}]
]);
onLoad((option) => {
typeID.value = option.id;
});
onShow(() => {
// getlist();
// getlist1();
})
const getlist1 = () => {
landdetail({
land_id: typeID.value
}).then((res) => {
if (res.code == 1) {
Object.assign(dataobj, res.data);
}
});
};
const getlist = () => {
plantlist({
land_id: typeID.value
}).then((res) => {
if (res.code == 1) {
dataList.splice(0, dataList.length, ...res.data);
dataList.forEach(item => {
item.showCode = false
})
console.log(dataList)
}
});
};
const show = ref(false);
const selectList = ref([]);
const navType = ref(1);
//新增种植
const addshowPicke = (type=1) => {
if(type==1){
selectList.value = [
{name: '购买'},
{name: '自繁'},
];
}else {
selectList.value = [
{name: '喂食'},
{name: '喂水'},
{name: '消毒'},
{name: '疫苗'},
{name: '驱虫'},
];
}
navType.value = type;
show.value = true;
}
const selectOne = (e)=>{
if(navType.value==1){
navTo(`/pages/plantAdmin/addBreed?name=${e.name}&type=${e.name=='购买'?1:2}`)
2023-12-21 16:29:58 +08:00
}else {
if(e.name=='喂食') return navTo(`/pages/feed/feed?id=23`);
if(e.name=='喂水') return navTo(`/pages/feed/water?id=23`);
if(e.name=='消毒') return navTo(`/pages/feed/sterilize?id=23`);
if(e.name=='疫苗') return navTo(`/pages/feed/vaccine?id=23`);
if(e.name=='驱虫') return navTo(`/pages/feed/expelling?id=23`);
2023-12-20 18:13:01 +08:00
}
}
//跳转
const navTo = (url) => {
uni.navigateTo({
url
})
}
const navtoForm = (item, type) => {
uni.navigateTo({
url: '/pages/landDetail/tudi?data=' + item.id
})
}
const getNowTimeFn = () => {
const now = new Date();
const hour = now.getHours();
const minute = now.getMinutes();
const formattedHour = hour < 10 ? '0' + hour : hour;
const formattedMinute = minute < 10 ? '0' + minute : minute;
const currentTime = formattedHour + ':' + formattedMinute;
return currentTime
}
//查看
const perviewFn = (url) => {
uni.previewImage({
urls: [url]
})
}
let img = ''
let codeImg = ''
const showCodeFn = (i) => {
// dataList[i].showCode != dataList[i].showCode
dataList[i].showCode = !dataList[i].showCode
console.log(dataList[i].showCode)
}
</script>
<style lang="scss" scoped>
.box {
width: 750rpx;
min-height: 100vh;
background-color: $theme-bg-color;
padding: 0;
.content {
width: 693.93rpx;
margin: auto;
padding-top: 20rpx;
.add-btn {
display: flex;
justify-content: space-between;
}
.add-thing {
height: 90rpx;
width: 335rpx;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
line-height: 90rpx;
text-align: center;
color: white;
background-color: $theme-main-color;
}
}
// padding: 20rpx;
.time {
display: flex;
font-size: 26.29rpx;
color: #737373;
margin-top: 10rpx;
}
.video {
// margin-top: 10rpx;
border-radius: 14rpx;
overflow: hidden;
}
}
.coneng-detail {
width: 478rpx;
height: 341rpx;
// background: #FFFFFF;
border-radius: 6px 6px 6px 6px;
opacity: 1;
font-size: 25rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #737373;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 70rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
}
}
.thing-card {
width: 693.93rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
margin-bottom: 30rpx;
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
.head {
height: 90rpx;
border-radius: 20rpx 20rpx 0 0;
background-color: $theme-main-color;
display: flex;
justify-content: space-between;
line-height: 90rpx;
color: white;
padding: 0 30rpx;
}
.card_body {
padding: 20rpx;
display: flex;
position: relative;
.next {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 20rpx;
}
.left {
flex-shrink: 0;
position: relative;
.qr-code{
position: absolute;
right: 10rpx;
bottom: 10rpx;
}
}
.right {
flex: 1;
display: flex;
justify-content: space-between;
flex-direction: column;
margin-left: 20rpx;
.name {
font-weight: bold;
color: #333;
}
.r-item {
font-size: 28rpx;
display: flex;
.item-title {
color: #333;
flex-shrink: 0;
margin-right: 10rpx;
}
.row2 {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 2;
/* 设置为需要显示的行数 */
}
}
}
}
}
.tit {
position: relative;
padding-left: 20rpx;
font-weight: bold;
margin-bottom: 20rpx;
}
.tit-more {
display: flex;
justify-content: space-between;
align-items: center;
.more {
display: flex;
font-size: 28rpx;
font-weight: 400;
}
}
.tit::before {
content: "";
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
width: 3px;
/* 左边框的宽度 */
height: 30rpx;
background-color: #FFB049;
}
.code-btn {
border: 1px solid $theme-main-color;
border-radius: 30rpx;
padding: 3rpx 20rpx;
color: $theme-main-color;
position: absolute;
right: 20rpx;
}
.actBtn {
background: linear-gradient(to right, #FEFFFF 0%, #E8FAF2 100%);
}
</style>