<template>
	<view class="check" >
		<view class="navbox">
			<view class="plr12 mt18">
				<view class="search flex0 mb10">
					<image :src="searchimg"></image>
					<input placeholder="输入委员姓名进行查询" v-model="title" @confirm="getSearch"/>
				</view>
			</view>
			<!-- <view class="tablists flexc mb20">
				<view v-for="(ite,idx) in tabList" @click="getTabFn(ite.val)" :class="{act:tabidx==ite.val}" :key="idx">{{ite.tit}}</view>
			</view> -->
		</view>
		<view class="ctip flex0">请左右滑动查看详细信息</view>
		<!-- 表格 -->
		<view class="tables">
			<view class="table">
				<zb-table
				  :show-header="true"
				  :columns="columns"
				  :headbgColor="headbgColor"
				  :stripe="false"
				  :fit="true"
				  :parameter="parameter"
				  @rowClick="rowClick"
				  @toggleRowSelection="toggleRowSelection"
				  @toggleAllSelection="toggleAllSelection"
				  :border="border"
				  :borderr="borderr"
				  @detail="getDetail"
				  :data="tableData"></zb-table>	
			</view>
		</view>

		<!-- 弹窗 -->
		<pop-up :type='ptype' @getClose="getClose"></pop-up>
	</view>
</template>

<script>
	import zbTable from "@/work/components/zb-table/zb-tables.vue"
	import {getMeetDetaiFn,getMeetPeoListFn,getzxActivityPeoFn} from "@/api/mine/meeting.js"
	import popUp from "@/work/components/popup/popup.vue"
	import {getDictionaryFn} from "@/api/mine/register.js"
	export default{
		components:{popUp,zbTable},
		data(){
			return{
				searchimg: require("@/work/static/images/search.png"),
				ccicoimg:require("@/work/static/images/ccico.png"),
				lbicoimg:require("@/work/static/images/lbico.png"),
				backimg:require("@/work/static/images/back.png"),
				upimg:require("@/work/static/images/up.png"),
				backgroundColor:"#1D64E2",
				tabidx:0,
				tabList:[{tit:'全部',val:0},{tit:'已读',val:1},{tit:'未读',val:2},{tit:'请假',val:3}],
				talbList:[{},],
				taztList:[{label:'是',value:'0'},{label:'否',value:'1'}],
				talbidx:'',
				datainfo:{
					talb:'',
				},
				columns: [
				    { name: 'userName', label: '姓名',width:130,align:'center', },
				    { name: 'postName', label: '工作地址及职务',align:'center'},
				    { name: 'replyTime', label: '答复时间',align:'center'},
				    // { name: 'unit', label: '是否参会',align:'center'},
					{ name: 'isJoin', type:'operation',label: '是否参会',key:"qjlist",renders:[
						  {
						    name:'isJoin',
						    type:'detail',
						    func:"detail"
						  },
					]},
					{ name: 'leaveReason', label: '请假事由',align:'center'},
				],
				ptype:'',//弹窗类型
				border:true,
				borderr:false,
				headbgColor:'#F1F1F1',
				tableData:[],
				id:'',
				title:'',
				parameter:{
					qjlist:[]
				},
				tabidx:""
				
			}
		},
		onUnload(){
			uni.$off('refreshlist')
		},
		onLoad(e) {
			this.id=e.id;
			this.tabidx=e.a
			this.getDataFn()
			this.init()
			// this.getDataFn()
			
			// uni.$on('refreshlist', (e) => {
			// 	this.getDataFn()
			// })
		},
		mounted() {
		},
		methods:{
			// 提案状态
			init(){
				// 请假理由
				getDictionaryFn('leave').then(res=>{
					if(res.code==200&&res.data.length){
						this.parameter.qjlist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
			},
			getClose(){
				this.ptype=""
			},
			getTabFn(idx){
				this.tabidx=idx;
			},
			getBack(){
				uni.navigateBack({
					delta:1
				})
			},
			rowClick(){
				
			},
			getDetail(data){
				console.log(52)
				// this.$tab.navigateTo('/work/pages/case/details?id='+data)	
			},
			getSearch(){
				this.getDataFn()
			},
			getDataFn(){
				var params={
					userName:this.title
				}
				var type=this.tabidx;
				if(type=='zxhd'){
					params.activityId=this.id
					getzxActivityPeoFn(params).then(res=>{
						if(res.code==200){
							this.tableData=res.rows
						}
					}) 
				}else{
					params.conferenceId=this.id
					getMeetPeoListFn(params).then(res=>{
						if(res.code==200){
							this.tableData=res.rows
						}
					}) 
				}
				
				
			},
		}
	}
</script>

<style scoped lang="scss">
page{background-color: #FFFFFF;}
.check{height: 100vh;display: flex;flex-direction: column;
	.tables{flex:0 1 auto;overflow: auto;padding: 0 24rpx;
		.table{
			height: 100%;
		}
	}
	.ctip{font-weight: 500;padding: 22rpx 24rpx 26rpx;font-size: 26rpx;color: #FF0000;}
	.cbtn{margin: 0 24rpx;height: 80rpx;background: #1D64E2;border-radius: 80rpx;font-weight: bold;font-size: 30rpx;color: #FFFFFF;}
}
.navbox{background-color: $com-cd3;flex: 0 0 auto;
	.tablists{
		overflow: auto;flex-wrap: nowrap;
		view{font-weight: bold;font-size: 26rpx;color: #FFFFFF;position: relative;flex: 1;padding: 22rpx 24rpx;margin-right: 6rpx;box-sizing: border-box;
				text-align: center;
			&:last-child{margin-right: 0;}
			&.act{font-size: 30rpx;
				&::after{content: '';width: 62rpx;height: 10rpx;background: #FFFFFF;border-radius: 4rpx;left: 50%;margin-left: -31rpx;bottom: 0rpx;position: absolute;}
			}
		}
	}
}
</style>