You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
6.9 KiB

12 months ago
<style lang="less" scoped>
.container{
height:100%;
background:#f6f6f6;
scroll-view{
flex-grow: 1;
height:1rpx;
.u-swipe-action{
.u-swipe-action-item{
margin:0 30rpx 30rpx;
}
.u-swipe-action-item__right__button{
display:flex;
align-items: center;
}
}
12 months ago
.card{
margin:0rpx;
12 months ago
&>.title{
display: flex;
align-items: center;
.icon{
background-image: url("data:image/svg+xml,%3Csvg width='16' height='16.001999' viewBox='0 0 16 16.002' fill='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3Cpath id='path' d='M0 16L8 16L8 0L0 0L0 16ZM4.57098 1.143L6.85699 1.143L6.85699 3.429L4.57098 3.429L4.57098 1.143ZM4.57098 4.572L6.85699 4.572L6.85699 6.858L4.57098 6.858L4.57098 4.572ZM4.57098 8.001L6.85699 8.001L6.85699 10.287L4.57098 10.287L4.57098 8.001ZM1.142 1.144L3.42801 1.144L3.42801 3.43L1.14301 3.43L1.142 1.144ZM1.142 4.573L3.42801 4.573L3.42801 6.859L1.14301 6.859L1.142 4.573ZM1.142 8.002L3.42801 8.002L3.42801 10.288L1.14301 10.288L1.142 8.002ZM9.142 16.002L11.428 16.002L11.428 12.571L14.857 12.571L14.857 16L16 16L16 9.143L9.14301 9.143L9.142 16.002ZM9.142 6.859L16 6.859L16 8L9.14301 8L9.142 6.859Z' fill='%2310C176' fill-opacity='1' fill-rule='nonzero'/%3E %3C/svg%3E ");
background-size:100% 100%;
width:32rpx;
height:32rpx;
margin-right:12rpx;
}
.name{
font-size:32rpx;
font-weight: bold;
margin-right:10rpx;
}
.statu{
margin-left:auto;
font-size:24rpx;
font-weight: bold;
&.no{
color:#00C220;
}
&.unusual{
color:#EE263A;
display: flex;
align-items: center;
&:before{
content:"";
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:%23ee263a;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M6,0A4.416,4.416,0,0,0,2.893,1.254,4.284,4.284,0,0,0,1.621,4.29v5.856h8.712V4.29A4.254,4.254,0,0,0,9.055,1.254,4.4,4.4,0,0,0,6,0Zm-.36,8.742L5.515,5.9H3.367l2.82-3.558.24,2.292,2.04.072L5.617,8.742ZM0,11.346a.654.654,0,0,1,.654-.66H11.347a.672.672,0,0,1,.462.192.684.684,0,0,1,.192.468.654.654,0,0,1-.654.654H.655A.654.654,0,0,1,0,11.346Zm0,0' transform='translate(-0.001)'/%3E%3C/svg%3E");
width:24rpx;
height:24rpx;
margin-right:4rpx;
}
}
}
.deal{
color:#F3AA1E;
}
12 months ago
.plant-youbian{
color:#777;
}
}
&>.imgs{
display: flex;
margin-right:-20rpx;
12 months ago
image{
border-radius: 8rpx;
width:calc(100%/4 - 20rpx);
12 months ago
height:140rpx;
12 months ago
position:relative;
12 months ago
&+image{
margin-left:20rpx;
}
12 months ago
&:nth-child(4){
&:before{
content:var(--c);
12 months ago
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
background:rgba(0, 0, 0, 0.4);
color:#fff;
line-height: 140rpx;
text-align: center;
}
}
12 months ago
}
}
&>.foot{
display: flex;
align-items: center;
justify-content: space-between;
border-top:2rpx solid rgba(216, 216, 216, 0.3);
color:#999;
padding-top:15rpx;
margin-top:10rpx;
}
}
}
}
</style>
<template>
<view class="container flex">
12 months ago
<d-navbar text="巡园记录" isBack style="--bg:#10C176;--c:#fff;">
<text slot="right" class="plant-xinjian" @click="toAddPage"/>
</d-navbar>
<d-search v-model="searchVal.search" @search="search('pageOne')"/>
<scroll-view scroll-y @scrolltolower="search()">
<u-swipe-action>
<u-swipe-action-item v-for="(v,k) in list" :key="k">
<view class="card" @click="toDetail(v)">
<view class="title">
<text class="icon"/>
<text class="name over">{{v.baseName}}</text>
<text v-if="v.flagAbnormal==0" class="statu no">无异常</text>
<text v-else class="statu unusual">异常</text>
<text v-if="v.flagAbnormal==1" class="deal">(已处理{{v.deal}}/{{v.detailVos.length}})</text>
<text class="plant-youbian"/>
</view>
<view class="imgs">
<image v-for="(v1,k1) in v.pic.slice(0,4)" :style="{'--c':v.pic.length-4>0?`'+${v.pic.length-4}'`:''}" :key="k1" mode="aspectFill" :src="`${host}/${v1}`"/>
</view>
<u-read-more toggle closetext="展开" showHeight="80rpx" textIndent="0em" style="margin-top:10rpx;">{{v.remark}}</u-read-more>
<view class="foot">
<text>巡园日期{{v.operateDate}}</text>
<text>{{v.userName}}</text>
</view>
</view>
<view slot="button" class="u-swipe-action-item__right__button">
<button class="cu-btn bg-red" style="margin:auto;" @click="del(k)">删除</button>
</view>
</u-swipe-action-item>
</u-swipe-action>
<view style="border:1rpx solid transparent;"/>
11 months ago
<u-empty :show="list.length<=0" text="未查询到相关信息" width="50%" icon="/static/noData.png"/>
12 months ago
</scroll-view>
</view>
</template>
<script>
import request,{host} from '@/common/request'
12 months ago
export default {
data(){
return{
searchVal:{
search:"",
baseId: this.$store.state.baseInfo.id,
pageNo:1,
pageSize:5,
12 months ago
},
total:0,
list:[],
host:host('imgUrl'),
12 months ago
}
},
onLoad(){
this.search()
},
12 months ago
methods:{
async search(type, i){
if(type=='pageOne'){
this.searchVal.pageNo=1
this.list=[]
this.total=0
}else if(type=='del'){
if(this.list.length>this.searchVal.pageSize+3){
this.total--
this.list.splice(i,1)
}else{
this.searchVal.pageNo=1
this.list=[]
this.total=0
}
}
if(this.total==0||this.list.length<this.total){
var res=await request("/api/basetour/queryTourListByBaseId",{
method:"post",
body:this.searchVal,
})
if(res.statu){
this.list=this.list.concat(res.data.record.map(v=>({
...v,
pic: v.pic?(v.pic||'').split(',').filter(v=>v):v.detailVos.reduce((a,b)=>a.concat((b.pic||'').split(',').filter(v=>v)),[])
})))
this.total=res.data.total
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取巡园记录失败!",
showCancel:false,
})
}
}
12 months ago
},
del(index){
uni.showModal({
title:"提示",
content:"确定删除?",
success:async e=>{
if(e.confirm){
var res=await request("/api/basetour/deleteById",{
params:{id:this.list[index].id}
})
if(res.statu){
uni.showToast({title:"删除成功!",icon:"success"})
this.search('del',index)
}else{
uni.showToast({title:"删除失败!",icon:"error"})
}
}
}
})
},
12 months ago
toAddPage(){
uni.navigateTo({
url:"/pages/patrolGarden/info",
events:{update:()=>this.search('pageOne')},
12 months ago
})
},
11 months ago
toDetail(e){
uni.navigateTo({
url:"/pages/patrolGarden/detail",
events:{update:()=>this.search('pageOne')},
11 months ago
success:res=>{
res.eventChannel.emit('detail',e)
}
})
}
12 months ago
}
}
</script>