<template>
	<view class="box">
		<view class="head">
			<view class="headleft">
				<input type="text" placeholder="输入项目名称查询" @input="enterxiangmu" />
			</view>
			<view class="headright" @click="chaxun">查询</view>
		</view>

		<view class="nodata" v-if="zixunlist.length==0">暂无数据</view>
		<view class="fenzulist" v-else>
			<view class="fenzuitem" v-for="(item,index) in zixunlist" :key="index">
				<view class="fenzutop">
					<view class="fenzutopleft">
						<view class="fenzutopshang">
							<text class="bianhao">项目编号:</text><text class="bianhaonum"> {{item.fnumber}}</text>
						</view>
						<!-- <view class="fenzutopshang">
							<text class="bianhao">任务编号:</text><text class="bianhaonum"> {{item.fbillno}}</text>
						</view> -->
					</view>
					<!-- <view class="fenzutopright">
						<view class="fenzunoimg">
							<image src="../../static/img/yifen.png" mode="" v-if="item.ftaskprocess=='已分配'"></image>
							<image src="../../static/img/nofen.png" mode="" v-else></image>


						</view>
						<view class="fenzunoname">{{item.ftaskprocess}}</view>
					</view> -->
				</view>
				<view class="fenzuobottom">
					<view class="fenzutopshang">
						<text class="bianhao">项目名称:</text><text class="bianhaonum">
							{{item.fname}}
						</text>
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">评审类型:</text><text class="bianhaonum">{{item.freviewtype}}</text>
					</view>
					
					
					<!-- 任务状态 -->
					<view class="statebox flexone">
						<view class="stateboxitem flexfour">
							<view class="stateboxitemtop">任务</view>
							<view class='stateboxitembot flexone'>
								<view class="stateimg">
									<image src="../../static/img/duigou.png" mode=""></image>
								</view>
								<view class="statename">{{item.ftaskstatus}}</view>
							</view>
						</view>
						<view class="stateboxitem flexfour">
							<view class="stateboxitemtop">征求意见稿初稿</view>
							<view class='stateboxitembot flexone'>
								<view class="stateimg" v-if="item.fdirstatus=='未提交'">
									
									<image src="../../static/img/wrong.png" mode=""></image>
								</view>
								<view class="stateimg" v-else>
									<image src="../../static/img/yifen.png" mode=""></image>
								</view>
								<view class="statename">{{item.fdirstatus}}</view>
							</view>
						</view>
						<view class="stateboxitem flexfour">
							<view class="stateboxitemtop">征求意见稿定稿</view>
							<view class='stateboxitembot flexone'>
								<view class="stateimg" v-if="item.ffinauditstatus=='未提交'">
									<image src="../../static/img/wrong.png" mode=""></image>
								</view>
								<view class="stateimg" v-else>
									<image src="../../static/img/yifen.png" mode=""></image>
								</view>
								<view class="statename">{{item.ffinauditstatus}}</view>
							</view>
						</view>
						<view class="stateboxitem flexfour">
							<view class="stateboxitemtop">评审报告</view>
							<view class='stateboxitembot flexone'>
								<view class="stateimg" v-if="item.freporttatus=='未提交'">
									<image src="../../static/img/wrong.png" mode=""></image>
								</view>
								<view class="stateimg" v-if="item.freporttatus=='已提交'">
									<image src="../../static/img/report.png" mode=""></image>
								</view>
								<view class="stateimg" v-if="item.freporttatus=='已确认'">
									<image src="../../static/img/yifen.png" mode=""></image>
								</view>
								
								<view class="statename">{{item.freporttatus==null?'':item.freporttatus}}</view>
							</view>
						</view>
						<view class="stateboxitem flexfour">
							<view class="stateboxitemtop">合同发票</view>
							<view class='stateboxitembot flexone'>
								<view class="stateimg" v-if="item.fservicestatus=='未提交'">
									<image src="../../static/img/wrong.png" mode=""></image>
								</view>
								<view class="stateimg" v-if="item.fservicestatus=='已提交'">
									<image src="../../static/img/report.png" mode=""></image>
								</view>
								<view class="stateimg" v-if="item.fservicestatus=='已确认'">
									<image src="../../static/img/yifen.png" mode=""></image>
								</view>
								<view class="statename">{{item.fservicestatus==null?'':item.fservicestatus}}</view>
							</view>
						</view>
					</view>
					<!--  状态按钮-->
					<view class="btnlist">
						<view class="btnitem" @click="see(item)">查看</view>
						
						
						<!-- <view class="btnitem" @click="jingban(item)" v-if="showhide[4].status!=0">经办人审核</view>
						<view class="btnitem" @click="pingshen(item)" v-if="showhide[4].status!=0">评审报告确认</view>
						<view class="btnitem" @click="concatsure(item)" v-if="showhide[4].status!=0">合同发票确认</view>
						 -->
						<!-- 
						 <view class="btnitem" @click="question(item)">问题往来</view>
						<view class="btnitem" @click="jingban(item)" >经办人审核</view>
						<view class="btnitem" @click="pingshen(item)" >评审报告确认</view>
						<view class="btnitem" @click="concatsure(item)" >合同发票确认</view> -->
					</view>
					<!-- <view class="fenzutopshang">
						<text class="bianhao">项目类型:</text><text class="bianhaonum"> {{item.projecttype}}</text>
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">项目组:</text><text class="bianhaonum">{{item.fteam==null?'':item.fteam}} </text>
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">评审类型:</text><text class="bianhaonum">{{item.freviewtype}} </text>
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">评审类型:</text><text class="bianhaonum">{{item.freviewtype}} </text>
					</view>
					<view class="fenzutopshang">

						<text class="bianhao">项目组分配状态:</text><text class="bianhaonum">{{item.ftaskprocess}}</text>
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">任务状态:</text><text class="bianhaonum" v-if="item.ftaskstatus==null"></text><text class="bianhaonum"
						 v-else>{{item.ftaskstatus}}</text>
						
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">评审报告状态:</text><text class="bianhaonum" v-if="item.freporttatus==null"></text><text class="bianhaonum"
						 v-else>{{item.freporttatus}}</text>
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">合同发票状态:</text><text class="bianhaonum" v-if="item.fservicestatus==null"></text><text class="bianhaonum"
						 v-else>{{item.fservicestatus}}</text>
					</view>

					<view class="fenzubottom" @click="xiangmuzufen" :data-item="item">
						<view class="fenzubtn">项目组分配</view>
					</view> -->
				</view>
			</view>

			<!-- <view class="fenzuitem">
				<view class="fenzutop">
					<view class="fenzutopleft">
						<view class="fenzutopshang">
							<text class="bianhao">项目编号:</text><text class="bianhaonum"> 20191115001</text>
						</view>
						<view class="fenzutopshang">
							<text class="bianhao">任务编号:</text><text class="bianhaonum"> 20191115001</text>
						</view>
					</view>
					<view class="fenzutopright">
						<view class="fenzunoimg">
							<image src="../../static/img/yifen.png" mode=""></image>
						</view>
						<view class="fenzunoname">未分配</view>
					</view>
				</view>
				<view class="fenzuobottom">
					<view class="fenzutopshang">
						<text class="bianhao">项目名称:</text><text class="bianhaonum">
							机关服务中心会务处保安服务项目
						</text>
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">项目类型:</text><text class="bianhaonum"> 预算</text>
					</view>
					<view class="fenzutopshang">
						<text class="bianhao">项目组:</text><text class="bianhaonum"> </text>
					</view>

					<view class="fenzubottom">
						<view class="fenzubtn">项目组分配</view>
					</view>
				</view>


			</view>

		 -->


		</view>
	</view>


