<template>
|
<view class="page">
|
<view class="packing-personnelList-bg"/>
|
<u-navbar title="人员列表" :background="background" :border-bottom="false" :title-bold="true" title-color="#000" back-icon-color="#000"/>
|
<view class="packing-personnelList-search">
|
<u-search v-model="keywords" shape="square" bg-color="rgba(250,252,255,0.36)" :show-action="false" placeholder="请输入人员名称" @clear="search" @custom="search" @search="search">
|
</u-search>
|
</view>
|
<view class="packing-personnelList-body-title">
|
<view class="title-label">检索结果选择</view>
|
</view>
|
<view class="wrap">
|
<scroll-view class="packing-personnelList-scroll-list" scroll-y="true" @scrolltolower="loadMore">
|
<u-cell-group class="packing-personnelList-scroll-list-group" :border="false">
|
<view class="content" v-for="(item, index) in list" :key="item.id" :index="index">
|
<view class="row-list" @click="switchSelected(item)">
|
<view class="row-list-item">
|
<view class="no-icon"></view>
|
<view class="no-label">人员编号:</view>
|
<view class="no-value">{{item.staffNo}}</view>
|
</view>
|
<view class="row-list-item">
|
<view class="name-icon"></view>
|
<view class="name-label">人员名称:</view>
|
<view class="name-value">{{item.staffName}}</view>
|
</view>
|
<view :class="item.isSelected?'selected-label':'unselected-label'">
|
|
</view>
|
</view>
|
</view>
|
</u-cell-group>
|
<view class="loadmore" @click="loadMore">
|
<u-loadmore :status="loadStatus"></u-loadmore>
|
</view>
|
</scroll-view>
|
<view class="packing-personnelList-form-footer">
|
<u-button class="btn" type="primary" @click="confirm">确定</u-button>
|
</view>
|
</view>
|
</view>
|
</template>
|
<script>
|
import content_bg from '@/static/custom/packing/backBg.png'
|
export default {
|
data() {
|
return {
|
background:{
|
backgroundImage: `url(${content_bg})`,
|
backgroundAttachment: 'fixed',
|
backgroundSize: '100% auto',
|
backgroundRepeat: 'no-repeat',
|
},
|
keywords: '',
|
alllist: [],
|
originList: [],
|
|
query: {
|
current: 1,
|
size: 10
|
},
|
list: [],
|
count: 0,
|
loadStatus: 'loading',
|
idList:[]
|
};
|
},
|
onLoad() {
|
this.$u.api.pigxPacking.getStaff().then(res => {
|
console.log(res);
|
let resData=res.data
|
resData.forEach((item)=>{
|
item.isSelected=false
|
})
|
this.alllist = resData
|
this.originList = resData
|
this.loadList()
|
})
|
},
|
methods: {
|
change(e) {
|
this.idList = e.detail.value
|
},
|
switchSelected(item){
|
item.isSelected=!item.isSelected
|
},
|
loadMore() {
|
if(this.loadStatus == "nomore" || this.loadStatus == "loading"){
|
return
|
}
|
this.loadStatus = "loading";
|
setTimeout(() => {
|
this.query.current += 1;
|
this.loadList();
|
}, 100);
|
},
|
loadList() {
|
const data = this.originList.slice((this.query.current-1)*this.query.size,this.query.current*this.query.size)
|
this.list = this.list.concat(data);
|
this.loadStatus = "loadmore";
|
if (!data || data.length < this.query.size) {
|
this.loadStatus = "nomore";
|
}
|
},
|
search(value) {
|
this.list = [];
|
this.query.current = 1;
|
if (value) {
|
this.originList = this.alllist.filter(item => item.staffName.includes(value))
|
} else {
|
this.originList = this.alllist
|
}
|
this.loadList()
|
},
|
confirm(){
|
this.idList=[]
|
this.list.forEach((item)=>{
|
if(item.isSelected){
|
let staffInfo=item.id.toString() + ',' + item.staffName + ',' + item.staffNo
|
this.idList.push(staffInfo)
|
}
|
})
|
if(this.idList.length>0){
|
this.refreshLastPage()
|
}else{
|
this.$u.toast('请先选择人员')
|
}
|
},
|
//刷新上一个页面
|
refreshLastPage() {
|
// 告知 A.vue 更新数据
|
// 获取页面栈
|
let pages = getCurrentPages()
|
|
// 获取上一页栈
|
let prevPage = pages[pages.length - 2]
|
|
// 触发上一页 upData 函数(并携带参数)
|
prevPage.$vm.setNo(this.idList)
|
|
// 返回上一页
|
uni.navigateBack({
|
delta: 1
|
})
|
},
|
}
|
};
|
</script>
|
<style lang="scss">
|
.packing-personnelList-bg{
|
background-color: #F6F9FF;
|
background-image: url('~@/static/custom/packing/backBg.png');
|
// background: linear-gradient(180deg,rgba(206,227,254,1),rgba(206,227,254,1) 20%,rgba(206,227,254,0.5) 40%,rgba(206,227,254,0.25) 60%,rgba(206,227,254,0.08) 80%,rgba(206,227,254,0));
|
padding: 0 20rpx;
|
background-attachment: fixed;
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
position: fixed;
|
top: 0;
|
bottom: 0;
|
width: 100%;
|
z-index: -1;
|
}
|
|
.packing-personnelList-search{
|
padding: 40rpx 30rpx 20rpx 30rpx;
|
}
|
|
.packing-personnelList-body-title{
|
padding: 0rpx 30rpx 0rpx 30rpx;
|
margin-top: 20rpx;
|
margin-bottom: 26rpx;
|
.title-label{
|
font-size: 28rpx;
|
color: #6D82A1;
|
}
|
}
|
|
.wrap .packing-personnelList-scroll-list{
|
height:calc(100vh - var(--window-top) - var(--window-bottom) - 446rpx);
|
width:100%;
|
}
|
.packing-personnelList-scroll-list-group{
|
::v-deep .u-cell-item-box {
|
background-color:rgba(250,252,255,0.36) !important;
|
padding:0rpx 30rpx ;
|
display: flex;
|
justify-content: space-between;
|
flex-wrap:wrap;
|
}
|
.content {
|
background-image: url('~@/static/custom/packing/person_row_bg.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:138rpx;
|
width:336rpx;
|
font-size: 12px;
|
background-color: #FFFFFF;
|
box-sizing: border-box;
|
border-radius: 10rpx;
|
margin: 0rpx 0rpx 20rpx;
|
padding: 0rpx 16rpx 0rpx 16rpx;
|
box-shadow: none;
|
.row-list{
|
height: 100%;
|
padding-top: 30rpx;
|
padding-bottom: 24rpx;
|
display: flex;
|
flex-direction:column;
|
justify-content: space-between;
|
position: relative;
|
.row-list-item{
|
display: flex;
|
align-items: center;
|
.no-icon{
|
background-image: url('~@/static/custom/packing/icon_1.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:26rpx;
|
width:26rpx;
|
}
|
.no-label{
|
margin-left:4rpx;
|
color: #666666;
|
font-size: 26rpx;
|
}
|
.no-value{
|
color: #333333;
|
font-size: 26rpx;
|
}
|
.name-icon{
|
background-image: url('~@/static/custom/packing/icon_2.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:26rpx;
|
width:26rpx;
|
}
|
.name-label{
|
margin-left:4rpx;
|
color: #666666;
|
font-size: 26rpx;
|
}
|
.name-value{
|
color: #333333;
|
font-size: 26rpx;
|
}
|
}
|
.selected-label{
|
position:absolute;
|
bottom: 12rpx;
|
right: 2rpx;
|
background-image: url('~@/static/custom/packing/click-selected.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:28rpx;
|
width:26rpx;
|
}
|
.unselected-label{
|
position:absolute;
|
bottom: 12rpx;
|
right: 2rpx;
|
background-image: url('~@/static/custom/packing/click-unselected.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:28rpx;
|
width:26rpx;
|
}
|
}
|
}
|
}
|
|
.packing-personnelList-form-footer{
|
display: flex;
|
margin-top: 10rpx;
|
margin-bottom: 10rpx;
|
margin-left: 20rpx;
|
margin-right: 20rpx;
|
padding-bottom: 14rpx;
|
.btn {
|
flex: 1;
|
margin: 10rpx;
|
background: #214DED;
|
box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(4,49,212,0.3);
|
font-weight: bold;
|
color: #FEFEFE;
|
font-family: PingFang SC;
|
}
|
}
|
|
</style>
|