<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.sqmyId)">
				<view class="flex">
					<view class="tit overtwo flex1">{{ite.title}}</view>
					<view class="readbox" :class="ite.isRead==0?'btna':'btnb'">{{ite.isRead==0?'已读':'未读'}}</view>
				</view>
				<view class="ftxt" v-if="type!='xxsb'&&type!='swsqmy'">
					<text>上报者</text>
					<view>{{ite.sqmyName}}</view>
				</view>
				<view class="ftxt" v-if="type!='swsqmy'&&type!='tjyx'&&type!='tjzd'">
					<text>主题类型</text>
					<view>{{kaType(ite.topicType,ztlxlist)}}</view>
				</view>
				<view class="flexcw" v-if="type=='swsqmy'">
					<view class="ftxt" >
						<text>刊物类型</text>
						<view>社情民意</view>
					</view>
					<view class="ftxt">
						<text>期刊号</text>
						<view>二十一期</view>
					</view>
				</view>
				
				<view class="ftxt" v-if="type!='swsqmy'&&type!='tjyx'&&type!='tjzd'">
					<text>提交时间</text>
					<view>{{ite.createTime}}</view>
				</view>
				<view class="ftxt" v-if="type=='tjyx'||type=='tjzd'">
					<text>推荐截止日期</text>
					<view>{{ite.categoryName}}</view>
				</view>
				<view class="ftxt" v-if="type=='xxsb'">
					<text>信息状态</text>
					<view>{{ite.isRead==0?'已读':'未读'}}</view>
				</view>
				<view class="ftxt" v-if="type=='swsqmy'">
					<text>批示情况</text>
					<view class="co0b">已批示</view>
					<view class="cof0">未批示</view>
				</view>
				<view class="ftxt">
					<text>进度情况</text>
					<view class="co0b">{{kaType(ite.sqmyProgress,tajdlist)}}</view>
				</view>
				
				<!-- 委员反馈 提案办理 -->
				<view class="casebtn flexc" v-if="type=='xxsb'||type=='xxbl'">
					<view class="ftit">办理状态<text>{{ite.isReply==0&&ite.sqmyProgress!=6&&ite.sqmyProgress!=7?'已反馈':'待反馈'}}</text></view>
					<view class="btn btn3" v-if="ite.isReply==0&&ite.sqmyProgress!=6&&ite.sqmyProgress!=7">已反馈</view>
					<view class="btn btn2" v-if="checkPermi(['sqmy:unit:reply'])&&(ite.isReply!=0||ite.sqmyProgress==6)&&ite.sqmyProgress!=3&&ite.sqmyProgress!=7" @click.stop="getTuiFn(ite,'dffk')">反馈意见</view>
					<view class="btn btn2" v-if="checkPermi(['sqmy:unit:reply'])&&(ite.isReply!=0||ite.sqmyProgress==7)&&(ite.sqmyProgress==3||ite.sqmyProgress==7)" @click.stop="getTuiFn(ite,'dwdf')">反馈意见</view>
				</view>
				<!-- 提案审查 -->
				<!-- <view class="casebtn flexc" v-if="type=='xxsh'">
					<block v-if="!ite.isRecord">
						<view class="lftit">该提案暂未审查立案</view>
						<view class="btn btn1" @click.stop="getTuiFn(ite,'scfk','1')">不予立案</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'scfk','0')">立案</view>
					</block>
				</view> -->
				<!--提案交办  -->
				<view class="casebtn flexc" v-if="type=='xxjb'">
					<block v-if="ite.sqmyProgress==3">
						<view class="lftit">该提案已进行交办，查看<text class="lfdet">交办详情</text></view>
						<view class="btn btn3">已交办</view>
					</block>
					<block v-if="ite.sqmyProgress==2">
						<view class="lftit">该提案暂未进行交办</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'tajb')">交办</view>
					</block>
				</view>
				<!-- 办结审核 -->
				<view class="casebtn flexc" v-if="type=='bjsh'">
					<block v-if="ite.sqmyProgress==6">
						<view class="lftit">该提案已办结，查看<text class="lfdet">办结审核情况</text></view>
						<view class="btn btn3">已办结</view>
					</block>
					<block v-if="ite.sqmyProgress==7">
						<view class="lftit">该提案暂未办结</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'bjsh')">交办审核</view>
					</block>
				</view>
				<!--信息审核  -->
				<view class="casebtn flexc" v-if="type=='xxsh'">
					<view class="ftxt flex1" style="margin-bottom: 0;">
						<text>办理状态</text>
						<view class="co22" v-if="ite.isRecord">已审核</view>
						<view class="co1d" v-else>待审核</view>
					</view>
					<view class="btn btn2" v-if="!ite.isRecord&&checkPermi(['sqmyInfo:info:isRecord'])" @click.stop="getTuiFn(ite,'sfcy')">审核</view>
				</view>
				<!--催办  4(不包含4) 之后 可以催办-->
				<view class="casebtn flexc" v-if="type=='xxcb'">
					<!-- <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=='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 []
			}
		},
		ztlxlist: {
			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"),
			dfflag:false,
			info:''
		}
	},
	onLoad: function() {
	},
	methods:{
		checkPermi, checkRole,
		kaType(ite,list){
			return selectValue(list, 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.sqmyId,
								type:txt,
								sh:sh,
							}
							that.$emit('getTuiFn',obj)
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			}else if(txt=='lmta'&&sh==1){
				uni.showModal({
					title: '确认联名',
					content: "是否确认联名",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var obj={
								id:ite.sqmyId,
								type:txt,
								sh:sh,
							}
							that.$emit('getTuiFn',obj)
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			}else{
				var obj={
					id:ite.sqmyId,
					type:txt,
					sh:sh,
				}
				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;
	.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;}
			}	
		}
}
.readbox{min-width: 110rpx;height: 40rpx;border-radius: 10rpx;font-weight: 500;line-height: 40rpx;
font-size: 24rpx;text-align: center;padding: 0 16rpx;box-sizing: border-box;margin-left: 20rpx;
	&.btna{color: #1D64E2;background: #E4EEFF;}
	&.btnb{color: #FF4E00;background: #FFECE3;}
}
</style>
