<template>
  <view>
	<view v-if="datalist.length>0">
		<!-- 我的提案 -->
		<block v-if="listtype=='case'">
			<view class="caselist" v-for="(ite,idx) in datalist" :key='idx' @click="getDetail(ite.proposalId)">
				<view class="tit overtwo">{{ite.title}}</view>
				
				<view class="zdbox" v-if="ite.isKeyPoint==0">
					<image :src="startbg" class="zdbg"></image>
					<view class="zdboxa">
						<image :src="startico"></image>
						<view>重点</view>
					</view>
				</view>
				<view class="flexcw" >
					<view class="ftxt" v-if="type!='wdta'&&type!='gkta'">
						<text>提案者</text>
						<view>{{ite.proposalName}}</view>
					</view>
					<!-- v-if="type=='lmta'||type=='tjyx'||type=='tjzd'||type=='gkta'" -->
					<view class="ftxt" v-if="ite.proposalNumber">
						<text>案号</text>
						<view>{{ite.proposalNumber}}</view>
					</view>
					<view class="ftxt" v-if="type=='tasc'||type=='tajb'||type=='tabl'||type=='bjsh'||type=='tacb'">
						<text>提案类型</text>
						<view>{{ite.proposalType==0?'大会提案':'平时提案'}}</view>
					</view>
				</view>
				<view class="ftxt" v-if="type=='tjyx'||type=='tjzd'">
					<text>推荐截止</text>
					<view>{{ite.categoryName}}</view>
				</view>
				<block v-if="type!='tjyx'&&type!='tjzd'">
					<view class="ftxt">
						<text>提案类别</text>
						<view>{{ite.categoryName}}</view>
					</view>
					<view class="ftxt">
						<text>提交时间</text>
						<view>{{ite.createTime}}</view>
					</view>
					<view class="ftxt">
						<text>提案状态</text>
						<view class="co0b">{{kaType(ite.proposalProgress)}}</view>
					</view>
				</block>
				
				<!-- 提案办理  回复单位-->
				<view class="casebtn flexc" v-if="type=='tabl'">
					<view class="ftit">办理状态<text>{{ite.isReply==0&&ite.proposalProgress!=6&&ite.proposalProgress!=7?'已反馈':'待反馈'}}</text></view>
					<view class="btn btn3" v-if="ite.isReply==0&&ite.proposalProgress!=6&&ite.proposalProgress!=7">已反馈</view>
					<view class="btn btn2" v-if="checkPermi(['proposal:unit:reply'])&&(ite.isReply!=0||ite.proposalProgress==6)&&ite.proposalProgress!=3&&ite.proposalProgress!=7" @click.stop="getTuiFn(ite,'dffk')">反馈意见</view>
					<view class="btn btn2" v-if="checkPermi(['proposal:unit:reply'])&&(ite.isReply!=0||ite.proposalProgress==7)&&(ite.proposalProgress==3||ite.proposalProgress==7)" @click.stop="getTuiFn(ite,'dwdf')">反馈意见</view>
				</view>
				<!-- 提案审查 -->
				<view class="casebtn flexc" v-if="type=='tasc'">
					<block v-if="!ite.isRecord">
						<view class="lftit">该提案暂未审查立案</view>
						<view class="btn btn1" v-if="checkPermi(['proposalInfo:info:isRecord'])" @click.stop="getTuiFn(ite,'scfk','1')">不予立案</view>
						<view class="btn btn2" v-if="checkPermi(['proposalInfo:info:isRecord'])" @click.stop="getTuiFn(ite,'scfk','0')">立案</view>
					</block>
					<!-- <block v-if="ite.isRecord=='0'">
						<view class="lftit">该提案已审查立案，查看<text class="lfdet">审查反馈</text></view>
						<view class="btn btn3">已立案</view>
					</block>
					<block v-if="ite.isRecord==1">
						<view class="lftit">该提案暂未通过审查立案</view>
					</block> -->
				</view>
				<!--提案交办  -->
				<view class="casebtn flexc" v-if="type=='tajb'">
					<block v-if="ite.proposalProgress=='3'">
						<view class="lftit">该提案已进行交办，查看<text class="lfdet">交办详情</text></view>
						<view class="btn btn3">已交办</view>
					</block>
					<block v-if="ite.proposalProgress=='2'">
						<view class="lftit">该提案暂未进行交办</view>
						<view class="btn btn2" v-if="checkPermi(['proposalInfo:info:assign'])" @click.stop="getTuiFn(ite,'tajb')">交办</view>
					</block>
				</view>
				<!--办结审核  -->
				<view class="casebtn flexc" v-if="type=='jbsh'">
					<block v-if="ite.isRecord=='0'">
						<view class="lftit">该提案已办结，查看<text class="lfdet">办结审核情况</text></view>
						<view class="btn btn3">已办结</view>
					</block>
					<block v-if="ite.isRecord==1">
						<view class="lftit">该提案暂未办结</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'jbsh')">交办审核</view>
					</block>
				</view>
				<!--催办  4(不包含4) 之后 可以催办-->
				<view class="casebtn flexc" v-if="type=='tacb'">
					<!-- <block v-if="ite.isRecord=='0'">
						<view class="lftit">该提案已被催办 <text class="co1d">1次</text></view>
						<view class="btn btn3">再次催办</view>
					</block> -->
					<!-- <block v-if="ite.isRecord==1">
						<view class="lftit">该提案暂未被催办</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'tacb')">催办</view>
					</block> -->
					<view class="lftit"></view>
					<view class="btn btn2" @click.stop="getTuiFn(ite,'tacb')">催办</view>
				</view>
				<!-- 联名提案 -->
				<view class="casebtn flexc" v-if="type=='lmta'">
					<view class="lftit" v-if="ite.isAgree==0">您的联名提案未反馈</view>
					<view class="lftit" v-else>您的联名提案已反馈，查看<text class="lfdet">反馈详情</text></view>
					<view class="btn  btn1" v-if="checkPermi(['proposal:user:verify'])&&ite.isAgree==0"  @click.stop="getTuiFn(ite,'lmta','2')">反对</view>
					<view class="btn btn2" v-if="checkPermi(['proposal:user:verify'])&&ite.isAgree==0"  @click.stop="getTuiFn(ite,'lmta','1')">同意</view>
					<view class="btn btn3" v-if="ite.isAgree!=0">{{ite.isAgree=='1'?'已同意':'不同意'}}</view>
				</view>
				<!-- 推荐优秀 -->
				<view class="casebtn flexc" v-if="type=='tjyx'">
					<block v-if="ite.isOutstanding==0">
						<view class="lftit" >该提案已推荐为优秀，查看<text class="lfdet" @click.stop="getDfFn(ite)">推荐理由</text></view>
						<view class="btn btn3"><image :src="nzanimg" class="zanimg"></image>推荐优秀</view>
					</block>
					<block v-else>
						<view class="lftit">该提案暂未推荐为优秀</view>
						<view class="btn btn2"  @click.stop="getTuiFn(ite,'tjyx')"><image :src="zanimg" class="zanimg"></image>推荐优秀</view>
					</block>
				</view>
				<!-- 推荐重点 -->
				<view class="casebtn flexc" v-if="type=='tjzd'">
					<block v-if="ite.isKeyPoint==0">
						<view class="lftit">该提案已推荐为重点，查看<text class="lfdet" @click.stop="getDfFn(ite)">推荐理由</text></view>
						<view class="btn btn3"><image :src="nstart" class="staimg"></image>推荐重点</view>
					</block>
					<block v-else>
						<view class="lftit">该提案暂未推荐为重点</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'tjzd')"><image :src="start" class="staimg"></image>推荐重点</view>
					</block>
				</view>
				<!-- 质量评议 -->
				<!-- <view class="casebtn flexc" v-if="type=='lmta'">
					<view class="lftit">该提案暂未进行质量评议</view>
					<view class="lftit">该提案已评议，查看<text class="lfdet">评议详情</text></view>
					<view class="btn btn2" @click="getTuiFn('zlpy')"><image :src="flower" class="staimg"></image>质量评议</view>
					<view class="btn btn3"><image :src="nflower" class="staimg"></image>已评议</view>
				</view> -->
			</view>
		</block>
		<view class="shax" v-if="wtdt">{{wtdt}}</view>
	</view>
	<block v-else>
		<no-data></no-data>
	</block>
	
	<view class="bgbox" @click="getClose" v-if="dfflag"></view>
	<view class="fixedbox" v-if="dfflag">
		<view class="ttit">推荐原因</view>
		<view  class="boxs">
			<view class="ftxt">
				<text>推荐事由</text>
				<view>{{info}}</view>
			</view>
			
		</view>
		<view class="fixedbtn flexcj">
			<view class="btns btn1" @click.stop="getClose">取消</view>
		</view>
	</view>
  </view>
