cultivationApp/pages/leave/leave.vue

327 lines
7.2 KiB
Vue

<template>
<view style="position: relative;">
<view class="top">
<view class="" style="height:var(--status-bar-height) ;">
</view>
<view class="nav-con">
<view class="left"></view>
<view class="title" @click="navBack">
<u-icon name="arrow-left" color="#fff" size="40rpx" style="margin-right: 10rpx;"></u-icon> <text
style="padding-bottom: 5rpx;">离栏记录</text>
</view>
<view class="btn" style="margin-top: -5rpx;">
<u-icon name="plus" color="#fff" size="40rpx" style="margin-right: 20rpx;" @click="navTo('/pages/leave/addLeave')"></u-icon>
<Myindex url='/pages/index/index' />
</view>
</view>
</view>
<view class="" style="height:var(--status-bar-height) ;">
</view>
<view class="nav-con">
</view>
<view class="content">
<view class="serch">
<u-search bgColor="white" :show-action="false" placeholder="请输入耳号" v-model="searchKey" shape="round"
:clearabled='false'></u-search>
<view class="ser-text" @click="search">
搜索
</view>
</view>
<view class="tits">
离栏记录
</view>
<view class="">
<block class="" v-if="dataList.length>0">
<view class="thing-card" v-for="(item, index) in dataList" :key="index"
@click="changeItem(item)">
<view class="c-title">{{item.animal_sn}}</view>
<view class="c-body">
<view class="c-item">
<view class="flex">
<view class="f-title">所在栏舍:</view>
<view>{{item.fence_house_name}}</view>
</view>
<view class="flex">
<view class="f-title">离舍原因:</view>
<view>{{item.reason}}</view>
</view>
</view>
<view class="c-item">
<view class="flex">
<view class="f-title">离舍类型:</view>
<view>{{getType(item.leave_type)}}</view>
</view>
<view class="flex">
<view class="f-title">离舍时间:</view>
<view>{{item.create_time.split(' ')[0]}}</view>
</view>
</view>
</view>
<view class="flex">
<view class="f-title">备注:</view>
<view>{{item.remark}}</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>
</view>
</view>
</template>
<script setup>
import {
onLoad,
onShow,
onReachBottom,
onPullDownRefresh
} from "@dcloudio/uni-app"
import {
ref,
reactive,
onMounted
} from "vue"
import {
fenceHouseLeaveList
} from "@/api/manage.js"
import {
leaveFenceHouseTypeLists
} from "@/api/dict.js"
import Myindex from '@/components/return/index.vue';
const leaveTypeList = ref([]);
const initLeaveFenceHouseTypeLists = ()=>{
leaveFenceHouseTypeLists().then(res=>{
leaveTypeList.value = res.data;
})
}
initLeaveFenceHouseTypeLists();
const getType = (value)=>{
return leaveTypeList.value.find(item=>item.id==value)?.name||'';
}
const searchKey = ref('');
const dataList = ref([])
const where = ref({
page_no: 1,
page_size: 15
})
const initfenceHouseLeaveList = ()=>{
fenceHouseLeaveList({
keyword: searchKey.value,
page_no: where.value.page_no,
page_size: where.value.page_size
}).then(res=>{
dataList.value = res.data.lists;
})
}
initfenceHouseLeaveList();
const search = ()=>{
where.value.page_no = 1;
initfenceHouseLeaveList();
}
const changeItem = (item)=>{
uni.navigateTo({
url:'/pages/leave/leaveDetail',
success: (res) => {
item.leave_type_name = getType(item.leave_type);
res.eventChannel.emit('setDatasItem', item);
}
})
}
//跳转
const navTo = (url) => {
uni.navigateTo({
url
})
}
const navBack = () => {
uni.navigateBack()
}
//查看
const perviewFn = (url) => {
uni.previewImage({
urls: [url]
})
}
</script>
<style lang="scss">
page {
background-color: $theme-bg-color;
}
.top {
background-color: #feb048;
position: fixed;
z-index: 999999;
width: 750rpx;
}
.nav-con {
width: 100vw;
height: 44px;
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 20rpx;
padding-bottom: 10rpx;
color: #fff;
.title {
display: flex;
align-items: center;
margin-left: 20rpx;
}
.btn {
flex: 1;
display: flex;
align-items: center;
justify-content: flex-end;
}
}
.tits {
position: relative;
padding-left: 20rpx;
font-weight: bold;
margin-bottom: 20rpx;
}
.tits::before {
content: "";
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
width: 3px;
/* 左边框的宽度 */
height: 30rpx;
background-color: #FFB049;
}
.content {
position: relative;
padding: 0 28rpx;
.serch {
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
border-radius: 200rpx;
position: relative;
color: #feb048;
font-size: 28rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
.ser-text {
position: absolute;
padding-left: 20rpx;
top: 50%;
transform: translateY(-50%);
right: 40rpx;
}
.ser-text::before {
content: "";
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
width: 2px;
/* 左边框的宽度 */
height: 20rpx;
background-color: #FFB049;
}
}
}
.thing-card {
width: 694;
box-sizing: border-box;
padding: 28rpx;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
font-size: 26rpx;
margin-bottom: 30rpx;
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
.c-title {
font-weight: bold;
margin-bottom: 10rpx;
font-size: 30rpx;
}
.c-body {
display: flex;
.c-item {
flex: 1;
}
}
.flex {
display: flex;
color: #999;
.f-title {
color: #333;
margin-right: 10rpx;
flex-shrink: 0;
}
view {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
}
}
.coneng-detail {
width: 478rpx;
height: 341rpx;
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: 300rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
}
}
</style>