</template>

<script>
	import app from "../../App.vue";
	export default {
		data() {
			return {
				zixunlist: [],
				keyword: '',
				querylist: [],
				type:'',
				showhide:''
			}
		},
		onLoad(options) {
				this.showhide = uni.getStorageSync("showhide");
				console.log('4389489',JSON.stringify(this.showhide))
			this.type=options.type;
			this.type=Number(this.type)
			switch(this.type){
				case 1:
				console.log(this.type)
				uni.setNavigationBarTitle({
				  title:'预算项目审核'
				})
				this.project='prj_toaudit_budget'
				break;
				case 2:
				console.log(this.type)
				uni.setNavigationBarTitle({
				  title:'结算项目审核'
				})
				this.project='prj_toaudit_settlement'
				break;
				case 3:
				uni.setNavigationBarTitle({
				  title:'决算项目审核'
				})
				this.project='prj_toaudit_change'
				break;
				case 4:
				uni.setNavigationBarTitle({
				  title:'土地成本项目审核'
				})
				this.project='prj_toaudit_land'
				break;
			}
		},
		methods: {
			// 项目组分配
			xiangmuzufen(item) {
				// let item = e.currentTarget.dataset.item;
				 let newitem = JSON.stringify(item)
				console.log(item)
				let finorgid = item.finorgid;
				let fprojectid = item.fprojectid;

				uni.navigateTo({
					url: '../zixunfenpei/zixunfenpei?item=' + newitem
				})
			},
			
			question(item){
				console.log(item)
				let questionid=item.fprojectid
				uni.setStorageSync("questionid",questionid)
				uni.navigateTo({
					url:'/pages/question/question?quesprojectid='+questionid
				})
			},
			getbudgetlist() {
				let that = this;
				let url = "project/Get_ProjectInventory";
				
				let param = {
					fprojectcategory:that.project,
					fuserid: uni.getStorageSync("userid"),
					fprojectid:'',
					role:uni.getStorageSync("role"),
				}
				 console.log('8877665544',param)
				app.post(url, param, 'get').then(r => {
					console.log(r)
					  // console.log('数组',JSON.stringify(r.data));
					that.zixunlist = r.data;
					that.querylist = r.data;
				}).catch(err => {
					console.log(err)
				})
			},
			// 查看
			see(item){
				 let newitem=JSON.stringify(item);
				// console.log(newitem)
				uni.navigateTo({
					url:'/pages/projectziliao/projectziliao?item='+newitem
				})
				
			},
			enterxiangmu(e) {
				console.log(e)
				this.keyword = e.target.value;

			},
			// 经办人
			jingban(item){
				let newitem=JSON.stringify(item)
				uni.navigateTo({
					url:'/pages/examinejingban/examinejingban?item='+newitem
				})
			},
			// 评审报告
			pingshen(item){
				let newitem=JSON.stringify(item)
				uni.navigateTo({
					url:'/pages/reviewreport/reviewreport?item='+newitem
				})
			},
			// 合同发票确认
			concatsure(item){
				let newitem=JSON.stringify(item)
				uni.navigateTo({
					url:'/pages/concat/concat?item='+newitem
				})
			},	
			chaxun() {
				if (this.keyword == '') {
					this.getbudgetlist();
				} else {
					console.log(9988776655)
					let newxiangmuarr = [];
					let newzixunlist = this.querylist;
					let name = [];
					for (var obj of newzixunlist) {
						
						name.push(obj.fname);
					}
					 console.log('名称', name)
					for (var i = 0; i < newzixunlist.length; i++) {
						for (var j = 0; j < name.length; j++) {

							if (name[j].indexOf(this.keyword) >= 0) {
								if (j == i) {
									newxiangmuarr.push(newzixunlist[i])
								}
								// console.log(9999)
							}
						}
					}
					console.log('9999000777', newxiangmuarr);
					this.zixunlist = newxiangmuarr;
				}
			}

		},
		onShow:function(){
			this.getbudgetlist();
		}

	}