</template>

<script>
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	import { selectValue } from '@/utils/common.js';
	import noData from "@/components/nodata/nodata.vue"
  export default {
	props:{
		datalist: {
			type: Array,
			default () {
				return []
			}
		},
		tajdlist: {
			type: Array,
			default () {
				return []
			}
		},
		wtdt:{
			type: String,
			default () {
				return ''
			}
		},
		type:{
			type: [String,Number],
			default () {
				return ''
			}
		},
		listtype:{
			type: [String,Number],
			default () {
				return ''
			}
		}
	},
	components:{
		noData
	},
	data(){
		return{
			start:require("@/work/static/images/start.png"),
			nstart:require("@/work/static/images/nstart.png"),
			zanimg:require("@/work/static/images/zanico.png"),
			nzanimg:require("@/work/static/images/nzanico.png"),
			flower:require("@/work/static/images/flower.png"),
			nflower:require("@/work/static/images/nflower.png"),
			startbg:require("@/work/static/images/startbg.png"),
			startico:require("@/work/static/images/startico.png"),
			dfflag:false,
			info:''
		}
	},
	onLoad: function() {
	},
	methods:{
		checkPermi, checkRole,
		kaType(ite){
			return selectValue(this.tajdlist, ite);
		},
		getClose(){
			this.dfflag=false
		},
		getDfFn(ite){
			if(this.type=='tjyx'){
				this.info=ite.outstandingArgument;
			}else{
				this.info=ite.keyPointArgument;	
			}
			this.dfflag=true	
		},
		getDetail(e){
			this.$emit('getDetail',e)
		},
		getTuiFn(ite,txt,sh){
			var that=this;
			// if(txt=='scfk'&&sh==0){
			// 	uni.showModal({
			// 		title: '确认立案',
			// 		content: "是否确认立案",
			// 		cancelText: '取消',
			// 		confirmText: '确认',
			// 		success: function(res) {
			// 			if (res.confirm) {
			// 				var obj={
			// 					id:ite.proposalId,
			// 					type:txt,
			// 					sh:sh,
			// 				}
			// 				that.$emit('getTuiFn',obj)
			// 			} else if (res.cancel) {
			// 				// console.log('用户点击取消');
			// 			}
			// 		}
			// 	});
			// }else 
			if(txt=='lmta'){
				var str='同意'
				if(sh==2){
					str='反对'
				}
				uni.showModal({
					title: '确认'+str+'联名',
					content: "是否确认"+str+"联名",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var obj={
								id:ite.proposalId,
								type:txt,
								sh:sh,
							}
							that.$emit('getTuiFn',obj)
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			}else{
				var obj={
					id:ite.proposalId,
					type:txt,
					sh:sh,
					ite:ite
				}
				this.$emit('getTuiFn',obj)
			}
			
		},
		typeFn(data){
			if(data){
				var newArr=[]
				var astr=data.split('-')
				astr.forEach(ite=>{
					var a=ite.substring(0,5);
					newArr.push(a)
				})
				return newArr.join('-')
			}else{
				return ''
			}
		},
	},
	
  }
</script>

<style lang="scss" scoped>
.caselist{background: #FFFFFF;border-radius: 30rpx;margin-top: 24rpx;padding: 38rpx 24rpx 8rpx;position: relative;
	.tit{font-weight: bold;font-size: 32rpx;color: #222327;margin-bottom: 42rpx;}
	.ftxt{display: flex;align-items: flex-start;margin-bottom: 32rpx;flex:0 1 auto;min-width: 50%;
		text{font-weight: bold;font-size: 26rpx;color: #CACACA;flex: 0 0 auto;min-width: 104rpx;text-align-last: justify;}
		view{flex: 1;color: #343434;font-size: 26rpx;margin-left: 20rpx;line-height: 34rpx;}
	}
	.casebtn{padding: 24rpx 0;border-top: 2rpx solid #E6E6E6;
		.ftit{font-weight: bold;font-size: 26rpx;color: #CACACA;flex: 1;
			text{color: $com-cd3;margin-left: 20rpx;font-weight:500;min-width: 104rpx;text-align-last: justify;}
		}
		.lftit{font-weight: 500;font-size: 26rpx;color: #666666;flex:1;
			.lfdet{color: $com-cd3;text-decoration: underline;}
		}
		.zanimg{width: 22rpx;height: 20rpx;margin-right: 14rpx;}
		.staimg{width: 24rpx;height: 24rpx;margin-right: 14rpx;}
		.btn{min-width: 118rpx;height: 52rpx;border-radius: 26rpx;font-weight: bold;flex: 0 0 auto;display: flex;align-items: center;
font-size: 26rpx;margin-left: 26rpx;line-height: 52rpx;text-align: center;padding: 0 32rpx;box-sizing: border-box;
		&.btn1{background: #FFEDED;color: #FF4141;}
		&.btn2{background: #E4EEFF;color: #1D64E2;}
		&.btn3{background: #ECECEC;color: #666666;}
		
		}
	}
}
.fixedbox{position: fixed;left: 48rpx;right: 48rpx;background: #fff;border-radius: 10rpx;top: 50%;transform: translateY(-50%);z-index: 10;padding: 32rpx 40rpx 50rpx;max-height: calc(100vh - 300rpx);overflow: auto;box-sizing: border-box;
	.ftxt{display: flex;align-items: flex-start;margin-bottom: 32rpx;flex:0 1 auto;min-width: 50%;
		text{font-weight: bold;font-size: 26rpx;color: #CACACA;flex: 0 0 auto;min-width: 104rpx;text-align-last: justify;}
		view{flex: 1;color: #343434;font-size: 26rpx;margin-left: 20rpx;line-height: 34rpx;}
	}
	.boxs{min-height: 180rpx;}
	.ttit{position: relative;text-align: center;font-weight: bold;font-size: 36rpx;color: #222327;margin-bottom: 34rpx;}
	.fixedbtn{padding-top: 18rpx;
			.btns{width: 254rpx;height: 80rpx;border-radius: 40rpx;font-weight: bold;flex: 1;
	font-size: 30rpx;display: flex;align-items: center;justify-content: center;box-sizing: border-box;
				&.btn1{color: #1D64E2;border: 2rpx solid #1D64E2;}
				&.btn2{color: #ffffff;background: #1D64E2;}
				.down{width: 26rpx;height: 26rpx;margin-right: 6rpx;flex: 0 0 auto;}
			}	
		}
}
.zdbox{
	width: 52rpx;height: 96rpx;position: absolute;right: 24rpx;top: 0;
	.zdbg{width: 100%;height: 100%;}
	.zdboxa{position: absolute;left: 0;top: 0;right: 0;bottom: 0%;padding-top: 12rpx;
		image{width: 20rpx;height: 20rpx;margin:0 auto 4rpx;}
		view{font-weight: 500;font-size: 20rpx;color: #FFFFFF;text-align: center;}
	}
}
</style>
