<template>
	<view class="point_box" :style="jdflag?'padding-top:100rpx':''">
		<!-- 项目信息 -->
		<uni-collapse  ref="collapse" v-model="value" >
			<!-- :show-arrow='false' -->
			<uni-collapse-item title="节点安排"  class='cldelista'   :border="false" title-border="none" v-for="(ite,idx) in datainfo" :key="idx">
				<template v-slot:title>
					<view class="flexc contentt">
						<view class="flex0 f16 fw cofe">{{ite.year}}年{{ite.month}}月</view>
						<view class="zdlbtn finbtn0" v-if="ite.sfwc=='0'">无状态</view>
						<view class="zdlbtn finbtn3" v-if="ite.sfwc=='1'">未处理</view>
						<view class="zdlbtn finbtn2" v-if="ite.sfwc=='2'">未完成</view>
						<view class="zdlbtn finbtn1" v-if="ite.sfwc=='3'">已完成</view>
					</view>
				</template>
				<view class="content">
					<!-- 操作按钮 -->
					
					<view class="contenta flexcj">
						<view class="tit">责任单位</view>
						<view class="txt">{{checkstring(ite.fgwJdapZrDwList)}}</view>
					</view>
					<view class="contenta flexcj">
						<view class="tit">协同单位</view>
						<view class="txt">{{checkstring(ite.fgwJdapXtDwList)}}</view>
					</view>
					<view class="contenta flexcj">
						<view class="tit">具体内容</view>
						<view class="txt">{{ite.jdannr}}</view>
					</view>
					<view class="contenta " v-if="ite.fgwJdapFjList&&ite.fgwJdapFjList.length">
						<view class="tit mb8">附件</view>
						<view class="txt flexcj cldelistbf mb10" v-for="(fite,fidx) in ite.fgwJdapFjList" :key="'fj'+fidx">
							<view class="flext f16 c6">
								<view class="imgl">
									<image :src="wimg" ></image>
								</view>
								
								<view class="lh22">{{fite.fjName}}</view>
								</view>
							<view class="flexc f16 co28 flex0" @click="getDown(fite.path)">
								<image :src="downimg" class="imgr"></image>
								预览</view>
						</view>
					</view>
					<!-- <view class="contenta flexcj">
						<view class="tit">督办等级</view>
						<view class="txt">{{ite.dbdj}}</view>
					</view> -->
					<view class="contenta flexcj">
						<view class="tit">要求完成时间</view>
						<view class="txt">{{ite.jdsj}}</view>
					</view>
					<view class="contenta flexcj">
						<view class="tit">审核结果</view>
						<view class="txt">
							<text v-if="ite.shjg==0" class="c6">待审核</text>
							<text v-if="ite.shjg==1" class="co26">已通过</text>
							<text v-if="ite.shjg==2" class="cof1">未通过</text>
						</view>
					</view>
					<view class="contenta flexcj">
						<view class="tit">审核意见</view>
						<view class="txt">
							{{ite.shyj}}
						</view>
					</view>
					<view class="contenta flexcj" v-if="ite.sfwc=='3'">
						<view class="tit">完成时间</view>
						<view class="txt">{{ite.updateTime}}</view>
					</view>
					<!-- <view class="contenta flexcj" v-if="ite.sfwc=='2'">
						<view class="tit">已超期天数</view>
						<view class="txt flexc">{{ite.cqts}}天
							<view class="zdlbtn"  :class="{
								btn1:ite.type==1,
								btn2:ite.type==2,
								btn3:ite.type==0,
							}">{{getfgwch(ite.type)}}</view>
						</view>
					</view> -->
					
					<view class="rate_top" v-if="jdflag">
						<!-- 上报人汇报进度 未完成-->
						<view class="rate_topl" v-if="checkPermi(['fgw:jzqk:add'])" @click="getHuiFn(ite)">
							<image :src="hbimg" class="limg"></image>
							<text class="co28 fw">汇报进度</text>
						</view>
						<!-- 管理员 未完成-->
						<view class="rate_topl" v-if="checkPermi(['fgw:jdap:jdcb'])&&ite.sfwc!='3'&&ite.shjg==1" @click="getCbFn(ite.id)">
							<image :src="cbimg" class="limg"></image>
							<text class="cofe fw">一键催报</text>
						</view>
						<view class="rate_topr"  @click="getoperateFn(ite)">
							<image :src="czimg" class="limg"></image>操作
						</view>
					</view>
				</view>
			</uni-collapse-item>
		</uni-collapse>
		
		<view class="bgbox" @click="getClose" v-if="moreflag"></view>
		<view class="more_fixed" v-if="moreflag">
			<view class="more_fixedt">
				<view v-if="checkPermi(['fgw:jzqk:list'])" @click="getjzqklistFn" >查看汇报进度</view>
				<view v-if="checkPermi(['fgw:jdap:jdsh'])" @click="getjdShFn" >审核</view>
				<!-- <view v-if="checkPermi(['fgw:jdap:query','fgw:jdap:edit'])&&(roles=='common_fgw'&&shjg!=1)" @click="getPutFn">修改</view>
				<view v-if="checkPermi(['fgw:jdap:remove'])&&(roles=='common_fgw'&&shjg!=1)" @click="getDelFn">删除</view> -->
				<!-- 普通用户 -->
				<view v-if="checkPermi(['fgw:jdap:editf'])&&shjg!=1" @click="getPutFn">修改</view>
				<view v-if="checkPermi(['fgw:jdap:removef'])&&shjg!=1" @click="getDelFn">删除</view>
				<!-- 管理员 -->
				<view v-if="checkPermi(['fgw:jdap:edit'])" @click="getPutFn">修改</view>
				<view v-if="checkPermi(['fgw:jdap:remove'])" @click="getDelFn">删除</view>
