<template>
|
<view class="work-order-list">
|
<view class="page-head">
|
<u-navbar title="人员列表" :border-bottom="false"
|
:background="background"
|
:title-bold="true" title-color="#000"
|
back-icon-color="#000" />
|
<view class="search">
|
<u-search placeholder="请输入人员名称" v-model="staffName"
|
border-color="#ADC8E4" shape="square" bg-color="rgba(250,252,255,0.36)"
|
placeholderColor="#8992A3" :showAction="false" style="margin: 35rpx;"
|
searchIconColor="#333333" height="74" @search="search" @change="search"></u-search>
|
</view>
|
<span class="title">检查结果选择</span>
|
<view class="list">
|
<view v-for="(item, index) in personList" :key="index" class="person-card">
|
<view class="card-info">
|
<span>
|
<u-icon class="icon_num" size="26rpx"/>
|
<span class="h5-title">人员编号:</span>
|
<span class="h5-info">{{item.staffNo}}</span>
|
</span>
|
<span>
|
<u-icon class="icon_person" size="26rpx"/>
|
<span class="h5-title">人员名称:</span>
|
<span class="h5-info">{{item.staffName}}</span>
|
</span>
|
</view>
|
<u-checkbox active-color="#428BF7" icon-size="24rpx" class="checkbox" v-model="item.checked" @change="checkboxChange(item)"></u-checkbox>
|
</view>
|
<view class="loadmore" @click="loadMore">
|
<u-loadmore :status="loadStatus"></u-loadmore>
|
</view>
|
</view>
|
</view>
|
<view class="bottom">
|
<u-button class="u-button" :loading="loading" type="primary" @click="submit">提交</u-button>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import content_bg from '@/static/custom/daily/background.png'
|
import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue";
|
|
export default {
|
name: "production-person",
|
// import 引入的组件需要注入到对象中才能使用
|
components: {UIcon},
|
data() {
|
// 这里存放数据
|
return {
|
background: {
|
// background:'transparent'
|
backgroundImage: `url(${content_bg})`,
|
backgroundAttachment: 'fixed',
|
backgroundSize: '100% auto',
|
backgroundRepeat: 'no-repeat',
|
},
|
loading:false,
|
staffName:'',
|
personCheckedList : [],
|
personList: [],
|
query: {
|
current: 1,
|
size: 20,
|
staffName: '',
|
divisionName:"生产部"
|
},
|
loadStatus: 'loadmore',
|
}
|
},
|
async onLoad(options) {
|
this.personCheckedList = []
|
this.personCheckedList = JSON.parse(decodeURIComponent(options.list))
|
await this.loadList()
|
},
|
// 方法集合
|
methods: {
|
checkboxChange (item) {
|
if(!item.checked) {
|
const obj = {
|
staffName: item.staffName,
|
staffNo: item.staffNo
|
}
|
this.personCheckedList.push(obj)
|
} else {
|
var index = this.personCheckedList.findIndex((i) => {
|
return i.staffNo==item.staffNo;
|
})
|
this.personCheckedList.splice(index,1);
|
}
|
this.$set(item, 'checked', !item.checked)
|
},
|
submit () {
|
console.log(`output->this.personCheckedList`,this.personCheckedList)
|
this.loading = true;
|
uni.$emit('checkedList',this.personCheckedList)
|
uni.navigateBack({
|
//关闭当前页面,返回上一页面或多级页面。
|
delta:1
|
});
|
this.loading = false;
|
},
|
// async getUserInfoFun() {
|
// const params = {
|
// current: this.page.current,
|
// size: this.page.size,
|
// staffName: this.staffName
|
// }
|
// await this.$u.api.dailyPaper.getUserInfo(params).then(res => {
|
// this.personList = res.data.records
|
// this.choosingFUn(this.personList, this.personCheckedList)
|
// })
|
// },
|
search (e) {
|
this.query = {
|
current:1,
|
size:20,
|
staffName: e,
|
divisionName:"生产部"
|
}
|
this.loadList()
|
},
|
// 在此加载列表
|
loadList(){
|
this.$u.api.dailyPaper.getUserInfo(this.query).then(res => {
|
console.log(res)
|
if (res.code === 0) {
|
if (!res.data.records || res.data.records.length === 0) {
|
this.loadStatus = "nomore";
|
return;
|
}
|
if (this.query.current === 1) {
|
this.personList = res.data.records
|
} else {
|
this.personList = this.personList.concat(res.data.records);
|
}
|
this.choosingFUn(this.personList, this.personCheckedList)
|
this.total = res.data.total;
|
this.query.current = res.data.current;
|
this.query.size = res.data.size;
|
this.loadStatus = "loadmore";
|
}
|
});
|
},
|
// 搜索不会使选中消失
|
/**
|
*
|
* @param {主数据列表} mainList
|
* @param {选中的数据列表} selectList
|
*/
|
choosingFUn(mainList, selectList) {
|
for (const i in mainList) {
|
let isExit = false
|
for (const j in selectList) {
|
if(mainList[i].staffNo === selectList[j].staffNo) {
|
isExit = true
|
this.$set(mainList[i], 'checked', true)
|
}
|
}
|
if(!isExit) {
|
this.$set(mainList[i], 'checked', false)
|
}
|
}
|
},
|
loadMore() {
|
this.loadStatus = "loading";
|
setTimeout(() => {
|
this.query.current += 1;
|
this.loadList();
|
}, 100);
|
},
|
},
|
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.work-order-list{
|
width: 100%;
|
height: 100vh;
|
background: #F6F9FF;
|
box-sizing: border-box;
|
padding-bottom: 24rpx;
|
.page-head{
|
height: 750rpx;
|
background-image: url('~@/static/custom/daily/background.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
.title {
|
font-weight: 500;
|
font-size: 28rpx;
|
color: #6D82A1;
|
margin-left: 30rpx;
|
}
|
.list {
|
overflow-y: auto;
|
padding: 0 30rpx;
|
display: flex;
|
flex-direction: row;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
align-content: flex-start;
|
margin-top: 20rpx;
|
height: calc(100vh - 450rpx);
|
.person-card {
|
margin-top: 30rpx;
|
width: 336rpx;
|
height: 138rpx;
|
background: linear-gradient(180deg, #DFEDFF 0%, #F7F7F8 100%);
|
border-radius: 10rpx;
|
border: 1px solid #FFFFFF;
|
position: relative;
|
display:table-cell; vertical-align:middle;
|
.card-info {
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
height: 100%;
|
padding: 0 16rpx;
|
.icon_num {
|
background-image: url('~@/static/custom/daily/icon_num.png');
|
background-repeat: no-repeat;
|
background-size: cover;
|
height: 26rpx;
|
width: 26rpx;
|
position: relative;
|
vertical-align: middle
|
}
|
.icon_person {
|
background-image: url('~@/static/custom/daily/icon_person.png');
|
background-repeat: no-repeat;
|
background-size: cover;
|
height: 26rpx;
|
width: 26rpx;
|
position: relative;
|
vertical-align: middle
|
}
|
.h5-title {
|
font-weight: 500;
|
font-size: 26rpx;
|
color: #666666;
|
margin: 0 6rpx;
|
line-height: 48rpx;
|
}
|
.h5-info {
|
font-weight: 500;
|
font-size: 26rpx;
|
color: #333333;
|
line-height: 48rpx;
|
}
|
}
|
.checkbox {
|
position: absolute;
|
bottom: 12rpx;
|
right: 16rpx;
|
}
|
}
|
.loadmore {
|
margin: 20rpx auto;
|
width: 100%;
|
height: 60rpx;
|
}
|
}
|
}
|
.bottom {
|
width: 100vw;
|
position:fixed;
|
bottom:60rpx;
|
.u-button {
|
width: 690rpx;
|
height: 80rpx;
|
background: #214DED;
|
border-radius: 8rpx;
|
font-weight: 500;
|
font-size: 34rpx;
|
color: #FFFFFF;
|
z-index: 99;
|
}
|
}
|
}
|
::v-deep.uni-input-placeholder {
|
font-weight: 400;
|
font-size: 30rpx;
|
color: #8992A3;
|
line-height: 80rpx;
|
}
|
::v-deep.u-checkbox {
|
display: inline;
|
}
|
::v-deep.u-checkbox__icon-wrap {
|
background: #F5F9FF;
|
border-radius: 2rpx;
|
border: 1px solid #428BF7;
|
}
|
</style>
|