cultivationApp/components/plant/breedInfo.vue

156 lines
3.9 KiB
Vue
Raw Normal View History

2023-12-20 18:13:01 +08:00
<template>
<view class="" style="margin-top: 10rpx;">
2024-01-30 18:31:10 +08:00
<view v-if="info.fenceHouseAttr" class="" style="display: flex;align-items: center;height: 60rpx;">
2023-12-20 18:13:01 +08:00
<u-icon name="map"></u-icon>
2024-01-30 18:31:10 +08:00
{{info.fenceHouseAttr.fence_house_name}}
2023-12-20 18:13:01 +08:00
</view>
<view class="info">
2024-02-21 18:23:37 +08:00
<view class="info-li" style="background-image: url('/static/main/animal/er_hao.png');">
2023-12-20 18:13:01 +08:00
耳号
<view class="">
2024-01-30 18:31:10 +08:00
{{info.sn}}
2023-12-20 18:13:01 +08:00
</view>
</view>
2024-02-21 18:23:37 +08:00
<view class="info-li" style="background-image: url('/static/main/animal/pin_lei.png');">
2023-12-20 18:13:01 +08:00
品类
<view class="">
2024-01-30 18:31:10 +08:00
{{getAnimalType(info.animal_type)}}
2023-12-20 18:13:01 +08:00
</view>
</view>
2024-02-21 18:23:37 +08:00
<view class="info-li" style="background-image: url('/static/main/animal/pin_zhong.png');">
2023-12-20 18:13:01 +08:00
品种
<view class="">
2024-01-30 18:31:10 +08:00
{{info.brand}}
2023-12-20 18:13:01 +08:00
</view>
</view>
2024-02-21 18:23:37 +08:00
<view class="info-li" @click="showInputDialog('physi_stage', info.physi_stage)" style="background-image: url('/static/main/animal/sheng_li_jie_duan.png');">
2023-12-20 18:13:01 +08:00
生理阶段
<view class="">
2024-02-21 18:23:37 +08:00
<uni-icons type="compose" size="20"></uni-icons>{{info.physi_stage}}
2023-12-20 18:13:01 +08:00
</view>
</view>
2024-02-21 18:23:37 +08:00
<view class="info-li" @click="showInputDialog('current_estimation', info.current_estimation)" style="background-image: url('/static/main/animal/ti_zhong.png');">
2023-12-20 18:13:01 +08:00
体重
<view class="">
2024-02-21 18:23:37 +08:00
<uni-icons type="compose" size="20"></uni-icons>{{info.current_estimation}}kg
2023-12-20 18:13:01 +08:00
</view>
</view>
2024-02-21 18:23:37 +08:00
<view class="info-li" style="background-image: url('/static/main/animal/jian_kang_zhuang_kuang.png');">
体温
2023-12-20 18:13:01 +08:00
<view class="">
2024-02-21 18:23:37 +08:00
{{ info.temperature || '--' }}
2023-12-20 18:13:01 +08:00
</view>
2024-02-21 18:23:37 +08:00
</view>
<!-- <view class="info-li-d"></view> -->
2023-12-20 18:13:01 +08:00
</view>
2024-02-21 18:23:37 +08:00
<u-modal :show="show" :title="editType=='current_estimation'?'修改体重':'修改生理阶段'" showConfirmButton showCancelButton @confirm="dialogInputConfirm" @cancel="show = false">
<u-input v-model="editValue" :type="editType=='current_estimation'?'number':'text'"></u-input>
</u-modal>
2023-12-20 18:13:01 +08:00
</view>
</template>
<script setup>
import {
reactive,
2024-01-30 18:31:10 +08:00
watch,
ref
2023-12-20 18:13:01 +08:00
} from "vue";
2024-01-30 18:31:10 +08:00
import {
animalTypeLists
} from "@/api/dict.js"
2024-02-21 18:23:37 +08:00
import {
animalInfoEdit
} from "@/api/manage.js"
2024-01-30 18:31:10 +08:00
2023-12-20 18:13:01 +08:00
const props = defineProps({
info: Object,
isDetail: Boolean
})
2024-01-30 18:31:10 +08:00
2024-02-21 18:23:37 +08:00
const emit = defineEmits(['getFenceHouseDetail']);
console.log(props.info);
2024-01-30 18:31:10 +08:00
const animal_type_lists = ref([])
const initAnimalTypeLists = ()=>{
animalTypeLists().then(res=>{
animal_type_lists.value = res.data;
})
}
initAnimalTypeLists();
const getAnimalType = (type)=>{
return animal_type_lists.value.find(item=>item.value==type)?.name||'';
}
2024-02-21 18:23:37 +08:00
const show = ref(false);
const editType = ref('');
const editValue = ref('');
const showInputDialog = (type, value)=>{
editType.value = type;
editValue.value = value;
show.value = true;
}
const dialogInputConfirm = (e)=>{
if(editValue.value=='') return show.value = false;
let obj = JSON.parse(JSON.stringify(props.info));
obj[editType.value] = editValue.value;
animalInfoEdit(obj).then(res=>{
// props.info[editType.value] = editValue.value;
emit('getFenceHouseDetail')
show.value = false;
}).catch(err=>{
})
}
2023-12-20 18:13:01 +08:00
const perviewFn = (url) => {
uni.previewImage({
urls: [url]
})
}
</script>
<style lang="scss" scoped>
.info {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.info-li {
width: 223rpx;
height: 129rpx;
border-radius: 10rpx;
background-size: 100% 100%;
padding: 20rpx;
margin-bottom: 20rpx;
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
}
.info-li-d {
width: 223rpx;
height: 129rpx;
border-radius: 10rpx;
padding: 20rpx;
margin-bottom: 20rpx;
}
}
.card {
// width: 710rpx;
margin: 0 auto;
.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;
}
}
</style>