252 lines
5.4 KiB
Vue

<template>
<view class="queryStaff">
<headers :showBack="true">
<view class="headerName">
人员查询
</view>
</headers>
<view class="content">
<view class="flex input_Wrap">
<input placeholder="请输入人员姓名/身份证" @input="changeSeek" @focus="showValue=true" @blur="blur"
class="input_c" placeholder-style="font-size:28rpx" :value="inputVal" />
<text class="seekBtn" @click="changeSeek({detail:{value:inputVal}})">搜索</text>
</view>
<view class="results_wrap" v-if="showValue">
<view class="value" v-if="listData.length>0" v-for="(item,index) in listData" :key="index"
@click="showDetailsBtn(item.id)">
<!-- <text v-if="item.personType==1">{{item.workerName+'-'+item.teamName+'-'}}<text class="font_weight">{{item.idCard}}</text></text>
<text v-else>{{item.workerName+'-'+item.departmentName+'-'}}<text class="font_weight">{{item.idCard}}</text></text> -->
<view v-if="item.personType==1">
<text>{{item.workerName+'-'+(item.teamName?item.teamName+'-':'')}}</text>
<text class="font_weight">{{item.idCard}}</text>
</view>
<view v-else-if="item.personType==3">
<text>{{item.workerName+'-'+'临时人员-'}}</text>
<text class="font_weight">{{item.idCard}}</text>
</view>
<view v-else>
<text>{{item.workerName+'-'+(item.departmentName?item.departmentName +'-':'')}}</text>
<text class="font_weight">{{item.idCard}}</text>
</view>
<!-- <uni-icons class="arrowright" type="arrowright"></uni-icons> -->
</view>
<view v-if="listData.length==0" class="noData">暂无数据</view>
</view>
<view class="margin_top" v-else-if="COMPANY != 'nanchang'">
<view class="placeholder flex2">
<view class="striping"></view>
<view style="margin:0 10px;">其他搜索方式</view>
<view class="striping"></view>
</view>
<view class="func_wrap flex2">
<view class="item" @click="scanQRcodeBtn">
<image src="../../../static/scan.png" class="icon"></image>
<view>扫码</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import uniIcons from "@/components/uni-icons/uni-icons.vue"
export default {
data() {
return {
inputVal: "",
showValue: false,
projectSn: '',
listData: [],
}
},
onLoad() {
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
},
methods: {
//输入内容时
changeSeek(val) {
let that = this;
this.inputVal = val.detail.value;
if (val.detail.value == "") {
this.listData = [];
this.showValue = true;
return
}
this.sendRequest({
url: 'xmgl/workerInfo/selectAppWorkerList',
method: "post",
data: {
projectSn: that.projectSn,
searchCondition: val.detail.value
},
success: res => {
this.listData = res.result;
this.listData.map(item => {
let str = "***************"
item.idCard = item.idCard.substring(0, 3) + str + item.idCard.substring(16)
})
}
})
},
//扫码按钮
scanQRcodeBtn() {
let that = this;
// 只允许通过相机扫码
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
that.showDetailsBtn(res.result)
},
fail: function(error) {}
});
},
//输入框失去焦点时
blur() {
if (this.inputVal == '') {
this.showValue = false;
}
},
showDetailsBtn(id) {
uni.navigateTo({
url: './searchTeam/personDetail?id=' + id
})
},
}
}
</script>
<style scoped lang="scss">
.flex {
display: flex;
align-items: center;
}
.flex2 {
display: flex;
align-items: center;
justify-content: center;
}
.flex3 {
display: flex;
align-items: center;
justify-content: space-between;
}
.queryStaff {
width: 100%;
box-sizing: border-box;
}
.queryStaff .content {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 55px 30rpx 0;
}
.input_Wrap {
width: 80%;
/* margin: 0 auto; */
border: 1px solid #d8d8e5;
box-sizing: border-box;
padding: 0;
border-radius: 20px;
}
.input_Wrap .input_c {
width: calc(100% - 116rpx);
height: 64rpx;
padding: 0 10px;
box-sizing: border-box;
font-size: 28rpx;
}
.input_Wrap .seekBtn {
padding: 6.5px 30rpx;
width: 116rpx;
height: 64rpx;
box-sizing: border-box;
background-color: rgba(65, 129, 254, 0.9);
color: #fff;
font-size: 28rpx;
/* border-radius: 2px; */
border-radius: 20px;
position: absolute;
right: 15px;
}
.seekBtn:active {
background-color: #4181FE;
}
.placeholder {
text-align: center;
margin: 0 auto;
width: 80%;
font-size: 30rpx;
color: rgba(38, 45, 71, 0.8);
}
.striping {
background-color: rgba(38, 45, 71, 0.6);
height: 1px;
width: 120rpx;
}
.func_wrap .item {
text-align: center;
margin: 18px 0;
font-size: 28rpx;
color: rgba(38, 45, 71, 0.8);
line-height: 16px;
}
.icon {
width: 78rpx;
height: 39px;
}
.results_wrap .value {
/* text-align: center; */
font-size: 28rpx;
line-height: 35px;
margin: 5px 0;
border-bottom: 1px dashed #babcc5;
>view{
width: 100%;
// display: flex;
// align-items: center;
// text:nth-child(1){
// display: block;
// }
}
}
.arrowright {
color: #999 !important;
}
.margin_top {
margin-top: 100px;
}
.font_weight {
font-weight: 700;
}
.noData {
text-align: center;
margin-top: 50px;
font-size: 28rpx;
color: #999;
}
</style>