</script>

<style>
	page {
		background: #F9F9F9;
	}
	image{
		width:100%;
		height:100%;
	}
	.btnlist{
		display:flex;
		align-items: center;
		flex-wrap: wrap;
		margin-top:20rpx;
	}
	.btnitem{
		width:194rpx;
		height:64rpx;
		background:rgba(0,147,255,1);
		opacity:1;
		border-radius:8rpx;
		color:#fff;
		font-size: 24rpx;
		text-align: center;
		line-height: 64rpx;
		margin-right:12rpx;
		margin-bottom:30rpx;
	}
	.statebox{
		flex-wrap: wrap;
		margin-top:32rpx;
	}
	
	.stateboxitem{
		width:188rpx;
		height:132rpx;
		border:1rpx solid rgba(189,196,206,1);
		opacity:1;
		border-radius:8rpx;
		margin-right:15rpx;
		margin-bottom:28rpx;
	}
	.stateboxitemtop{
		color:#06121E;
		font-size: 24rpx;
	}
	.stateboxitembot{
		margin-top:10rpx;
	}

	.head {
		display: flex;
		align-items: center;
		padding: 20rpx 32rpx;
		box-sizing: border-box;
		background: #fff;
		position: fixed;
		top: 0;
		left: 0;
		z-index:999;
	}
	.stateimg{
		width:28rpx;
		height:28rpx;
		font-size: 0;
	}
	.statename{
		color:#06121E;
		font-size: 24rpx;
		margin-left:5rpx;
	}

	.fenzulist {
		margin-top: 100rpx;
	}

	.headleft {
		width: 572rpx;
		height: 60rpx;
		background: rgba(238, 238, 238, 1);
		opacity: 1;
		border-radius: 8rpx;
		padding: 10rpx 24rpx;
		box-sizing: border-box;
		display: felex;
		align-items: center;
		display: flex;
		align-items: center;
	}

	.headleft input {
		color: #BDC4CE;
		font-size: 28rpx;
	}

	.headright {
		width: 98rpx;
		height: 60rpx;
		background: rgba(0, 147, 255, 1);
		opacity: 1;
		border-radius: 8rpx;
		color: #fff;
		font-size: 22rpx;
		text-align: center;
		line-height: 60rpx;
		margin-left: 16rpx;
	}

	.fenzuitem {
		width: 686rpx;
		/* height: 484rpx; */
		background: rgba(255, 255, 255, 1);
		box-shadow: 0px 6rpx 6rpx rgba(0, 0, 0, 0.03);
		opacity: 1;
		border-radius: 20rpx;
		margin: 20rpx auto 0;
		padding: 28rpx 32rpx 40rpx;
		box-sizing: border-box;
	}

	.fenzutopright {}

	.fenzunoimg {
		width: 28rpx;
		height: 28rpx;
		font-size: 0;
		margin-right: 10rpx;
	}

	.fenzunoimg image {
		width: 100%;
		height: 100%;
	}

	.bianhao {
		color: #8C9198;
		font-size: 24rpx;

	}

	.bianhaonum {
		color: #06121E;
		font-size: 24rpx;
		letter-spacing: 2rpx;
	}

	.fenzunoname {
		color: #3D444D;
		font-size: 24rpx;
	}

	.fenzutopright {
		display: flex;
		align-items: center;
		width: 126rpx;
		height: 48rpx;
		border: 1rpx solid rgba(189, 196, 206, 1);
		opacity: 1;
		border-radius: 8rpx;
		padding: 0 5rpx;
		box-sizing: border-box;

	}

	.fenzutop {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding-bottom: 16rpx;
		border-bottom: 1rpx solid #f5f5f5;
	}

	.fenzuobottom {
		margin-top: 16rpx
	}

	.fenzubottom {
		display: flex;
		justify-content: flex-end;
		margin-top: 16rpx
	}

	.fenzubtn {
		width: 200rpx;
		height: 64rpx;
		background: rgba(0, 147, 255, 1);
		opacity: 1;
		border-radius: 8rpx;
		color: #F9F9F9;
		font-size: 24rpx;
		text-align: center;
		line-height: 64rpx;
	}
</style>