<template>
	<view class="index">
		<u-navbar :background="background" title-color="#ffffff" back-icon-color="#ffffff" >
			<view class="nav_box">
				
				<view class="nav_boxa" :class="navidx==1?'act':''" @click="navcheck(1)">
					<image :src="navbg" class="nav_boxb"></image>
					<view class="nav_boxa1">户籍信息</view>
				</view>
				<view class="nav_boxa" :class="navidx==0?'act':''" @click="navcheck(0)">
					<image :src="navbg" class="nav_boxb"></image>
					<view class="nav_boxa1">常住信息</view>
				</view>
			</view>
			
		</u-navbar>
		<view class="sous_sear">
			<view class="sous_box" @click="getSearch">
				<image :src="searimg" class="sous_img"></image>
				<input  placeholder="请输入身份证号或姓名进行查询" class="sous_input" disabled/>
			</view>
		</view>
		<p style="height: 28upx; background-color: #f2f2f2;"></p>
		<div class="tabld">
			<view :class="[currentTab==index ? 'one_tabhu ' : '']" v-for="(item,index) in tabsta" :key="index" @click="changeTab(index)">
				<text>{{item.text}}</text>
				<!-- <text style="color: #AAAAAA;">{{item.nume}}</text> -->
			</view>
		</div>
		
		<view class="tab">
			<!-- //表格 -->
			<view class="exele">

				<view class="box">
					<table @change="change">
						<tr class="tr_one">
							<th style="width: 100upx; text-align: center;">姓名</th>
							<th style="width: 270upx; text-align: center;">身份证号</th>
							<th style="width: 170upx; text-align: center;">联系方式(人口信息登记)</th>
							<th style="width: 80upx; text-align: center;">是否核酸</th>
							<th style="width: 50upx; text-align: center;">操作</th>
						</tr>
						<view class="scrollbox">
						
						<scroll-view scroll-y class="scroll-view" upper-threshold="40" lower-threshold="40" @scrolltolower="bot_btn">
							<tr v-for="(item,index) in list" :key="index" :class=" [index%2  ==0 ? 'two_tr two_trtwo':'two_tr']" @click="chakn(item)">
								<!-- <td style="width: 130upx; text-align: center;" >{{ item.code == null ? '暂无信息' :  item.code}}</td> -->
								<td style="width: 100upx; text-align: center;" >{{ item.xm == null ? '暂无信息' :  item.xm}}</td>
								<td style="width: 270upx; text-align: center;">{{item.zjhm == null? '暂无信息' : item.zjhm }}</td>
								<td style="width: 170upx; text-align: center;" >{{ item.phoneNum == null? '暂无信息' :  item.phoneNum}}</td>
								<td style="width: 80upx; text-align: center;" v-if="item.isNucleicAcid=='Y'">是</td>
								<td style="width: 80upx; text-align: center;color: #FF0000;" v-else>否</td>
								<td style="width: 50upx; color: #32B16C;" @click.stop="goDetail(item)">查看</td>
							</tr>
							<div class="shax" v-if="list.length>0">
								{{wtdt}}
							</div>
							<div class="zanwu " v-else><span>暂无数据</span></div>	
						</scroll-view>
						<!-- 水印 -->
						<view class="syone" v-if="list.length>0">{{telephone}}</view>
						<view class="sytwo" v-if="list.length>0">{{telephone}}</view>
						<view class="sythree" v-if="list.length>0">{{telephone}}</view>
						</view>
					</table>
				</view>

			</view>
		</view>
		<view class="xinse">
			<view class="xinsel" @click="getTfn">统计功能</view>
			<view class="xinser" @click="getImport">导出</view>
		</view>
		<!-- <div class="xinse" @click="addVacFrom">新增户主</div> -->
		<!-- <div class="xinse" @click.stop="showPicker($event)">选择地址</div> -->
		
		<!-- 弹窗 -->
		<!-- 搜索弹窗 -->
		<view class='bgbox' v-if="searchflag"></view>
		<view class="sfixed" v-if="searchflag">
			<view class="sfixedtop">
				
			
			<view class="sfixed_tit">筛选查询</view>
			<image :src="closeimg" class="sfixed_clo" @click="getSearClose"></image>
			<view class="sfixed_box">
				<input placeholder="请输入身份证号进行查询" class="sfixed_inp" type="text" value="" v-model="formData.zjhm" />
				<input placeholder="请输入姓名进行查询" class="sfixed_inp" type="text" value="" v-model="formData.xm"/>
				
				<input placeholder="请输入手机号进行查询" class="sfixed_inp" maxlength="11" type="number" value="" v-model="formData.lxdh" v-if="roles"/>
				
				<view class="sfixed_line"></view>
				<view class="sfixed_flex">
					<view class="sfixed_a">筛选条件</view>
					<view class="sfixed_ar" @click="getClearFn">重置</view>
				</view>
				
				<view class="address">
					<view class="addtita" v-if="navidx==0">居住地址</view>
					<view class="addtita" v-else>户籍地址</view>
					<view class="addressa" @click="showPicker">
						<view class="addsa" :style="searchresult?'':'color:#AAAAAA;'">{{searchresult||'选择区域'}}</view>
						<image :src="rimg" class="addsimg"></image>
						<!-- <view class="adds" >
							
						</view> -->
					</view>
				</view>
				<!-- 开始时间 -->
				<view class="address">
					<view class="addtita">开始时间</view>
					<view class="addressa" >
						<uni-datetime-picker placeholder='选择采集开始时间' :border="false" v-model="formData.params.startTime" />
						<image :src="rimg"  class="addsimg"></image>
						 <!-- <u-datetime-picker
						                :show="show"
						                v-model="value1"
						                mode="datetime"
						        ></u-datetime-picker> -->
					</view>
				</view>
				<!-- 结束日期 -->
				<view class="address">
					<view class="addtita">结束时间</view>
					<view class="addressa">
						<uni-datetime-picker placeholder='选择采集结束时间' :border="false" v-model="formData.params.endTime" />
						<image :src="rimg" class="addsimg"></image>
					</view>
				</view>
				<!-- 是否核酸 -->
				<view class="address">
					<view class="addtita">是否核酸</view>
					<view class="addressa" @click="showNucleic">
						<view class="addsa" v-if="formData.isNucleicAcid" >{{formData.isNucleicAcid=='Y'?'是':'否'}}</view>
						<view class="addsa" v-else style="color:#AAAAAA">选择是否核酸</view>
						<image :src="rimg" class="addsimg"></image>
					</view>
				</view>
			</view>
			<view class="sfixed_btn" @click="Seach">查询</view>
			</view>
		</view>
		
		
		<view class="bgbox" v-if="houseflag"></view>
		<!-- 是否核酸 -->
		<selectPicker ref="nucleinselet" :list="surelist" title="请选择" @vacChange="vacSureChange"></selectPicker>

		<selectMorePicker 
					ref="picker" 
					:title="auiPicker.title"
					:layer="auiPicker.layer"
					:titflag='auiPicker.titflag'
					:data="auiPicker.data"
					@callback="pickerCallback"
				></selectMorePicker>
		<!-- 时间弹窗 -->		
	<!-- 	<dataTimePicke ref="setpicker" type="datetime-all" toolBarTitle="请选择时间" @change="dataconfirm"></dataTimePicke> -->
	</view>
