Commit 9e55b46c authored by “lixuyan”'s avatar “lixuyan”

去掉加载更多

parent 596a7a5f
......@@ -87,7 +87,7 @@
<div class="sub-title" style="margin:0 10px">
检验派工
</div>
<div class="group-list">
<div class="group-list" @scroll="handleScroll">
<div v-for="(item, index) in groupUserList" :key="index" class="group-list-box" :class="{'active': item.isSelect}" @click="changeGroupUser(item)">
<div class="message">
<el-tooltip placement="top">
......@@ -118,9 +118,9 @@
</div>
</div>
<div class="more-bar">
<span v-if="groupUserList.length < groupUserTotal" class="more" @click="getMoreData">加载更多</span>
<span v-else-if="groupUserList.length===0">暂无数据</span>
<span v-else>已全部加载!</span>
<!-- <span v-if="groupUserList.length < groupUserTotal" class="more" @click="getMoreData">加载更多</span> -->
<span v-if="groupUserList.length===0">暂无数据</span>
<span v-if="groupUserTotal!==0&&groupUserList.length===groupUserTotal">已全部加载!</span>
</div>
</div>
</template>
......@@ -276,7 +276,8 @@ export default {
}
],
groupUserTotal: 0,
groupUserPage: 1
groupUserPage: 1,
isLoading: false
}
},
computed: {
......@@ -305,6 +306,15 @@ export default {
this.getStation()
},
methods: {
handleScroll(e) {
if (this.isLoading) return
const scrollTop = e.target.scrollTop
const scrollHeight = e.target.scrollHeight
const clientHeight = e.target.clientHeight
if (scrollTop + clientHeight - scrollHeight <= 40) {
this.getMoreData()
}
},
getStories() {
const params = {
'searchItems': {
......@@ -583,6 +593,7 @@ export default {
val.isSelect = !val.isSelect
},
getGroupUser() {
this.isLoading = true
const params = {
'pageFrom': this.groupUserPage,
'pageSize': 10,
......@@ -622,13 +633,14 @@ export default {
this.groupUserList.push(item)
})
this.groupUserTotal = res.items.totalElements
this.isLoading = false
// this.groupUserList[0].isSelect = true
}
})
},
getMoreData() {
const num = Math.ceil(this.groupUserTotal / 10)
if (this.groupUserPage <= num) {
if (this.groupUserPage < num) {
this.groupUserPage++
this.getGroupUser()
}
......
......@@ -46,7 +46,7 @@
<el-col :span="2">
<el-button
type="primary"
@click="searchTableData"
@click="getTableData"
>查询</el-button>
</el-col>
</el-form>
......@@ -176,7 +176,7 @@
<div class="more-bar">
<!-- <span v-if="groupUserList.length < groupUserTotal" class="more" @click="getMoreData">加载更多</span> -->
<span v-if="groupUserList.length===0">暂无数据</span>
<span v-else>已全部加载!</span>
<span v-if="groupUserTotal!==0&&groupUserList.length===groupUserTotal">已全部加载!</span>
</div>
</div>
</template>
......
......@@ -4,7 +4,7 @@
<div class="sub-title" style="margin:0 10px">
下发班组
</div>
<div class="group-list">
<div class="group-list" @scroll="handleScroll">
<div v-for="(item, index) in groupDropList" :key="index" class="group-list-box" :class="{'active': group===item.id}" @click="changeGroup(item)">
<div class="left">
<div class="left-text"> {{ item.resName }}</div>
......@@ -31,9 +31,9 @@
</div>
</div>
<div class="more-bar">
<span v-if="groupDropList.length < groupTotal" class="more" @click="getMoreData">加载更多</span>
<span v-else-if="groupDropList.length===0">暂无数据</span>
<span v-else>已全部加载!</span>
<!-- <span v-if="groupDropList.length < groupTotal" class="more" @click="getMoreData">加载更多</span> -->
<span v-if="groupDropList.length===0">暂无数据</span>
<span v-if="groupTotal!==0&&groupDropList.length===groupTotal">已全部加载!</span>
</div>
</div>
</div>
......@@ -56,7 +56,8 @@ export default {
groupTotal: 0,
detailInfo: null,
group: '',
groupType: ''
groupType: '',
isLoading: ''
}
},
created() {
......@@ -86,10 +87,20 @@ export default {
})
},
methods: {
handleScroll(e) {
if (this.isLoading) return
const scrollTop = e.target.scrollTop
const scrollHeight = e.target.scrollHeight
const clientHeight = e.target.clientHeight
if (scrollTop + clientHeight - scrollHeight <= 10) {
this.getMoreData()
}
},
handleCurrentChange(val) {
this.$emit('getInfo', val)
},
getGroupList() {
this.isLoading = true
const params = {
'pageFrom': this.groupPage,
'pageSize': 10,
......@@ -150,12 +161,13 @@ export default {
if (res.items && res.items.content) {
this.groupDropList = this.groupDropList.concat(res.items.content)
this.groupTotal = res.items.totalElements
this.isLoading = false
}
})
},
getMoreData() {
const num = Math.ceil(this.groupTotal / 10)
if (this.groupPage <= num) {
if (this.groupPage < num) {
this.groupPage++
this.getGroupList()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment