yxk_h5_master/pages/advertiseInfo/advertiseInfo.vue

466 lines
12 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content">
<view class="mb">
<view class="filter_container">
<view class="search_container" @click="toSearch()">
<uni-icons class="search_icon" type="search" size="20" v-model="advertisePositionName" color="#bdbdbd"></uni-icons>
<input style="text1" class="input-" size="20" placeholder="招聘岗位(模糊查询)" v-model="advertisePositionName" />
</view>
<view class="otherFixed">
<view class="text " @click="showSinglePicker">{{deptResult.name}}</view>
<view class="text" @click="filterDate">{{timeData.begin==''?'日期范围':(timeData.begin+'~'+timeData.end)}}</view>
</view>
</view>
</view>
<view class="example-body" v-if="listCards.length>0">
<view v-for="(item,index) in listCards" :key="index" class="example-box" style="position: relative;" @click="clickDetail(item)">
<dev-block :title="item.title" :titleNumber="item.titleNumber" :note="item.note"
:extra="item.extra" :tagType="item.tagType"
:contentList="item.contentList"></dev-block>
</view>
<uni-load-more :status="loading_status" ></uni-load-more>
</view>
<view class="example-body" v-else>
<no-record ></no-record>
</view>
<view class="goHome" @click='goMain("workInfo")'>
<img src="../../static/img/gohome.png">
</view>
<uni-calendar ref="calendar" :lunar="false" :range="true" @confirm="confirmDate" @cancel='cancleData'/>
<lb-picker ref="picker" mode="multiSelector" :level="level" :pickerValueDefault="[0,0]"
@confirm="pickerConfirm" :props="myProps" :list="deptArray"></lb-picker>
</view>
</template>
<script>
import LbPicker from '@/components/lb-picker'
import mpvuePicker from '@/components/mpvue-picker/mpvuePicker.vue';
import devBlock from '@/components/xinsoft-dev-block/xinsoft-dev-block.vue'
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import noRecord from '@/components/xinsoft-no-record/xinsoft-no-record';
import uniBadge from '@/components/uni-badge/uni-badge.vue'
import uniCalendar from '@/components/uni-calendar/uni-calendar.vue'
export default {
components: {
LbPicker,devBlock,uniLoadMore,noRecord,uniBadge,uniCalendar,mpvuePicker
},
data() {
return {
current_num:2,
deptArray:[],
level:4,
advertisePositionName: '',
myProps: {
label: 'text',
value: 'id',
children: 'children'
},
listCards: [],
//上拉刷新,下拉加载
loading_status: 'more',//moreloading前、loadingloading中、noMore没有更多了
pageSize:5,
page:1,
approveState:63,
filter:{},
//日历变量。
timeData:{
begin:"",
end:''
},
deptResult:{
value:'',
name:'部门'
},
userInfo:{}
}
},
onLoad() {
var _this = this;
this.userInfo = uni.getStorageSync('userInfo');
this.filter = {
approveUserId :this.userInfo.userId
}
// this.getDept('');
this.getDept(this.userInfo.deptId);
//初始化当前列表。
this.dataList();
},
onReachBottom: function() {
//下拉刷新的时候请求一次数据
if(this.loading_status=='noMore'){
return false;
}
this.page++;
this.dataList();
},
onPullDownRefresh: function() {
this.listCards=[];
this.page=1;
this.loading_status="more";
//触底的时候请求数据,即为上拉加载更多
this.dataList();
},
methods: {
// 按招聘岗位查询
toSearch() {
this.dataList(1)
},
getDept(deptId){
//使用部门
this.$http.request({
url: '/apis/dept/tree',
params:{
deptId:deptId
},
method:'GET',
}).then(res=>{
if(res.statusCode == '200'){
this.deptArray =res.data.data.children
}
}).catch(err=>{
console.log(err);
});
},
filterConfirm(f){
//筛选成功。
var num = f.num;
if(num == 1 || num == ''){
this.filter = {
userId :this.userInfo.userId
}
}else if(num == 2){
this.filter = {
approveUserId:this.userInfo.userId
}
}else if(num == 3){
this.filter = {
deptId:this.userInfo.deptId
}
}
this.current_num = num;
this.filter.userName = f.userName;
this.listCards=[];
this.page=1;
this.loading_status="more";
this.dataList();
},
dataList(n){
if(n==1){
this.page=1
this.listCards=[]
}
this.loading_status="loading";
var filterRes = this.filter;
filterRes.pageno = this.page;
filterRes.type = 1;
filterRes.pagesize = this.pageSize;
filterRes.approveState = this.approveState;
filterRes.startTime = this.timeData.begin;
filterRes.endTime = this.timeData.end;
filterRes.deptId = (this.deptResult.value || this.filter.deptId || '' )
filterRes.advertisePositionName = this.advertisePositionName
this.$http.request({
url: '/apis/advertiseInfo/list',
method:'post',
paramsBody:filterRes,
}).then(res=>{
uni.stopPullDownRefresh();
if(!res.data.data.records){
this.loading_status="noMore";
}else if(res.data.data.records.length<this.pageSize){
this.loading_status="noMore";
}else{
this.loading_status="more";
}
if(res.data.code == 0){
if(res.data.data.records.length>0){
this.listCards = this.listCards.concat(this.formaterData(res.data.data.records));
}
}
}).catch(err=>{
this.loading_status="noMore";
});
},
clickDetail(item){
//点击详情
uni.navigateTo({
url: 'advertiseInfoDetail?id='+item.id+'&num='+this.current_num
});
},
showSinglePicker() {
//关闭之前filter。
// document.getElementById("popupRef").style.display="none";
this.$refs.picker.show()
},
pickerConfirm(e){
var value = e.value;
console.log(value)
var name = ''
this.filter.deptId = ''
if(value[1] == '-') {
name = e.item[0].text
this.deptResult.value = value[0]
} else {
this.deptResult.value = value[2]?value[2]:value[1];
if(value[2]){
// name = name.substring(0,name.length-2);
name = e.item[0].text+'/'+e.item[1].text+'/'+e.item[2].text
} else {
name = e.item[0].text+'/'+e.item[1].text
}
}
console.log(this.deptResult.value)
this.deptResult.name = name;
this.listCards=[];
this.page=1;
this.loading_status="more";
this.dataList();
},
// showSinglePicker() {
// //关闭之前filter。
// // document.getElementById("popupRef").style.display="none";
// this.$refs.mpvuePicker.show()
// },
// pickerConfirm(e){
// var value = e.value;
// this.deptResult.value = value[1]?value[1]:value[0];
// var name = e.label;
// if(!value[1]){
// name = name.substring(0,name.length-2);
// }
// this.deptResult.name = name;
// this.listCards=[];
// this.page=1;
// this.loading_status="more";
// this.dataList();
// },
formaterData(data){
var resData = [];
data.forEach((vals,index)=>{
var combineJSON = {
id: vals.id,
title: "招聘需求单号"+":"+vals.advertiseCode,
contentList: [
{
id:1,
isDouble:false,
labelName:'招聘部门',
labelContent:vals.deptName
},
{
id:2,
isDouble:false,
labelName:'招聘岗位',
labelContent:vals.advertisePositionName
},
{
id:3,
isDouble:false,
labelName:'招聘人数',
labelContent:vals.advertiseCounts
},
{
id:4,
isDouble:false,
labelName:'申请人',
labelContent:vals.applicant
},
{
id:5,
isDouble:false,
labelName:'申请时间',
labelContent:vals.submitTime
}
],
extra: vals.approveStateName,
tagType:this.setTag(vals.approveStateName),
}
resData.push(combineJSON);
});
return resData;
},
setTag(approveStateName){
if(approveStateName == '审批中'){ //审批中
return '106'
}
},
filterDate() {
//关闭之前filter。
// document.getElementById("popupRef").style.display="none";
this.$refs.calendar.open();
},
confirmDate(e){
if(e.range.begin && e.range.end){
this.timeData = {
begin:e.range.begin+' 00:00:00',
end:e.range.end+' 00:00:00'
}
this.listCards=[];
this.page=1;
this.loading_status="more";
this.dataList();
}
}
},
onNavigationBarButtonTap(obj) {
//重置下
uni.removeStorageSync('workInfo');
uni.navigateTo({
url: 'addWorkApply'
});
},
onBackPress(options) { //取消默认的返回事件.
uni.switchTab({
url: "../main/main"
});
return true;
}
}
</script>
<style scoped>
>>>.picker-item .lb-picker-column .lb-picker-column-label {
-webkit-transition: all 0.3s;
transition: all 0.3s;
line-height: 55px !important;
}
uni-input {
position: relative;
top: 4px;
color: rgb(102, 102, 102);
display: block;
font-size: 13px;
line-height: 1.4em;
height: 1.4em;
min-height: 1.4em;
overflow: hidden;
}
.content{
position: relative;
}
.filter_container {
position: fixed;
width: 50%;
top: var(--window-top);
background-color: #fff;
height: 40px;
z-index: 2;
padding-top: 7px;
box-sizing: border-box;
}
>>>.doubleList:nth-of-type(1) {
width: 60%;
}
>>>.doubleList:nth-of-type(2) {
width: 40%;
}
>>>.doubleList:nth-of-type(3) {
width: 60%;
}
>>>.doubleList:nth-of-type(4) {
width: 40%;
}
>>>.dev-label{
white-space: nowrap;
}
>>>.select-tab-fixed-top{
right: 0;
width: 50%;
z-index: 2;
top:var(--window-top);
white-space: nowrap
}
>>>.popup-layer{
position: fixed;
top: var(--window-top);
margin-top: 40px;
}
>>>.filter-content-detail{
/* position: relative;
height: 90px;
overflow: scroll; */
}
.search_container {
position: relative;
padding-left: 30px;
box-sizing: border-box;
color: #bdbdbd;
margin: auto;
width: 80%;
height: 26px;
background-color: #F6F6F6;
border-radius: 26px;
font-size: 14px;
line-height: 26px;
}
.search_icon{
position: absolute;
left: 5px;
top: 3px;
}
.fliter_content {
position: absolute;
right: 15px;
left: 85px;
height: 100%;
z-index: 2;
}
.arrowright{
position: absolute;
right: 30upx;
bottom: 30upx;
font-size: 40upx !important;
}
>>>.dev-block__content{
padding-right: 36upx;
}
>>>.dev-block__header-title-text{
overflow: auto;
white-space: pre-wrap !important;
}
/* >>>.select-tab >>>.select-tab-item[data-v-fe683d44],
>>>.select-tab-fixed-top >>>.select-tab-item[data-v-fe683d44] {
width: 100% !important;
} */
.arrowright{
position: absolute;
right: 30upx;
bottom: 30upx;
font-size: 40upx !important;
}
>>>.dev-block__content{
padding-right: 36upx;
}
>>>.popup-layer{
position: fixed;
top: var(--window-top);
margin-top: 40px;
}
.otherFixed {
background: #fff;
width: 50%;
text-align: center;
color: #666;
position: fixed;
top: 45px;
z-index: 2;
height: 40px;
right: 0px;
}
.mb {
margin-bottom: 50px;
}
</style>