</template>

<script>
	import selectPicker from '@/_components/picker/selectPicker.vue'
	import selectMorePicker from '@/_components/picker/selectMorePicker.vue'
	import encoding from '@/js_sdk/encoding.js'
	// import dataTimePicke from '@/_components/picker/dataTimePicke.vue'
	export default {
		components:{selectPicker,selectMorePicker},
		data() {
			return {
				background: {
					backgroundColor: '#009FE8'
				},
				navidx:1,
				navbg:require("@/static/image/titbg.png"),
				searimg:require("@/static/image/search.png"),
				closeimg:require("@/static/image/del.png"),
				searchflag:false,
				rimg:require('@/static/image/icon_mine_listenter.png'),
				upimg:require("@/static/image/up.png"),
				activeTab: 0, //tab切换
				//列表数据
				list: [],
				roles:false,
				show: false,
				tabsta: [{
						"text": '全部',
						"nume": 0
					},
					{
						"text": '已核酸',
						"nume": 0
					},
					{
						"text": '未核酸',
						"nume": 0
					},
				],
				currentTab: 0, //tab切换
				Collected: false, //判断已采集未采集   false 已采集  true未采集
				formData: { //上拉刷新
					pageNum: 1,
					pageSize: 20,
					zjhm:'',
					queryType:'hj',
					isNucleicAcid:"",
					xm:'',
					lxdh:'',
					params:{
						'startTime':'',
						'endTime':'',
					}
				},
				villageTowns:'',
				village:'',
				keyword: '',
				haveMore: true,
				wtdt: '上拉加载更多',
				
				shwtie:0,
				townslist:[],//乡镇
				villagelist:[],//村,
				villageTownsId:'',
				villageId:'',
				searchresult:'',//搜索区域显示
				houselist:[{
					"label": '是',
					"value":0
				},{
					"label": '否',
					"value":1
				}],
				surelist:[{
					"label": '是',
					"value":'Y'
				},{
					"label": '否',
					"value":'N'
				}],
				sureselet:false,
				houseflag:false,
				auiPicker: {
					title: '选择区域',
					layer: null,
					titflag:true,
					data: []
				},
				houseobj:{
					id:'',
					code:''
				},
				housetypflag:false,
				telephone:'',
				importflag:false
			};
		},
		onShow() {
			let type = uni.getStorageSync('token')
			if (!type) {
				uni.redirectTo({
					url: '/pages/login/login'
				})
			}else{
				let roles=uni.getStorageSync('roles')||false
				this.roles=roles
			}
			this.importflag=false;
		},
		onLoad(option) {
			
			// 水印
			this.telephone = uni.getStorageSync('phone')||''
			// 水印
			uni.$on('refreshData',(data) => {
				this.formData.pageNum = 1;
				this.list = []
				// 修改 获取列表的
				// 获取统计
				// this.getAlllist()
				this.lists(this.formData)
			})
			 // this.getTownsFn();
			 this.formData.pageNum = 1;
			 this.importflag=false;
			 this.list = []
			 // 修改 获取列表的
			 // 获取统计
			 // this.getAlllist()
			 // 获取时间
			 var time = new Date().getTime()-24*60*60*1000;
			 this.formData.params.startTime =this.Format(new Date(time),"yyyy-MM-dd hh:mm:ss");
			 this.formData.params.endTime = this.Format(new Date(),"yyyy-MM-dd hh:mm:ss"); 
			this.lists(this.formData)
			this.getRegionListFirst()
		},
		beforeDestroy() {
			uni.$off("refreshData")
		},
		created() {

		},
		methods: {
			// 时间格式化
			Format(time,fmt) { // author: meizz
			    var o = {
			        "M+": time.getMonth() + 1, // 月份
			        "d+": time.getDate(), // 日
			        "h+": time.getHours(), // 小时
			        "m+": time.getMinutes(), // 分
			        "s+": time.getSeconds(), // 秒
			        // "q+": Math.floor((time.getMonth() + 3) / 3), // 季度
			        // "S": time.getMilliseconds() // 毫秒
			    };
			    if (/(y+)/.test(fmt))
			        fmt = fmt.replace(RegExp.$1, (time.getFullYear() + "").substr(4 - RegExp.$1.length));
			    for (var k in o)
			        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
			            return fmt;
			},
			//查看统计
			getTfn(){
				uni.navigateTo({
					url: '/home/pages/recordthree/statistics' 
				})
			},
			// 导出
			getImport(){
				// 判断是否在导出
				if(this.importflag){
					uni.showToast({
						title: '正在导出，请勿多次重复导出',
						duration: 1000,
						icon: 'none'
					});
					return
				}else{
					this.importflag=true;
				}
				// 删除导出的临时文件
				const fsm = wx.getFileSystemManager()
				const _dirPath=`${wx.env.USER_DATA_PATH}`
				
				fsm.readdir({
					dirPath: _dirPath,
					success: (reds)=> {
						const {errMsg,files} = reds;
						if(errMsg=='readdir:ok'){
							files.forEach((item)=>{
								if(item.indexOf('xlsx')){
									fsm.unlink({
										filePath:_dirPath + '/'+item
									})
								}
							})
						}
					}
				})
				var url='',txt='';
				if(this.navidx==1){
					url='boman-web-core/core/account/exportHj';
					txt='核酸检测数据-户籍'
				}else{
					url='boman-web-core/core/account/exportCz';
					txt='核酸检测数据-常住'
				}
				// 去除分页现在
				var formData={}
				for(var i in this.formData){
					if(i!='pageNum'&&i!='pageSize'){
						formData[i]=this.formData[i]
					}
				}
				this.$http.downfile(url,'post',formData).then(res =>{
					// 判断是二进制流还是json
					if(res){
						try {
							let enc = new encoding.TextDecoder('utf-8')
							let data = JSON.parse(enc.decode(new Uint8Array(res)))
							if(data.code && data.code!=200){
								this.importflag=false;
								uni.showToast({
									title: data.msg,
									duration: 1000,
									icon: 'none'
								});
							}else{
								this.importflag=false;
								this.$http.dowmload(res,txt) 
							}			 
						} catch(e) {
							this.importflag=false;
							this.$http.dowmload(res,txt) 
						}
					}
				})
				
			},
			getSearch(){
				this.searchflag=true
			},
			getSearClose(){
				this.searchflag=false
			},
			//是否核酸
			showNucleic(){
				this.$refs.nucleinselet.show();
			},
			vacSureChange(e){
				this.formData.isNucleicAcid=e[0].value;
			},

			getRegionListFirst(){
				this.$http.post('boman-system/chinaArea/treeSelect',{pid: 0},true).then(res=>{
					this.auiPicker.data=res.data	
				})
			},
			//显示picker多级联动弹窗
			showPicker(e){
				const _this = this;
				_this.$refs.picker.open().then(function(){
					console.log('picker打开');
				});
			},
			//picker多级联动回调
			pickerCallback(e){
				const _this = this;
				let result = '';
				e.data.forEach(function(item, index){
					if(index==0){
						result += item.name;
					}else{
						result +='/'+ item.name;
					}
				});
				_this.searchresult=result;
				var formData={
					pageNum: 1,
					pageSize: 20,
					zjhm:this.formData.zjhm,
					queryType:this.formData.queryType,
					isNucleicAcid:this.formData.isNucleicAcid,
					xm:this.formData.xm,
					lxdh:this.formData.lxdh,
					params:{
						startTime:this.formData.params.startTime,
						endTime:this.formData.params.endTime,
					}
				}
				var length=e.data.length;
				// console.log(this.formData.queryType,33)
				if(this.formData.queryType=='hj'){
					switch (length) {
						case 0:
							break;
						case 1:
							formData.provinceId = e.data[0].areaid;
							break;
						case 2:
							formData.cityId = e.data[1].areaid;
							break;
						case 3:
							formData.regionId = e.data[2].areaid;
							break;
						case 4:
							formData.villageTownsId = e.data[3].areaid;
							break;
						case 5:
							formData.villageId = e.data[4].areaid;
							break;
						default:
							break;
					}
				}else{
					switch (length) {
						case 0:
							break;
						case 1:
							formData.provinceIdXjd = e.data[0].areaid;
							break;
						case 2:
							formData.cityIdXjd = e.data[1].areaid;
							break;
						case 3:
							formData.regionIdXjd = e.data[2].areaid;
							break;
						case 4:
							formData.villageTownsIdXjd = e.data[3].areaid;
							break;
						case 5:
							formData.villageIdXjd = e.data[4].areaid;
							break;
						default:
							break;
					}
				}
				
				//搜索
				this.formData=JSON.parse(JSON.stringify(formData));
			},
			navcheck(e){
				if(this.navidx==e){
					return
				}

				this.navidx=e;
				var formData={
					pageNum: 1,
					pageSize: 20,
					zjhm:this.formData.zjhm,
					queryType:this.formData.queryType,
					isNucleicAcid:this.formData.isNucleicAcid,
					xm:this.formData.xm,
					lxdh:this.formData.lxdh,
					params:{
						startTime:this.formData.params.startTime,
						endTime:this.formData.params.endTime,
					}
				}
				// 判断是不是认领的
				if(e==0){
					formData.queryType='cz'
					// 常驻
					for(var i in this.formData){
						if(i!='pageNum'&&i!='pageSize'){
							if(i=='provinceId'){
								formData.provinceIdXjd=this.formData[i]
							}else if(i=='cityId'){
								formData.cityIdXjd=this.formData[i]
							}else if(i=='regionId'){
								formData.regionIdXjd=this.formData[i]
							}else if(i=='villageTownsId'){
								formData.villageTownsIdXjd=this.formData[i]
							}else if(i=='villageId'){
								formData.villageIdXjd=this.formData[i]
							}
						}
					}
				}else{
					// 户籍
					formData.queryType='hj'
					for(var i in this.formData){
						if(i!='pageNum'&&i!='pageSize'){
							if(i=='provinceIdXjd'){
								formData.provinceId=this.formData[i]
							}else if(i=='cityIdXjd'){
								formData.cityId=this.formData[i]
							}else if(i=='regionIdXjd'){
								formData.regionId=this.formData[i]
							}else if(i=='villageTownsIdXjd'){
								formData.villageTownsId=this.formData[i]
							}else if(i=='villageIdXjd'){
								formData.villageId=this.formData[i]
							}
						}
					}
				}
				
				
				this.list = []
				this.formData=JSON.parse(JSON.stringify(formData));
				this.$nextTick(function(){
					this.getAlllist()
					this.lists(formData)
				})
			},
			getClearFn(){
				this.searchresult='';
				// 获取时间
				var time = new Date().getTime()-24*60*60*1000;
				var startTime =this.Format(new Date(time),"yyyy-MM-dd hh:mm:ss");
				var endTime = this.Format(new Date(),"yyyy-MM-dd hh:mm:ss"); 
				var formData={
					pageNum: 1,
					pageSize: 20,
					zjhm:'',
					queryType:this.formData.queryType,
					isNucleicAcid:this.formData.isNucleicAcid,
					lxdh:'',
					xm:'',
					params:{
						startTime:startTime,
						endTime:endTime,
					}
				}
				// this.list = []
				this.formData=JSON.parse(JSON.stringify(formData));
				// this.getAlllist()
				// this.lists(this.formData)
			},
			getAlllist(){
				return
				// var formData={
				// 	xm:this.formData.xm,
				// };
				// if(this.villageId){
				// 	formData.townId=this.villageTownsId
				// 	formData.villageId=this.villageId
				// }else if(this.villageTownsId){
				// 	formData.townId=this.villageTownsId
				// }
				var formData={}
				for(var i in this.formData){
					if(i!='pageNum'&&i!='pageSize'&&i!='isRl'){
						// if(i=='provinceIdXjd'){
						// 	formData.provinceId=this.formData[i]
						// }else if(i=='cityIdXjd'){
						// 	formData.cityId=this.formData[i]
						// }else if(i=='regionIdXjd'){
						// 	formData.regionId=this.formData[i]
						// }else if(i=='villageTownsIdXjd'){
						// 	formData.townId=this.formData[i]
						// }else if(i=='villageTownsId'){
						// 	formData.townId=this.formData[i]
						// }else if(i=='villageIdXjd'){
						// 	formData.villageId=this.formData[i]
						// }else{
							formData[i]=this.formData[i]
						// }
					}
				}
				this.$http.post("boman-web-core/core/ryrl/sts", formData).then(res => {
					if (res.code == 200) {
						this.tabsta[0].nume = res.data.total;
						this.tabsta[1].nume = res.data.yrl;
						this.tabsta[2].nume = res.data.wrl;
					} else {
						uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});

					}
				})
			},
			goDetail(e) {
				// 判断是不是常驻
				//判断是否有
				uni.navigateTo({
					url: '/add/pages/addvacfrom/nucleindetail?type=1&zjhm=' + e.zjhm+"&cjsj="+e.cjsj+"&navidx="+this.navidx
				})
				return
				
				if(this.navidx==1){
					// 户籍
					this.houseflag=true;
					this.houseobj.code=e.code;
					this.houseobj.id=e.id;
					if(e.houseType=='是'){
						this.housetypflag=true
					}else{
						this.housetypflag=false
					}
				}else{
					//常驻
					if(e.houseType=='是'){
						this.houseflag=true;
						this.houseobj.code=e.code;
						this.houseobj.id=e.id;
						this.housetypflag=true
					}else{
						this.housetypflag=false
						var isnrl=0
						if(this.currentTab==2){
							isnrl=1
						}
						uni.navigateTo({
							url: '/add/pages/addvacfrom/addpeople?id=' + e.id+'&isnrl='+isnrl+'&navidx='+this.navidx
						})
					}
					// 未认领
					
				}
				
			},
			//查询列表
			
			// 户籍地址
			getListHjFn(formData){
				var params={}
				// 判断时间是否为空
				if(!this.formData.params.startTime){
					uni.showToast({
						title: '请选择采集开始时间',
						duration: 1000,
						icon: 'none'
					});
					return
				}
				if(!this.formData.params.endTime){
					uni.showToast({
						title: '请选择采集结束时间',
						duration: 1000,
						icon: 'none'
					});
					return
				}
				for(var i in formData){
					if(i!='params'){
						params[i]=this.formData[i]
					}
				}
				params['params[startTime]']=this.formData.params.startTime
				params['params[endTime]']=this.formData.params.endTime
				// console.log(formData)
				// return
				this.$http.get("boman-web-core/core/account/nucleicAcid/hj", params).then(res => {
					//停止下拉加载
					uni.hideNavigationBarLoading()
					uni.stopPullDownRefresh()
					if (res.code == 200) {
						if (res.rows.length < formData.pageSize) {
							this.haveMore = false
							this.wtdt='到底了~';
						} else {
							var num=parseInt(res.rows.length)+parseInt(formData.pageSize)*parseInt(formData.pageNum-1)
							if(num<res.total){
								this.haveMore = true
								this.wtdt='上拉加载更多'
							}else{
								this.haveMore = false
								this.wtdt='到底了~';
							}	
						}
						if(formData.pageNum==1){
							this.list = res.rows
						}else{
							this.list = this.list.concat(res.rows) 
						}
					} else {
						uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
				
				
					}
				})
			},
			//常驻信息
			getListCzFn(formData){
				if(!this.formData.params.startTime){
					uni.showToast({
						title: '请选择采集开始时间',
						duration: 1000,
						icon: 'none'
					});
					return
				}
				if(!this.formData.params.endTime){
					uni.showToast({
						title: '请选择采集结束时间',
						duration: 1000,
						icon: 'none'
					});
					return
				}
				var params={}
				for(var i in formData){
					if(i!='params'){
						params[i]=this.formData[i]
					}
				}
				params['params[startTime]']=this.formData.params.startTime
				params['params[endTime]']=this.formData.params.endTime
				this.$http.get("boman-web-core/core/account/nucleicAcid/jzdz", params).then(res => {
					//停止下拉加载
					uni.hideNavigationBarLoading()
					uni.stopPullDownRefresh()
					if (res.code == 200) {
						if (res.rows.length < formData.pageSize) {
							this.haveMore = false
							this.wtdt='到底了~';
						} else {
							var num=parseInt(res.rows.length)+parseInt(formData.pageSize)*parseInt(formData.pageNum-1)
							if(num<res.total){
								this.haveMore = true
								this.wtdt='上拉加载更多'
							}else{
								this.haveMore = false
								this.wtdt='到底了~';
							}	
						}
						if(formData.pageNum==1){
							this.list = res.rows
						}else{
							this.list = this.list.concat(res.rows) 
						}
					} else {
						uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
				
				
					}
				})
			},
			// 人员未认领接口
			getListRyrlFn(){
				var formData=this.formData;
				// 户籍
				if(this.navidx==1){
					this.$http.get("boman-web-core/core/ryrl/listHj", formData).then(res => {
						//停止下拉加载
						uni.hideNavigationBarLoading()
						uni.stopPullDownRefresh()
						if (res.code == 200) {
							if (res.rows.length < formData.pageSize) {
								this.haveMore = false
								this.wtdt='到底了~';
							} else {
								var num=parseInt(res.rows.length)+parseInt(formData.pageSize)*parseInt(formData.pageNum-1)
								if(num<res.total){
									this.haveMore = true
									this.wtdt='上拉加载更多'
								}else{
									this.haveMore = false
									this.wtdt='到底了~';
								}	
							}
							if(formData.pageNum==1){
								this.list = res.rows
							}else{
								this.list = this.list.concat(res.rows) 
							}
						} else {
							uni.showToast({
								title: res.msg,
								duration: 1000,
								icon: 'none'
							});
					
					
						}
					})
				}else{
					this.$http.get("boman-web-core/core/ryrl/listCz", formData).then(res => {
						//停止下拉加载
						uni.hideNavigationBarLoading()
						uni.stopPullDownRefresh()
						if (res.code == 200) {
							if (res.rows.length < formData.pageSize) {
								this.haveMore = false
								this.wtdt='到底了~';
							} else {
								var num=parseInt(res.rows.length)+parseInt(formData.pageSize)*parseInt(formData.pageNum-1)
								if(num<res.total){
									this.haveMore = true
									this.wtdt='上拉加载更多'
								}else{
									this.haveMore = false
									this.wtdt='到底了~';
								}	
							}
							if(formData.pageNum==1){
								this.list = res.rows
							}else{
								this.list = this.list.concat(res.rows) 
							}
						} else {
							uni.showToast({
								title: res.msg,
								duration: 1000,
								icon: 'none'
							});
					
					
						}
					})
				}
				// 常驻
				
				
			},
			lists(formData) {
				this.importflag=false;
				if(this.navidx==1){
					this.getListHjFn(formData)
				}else{
					this.getListCzFn(formData)
				}
			},
			//刷新
			bot_btn() {
				if (this.haveMore) {
					this.formData.pageNum++
					this.lists(this.formData)
				}
			},
			//查看
			chakn(item) {
				// uni.setStorageSync('item', item)
				// wx.navigateTo({
				// 	url: '/pages/home/recordtwo'
				// })
			},
			// 删除
			dele(item){
				this.$http.dele("boman-web-core/core/info/" + item).then(res => {
					if(res.code == 200){
						this.formData.pageNum = 1
						this.list = []
						this.getAlllist()
						this.lists(this.formData)
					}
				
				})
			},
			//搜索
			Seach() {
				// 判断时间是否为空
				if(!this.formData.params.startTime){
					uni.showToast({
						title: '请选择采集开始时间',
						duration: 1000,
						icon: 'none'
					});
					return
				}
				if(!this.formData.params.endTime){
					uni.showToast({
						title: '请选择采集结束时间',
						duration: 1000,
						icon: 'none'
					});
					return
				}
				var idx=this.formData.isNucleicAcid;
				if(idx=='Y'){
					this.currentTab=1
				}else if(idx=='N'){
					this.currentTab=2
				}
				this.list = [];
				this.searchflag=false;
				this.formData.pageNum = 1;
				this.formData.pageSize=20;
				this.getAlllist();
				this.lists(this.formData)
			},

			//弹
			changeTab(index){
				this.currentTab = index
				this.formData.pageNum=1;
				this.formData.pageSize=20;
				this.list = []
				if(index == 0){
					this.formData.isNucleicAcid = ''
					this.lists(this.formData)
				}else if(index == 1){
					// 已认领
					this.formData.isNucleicAcid = "Y"
					this.lists(this.formData)
				}else if(index == 2){
					// 未认领
					this.formData.isNucleicAcid = "N"
					this.lists(this.formData)
					// this.getListRyrlFn()
				}
				
				
			},
			// formatter(type, value){
			// 	 if (type === 'year') {
			// 	        return `${value}年`;
			// 	      } else if (type === 'month') {
			// 	        return `${value}月`;
			// 	      }
			// 	      return value;
			// },
			// 点击新增
			addVacFrom () {
				uni.navigateTo({
					url: '/add/pages/addvacfrom/addpeople?type=house'
				})
			}


		}
	}
