页面完善

This commit is contained in:
zmj 2023-10-26 20:18:04 +08:00
parent 539915a6f7
commit c007d53926
9 changed files with 105 additions and 52 deletions

View File

@ -16,3 +16,8 @@ export const animalInfoAPI = (data) => syhttp.get('/AnimalBreed/animalInfo', dat
export const animalPicListAPI = (data) => syhttp.get('/PoultryBreed/poultryPicList', data) export const animalPicListAPI = (data) => syhttp.get('/PoultryBreed/poultryPicList', data)
// 上传动物图片 // 上传动物图片
export const addAnimalPicAPI = (data) => syhttp.post('/PoultryBreed/addPoultryPic', data) export const addAnimalPicAPI = (data) => syhttp.post('/PoultryBreed/addPoultryPic', data)
// 家禽详情
export const poultryInfoAPI = (data) => syhttp.get('/PoultryBreed/poultryInfo', data)
// 更新状态
export const poultryStatusAPI = (data) => syhttp.post('/PoultryBreed/poultryStatus', data)
// /api/PoultryBreed/poultryPicList

View File

@ -7,7 +7,7 @@
<u--image :src="urlFn('sj')" style="margin: 0 5rpx;" width="28.04rpx" height="28.04rpx"></u--image> <u--image :src="urlFn('sj')" style="margin: 0 5rpx;" width="28.04rpx" height="28.04rpx"></u--image>
<text>刷新时间:{{dateFn()}}</text> <text>刷新时间:{{dateFn()}}</text>
</view> </view>
<view style="display: flex;" @click="navgo('/pages/allPlant/index')"> <view style="display: flex;" @click="navgo(`/pages/feedIng/histroyFeed?id=${animal_id}`)">
查看历史条件 <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx" 查看历史条件 <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx"
height="31.54rpx"></u--image> height="31.54rpx"></u--image>
</view> </view>
@ -67,6 +67,12 @@
<script setup> <script setup>
import myTable from "@/components/myTable/index.vue" import myTable from "@/components/myTable/index.vue"
import imgCard from "@/components/imgCard.vue" import imgCard from "@/components/imgCard.vue"
import {
ref
} from "vue"
import {
onLoad
} from "@dcloudio/uni-app"
const urlFn = (name) => { const urlFn = (name) => {
return `/static/img/${name}.png` return `/static/img/${name}.png`
} }
@ -90,8 +96,11 @@
var dateStr = year + '-' + month + '-' + day; var dateStr = year + '-' + month + '-' + day;
return dateStr return dateStr
// //
} }
const animal_id = ref(0)
onLoad((option) => {
animal_id.value = option.id
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,6 +1,5 @@
<template> <template>
<view class="content" @click.capture="selectAct=false"> <view class="content" @click.capture="selectAct=false">
<view class="card"> <view class="card">
<view class="tit"> <view class="tit">
<view class=""> <view class="">

View File

@ -47,7 +47,8 @@
搜索 搜索
</view> </view>
</view> </view>
<view class="card" v-for="(item,index) in animalList" :key="index" @click="navgo('/pages/feedIng/feedDetail')"> <view class="card" v-for="(item,index) in animalList" :key="index"
@click="navgo(`/pages/feedIng/feedDetail?id=${item.id}`)">
<view class="tit"> <view class="tit">
<view class=""> <view class="">
编号: {{item.animal_code}} 编号: {{item.animal_code}}

View File

@ -41,14 +41,10 @@
</view> </view>
<view class=""> <view class="">
<view class="">
今日养殖状态
</view>
<imgCard></imgCard>
<view class=""> <view class="">
养殖情况 养殖情况
</view> </view>
<imgCard v-for="(item,index) in imgList" :imgUrl='item.pic' :key="index"></imgCard> <imgCard v-for="(item,index) in imgList" :imgUrl='item' :key="index" @tap='previewImage(index)'></imgCard>
</view> </view>
<view class="up-plant-btn" @click="updateImgFn"> <view class="up-plant-btn" @click="updateImgFn">
@ -73,13 +69,15 @@
reactive, reactive,
ref ref
} from "vue"; } from "vue";
const img = ref("")
const updateImgFn = () => { const updateImgFn = () => {
uplodeImg().then(res => { uplodeImg().then(res => {
img.value = res.data.image
addAnimalPicAPI({ addAnimalPicAPI({
animal_id: Number(animal_id.value), animal_id: Number(animal_id.value),
pic: res.data.image pic: res.data.image
}).then(res => { }).then(res => {
console.log(res) imgList.unshift(img.value)
}) })
}) })
} }
@ -91,11 +89,18 @@
animal_id: option.id animal_id: option.id
}).then(res => { }).then(res => {
res.data.forEach(item => { res.data.forEach(item => {
imgList.push(item) imgList.push(item.pic)
}) })
}) })
}) })
const previewImage = (index) => {
uni.previewImage({
urls: imgList,
current: index,
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -7,8 +7,8 @@
<u--image :src="urlFn('sj')" style="margin: 0 5rpx;" width="28.04rpx" height="28.04rpx"></u--image> <u--image :src="urlFn('sj')" style="margin: 0 5rpx;" width="28.04rpx" height="28.04rpx"></u--image>
<text>刷新时间:{{dateFn()}}</text> <text>刷新时间:{{dateFn()}}</text>
</view> </view>
<view style="display: flex;" @click="navgo('/pages/allPlant/index')"> <view style="display: flex;" @click="navgo(`/pages/poultry/histroyFeed?id=${id}`)">
查看史条件 <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx" 查看史条件 <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx"
height="31.54rpx"></u--image> height="31.54rpx"></u--image>
</view> </view>
</view> </view>
@ -67,6 +67,12 @@
<script setup> <script setup>
import myTable from "@/components/myTable/index.vue" import myTable from "@/components/myTable/index.vue"
import imgCard from "@/components/imgCard.vue" import imgCard from "@/components/imgCard.vue"
import {
onLoad
} from "@dcloudio/uni-app"
import {
ref
} from "vue"
const urlFn = (name) => { const urlFn = (name) => {
return `/static/img/${name}.png` return `/static/img/${name}.png`
} }
@ -92,6 +98,10 @@
// //
} }
const id = ref(0)
onLoad((option) => {
id.value = option.id
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,6 +1,5 @@
<template> <template>
<view class="content" @click.capture="selectAct=false"> <view class="content" @click.capture="selectAct=false">
<view class="card"> <view class="card">
<view class="tit"> <view class="tit">
<view class=""> <view class="">
@ -50,9 +49,9 @@
</view> --> </view> -->
<view class="title"> <view class="title">
<view class=""> <view class="">
编号: 13645 编号: {{baseData.code}}
</view> </view>
<view class="more-jt" @click="navgo(`/pages/poultry/SingleDetail?id=${animal_id}`)"> <view class="more-jt" @click="navgo(`/pages/poultry/SingleDetail?id=${poultry_id}`)">
查看养殖详情 <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx" 查看养殖详情 <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx"
height="31.54rpx"></u--image> height="31.54rpx"></u--image>
</view> </view>
@ -62,16 +61,16 @@
<view class="card-li"> <view class="card-li">
<view class="" @click.capture="selectFoucsFn"> <view class="" @click.capture="selectFoucsFn">
养殖类型: 母猪 养殖类型: {{baseData.kind}}
</view> </view>
<view class="" style="display: flex;align-items: center;"> <view class="" style="display: flex;align-items: center;">
体重: <up-input style="height: 49.07rpx;width: 215.54rpx;margin-left: 20rpx;" placeholder="请输入内容" 体重: <up-input style="height: 49.07rpx;width: 215.54rpx;margin-left: 20rpx;" placeholder="请输入内容"
border="surround" v-model="formData.animal_weight"></up-input> border="surround" v-model="formData.weight"></up-input>
</view> </view>
</view> </view>
<view class="card-li" style="align-items: center;"> <view class="card-li" style="align-items: center;">
<view class=""> <view class="">
年龄: 2 年龄: {{baseData.age}}
</view> </view>
<view class="select"> <view class="select">
状态: <up-input readonly style="height: 49.07rpx;width: 215.54rpx;margin-left: 20rpx;" 状态: <up-input readonly style="height: 49.07rpx;width: 215.54rpx;margin-left: 20rpx;"
@ -91,8 +90,8 @@
</view> </view>
</view> </view>
</view> </view>
<imgCard></imgCard> <!-- <imgCard :imgUrl='baseData?.pic_detail?.pic'></imgCard> -->
<imgCard :imgUrl='baseData?.pic_detail?.pic'></imgCard>
<view class="up-plant-btn" @tap="updataStatusFn"> <view class="up-plant-btn" @tap="updataStatusFn">
确认更新 确认更新
</view> </view>
@ -131,11 +130,15 @@
animalInfoAPI, animalInfoAPI,
animalStatusAPI animalStatusAPI
} from "@/api/animal.js" } from "@/api/animal.js"
import {
poultryStatusAPI,
poultryInfoAPI
} from "@/api/chick.js"
import { import {
actionsAPI actionsAPI
} from "@/api/animal.js" } from "@/api/animal.js"
const selectList = reactive([ const selectList = reactive([
"健康", "怀孕中", "生病隔离中", "可出栏" "健康", "产蛋中", "生病隔离中", "可出栏"
]) ])
const value = ref("") const value = ref("")
const selectAct = ref(false) const selectAct = ref(false)
@ -148,10 +151,22 @@
value.value = selectList[index] value.value = selectList[index]
formData.status = index + 1 formData.status = index + 1
} }
const animal_id = ref(0) const poultry_id = ref(0)
const baseData = reactive({})
onLoad((options) => { onLoad((options) => {
animal_id.value = options.id poultry_id.value = options.id
formData.animal_id = options.id formData.poultry_id = options.id
poultryInfoAPI({
poultry_id: options.id
}).then(res => {
for (let key in res.data) {
baseData[key] = res.data[key]
}
formData.weight = baseData.weight
formData.status = baseData.status
value.value = selectList[baseData.status - 1]
indexs.value = baseData.status - 1
})
}) })
const navgo = (url) => { const navgo = (url) => {
uni.navigateTo({ uni.navigateTo({
@ -160,11 +175,11 @@
} }
const formData = reactive({ const formData = reactive({
status: '', status: '',
animal_id: '', poultry_id: '',
animal_weight: "" weight: ""
}) })
const updataStatusFn = () => { const updataStatusFn = () => {
animalStatusAPI({ poultryStatusAPI({
...formData ...formData
}).then(res => { }).then(res => {
uni.showToast({ uni.showToast({
@ -174,7 +189,7 @@
}) })
} }
const outBar = () => { const outBar = () => {
animalStatusAPI({ poultryStatusAPI({
status: 4, status: 4,
animal_id: animal_id.value, animal_id: animal_id.value,
}).then(res => { }).then(res => {
@ -191,7 +206,7 @@
} }
const actionList = reactive({}) const actionList = reactive({})
actionsAPI({ actionsAPI({
type: 2 type: 3
}).then(res => { }).then(res => {
for (let key in res.data) { for (let key in res.data) {
actionList[key] = (res.data)[key] actionList[key] = (res.data)[key]
@ -226,6 +241,7 @@
.updata-btn { .updata-btn {
width: 192.76rpx; width: 192.76rpx;
height: 57.83rpx; height: 57.83rpx;
border: 1px solid #00A15E; border: 1px solid #00A15E;
color: #00A15E; color: #00A15E;
@ -362,6 +378,7 @@
.updata-btn { .updata-btn {
font-size: 26.29rpx; font-size: 26.29rpx;
// width: 192.76rpx;
padding: 0 20rpx; padding: 0 20rpx;
height: 57.83rpx; height: 57.83rpx;
border: 1px solid #00A15E; border: 1px solid #00A15E;

View File

@ -47,33 +47,34 @@
搜索 搜索
</view> </view>
</view> </view>
<view class="card" v-for="(item,index) in animalList" :key="index" @click="navgo('/pages/feedIng/feedDetail')"> <view class="card" v-for="(item,index) in animalList" :key="index"
@click="navgo(`/pages/poultry/feedDetail?id=${item.id}`)">
<view class="tit"> <view class="tit">
<view class=""> <view class="">
编号: {{item.animal_code}} 编号: {{item.code}}
</view> </view>
<view class="" style="color: #00A15E;" v-if='item.animal_status==1'> <view class="" style="color: #00A15E;" v-if='item.status==1'>
健康 健康
</view> </view>
<view class="" style="color: #FFD736;" v-if='item.animal_status==2'> <view class="" style="color: #FFD736;" v-if='item.status==2'>
怀孕中 产蛋期
</view> </view>
<view class="" style="color: #3274F9;" v-if='item.animal_status==4'> <view class="" style="color: #3274F9;" v-if='item.status==4'>
可出栏 可出栏
</view> </view>
<view class="" style="color: #F84221;" v-if='item.animal_status==3'> <view class="" style="color: #F84221;" v-if='item.status==3'>
生病隔离中 生病隔离中
</view> </view>
</view> </view>
<view class="card-li"> <view class="card-li">
<view class=""> <view class="">
养殖类型: {{item.animal_kind}} 养殖类型: {{item.kind}}
</view> </view>
<view class=""> <view class="">
年龄: {{item.animal_age}} 年龄: {{item.age}}
</view> </view>
<view class=""> <view class="">
体重: {{item.animal_weight}}kg 体重: {{item.weight}}kg
</view> </view>
</view> </view>
</view> </view>
@ -87,7 +88,7 @@
<script setup> <script setup>
import { import {
animalListAPI, animalListAPI,
} from "@/api/animal.js" } from "@/api/chick.js"
import { import {
reactive, reactive,
ref ref

View File

@ -41,14 +41,11 @@
</view> </view>
<view class=""> <view class="">
<view class="">
今日养殖状态
</view>
<imgCard></imgCard>
<view class=""> <view class="">
养殖情况 养殖情况
</view> </view>
<imgCard v-for="(item,index) in imgList" :imgUrl='item.pic' :key="index"></imgCard> <imgCard v-for="(item,index) in imgList" :imgUrl='item' :key="index" @tap='previewImage(index)'></imgCard>
</view> </view>
<view class="up-plant-btn" @click="updateImgFn"> <view class="up-plant-btn" @click="updateImgFn">
@ -65,7 +62,7 @@
import { import {
animalPicListAPI, animalPicListAPI,
addAnimalPicAPI addAnimalPicAPI
} from "@/api/animal.js" } from "@/api/chick.js"
import { import {
onLoad onLoad
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
@ -73,13 +70,15 @@
reactive, reactive,
ref ref
} from "vue"; } from "vue";
const img = ref("")
const updateImgFn = () => { const updateImgFn = () => {
uplodeImg().then(res => { uplodeImg().then(res => {
img.value = res.data.image
addAnimalPicAPI({ addAnimalPicAPI({
animal_id: Number(animal_id.value), poultry_id: Number(animal_id.value),
pic: res.data.image pic: res.data.image
}).then(res => { }).then(res => {
console.log(res) imgList.unshift(img.value)
}) })
}) })
} }
@ -88,14 +87,21 @@
onLoad((option) => { onLoad((option) => {
animal_id.value = option.id animal_id.value = option.id
animalPicListAPI({ animalPicListAPI({
animal_id: option.id poultry_id: option.id
}).then(res => { }).then(res => {
res.data.forEach(item => { res.data.forEach(item => {
imgList.push(item) imgList.push(item.pic)
}) })
}) })
}) })
const previewImage = (index) => {
uni.previewImage({
urls: imgList,
current: index,
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>