<template>
|
<view class="cistern_index">
|
<view class="cistern_header"></view>
|
<view class="cistern_content">
|
<view class="cistern_content_search">
|
<u-row gutter="5" customStyle="padding-right: 10px">
|
<u-col span="5" @click="propPicker()">
|
<u-input
|
v-model="value"
|
border="surround"
|
disabled
|
disabledColor="#FFFFFF"
|
placeholder="请选择水养池"
|
></u-input>
|
</u-col>
|
<u-col span="5">
|
<u-input
|
v-model="ringNum"
|
border="surround"
|
placeholder="请输入环号"
|
></u-input>
|
</u-col>
|
<u-col span="2">
|
<u-button type="primary" size="small" text="查询" color="#1977FF" @click="searchData()"></u-button>
|
</u-col>
|
</u-row>
|
</view>
|
<scroll-view :scroll-top="scrollTop" refresher-enabled="true" scroll-y="true" class="cistern_content_scroll"
|
refresher-background="#EAEAEA" @scrolltolower="scrolltoLower" :refresher-triggered="triggered"
|
@refresherrefresh="refresherrefresh">
|
<view
|
class="cistern_scroll_item"
|
v-for="item in cisternList"
|
:key="item.id">
|
<view class="item_title">
|
{{item.proName}}
|
</view>
|
<view class="item_content">
|
<view class="item_content_info">
|
<text class="label">环号:</text>
|
<text>{{item.ringNum}}</text>
|
</view>
|
<view class="item_content_info">
|
<text class="label">水养池:</text>
|
<text>{{item.waterCultivatedName}}</text>
|
</view>
|
<view class="item_content_info">
|
<text class="label">已水养时间:</text>
|
<text>{{item.diffDescript}}</text>
|
</view>
|
<view class="item_content_info">
|
<text class="label">入池时间:</text>
|
<text>{{item.createTime}}</text>
|
</view>
|
<view class="item_content_info">
|
<text class="label">入池操作人:</text>
|
<text>{{item.checkUser}}</text>
|
</view>
|
<view class="item_content_info">
|
<text class="label">预计完成水养时间:</text>
|
<text>{{item.expectTime}}</text>
|
</view>
|
</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
</view>
|
<u-picker
|
:show="showPicker"
|
:columns="columnData"
|
keyName="waterCultivatedName"
|
closeOnClickOverlay
|
@cancel="showPicker = false"
|
@confirm="confirmPicker"
|
@close="showPicker = false"
|
></u-picker>
|
</view>
|
</template>
|
|
<script>
|
import { throttle } from '../../plugins/public';
|
export default {
|
data() {
|
return {
|
value: '', // 列表选择水养池
|
waterCultivatedId: '', // 入池选择水养池
|
ringNum: '',
|
pageNum: 1,
|
pageSize: 10,
|
loadPage: '',
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
iconType: 'flower',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
cisternList: [], // 入池信息
|
showPicker: false, // 选择水养池
|
columnData: [], // 水养池信息
|
}
|
},
|
onShow() {
|
const that = this;
|
uni.$off('scancodedate');
|
uni.$on('scancodedate', function(data) {
|
console.log(data);
|
console.log(data.code.slice(-17));
|
that.$api.cistern.pipeCultivatedScan({
|
pipeNum: data.code.slice(-17)
|
}).then((res) => {
|
if(res.success) {
|
uni.$u.toast('扫描完成!');
|
uni.navigateTo({
|
url: '../cisternIndex/scanIndex?data=' + JSON.stringify(res.data)
|
})
|
} else {
|
uni.$u.toast(res.statusMsg);
|
}
|
})
|
})
|
that.searchData();
|
that.getAllWaterData();
|
},
|
onUnload() {
|
// 移除监听事件
|
uni.$off('scancodedate');
|
},
|
methods: {
|
// 获取全部水养池信息
|
async getAllWaterData() {
|
const { data } = await this.$api.cistern.getAllWaterData();
|
this.$set(this.columnData, 0, data);
|
},
|
// 查询列表信息
|
async searchEnterCisterbList() {
|
const { data } = await this.$api.cistern.searchEnterCisterbList({
|
pageNum: this.pageNum,
|
pageSzie: this.pageSize,
|
ringNum: this.ringNum,
|
waterCultivatedId: this.waterCultivatedId
|
})
|
return data;
|
},
|
// 查询
|
searchData() {
|
this.triggered = true;
|
this.cisternList = [];
|
this.searchEnterCisterbList().then((data) => {
|
this.cisternList = data.list;
|
this.loadPage = data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}).catch(() => {
|
this.triggered = false;
|
this.status = 'nomore';
|
uni.$u.toast('没有更多数据了');
|
})
|
},
|
//自定义下拉刷新
|
refresherrefresh: throttle(function() {
|
this.status = 'loading';
|
this.pageNum = 1;
|
this.searchData();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLower: throttle(function() {
|
this.status = 'loading';
|
if(this.pageNum >= this.loadPage) {
|
setTimeout(() => {
|
this.status = 'nomore';
|
uni.$u.toast('没有更数据了');
|
},1000)
|
return;
|
} else {
|
this.pageNum += 1;
|
this.searchEnterCisterbList().then((data) => {
|
this.loadPage = data.pages;
|
this.cisternList.push(...data.list);
|
this.status = 'nomore';
|
})
|
}
|
}, 3000),
|
// 打开选择水养池
|
propPicker() {
|
this.value = '';
|
this.waterCultivatedId = '';
|
this.showPicker = true;
|
},
|
// 确认选择水养池信息
|
confirmPicker(data) {
|
this.value = data.value[0].waterCultivatedName;
|
this.waterCultivatedId = data.value[0].waterCultivatedId;
|
this.showPicker = false;
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.cistern_index {
|
position: relative;
|
width: 100vw;
|
height: 100vh;
|
background: #F6F6F6;
|
|
.cistern_header {
|
height: 16%;
|
background: #1976FF;
|
border-radius: 0 0 30% 30%;
|
}
|
|
.cistern_content {
|
position: absolute;
|
top: 5%;
|
left: 50%;
|
transform: translateX(-50%);
|
width: 92%;
|
height: 95%;
|
|
.cistern_content_search {
|
padding: 15px 10px;
|
margin-bottom: 10px;
|
background: #FFFFFF;
|
border-radius: 4px;
|
}
|
|
.cistern_content_scroll {
|
padding: 0 0 10px 0;
|
height: calc(100% - 107px);
|
|
.cistern_scroll_item {
|
padding-bottom: 15px;
|
margin: 10px 0;
|
background: #FFFFFF;
|
border-radius: 4px;
|
|
&:first-child {
|
margin-top: 0;
|
}
|
|
.item_title {
|
position: relative;
|
padding: 10px 20px;
|
color: #1976FF;
|
font-size: 16px;
|
background: #DAE9FF;
|
|
&::before {
|
content: '';
|
position: absolute;
|
top: 50%;
|
left: 10px;
|
transform: translateY(-50%);
|
width: 2px;
|
height: 40%;
|
background: #1976FF;
|
}
|
}
|
|
.item_content {
|
padding: 10px;
|
margin: 20px 10px 10px;
|
background: #F6F9FE;
|
|
.item_content_info {
|
display: flex;
|
align-items: center;
|
padding: 2px 0;
|
white-space: nowrap;
|
|
.label {
|
color: #AFB0B1;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
::v-deep .u-button--small {
|
height: 36px;
|
}
|
</style>
|