mkm
/
yanzhiAPP
Template
2
0
Fork 0

页面完善

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

@ -15,4 +15,9 @@ export const animalInfoAPI = (data) => syhttp.get('/AnimalBreed/animalInfo', dat
// 图片列表
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>
<text>刷新时间:{{dateFn()}}</text>
</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"
height="31.54rpx"></u--image>
</view>
@ -67,6 +67,12 @@
<script setup>
import myTable from "@/components/myTable/index.vue"
import imgCard from "@/components/imgCard.vue"
import {
ref
} from "vue"
import {
onLoad
} from "@dcloudio/uni-app"
const urlFn = (name) => {
return `/static/img/${name}.png`
}
@ -90,8 +96,11 @@
var dateStr = year + '-' + month + '-' + day;
return dateStr
//
}
const animal_id = ref(0)
onLoad((option) => {
animal_id.value = option.id
})
</script>
<style lang="scss" scoped>

View File

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

View File

@ -47,7 +47,8 @@
搜索
</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="">
编号: {{item.animal_code}}

View File

@ -41,14 +41,10 @@
</view>
<view class="">
<view class="">
今日养殖状态
</view>
<imgCard></imgCard>
<view class="">
养殖情况
</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 class="up-plant-btn" @click="updateImgFn">
@ -73,13 +69,15 @@
reactive,
ref
} from "vue";
const img = ref("")
const updateImgFn = () => {
uplodeImg().then(res => {
img.value = res.data.image
addAnimalPicAPI({
animal_id: Number(animal_id.value),
pic: res.data.image
}).then(res => {
console.log(res)
imgList.unshift(img.value)
})
})
}
@ -91,11 +89,18 @@
animal_id: option.id
}).then(res => {
res.data.forEach(item => {
imgList.push(item)
imgList.push(item.pic)
})
})
})
const previewImage = (index) => {
uni.previewImage({
urls: imgList,
current: index,
})
}
</script>
<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>
<text>刷新时间:{{dateFn()}}</text>
</view>
<view style="display: flex;" @click="navgo('/pages/allPlant/index')">
查看史条件 <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx"
<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"
height="31.54rpx"></u--image>
</view>
</view>
@ -67,6 +67,12 @@
<script setup>
import myTable from "@/components/myTable/index.vue"
import imgCard from "@/components/imgCard.vue"
import {
onLoad
} from "@dcloudio/uni-app"
import {
ref
} from "vue"
const urlFn = (name) => {
return `/static/img/${name}.png`
}
@ -92,6 +98,10 @@
//
}
const id = ref(0)
onLoad((option) => {
id.value = option.id
})
</script>
<style lang="scss" scoped>

View File

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

View File

@ -47,33 +47,34 @@
搜索
</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="">
编号: {{item.animal_code}}
编号: {{item.code}}
</view>
<view class="" style="color: #00A15E;" v-if='item.animal_status==1'>
<view class="" style="color: #00A15E;" v-if='item.status==1'>
健康
</view>
<view class="" style="color: #FFD736;" v-if='item.animal_status==2'>
怀孕中
<view class="" style="color: #FFD736;" v-if='item.status==2'>
产蛋期
</view>
<view class="" style="color: #3274F9;" v-if='item.animal_status==4'>
<view class="" style="color: #3274F9;" v-if='item.status==4'>
可出栏
</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 class="card-li">
<view class="">
养殖类型: {{item.animal_kind}}
养殖类型: {{item.kind}}
</view>
<view class="">
年龄: {{item.animal_age}}
年龄: {{item.age}}
</view>
<view class="">
体重: {{item.animal_weight}}kg
体重: {{item.weight}}kg
</view>
</view>
</view>
@ -87,7 +88,7 @@
<script setup>
import {
animalListAPI,
} from "@/api/animal.js"
} from "@/api/chick.js"
import {
reactive,
ref

View File

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