</script>

<style lang="scss" scoped>
	/deep/ .uni-date__x-input{text-align: right;font-size: 26rpx;height:40rpx;}
	/deep/ .uniui-calendar {display: none;}
	// 水印
	.syone{position: absolute;font-size: 40rpx;color: rgba(0,0,0,0.3);top: 200rpx;left: 50%;transform: translateX(-50%) rotate(45deg);}
	.sytwo{position: absolute;font-size: 40rpx;color: rgba(0,0,0,0.3);top: 420rpx;left: 50%;transform: translateX(-50%) rotate(45deg);}
	.sythree{position: absolute;font-size: 40rpx;color: rgba(0,0,0,0.3);top: 620rpx;left: 50%;transform: translateX(-50%) rotate(45deg);}
	
	.bgbox{position: fixed;left: 0;right: 0;top: 0;bottom: 0;z-index: 999;
    background: rgba(0,0,0,0.5);}
	.housebox{position: fixed;left: 0;right: 0;bottom: 0;z-index: 1000;background: #FFFFFF;border-radius: 30rpx 30rpx 0 0;
	.house_tit{width: 100%;height: 100rpx;position: relative;z-index: 999;background: #F2F2F2;border-radius: 30rpx 30rpx 0 0;display: flex;align-items: center;margin-bottom: 10rpx;
		.house_titl{font-size: 30rpx;color: #333333;flex: 0 0 auto;height: 100rpx;width: 120rpx;text-align: center;line-height:100rpx;}
		.house_titr{flex: 0 0 auto;font-size: 30rpx;color: #197DE0;height:100rpx;width:120rpx;text-align: center;line-height: 100rpx;}
		.house_titc{line-height: 40rpx;font-size: 34rpx;color: #333;padding: 30rpx;box-sizing: border-box;flex: 1;text-align: center;}
	
	}
	.houselist{width: 100%;text-align: center;font-size: 30rpx;color: #333333;line-height: 88rpx;
		&.act{color: #197DE0;}
		&:last-child{padding-bottom: 20rpx;}
	}
	}
	
	
	.nav_box{display: flex;align-items: center;justify-content: center;flex: 1;
		.nav_boxa{position: relative;width: 214rpx;height: 86rpx;
			.nav_boxb{width: 100%;height: 100%;display: none;}
			.nav_boxa1{font-size: 34rpx;font-weight: bold;color: #0678AC;text-align: center;padding-top: 14rpx;box-sizing: border-box;position: absolute;left: 0;top: 0;right: 0;bottom: 0;}
			&.act{color: #FFFFFF;
				.nav_boxb{display: block;}
				.nav_boxa1{color: #FFFFFF;}
			}
		}
	}
	.address{
		display: flex;align-items: center;
		margin-top: 38rpx;
		.addtita{flex: 0 0 auto;font-size: 28rpx;font-weight: bold;
color: #343434;}
		.addressa{
			display: flex;align-items: center;
			flex: 1;
			display: flex;align-items: center;justify-content: flex-end;
			overflow: hidden;
			.addsa{font-size: 26rpx;color: #333333;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;
			flex: 1;text-align: right;
			}
			.addsimg{width: 16rpx;height: 24rpx;margin-left: 10rpx;flex: 0 0 auto;}
			// .adds{
			// 	display: flex;align-items: center;justify-content: flex-start;padding:10rpx 20rpx;min-width: 220rpx;box-sizing: border-box;}
		}
		
		.addclear{color: #EA2929;font-size: 26rpx;flex: 0 0 auto;height: 60rpx;line-height: 60rpx;width: 128rpx;text-align:center}
	}
	
	
	.coie{
		width: 100%;
		box-sizing: border-box;
		padding:  0 33upx;
		.coie_nav{
			border-top: 1upx solid #E5E5E5;
			display: flex;
			flex-wrap: wrap;
			padding-bottom: 28upx;
			p{
				width: 33.33%;
				text-align: center;
				display: flex;
				flex-direction: column;
				margin-top: 53upx;
				span{
					font-size: 28upx;
				}
				i{
					font-size: 28upx;
					color: #333;
					margin-top: 28upx;
				}
			}
		}
	}
	.ieju{
		height: 17upx;
		width: 100%;
		background-color: #eee;
		margin-bottom: 33upx;
	}
	//暂无数据
	.zanwu {
		text-align: center;
		padding-top: 20upx;

		span {
			font-size: 24upx;
		}
	}
	.scrollbox{position: relative;}
	.scroll-view {
		max-height: calc(100vh - 401upx);
	}

	.shax {
		// height: 83upx;
		font-size: 25upx;
		color: #666;
		text-align: center;
	}

	.index {
		// padding-top: 33upx;
		max-height: 100vh;

		.sous {
			padding: 24upx 33upx 0;
			// display: flex;
            
			.input {
				height: 80upx;
				border: 1upx solid #E5E5E5;
				flex: 1;
				margin-right: 28upx;
				padding-left: 10upx;
				box-sizing: border-box;
			}

			button {
				// width: 125upx;
				height: 80upx;
				background-color: #1678FF;
				text-size: 28upx;
				color: #fff;
				text-align: center;
				line-height: 80upx;
			}
		}

		//tab
		.tab {
			padding-top:33upx;
            padding-bottom: 100upx;
			.tabs {
				display: flex;
				padding: 0 20upx;
				box-sizing: border-box;
				height: 111upx;
				justify-content: space-between;
				box-shadow: 0px 7px 7px 0px rgba(229, 229, 229, 0.5);

				.one_tab {
					color: #1678FF !important;
					// width: 140upx;
					// text-align: center;

					// .twotabs {
					// 	font-size: 31upx;
					// 	color: #666666;
					// 	;
					// 	font-weight: 500;
					// }

					// .twosrtabs {
					// 	color: #1678FF;
					// }

					// .twotabstwo {
					// 	font-size: 24upx;
					// 	color: #AAAAAA;
					// }
				}

				.one_tabqie {
					border-bottom: 8upx solid #1678FF;

				}
			}
		}

		//表格
		.exele {
			.box {
				.tr_one {
					display: flex;
					padding: 0 20upx;
					box-sizing: border-box;
					justify-content: space-between;

					th {
						// flex: 1;

						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #333333;
						display: flex;
						align-items: center;
						justify-content: center;
						// line-height: 14upx;
						// overflow: hidden;
						// text-overflow: ellipsis;
						// white-space: nowrap;
						// line-height: 83upx;
						height: 83upx;
					}
				}

				.two_tr {
					display: flex;
					padding: 0 20upx;
					box-sizing: border-box;
					justify-content: space-between;

					td {
						// flex: 1;

						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #333333;
						line-height: 83upx;
						height: 83upx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;

					}

					.tdse {
						color: #E60012 !important;
					}
					.apply_span_xl{
						color: #32B16C !important;
					}
					.apply_span_xltwo{
						color: #ffa200 !important;
					}
					.apply_span_xlfive{
						color: #4c4b4b !important;
					}
					.apply_span_xlthreo{
						color: #f00404 !important;
					}
					.apply_span_xlforu{
						color: #aaaaaa !important;
					}
					// .apply_span_xla{
					// 	color: #1678FF;
					// 	text-decoration: underline ;
					// }

					.coiu {
						color: #EC1717;
					}
				}

				.two_trtwo {
					background-color: #F6F9FC;
				}
			}

		}
	}

	.banj {
		height: 86upx;
		width: 100%;
		// text-align: center;
		line-height: 86upx;
		// background-color: #F6F9FC;
		color: #AAAAAA;
		margin-top: 20upx;
		display: flex;
		justify-content: space-around;
	}
	.apply_box{
		.apply_item_input{
			padding: 0 33upx;
			// border-top: 1upx solid #F4F4F4;
			display: flex;
			height: 68upx;
			align-items: center;
			.apply_span_x{
				font-size: 28upx;
				color: #363535;
				span{
					color: #F22346;
				}
			}
			.input_r{
				font-size: 28upx;
				height: 100%;
				flex: 1;
				text-align: right;
			}
			.input_rtwo{
				line-height:68upx;
			}
			.input_rtwoss{
				color: #1678FF;
			}
			.input_rtwosss{
				color: #FF0000;
			}
		}
		.apply_title_jt{
			height: 130upx;
			border-top: 1upx solid #F4F4F4;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 32upx;
			span{
				font-size: 36upx;
				color: #333;
				font-weight: bold;
			}
			.apply_title_btn{
				width: 160upx;
				height: 60upx;
				font-size: 24upx;
				color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;
				background: #FF568C;
				border-radius: 8upx;
				.img{
					width: 30upx;
					height: 30upx;
					margin-right: 10upx;
				}
			}
		}
		.apply_title_jts{
			border:none;
		}
		.apply_title_jt_item{
			border-bottom: 9upx solid #F4F4F4;
			.apply_item_input_qx{
				color: #FF5185;
				height: 100%;
				display: flex;
				justify-content: center;
				align-items: center;
				height: 112upx;
				font-size: 30upx;
			}
		}
		.apply_item_sfz{
			padding: 42upx 20upx;
			border-bottom: 9upx solid #F4F4F4;
			.apply_item_sfz_title{
				font-weight: bold;
				font-size: 34upx;
				margin-bottom: 40upx;
				margin-left: 2upx;
			}
			.apply_item_phones{
				display: flex;
				justify-content: space-between;
				.apply_item_phone{
					width: 340upx;
					height: 218upx;
					.img{
						width: 100%;
						height: 100%;
						border-radius: 20upx;
					}
				}
			}
		}
		.apply_item_zdxx{
			padding: 0 26upx;
			font-size: 34upx;
			font-weight: bold;
			color: #333;
			height: 112upx;
			line-height: 112upx;
			border: 1upx solid #F4F4F4;
		}
		.qt_div{
			height: 112upx;
			border-top: 1upx solid #F4F4F4;
			padding: 0 32upx;
			border-bottom: 9upx solid #F9F9F9;
			.input_l{
				height: 100%;
				font-size: 30upx;
			}
		}
	}
	.tabld{
		display: flex;
		// height: 90upx;
		box-shadow: 0px 7px 5px 0px rgba(218, 218, 218, 0.35);
		view {
			font-size:26upx ;
			font-family: PingFang SC;
			font-weight: 500;
			color: #191919;
			text-align: center;
			flex: 1;
			// line-height: 70upx;
			display: flex;
			flex-direction: column;
			padding: 18rpx 0 20rpx;
		}
		.one_tabhu{
			color: #009FE8;
			position: relative;
		::after{width: 28rpx;height: 6rpx;background: #009FE8;position: absolute;left: 50%;margin-left: -14rpx;bottom: 0;content: "";}
		}
	}
	.nbhe{
		display: flex;
		margin-bottom: 44upx;
		p{
			font-size: 25upx;
			flex: 1;
			padding: 0 77upx;
			display: flex;
			align-items: center;
		}
		p:nth-child(2){
			justify-content: flex-end;
		}
		img{
			width: 31upx;
			height: 29upx;
			margin-right: 11upx;
		}
	}
	.xinse{
		position: fixed;
		width: 100%;
		bottom: 0;
		left: 0;
		font-size: 33upx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		height: 90upx;
		background-color: #00B034;
		text-align: center;
		line-height: 90upx;
		z-index: 2;
		display: flex;align-items: center;
		.xinsel{
			width: 50%;
			background: #009FE8;
		}
		.xinser{
			width: 50%;
			background: #00B034;
		}
	}
	.sous_sear{
		padding: 24rpx 34rpx;background: #FFFFFF;
		.sous_box{width: 100%;height:90rpx;background: #F2F2F2;border-radius: 6rpx;display: flex;align-items: center;padding: 0 34rpx;box-sizing: border-box;
			.sous_img{width: 32rpx;height: 34rpx;margin-right: 18rpx;flex: 0 0 auto;}
			.sous_input{font-size: 30rpx;color: #AAAAAA;flex: 1;}
		}
	}
	// 搜索条件width: 562rpx;
	.sfixed{background: #FFFFFF;border-radius: 14rpx;box-sizing: border-box;position: fixed;left: 60rpx;right: 60rpx;top: 50%;transform: translateY(-50%);
	z-index: 1100;
	.sfixedtop{
		min-height: 840rpx;width: 100%;height: 100%;overflow: auto;padding: 40rpx 34rpx;box-sizing: border-box;max-height: calc(100vh - 280rpx);
	}
		.sfixed_tit{font-size: 28rpx;font-weight: bold;color: #343434;line-height: 44rpx;text-align: center;}
		.sfixed_clo{width: 34rpx;height: 34rpx;position: absolute;right: 34rpx;top: 44rpx;}
		.sfixed_box{
			padding-top: 20rpx;
			.sfixed_inp{width: 100%;height: 76rpx;background:#F2F2F2;padding: 0 34rpx;box-sizing: border-box;font-size: 28rpx;color: #333333;margin-top: 30rpx;}
			.sfixed_line{width: 62rpx;height: 6rpx;background: #009FE8;margin: 38rpx auto 32rpx;}
			.sfixed_flex{display: flex;align-items: center;justify-content: space-between;
				.sfixed_a{font-size: 26rpx;font-weight: bold;color: #666666;}
				.sfixed_ar{font-size: 26rpx;font-weight: bold;color: #DF0024;}
			}
		}
		.sfixed_btn{width: 100%;height: 76rpx;background: #00B034;border: 0px solid #00B034;border-radius: 6rpx;font-size: 28rpx;font-weight: bold;
color: #FFFFFF;text-align: center;line-height: 76rpx;margin-top: 62rpx;}
		
	}
	
</style>

