@sy-common/organize-select-help 1.0.0-beta.7 → 1.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.vue +59 -10
package/package.json
CHANGED
package/src/index.vue
CHANGED
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
</div>
|
|
64
64
|
</TabPane>
|
|
65
65
|
<TabPane label="选择人员" name="staff">
|
|
66
|
-
<div class="tab">
|
|
67
|
-
<Input v-model="staffSearch" @on-blur="
|
|
68
|
-
<div class="tree staff-content">
|
|
66
|
+
<div class="tab" style="position:relative;">
|
|
67
|
+
<Input v-model="staffSearch" @on-blur="searchStaff" @on-enter="searchStaff" placeholder="搜索人员"/>
|
|
68
|
+
<div class="tree staff-content" @scroll="handleScroll">
|
|
69
69
|
<div :class="['gust-item',item.checked && 'staff-active']" v-for="item in staffAllList" :key="item.id" @click="handlestaff(item)">
|
|
70
70
|
<div class="left-panel">{{item.name && item.name.slice(0,1) || ''}}</div>
|
|
71
71
|
<div class="right-panel">
|
|
@@ -74,6 +74,8 @@
|
|
|
74
74
|
</div>
|
|
75
75
|
<div class="checked-icon" v-show="item.checked">✔</div>
|
|
76
76
|
</div>
|
|
77
|
+
<p v-if="staffEnding" style="color:#CCCCCC;text-align: center">---我也是有底线的---</p>
|
|
78
|
+
<Spin v-if="loadingStaff" size="large" fix />
|
|
77
79
|
</div>
|
|
78
80
|
<div class="bottom-select">
|
|
79
81
|
<div>当前已选择 <span class="num">{{getCheckedStaff}}</span>人</div>
|
|
@@ -173,6 +175,10 @@ export default {
|
|
|
173
175
|
staffSearch:'',
|
|
174
176
|
staffAllList:[],
|
|
175
177
|
staffList:[],
|
|
178
|
+
loadingStaff:false,
|
|
179
|
+
lastLoadingTime:0,
|
|
180
|
+
offset:0,
|
|
181
|
+
staffEnding:false,
|
|
176
182
|
tagList:[{
|
|
177
183
|
v:'所选市公司所有部门',
|
|
178
184
|
on:false,
|
|
@@ -186,7 +192,7 @@ export default {
|
|
|
186
192
|
},
|
|
187
193
|
mounted() {
|
|
188
194
|
this.queryPositionList()
|
|
189
|
-
this.
|
|
195
|
+
this.loadMore()
|
|
190
196
|
},
|
|
191
197
|
methods:{
|
|
192
198
|
queryPositionList(){
|
|
@@ -198,15 +204,58 @@ export default {
|
|
|
198
204
|
}
|
|
199
205
|
})
|
|
200
206
|
},
|
|
207
|
+
searchStaff(){
|
|
208
|
+
this.staffEnding = false;
|
|
209
|
+
this.offset = 0
|
|
210
|
+
this.staffAllList = []
|
|
211
|
+
this.loadMore()
|
|
212
|
+
},
|
|
201
213
|
queryAllStaffList(){
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
214
|
+
return new Promise((resolve,reject)=>{
|
|
215
|
+
ajax.get('/pub-manage-server/pub/personHelpBox/q/queryAllStaffList',{
|
|
216
|
+
params:{
|
|
217
|
+
search:this.staffSearch,
|
|
218
|
+
offset:this.offset,
|
|
219
|
+
limit:10,
|
|
220
|
+
}
|
|
221
|
+
}).then((res)=>{
|
|
222
|
+
if(res.data.code === 1){
|
|
223
|
+
let resp = res.data.data
|
|
224
|
+
resolve(resp)
|
|
225
|
+
}else{
|
|
226
|
+
reject(false)
|
|
227
|
+
}
|
|
228
|
+
})
|
|
208
229
|
})
|
|
209
230
|
},
|
|
231
|
+
handleScroll(e){
|
|
232
|
+
const { scrollTop, clientHeight, scrollHeight } = e.target;
|
|
233
|
+
if (scrollHeight - (scrollTop + clientHeight) < 50) {
|
|
234
|
+
this.loadMore();
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
async loadMore(){
|
|
238
|
+
let nowTime = Date.now()
|
|
239
|
+
if (this.loadingStaff || this.staffEnding || (nowTime - this.lastLoadingTime < 1000)) return
|
|
240
|
+
this.loadingStaff = true
|
|
241
|
+
try {
|
|
242
|
+
console.log("--触底加载---")
|
|
243
|
+
let res = await this.queryAllStaffList()
|
|
244
|
+
let list = res.rows;
|
|
245
|
+
list.map((item)=>item.checked=false)
|
|
246
|
+
this.staffAllList = this.staffAllList.concat(list)
|
|
247
|
+
this.offset += 10;
|
|
248
|
+
this.loadingStaff = false
|
|
249
|
+
this.lastLoadingTime = Date.now()
|
|
250
|
+
if(res.total===this.staffAllList.length){
|
|
251
|
+
this.staffEnding = true
|
|
252
|
+
}
|
|
253
|
+
}catch (e){
|
|
254
|
+
this.loadingStaff = false
|
|
255
|
+
this.lastLoadingTime = Date.now()
|
|
256
|
+
console.log(e)
|
|
257
|
+
}
|
|
258
|
+
},
|
|
210
259
|
getOrgList(data){
|
|
211
260
|
this.proOrgList = data
|
|
212
261
|
},
|