<!-- () -->
			</view>
			<view class="more_fixedb" @click="getClose">取消</view>
		</view>
	</view>
</template>

<script>
	import { selectDictValue } from '@/utils/common.js';
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	export default{
		props:{
			datainfo:{},
			fgwchlist:{},
			jdflag:{
				type:Boolean,
				default () {
					return true
				}
			}
		},
		data(){
			return{
				upimg:require('@/static/images/index/up.png'),
				wimg:require('@/static/images/index/wicon.png'),
				downimg:require('@/static/images/index/down.png'),
				hbimg:require("@/static/images/new/index/hbpoint.png"),
				cbimg:require("@/static/images/new/index/cbpoint.png"),
				czimg:require("@/static/images/new/index/czpoint.png"),
				value:[],
				valuetwo:[],
				fgwchlistes:[],
				content: '折叠内容主体，可自定义内容及样式，点击按钮修改内容使高度发生变化。',
				moreflag:false,
				checkid:'',
				checkite:'',//选择的数据
				roles:this.$store.state.user.roles[0],
				shjg:'',//审核结果
			}
		},
		mounted() {
			this.fgwchlistes=this.fgwchlist;
		},
		methods:{
			checkPermi, checkRole,
			getClose(){
				this.moreflag=false;
			},
			getoperateFn(ite){
				this.checkid=ite.id;
				this.shjg=ite.shjg;
				this.checkite=ite;
				this.moreflag=true;
			},
			getjdShFn(){
				this.moreflag=false;
				this.$emit('getjdShFn',this.checkid)
			},
			//催报
			getCbFn(id){
				var that=this;
				this.moreflag=false;
				 uni.showModal({
				 	title: '确认催报',
				 	content: "是否确认催报",
				 	cancelText: '取消',
				 	confirmText: '确认',
				 	success: function(res) {
				 		if (res.confirm) {
				 			that.$emit('getCbFn',id)
				 		} else if (res.cancel) {
				 		}
				 	}
				 }); 
			},
			//汇报
			getHuiFn(ite){
				this.$emit('getHuiFn',ite)
			},
			// 查看汇报进度
			getjzqklistFn(){
				this.moreflag=false;
				this.$emit('getjzqklistFn',this.checkite)
			},
			getDown(url){
				this.$emit('getDown',url)
			},
			getPutFn(){
				this.moreflag=false;
				this.$emit('getPutFn',this.checkid)
			},
			getfgwch(data){
				return selectDictValue(this.fgwchlistes, data);
			},
			checkstring(e){
				var newArr=[];
				e.forEach((ite,idx)=>{
					newArr[idx]=ite.deptName
				})
				return newArr.join(',')
			},
			getDelFn(e){
				var that=this;
				this.moreflag=false;
				 uni.showModal({
				 	title: '确认删除',
				 	content: "是否确认删除",
				 	cancelText: '取消',
				 	confirmText: '确认',
				 	success: function(res) {
				 		if (res.confirm) {
				 			that.$emit('getDelFn',that.checkid)
							
				 		} else if (res.cancel) {
				 		}
				 	}
				 }); 
			},
			
		}
	}
</script>

<style lang="scss" scoped>
// .point_box{padding-top: 100rpx;}
.cldelista{
	border-bottom: 2rpx solid #E5E5E5;
	&:last-of-type{border-bottom: none;}
	.contentt{padding:48rpx 28rpx;
		.cldelistz{display: flex;align-items: center;justify-content: flex-end;
			image{width: 26rpx;height: 20rpx;margin-left: 20rpx;transition: all .5s; }
			&.act{
				image{transform: rotate(-180deg);}
			}
		}
	}
	.content{padding: 0rpx 28rpx 40rpx 28rpx;}
	.contenta{padding: 22rpx 0;
		.tit{font-size: 32rpx;font-weight: bold;color: #343434;flex: 0 0 auto;margin-right: 20rpx;}
		.txt{font-size: 32rpx;color: #666666;}
	}
	&.cldelistb{padding: 48rpx 28rpx;
		.tit{margin-bottom: 0;}
	}
	.cldelistbf {
		image{margin-right: 18rpx;flex: 0 0 auto;}
		.imgl{width: 40rpx;height: 44rpx;display: flex;align-items: center;justify-content: center;margin-right: 16rpx;
			image{width: 38rpx;height: 30rpx;}
			}
		.imgr{width: 36rpx;height: 32rpx;}
	}
}
// 操作按钮
.rate_top{display: flex;align-items: center;justify-content: space-between;margin-bottom: 10rpx;
	.rate_topl{height: 70rpx;display: flex;align-items: center;font-size: 32rpx;font-weight: 500;color: #20ACCF;
	.limg{width: 32rpx;height: 32rpx;margin-right: 20rpx;}
	}
	.rate_topr{height: 70rpx;display: flex;align-items: center;font-size: 32rpx;font-weight: 500;color: #1FB9F7;flex:0 0 auto;
	.limg{width: 32rpx;height: 32rpx;margin-right: 20rpx;}
	}
}

</style>