|
@@ -4,8 +4,11 @@
|
|
|
<u-search placeholder="请输入客户名称" :clearabled="true" @clear="searchDept" @custom="searchDept"
|
|
<u-search placeholder="请输入客户名称" :clearabled="true" @clear="searchDept" @custom="searchDept"
|
|
|
v-model="search.deptName" @search="searchDept"></u-search>
|
|
v-model="search.deptName" @search="searchDept"></u-search>
|
|
|
</view>
|
|
</view>
|
|
|
- <view style="margin-top: 10px">
|
|
|
|
|
- <uni-card v-if="item.parentId !==0" v-for="item in deptList" :title="item.deptName"
|
|
|
|
|
|
|
+ <scroll-view
|
|
|
|
|
+ scroll-y
|
|
|
|
|
+ style="height: 100vh"
|
|
|
|
|
+ @scrolltolower="loadMore">
|
|
|
|
|
+ <uni-card v-if="item.parentId !==0" v-for="item in displayList" :title="item.deptName"
|
|
|
:extra="item.createTime">
|
|
:extra="item.createTime">
|
|
|
|
|
|
|
|
<view style="position: relative">
|
|
<view style="position: relative">
|
|
@@ -14,7 +17,7 @@
|
|
|
<view style="width: 50px;position: absolute;right:-10px;bottom:0px"><u-button @click="toUser(item)"
|
|
<view style="width: 50px;position: absolute;right:-10px;bottom:0px"><u-button @click="toUser(item)"
|
|
|
type="primary" :plain="true" size="mini" text="查看人员"></u-button>
|
|
type="primary" :plain="true" size="mini" text="查看人员"></u-button>
|
|
|
</view>
|
|
</view>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<view style="width: 50px;position: absolute;right:90rpx;bottom:0rpx"><u-button type="success"
|
|
<view style="width: 50px;position: absolute;right:90rpx;bottom:0rpx"><u-button type="success"
|
|
|
@click="toDeviceList(item)" :plain="true" size="mini" text="查看设备"></u-button>
|
|
@click="toDeviceList(item)" :plain="true" size="mini" text="查看设备"></u-button>
|
|
|
</view>
|
|
</view>
|
|
@@ -24,7 +27,9 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
</uni-card>
|
|
</uni-card>
|
|
|
- </view>
|
|
|
|
|
|
|
+ <view v-if="loading" class="loading">加载中...</view>
|
|
|
|
|
+ <view v-if="allLoaded" class="no-more">没有更多了</view>
|
|
|
|
|
+ </scroll-view>
|
|
|
<view style="position: fixed;bottom: 0px;text-align: center;width: 100%">
|
|
<view style="position: fixed;bottom: 0px;text-align: center;width: 100%">
|
|
|
<u-button type="primary" text="新增客户" @click="newUser"></u-button>
|
|
<u-button type="primary" text="新增客户" @click="newUser"></u-button>
|
|
|
</view>
|
|
</view>
|
|
@@ -89,7 +94,12 @@
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
deptList: [],
|
|
deptList: [],
|
|
|
- search: {
|
|
|
|
|
|
|
+ displayList:[],
|
|
|
|
|
+ loading:false,
|
|
|
|
|
+ allLoaded :false,
|
|
|
|
|
+ pageSize:50,
|
|
|
|
|
+ currentPage:1,
|
|
|
|
|
+ search: {
|
|
|
deptName: ""
|
|
deptName: ""
|
|
|
},
|
|
},
|
|
|
statusList: [{
|
|
statusList: [{
|
|
@@ -163,10 +173,31 @@
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ loadMore() {
|
|
|
|
|
+ if (this.loading || this.allLoaded) return
|
|
|
|
|
+
|
|
|
|
|
+ this.loading = true
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ const start = this.currentPage * this.pageSize
|
|
|
|
|
+ const end = start + this.pageSize
|
|
|
|
|
+ const nextPageData = this.deptList.slice(start, end)
|
|
|
|
|
+
|
|
|
|
|
+ if (nextPageData.length === 0) {
|
|
|
|
|
+ this.allLoaded = true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.displayList = this.displayList.concat(nextPageData)
|
|
|
|
|
+ this.currentPage++
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ }, 300) // 模拟加载时间,实际可以去掉
|
|
|
|
|
+ },
|
|
|
getDeptList() {
|
|
getDeptList() {
|
|
|
getDeptList(this.search.deptName).then(res => {
|
|
getDeptList(this.search.deptName).then(res => {
|
|
|
this.deptList = res.data;
|
|
this.deptList = res.data;
|
|
|
- });
|
|
|
|
|
|
|
+ this.displayList = this.deptList.slice(0, 50)
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
doAddUser() {
|
|
doAddUser() {
|
|
|
let self = this;
|
|
let self = this;
|
|
@@ -282,4 +313,4 @@
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|